From 11c47570ce03991c5e883f61244c01abda6e55b4 Mon Sep 17 00:00:00 2001 From: Ben10do Date: Sun, 3 Jun 2018 10:11:55 +0100 Subject: [PATCH] Fix the global checksum calculation in rgbfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A regression was spotted in rgbfix 0.3.7, where we would accidentally include the first byte of the existing checksum when calculating a global checksum. We now correctly ignore both of the existing checksum bytes. This was spotted when running rgbfix on the Pokémon Gold/Silver betas, as they have a non-zero global checksum. Fixes #280. Signed-off-by: Ben10do --- src/fix/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fix/main.c b/src/fix/main.c index f0da7600..d43ce6f2 100644 --- a/src/fix/main.c +++ b/src/fix/main.c @@ -478,9 +478,9 @@ int main(int argc, char *argv[]) int byte; while ((byte = fgetc(rom)) != EOF) { - i++; - if (i != 0x150) + if (i != 0x14E && i != 0x14F) globalcksum += byte; + i++; } if (ferror(rom))