From e14c5996d4d9f3f96f20b15ccbaa007d5381f33e Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Sat, 17 Oct 2020 06:43:13 -0700 Subject: [PATCH] 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 --- core/src/cartridge/header.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/cartridge/header.rs b/core/src/cartridge/header.rs index 3b781ee..67c6bd7 100644 --- a/core/src/cartridge/header.rs +++ b/core/src/cartridge/header.rs @@ -56,10 +56,12 @@ pub fn parse(bytes: &[u8]) -> GBAResult { } let checksum = bytes[0xbd]; - if calculate_checksum(&bytes[0xa0..=0xbc]) != checksum { - return Err(GBAError::CartridgeLoadError( - "invalid header checksum".to_string(), - )); + let calculated_checksum = calculate_checksum(&bytes[0xa0..=0xbc]); + if calculated_checksum != checksum { + warn!( + "invalid header checksum, calculated {:02x} but expected {:02x}", + calculated_checksum, checksum + ); } let game_title = from_utf8(&bytes[0xa0..0xac])