Add RomData::is_randomizer.

This commit is contained in:
Lyle Mantooth 2022-06-01 09:53:11 -04:00
parent 568360206d
commit 41be111857
Signed by: IslandUsurper
GPG key ID: 6DB52EAE123A5789

View file

@ -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.");
}