fix serial code

This commit is contained in:
Argon 2024-02-27 14:48:04 +08:00
parent 3101876a02
commit f3f09702e8
1 changed files with 2 additions and 2 deletions

View File

@ -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));
}