Guide:Replacing strings

From SlyMods
Jump to navigation Jump to search
Guide:Replacing strings
Modding Guide
Game(s)Sly 2: Band of Thieves

This tutorial will walk you through the steps of using Sly String Toolkit to string replacement mods for Sly 2 on the PS2.

Note: The toolkit currently only works with Sly 2 PS2 (NTSC and PAL). It will be updated in the future to work with Sly 3.


Sly String Toolkit

First, download Sly String Toolkit from github here. If you have git, you can also clone the latest version directly from the repo, but this guide is probably only accurate for the latest release version.


You will need to install Python 3.8 or higher from here if you don't already have it. Then, open a command prompt and cd into the folder with the script. Finally, run pip install -r requirements.txt to install the script dependencies. Now you're ready to generate a pnach file!

Build example PNACH

The string toolkit comes with some example input files in the examples directory. There you will find a file called test.csv. It contains two strings that replace the text on the title screen, "Press START button for New Game" and "Press SELECT button for Menu" with "Sly String Toolkit" and the link to the GitHub repo.

To generate the .pnach file, open a command prompt in the project directory and run this command:

python example/string.csv

This will generate a .pnach file in the out folder for the NTSC version. If you are playing on PAL version, add --region pal to the command. Then copy the pnach file to your pcsx2/cheats folder, enable cheats, and start Sly 2. You should see the new strings on the title screen.

Adding custom strings

Making a CSV file

To make your own string replacement mods, you will need to make a CSV file (a spreadsheet) with all the custom strings you want. Each row should have the following format:

<string id>,<string>,<optional target address>

  • <string id> is the ID of the string you want to replace
  • <string> is the string to replace it with
  • <optional target address> is the address to write the string to. If not specified, it will be written with the rest of the strings in a block at the address specified by the -a option.

Everything after the third column is ignored by the script, so you can use them for notes if you want. You can use example CSV as a template, or make a spreadsheet in Excel or Google Sheets and export it as a CSV.

String IDs

Every string in the game has a unique ID. You will need to know the ID of any string you want to replace. Fortunately, the game stores all these strings in a large table, which we have dumped into this spreadsheet.

Find the string in the string table you want to replace, and in your spreadsheet put that ID in the first column. In the second column, put the string you want to replace it with.

For example, if you want to replace the string "WE'LL BE RIGHT BACK!" on the pause menu (which has ID 309) with "MODDING IS FUN!", your csv should look like this:


Generating the mod PNACH

When you are ready to generate the PNACH file, run the script with the following command:

python <path_to_your_csv_file>

The default region is NTSC. You can specify the region with the -r option like this:

python <path_to_your_csv_file> -r pal

This will generate a file called <crc>.mod.pnach in the out folder. Place the pnach file in your pcsx2/cheats folder and enable cheats, and your custom strings should appear in game.

Setting the output directory

For a faster workflow, you can use the -o option to set your output directory to your pcsx2/cheats folder so you don't have to copy the file over every time you run the script. Run the script as follows:

python <path_to_your_csv_file> -o <path_to_pcsx2_cheats_folder>

Your PCSX2 folder folder is probably something like this: C:\Users\Yourname\My Documents\PCSX2 1.6.0\cheats. So, you can run the script as follows (with quotation marks around the directory):

python <path_to_your_csv_file> -o "C:\Users\Yourname\My Documents\PCSX2 1.6.0\cheats"