This commit is contained in:
Lyle Mantooth 2022-06-05 15:56:36 -04:00
parent a0150caa56
commit d1d4e31738
Signed by: IslandUsurper
GPG key ID: 6DB52EAE123A5789
2 changed files with 16 additions and 15 deletions

View file

@ -16,19 +16,19 @@ pub fn load_symbols(contents: &str) -> anyhow::Result<Symbols> {
_ => None, _ => None,
} }
}) })
.filter_map(|(symbol, mut address)| { .filter_map(|(symbol, mut address)| {
if let Some(colon_at) = address.find(':') { if let Some(colon_at) = address.find(':') {
address.remove(colon_at); address.remove(colon_at);
} }
// Filter out the ones that don't have a hexadecimal number as the first word. // Filter out the ones that don't have a hexadecimal number as the first word.
let snes_address = u32::from_str_radix(&address, 16).ok()?; let snes_address = u32::from_str_radix(&address, 16).ok()?;
let pc_address = snes_to_pc_address(snes_address); let pc_address = snes_to_pc_address(snes_address);
Some((symbol, pc_address)) Some((symbol, pc_address))
}) })
.collect(); .collect();
Ok(symbols) Ok(symbols)
} }

View file

@ -387,13 +387,11 @@ pub struct OptionFlags {
pub enemy_damage_chaos_mode: bool, pub enemy_damage_chaos_mode: bool,
//pub easy_mode_escape: bool, //pub easy_mode_escape: bool,
pub enemies_absorbable: bool, pub enemies_absorbable: bool,
pub absorbable_spawn_rate: u8, pub absorbable_spawn_rate: u8,
pub absorbable_types: HashMap<AbsorbableType, bool>, pub absorbable_types: HashMap<AbsorbableType, bool>,
//pub boss_madness: bool, //pub boss_madness: bool,
pub randomize_bosses: bool, pub randomize_bosses: bool,
pub randomize_bosses_type: RandomizeBossesType, pub randomize_bosses_type: RandomizeBossesType,
@ -406,7 +404,6 @@ pub struct OptionFlags {
//pub randomize_boss_damage_max_amount: u8, //pub randomize_boss_damage_max_amount: u8,
//pub randomize_boss_behavior: bool, //pub randomize_boss_behavior: bool,
pub randomize_dungeon_palettes: bool, pub randomize_dungeon_palettes: bool,
pub set_blackout_mode: bool, pub set_blackout_mode: bool,
@ -766,8 +763,12 @@ mod test {
fn test_option_flags_serde() { fn test_option_flags_serde() {
let empty = "{}"; let empty = "{}";
let actual: OptionFlags = serde_json::from_str(empty).expect("Can't deserialize empty"); let actual: OptionFlags = serde_json::from_str(empty).expect("Can't deserialize empty");
let expected = serde_json::to_string(&OptionFlags::default()).expect("Can't serialize default"); let expected =
serde_json::to_string(&OptionFlags::default()).expect("Can't serialize default");
assert_eq!(serde_json::to_string(&actual).expect("Can't roundtrip"), expected); assert_eq!(
serde_json::to_string(&actual).expect("Can't roundtrip"),
expected
);
} }
} }