Пример #1
0
    for name, diff in needCopy.items():
        if not diff:
            continue
        print("copy {} from hack".format(name))
        tmpBytes = []
        addrs = addresses[name]
        for addr in range(addrs["hack"][0], addrs["hack"][1]):
            tmpBytes.append(hackRom.readByte(addr))
        vanillaRom.seek(addrs["vanilla"][0])
        for byte in tmpBytes:
            vanillaRom.writeByte(byte)

# also copy last line of ship tiles in escape sequence
rowSize = 1024
hAddr = addresses["tilesAddr"]["hack"][0] + rowSize * 3
vAddr = snes_to_pc(0x94C800)
hackRom.seek(hAddr)
vanillaRom.seek(vAddr)
for i in range(rowSize):
    vanillaRom.writeByte(hackRom.readByte())

vanillaRom.close()

# generate ips between vanilla & tempfile
patch = IPS_Patch.create(
    open(vanilla, 'rb').read(),
    open(tmpfile, 'rb').read())
out = hack + '.ips'
patch.save(out)
print("ips generated: {}".format(out))
Пример #2
0
#!/usr/bin/python3

import sys, os

# now that we're in directory 'tools/' we have to update sys.path
sys.path.append(os.path.dirname(sys.path[0]))

from rom.ips import IPS_Patch

original=sys.argv[1]
patched=sys.argv[2]
target=sys.argv[3]

patch = IPS_Patch.create(open(original, 'rb').read(), open(patched, 'rb').read())

patch.save(target)