From 41be111857e8660b44378525d47e409852f3b40b Mon Sep 17 00:00:00 2001 From: Lyle Mantooth Date: Wed, 1 Jun 2022 09:53:11 -0400 Subject: [PATCH] Add RomData::is_randomizer. --- enemize/src/rom.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/enemize/src/rom.rs b/enemize/src/rom.rs index 8b7a2e0..95b1fb6 100644 --- a/enemize/src/rom.rs +++ b/enemize/src/rom.rs @@ -69,6 +69,29 @@ impl RomData { && self.rom_data[self.asar_symbols["enemizer_info_table"] + ENEMIZER_INFO_SEED_OFFSET + 1] == b'N' } + pub fn is_randomizer(&self) -> bool { + let acceptable = [ + // item rando + b"VT", + // entrance rando + b"ER", + // door rando + b"DR", + // Berserker's multiworld + b"BM", + // Berserker's multiworld doors + b"BD", + // Archipelago + b"AP", + // Archipelago with door rando + b"AD", + ]; + + acceptable.iter().any(|abbr| &abbr[..] == &self.rom_data[0x7FC0..0x7Fc1]) || + (self.rom_data.len() >= 0x20_0000 && + &self.rom_data[0x7FC0..0x7FCE] == b"ZELDANODENSETSU") + } + fn assert_rom_length(&self) { assert!(self.rom_data.len() >= ENEMIZER_FILE_LENGTH, "You need to expand the rom before you can use Enemizer features."); }