diff --git a/src/fix/main.c b/src/fix/main.c index 1a872c96..dc5a3f3c 100644 --- a/src/fix/main.c +++ b/src/fix/main.c @@ -967,6 +967,10 @@ static void processFile(int input, int output, char const *name, off_t fileSize) if (oldLicensee != UNSPECIFIED) overwriteByte(rom0, 0x14B, oldLicensee, "old licensee code"); + else if (sgb && rom0[0x14B] != 0x33) + fprintf(stderr, + "warning: SGB compatibility enabled, but old licensee was %#x, not 0x33\n", + rom0[0x14B]); if (romVersion != UNSPECIFIED) overwriteByte(rom0, 0x14C, romVersion, "mask ROM version number"); diff --git a/test/fix/sgb-old-licensee.bin b/test/fix/sgb-old-licensee.bin new file mode 100644 index 00000000..929bea12 Binary files /dev/null and b/test/fix/sgb-old-licensee.bin differ diff --git a/test/fix/sgb-old-licensee.err b/test/fix/sgb-old-licensee.err new file mode 100644 index 00000000..2edaa257 --- /dev/null +++ b/test/fix/sgb-old-licensee.err @@ -0,0 +1,2 @@ +warning: Overwrote a non-zero byte in the SGB flag +warning: SGB compatibility enabled, but old licensee was 0xc5, not 0x33 diff --git a/test/fix/sgb-old-licensee.flags b/test/fix/sgb-old-licensee.flags new file mode 100644 index 00000000..5d9af957 --- /dev/null +++ b/test/fix/sgb-old-licensee.flags @@ -0,0 +1 @@ +-s diff --git a/test/fix/sgb.bin b/test/fix/sgb.bin index 3ab8ec34..28a68032 100644 Binary files a/test/fix/sgb.bin and b/test/fix/sgb.bin differ diff --git a/test/fix/sgb.gb b/test/fix/sgb.gb index 4cf70bb6..7816b245 100644 Binary files a/test/fix/sgb.gb and b/test/fix/sgb.gb differ