How to find aspect ratio for unreal engine games [CE]

This information should help find aspect ratio for unreal engine games, with AOB pattern.

A section for guides, manuals, and walkthroughs on how to use Cheat Engine functions and advanced features.


Post Reply
J1327
Enchanter
Enchanter
Apprentice Hacker
Apprentice Hacker
Posts: 85
Joined: Mon Jul 25, 2022 5:00 pm
Answers: 0
x 110

How to find aspect ratio for unreal engine games [CE]

Post by J1327 »

What is aspect ratio?
Aspect ratio is your screen value (width divided by height). For short a ratio of the width to the height of an image or screen. For example you have a screen with 1920 x 1080, then you need to divide 1920 from 1080 which as sum is 1.77777777778 , 1.77777777778 is aspect ratio. You can also use CELua/Lua which has functions getScreenHeight() and getScreenWidth() and use those values in the formula to get aspect ratio.
Some unreal engine games don’t support native ultra-wide screen, even it says it kind of does -- for example “3440x1440” -- yet we still can see the black bars. This is there am going to show you how to “fix” black bars in cheat engine. For short Teaching you how to change aspect ratio for unreal engine games.
If you are using cheat engine software,

You have two options :
1# Nop it out it after getting games aspect ratio value.
2# write a script.

Pattern:

F3 0F 11 ? ? ? ? ? F3 0F 11 ? ? ? ? ? 0F ? ? ? ? 48 ? ? ?

image of two different (unrelated to each other) Unreal engine games with nearly same code structure
Image
Image

Attach game process to Cheat engine 7.5 through process picker.

Image

In memory scan
select to “-Win64-Shipping.exe” process only. If game has created multiple processes of same “-Win64-Shipping.exe” try looking for “*.exe” instead.

Image

uncheck Writable and by that leave only GRAY Executable

Image

With given aob pattern from above give search go in cheat engine
You should see starting from 2 up to * addresses (depends on the game)

Image

Mark one of these and press CTRL+D , alternatively press right click on address and select "Disassemble memory region." Memory Viewer window should pop-up.

Image

Scroll UP a bit to see if there is an automated comment "->->ucrtbase.atanf". Take note of code block ending. Right code block should have repeating code block end (repeats two times). If you see that comment… Then you are on the right path, if you don't see "automated" comment ("->->ucrtbase.atanf"), try checking next address from the found list.

BAD:
Image

GOOD:
Image

When you find right code block -- select second “”movss”” -- right click it and select "check who access this opcode" you should see one address, press stop button/

Image
Image

editing address value straight away in this form -- value is unchangeable -- so add address to address list by double clicking. (…) In cheat engine’s address list, select recently added address and right click on -- select "Check what access this address" alternatively press F6.

Image

You should see one opcode/instruction that is accessing recently added address (for this case, to this address accesses/writes only one instruction).

Image

From this point you can press button “Replace” -- What it does – it replaces write instruction to NOP's opcode/instruction aka. No operation. And now you can edit recently added address value. Edit aspect ratio according to your needs. This should fix aspect ratio for some time.

Image
Image
Image


Why for some time. Depending on the game, these steps should be enough -- yet on some games, on scenery change RBX base changes or in more complex situation “code flow” doesn’t go through this code block, so that means recently added address will be null/ineffective – and by that saying. You have two options. You continue repeating these steps or you can write a script for this code block. If you choose to repeat steps then you need to restore original code (to get address of changed games aspect value) to original state and that can be achieved by pressing in cheat engines main form “Advanced Options” button – in this form you can restore opcode to original state by right clicking on red marked address and select “restore original code” next repeat steps from 5 to 10 step. Note if aspect ratio has been reset (or and you can still see black bars), that means code flow have changed elsewhere – check Q|A for more info. To better handle things I recommend in this code block write a script.
Image
Image

In order to write a script, select opcode there you did find after step 5. Thereafter Select Tools -> Auto Assemble (alternatively press [CTRL]+[A] after selecting opcode)
Image
In auto assemble form select Template-> Cheat table framework code – this should fill in essential code for cheat engines script activation (without this step* you can’t activate script).
Image
Image
Next select Template-> Code Injection or AOB Injection.
Now depending on your choice…
Press [Ok] if you selected Code Injection:
Image
Press two times [Ok] if you selected AOB Injection:
Image
this should fill in auto assembler code..
Edit code at original code “”movss [rbx+00000xxx],xmm0”” to “”mov [rbx+00000xxx],(float)2.4”” … afterwards select File-> Assign to current cheat table.. This should go without any errors, and you should see “Auto Assemble script” in address list. Activate script by selecting Box near “Auto Assemble script” and you should see results instantly. Now, whenever code flow goes through here “black bars fix” automatically should apply.
Image
Image
Image
Image
Optionally you can save cheat table.


From:
Image
To:
Image


Q:
I need fix aspect ratio for 1920x1080 UE game, which is default ratio 21:9 (example The Dark Pictures Anthology)
A:
This tutorial should help you. Finding aspect ratio address in that code block – editing value – should be enough.*

Q:
In a different game scene, sometimes aspect ratio resets..
..What if aspect ratio editing doesn't work?
A:
Be aware that RBX base can frequently change even in the middle of cutscene – that is why I recommend writing a script -- for the games I have conquered so far, this code block editing with a script should do the work 50/50. Only few cases there was needed additional scripts to patch things up elsewhere.
Yet if you encounter this.. I have encountered this too,
In special game scene, aspect ratio resets to 16:9, because code flow doesn't go through our edited code block. This is there we need to apply additional patches to the game. So how do you patch things up.
..You need search for 1.777777777777778 and filter out until till least possible to have address found list (approx..200 ) – next try to change all values at once by choosing all (CTRL+A) and then (CTRL+E) for mass edit and see if that helps.Note such a mass editing can cause game crash. If you find right address, check what opcode writes to address – and write a script.

Yet if you have a script written for that block only and you do nothing, after “special” scene (on scene switch..) ends: ratio should rest back to your aspect ratio as well and code flow.

Q:
I Replaced code with nop’s and successfully edited aspect ratio value, but I see still letterbox or black bars.
A:
Try setting a breakpoint and copy RBX address, next open Structure dissect and enter RBX address.. Create a structure in Structure dissect form.. Try to look for float values between 1 to 3 (most common 1.77 for aspect ratio) and edit -- if needed NOP write or and write a script.

Q:
I can use hex editor instead, why should I try this?
A:
Indeed you can -- for example you can try to use HxD Tool to modify *.exe file. Yet, for any mass editing, there is a side-effect or a risk : you will break games strings (text such as subtitles), or game won’t launch/start.

Q:
After editing aspect ratio, I need edit FOV
A:
Static FOV address SHOULD* be in the same code block as and aspect ratio (...). If you scroll up a bit you should see ““Call .exe+?..” ->->ucrtbase.” Double click NEXT instruction : “mulss,[…]”. You should see an opcode editing form. From there select address in the brackets and add it to address list. FOV is in float type as and aspect ratio.

================================


Post Reply