An ambitious attempt to create NES combo world randos with an arbitrary number of games.
Patches can be a single python file or a directory containing a patch.py
file as its entry point.
The python file should share the same name as the patch. For example, a patch named mycoolpatch
should be contained in a file called mycoolpatch.py
. The file has 2 requirements
- A function named
execute(data)
, where thedata
parameter is a reference to abytearray
containing the ROM data on which you are hacking. - a
patch
dictionary containing the following properties:name
- The name of the patchdesc
- A brief description of the patchdeps
- A list of patch names upon which this patch relies. Those patches will be executed before this patch.execute
- A reference to theexecute(data)
function, #1 in the list list.
Here's a simple annotated example for Castlevania 2, used only in testing:
def execute(data):
# This list of hex values represents 9 "Z" letters on the CV2 title screen
bytes = [0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A]
# The loc variable represents the location in the ROM data to which we are going
* to write the above bytes
loc = 0x0101A2
# Write the bytes to the location
data[loc: loc + len(bytes)] = bytes
patch = {
'name': 'Z\'s',
'desc': 'Write a bunch of Z\'s to the title screen',
'deps': [],
'execute': execute
}