Patch: update to version 4 (#312)

This commit is contained in:
Fabian Dill
2022-03-18 04:53:09 +01:00
committed by GitHub
parent b02a710bc5
commit 7394598aff
14 changed files with 334 additions and 118 deletions

View File

@@ -3,7 +3,6 @@ from ..generic.Rules import set_rule, add_item_rule
from BaseClasses import Region, Location, Entrance, Item
from Utils import get_options, output_path
import typing
import lzma
import os
import os.path
import threading
@@ -17,7 +16,7 @@ except ImportError:
from . import Logic # load logic mixin
from .Options import soe_options
from .Patch import generate_patch
from .Patch import SoEDeltaPatch, get_base_rom_path
"""
In evermizer:
@@ -181,7 +180,7 @@ class SoEWorld(World):
try:
money = self.world.money_modifier[self.player].value
exp = self.world.exp_modifier[self.player].value
rom_file = get_options()['soe_options']['rom_file']
rom_file = get_base_rom_path()
out_base = output_path(output_directory, f'AP_{self.world.seed_name}_P{self.player}_{player_name}')
out_file = out_base + '.sfc'
placement_file = out_base + '.txt'
@@ -210,13 +209,9 @@ class SoEWorld(World):
if (pyevermizer.main(rom_file, out_file, placement_file, self.world.seed_name, self.connect_name,
self.evermizer_seed, flags, money, exp)):
raise RuntimeError()
with lzma.LZMAFile(patch_file, 'wb') as f:
f.write(generate_patch(rom_file, out_file,
{
# used by WebHost
"player_name": self.world.player_name[self.player],
"player_id": self.player
}))
patch = SoEDeltaPatch(patch_file, player=self.player,
player_name=player_name, patched_path=out_file)
patch.write()
except:
raise
finally: