Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the module base address unchanged #201

Closed
qingsheng8848 opened this issue Jun 8, 2022 · 6 comments
Closed

Make the module base address unchanged #201

qingsheng8848 opened this issue Jun 8, 2022 · 6 comments

Comments

@qingsheng8848
Copy link

Describe the feature you'd like to see added

5 F80H3X((4KPQ6TZK39$~B
When we restart the computer, or modify the bio4.EXE file. The module base address of the game will change. As shown in the figure. This limits our modifications to the game EXE file. Is there any way to fix it?

@qingsheng8848
Copy link
Author

In the 2007 version it worked without any issues. We can freely modify EXE files. But not in 2014 version

@emoose
Copy link
Collaborator

emoose commented Jun 8, 2022

You can set the relocations stripped flag which should stop Windows from relocating it, making it stay at 0x400000:
(this is very useful when using IDA to debug, otherwise IDA will spend 5+ minutes relocating every time you debug >.>)

image

@qingsheng8848
Copy link
Author

您可以设置 relocations stripped 标志,该标志应该阻止 Windows 重新定位它,使其保持在 0x400000:( 这在使用 IDA 调试时非常有用,否则 IDA 每次调试时都会花费 5 分钟以上重新定位 >.>)

图片

Ahhh, thank you very much for your answer

@Mister-Curious
Copy link

Mister-Curious commented Dec 9, 2022

Ok so I have some questions, as my friend and I are considering either nerfing, or editing the .reloc table in order to ensure that the edits we create (and share with the public), are no longer reliant on users having the Companion DLL installed. Presently many of our edits do require this, as our present method is to piggyback some of the memory regions used by the Companion DLL.

Now before we go ahead and change a whole bunch of edits to make them more accessible to the public, we wanted to ask @emoose about whether there might be some conflicts or adverse consequences of distributing code that would point to an edited or nerfed .reloc table. Like, would doing this interfere in any way with the functions of the RE4Tweaks DLL? The goal here is to maintain compatibility of our edits with those of the RE4Tweaks DLL.

One more thing that would assist in our tests; could you @emoose send us a copy of the vanilla 1.0.6 bio4.exe with the .reloc table 'stripped from file' (as shown in your photo to Qingsheng above)? You can send me a link DM on Discord or just post it here. That would be super helpful.

Thanks!

@emoose
Copy link
Collaborator

emoose commented Dec 9, 2022

Did you show your friend the post I sent before? That flag & the .reloc edit should work pretty much the same, both should make EXE use the default base addr (0x400000 for RE4) instead of moving it around.

Anything dynamically allocated (like pointers to certain things in memory) would still be placed at random addresses though (.reloc wouldn't affect that neither afaik) - but things that are actually inside the EXE file on your HDD should get put at a static offset.

re4_tweaks should work fine with either method, don't know about other mods though - IIRC companion will complain about game not being 4GB patched if you use this flag though even if the 4GB patch is present, since this flag & 4GB patch both change the same byte.

There is another flag you can set which might work better with companion (OptionalHeader -> DllCharacteristics -> uncheck "DLL can move"), haven't tested that with companion yet but seems to make addr static like the other flag, but if companion still gives a warning with both of them maybe editing .reloc would be better.

Here's a zip with both flags, bio4_flag1 sets the first flag I mentioned (FileHeader -> Characteristics -> "Relocation info stripped"), the bio4_flag2 sets the other one, both have 4GB patch applied too:
bio4-106-relocflags.zip

@Mister-Curious
Copy link

Mister-Curious commented Dec 9, 2022

Here's a zip with both flags

Thanks for all this info, I am sure it will be helpful. I will let you know how things go after we decide which way to go and how it all works out. I'm relieved that it will not interfere with your work!

Peace!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants