From 073b4a1eb88e4b7537d073d82089452aa434d7b1 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sun, 27 Jun 2021 16:38:38 -0400 Subject: [PATCH] apply patch work started --- src/patch.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/patch.rs 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