diff --git a/src/patch.rs b/src/patch.rs new file mode 100644 index 0000000..faeac98 --- /dev/null +++ b/src/patch.rs @@ -0,0 +1,23 @@ +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::().unwrap()); + }, + false => panic!("\u{1F926}"), + } +} \ No newline at end of file