Jump to content

Tutorial for creating widescreen fixes


Recommended Posts

So, I've noticed nobody talks about modding old games here, so I'll break the tradition. Many people know old games have many issues running on newer monitors with aspect ratios different from what they used to be designed for, like 4:3 and 5:4, including no support for any kind of widescreen or wider resolutions, or when they do, they have a fixed field of view or it gets reduced with a wider resolution. Many old engines have the option to set a widescreen resolution, but just don't expose it to the user through the in-game settings, so editing through the Registry or external .ini/.cfg/.xml files or other similar kind of files might be needed.

Usually when it's not possible to edit settings through external files or through Registry, it's needed to edit executables or other files around it directly (usually it can be DLLs, but not only), usually by using softwares that can edit the code in those files in hexadecimal form, like the so-called hexadecimal editors, or hex editors for short.

HOW OLD GAMES STORE VALUES

RESOLUTION

Usually old games use 4-byte integers to store resolutions, so say a game supports 640x480, 800x600, 1024x768 and 1280x960. Each of those resolutions are stored as pairs of two 4-byte integers as hexadecimal numbers, so it means 640x480 is stored as 80 02 00 00 (640) and E0 01 00 00 (480), it might be represented in the file either one after the other (80 02 00 00 E0 01 00 00) or even inverted (E0 01 00 00 80 02 00 00), or even separated by other non-related bytes.

Beware that not all games allow setting a custom resolution due to rendering API or engine's memory limitations, those limits might be hardcoded in certain files and might not be easy to fix those issues without experience.

ASPECT RATIO

For the aspect ratio, games might use a separate value to determine the aspect ratio or it might be tied with the resolution, it varies for every game. Usually games store aspect ratio just by dividing width by the height, so usually it might be 4:3, 5:4 or 3:2 (the values are 1.333333, 1.25 and 1.5 respectively). Although, some engines might determine aspect ratio from a multiplier, it can be a floating point number like 0.5, 0.55, 0.6, 0.75, 0.8, 1,0, or even a higher number like 20, 25, 30, 35, etc.

FIELD OF VIEW

For field of view, games usually either determine it from the aspect ratio, or might use a separate and different value for it, by using multipliers like 0.25, 0.5, 0.75. 1.0, setting it in degrees (60º, 65º, 70º, etc.), radians or through another kind of formula.

EDITING FILES

So to start editing files, a hex editor like it was mentioned above is needed. Usually HxD is a good choice, it's not too hard to learn and has all that's needed for a hex editor.

1. First open the file you want to edit on it either by dragging the file onto the HxD window, or press Ctrl+O and open it from there.

2. Then, when the file is opened, it's time to search for values. First press Ctrl+F, this window will appear, if wanting to find a hexadecimal number, change the datatype to "Hex-values", for integer numbers it's "Integer number" and for floating point numbers like those shown in the "Aspect Ratio" section, change it to "Floating point number".

image.png.e5b755e5bf780d08014d0dbb48fc9538.png

image.png.b8162acd643b78de630d7069e2ec785f.png

image.png.3a461e28e4aaa44d60943629de5615a2.png

image.png.9f636dfc1d259bde57a14cc7b0644e3c.png

3. Let's take this example for Lego Racers 2. The game only supports the following resolutions by default: 640x480, 800x600 and 1024x768.

image.thumb.png.ec86f624be44664cf1e523f263de3984.png

1363842399_LEGORacers22024-06-0321-39-02-360.thumb.png.58cf98ed4ba7b295ccdbfeabe8d6f358.png

1264421491_LEGORacers22024-06-0321-39-05-240.thumb.png.a540d668c49bf478bed1fa16965af3bf.png

5. To find the right resolution, it's needed to find both width and height values that are close enough to eachother in a file. For that, this program made by myself can be used to determine that: https://github.com/alphayellow1/AlphaYellowWidescreenFixes/releases/tag/utilities

6. Put the downloaded executable in the same folder where the game exe is, run it, put the executable name, write one of the resolutions the game supports, set the byte search range to 15 and type Enter.

image.thumb.png.ac0b1b73c6c6ccc6534392085216ce78.png

image.thumb.png.e26cfbd3614c8c9abda544641e9097d4.png

image.thumb.png.67e7ce78c084a6c113416c52860ebf9a.png

image.thumb.png.e512508b9d23cee829fb91fd840785ac.png

7. Since the 800x600 resolution has the least amount of close enough pairs in the executable (just 1), we'll go with it.

8. Go back to HxD, press Ctrl+G and search for the address that was found for the width: 0002A912 (just for info, each pair of numbers or letters represents 1 byte, so the highlighted value below is 2 bytes long).

9. image.thumb.png.44bd8be12b4ff14efc87664947117ad4.png

9. Highlight it, then go to the right side of the window in the "Data inspector" tab, and go to the row where it says Int16.

image.thumb.png.5c796bab8251c10a6d87290b25559480.png

10. Change it to the desired width, and type Enter.

11. Do the same for the height, highlight the value in the right address you found in the program above and change the value in the Int16 row at the right side. Save the file.

12. Now inside the game, we can see the new resolution that was changed earlier above now appears in the graphics settings, but if it doesn't appear, just set it to the one you changed before (so change it to 800x600 and the resolution in-game will change to the one you set in the file).

 414992054_LEGORacers22024-06-0402-12-46-594.thumb.png.c634ba8ab607bf17d0fb75e3ba6caedd.png

13. Now during gameplay we can check the proportions look correct but the camera view looks cropped in relation to 4:3, which means the field of view is reduced with wider resolutions, this scaling behavior is called Vert-, because the vertical field of view is reduced to accomodate the new aspect ratio. This means we have to increase it.

image.thumb.png.be1cae2b78e6642dea3fe47e773585cd.png

image.thumb.png.b955ed16d4837b6dddaeba55e2d4dc53.png

14. For the field of view, it was found the game stores FOV values as degrees, and after some experimentation, it's found the value is 90º. Note that in some games, they might store FOV for different areas of the game in more than one place, it might be either the same value as normal gameplay one, or might be a different FOV value altogether, like using one FOV for menus and another FOV for gameplay, or even different FOVs for each mission. For first-person games, they might store a  FOV value for the camera and another one different altogether for the weaponmodel. Also cutscenes might have its own FOV assigned to it (either a universal FOV value for cutscenes, or even different FOV values inside the same cutscene, or each type of cutscene having its own FOV), so beware.

15. In HxD, press Ctrl+F, change the tab to "Floating point number" and type 90, change "Search direction" to "All", and click in "Search all". 

image.png.e375438527d50fb8d1a1b744f54c9d3b.png

16. All the found 90 values are listed below:

image.thumb.png.34df20e0a9198c796ffb74b22e01241d.png

15. To edit each value, double click on one of the results below, and then go to the right side, and change the value in the "Single (float32)" row. You can try editing each value to a much higher one like 130, noting in which address the value is before changing it (see the second screenshot below this one), then saving the file, starting the game and going into gameplay, and seeing if the FOV became much higher, then if not, closing the game and coming back to HxD, changing the value back to 90 in the address you noted before, and going to the next value and doing the same process again until the camera FOV changes in-game.

image.thumb.png.7bb9b0747f493497db6c110fd42eb13a.png

image.thumb.png.6e54798e7b6116034c617ada450b0b70.png

16. It won't take long to find out it's the second value responsible for the camera FOV ingame, highlight it and change the value according to WSGF's FOV calculator: https://www.wsgf.org/fovcalc.php . Leave it as it is, and change the "number of monitors across" to 1, and change the resolution to the desired one above (in my case it's 1920x1080).

image.thumb.png.420ecff4e76ac23817871cc6aed60f2b.png

17. Copy the value after where it says "New hFOV =", only copy the number in bold. Also note that if the standard FOV isn't 90º but another number, you can change the number that is after "Old hFOV:" to that one to get the correct FOV for your aspect ratio.

18. After copying the number in step 17, go back to HxD and paste it in the "Single (float32)" row of the second address that was found in the first screenshot of step 15.

19. Now going back in-game, we can see the resolution and field of view were successfully changed and the game is fixed!

image.thumb.png.b955ed16d4837b6dddaeba55e2d4dc53.png

961370585_LEGORacers22024-06-0402-39-06-049.thumb.png.0366f5d0b4b7bff5bba64a1fd4fd5c71.png

ADVANCED EDITING THROUGH MEMORY HACKING

If changing resolution or FOV values in files doesn't change anything in-game, then memory scanning/debugging softwares like Cheat Engine and code disassemblers like OllyDbg and x32dbg are needed. I'll expand on this section later.

Link to comment
Share on other sites

  • Aemony featured and pinned this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Found PCGamingWiki useful? Please consider making a Donation or visiting our Patreon.
  • Who's Online   0 Members, 0 Anonymous, 569 Guests (See full list)

    • There are no registered users currently online
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Forum Statistics

    1.8k
    Total Topics
    9.2k
    Total Posts
×
×
  • Create New...