libnds-rs/tests/main.rs
Conando 812df5e87c SystemData struct
Added a tests folder whuth a test to check that
the rust and C struct definitions agree
2024-05-09 14:59:28 +02:00

15 lines
528 B
Rust

use std::mem::size_of;
use nitro_rs::arm7::{PersonalData, SystemData, SystemDataRepresentation};
fn main() {
use std::io::Read;
println!("The struct is {} bytes in Rust.", size_of::<PersonalData>());
let mut file = std::fs::File::open("example.obj").unwrap();
let mut raw_obj = [0x00; 112];
file.read(&mut raw_obj).unwrap();
let obj: PersonalData = unsafe { std::mem::transmute_copy(&raw_obj) };
let datum: SystemDataRepresentation = obj.sys_data.into();
println!("{}", datum.settings_lost);
}