Skip to content

Commit

Permalink
LADX: fix egg sprite in non-patched gfx mode (ArchipelagoMW#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
zig-for authored Apr 15, 2023
1 parent d8f79b4 commit 808203a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
5 changes: 0 additions & 5 deletions worlds/ladx/LADXR/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
def generateRom(args, settings, ap_settings, auth, seed_name, logic, rnd=None, multiworld=None, player_name=None, player_names=[], player_id = 0):
rom_patches = []

if ap_settings["ap_title_screen"]:
rom_patches.append(pkgutil.get_data(__name__, "patches/title_screen.bdiff4"))

rom = ROMWithTables(args.input_filename, rom_patches)
rom.player_names = player_names
pymods = []
Expand Down Expand Up @@ -416,9 +413,7 @@ def clamp(x, min, max):
assert(len(auth) == 12)
rom.patch(0x00, SEED_LOCATION, None, binascii.hexlify(auth))


for pymod in pymods:
pymod.postPatch(rom)


return rom
17 changes: 14 additions & 3 deletions worlds/ladx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import binascii
import bsdiff4
import os
import pkgutil
import tempfile

from BaseClasses import Entrance, Item, ItemClassification, Location, Tutorial
from Fill import fill_restrictive
Expand Down Expand Up @@ -406,10 +409,18 @@ def generate_output(self, output_directory: str):
player_names=all_names,
player_id = self.player)

handle = open(out_path, "wb")
rom.save(handle, name="LADXR")
with open(out_path, "wb") as handle:
rom.save(handle, name="LADXR")

# Write title screen after everything else is done - full gfxmods may stomp over the egg tiles
if self.player_options["ap_title_screen"]:
with tempfile.NamedTemporaryFile(delete=False) as title_patch:
title_patch.write(pkgutil.get_data(__name__, "LADXR/patches/title_screen.bdiff4"))

bsdiff4.file_patch_inplace(out_path, title_patch.name)
os.unlink(title_patch.name)


handle.close()
patch = LADXDeltaPatch(os.path.splitext(out_path)[0]+LADXDeltaPatch.patch_file_ending, player=self.player,
player_name=self.multiworld.player_name[self.player], patched_path=out_path)
patch.write()
Expand Down

0 comments on commit 808203a

Please sign in to comment.