Added --boot option to the automatic tester to specify the boot ROM, better support for automatic testing of the mooneye-GB tests
This commit is contained in:
parent
c59272d46d
commit
623f92378d
@ -213,6 +213,7 @@ static void replace_extension(const char *src, size_t length, char *dest, const
|
|||||||
strcat(dest, ext);
|
strcat(dest, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#define str(x) #x
|
#define str(x) #x
|
||||||
@ -220,7 +221,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "SameBoy Tester v" xstr(VERSION) "\n");
|
fprintf(stderr, "SameBoy Tester v" xstr(VERSION) "\n");
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
fprintf(stderr, "Usage: %s [--dmg] [--start] [--length seconds]"
|
fprintf(stderr, "Usage: %s [--dmg] [--start] [--length seconds] [--boot path to boot ROM]"
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
" [--jobs number of tests to run simultaneously]"
|
" [--jobs number of tests to run simultaneously]"
|
||||||
#endif
|
#endif
|
||||||
@ -234,6 +235,8 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool dmg = false;
|
bool dmg = false;
|
||||||
|
const char *boot_rom_path = NULL;
|
||||||
|
|
||||||
for (unsigned i = 1; i < argc; i++) {
|
for (unsigned i = 1; i < argc; i++) {
|
||||||
if (strcmp(argv[i], "--dmg") == 0) {
|
if (strcmp(argv[i], "--dmg") == 0) {
|
||||||
fprintf(stderr, "Using DMG mode\n");
|
fprintf(stderr, "Using DMG mode\n");
|
||||||
@ -253,6 +256,12 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(argv[i], "--boot") == 0 && i != argc - 1) {
|
||||||
|
fprintf(stderr, "Using boot ROM %s\n", argv[i + 1]);
|
||||||
|
boot_rom_path = argv[++i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (strcmp(argv[i], "--jobs") == 0 && i != argc - 1) {
|
if (strcmp(argv[i], "--jobs") == 0 && i != argc - 1) {
|
||||||
max_forks = atoi(argv[++i]);
|
max_forks = atoi(argv[++i]);
|
||||||
@ -289,14 +298,14 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (dmg) {
|
if (dmg) {
|
||||||
GB_init(&gb);
|
GB_init(&gb);
|
||||||
if (GB_load_boot_rom(&gb, executable_relative_path("dmg_boot.bin"))) {
|
if (GB_load_boot_rom(&gb, boot_rom_path? boot_rom_path : executable_relative_path("dmg_boot.bin"))) {
|
||||||
perror("Failed to load boot ROM");
|
perror("Failed to load boot ROM");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GB_init_cgb(&gb);
|
GB_init_cgb(&gb);
|
||||||
if (GB_load_boot_rom(&gb, executable_relative_path("cgb_boot.bin"))) {
|
if (GB_load_boot_rom(&gb, boot_rom_path? boot_rom_path : executable_relative_path("cgb_boot.bin"))) {
|
||||||
perror("Failed to load boot ROM");
|
perror("Failed to load boot ROM");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -334,13 +343,15 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
/* This game temporarily sets SP to OAM RAM */
|
/* This game temporarily sets SP to OAM RAM */
|
||||||
allow_weird_sp_values = strcmp((const char *)(gb.rom + 0x134), "WDL:TT") == 0;
|
allow_weird_sp_values = strcmp((const char *)(gb.rom + 0x134), "WDL:TT") == 0 ||
|
||||||
|
/* Some mooneye-gb tests abuse the stack */
|
||||||
|
strcmp((const char *)(gb.rom + 0x134), "mooneye-gb test") == 0;
|
||||||
|
|
||||||
/* This game uses some recursive algorithms and therefore requires quite a large call stack */
|
/* This game uses some recursive algorithms and therefore requires quite a large call stack */
|
||||||
large_stack = memcmp((const char *)(gb.rom + 0x134), "MICRO EPAK1BM", strlen("MICRO EPAK1BM")) == 0 ||
|
large_stack = memcmp((const char *)(gb.rom + 0x134), "MICRO EPAK1BM", strlen("MICRO EPAK1BM")) == 0 ||
|
||||||
strcmp((const char *)(gb.rom + 0x134), "TECMO BOWL") == 0;
|
strcmp((const char *)(gb.rom + 0x134), "TECMO BOWL") == 0;
|
||||||
|
|
||||||
/* Pressing start while in the map in Tsuri Sensi will leak an internal screen-stack which
|
/* Pressing start while in the map in Tsuri Sensei will leak an internal screen-stack which
|
||||||
will eventually overflow, override an array of jump-table indexes, jump to a random
|
will eventually overflow, override an array of jump-table indexes, jump to a random
|
||||||
address, execute an invalid opcode, and crash. Pressing A twice while slowing down
|
address, execute an invalid opcode, and crash. Pressing A twice while slowing down
|
||||||
will prevent this scenario. */
|
will prevent this scenario. */
|
||||||
|
Loading…
Reference in New Issue
Block a user