From 94a9f565337587cb40d7db9a3cf474826d74cb0a Mon Sep 17 00:00:00 2001 From: Bobby Dilley Date: Tue, 16 Jan 2024 23:11:56 +0000 Subject: [PATCH] Rework game detection, sorry if I broke anything --- src/lindbergh/config.c | 372 ++++++++++++++------------------------ src/lindbergh/config.h | 123 +++++++------ src/lindbergh/eeprom.c | 2 +- src/lindbergh/graphics.c | 4 +- src/lindbergh/hook.c | 21 +-- src/lindbergh/input.c | 42 +---- src/lindbergh/lindbergh.c | 10 +- src/lindbergh/patch.c | 8 +- 8 files changed, 234 insertions(+), 348 deletions(-) diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index 5d2535d..8df85ec 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -33,379 +33,281 @@ static char *getNextToken(char *buffer, char *seperator, char **saveptr) static int detectGame(uint32_t elf_crc) { - if (elf_crc == 0x93ea7e11) + switch (elf_crc) { - config.game = SEGABOOT_2_4; + + case SEGABOOT_2_4: + { + config.gameTitle = "Segaboot 2.4"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x3cc635ee) + case SEGABOOT_2_4_SYM: { - config.game = SEGABOOT_2_4_SYM; + config.gameTitle = "Segaboot 2.4 with symbols"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xbc0c9ffa) + case THE_HOUSE_OF_THE_DEAD_4: + case THE_HOUSE_OF_THE_DEAD_4_TEST: { - config.game = THE_HOUSE_OF_THE_DEAD_4; + config.gameTitle = "The House of the Dead 4"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x5df569f5) + case THE_HOUSE_OF_THE_DEAD_4_STRIPPED: + case THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST: { - config.game = THE_HOUSE_OF_THE_DEAD_4_STRIPPED; + config.gameTitle = "The House of the Dead 4 Rev A"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xDDECE1E9) + case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: + case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST: { - config.game = THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST; + config.gameTitle = "The House of the Dead 4 Special"; + config.emulateRideboard = 1; config.gameStatus = WORKING; return 0; } + break; + + case THE_HOUSE_OF_THE_DEAD_EX: + case THE_HOUSE_OF_THE_DEAD_EX_TEST: - if (elf_crc == 0x7235bda8) { - config.game = THE_HOUSE_OF_THE_DEAD_4_TEST; + config.gameTitle = "The House of the Dead EX"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x12266f81) + case OUTRUN_2_SP_SDX_REVA: + case OUTRUN_2_SP_SDX_REVA_TEST: { - config.game = THE_HOUSE_OF_THE_DEAD_4_SPECIAL; - config.gameStatus = WORKING; - return 0; - } - - if (elf_crc == 0x83ba3b45) - { - config.game = THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST; - config.gameStatus = WORKING; - return 0; - } - - if (elf_crc == 0x85c0c22a) - { - config.game = THE_HOUSE_OF_THE_DEAD_EX; - config.gameStatus = WORKING; - return 0; - } - - if (elf_crc == 0xb9a166bb) - { - config.game = THE_HOUSE_OF_THE_DEAD_EX_TEST; - config.gameStatus = WORKING; - return 0; - } - - if (elf_crc == 0x6d055308) - { - config.game = OUTRUN_2_SP_SDX_REVA; + config.gameTitle = "Outrun 2 SP SDX"; config.emulateDriveboard = 1; config.emulateMotionboard = 1; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xffdccaaa) + case VIRTUA_FIGHTER_5_EXPORT: { - config.game = OUTRUN_2_SP_SDX_REVA_TEST; - config.emulateDriveboard = 1; - config.emulateMotionboard = 1; + config.gameTitle = "Virtua Fighter 5 Export"; + config.gameDVP = "DVP-0043"; config.gameStatus = WORKING; return 0; } + break; - if(elf_crc == 0x157B0576) { - config.game = VIRTUA_FIGHTER_5_EXPORT; + case LETS_GO_JUNGLE: + { + config.gameTitle = "Let's Go Jungle! Lost on the Island of Spice!"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xd4726d61) + case LETS_GO_JUNGLE_SPECIAL: { - config.game = LETS_GO_JUNGLE; + config.gameTitle = "Let's Go Jungle! Special!"; + config.emulateRideboard = 1; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xbbabc0e0) + case AFTER_BURNER_CLIMAX: { - config.game = LETS_GO_JUNGLE_SPECIAL; - config.gameStatus = NOT_WORKING; - return 0; - } - - if (elf_crc == 0xcc02de7d) - { - config.game = AFTER_BURNER_CLIMAX; + config.gameTitle = "After Burner Climax"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x152530dd) + case AFTER_BURNER_CLIMAX_REVA: { - config.game = AFTER_BURNER_CLIMAX_REVA; + config.gameTitle = "After Burner Climax Rev A"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x5c18953c) + case AFTER_BURNER_CLIMAX_SDX: { - config.game = AFTER_BURNER_CLIMAX_SDX; + config.gameTitle = "After Burner Climax SDX"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x9af7cb29) + case AFTER_BURNER_CLIMAX_CE: { - config.game = AFTER_BURNER_CLIMAX_CE; + config.gameTitle = "After Burner Climax CE"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x4e9ccf33) + case INITIALD_4: { - config.game = INITIALD_4; - config.gameStatus = NOT_WORKING; + config.gameTitle = "Initial D Arcade Stage 4"; + config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x7f3f9f0c) + case INITIALD_4_REVE: { - config.game = INITIALD_4_REVE; - config.gameStatus = NOT_WORKING; + config.gameTitle = "Initial D Arcade Stage 4 Rev E"; + config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xfb096f81) + case SEGA_RACE_TV: { - config.game = SEGA_RACE_TV; - config.emulateDriveboard = 1; - config.gameStatus = NOT_WORKING; - return 0; - } - - if (elf_crc == 0x77ebac34) - { - config.game = RAMBO; - config.gameStatus = NOT_WORKING; - return 0; - } - - if (elf_crc == 0xb05d9bbe) - { - config.game = R_TUNED; + config.gameTitle = "SEGA Race TV"; config.emulateDriveboard = 1; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0x4c768eb4) + case RAMBO: { - config.game = TOO_SPICY; + config.gameTitle = "Rambo"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xc4b7e89) + case R_TUNED: { - config.game = VIRTUA_TENNIS_3; + config.gameTitle = "R Tuned"; + config.emulateDriveboard = 1; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xffe3b0fd) + case TOO_SPICY: { - config.game = VIRTUA_TENNIS_3_TEST; - config.gameStatus = NOT_WORKING; - return 0; - } - - if (elf_crc == 0x1bf1b627) - { - config.game = VIRTUA_FIGHTER_5_REVC; + config.gameTitle = "Too Spicy"; config.gameStatus = WORKING; return 0; } + break; - if(elf_crc == 0xC4B05D40) { - config.game = VIRTUA_FIGHTER_5_REVE; - config.gameStatus = NOT_WORKING; - return 0; - } - - if (elf_crc == 0x3CC635EE) + case VIRTUA_TENNIS_3: + case VIRTUA_TENNIS_3_TEST: { - config.game = SEGABOOT_2_4; + config.gameTitle = "Virtua Tennis 3"; config.gameStatus = WORKING; return 0; } + break; - if (elf_crc == 0xcdbc8069) + case VIRTUA_FIGHTER_5_REVC: { - config.game = PRIMEVAL_HUNT; + config.gameTitle = "Virtua Fighter 5 Rev C"; + config.gameStatus = WORKING; + return 0; + } + break; + + case VIRTUA_FIGHTER_5_REVE: + { + config.gameTitle = "Virtua Fighter 5 Rev E"; config.gameStatus = NOT_WORKING; return 0; } + break; - if (elf_crc == 0xe60d8e04) + case PRIMEVAL_HUNT: { - config.game = GHOST_SQUAD_EVOLUTION; + config.gameTitle = "Primeval Hunt"; config.gameStatus = NOT_WORKING; return 0; } + break; - if (elf_crc == 0x14d1292a) + case GHOST_SQUAD_EVOLUTION: { - config.game = INITIALD_5_EXP_20; + config.gameTitle = "Ghost Squad Evolution"; config.gameStatus = NOT_WORKING; return 0; } + break; - if (elf_crc == 0x722ebbc4) + case INITIALD_5_EXP_20: { - config.game = INITIALD_ARCADE_STAGE_5; + config.gameTitle = "Initial D Arcade Stage 5 Export Ver 2.0"; config.gameStatus = NOT_WORKING; return 0; } + break; - if (elf_crc == 0xc85f106a) + case INITIALD_ARCADE_STAGE_5: { - config.game = HUMMER_EXTREME; + config.gameTitle = "Initial D Arcade Stage 5"; config.gameStatus = NOT_WORKING; return 0; } + break; - if (elf_crc == 0xB6479554) + case HUMMER_EXTREME: { - config.game = LETS_GO_JUNGLE_REVA; + config.gameTitle = "Hummer Extreme"; + config.gameID = "SBST"; + config.gameDVP = "DVP-0079"; + config.gameType = DRIVING; + config.gameStatus = WORKING; + return 0; + } + break; + + case LETS_GO_JUNGLE_REVA: + { + config.gameTitle = "Lets Go Jungle Rev A"; config.gameStatus = NOT_WORKING; return 0; } + break; + + default: + { + config.crc32 = UNKNOWN; + } + break; + } - config.game = UNKNOWN; return 1; } char *getGameName() { - char *unknownGameTitle = "Unknown Game"; - switch (config.game) - { - case AFTER_BURNER_CLIMAX: - return "After Burner Climax"; - case AFTER_BURNER_CLIMAX_REVA: - return "After Burner Climax Rev A"; - case AFTER_BURNER_CLIMAX_REVB: - return "After Burner Climax Rev B"; - case AFTER_BURNER_CLIMAX_SDX: - return "After Burner Climax SDX"; - case AFTER_BURNER_CLIMAX_SDX_REVA: - return "After Burner Climax SDX Rev A"; - case AFTER_BURNER_CLIMAX_CE: - return "After Burner Climax CE2"; - case GHOST_SQUAD_EVOLUTION: - return "Ghost Squad Evolution"; - case HARLEY_DAVIDSON: - return "Harley Davidson: King of the Road"; - case HUMMER: - return "Hummer"; - case HUMMER_EXTREME: - return "Hummer Extreme"; - case HUMMER_EXTREME_MDX: - return "Hummer Extreme MDX"; - case INITIALD_4: - return "Initial D Arcade Stage 4"; - case INITIALD_4_REVE: - return "Initial D Arcade Stage 4 EXP Rev E"; - case INITIALD_5_EXP_20: - return "Initial D Arcade Stage 5 Ver.2.0"; - case INITIALD_ARCADE_STAGE_5: - return "Initial D Arcade Stage 5"; - case LETS_GO_JUNGLE_REVA: - return "Let's Go Jungle! Lost on the Island of Spice! Rev A"; - case LETS_GO_JUNGLE: - return "Let's Go Jungle! Lost on the Island of Spice!"; - case LETS_GO_JUNGLE_SPECIAL: - return "Let's Go Jungle! Special!"; - case VIRTUA_FIGHTER_5_EXPORT: - return "Virtua Fighter 5 Export"; - case OUTRUN_2_SP_SDX: - return "Outrun 2 SP SDX"; - case OUTRUN_2_SP_SDX_REVA: - return "Outrun 2 SP SDX Rev A"; - case OUTRUN_2_SP_SDX_REVA_TEST: - return "Outrun 2 SP SDX Rev A Test Mode"; - case OUTRUN_2_SP_SDX_TEST: - return "Outrun 2 SP SDX Test Mode"; - case PRIMEVAL_HUNT: - return "Primeval Hunt"; - case RAMBO: - return "Rambo"; - case RAMBO_CHINA: - return "Rambo China Release"; - case R_TUNED: - return "R-Tuned Ultimate Street Racing"; - case SEGABOOT: - return "Segaboot"; - case SEGABOOT_2_4: - return "SEGABOOT 2.4"; - case SEGABOOT_2_4_SYM: - return "SEGABOOT 2.4 with Symbols"; - case SEGABOOT_2_6: - return "SEGABOOT 2.6"; - case SEGA_RACE_TV: - return "SEGA Race TV"; - case THE_HOUSE_OF_THE_DEAD_4: - return "The House of the Dead 4"; - case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: - return "The House of the Dead 4 Special"; - case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST: - return "The House of the Dead 4 Special Test Mode"; - case THE_HOUSE_OF_THE_DEAD_4_TEST: - return "The House of the Dead 4 Test Mode"; - case THE_HOUSE_OF_THE_DEAD_EX: - return "The House of the Dead Ex"; - case TOO_SPICY: - return "2 Step : 2 Spicy"; - case UNKNOWN: - return unknownGameTitle; - case VIRTUA_FIGHTER_5: - return "Virtua Fighter 5"; - case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN: - return "Virtua Fighter 5 Final Showdown"; - case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA: - return "Virtua Fighter 5 Final Showdown Rev A"; - case VIRTUA_FIGHTER_5_R: - return " Virtua Fighter 5 R"; - case VIRTUA_FIGHTER_5_REVA: - return "Virtua Fighter 5 Rev A"; - case VIRTUA_FIGHTER_5_REVB: - return "Virtua Fighter 5 Rev B"; - case VIRTUA_FIGHTER_5_REVC: - return "Virtua Fighter 5 Rev C"; - case VIRTUA_FIGHTER_5_REVE: - return "Virtua Fighter 5 Rev E"; - case VIRTUA_FIGHTER_5_R_REVD: - return "Virtua Fighter 5 Rev D"; - case VIRTUA_TENNIS_3: - return "Virtua Tennis 3"; - case VIRTUA_TENNIS_3_TEST: - 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"; - default: - return unknownGameTitle; - } - return unknownGameTitle; + return config.gameTitle; +} + +char *getDVPName() +{ + return config.gameDVP; +} + +char *getGameID() +{ + return config.gameID; } int readConfig(FILE *configFile, EmulatorConfig *config) @@ -514,6 +416,10 @@ int initConfig() config.region = -1; config.freeplay = -1; config.showDebugMessages = 0; + config.gameTitle = "Unknown game"; + config.gameID = "XXXX"; + config.gameDVP = "DVP-XXXX"; + config.gameType = SHOOTING; if (detectGame(config.crc32) != 0) { printf("Warning: Unsure what game with CRC 0x%X is. Please submit this new game to the GitHub repository: https://github.com/bobbydilley/lindbergh-loader/issues/new?title=Please+add+new+game+0x%X&body=I+tried+to+launch+the+following+game:\n", config.crc32, config.crc32); diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index de4bf14..bc838d4 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -2,62 +2,59 @@ #define MAX_PATH_LENGTH 1024 -typedef enum -{ - AFTER_BURNER_CLIMAX, - AFTER_BURNER_CLIMAX_REVA, - AFTER_BURNER_CLIMAX_REVB, - AFTER_BURNER_CLIMAX_SDX, - AFTER_BURNER_CLIMAX_SDX_REVA, - AFTER_BURNER_CLIMAX_CE, - GHOST_SQUAD_EVOLUTION, - HARLEY_DAVIDSON, - HUMMER, - HUMMER_EXTREME, - HUMMER_EXTREME_MDX, - INITIALD_4, - INITIALD_4_REVE, - INITIALD_5_EXP_20, - INITIALD_ARCADE_STAGE_5, - LETS_GO_JUNGLE, - LETS_GO_JUNGLE_REVA, - LETS_GO_JUNGLE_SPECIAL, - OUTRUN_2_SP_SDX, - OUTRUN_2_SP_SDX_REVA, - OUTRUN_2_SP_SDX_REVA_TEST, - OUTRUN_2_SP_SDX_TEST, - PRIMEVAL_HUNT, - RAMBO, - RAMBO_CHINA, - R_TUNED, - SEGABOOT, - SEGABOOT_2_4, - SEGABOOT_2_4_SYM, - SEGABOOT_2_6, - 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, - THE_HOUSE_OF_THE_DEAD_EX, - THE_HOUSE_OF_THE_DEAD_EX_TEST, - TOO_SPICY, - UNKNOWN, - VIRTUA_FIGHTER_5, - VIRTUA_FIGHTER_5_FINAL_SHOWDOWN, - VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA, - VIRTUA_FIGHTER_5_R, - VIRTUA_FIGHTER_5_REVA, - VIRTUA_FIGHTER_5_REVB, - VIRTUA_FIGHTER_5_REVC, - VIRTUA_FIGHTER_5_REVE, - VIRTUA_FIGHTER_5_EXPORT, - VIRTUA_FIGHTER_5_R_REVD, - VIRTUA_TENNIS_3, - VIRTUA_TENNIS_3_TEST -} Game; +#define AFTER_BURNER_CLIMAX 0xcc02de7d +#define AFTER_BURNER_CLIMAX_REVA 0x152530dd +#define AFTER_BURNER_CLIMAX_REVB 0x0002 +#define AFTER_BURNER_CLIMAX_SDX 0x5c18953c +#define AFTER_BURNER_CLIMAX_SDX_REVA 0x0004 +#define AFTER_BURNER_CLIMAX_CE 0x9af7cb29 +#define GHOST_SQUAD_EVOLUTION 0xe60d8e04 +#define HARLEY_DAVIDSON 0x0007 +#define HUMMER 0x0008 +#define HUMMER_EXTREME 0xc85f106a +#define HUMMER_EXTREME_MDX 0x0010 +#define INITIALD_4 0x4e9ccf33 +#define INITIALD_4_REVE 0x7f3f9f0c +#define INITIALD_5_EXP_20 0x14d1292a +#define INITIALD_ARCADE_STAGE_5 0x722ebbc4 +#define LETS_GO_JUNGLE 0xd4726d61 +#define LETS_GO_JUNGLE_REVA 0xB6479554 +#define LETS_GO_JUNGLE_SPECIAL 0xbbabc0e0 +#define OUTRUN_2_SP_SDX 0x0019 +#define OUTRUN_2_SP_SDX_REVA 0x6d055308 +#define OUTRUN_2_SP_SDX_REVA_TEST 0xffdccaaa +#define OUTRUN_2_SP_SDX_TEST 0x0022 +#define PRIMEVAL_HUNT 0xcdbc8069 +#define RAMBO 0x77ebac34 +#define RAMBO_CHINA 0x0025 +#define R_TUNED 0xb05d9bbe +#define SEGABOOT 0x0027 +#define SEGABOOT_2_4 0x93ea7e11 +#define SEGABOOT_2_4_SYM 0x3cc635ee +#define SEGABOOT_2_6 0x0030 +#define SEGA_RACE_TV 0xfb096f81 +#define THE_HOUSE_OF_THE_DEAD_4 0xbc0c9ffa +#define THE_HOUSE_OF_THE_DEAD_4_STRIPPED 0x5df569f5 +#define THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST 0xDDECE1E9 +#define THE_HOUSE_OF_THE_DEAD_4_SPECIAL 0x12266f81 +#define THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST 0x83ba3b45 +#define THE_HOUSE_OF_THE_DEAD_4_TEST 0x7235bda8 +#define THE_HOUSE_OF_THE_DEAD_EX 0x85c0c22a +#define THE_HOUSE_OF_THE_DEAD_EX_TEST 0xb9a166bb +#define TOO_SPICY 0x4c768eb4 +#define UNKNOWN 0xFFFFFFFF +#define VIRTUA_FIGHTER_5 0x0042 +#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN 0x0043 +#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA 0x0044 +#define VIRTUA_FIGHTER_5_R 0x0045 +#define VIRTUA_FIGHTER_5_REVA 0x0046 +#define VIRTUA_FIGHTER_5_REVB 0x0047 +#define VIRTUA_FIGHTER_5_REVC 0x1bf1b627 +#define VIRTUA_FIGHTER_5_REVE 0xC4B05D40 +#define VIRTUA_FIGHTER_5_EXPORT 0x157B0576 +#define VIRTUA_FIGHTER_5_R_REVD 0x0051 +#define VIRTUA_TENNIS_3 0xc4b7e89 +#define VIRTUA_TENNIS_3_TEST 0xffe3b0fd typedef enum { @@ -78,6 +75,13 @@ typedef enum EX } GameRegion; +typedef enum +{ + SHOOTING, + DRIVING, + FIGHTING +} GameType; + typedef struct { int emulateRideboard; @@ -93,15 +97,20 @@ typedef struct char driveboardPath[MAX_PATH_LENGTH]; int width; int height; - Game game; Colour lindberghColour; GameStatus gameStatus; + GameType gameType; uint32_t crc32; GameRegion region; int freeplay; int showDebugMessages; + char *gameID; + char *gameTitle; + char* gameDVP; } EmulatorConfig; int initConfig(); EmulatorConfig *getConfig(); char *getGameName(); +char *getDVPName(); +char *getGameID(); diff --git a/src/lindbergh/eeprom.c b/src/lindbergh/eeprom.c index 9b6f45a..6fbed38 100644 --- a/src/lindbergh/eeprom.c +++ b/src/lindbergh/eeprom.c @@ -68,7 +68,7 @@ int initEeprom() setFreeplay(eeprom, getConfig()->freeplay); } - if ((getConfig()->game == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->game == THE_HOUSE_OF_THE_DEAD_EX) || (getConfig()->game == THE_HOUSE_OF_THE_DEAD_4_SPECIAL)) + if ((getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == THE_HOUSE_OF_THE_DEAD_EX) || (getConfig()->crc32 == THE_HOUSE_OF_THE_DEAD_4_SPECIAL)) { if (fixCreditSection(eeprom) != 0) { diff --git a/src/lindbergh/graphics.c b/src/lindbergh/graphics.c index cdb539c..adb399f 100644 --- a/src/lindbergh/graphics.c +++ b/src/lindbergh/graphics.c @@ -29,7 +29,7 @@ FGAPI int FGAPIENTRY glutEnterGameMode() glutCreateWindow(gameTitle); // Outrun doesn't run the glutMainLoop through, so we'll do that here - Game game = getConfig()->game; + uint32_t game = getConfig()->crc32; if (game == OUTRUN_2_SP_SDX || game == OUTRUN_2_SP_SDX_TEST || game == OUTRUN_2_SP_SDX_REVA || game == OUTRUN_2_SP_SDX_REVA_TEST) { pthread_t glutMainLoopID; @@ -107,7 +107,7 @@ Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int // attributes->override_redirect = False; Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes); - printf("The resolution is %dx%d \n", width, height); + printf(" RESOLUTION: %dx%d\n\n", width, height); if (getConfig()->fullscreen) { diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index ee5f096..17743d7 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -136,7 +136,6 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr) void __attribute__((constructor)) hook_init() { - printf("SEGA Lindbergh Loader\nRobert Dilley 2023\nNot for public consumption\n\n"); // Get offsets of the Game's ELF and calculate CRC32. dl_iterate_phdr(callback, NULL); @@ -184,15 +183,12 @@ void __attribute__((constructor)) hook_init() securityBoardSetDipResolution(getConfig()->width, getConfig()->height); - printf("Now starting \"%s\"", getGameName()); - if (getConfig()->gameStatus == WORKING) - { - printf((", this game is working.\n")); - } - else - { - printf((", this game is NOT working.\n")); - } + printf("\nSEGA Lindbergh Emulator\nRobert Dilley 2023\n\n"); + printf(" GAME: %s\n", getGameName()); + printf(" GAME ID: %s\n", getGameID()); + printf(" DVP: %s\n", getDVPName()); + printf(" STATUS: %s\n", getConfig()->gameStatus == WORKING ? "WORKING" : "NOT WORKING"); + } int open(const char *pathname, int flags) @@ -326,7 +322,6 @@ FILE *fopen64(const char *pathname, const char *mode) if (strcmp(pathname, "/proc/sys/kernel/osrelease") == 0) { EmulatorConfig *config = getConfig(); - config->game = SEGABOOT_2_6; fileRead[OSRELEASE] = 0; fileHooks[OSRELEASE] = _fopen64(HOOK_FILE_NAME, mode); return fileHooks[OSRELEASE]; @@ -708,8 +703,8 @@ char *getenv(const char *name) { char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv"); - if ((strcmp(name, "TEA_DIR") == 0) && ((getConfig()->game == VIRTUA_TENNIS_3) || (getConfig()->game == VIRTUA_TENNIS_3_TEST) || - ((getConfig()->game == RAMBO)) || (getConfig()->game == TOO_SPICY))) + if ((strcmp(name, "TEA_DIR") == 0) && ((getConfig()->crc32 == VIRTUA_TENNIS_3) || (getConfig()->crc32 == VIRTUA_TENNIS_3_TEST) || + ((getConfig()->crc32 == RAMBO)) || (getConfig()->crc32 == TOO_SPICY))) { if (getcwd(envpath, 100) == NULL) return ""; diff --git a/src/lindbergh/input.c b/src/lindbergh/input.c index b71d4b7..39dbba0 100644 --- a/src/lindbergh/input.c +++ b/src/lindbergh/input.c @@ -15,11 +15,11 @@ #include #include -Game game = UNKNOWN; +GameType gameType = SHOOTING; int initInput() { - game = getConfig()->game; + gameType = getConfig()->gameType; return 0; } @@ -199,44 +199,14 @@ int XNextEvent(Display *display, XEvent *event_return) } // Select the appropriate input mapping depending on the game - switch (game) + switch (gameType) { - // Driving games - case INITIALD_4: - case INITIALD_4_REVE: - case INITIALD_5_EXP_20: - case INITIALD_ARCADE_STAGE_5: - case OUTRUN_2_SP_SDX: - case OUTRUN_2_SP_SDX_TEST: - case OUTRUN_2_SP_SDX_REVA: - case OUTRUN_2_SP_SDX_REVA_TEST: - case SEGA_RACE_TV: - case HUMMER_EXTREME: - case R_TUNED: + case DRIVING: return XNextEventDriving(display, event_return, returnValue); break; - // Shooting games - case THE_HOUSE_OF_THE_DEAD_4: - case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: - case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST: - case THE_HOUSE_OF_THE_DEAD_4_STRIPPED: - case THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST: - case THE_HOUSE_OF_THE_DEAD_4_TEST: - case THE_HOUSE_OF_THE_DEAD_EX: - case THE_HOUSE_OF_THE_DEAD_EX_TEST: - case TOO_SPICY: - case PRIMEVAL_HUNT: - case LETS_GO_JUNGLE: - case LETS_GO_JUNGLE_REVA: - case LETS_GO_JUNGLE_SPECIAL: - - // Stick games - case VIRTUA_TENNIS_3: - case VIRTUA_TENNIS_3_TEST: - case VIRTUA_FIGHTER_5: // TODO: Add in all the other VFs - case VIRTUA_FIGHTER_5_EXPORT: - + case SHOOTING: + case FIGHTING: default: return XNextEventShooting(display, event_return, returnValue); break; diff --git a/src/lindbergh/lindbergh.c b/src/lindbergh/lindbergh.c index 708fd81..c6fe510 100644 --- a/src/lindbergh/lindbergh.c +++ b/src/lindbergh/lindbergh.c @@ -8,7 +8,7 @@ #define PRELOAD_FILE_NAME "lindbergh.so" // List of all lindbergh executables known, not including the test executables -char *games[] = {"hummer_Master.elf", "drive.elf", "chopperM.elf", "vsg", "Jennifer", "amiM.elf", "abc", "hod4M.elf", "lgj_final", "vt3", "id4.elf", "id5.elf", "lgjsp_app", "gsevo", "vf5", "apacheM.elf", "segaboot", "END"}; +char *games[] = {"vt3_Lindbergh", "hummer_Master.elf", "drive.elf", "chopperM.elf", "vsg", "Jennifer", "amiM.elf", "abc", "hod4M.elf", "lgj_final", "vt3", "id4.elf", "id5.elf", "lgjsp_app", "gsevo", "vf5", "apacheM.elf", "segaboot", "END"}; /** * Tests if the game uses a seperate elf for test mode @@ -37,6 +37,12 @@ void testModePath(char *name) return; } + if (strcmp(name, "./vt3_Lindbergh") == 0) + { + strcpy(name, "./vt3_testmode"); + return; + } + // Otherwise add the standard -t to the end strcat(name, " -t"); } @@ -57,7 +63,7 @@ void setEnvironmentVariables() strcat(libraryPath, ":"); } - strcat(libraryPath, ".:lib"); + strcat(libraryPath, ".:lib:../lib"); setenv(LD_LIBRARY_PATH, libraryPath, 1); diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index d501620..313f061 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -125,11 +125,11 @@ int amDongleUpdate() int amDongleUserInfoEx(int a, int b, char *_arcadeContext) { - if (getConfig()->game == INITIALD_4_REVE) + if (getConfig()->crc32 == INITIALD_4_REVE) memcpy(_arcadeContext, "SBNK", 4); - else if (getConfig()->game == INITIALD_5_EXP_20) + else if (getConfig()->crc32 == INITIALD_5_EXP_20) memcpy(_arcadeContext, "SBPF", 4); - else if (getConfig()->game == HUMMER_EXTREME) + else if (getConfig()->crc32 == HUMMER_EXTREME) memcpy(_arcadeContext, "SBST", 4); return 0; } @@ -239,7 +239,7 @@ int initPatch() { EmulatorConfig *config = getConfig(); - switch (config->game) + switch (config->crc32) { case R_TUNED: {