From cfcadcaff793d4f36288ba5977b71ea9071a3baa Mon Sep 17 00:00:00 2001 From: Crumps Brother <> Date: Sun, 2 Oct 2022 20:13:42 -0500 Subject: [PATCH] Forfeit Trigger Adds a forfeit trigger to the status screen. Let's players quit a seed, but still see their super cool end game stats. --- common/dwr.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ notes/free_space.txt | 1 + 2 files changed, 48 insertions(+) diff --git a/common/dwr.c b/common/dwr.c index 0cf1092..99289e2 100644 --- a/common/dwr.c +++ b/common/dwr.c @@ -1945,6 +1945,51 @@ static void skip_vanilla_credits(dw_rom *rom) } } + +static void forfeit_trigger(dw_rom *rom) +{ + +/* After the status screen is opened it waits for any input at all before closing. */ +/* We're jumping off at that point to do almost the same thing, but with a twist. */ + vpatch(rom, 0xcfa4, 3, + 0x20, 0x00, 0xc9); /* JSR 0xC900 */ + + +/* After you open the status screen before anything else can happen you have to let */ +/* go of every button on the controller. This is vanilla behavior. Used to be that */ +/* pressing any button would then close the window. Now, any button that isn't */ +/* select or start will close the window. If you push select and start together at */ +/* the same time it takes you straight to the credits. */ + vpatch(rom, 0xc900, 40, + 0x20, 0x74, 0xff, /* These first two sections */ + 0x20, 0x08, 0xc6, /* are just rehashing the */ + 0xa5, 0x47, /* "let go of all buttons...*/ + 0xd0, 0xf6, + + 0x20, 0x74, 0xff, /* ...then press any button"*/ + 0x20, 0x08, 0xc6, /* code that's used in the */ + 0xa5, 0x47, /* status screen as well as */ + 0xf0, 0xf6, /* a couple other places. */ + + 0x29, 0xf3, /* AND 11110011 (bitwise code for every button that isn't start or select) */ + 0xf0, 0x01, /* BEQ 1 */ + 0x60, /* RTS (close the window) */ + + 0xa5, 0x47, /* LDA $47 (load button presses) */ + 0x29, 0x04, /* AND select_button */ + 0xf0, 0xeb, /* BEQ -21 (start the loop over */ + /* if only one is pressed)*/ + 0xa5, 0x47, /* LDA $47 (load button presses) */ + 0x29, 0x08, /* AND start_button */ + 0xf0, 0xe5, /* BEQ -27 (same as above) */ + + 0x4c, 0xed, 0xcc /* JMP 0xCCED (start credits) */ + + ); + + +} + /** * Sets up the extra expansion banks * @@ -2107,6 +2152,8 @@ uint64_t dwr_randomize(const char* input_file, uint64_t seed, char *flags, crc = crc64(0, rom.content, 0x10000); +forfeit_trigger(&rom); + update_title_screen(&rom); no_screen_flash(&rom); diff --git a/notes/free_space.txt b/notes/free_space.txt index 39d8b3d..4153546 100644 --- a/notes/free_space.txt +++ b/notes/free_space.txt @@ -39,6 +39,7 @@ C475 | C4BC | 71 | 3 | Torch/FW use in battle C4BC | C4CE | 18 | 3 | Three's Company C4CE | C4E8 | 26 | 3 | Cursed Princess C4E8 | C4F5 | 13 | 3 | Scared Metal Slimes +C900 | C927 | 40 | 3 | Forfeit Trigger E158 | E16E | 22 | 3 | Scaled Metal Slime XP FF7D | FF8E | 17 | 3 | Fighter's Ring fix FF54 | FF57 | 3 | 3 | Fighter's Ring fix