I've compiled some of the most common reasons for crash while I was modding. Hope this can be useful for someone.
C00 - Image Pack (Missing)
Cause: The game calls a .pack file that is not present.
Fix: Restore the file back to the its directory BIO4\ImagePack or ImagePackHD.
C01 - Image Pack (Missing Texture)
Cause: The .pack file exist, but the game calls a texture that is not present. So the last texture number in the .pack is lower than the texture called. This is very common when we add new models to the SMD, but forgot to update the pack.
Fix: Ensure the texture is present in the .pack.
Troubleshoot: Drop a lot of empty textures after the last one, up to a high number like 0500. Most rooms go up to 150 ~ 300 textures so it can do the trick. I've made a set of null textures that can be useful, you can download them here.
*If even with the additional textures the game keeps crashing, then it's another type of crash like bad TPL.
C02 - TPL (Corrupted)
Cause: The TPL got corrupted during SMD repacking. This TPL should be discarded.
Fix: Get the original TPL, or the last good one, and repack all the way to the problematic model.
Troubleshoot: Add one texture at once, and be careful with opacity map as it can also broke the tpl, as 2 new textures will be processed at the same time. The size of TPL should not increase after the second (testing) repack. What I mean by that is to make the 1st repack, then place the texture in the .pack, and check in-game.
If everything looks right repack SMD again, just to check. After this 2nd repack, if for any reason it increases its size, discard this TPL and get a older good one, and do the process again. Make constant backups of the TPLs after adding each new model.
C03 - TPL (BIN, EFF, ETM, ITM, SMD, TEX)
Cause: The tpls inside it are pointing to a .pack file, that is not beign loaded at the moment.
*For example r101 will load only 44000101 and so on, if the tpl is not pointing to the room pack, or some pack that is always loaded (UI, Font,etc), then it is likely to crash.
Fix: Reference a valid .pack in the tpls and repack it.
*You can also quickly fix it using hex, just type the current .pack in little endian and replace for the new one for example:
02 01 00 44 to 1f 01 00 44 would change the .pack from r102 to r11f.
*For Imagepacks the game can even load and sustain for a few seconds, while it spam errors in the log, before crashing completely.
C04 - SMD Scripted Entries Flag 9 (Missing)
Cause: Some entries cannot be removed from the SMD repack, as the game still calling them by scripts.
Fix: Restore the deleted entries (The ones with number 9 Flag in the last offset).
*Don't remove entries without knowing what they do, alternatively you can set the scale to zero in order to prevent the model to be shown in-game, and null the bin to save disk space.
C05 - SMD Scripted Entries (Order)
Cause: New entries were added before scripted ones, thus affecting the order of these entries that may fail to be triggered.
Fix: Add the new entries at the bottom of Modeldata.txt, never on top of existent entries.
C06 - SMD Scripted SMX ID
Cause: The referenced SMX ID from an scripted entry in Modeldata.txt was changed.
Fix: Use the original SMX ID of the SMD entry.
*In r100 this is very common, if such entries don't match the right SMX ID the game closes instantly.
C07 - SMD Size
Cause: The SMD gets to big due to the new geometry added.
Fix: Remove unnecessary geometry and keep it under the size where the crash start to happen.
C08 - SMD DAT Size
Cause: The DAT files from r100 got too big in size due to the geometry added. The game may start:
- Failing to load the room.
- Failing to trigger cutscenes.
- Failing to save.
- Saving but failing to load the same save.
- Loading the room and saving, but if checkpoint is restarted, or a green door is used, Leon spawns in the center of the map at 0 XYZ coordinates.
Fix: Keep the size of the .dat files small.
*This is related to r100 only, but if this room is cloned with proper rxxx_xx.dat files, the same side effects can happen even though the room number is different.
*Another thing to take in consideration, is that these issues appear gradually. Depending on the size, it can be something subtle like failing to trigger an EVD (after 1st ganado) to simply crashing when loading the room.
C09 - SMD (Facing Direction)
Cause: During the first load of a room, too many models are in our FOV and the game can't handle it.
Fix: Edit the door warp AEV to spawn Leon facing another direction. If that's not possible try moving the new models to the opposite direction when entering the room for the first time.
Troubleshoot: To make sure it's not size or poly count related, try loading the room facing the opposite direction. It's recommended to also use a LIT with near fog and short draw distance.
*In general the game can handle the geometry after the room is completely loaded, but not during the first load if the models are in front of Leon or in range.
It's not the same type of crash or directly related to Poly count limit, but tends to appear only when a lot of geometry is present.
C10 - Poly Count Limit
Cause: Too many polygons appear on screen at the same time.
Fix: Remove part of the geometry by optimizing it, or use a LIT with shorter draw distance. Lowering the FOV by the CAM file also helps.
*We can have this issue even with a small size SMD, just adding lots of entries of multiple objects, it will hit the limit at some point. This is not related to SMD size but the number of objects on screen.
This limit can also be reached using any models like EM, ETM, ITM, etc. It's not something related to SMD only.
C11 - INIT Instructions
Cause: The room is missing the dependencies of the referenced instruction.
Fix: Add all the missing dependencies from the room that is being ported.
C12 - EFF (EM, Core udas, etc)
Cause: The effect count was lowered, so effects were cut from the eff, when the game calls these critical effects they are not present.
Fix: Restore the missing effects.
C13 - Memory Limit
Cause: The game hits the 3,5 GB of memory limit.
Fix: Keep the usage bellow the 3,5 GB limit, reduce the size of textures, smd, and other side-loaded files.
*Opening Inventory, the Key Items Screen, and the Files Screen can result in peak spikes, so the room must have some 150 mb~ of headroom to avoid instability from my experience.
Running close to 3,5 gb may result in crash when opening Inventory and other interactions like locked doors, examining files etc. So it's not ideal.
Try using smaller textures, and less demanding stuff. Disable settings you don't use in DLL Companion and Re4 Tweaks as it also increases memory usage.
C14 - XSB and XWB (Missing)
Cause: The room/foot audio files are not present.
Fix: Add/restore proper room and foot audio files for the room you are creating.
C15 - EM (Missing)
Cause: The game calls scripted enemies that ate not present in the ESL, or were modified.
Fix: Restore the original entries. Don't side-load EM for certain rooms like r100.
*Sometimes even changing the type of an enemy can cause a crash, if it is scripted.
C16 - FCV (Missing)
Cause: The game calls a FCV that is not present.
Fix: Restore the original file.
C17 - AEV ITA (Enemy Spawn)
Cause: The 2nd part of the code is installed.
Fix: Install only the 1st part.
*This is not a actual fix, but it made my game stop crashing while the enemies can still be triggered normally. May affect something else idk. Not sure if I installed the code the right way though.
C18 - AEV FSE (Vase Break)
Cause: I think part of the AEV FSE code was causing the issue every time a vase is broken.
Fix:
*I forgot and probably lost the code, when restored back to vanilla stopped the crash for me.
Freezes
F01 - Infinite Loading
Cause: Some file is missing, most of the times the stage .udas is the reason.
Fix: Check the integrity of the game files, restore missing files.
F02 - White Screen Boot
Cause: The game has a modification (by Mr Curious and Anonymous User) in the bio4.exe that is calling an additional BGM file that is not present.
Fix: Go to the offset of the modification and null the path, or get a .xsb and .xwb and rename them to the same name set in the .exe.