feat: bank stuff

This commit is contained in:
2024-04-17 21:13:09 +02:00
parent 0f6bfc272c
commit ab161c5a64
5 changed files with 66 additions and 9 deletions

View File

@@ -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)]