techdemo_patcher.py
Description 🔗︎
techdemo_patcher.py is a small tool for editing the strings that are hardcoded in the techdemo (i.e. "baked" into the PlagueCity.exe executable, and not stored in an outside text file).
It does so by reading all existing strings in PlagueCity.exe, then outputting them in a neat text template that can then be edited by the user. The changes will then be elegantly written back into the EXE, automatically accomodating for various string length limitations and the CP-1251 encoding that the techdemo uses.
Download 🔗︎
techdemo_patcher.pyUsage 🔗︎
Note: you must have Python 3 installed and available in PATH.
The script comes with a --help page:
$ python3 techdemo_patcher.py --help
usage: techdemo_patcher.py [-h] [-r] [-w] [-x [EXE_FILE]] [-t [TEMPLATE]] [-o]
Minimal script for editing the strings in Pathologic 2002 Techdemo
options:
-h, --help show this help message and exit
-r, --read create a template out of an .exe file
-w, --write write from a template into an .exe file
-x [EXE_FILE], --exe_file [EXE_FILE]
path to the Techdemo .exe file (usually PlagueCity.exe)
-t [TEMPLATE], --template [TEMPLATE]
path to the template that holds the strings
-o, --overwrite don't ask, just overwrite existing files when generating new
templates or .exe backups
Generating the template from EXE 🔗︎
To read the strings from PlagueCity.exe, run:
python3 techdemo_patcher.py -r
If the file is not named PlagueCity.exe, or located in a different directory, specify it like so:
python3 techdemo_patcher.py -r -x /path/to/PlagueCity.exe
You can also specify the name of the template that will be created:
python3 techdemo_patcher.py -r -t my_new_template.txt
If everything has gone OK, you will see the new template appear now - typically a .txt file. It doesn't strictly have to have a .txt extension, but this way OSs usually pick it up rightaway as something to edit with a text editor. When opening the template for the first time, make yourself familiar with the little rules written in the first several lines, to ensure the template could be written back into the EXE file without any errors.
Applying changes 🔗︎
To write changes back into the EXE file, run:
python3 techdemo_patcher.py -w
Again, if needed, you can specify the path to the EXE file or to your template:
python3 techdemo_patcher.py -r -x /path/to/PlagueCity.exe -t my_new_template.txt
If there are no errors, you should now have two files: PlagueCity.exe and PlagueCity.exe.back. The .back file is just a copy of PlagueCity.exe before it was last edited by the script.
See also 🔗︎
If this script was not enough for your modding needs, there's always more information at the demo's page on Pathologic Modding wiki, and for the matters of strings, I also wrote these notes about making the English Localisation mod.