native bps creation
parent
86b344f933
commit
43e16025da
|
@ -14,6 +14,9 @@ import math
|
||||||
import Fusion_Graph as Graph
|
import Fusion_Graph as Graph
|
||||||
from Fusion_Items import *
|
from Fusion_Items import *
|
||||||
from bps.apply import apply_to_files
|
from bps.apply import apply_to_files
|
||||||
|
from bps.diff import diff_bytearrays
|
||||||
|
from bps.io import write_bps
|
||||||
|
from bps.util import bps_progress
|
||||||
|
|
||||||
version = '0.11.6'
|
version = '0.11.6'
|
||||||
|
|
||||||
|
@ -4913,8 +4916,18 @@ def patch_game():
|
||||||
patchedGame.write(value.to_bytes(1, 'little'))
|
patchedGame.write(value.to_bytes(1, 'little'))
|
||||||
|
|
||||||
if Patch:
|
if Patch:
|
||||||
# FIXME: replace with internal patch creator
|
with open(BaseGame, 'rb') as source:
|
||||||
os.system('.\\flips\\flips.exe --create --bps "{}" ".\\seeds\\{}.gba"'.format(BaseGame, FileName))
|
sourcedata = source.read()
|
||||||
|
with open(os.path.join('.', 'seeds', '{}.gba'.format(FileName)), 'rb') as target:
|
||||||
|
targetdata = target.read()
|
||||||
|
|
||||||
|
patch = open(os.path.join('.', 'seeds', '{}.bps'.format(FileName)), 'wb')
|
||||||
|
|
||||||
|
blocksize = (len(sourcedata) + len(targetdata)) // 1000000 + 1
|
||||||
|
print("Using blocks of {0} bytes".format(blocksize))
|
||||||
|
|
||||||
|
iterable = diff_bytearrays(blocksize, sourcedata, targetdata)
|
||||||
|
write_bps(bps_progress(iterable), patch)
|
||||||
print('')
|
print('')
|
||||||
ItemNames = [
|
ItemNames = [
|
||||||
'Missile Data',
|
'Missile Data',
|
||||||
|
|
Loading…
Reference in New Issue