core: cartridge: Don't error when the checksum is invalid.

A lot of test ROMs i'm using don't bother to calculate the checksum :\


Former-commit-id: da02a70271c34bc26e560ea18b3f5052ee171a65
Former-commit-id: 332d917e47b268ae649574844d14cab2da65197d
This commit is contained in:
Michel Heily 2020-10-17 06:43:13 -07:00
parent a3546cbe07
commit e14c5996d4

View file

@ -56,10 +56,12 @@ pub fn parse(bytes: &[u8]) -> GBAResult<CartridgeHeader> {
} }
let checksum = bytes[0xbd]; let checksum = bytes[0xbd];
if calculate_checksum(&bytes[0xa0..=0xbc]) != checksum { let calculated_checksum = calculate_checksum(&bytes[0xa0..=0xbc]);
return Err(GBAError::CartridgeLoadError( if calculated_checksum != checksum {
"invalid header checksum".to_string(), warn!(
)); "invalid header checksum, calculated {:02x} but expected {:02x}",
calculated_checksum, checksum
);
} }
let game_title = from_utf8(&bytes[0xa0..0xac]) let game_title = from_utf8(&bytes[0xa0..0xac])