re4_tweaks
re4_tweaks copied to clipboard
Increase ESL limit to FFFF (65535)
Describe the feature you'd like to see added
For you guys that don't know, RE4 only supports saving data from the first 255 entries of each ESL. Entries above 255 can't be read by the game and won't have a proper death flag to them, meaning the entity would respawn on checkpoint.
However, i've seen that it's possible to hex edit indexes on ITA, AEV, and others with bytes up until FFFF. Would it be possible for you guys to increase the reading limit from each .esl from FF to FFFF? I've recently found out that we can create any .udas within the existing St files without crashes and such, so having FFFF amount of esl entries could add infinite possibilities. Not even for enemies alone, but for having more flexibility with traps, explosives, animals, etc.
AFAIK the ESL gets copied into the games GLOBAL_WK
memory, which only has space for 256 entries there... would need to locate all the code spots that reference that part of GLOBAL_WK
and update them to point to our own memory, also think I've seen a lot of code spots that only store an index into that space inside GLOBAL_WK
as an 8-bit byte too, again limiting it to 256 :/
Seems the game itself works around the limit by switching which ESL to read from at certain moments, like r20a reads from a different ESL after you meet up with ashley, thanks to checkEmListNo
checking some game flags and returning a different number.
I wonder if letting it use seperate ESLs per-room could be a way around it? I'm not really sure why it doesn't use that already, are enemies ever able to cross into different areas at all maybe? (or I guess maybe keeping the per-chapter-ish ESL in GLOBAL_WK
could be how they store the state of enemies across rooms...)
i dunno, would it be possible then to add more flags for loading new ESL for specific rooms? that could be a good workaround. like, making so that when entering r150 activate CUSTOM00.esl and it also not interfeering with other ESLs when trying to load emleonXX or omakeXX
I also have this piece of info here from last month about how esl is read:
i'm currently using code from qingsheng to force emleon08 load when entering any map from St0, and it works fine. however, my plan was to use it in the ashley section, right after emleon03 and that gives us a problem, since emleon04 to emleon07 wouldn't load anymore after emleon08 is loaded this game has some sort of priority i guess to esl reading the order goes as emleon00, emleon01, emleon02... emleon07, emleon08, emleon09, omake00, omake01... etc you're not able to load any other esl if the currently loaded is higher in priority.
Man if this works, added a new emleon per map the game will finally revolution. Thats my dream .
Man if this works, added a new emleon per map the game will finally revolution. Thats my dream .
You do know that this is possible with the Companion DLL right?
Yes but not work like intended.I'm thinking in put 255 enemies per map working, as far as i know is not possible, when you put 255 enemies the game starts to disappear the next enemies for the other maps. Also i'm using Qingsheng dll and i'm not working with companion. Do you know a way to do that without the problems?
Sorry, I think there are certain limitations with the game. It was not intended to put hundreds of enemies in the same room. Not sure what can be done.
I managed to find a code in the game that allows live enemy spawn and de-spawns. If this is successful, it may provide good alternative to ESL editing. I'm currently making more tests, but it looks promising.
My code is based on the following function from the game code: EmSetFromList2(). Essentially I recreated it, only with changing enemy position, where it spawns in the room. Internally it calls the other game function, cManager_cEm_::create().
Live Enemy and Item Spawns WIP Demo https://www.youtube.com/watch?v=MrU3StecC3I Also check the video desc.
I will use these features in my mod later. It's open source. In my mod, the code that does this is in the function: CzmEnemyFactory::createLiveEnemy2(). If anyone is interested I can provide more info. Hope that helps.
that's awesome! never thought of the idea of adding enemies in real time. Would you be willing to try what i suggested in #350 ? That's what i'm looking for the most and it'll also surely benefit your mod, especially if you intend to warp around different St folders all the time.
#350 ?
I only know how ESL works but not how ITA/AEV. Is it that what you want to do is for enemies to be saved / loaded with the game save state, i.e. don't keep bringing back enemies that had died?
For that, implementing some kind of extra database system would be needed - like you mentioned, INI files for example ... Setting new enemy properties, positions, h-points etc. ... programmatically, both is easy to do. I'm thinking... someone could create a DLL that serves just that purpose - adds enemies from INI files, based on which room the game is in.
I'm currently looking for a way to identify which game session and which game save the game is in. This is to track which of the added enemies to not bring back on a subsequent room visit or a game-save load. Otherwise, it could all be done on a game session basis - once enemy is killed, it wont be back until the game exit-to-desktop.
If anyone know how game-saves can be tracked, please let me know?