Page 1 of 1

[P4G PC] Inaba Exe Patcher

Posted: Mon Sep 14, 2020 5:19 pm
by Tekka
Image

Gamebanana Page for Download: https://gamebanana.com/tools/6872

The name Inaba came from the best girl in the best anime Kokoro Connect not the town that Persona 4 Golden takes place in. It uses .patch files (basically raw hex data with .patch extension) from your mods/patches folder in your Steam game directory to patch the exe at startup.

Prerequisites

All you need for Inaba Exe Patcher to work is to already have Reloaded II setup for mod loading following this tutorial (if you already mod Persona 4 Golden through Reloaded II you should be good to go).

Also if you're somehow still on Version 1.0 (REV: 2008), you'll need to patch P4G.exe with this tool in order to not get a AccessOutOfMemory error. All other versions don't need to have the 4GB Patch.

How To Install

- Extract the p4gpc.inaba folder from the download and place it in your Reloaded II 'Mods' folder. ('Release' is my Reloaded II folder)

Image

- Enable 'Inaba Exe Patcher' in your Reloaded II Launcher by making sure the icon next to it is a red plus like so.

Image

- Take your .patch files (none provided with this tool) and place it in your 'mods/patches' folder in your Steam game directory. Just create a 'patches' folder if you don't have one already. Also, if you launch the game with the mod enabled and don't have the directory, it'll create one for you.

Image

- Now when you launch the game, P4G.exe and init_free.bin's tbl files should be modified by the patch files at startup.

Structure of .patch Files used for Exe Patcher (For Modders)

Read this if you want to create .patch files to modify P4G.exe yourself. This would be especially useful for people who want to translate the game since there's a lot of the game's text found inside P4G.exe. You can also modify any other part of the exe if you wish to do so (and know how to). Do note that you should have a hex editor if you want to create your own. Before creating a .patch file, you want to look inside P4G.exe with a hex editor to see which part you want to modify.

First two bytes of the .patch file - Length of the search pattern in hex
You can use a decimal to hex converter like this one.

Image
In this example, we can see that the length is 00 05 or 5.

The Exe Patcher then uses that length to get the Search Pattern from the .patch file. For example, if the first two bytes indicated a length of 10, the patcher then reads 10 bytes after the first two bytes as the Search Pattern. This Search Pattern is then used to search for in P4G.exe. Do note that it'll stop at the first instance it finds since this is a simple patcher. Do make sure your search pattern is unique so that you'll be modifying the right part of the exe. I usually make sure that it's unique by just ctrl+f'ing the pattern in a hex editor and seeing if it's the only one that pops up.

Image
In this example, we can see that the search pattern is "Sorry" since it's the next 5 bytes that follow the length indicated by the previous image.

Finally, right after the search pattern is the hex data you want to use for replacing the original hex data starting at which the Search Pattern was found. This part of the .patch file can be any length you want as the patcher just grabs the rest of the hex that follows the search pattern.

Image
In this example, we can see the contents we're replacing is "UwU 00 00 00 00 00 We made a fucky wucky!!" as it is just the remaining hex data of the .patch file.

Config

If you click on 'Configure Mod' in the Reloaded II Launcher you will see there's multiple configurations that you can edit.

Image

You can enable debug mode to print out more stuff to the console. This is useful for modders creating their own .patch files to use with this simple patcher. I would use it to make sure I setup my .patch files correctly. It'll print out the info it grabbed from the .patch files onto the console like so.

Image

The last option is an optional priority system to make sure which patches are done last. In order to utilize this you should create folders with .patch/.tblpatch files inside your mods/patches folder. Then simply add the folder names to the Patch Folder Priority Collection by clicking on the drop down menu. Priority is given to the top of the list and descends to the bottom. Any other folder names not provided are given priority in alphabetical order. The least priority is given to patch files simply inside mods/patches and not any other folders. The highest priority patches will overwrite the bytes last so all of their changes should show up. However, it won't work for Exe Patcher if the lower priority patch files change the unique search pattern of higher priority patch files.

Image
Image

In this example, epname_kuma.patch will be loaded first, then the patch files inside 'Kechi,' and finally the patch files inside 'Weeb.'

For Mod Creators - inaba_overlay.png

Thanks again to Pixelguin for providing an overlay for use with thumbnails to indicate that a mod uses this simple patcher. It's included in the download.

Future Plans

No more future plans at the moment for this simple patchers as all my ideas are now going towards Aemulus Package Manager.

Any Questions?

If anything isn't working or you need help with using this tool please let me know through here or through my Discord found on my profile page. I'm also pretty active on the Discord server listed on GameBanana for Persona 4 Golden if you wish to talk with me there. Also let me know if you have any suggestions on what to add or improve to this tool. I also haven't messed with .tbl files for my own mods so let me know how this works out.