Guide:Replacing strings: Difference between revisions

Updated lead
(Added string replacement tutorial)
 
(Updated lead)
 
(7 intermediate revisions by the same user not shown)
Line 1:
{{Infobox guide
This tutorial will walk you through the steps of using [[Sly String Toolkit]] to make mods that replace strings in Sly 2.
| sly2 = y
| sly3 =
| difficulty = Easy
}}
 
This tutorial will walk you through the steps of using [[Sly String Toolkit]] to makestring replacement mods thatfor replaceSly strings2 inon Slythe 2PS2.
 
'''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.
 
{{To do|Add instructions for how to use Live Edit to update the strings in real time.}}
 
== Setup ==
 
=== Sly String Toolkit ===
First, download Sly String Toolkit from github [https://github.com/TheOnlyZac/sly-string-toolkit/releases 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.
 
=== Example projectPython ===
You will need to install Python 3.8 or higher from [https://www.python.org/downloads/ here] if you don't already have it. Then, open a command prompt and <code>cd</code> into the folder with the <code>main.py</code> script. Finally, run <code>pip install -r requirements.txt</code> to install the script dependencies. Now you're ready to generate a pnach file!
 
=== Build example PNACH ===
The string toolkit comes with an example project in the <code>example</code> directory to test the script. The directory contains a file called <code>strings.csv</code>. It contains two strings that replace the text on the title screen, "Press START button for New Game" and "Press SELECT button for Menu".
 
The string toolkit comes with ansome example projectinput files in the <code>exampleexamples</code> directory to test the script. TheThere directoryyou containswill find a file called <code>stringstest.csv</code>. 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 <code>.pnach</code> file, open a command prompt, cd to the main directory, run this command:
 
To generate the <code>.pnach</code> file, open a command prompt, cd toin the mainproject directory, and run this command:
 
<pre>
python main.py -i exmapleexample/string.csv
</pre>
 
ThenThis copywill generate a <codett>07652DD9.mod.pnach</codett> fromfile in the <codett>out</codett> folder for the NTSC version. If you are playing on PAL version, add <code>--region pal</code> to the command. Then copy the pnach file to your <code>pcsx2/cheats</code> folder, enable cheats, and start Sly 2. You should see the new textstrings on the title screen.
 
[[File:String Toolkit screenshot.png|480px]]
== Adding custom strings ==
 
== Adding custom strings ==
Now that you know the script is working, you can start making your own custom string 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:
 
=== Making a CSV file ===
NowTo that you know the script is working, you can start makingmake your own custom string replacement mods., Youyou will need to make a csvCSV file (a spreadsheet) with all the custom strings you want. Each row should have the following format:
 
<code><string id>,<string>,<optional target address></code>
* <code><string id></code> is the ID of the string you want to replace
* <code><string></code> is the string to replace it with
* <code><optional target address></code> 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 <code>-a</code> option.
 
Everything after the third column is ignored by the script, so you can use them for notes if you want. You can use the csv file from the example projectCSV as a basetemplate, or make thea filespreadsheet in Excel or Google Sheets, thenand 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 compileddumped into [https://docs.google.com/spreadsheets/d/1W-20RZ1hBz7ZtgRBKCNkH84MxkYsoqesDEBGv8l5BdA/edit?usp=sharing this spreadsheet]. However, the sheet is incomplete and will be expanded in the future.
 
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 compiled into [https://docs.google.com/spreadsheets/d/1W-20RZ1hBz7ZtgRBKCNkH84MxkYsoqesDEBGv8l5BdA/edit?usp=sharing this spreadsheet]. However, the sheet is incomplete and will be expanded in the future.
 
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 "SLY MODDING IS FUN!", your csv should look like this:
 
<pre>
309,SLY MODDING IS FUN!
</pre>
 
== Generating the mod pnach PNACH==
 
OnceWhen you are ready to testgenerate the modPNACH file, run the script with the following command:
 
<pre>python main.py -i <path_to_your_csv_file></pre>
 
The default region is NTSC. You can specify the region with the <code>-r</code> option like this:
If you aren't familiar with the command line and don't know how to input the path to your csv file, just name it <code>strings.csv</code> and put it in the same folder as <code>main.py</code> script. Then simply run the script with:
 
<pre>python main.py <path_to_your_csv_file> -r pal</pre>
<pre>
python main.py
</pre>
 
This will generate a file called <code>07652DD9<nowiki><crc>.mod.pnach</nowiki></code> in the <code>out</code> folder. Place the pnach file in your <code>pcsx2/cheats</code> folder and enable cheats, and your custom strings should appear in game.
 
=== Setting the output directory ===
 
For a faster workflow, you can use the <code>-o</code> option to set your output directory to your <code>pcsx2/cheats</code> folder so you don't have to copy the file over every time you run the script. Run the script as follows:
 
<pre>
python main.py -i <path_to_your_csv_file> -o <path_to_pcsx2_cheats_folder>
</pre>
 
Your PCSX2 folder directoryfolder probablyis looksprobably something like this: <tt>C:\Users\Yourname\My Documents\PCSX2 1.6.0\cheats</tt>. So, you can run the script as follows (with quotation marks around the directory):
 
<pre>
python main.py -i <path_to_your_csv_file> -o "C:\Users\Yourname\My Documents\PCSX2 1.6.0\cheats"
</pre>
 
{{Navbox guides}}
== Conclusion ==
 
That's everything you need to know to make string replacement mods for Sly 2. If you have any questions, feel free to ask in the #mod-help channel on the Discord server.
 
{{Comments}}