shithub: rgbds

Download patch

ref: 11c47570ce03991c5e883f61244c01abda6e55b4
parent: f8b4cc52f6bd0cc2e06b531cd8a1a7daceefff9d
author: Ben10do <Ben10do@users.noreply.github.com>
date: Sun Jun 3 06:11:55 EDT 2018

Fix the global checksum calculation in rgbfix

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 <Ben10do@users.noreply.github.com>

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -478,9 +478,9 @@
 		int byte;
 
 		while ((byte = fgetc(rom)) != EOF) {
-			i++;
-			if (i != 0x150)
+			if (i != 0x14E && i != 0x14F)
 				globalcksum += byte;
+			i++;
 		}
 
 		if (ferror(rom))