ROMPatcher
If a patch file is found and the ROMPatcher module is selected, then this will download patch files and apply to ROMs. To highlight if a ROM has been patched, the final file will have a (ROMPatched) in the file name.
Currently, ROMSearch can use xdelta and RomPatcher.js to patch ROMs.
For more details on the ROMPatcher arguments, see the config file documentation.
xdelta
To use xdelta, download the latest xdelta3 release from
https://github.com/jmacd/xdelta-gpl/releases/latest.
After unzipping the .exe file, add the path to this file into your config, under xdelta_path in the rompatcher
config section.
RomPatcher.js
You may need to download node.js to start with. You can get it at https://nodejs.org/en.
After that, clone the NodePatcher.js repository and install:
git clone https://github.com/marcrobledo/RomPatcher.js.git
cd RomPatcher.js
npm install
After this, as the RomPatcher.js path in the config, put the path to the index.js file.
API
- class romsearch.ROMPatcher(platform, config_file=None, config=None, platform_config=None, regex_config=None, logger=None, log_line_sep='=', log_line_length=100)[source]
ROM Patching tool
There are different ways to patch files based on platforms, so we need to keep track of a number of things here
- Parameters:
platform (str) – Platform name
config_file (str, optional) – path to config file. Defaults to None.
config (dict, optional) – configuration dictionary. Defaults to None.
platform_config (dict, optional) – platform configuration dictionary. Defaults to None.
regex_config (dict, optional) – regex configuration dictionary. Defaults to None.
logger (logging.Logger, optional) – logger. Defaults to None.
log_line_length (int, optional) – Line length of log. Defaults to 100
- download_patch_file(patch_url, patch_dir)[source]
Download a patch file
- Parameters:
patch_url (str) – URL to patch file
patch_dir (str) – Patch directory
- find_patch_file(patch_dir)[source]
Find potentially multiple patch files within directory
- Parameters:
patch_dir (str) – Patch directory to search
- get_unpatched_file(patch_dir)[source]
Get the unpatched file from the patch directory
- Parameters:
patch_dir (str) – Patch directory
- patch_rom(unpatched_file, patch_file, patch_dir)[source]
Patch a ROM
- Parameters:
unpatched_file (str) – ROM file to patch
patch_file (str) – Patch file to patch
patch_dir (str) – Patch directory
- rompatcher_js_patch(unpatched_file, patch_file, rompatcher_js_file, out_file, patch_dir)[source]
Patch using RomPatcher.js
- Parameters:
unpatched_file (str) – ROM file to patch
patch_file (str) – Patch file to patch
rompatcher_js_file (str) – Filename that RomPatcher.js will output
out_file (str) – Path for output file
patch_dir (str) – Patch directory
- run(file, patch_url, rom_dict=None)[source]
Run the ROMPatcher
- Parameters:
file (str) – file to patch
patch_url (str) – URL for patch files
rom_dict – Parsed ROM dictionary
- xdelta_patch(unpatched_file, patch_file, out_file)[source]
Patch using xdelta
- Parameters:
unpatched_file (str) – ROM file to patch
patch_file (str) – Patch file to patch
out_file (str) – Path for output file