mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Add RGBFIX tests for MBC names (#1477)
RGBFIX tests are now based on .flags files The .bin and .err files are optional
This commit is contained in:
@@ -117,13 +117,14 @@ The object file will be linked with and without said flag, respectively; and in
|
|||||||
|
|
||||||
### RGBFIX
|
### RGBFIX
|
||||||
|
|
||||||
Each `.bin` file corresponds to one test, and **must** be accompanied by a `.flags` file and a `.err` file.
|
Each `.flags` file corresponds to one test.
|
||||||
|
Each one is a text file whose first line contains flags to pass to RGBFIX.
|
||||||
The `.flags` file is a text file whose first line contains flags to pass to RGBFIX.
|
|
||||||
(There may be more lines, which will be ignored; they can serve as comments to explain what the test is about.)
|
(There may be more lines, which will be ignored; they can serve as comments to explain what the test is about.)
|
||||||
|
|
||||||
RGBFIX will be invoked on the `.bin` file, and its error output must match the contents of the `.err` file.
|
RGBFIX will be invoked on the `.bin` file if it exists, or else on default-input.bin.
|
||||||
(If no errors ought to be printed, then the `.err` file should just be empty.)
|
|
||||||
|
If no `.err` file exists, RGBFIX is simply expected to be able to process the file normally.
|
||||||
|
If one *does* exist, RGBFIX's return status is ignored, but its output **must** match the `.err` file's contents.
|
||||||
|
|
||||||
Additionally, if a `.gb` file exists, the output of RGBFIX must match the `.gb`.
|
Additionally, if a `.gb` file exists, the output of RGBFIX must match the `.gb`.
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ enum MbcType {
|
|||||||
MBC_BAD, // Specified MBC does not exist / syntax error
|
MBC_BAD, // Specified MBC does not exist / syntax error
|
||||||
MBC_WRONG_FEATURES, // MBC incompatible with specified features
|
MBC_WRONG_FEATURES, // MBC incompatible with specified features
|
||||||
MBC_BAD_RANGE, // MBC number out of range
|
MBC_BAD_RANGE, // MBC number out of range
|
||||||
|
MBC_BAD_TPP1, // Invalid TPP1 major or minor revision numbers
|
||||||
};
|
};
|
||||||
|
|
||||||
static void printAcceptedMBCNames() {
|
static void printAcceptedMBCNames() {
|
||||||
@@ -170,7 +171,7 @@ static void printAcceptedMBCNames() {
|
|||||||
fputs("\tMBC6 ($20)\n", stderr);
|
fputs("\tMBC6 ($20)\n", stderr);
|
||||||
fputs("\tMBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)\n", stderr);
|
fputs("\tMBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)\n", stderr);
|
||||||
fputs("\tPOCKET_CAMERA ($FC)\n", stderr);
|
fputs("\tPOCKET_CAMERA ($FC)\n", stderr);
|
||||||
fputs("\tBANDAI_TAMA5 ($FD)\n", stderr);
|
fputs("\tBANDAI_TAMA5 ($FD) [aka TAMA5]\n", stderr);
|
||||||
fputs("\tHUC3 ($FE)\n", stderr);
|
fputs("\tHUC3 ($FE)\n", stderr);
|
||||||
fputs("\tHUC1+RAM+BATTERY ($FF)\n", stderr);
|
fputs("\tHUC1+RAM+BATTERY ($FF)\n", stderr);
|
||||||
|
|
||||||
@@ -332,12 +333,12 @@ static MbcType parseMBC(char const *name) {
|
|||||||
|
|
||||||
if (endptr == ptr) {
|
if (endptr == ptr) {
|
||||||
report("error: Failed to parse TPP1 major revision number\n");
|
report("error: Failed to parse TPP1 major revision number\n");
|
||||||
return MBC_BAD;
|
return MBC_BAD_TPP1;
|
||||||
}
|
}
|
||||||
ptr = endptr;
|
ptr = endptr;
|
||||||
if (val != 1) {
|
if (val != 1) {
|
||||||
report("error: RGBFIX only supports TPP1 versions 1.0\n");
|
report("error: RGBFIX only supports TPP1 version 1.0\n");
|
||||||
return MBC_BAD;
|
return MBC_BAD_TPP1;
|
||||||
}
|
}
|
||||||
tpp1Rev[0] = val;
|
tpp1Rev[0] = val;
|
||||||
tryReadSlice(".");
|
tryReadSlice(".");
|
||||||
@@ -345,12 +346,12 @@ static MbcType parseMBC(char const *name) {
|
|||||||
val = strtoul(ptr, &endptr, 10);
|
val = strtoul(ptr, &endptr, 10);
|
||||||
if (endptr == ptr) {
|
if (endptr == ptr) {
|
||||||
report("error: Failed to parse TPP1 minor revision number\n");
|
report("error: Failed to parse TPP1 minor revision number\n");
|
||||||
return MBC_BAD;
|
return MBC_BAD_TPP1;
|
||||||
}
|
}
|
||||||
ptr = endptr;
|
ptr = endptr;
|
||||||
if (val > 0xFF) {
|
if (val > 0xFF) {
|
||||||
report("error: TPP1 minor revision number must be 8-bit\n");
|
report("error: TPP1 minor revision number must be 8-bit\n");
|
||||||
return MBC_BAD;
|
return MBC_BAD_TPP1;
|
||||||
}
|
}
|
||||||
tpp1Rev[1] = val;
|
tpp1Rev[1] = val;
|
||||||
mbc = TPP1;
|
mbc = TPP1;
|
||||||
@@ -663,6 +664,7 @@ static char const *mbcName(MbcType type) {
|
|||||||
case MBC_BAD:
|
case MBC_BAD:
|
||||||
case MBC_WRONG_FEATURES:
|
case MBC_WRONG_FEATURES:
|
||||||
case MBC_BAD_RANGE:
|
case MBC_BAD_RANGE:
|
||||||
|
case MBC_BAD_TPP1:
|
||||||
unreachable_();
|
unreachable_();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,6 +688,7 @@ static bool hasRAM(MbcType type) {
|
|||||||
case MBC_BAD:
|
case MBC_BAD:
|
||||||
case MBC_WRONG_FEATURES:
|
case MBC_WRONG_FEATURES:
|
||||||
case MBC_BAD_RANGE:
|
case MBC_BAD_RANGE:
|
||||||
|
case MBC_BAD_TPP1:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ROM_RAM:
|
case ROM_RAM:
|
||||||
@@ -1324,8 +1327,8 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (cartridgeType == ROM_RAM || cartridgeType == ROM_RAM_BATTERY) {
|
} else if (cartridgeType == ROM_RAM || cartridgeType == ROM_RAM_BATTERY) {
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"warning: ROM+RAM / ROM+RAM+BATTERY are under-specified and poorly "
|
"warning: MBC \"%s\" is under-specified and poorly supported\n",
|
||||||
"supported\n"
|
musl_optarg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
-f l -L custom-logo.1bpp
|
-f l -L ./custom-logo.1bpp
|
||||||
|
|||||||
BIN
test/fix/default-input.bin
Normal file
BIN
test/fix/default-input.bin
Normal file
Binary file not shown.
23
test/fix/incompatible-features.err
Normal file
23
test/fix/incompatible-features.err
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
error: Features incompatible with MBC ("mbc1+multirumble")
|
||||||
|
Accepted combinations:
|
||||||
|
ROM ($00) [aka ROM_ONLY]
|
||||||
|
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
||||||
|
MBC2 ($05), MBC2+BATTERY ($06)
|
||||||
|
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
||||||
|
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
||||||
|
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
||||||
|
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
||||||
|
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
||||||
|
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
||||||
|
MBC6 ($20)
|
||||||
|
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
||||||
|
POCKET_CAMERA ($FC)
|
||||||
|
BANDAI_TAMA5 ($FD) [aka TAMA5]
|
||||||
|
HUC3 ($FE)
|
||||||
|
HUC1+RAM+BATTERY ($FF)
|
||||||
|
|
||||||
|
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
||||||
|
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
||||||
|
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
||||||
|
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
||||||
|
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
||||||
1
test/fix/incompatible-features.flags
Normal file
1
test/fix/incompatible-features.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m mbc1+multirumble
|
||||||
22
test/fix/list-mbcs.err
Normal file
22
test/fix/list-mbcs.err
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Accepted MBC names:
|
||||||
|
ROM ($00) [aka ROM_ONLY]
|
||||||
|
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
||||||
|
MBC2 ($05), MBC2+BATTERY ($06)
|
||||||
|
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
||||||
|
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
||||||
|
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
||||||
|
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
||||||
|
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
||||||
|
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
||||||
|
MBC6 ($20)
|
||||||
|
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
||||||
|
POCKET_CAMERA ($FC)
|
||||||
|
BANDAI_TAMA5 ($FD) [aka TAMA5]
|
||||||
|
HUC3 ($FE)
|
||||||
|
HUC1+RAM+BATTERY ($FF)
|
||||||
|
|
||||||
|
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
||||||
|
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
||||||
|
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
||||||
|
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
||||||
|
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
||||||
1
test/fix/list-mbcs.flags
Normal file
1
test/fix/list-mbcs.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m Help
|
||||||
1
test/fix/mbc-bandai-tama5.flags
Normal file
1
test/fix/mbc-bandai-tama5.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m BANDAI_TAMA5
|
||||||
BIN
test/fix/mbc-bandai-tama5.gb
Normal file
BIN
test/fix/mbc-bandai-tama5.gb
Normal file
Binary file not shown.
1
test/fix/mbc-huc1-ram-battery.flags
Normal file
1
test/fix/mbc-huc1-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m HUC1+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-huc1-ram-battery.gb
Normal file
BIN
test/fix/mbc-huc1-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-huc3.flags
Normal file
1
test/fix/mbc-huc3.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m HUC3
|
||||||
BIN
test/fix/mbc-huc3.gb
Normal file
BIN
test/fix/mbc-huc3.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc1-ram-battery.flags
Normal file
1
test/fix/mbc-mbc1-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC1+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc1-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc1-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc1-ram.flags
Normal file
1
test/fix/mbc-mbc1-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC1+RAM
|
||||||
BIN
test/fix/mbc-mbc1-ram.gb
Normal file
BIN
test/fix/mbc-mbc1-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc1.flags
Normal file
1
test/fix/mbc-mbc1.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC1
|
||||||
BIN
test/fix/mbc-mbc1.gb
Normal file
BIN
test/fix/mbc-mbc1.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc2-battery.flags
Normal file
1
test/fix/mbc-mbc2-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC2+BATTERY
|
||||||
BIN
test/fix/mbc-mbc2-battery.gb
Normal file
BIN
test/fix/mbc-mbc2-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc2.flags
Normal file
1
test/fix/mbc-mbc2.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC2
|
||||||
BIN
test/fix/mbc-mbc2.gb
Normal file
BIN
test/fix/mbc-mbc2.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc3-ram-battery.flags
Normal file
1
test/fix/mbc-mbc3-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC3+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc3-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc3-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc3-ram.flags
Normal file
1
test/fix/mbc-mbc3-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC3+RAM
|
||||||
BIN
test/fix/mbc-mbc3-ram.gb
Normal file
BIN
test/fix/mbc-mbc3-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc3-timer-battery.flags
Normal file
1
test/fix/mbc-mbc3-timer-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC3+TIMER+BATTERY
|
||||||
BIN
test/fix/mbc-mbc3-timer-battery.gb
Normal file
BIN
test/fix/mbc-mbc3-timer-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc3-timer-ram-battery.flags
Normal file
1
test/fix/mbc-mbc3-timer-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC3+TIMER+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc3-timer-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc3-timer-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc3.flags
Normal file
1
test/fix/mbc-mbc3.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC3
|
||||||
BIN
test/fix/mbc-mbc3.gb
Normal file
BIN
test/fix/mbc-mbc3.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5-ram-battery.flags
Normal file
1
test/fix/mbc-mbc5-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc5-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc5-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5-ram.flags
Normal file
1
test/fix/mbc-mbc5-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5+RAM
|
||||||
BIN
test/fix/mbc-mbc5-ram.gb
Normal file
BIN
test/fix/mbc-mbc5-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5-rumble-ram-battery.flags
Normal file
1
test/fix/mbc-mbc5-rumble-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5+RUMBLE+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc5-rumble-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc5-rumble-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5-rumble-ram.flags
Normal file
1
test/fix/mbc-mbc5-rumble-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5+RUMBLE+RAM
|
||||||
BIN
test/fix/mbc-mbc5-rumble-ram.gb
Normal file
BIN
test/fix/mbc-mbc5-rumble-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5-rumble.flags
Normal file
1
test/fix/mbc-mbc5-rumble.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5+RUMBLE
|
||||||
BIN
test/fix/mbc-mbc5-rumble.gb
Normal file
BIN
test/fix/mbc-mbc5-rumble.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc5.flags
Normal file
1
test/fix/mbc-mbc5.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC5
|
||||||
BIN
test/fix/mbc-mbc5.gb
Normal file
BIN
test/fix/mbc-mbc5.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc6.flags
Normal file
1
test/fix/mbc-mbc6.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC6
|
||||||
BIN
test/fix/mbc-mbc6.gb
Normal file
BIN
test/fix/mbc-mbc6.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mbc7-sensor-rumble-ram-battery.flags
Normal file
1
test/fix/mbc-mbc7-sensor-rumble-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MBC7+SENSOR+RUMBLE+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mbc7-sensor-rumble-ram-battery.gb
Normal file
BIN
test/fix/mbc-mbc7-sensor-rumble-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mmm01-ram-battery.flags
Normal file
1
test/fix/mbc-mmm01-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MMM01+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-mmm01-ram-battery.gb
Normal file
BIN
test/fix/mbc-mmm01-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mmm01-ram.flags
Normal file
1
test/fix/mbc-mmm01-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MMM01+RAM
|
||||||
BIN
test/fix/mbc-mmm01-ram.gb
Normal file
BIN
test/fix/mbc-mmm01-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-mmm01.flags
Normal file
1
test/fix/mbc-mmm01.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m MMM01
|
||||||
BIN
test/fix/mbc-mmm01.gb
Normal file
BIN
test/fix/mbc-mmm01.gb
Normal file
Binary file not shown.
1
test/fix/mbc-pocket-camera.flags
Normal file
1
test/fix/mbc-pocket-camera.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m POCKET_CAMERA
|
||||||
BIN
test/fix/mbc-pocket-camera.gb
Normal file
BIN
test/fix/mbc-pocket-camera.gb
Normal file
Binary file not shown.
1
test/fix/mbc-rom-only.flags
Normal file
1
test/fix/mbc-rom-only.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m ROM_ONLY
|
||||||
BIN
test/fix/mbc-rom-only.gb
Normal file
BIN
test/fix/mbc-rom-only.gb
Normal file
Binary file not shown.
1
test/fix/mbc-rom-ram-battery.err
Normal file
1
test/fix/mbc-rom-ram-battery.err
Normal file
@@ -0,0 +1 @@
|
|||||||
|
warning: MBC "ROM+RAM+BATTERY" is under-specified and poorly supported
|
||||||
1
test/fix/mbc-rom-ram-battery.flags
Normal file
1
test/fix/mbc-rom-ram-battery.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m ROM+RAM+BATTERY
|
||||||
BIN
test/fix/mbc-rom-ram-battery.gb
Normal file
BIN
test/fix/mbc-rom-ram-battery.gb
Normal file
Binary file not shown.
1
test/fix/mbc-rom-ram.err
Normal file
1
test/fix/mbc-rom-ram.err
Normal file
@@ -0,0 +1 @@
|
|||||||
|
warning: MBC "ROM+RAM" is under-specified and poorly supported
|
||||||
1
test/fix/mbc-rom-ram.flags
Normal file
1
test/fix/mbc-rom-ram.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m ROM+RAM
|
||||||
BIN
test/fix/mbc-rom-ram.gb
Normal file
BIN
test/fix/mbc-rom-ram.gb
Normal file
Binary file not shown.
1
test/fix/mbc-rom.flags
Normal file
1
test/fix/mbc-rom.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m ROM
|
||||||
BIN
test/fix/mbc-rom.gb
Normal file
BIN
test/fix/mbc-rom.gb
Normal file
Binary file not shown.
1
test/fix/mbc-tama5.flags
Normal file
1
test/fix/mbc-tama5.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m TAMA5
|
||||||
BIN
test/fix/mbc-tama5.gb
Normal file
BIN
test/fix/mbc-tama5.gb
Normal file
Binary file not shown.
@@ -1 +1 @@
|
|||||||
-m ROM -r 2
|
-m rom_only -r 2
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
-m MBC3+RAM -r 0
|
-m mbc3+ram -r 0
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
-m MBC3+RAM -r 2
|
-m mbc3+ram -r 2
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
-m MBC3 -r 0
|
-m mbc3 -r 0
|
||||||
|
|||||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
warning: ROM+RAM / ROM+RAM+BATTERY are under-specified and poorly supported
|
|
||||||
warning: Overwrote a non-zero byte in the cartridge type
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
-m8
|
|
||||||
Binary file not shown.
@@ -42,7 +42,7 @@ tryCmp () {
|
|||||||
runTest () {
|
runTest () {
|
||||||
flags=$(
|
flags=$(
|
||||||
head -n 1 "$2/$1.flags" | # Allow other lines to serve as comments
|
head -n 1 "$2/$1.flags" | # Allow other lines to serve as comments
|
||||||
sed "s#-L #-L ${src//#/\\#}/#g" # Prepend src directory to logo file
|
sed "s# ./# ${src//#/\\#}/#g" # Prepend src directory to path arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
for variant in '' ' piped'; do
|
for variant in '' ' piped'; do
|
||||||
@@ -51,26 +51,37 @@ runTest () {
|
|||||||
if [[ $progress -ne 0 ]]; then
|
if [[ $progress -ne 0 ]]; then
|
||||||
echo "${bold}${green}$1${variant}...${rescolors}${resbold}"
|
echo "${bold}${green}$1${variant}...${rescolors}${resbold}"
|
||||||
fi
|
fi
|
||||||
|
if [[ -r "$2/$1.bin" ]]; then
|
||||||
|
desired_input="$2/$1.bin"
|
||||||
|
else
|
||||||
|
desired_input="$src/default-input.bin"
|
||||||
|
fi
|
||||||
if [[ -z "$variant" ]]; then
|
if [[ -z "$variant" ]]; then
|
||||||
cp "$2/$1.bin" out.gb
|
cp "$desired_input" out.gb
|
||||||
if [[ -n "$(eval "$RGBFIX" $flags out.gb '2>out.err')" ]]; then
|
if [[ -n "$(eval "$RGBFIX" $flags out.gb '2>out.err')" ]]; then
|
||||||
echo "${bold}${red}Fixing $1 in-place shouldn't output anything on stdout!${rescolors}${resbold}"
|
echo "${bold}${red}Fixing $1 in-place shouldn't output anything on stdout!${rescolors}${resbold}"
|
||||||
our_rc=1
|
our_rc=1
|
||||||
fi
|
fi
|
||||||
subst='out.gb'
|
subst=out.gb
|
||||||
else
|
else
|
||||||
# Stop! This is not a Useless Use Of Cat. Using cat instead of
|
# Stop! This is not a Useless Use Of Cat. Using cat instead of
|
||||||
# stdin redirection makes the input an unseekable pipe - a scenario
|
# stdin redirection makes the input an unseekable pipe - a scenario
|
||||||
# that's harder to deal with.
|
# that's harder to deal with.
|
||||||
# shellcheck disable=SC2002
|
# shellcheck disable=SC2002
|
||||||
cat "$2/$1.bin" | eval $RGBFIX "$flags" - '>out.gb' '2>out.err'
|
cat "$desired_input" | eval $RGBFIX "$flags" - '>out.gb' '2>out.err'
|
||||||
subst='<stdin>'
|
subst='<stdin>'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed "s/$subst/<filename>/g" "out.err" | tryDiff "$2/$1.err" - "$1.err${variant}"
|
if [[ -r "$2/$1.err" ]]; then
|
||||||
|
desired_errname="$2/$1.err"
|
||||||
|
else
|
||||||
|
desired_errname=/dev/null
|
||||||
|
fi
|
||||||
|
sed "s/$subst/<filename>/g" out.err | tryDiff "$desired_errname" - "$1.err${variant}"
|
||||||
(( our_rc = our_rc || $? ))
|
(( our_rc = our_rc || $? ))
|
||||||
|
|
||||||
if [[ -r "$2/$1.gb" ]]; then
|
if [[ -r "$2/$1.gb" ]]; then
|
||||||
tryCmp "$2/$1.gb" "out.gb" "$1.gb${variant}"
|
tryCmp "$2/$1.gb" out.gb "$1.gb${variant}"
|
||||||
(( our_rc = our_rc || $? ))
|
(( our_rc = our_rc || $? ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -85,8 +96,8 @@ runTest () {
|
|||||||
rm -f padding*_* # Delete padding test cases generated but not deleted (e.g. interrupted)
|
rm -f padding*_* # Delete padding test cases generated but not deleted (e.g. interrupted)
|
||||||
|
|
||||||
progress=1
|
progress=1
|
||||||
for i in "$src"/*.bin; do
|
for i in "$src"/*.flags; do
|
||||||
runTest "$(basename "$i" .bin)" "$src"
|
runTest "$(basename "$i" .flags)" "$src"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check the result with all different padding bytes
|
# Check the result with all different padding bytes
|
||||||
@@ -103,9 +114,7 @@ for (( i=0; i < 10; ++i )); do
|
|||||||
runTest padding${suffix} .
|
runTest padding${suffix} .
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
echo "Done!"
|
echo "${bold}Done checking padding!${resbold}"
|
||||||
|
|
||||||
# TODO: check MBC names
|
|
||||||
|
|
||||||
# Check that RGBFIX errors out when inputting a non-existent file...
|
# Check that RGBFIX errors out when inputting a non-existent file...
|
||||||
$RGBFIX noexist 2>out.err
|
$RGBFIX noexist 2>out.err
|
||||||
|
|||||||
@@ -1,24 +1 @@
|
|||||||
error: Failed to parse TPP1 major revision number
|
error: Failed to parse TPP1 major revision number
|
||||||
error: Unknown MBC "TPP1_lol"
|
|
||||||
Accepted MBC names:
|
|
||||||
ROM ($00) [aka ROM_ONLY]
|
|
||||||
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
|
||||||
MBC2 ($05), MBC2+BATTERY ($06)
|
|
||||||
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
|
||||||
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
|
||||||
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
|
||||||
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
|
||||||
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
|
||||||
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
|
||||||
MBC6 ($20)
|
|
||||||
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
|
||||||
POCKET_CAMERA ($FC)
|
|
||||||
BANDAI_TAMA5 ($FD)
|
|
||||||
HUC3 ($FE)
|
|
||||||
HUC1+RAM+BATTERY ($FF)
|
|
||||||
|
|
||||||
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
|
||||||
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
|
||||||
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
|
||||||
|
|||||||
@@ -1,24 +1 @@
|
|||||||
error: Failed to parse TPP1 minor revision number
|
error: Failed to parse TPP1 minor revision number
|
||||||
error: Unknown MBC "TPP1_1.lol"
|
|
||||||
Accepted MBC names:
|
|
||||||
ROM ($00) [aka ROM_ONLY]
|
|
||||||
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
|
||||||
MBC2 ($05), MBC2+BATTERY ($06)
|
|
||||||
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
|
||||||
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
|
||||||
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
|
||||||
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
|
||||||
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
|
||||||
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
|
||||||
MBC6 ($20)
|
|
||||||
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
|
||||||
POCKET_CAMERA ($FC)
|
|
||||||
BANDAI_TAMA5 ($FD)
|
|
||||||
HUC3 ($FE)
|
|
||||||
HUC1+RAM+BATTERY ($FF)
|
|
||||||
|
|
||||||
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
|
||||||
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
|
||||||
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
|
||||||
|
|||||||
BIN
test/fix/tpp1-features.bin
Normal file
BIN
test/fix/tpp1-features.bin
Normal file
Binary file not shown.
5
test/fix/tpp1-features.err
Normal file
5
test/fix/tpp1-features.err
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
warning: Overwrote a non-zero byte in the cartridge type
|
||||||
|
warning: Overwrote a non-zero byte in the TPP1 identification code
|
||||||
|
warning: Overwrote a non-zero byte in the TPP1 revision number
|
||||||
|
warning: Overwrote a non-zero byte in the RAM size
|
||||||
|
warning: Overwrote a non-zero byte in the TPP1 feature flags
|
||||||
1
test/fix/tpp1-features.flags
Normal file
1
test/fix/tpp1-features.flags
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-m TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE -r 8
|
||||||
BIN
test/fix/tpp1-features.gb
Normal file
BIN
test/fix/tpp1-features.gb
Normal file
Binary file not shown.
@@ -1,24 +1 @@
|
|||||||
error: RGBFIX only supports TPP1 versions 1.0
|
error: RGBFIX only supports TPP1 version 1.0
|
||||||
error: Unknown MBC "TPP1_2.0"
|
|
||||||
Accepted MBC names:
|
|
||||||
ROM ($00) [aka ROM_ONLY]
|
|
||||||
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
|
||||||
MBC2 ($05), MBC2+BATTERY ($06)
|
|
||||||
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
|
||||||
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
|
||||||
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
|
||||||
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
|
||||||
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
|
||||||
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
|
||||||
MBC6 ($20)
|
|
||||||
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
|
||||||
POCKET_CAMERA ($FC)
|
|
||||||
BANDAI_TAMA5 ($FD)
|
|
||||||
HUC3 ($FE)
|
|
||||||
HUC1+RAM+BATTERY ($FF)
|
|
||||||
|
|
||||||
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
|
||||||
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
|
||||||
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
|
||||||
|
|||||||
@@ -1,24 +1 @@
|
|||||||
error: TPP1 minor revision number must be 8-bit
|
error: TPP1 minor revision number must be 8-bit
|
||||||
error: Unknown MBC "TPP1_1.256"
|
|
||||||
Accepted MBC names:
|
|
||||||
ROM ($00) [aka ROM_ONLY]
|
|
||||||
MBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)
|
|
||||||
MBC2 ($05), MBC2+BATTERY ($06)
|
|
||||||
ROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]
|
|
||||||
MMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)
|
|
||||||
MBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)
|
|
||||||
MBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)
|
|
||||||
MBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)
|
|
||||||
MBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)
|
|
||||||
MBC6 ($20)
|
|
||||||
MBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)
|
|
||||||
POCKET_CAMERA ($FC)
|
|
||||||
BANDAI_TAMA5 ($FD)
|
|
||||||
HUC3 ($FE)
|
|
||||||
HUC1+RAM+BATTERY ($FF)
|
|
||||||
|
|
||||||
TPP1_1.0, TPP1_1.0+RUMBLE, TPP1_1.0+MULTIRUMBLE, TPP1_1.0+TIMER,
|
|
||||||
TPP1_1.0+TIMER+RUMBLE, TPP1_1.0+TIMER+MULTIRUMBLE, TPP1_1.0+BATTERY,
|
|
||||||
TPP1_1.0+BATTERY+RUMBLE, TPP1_1.0+BATTERY+MULTIRUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER, TPP1_1.0+BATTERY+TIMER+RUMBLE,
|
|
||||||
TPP1_1.0+BATTERY+TIMER+MULTIRUMBLE
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user