rebtd7 / FF13Fix

Performance and bug fixes for the PC versions of FF13 and FF13-2
GNU General Public License v3.0
346 stars 24 forks source link

4gb patch doesn't work for some users #77

Closed Surihix closed 2 years ago

Surihix commented 3 years ago

The 4gb patch support of the fix doesn't work for some users. I found out about this recently after I tried helping one of the users on steam who tried to install the patch on their game. they had the problematic RDNA GPU with the latest version of DXVK installed. so the 4gb patch is required to resolve the crashes for them.

They followed the installation steps correctly and faced the code 51 error. I provided them the patched and untouched exe's which at this point is easier for them to install. still they got the code 51 error and weirdly the exe's that I provided to them, work fine for me.

I also made sure that the game was not installed on their C drive, anti virus was windows defender which did not flag or delete anything, and there was no other programs running in the background. their PC was also new as well.

Without the 4gb patch installed, the fix otherwise works fine for them. In the end, I had to take the exe from CPY's pirated release of the game and apply the 4gb patch to it. I later gave that exe to the user and the game now runs fine without crashing for them. The only difference with the game installation between my PC and that user's PC was that the game was installed on a SSD while mine is installed on the HDD.

I couldn't get the log report with the 4gb patch applied to the exe, as I assume that log is only updated when the game is running and since the code 51 error occurs instantly on launching the game before the game is ran, the log is unable to write what the issue is with the 4gb patch exe.

rebtd7 commented 3 years ago

That's unfortunate. It will be hard to fix without being able to reproduce. I think during the development of the 4GB fix I think I had some instances where I had to re-start the steam client after I messed up the patching. I suggest trying that (or even trying to open ffxiiiimg.exe directly without Steam client opened)

Also, if you open ffxiiiimg.exe directly (not the launcher) you should be able to get a log (the error message box is different in this case: it is created in the fxiiiimg.exe process instead of the Steam client)

Surihix commented 3 years ago

We tried that as well. Steam was restarted after the game failed to launch after copying in the patched and untouched exe files. I even asked them to try and launch the exe directly and they got the application load error 3:00000065432

I am actually thinking if the newer version of DXVK is the cause of the issue. It got updated recently and maybe the patch would have wroked with an older version of DXVK. you can see if the newer version of DXVK has some issue that prevents the 4gb patch features present in the fix from hooking into the exe.

rebtd7 commented 3 years ago

I just tried dxvk 1.9 and I could not reproduce unfortunately

Surihix commented 3 years ago

I guess it's an one of issue with certain PCs. I will check if anyone else faces this issue with the patch again and let you know about it.

I have even added images for the installation steps on how to patch the exe in my guide. to make it even more easier, I am thinking of including a zip of the patched and untouched exe files in my guide and just tell people to unzip and copy those exe files to their bin folder if they find it difficult to follow the installation steps.

Lastly I am curious as to how does the fix enables the 4gb patched exe to work ?

rebtd7 commented 3 years ago

It works like this:

  1. When loading the ffxiiiimg.exe to the memory, Windows checks that the .exe has the Large Address Aware flag set, so it allows it to access more than 2GB of RAM.
  2. After the .exe is loaded, the FF13Fix dll startup code is executed, unsetting the LAA flag in the executable loaded in the RAM (and the checksum, which is also modified by the 4GB patch). The fact that the flag is not set anymore doesn't seem to matter, as Windows has already read it when loading the .exe
  3. The game checks that the .exe file loaded to the RAM is intact (everything was patched back to the initial values, so this check passes)
  4. The game checks that the .exe file in the HDD is intact (this check is bypassed because we hook the functions used to open files, making the game actually open and verify untouched.exe instead)
rebtd7 commented 3 years ago

@Surihix Somewhat related to this issue: I saw some people in Steam forums saying that AMD fixed their drivers (e.g. https://steamcommunity.com/app/292120/discussions/0/3047234112541894733/)

Do you have any way to confirm this? If this is really the case (finally!) AMD users will have better performance by not using DXVK on Windows

Surihix commented 3 years ago

@Surihix Somewhat related to this issue: I saw some people in Steam forums saying that AMD fixed their drivers (e.g. https://steamcommunity.com/app/292120/discussions/0/3047234112541894733/)

Do you have any way to confirm this? If this is really the case (finally!) AMD users will have better performance by not using DXVK on Windows

Sorry I missed this message as I did not get notified. One way to confirm if the driver has indeed fixed the issue is to ask people on steam to switch to this new driver and see if the game works fine. Do hope that this is the miracle driver that these games needed at long last.

josephlee222 commented 3 years ago

Hi, I have faced this problem as well with windows 11 (not sure about windows 10) with nvidia driver version 472.12 where steam returns a 51 error code (if launched thru steam) or a application load error 3:0000065432 when launched directly

Edit: It works when launched with xiiiimg.exe

rebtd7 commented 3 years ago

@josephlee222 Were you trying to open untouched.exe? You are supposed to launch ffxiiiimg.exe or use the game's launcher (FFXiiiLauncher.exe)

josephlee222 commented 3 years ago

I can launch with ffxiiiimg.exe but when i tried launching with steam with the launcher, it will not work

mainman879 commented 2 years ago

I was having this very same issue after doing the 4gb patch, and managed to fix it by changing the "untouched" file to "untouched.exe". One of the guides I was using said to rename it to just untouched and to get rid of the .exe at the end, but after I added .exe it fixed the error 51 problems. I suggest double checking for this particular issue if others have error 51.

Surihix commented 2 years ago

I had made an automated batch script to install this 4gb patch which you can download from this link here: https://drive.google.com/file/d/1lNGJYNtzmDAGMQeueN8PwRtISrbSCoJT/view?usp=drivesdk

Closing this issue