Migrate DKC3 to APDeltaPatch (#838)
* Add DKC3 to APDeltaPatch * Undo unintended commit * More undoing * Remove else clause
This commit is contained in:
parent
2ff7e83ad9
commit
07450bb83d
|
@ -1,5 +1,5 @@
|
||||||
import Utils
|
import Utils
|
||||||
from Patch import read_rom
|
from Patch import read_rom, APDeltaPatch
|
||||||
from .Locations import lookup_id_to_name, all_locations
|
from .Locations import lookup_id_to_name, all_locations
|
||||||
from .Levels import level_list, level_dict
|
from .Levels import level_list, level_dict
|
||||||
|
|
||||||
|
@ -529,6 +529,15 @@ def patch_rom(world, rom, player, active_level_list):
|
||||||
rom.write_byte(0x3B97EA, 0xEA)
|
rom.write_byte(0x3B97EA, 0xEA)
|
||||||
|
|
||||||
|
|
||||||
|
class DKC3DeltaPatch(APDeltaPatch):
|
||||||
|
hash = USHASH
|
||||||
|
game = "Donkey Kong Country 3"
|
||||||
|
patch_file_ending = ".apdkc3"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_source_data(cls) -> bytes:
|
||||||
|
return get_base_rom_bytes()
|
||||||
|
|
||||||
|
|
||||||
def get_base_rom_bytes(file_name: str = "") -> bytes:
|
def get_base_rom_bytes(file_name: str = "") -> bytes:
|
||||||
base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None)
|
base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None)
|
||||||
|
|
|
@ -12,7 +12,7 @@ from .Levels import level_list
|
||||||
from .Rules import set_rules
|
from .Rules import set_rules
|
||||||
from .Names import ItemName, LocationName
|
from .Names import ItemName, LocationName
|
||||||
from ..AutoWorld import WebWorld, World
|
from ..AutoWorld import WebWorld, World
|
||||||
from .Rom import LocalRom, patch_rom, get_base_rom_path
|
from .Rom import LocalRom, patch_rom, get_base_rom_path, DKC3DeltaPatch
|
||||||
import Patch
|
import Patch
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,12 +145,16 @@ class DKC3World(World):
|
||||||
|
|
||||||
rompath = os.path.join(output_directory, f'AP_{world.seed_name}{outfilepname}.sfc')
|
rompath = os.path.join(output_directory, f'AP_{world.seed_name}{outfilepname}.sfc')
|
||||||
rom.write_to_file(rompath)
|
rom.write_to_file(rompath)
|
||||||
Patch.create_patch_file(rompath, player=player, player_name=world.player_name[player], game=Patch.GAME_DKC3)
|
|
||||||
os.unlink(rompath)
|
|
||||||
self.rom_name = rom.name
|
self.rom_name = rom.name
|
||||||
|
|
||||||
|
patch = DKC3DeltaPatch(os.path.splitext(rompath)[0]+DKC3DeltaPatch.patch_file_ending, player=player,
|
||||||
|
player_name=world.player_name[player], patched_path=rompath)
|
||||||
|
patch.write()
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
if os.path.exists(rompath):
|
||||||
|
os.unlink(rompath)
|
||||||
self.rom_name_available_event.set() # make sure threading continues and errors are collected
|
self.rom_name_available_event.set() # make sure threading continues and errors are collected
|
||||||
|
|
||||||
def modify_multidata(self, multidata: dict):
|
def modify_multidata(self, multidata: dict):
|
||||||
|
|
Loading…
Reference in New Issue