Jump to content
Tuts 4 You

Changing the aspect ratio of an older game


darkmb

Recommended Posts

I am trying to change the aspect ratio of an older 32-bit game from 4:3 to 16:9. I have already successfully changed the game's resolution to 4k (3840x2160) (hex - 00 0F 70 08) which is stored in the game's save game file (not the executable). However, there's no aspect ratio information stored in this same save game file. Hence, I am looking for it within the game's executable.

When searching for AB AA AA 3F (4/3 = 1.3333333) using a hex editor I am able to find one match. Changing it to 39 8E E3 3F (16/9 = 1.7777777) does not change the aspect ratio however. It's because I have found that this one match in the entire executable is actually the game's FOV and not the aspect ratio. The FOV of the camera changes as expected when this value is modified. However the game still remains stretched to the 4:3 aspect ratio.

When searching for 1.3333333 as a float exact match using Cheat Engine I am able to find an address and changing it to 1.7777777 changes the aspect ratio as desired. But I can't save the executable with the patch since it seems that Cheat Engine does not have the ability to do so. This address is dynamic however and I can't find it's static equivalent within the game's executable file.

Hence, I am trying to use x32dbg to perform the same change and be able to patch and save the executable with the desired change. I run the game exe, attach it using x32dbg and enter the entry point of the exe after pressing Run twice (menubar at the top shows game's exe). However, I am unable to find this 1.3333333 value or AB AA AA 3F using x32dbg while the game is running (which I can find using Cheat Engine float exact match).

I was wondering if someone would be able to guide me in the right direction.

I presume that the game derives this 4:3 (1.3333333) value in some other fashion than the standard method of specifying it directly as AB AA AA 3F and that's why it's not present in the game's exe as a direct match for it's hex value equivalent. However, since I am able to produce the desired result using Cheat Engine when the game is running is there a way using x32dbg to patch the game's executable permanently to change this aspect ratio value from AB AA AA 3F to 39 8E E3 3F?

Below is a snip from Cheat Engine's disassembler. After changing the AB to 39, AA to 8E, AA to E3 (AB AA AA 3F -> 39 8E E3 3F)I am able to change the aspect ratio of the running game to 16:9 as desired, however I can't patch the executable permanently using Cheat Engine and hence I am trying to achieve the same using x32dbg but cannot find the same disassembled output when the game is being run.

Capture3.PNG

Edited by darkmb
Link to comment

Using Cheat Engine disassembler when trying to find what writes or accesses this address where the floating point aspect ratio of 1.333333373 is stored at it shows the following instruction.

Count      Instruction

1846        00907BCE - 8b 40 0C - mov eax,[eax+0C]

982          FFFFF8012FB99FC4 - F3 A4 - repe movsb

-------------------------------------------------------------------------------

Cricket2005.exe+507BCE:

00907BC7 - 8B C8 - mov ecx,eax

00907BC9 - E8 3677DDFF - call Cricket2005.exe+2DF304

00907BCE - 8B 40 0C - mov eax,[eax+0C] <<

00907BD1 - 89 45 F4 - mov [ebp-0C],eax

00907BD4 - 8B 45 A0 - mov eax,[ebp-60]

EAX=03F693B4

EBX=0019FC2C

ECX=03F693A0

EDX=3E99999A

ESI=0019F60C

EDI=0019F438

ESP=0019F43C

EBP=0019F694

EIP=00907BCE

With the instruction mov eax,[eax+0C] it seems that the code is trying to move contents of a memory address into a register.

I was able to find the instruction in x32dbg and followed it in dump. I am not sure though what steps to follow next though to make the change permanent.


Capture7.PNG

Edited by darkmb
Link to comment

There isn't enough space for storing the value directly:
00907BCE - 8B 40 0C - mov eax,[eax+0C] <<
00907BD1 - 89 45 F4 - mov [ebp-0C],eax

You should find some free space (00 bytes) in the executable:
at 00907BCE: jmp "free space"
at free space:
mov eax, value
mov [ebp-0C],eax
jmp 00907BD4
 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...