Make it run (no actual randomizing yet).
This commit is contained in:
parent
87b0476b7e
commit
1113adca98
5 changed files with 196 additions and 27 deletions
29
enemize/src/randomize.rs
Normal file
29
enemize/src/randomize.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
use std::path::Path;
|
||||
|
||||
use anyhow::ensure;
|
||||
|
||||
use crate::PatchSet;
|
||||
use crate::option_flags::OptionFlags;
|
||||
use crate::rom::RomData;
|
||||
|
||||
impl RomData {
|
||||
pub fn randomize(&mut self, base_patch: &Path, option_flags: OptionFlags, seed: i32) -> anyhow::Result<()> {
|
||||
ensure!(self.is_randomizer(), "Enemizer only supports randomizer ROMs for input.");
|
||||
ensure!(!self.is_race(), "Enemizer does not support race roms.");
|
||||
|
||||
if self.is_enemizer() {
|
||||
// Reuse seed in ROM, not the one given.
|
||||
self.reset_enemizer();
|
||||
} else {
|
||||
self.set_enemizer_seed(seed);
|
||||
}
|
||||
|
||||
self.expand_rom();
|
||||
self.set_info_flags(option_flags)?;
|
||||
|
||||
let patches = PatchSet::load(base_patch)?;
|
||||
patches.patch_rom(self);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue