mirror of
https://github.com/Theaninova/WanganSunrise.git
synced 2026-01-22 01:22:42 +00:00
feat: bank stuff
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use crate::{section::EnmaSection, windows_pe::WindowsPEFile};
|
||||
use crate::{
|
||||
section::{read_bank_cell, EnmaBankCell, EnmaSection},
|
||||
windows_pe::WindowsPEFile,
|
||||
};
|
||||
use binrw::{BinRead, NullString};
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -53,19 +56,25 @@ pub fn read_area(file: &WindowsPEFile, address: u64) -> Result<EnmaArea, std::io
|
||||
related_area_addr: area.related_area_addr,
|
||||
unknown: area.unk2,
|
||||
sections: (0..area.section_count)
|
||||
.map(|i| file.read_addr::<EnmaSection>(area.sections_addr + i as u64 * 0x24))
|
||||
.map(|i| file.read_addr::<EnmaSection>(area.sections_addr + i as u64 * 0x28))
|
||||
.collect::<Result<_, _>>()?,
|
||||
bank_left: read_bank_cell(file, area.bank_left_addr, area.section_count)?,
|
||||
bank_right: read_bank_cell(file, area.bank_right_addr, area.section_count)?,
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct EnmaArea {
|
||||
/// A unique identifier for the area
|
||||
pub id: u64,
|
||||
/// The name of the area
|
||||
pub name: String,
|
||||
pub stage_id: u64,
|
||||
pub related_area_addr: [u64; 4],
|
||||
pub unknown: [f32; 4],
|
||||
pub sections: Vec<EnmaSection>,
|
||||
pub bank_left: Vec<EnmaBankCell>,
|
||||
pub bank_right: Vec<EnmaBankCell>,
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user