Skip to content

Commit

Permalink
Warn when SGB compatibility is set without old licensee 0x33
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Nov 1, 2023
1 parent 32bc68d commit a6fb6cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Binary file added test/fix/sgb-old-licensee.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions test/fix/sgb-old-licensee.err
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/fix/sgb-old-licensee.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-s

0 comments on commit a6fb6cd

Please sign in to comment.