Skip to content

Commit

Permalink
feat: stage id obtain prereq
Browse files Browse the repository at this point in the history
  • Loading branch information
markisha64 committed Dec 2, 2023
1 parent 519e9f0 commit cf0d8cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub const EXP_FILE: &str = "AAA/PRO/STFGTREP.PRO";

pub const SHOPS_LEN: usize = 30;

pub const OVERLAYADDRESS: u32 = 0x800100c4;
pub const STAGEADDRESS: u32 = 0x800100c8;
pub const OVERLAY_ADDRESS: u32 = 0x800100c4;
pub const STAGE_ADDRESS: u32 = 0x800100c8;

pub const ENVIRONMENTAL_INSTRUCTION: &[u8; 4] = b"\x14\x00\x22\xae";

Expand Down Expand Up @@ -59,3 +59,5 @@ pub const DIGIVOLUTION_COUNT: usize = 44;

pub const MIN_STAT_AFFINITY: u8 = 1;
pub const MAX_STAT_AFFINITY: u8 = 5;

pub const STAGE_LOAD_DATA_LENGTH: usize = 241;
12 changes: 10 additions & 2 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ impl Executable {
// Executable::JAP => Pointer { value: 0x80099aa8 },
// }
// }

fn to_stage_load_data_address(&self) -> Pointer {
match self {
Executable::PAL => Pointer { value: 0x8009a884 },
Executable::USA => Pointer { value: 0x800998e4 },
Executable::JAP => Pointer { value: 0x8009a598 },
}
}
}

fn read_map_objects(path: &PathBuf, executable: &Executable, stage: &Pointer) -> Vec<MapObject> {
Expand Down Expand Up @@ -210,15 +218,15 @@ fn read_objects(path: &PathBuf) -> Objects {
let exp_buf = fs::read(format!("extract/{}/{}", rom_name, consts::EXP_FILE)).unwrap();

let overlay_address = Pointer {
value: consts::OVERLAYADDRESS,
value: consts::OVERLAY_ADDRESS,
};

let overlay = Pointer::from(
&main_buf[overlay_address.to_index() as usize..overlay_address.to_index() as usize + 4],
);

let stage_address = Pointer {
value: consts::STAGEADDRESS,
value: consts::STAGE_ADDRESS,
};

let stage = Pointer::from(
Expand Down

0 comments on commit cf0d8cb

Please sign in to comment.