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>
This commit is contained in:
Ben10do
2018-06-03 10:11:55 +01:00
parent f8b4cc52f6
commit 11c47570ce

View File

@@ -478,9 +478,9 @@ int main(int argc, char *argv[])
int byte; int byte;
while ((byte = fgetc(rom)) != EOF) { while ((byte = fgetc(rom)) != EOF) {
i++; if (i != 0x14E && i != 0x14F)
if (i != 0x150)
globalcksum += byte; globalcksum += byte;
i++;
} }
if (ferror(rom)) if (ferror(rom))