Introduction to the Companion DLL
Aug 12, 2020 13:14:39 GMT 10
HisBoyfriend, DeⓧiaZ, and 16 more like this
Post by Mr.Curious on Aug 12, 2020 13:14:39 GMT 10
Introduction to the Companion DLL
It should be noted that there is a more updated version of this tutorial and all those in this thread which can be seen HERE. A full list of updated tutorials in Google Doc format can be seen HERE.
So there has been a small uptick in the amount of interest in stage modding in the last few months, and in particular, a lot of questions coming from the community about how to use Raz0r's Companion DLL. Since I helped develop/implement/test many of the features of this DLL I am essentially now the only person who can explain how to use many of the features, so I feel that it is my responsibility to share the knowledge I have in Raz0r's leave of absence.
In this thread I will create several tutorials about the functions of the DLL. In this initial post I will describe the needed files for using the DLL:
REQUIREMENTS
1 - You will need a legitimate copy of the game that launches through Steam. There is no way to use with a pirated version of the game
2 - You will need a copy of the public version of the DLL that can be downloaded HERE (you may need to create a NexusMods account to download anything).
3 - You will need a copy of the BIO4.exe 1.0.6 version of the game which can be downloaded HERE this already has the 4gb patch applied so there is no need to patch it. If you are going to use your own version of the exe it must be version 1.0.6 and should be patched with the 4gb patch for all functionality to be usable.
INSTALLATION INSTRUCTIONS
Download the DLL files from the link above and place the files dinput8.cfg and dinput8.dll in your Bin32 folder of the Resident Evil 4 directory.
Place the FILES folder in the Resident Evil 4 directory (same directory as BIO4, Bin32).
* Note about conflict with RE4Tweaks DLL*
With the development of another amazing project, the RE4 Tweaks provides a DLL that uses the same name as the Companion DLL. If you use RE4 Tweaks you will notice both mods use the same "dinput8" name. In this case, for them to work together, rename RE4 Tweaks's files to either "winmm" or "xinput1_3". If you have crashes with the inventory while using both DLL's, be sure to set RaiseInventoryAlloc = False in the RE4 Tweaks .ini file.
OVERVIEW OF FUNCTIONS
How does this work?
It works by overriding existing files in memory - files are loaded for each room independently. This means that you cannot load files if a particular room doesn't have them. If you wish to load textures/room files for all rooms place them into MAIN folder. Override files in MAIN by placing files with the same names into named room folders.
What can this .dll do?
- Load movies with sizes up to 500 MB;
- Fix wrong aspect ration when playing movies;
- Swap dropped items;
- Swap enemies;
- Load textures/files;
- Allocate more RAM for certain stuff(stage files, textures, enemies etc);
- ss_pzzl.dat file can be up to 32MBs in size;
- 32MBs of memory for player .udas and up to 16MBs for weapon .udas, 8MBs for vertex data,
allowing to have around 55k polygons for player model and more than just 255 vertex bone/weight entries;
- Player/Enemy models do not disappear when a certain poly limit has been reached;
- Enemy table has been increased in size to hold more than 4 .udas entries;
- Less limits when combining enemies. Incompatible enemies can be spawned with 01 flag
(village ganados + zealots or army ganados). Other enemies don't seem to have issues when
combined with one of the aforementioned types. TotalPolygonsOnScreenFix is used to enable/disable it;
- Gray screen overlay fix is also included;
- Hookshot is included;
- Zip line is included;
- Press F8 when in-game to see coordinates/stage name/fps overlay. Also works with RE4 2007 1.1.0 European version;
- Press F1 when in-game to remove the grain filter;
- Load modded files without having to rename .lfs to something else(non-lfs files have priority over lfs files)
DINPUT8.CFG
TotalPolygonsOnScreenFix - show more polygons on screen, people with slow machines should set this to false;
LoadStageFilesTexturesItemsConfigs - side-load stage files from STAGE folder as well as .cfg files(itemsswap,itemdrop,effects.conf);
LoadESLFiles - side-load .esl files from EM folder;
LoadEVDFiles - side-load EVD files;
LoadTexturesFor120 - side-load textures for r120. Loading textures for this room is buggy and unreliable;
VIDEO_RESOLUTION - override video res to prevent it from stretching it. Leave as is;
ResetOrder - resets the order of how .esl files are loaded;
SkipEndScreen - skips the chapter end screen;
Adjust_FPS_To_Speed_Ratio - for machines that cannot sustain solid 60 FPS all the time this option dials it back to 30 FPS, then back to 60;
SkipRadio - skip radio cutscenes. Skipping the very first radio call after the r120 cutscene will freeze the game(not the one in the cabin or any other call)
FlameThrower - converts TMP to flamethrower. Needs a proper model/anims - same as RE5 Boss Jill Dual-wielding mod.
No_Ashley - disables Ashley for a specific stage, e.g.: r310 = true
HOOKSHOT folder:
Nothing interesting about it, just animations, models, textures and tpl files.
Can be disabled by moving it out of FILES and completely restarting the game.
ZIPLINE folder:
Loads animations, textures and models for it. Create a config(according to the stage you want, let's say r400.conf).
PHYSICS.CFG
This files is used to swap physics of the characters, similar to what's available in the Ultimate Trainer(note: this option is disabled in the trainer when this dll is used).
STAGE folder
MAIN folder - MAIN folder is a master folder - files in this folder are loaded for all rooms.
Create a named room folder insde this MAIN folder (let's say r101) to override any file(s) in MAIN.
AMMO folder:
Allows to load different icons for inventory items. The folders should start with item_ and id of the item in hex should be appended, e.g.
itm_1a, itm_4, itm_20 etc. config.cfg is used to specify the properties of the icon - how many cells it takes up, as well as adjusting it's position.
.bin and .tpl files should be named as 000.bin and 000.tpl.
EVD folder
MAIN folder - MAIN folder is a master folder - files in this folder are loaded for all rooms.
Create a named room folder (let's say r101) to override any file(s) in MAIN.
WPN_AMMO:
Allows to limit max ammo for any gun. Create a file wpn_XX.cfg where XX is an ID of a gun in hex.
File naming:
STAGE files should be named in this style:
0000.LIT, 0001.LIT, 0000.CAM, 0000.SMD, 0001.SMD - up to 000F (16 files of each type, except .SND - only single file).
Textures:
Place any .pack file(s) into TEXTURES folder. (i don’t think pack.yz2 files work)
Additionally, HD and SD folders can be created to load HD or SD textures depending on the option selected in the game.
It should look like the following: FILES\STAGE\r100\TEXTURES\DEADBEEF.pack.
TEXTURES folder in MAIN and named room folders follow same rules as other files.
You texture packages should be named exactly as in .TPL files.
Important Note about side-chaining pack files:
For unknown reasons, the Companion DLL will not sidechain certain pack files that use certain names. For example, the game will hang if we try to side-chain any of the enemy pack files (000000xx.pack). Feel free to experiment what works, but it should be noted that certain names just don’t work. Also VERY IMPORTANT:
WHEN SIDE-CHAINGING CUSTOM PACK FILES THE COMPANION DLL WILL CAUSE MEMORY LEAKS
For unknown reasons the Companion DLL causes a memory leak when using custom side-chained .pack files. I have created a short video explaining the phenomenon and how to fix it HERE.
Loading:
Files can be loaded and unloaded almost on-the-fly - copy/delete files and restart if in-game.
Textures are truly loaded on-the-fly - copy a .pack file into TEXTURES folder and it'll be instantly loaded.
To remove a specific texture .pack file move or delete it from TEXTURES folder and restart if in-game.
Configs for STAGE folder:
enemy_swap.ini - allows to swap enemies;This option swaps Enemy with Replace_with Count times (count is how many enemies will be replaced before the group is discarded).Setting outfit, health, replace_outfit_with, replace_health_with values to 0xFF makes it apply changes to any enemy with a matching ID.
evd2video.cfg - play video instead of EVD events or play movies when at certain position;
effects.conf - effects, right now only rain works;
itemdrop.cfg - adds more items that enemies can drop;
itemswap.cfg - swap items that enemies drop;
events.cfg - AEV events - Allows you to have up to 10 lock AEV events in every room(when doors need a certain key to unlock them). Item id and event index should be the same as in .AEV files.
EM files:
Master file - r0000.esl is loaded for all rooms. Named esl files are loaded for a particular stage.
Chapter .esl files:
VillageDay.esl
VillageNight.esl
CastleBeginning.esl
CastleMainHall.esl
CastleDragonRoom.esl
CastleBelowPit.esl
IslandBeginning.esl
IslandAfterTruck.esl
SWBeginning.esl
SWChiefsHouse.esl
SWCastleMaze.esl
SWCastleTunnel.esl
SWCastleOutside.esl
For example, VillageDay.esl is loaded for the following rooms:
r100,
r101,
r103,
r106,
r104,
r107,
r105,
r102,
r108,
r109,
r10a,
r10b
ESL_MODE folder:
.esl files enabled in esl.conf are loaded instead of the original .esl files.
ESLX corresponds to .esl file number.
.esl files in this format "r400.esl" should be placed into ESLX folder and enabled in esl.conf.
There will be more in depth tutorials that follow this first thread, but are not ready at this moment. Please be patient until those reserved threads are populated with the tutorials.
Happy Modding!