ThirteenAG / WidescreenFixesPack

Plugins to make or improve widescreen resolutions support in games, add more features and fix bugs.
https://thirteenag.github.io/wfp
MIT License
2.27k stars 215 forks source link

GTA 1: player_a.dat fix does not work #612

Closed danielmarschall closed 5 years ago

danielmarschall commented 5 years ago

In the source code comment , there is mentioned that some kind of player_a.dat fix is applied.

But it does not work. The file still gets corrupted and needs to be fixed by running GtaFixer.exe before each start.

ThirteenAG commented 5 years ago

As far as I remember, only 1 byte needs to be changed in player_a.dat for it work, so that is what should happen in my fix. I think it worked the last time I checked. I don't have a lot of time to get into this, but I'll check your other update a bit later.

danielmarschall commented 5 years ago

Thank you for your answer.

I just found out, that the problem is that during development I ran both, the Classic version and the Retail version. It turns out that the player_a.dat has some kind of different format. So if you run GTA Classic with a player_a.dat which was written by GTA Retail, there will be a corrupted save state.

It seems like your fix works correctly: The files written by GTA Classic will contain the byte 0x06.

However, if you run GTA Retail (which does not contain the player_a.dat fix), you will get a player_a.dat, which will crash GTA Classic, even if the fix is applied.

Attached is a player_a.dat that will crash GTA Classic, even if the patch is applied: player_a.zip

Open questions:

  1. Should/can we do a fix to the GTA Classic patcher to avoid that the game crashes if the 0x06 byte is missing?
  2. Do we need to introduce the player_a.dat bugfix in the GTA Retail+London patch (#611) ? If I understand correctly, the player_a.dat bug was introduced in GTA Classic. The Retail version writes different values than 0x06, but it actually seems to be OK with it.
danielmarschall commented 5 years ago

I have found a different approach how to fix the player_a.dat bug.

I have added this fix in my updated file https://misc.daniel-marschall.de/spiele/gta1/widescreen_patch.cpp

Now, GTA will run without GTAFixer.exe

danielmarschall commented 5 years ago

Today, I have debugged the game with IDA, and I actually found the cause of the bug, and I found a way to actually fix the issue!

I have made a technical description here https://misc.daniel-marschall.de/spiele/gta1/player_a_bugfix.txt

In player_a.dat, at the fifth byte, the resolution setting of the previous game session will be saved. The saving works, but during the load procedure, the game will crash because an invalid resolution setting "6" is requested. The issue is very easy to fix. My fix has the big advantage that the resolution setting is now preserved for the next game session, like in the Retail version of the game.

I have updated my file and it is ready to be pulled :-) https://misc.daniel-marschall.de/spiele/gta1/widescreen_patch.cpp

ThirteenAG commented 5 years ago

I briefly tested on the files I have, it's working for me, so I pushed the changes to github. Unfortunately at this time that's all I can do, so I suggest you try the dev build and make sure everything is fine, then let me know and I'll reupload it on github.