From f3f09702e8cab2432373befa3033909a8206839e Mon Sep 17 00:00:00 2001 From: Argon Date: Tue, 27 Feb 2024 14:48:04 +0800 Subject: [PATCH] fix serial code --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b9b6a23..fd2be85 100644 --- a/src/main.rs +++ b/src/main.rs @@ -199,12 +199,12 @@ fn apply_code(patch_file : &str, codes : &Vec<(u32, u32)>) -> Result<(), String> let addr_diff = codes[pos + 2].1 & 0xffff; let val_diff = codes[pos + 3].1; while count != 0 { - if first_code & 0xf000000 == 0x1000000 { + if first_code & 0x7000000 == 0x1000000 { if addr >= max_data_len { return Err(format!("apply code error at line {}: address overflow", line)); } data[addr] = (val & 0xff) as u8; - } else if first_code & 0xf000000 == 0x2000000 { + } else if first_code & 0x7000000 == 0x2000000 { if addr + 1 >= max_data_len { return Err(format!("apply code error at line {}: address overflow", line)); }