mirror of
https://github.com/Theaninova/WanganSunrise.git
synced 2025-12-11 02:56:17 +00:00
non-guard
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
dist_cell::read_dist_cells,
|
||||
lane::EnmaLaneCell,
|
||||
non_guard::EnmaNonGuardCell,
|
||||
section::{read_bank_cell, EnmaBankCell, EnmaSection},
|
||||
speed::EnmaSpeedCell,
|
||||
windows_pe::WindowsPEFile,
|
||||
@@ -67,6 +68,8 @@ pub fn read_area(file: &WindowsPEFile, address: u64) -> Result<EnmaArea, std::io
|
||||
zebra_left: read_dist_cells(file, area.zebra_left_addr, area.max_dist, false)?,
|
||||
zebra_right: read_dist_cells(file, area.zebra_left_addr, area.max_dist, false)?,
|
||||
gaps: read_dist_cells(file, area.gaps_addr, area.max_dist, false)?,
|
||||
non_guard_left: read_dist_cells(file, area.non_guard_left_addr, area.max_dist, false)?,
|
||||
non_guard_right: read_dist_cells(file, area.non_guard_right_addr, area.max_dist, false)?,
|
||||
speed: read_dist_cells(file, area.speed_addr, area.max_dist, true)?,
|
||||
lane: read_dist_cells(file, area.lane_addr, area.max_dist, true)?,
|
||||
})
|
||||
@@ -87,8 +90,8 @@ pub struct EnmaArea {
|
||||
pub zebra_left: Vec<EnmaZebraCell>,
|
||||
pub zebra_right: Vec<EnmaZebraCell>,
|
||||
pub gaps: Vec<f32>,
|
||||
// TODO: Non Guard Left
|
||||
// TODO: Non Guard Right
|
||||
pub non_guard_left: Vec<EnmaNonGuardCell>,
|
||||
pub non_guard_right: Vec<EnmaNonGuardCell>,
|
||||
pub speed: Vec<EnmaSpeedCell>,
|
||||
pub lane: Vec<EnmaLaneCell>,
|
||||
}
|
||||
|
||||
@@ -17,6 +17,16 @@ impl EnmaDistCell for f32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl EnmaDistCell for (f32, i32) {
|
||||
fn dist(&self) -> f32 {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn size() -> u64 {
|
||||
8
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_dist_cells<'a, T>(
|
||||
file: &WindowsPEFile,
|
||||
mut address: u64,
|
||||
|
||||
@@ -2,6 +2,7 @@ pub mod area;
|
||||
pub mod dist_cell;
|
||||
pub mod lane;
|
||||
pub mod meta;
|
||||
pub mod non_guard;
|
||||
pub mod section;
|
||||
pub mod speed;
|
||||
mod util;
|
||||
|
||||
22
enmacompat/src/non_guard.rs
Normal file
22
enmacompat/src/non_guard.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use binrw::BinRead;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::dist_cell::EnmaDistCell;
|
||||
|
||||
#[derive(Debug, BinRead, Serialize)]
|
||||
pub struct EnmaNonGuardCell {
|
||||
pub dist: f32,
|
||||
pub unk1: f32,
|
||||
// TODO: Is this a boolean?
|
||||
pub guard: i32,
|
||||
}
|
||||
|
||||
impl EnmaDistCell for EnmaNonGuardCell {
|
||||
fn dist(&self) -> f32 {
|
||||
self.dist
|
||||
}
|
||||
|
||||
fn size() -> u64 {
|
||||
0xc
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user