From e8ec0f072ddd0f49baf241cb1f59e5b5cfd54aaa Mon Sep 17 00:00:00 2001 From: Bobby Dilley Date: Fri, 29 Dec 2023 14:34:21 +0000 Subject: [PATCH] Fix lindbergh util and add HOTD4RevCTest --- src/lindbergh/config.c | 8 ++++++ src/lindbergh/config.h | 1 + src/lindbergh/lindbergh.c | 54 +++++++++++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index 76ed77a..28e22de 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -61,6 +61,12 @@ static int detectGame(uint32_t elf_crc) return 0; } + if(elf_crc == 0xDDECE1E9) { + config.game = THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST; + config.gameStatus = WORKING; + return 0; + } + if (elf_crc == 0x7235bda8) { config.game = THE_HOUSE_OF_THE_DEAD_4_TEST; @@ -313,6 +319,8 @@ char *getGameName() return "Virtua Tennis 3 Test Mode"; case THE_HOUSE_OF_THE_DEAD_4_STRIPPED: return "The House of the Dead 4 Rev C"; + case THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST: + return "The House of the Dead 4 Rev C Test Mode"; case INITIALD_4_REVE: return "Initial D 4 Exp Rev E"; default: diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 4db28d0..0511ee8 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -34,6 +34,7 @@ typedef enum SEGA_RACE_TV, THE_HOUSE_OF_THE_DEAD_4, THE_HOUSE_OF_THE_DEAD_4_STRIPPED, + THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST, THE_HOUSE_OF_THE_DEAD_4_SPECIAL, THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST, THE_HOUSE_OF_THE_DEAD_4_TEST, diff --git a/src/lindbergh/lindbergh.c b/src/lindbergh/lindbergh.c index 013857b..9c2b2fa 100644 --- a/src/lindbergh/lindbergh.c +++ b/src/lindbergh/lindbergh.c @@ -146,31 +146,57 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - if (game == NULL) - { - printf("Error: No lindbergh game found in this directory.\n"); - return EXIT_FAILURE; - } - // Build up the command to start the game - char command[128]; - strcpy(command, "./"); - strcat(command, game); + int testMode = 0; + int gdb = 0; + int forceGame = 0; + + char forceGamePath[128] = {0}; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0) { - testModePath(command); + testMode = 1; + continue; } if (strcmp(argv[i], "--gdb") == 0) { - char temp[128]; - strcpy(temp, "gdb "); - strcat(temp, command); - strcpy(command, temp); + gdb = 1; + continue; } + + // Treat the argument as the game name + strcpy(forceGamePath, argv[i]); + forceGame = 1; + } + + char command[128] = {0}; + strcpy(command, "./"); + if (forceGame) + { + strcat(command, forceGamePath); + } + else + { + if (game == NULL) + { + printf("Error: No lindbergh game found in this directory.\n"); + return EXIT_FAILURE; + } + strcat(command, game); + } + + if (testMode) + testModePath(command); + + if (gdb) + { + char temp[128]; + strcpy(temp, "gdb "); + strcat(temp, command); + strcpy(command, temp); } printf("$ %s\n", command);