argonlefou / Hotd3pc_ArcadeMod

Launcher to run an 'Arcade' version of game, from the Windows game
19 stars 1 forks source link

Hexediting the exe for widescreen and higher resolution breaks compatibility #8

Closed RiasatSalminSami closed 5 months ago

RiasatSalminSami commented 6 months ago

I had been adding custom resolutions [like 3840x2160, 3840x1638] and also changing the FOV [aspect ratio] by hexediting the exe.

WSGF tutorial: https://www.wsgf.org/dr/house-dead-iii/en

But this makes the launcher not able to start the game at all.

There are some workarounds for having higher resolution, like using DgVoodoo2 to force the game to render in higher resolution. This works well but DgVoodoo2 in itself causes the game to have framerate drops, which is not ideal. And changing the aspect ratio is still impossible since that requires hexediting the exe.

argonlefou commented 5 months ago

What is the md5 checksum of your hod3pc.exe file ? (Original or cracked, but unedited for resolution/FOV)

RiasatSalminSami commented 5 months ago

What is the md5 checksum of your hod3pc.exe file ? (Original or cracked, but unedited for resolution/FOV)

b8af47f16d5e43cddad8df0a6fdb46f5 (Downloaded and tested on this crack)

and

e4819dcf2105b85a7e7bc9dc66159f5c (This is the default exe on my game disc. If I play this way, I have to put the cd on my disc drive to boot the game)

So I've tested 2 different exes, same outcome on both.

argonlefou commented 5 months ago

Thanks

For further testing, I'd advise to use the following exe : b8af47f16d5e43cddad8df0a6fdb46f5

The other one (e4819dcf2105b85a7e7bc9dc66159f5c) is - as far as I know - the only one wich is totally different than all the others and needs specific memory addresses for patching.

The launcher will try to find a config filename matching the exe md5, which only exists for the later. For all the other ones, the launcher will fall back to the default shared values.

As a consequence, using the e4819dcf2105b85a7e7bc9dc66159f5c exe and hex editing it would change its md5 checksum, and the launcher will not find the matching config file anymore and will use the default memory values which will not work -> crash

Now, that beeing said, this doesn't explain the issue with the b8af47f16d5e43cddad8df0a6fdb46f5 exe

Could you post some kind of diff file, or a list of all the changes you made (and the resulting md5) so that I can hex edit the binary in a similar way and test it

RiasatSalminSami commented 5 months ago

@argonlefou I will make a detailed instruction/ video later but the quick steps are as follows:

It's going to be a little tricky since changing hex values will depend on what aspect ratio and resolution you want to target. However, first we must focus on changing the aspect ratio only. For this:

  1. Open the hod3.exe with any hexeditor (I have used HxD hex editor in this case).
  2. Search for all the instances of AB AA AA 3F (There should be 4 instances). This is the aspect ratio value for 4:3. We will replace all of them with values for different aspect ratios:
  3. For 16:9 -->39 8E E3 3F For 16:10 --> CD CC CC 3F For 21:9 --> 55 55 15 40
  4. Save the exe and aspect ratio will change to your target aspect ratio.

If you replace AB AA AA 3F with 39 8E E3 3F, then the resulting md5 is e40c58afc06dfbc8ae8aafa459e43310.

Also some extra info regarding modifying aspect ratio: The gun cursor will get misaligned .

To find hex values for any aspect ratio or resolution, I opened windows calculator and divided the horizontal res with vertical res (For ex: 16/9 = 1.777777777777778. I put that value in Decimal representation in IEEE 754 calculator [https://www.h-schmidt.net/FloatConverter/IEEE754.html], then look for the hexadecimal representation. In this case the value was 3f e3 8e 39. But it's in reverse order, so my desired value is actually 39 8e e3 3f. You can calculate the hex values for any aspect ratio using this method. Credits: WSGF)

argonlefou commented 5 months ago

So, I patched the 4 values in the exe for a 16/9 display ratio and obtained the E40C58AFC06DFBC8AE8AAFA459E43310 exe.

Tried to load it with the ArcadeMod launcher, no issue to report (starting and running fine)

RiasatSalminSami commented 5 months ago

So, I patched the 4 values in the exe for a 16/9 display ratio and obtained the E40C58AFC06DFBC8AE8AAFA459E43310 exe.

Tried to load it with the ArcadeMod launcher, no issue to report (starting and running fine)

Sorry, looks like I'm managing to boot the game now with the cracked b8af47f16d5e43cddad8df0a6fdb46f5 exe as well. No idea why it did not boot the first time.

The other exe from my actual disc is not working if I hex edit (Retested it multiple times today). But I think the issue can be considered solved since the issue seems to only stem from this particular release of the game like you mentioned before. I will try to test other exes too if I can get my hands on those copies but at the moment b8af47f16d5e43cddad8df0a6fdb46f5 is confirmed to work with both aspect ratio edits and with resolution edit.

For resolution edit, I changed 80 02 00 00 C7 86 04 01 00 00 E0 01 (640x480) to 00 0F 00 00 C7 86 04 01 00 00 70 08 (3840x2160) and it's working. I test with other resolution and aspect ratio combinations.

Thanks for helping me 👍🏻

argonlefou commented 5 months ago

Thanks for the feedback

As for your other binary, the non working one, you can try the following solution to make it work :
1) Mod it as you want with Hxd 2) Get the exe MD5 3) Go to the ArcadeLauncher folder, under the MemoryData directory 4) Make a copy of e4819dcf2105b85a7e7bc9dc66159f5c.cfg and rename it after your targeted exe MD5 in step 2: [MyMd5Hash].cfg You may have to create the filename with lowercase only characters, I don't remember if I'm case sensitive when I try to find the config file matching the MD5 check with the loader

5) run the Launcher, it should start succesfully