Phantom Brave PC

Phantom Brave PC

70 ratings
How to force the game to correctly load your settings (OUTDATED)
By gmnx and 1 collaborators
If you are annoyed by your game settings resetting to the default values every time you launch a game, I have a solution for you!
2
2
   
Award
Favorite
Favorited
Unfavorite
You no longer need this
As you may already know, in the Steam version of Phantom Brave PC there is was a bug that caused game settings to sometimes reset themselves to default values on launch.
There are several workarounds for this issue floating around, but none of them worked for me, so I made my own fix.


Try it out and see if it works for you, too!
This update from Durante:
https://cs2bus.com/games/409870/announcements/detail/4481737694941020390
fixed this, along with many other issues.
Preface
Since there is no source code for Phantom Brave PC available, I had to use debugger and poke around in the game executable to find a way to solve this problem.
Therefore, this fix involves patching the game's executable file to make it work correctly - that is, to load saved settings without them resetting to the default values.

You'll need to locate the folder containing the main executable "Phantom Brave PC.exe":
  • Right-click the game in the Steam library
  • Choose "Properties"
  • Choose tab called "Local files"
  • Click on the "Browse local files" button
With that in mind, all that is left is to choose which of the two ways you want to use to patch your game.
Why are there two ways of patching the game?
They give identical results, but differ in the amount of trust you need to have in order to apply them.

First one only requires you to download an already patched "Phantom Brave PC.exe" file and replace the one you have in that folder.

Second one is for those who do not trust random executables from the Internet (and rightly so).
Fast & easy way of patching the game
Download the already patched version from here[www.dropbox.com], and put it in your Phantom Brave PC folder, replacing the existing file.

Please note, however, that you absolutely should not trust any executable that you got from the Internet.
I suggest using this way only if the manual way didn't work for you for some reason.
Manual way of patching the game
For the manual approach, we will need two things.

First is a patch file that I made with xdelta[github.com] - a free and open-source software for creating and applying binary patches. You can download the patch file here[www.dropbox.com].

Second is a software that will apply this xdelta patch to the Phantom Brave PC executable.
There are several tools that are capable of that, so I will link only the official one and the unofficial version with easy-to-use GUI that I have tried and confirmed to be working:
You need to choose either of those (or any other xdelta patcher in case you didn't like those two).

Extract the archive you have downloaded into the Phantom Brave PC folder and move the downloaded "patch.xdelta" file there as well.

If you chose Delta Patcher
Launch the "DeltaPatcherLite.exe", select the original "Phantom Brave PC.exe" and the "patch.xdelta" files and hit "Apply patch".
Now your game is patched and your settings should no longer reset to default values on startup.

If you chose xdelta
Open a command prompt in the Phantom Brave PC folder.
To do so, type "cmd" in the Address Bar (as shown on the screenshot below) and press Enter.

Then, execute the following two commands in that command prompt (you can paste them by right-clicking in the terminal window and selecting "Paste") to apply the patch:
move "Phantom Brave PC.exe" "Phantom Brave PC_orig.exe"
xdelta3-3.0.11-x86_64.exe decode -s "Phantom Brave PC_orig.exe" patch.xdelta "Phantom Brave PC.exe"
Last command assumes you have downloaded the 64bit version of the xdelta - if not, just change the executable name to the one you have extracted.
Now your game is patched and your settings should no longer reset to default values on startup.
Technical details
Feel free to skip this section - it is not required in order to apply the patch.

If, however, you're curious about the inner workings of this patch, then please, do continue, but note that some degree of programming knowledge is required.

The problem

If we look at the function that handles the loading of saved values of game settings from "game.cfg" file (a file where the game stores its settings) through the debugger, we can see the following instructions:



The first two lines check whether "game.cfg" file is present at all.

The rest of the instructions compare different values from the loaded configuration file to the hardcoded constants and, in case they are equal, jump to another area of the code, skipping everything that actually loads the game settings into memory.

Later the game checks whether those loaded values are correct, but since it skipped the loading steps they obviously are not, and so it replaces them with default values.

This is where the problem lies.

Those hardcoded constants are perfectly sensible values for those options. The first 4 checks, for example, compare different sound volume sliders to their maximum value, 10. So if one of your volume sliders was maxed out, then the jump instruction triggers and the game doesn't load your settings, using the default ones instead.

The fix

We have the following situation:


And so - what should we do in order to force the game to always load the settings from game.cfg ?

That is - to execute green code path, instead of the red one?

We need to change how all those checks work so that they will never trigger again.

And so I replaced the constants in those checks, since it was the smallest and least invasive change that I could think of.

Since this new value is invalid for any of those options, and should never appear in the game.cfg file, the code that resets settings to default values will never get to run.


You can see this change for yourself by using any sort of binary diff software and comparing the original and patched executables:


As you can see, the only thing that was changed was the hardcoded value in all those checks.



That's all I had to say, thanks for reading and I hope that this fix will be useful to you.
16 Comments
Cqllel 1 Sep, 2024 @ 5:21pm 
It's not surprising this game never got a basic issue patched. Most ports seem to just get abandoned after release smh. This game runs significantly better than Disgaea 1 and 2. Those 2 games pulled up to 17W on my SD OLED. I haven't even touched 7W in Phantom Brave
2 Jun, 2024 @ 11:25am 
Thanks for the fix! :marijaonlooker:
mib 10 May, 2024 @ 6:51am 
worked on steam deck! thank you :)
Twist 24 Apr, 2024 @ 2:28pm 
Thank you very much! great design as well.
FreewayPound 14 Jan, 2023 @ 8:41am 
Thanks for the fix! It's nice that there are so many resources for this game. Cheers!
TheSilverLining 21 Apr, 2022 @ 10:45am 
Thanks for the patch. Though this was made almost 4 years ago its still works today. Surprised they have not fixed this issue since they released NIS Classics Vol 1 very recently and gave this game no touch up.
zodd 23 Mar, 2022 @ 11:04am 
Thank you!
Don't Uber Me 1 May, 2021 @ 6:18am 
Hello, thanks for the patch, but there's another issue in that with this patch, the game will only run at 40 fps while in full screen.
Stahlkadan 26 Feb, 2020 @ 1:25pm 
Thanks a lot man, fast & easy way worked like a charm <3
wolsy 6 Feb, 2020 @ 9:01pm 
god. you are god.