snespatcher/src/patch.rs

23 lines
719 B
Rust
Raw Permalink Normal View History

2021-06-27 15:38:38 -05:00
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use std::path::{Path, PathBuf};
use byteorder::*;
pub fn apply_ips(ips_file: PathBuf, binary: PathBuf) {
match ips_file.exists() || binary.exists() {
true => {
let mut ips = File::open(ips_file).unwrap();
let mut bin = File::open(binary).unwrap();
let mut ips_str = String::new();
let mut bin_str = String::new();
ips.read_to_string(&mut ips_str).unwrap();
bin.read_to_string(&mut bin_str).unwrap();
ips.seek(SeekFrom::Start(5)).unwrap();
println!("{:?}", ips.read_f32::<BigEndian>().unwrap());
},
false => panic!("\u{1F926}"),
}
}