From 0ee6d12393260905761ddfd233ef557c430c9eed Mon Sep 17 00:00:00 2001 From: dkeruza Date: Wed, 22 Nov 2023 15:45:41 -0500 Subject: [PATCH] more patches / cleaned CRC / added game status. --- src/hookcrc32/hookcrc32.c | 2 +- src/hookcrc32/hookcrc32.so | Bin 16980 -> 16900 bytes src/lindbergh/config.c | 47 ++++++++++++++++------ src/lindbergh/config.h | 11 ++++++ src/lindbergh/hook.c | 12 +++++- src/lindbergh/patch.c | 77 +++++++++++++++++++++++++++++++++++++ 6 files changed, 134 insertions(+), 15 deletions(-) diff --git a/src/hookcrc32/hookcrc32.c b/src/hookcrc32/hookcrc32.c index 4181782..9f7e5fc 100644 --- a/src/hookcrc32/hookcrc32.c +++ b/src/hookcrc32/hookcrc32.c @@ -74,7 +74,7 @@ __attribute__((__constructor__)) static void setup(void) { dl_iterate_phdr(callback, NULL); //real_main = dlsym(RTLD_NEXT, "main"); - exit(0); + //exit(0); } __attribute__((__destructor__)) diff --git a/src/hookcrc32/hookcrc32.so b/src/hookcrc32/hookcrc32.so index 01742def06663b65b0449fbf971c17262855bb45..ff67e24d404dd061a664ecd403e913281ddf5ee3 100755 GIT binary patch delta 2159 zcmY*aYfMx}6rQ>F&hA}ym)>Q!zyit|LO>X z61B39rfoz^jV9XCmUd}s(uW$fDM=e`s;#a4fiXsY&<2dAX`*hwa~Gn$Wac~PJKvl+ zJ1?$v^3G1)?c+;B)6#^YGG>Holf?jMY#lC8Mk6esENewBJ7%bPPu#btAt&Hu-Z@{Qfl$hX#>m zNpMsfSqMTL$z=@s&FodLj*f>sk;i z{i^%0&sShzGXGd4vKrC>;7(xmcqGyb+y=Y^>;aAddw~ySy)TXbDcgOiwfWF@gJ)H- z`d($eQ&b04W#8pNho&(f=(T7)(BuH0)@+PQOid?3r{#5DYQY&;eNazs7p?g>Xp~`+ z^TEH0cH?iXS2%sz6=%*;7Zw(c7LB%wFmD1&C-C_RTp}~`@&fq^V-_&Okj4O8(d=k6 zAM2F3wN??%(nu(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#b*gd*lwZ z^W~{vj#yp9*x&M2Fd$ZzGWNaXp@1lv&DbK;am&h(Q*0??%pvPS0lrgqhH^xG1lindberghColour = RED; } - else printf("Error: Unknown settings command %s\n", command); } @@ -214,7 +240,7 @@ int readConfig(FILE *configFile, EmulatorConfig *config) return 0; } -int initConfig(uint32_t elf_crc) +int initConfig() { config.emulateRideboard = 0; config.emulateDriveboard = 0; @@ -230,14 +256,11 @@ int initConfig(uint32_t elf_crc) strcpy(config.rideboardPath, "none"); config.width = 1024; config.height = 768; - if (detectGame(elf_crc) != 0) + config.crc32 = elf_crc; + if (detectGame(config.crc32) != 0) { printf("Warning: Unsure what game this is, using default configuration values.\n"); } - else - { - printf("Game Detected: %s\n", getGameName()); - } configFile = fopen(CONFIG_PATH, "r"); diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 03dece1..b0f2c7c 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -13,8 +13,10 @@ typedef enum OUTRUN, OUTRUN_TEST, LETS_GO_JUNGLE, + LETS_GO_JUNGLE_SPECIAL, ABC_2006, ABC_2007, + ID4, SRTV, RTUNED, VT3, @@ -27,6 +29,12 @@ typedef enum RED } Colour; +typedef enum +{ + WORKING, + NOT_WORKING +}GameStatus; + typedef struct { int emulateRideboard; @@ -44,6 +52,9 @@ typedef struct int height; Game game; Colour lindberghColour; + GameStatus gameStatus; + uint32_t crc32; + } EmulatorConfig; int initConfig(); diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index 610a0c4..eeb4756 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -144,7 +144,7 @@ void __attribute__((constructor)) hook_init() act.sa_flags = SA_SIGINFO; sigaction(SIGSEGV, &act, NULL); - initConfig(elf_crc); + initConfig(); if(initPatch() != 0) exit(1); @@ -175,7 +175,15 @@ void __attribute__((constructor)) hook_init() securityBoardSetDipResolution(getConfig()->width, getConfig()->height); - printf("Now emulating %s\n", getGameName()); + printf("Now emulating %s", getGameName()); + if(getConfig()->gameStatus == WORKING) + { + printf((" - Game is in working state.\n")); + } + else + { + printf((" - Game is in NOT WORKING state.\n")); + } } int open(const char *pathname, int flags) diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index 8366481..635d3b0 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -67,6 +67,20 @@ int amDongleUpdate() return 0; } +void _putConsole(char *param1, char *param2) +{ + if(param2 >=0 ) + { + printf(param1, (int)param2); + printf("\n"); + } + else + { + printf("%s\n", param1); + } + return; +} + int initPatch() { Game game = getConfig()->game; @@ -187,6 +201,69 @@ int initPatch() detourFunction(0x085c62f0, amDongleUpdate); } break; + case LETS_GO_JUNGLE: + { + setVariable(0x08c083a4, 2); // amBackupDebugLevel + setVariable(0x08c083c0, 2); // amCreditDebugLevel + setVariable(0x08c08618, 2); // amDipswDebugLevel + setVariable(0x08c0861c, 2); // amDongleDebugLevel + setVariable(0x08c08620, 2); // amEepromDebugLevel + setVariable(0x08c08624, 2); // amHwmonitorDebugLevel + setVariable(0x08c08628, 2); // amJvsDebugLevel + setVariable(0x08c0862c, 2); // amLibDebugLevel + setVariable(0x08c08630, 2); // amMiscDebugLevel + setVariable(0x08c08638, 2); // amSysDataDebugLevel + setVariable(0x08c08640, 2); // bcLibDebugLevel + setVariable(0x08c08634, 2); // amOsinfoDebugLevel + setVariable(0x08c08644, 0x0FFFFFFF); // s_logMask + detourFunction(0x084e50d8, amDongleInit); + detourFunction(0x084e5459, amDongleIsAvailable); + detourFunction(0x084e537d, amDongleUpdate); + //detourFunction(0x08074a8c, _putConsole); + setVariable(0x0840b06f, 0xc48306eb); // Patch to initialize???? + } + break; + case LETS_GO_JUNGLE_SPECIAL: + { + setVariable(0x08c453e4, 2); // amBackupDebugLevel + setVariable(0x08c45400, 2); // amCreditDebugLevel + setVariable(0x08c45658, 2); // amDipswDebugLevel + setVariable(0x08c4565c, 2); // amDongleDebugLevel + setVariable(0x08c45660, 2); // amEepromDebugLevel + setVariable(0x08c45664, 2); // amHwmonitorDebugLevel + setVariable(0x08c45668, 2); // amJvsDebugLevel + setVariable(0x08c4566c, 2); // amLibDebugLevel + setVariable(0x08c45670, 2); // amMiscDebugLevel + setVariable(0x08c45678, 2); // amSysDataDebugLevel + setVariable(0x08c45680, 2); // bcLibDebugLevel + setVariable(0x08c45674, 2); // amOsinfoDebugLevel + setVariable(0x08c45684, 0x0FFFFFFF); // s_logMask + detourFunction(0x08510320, amDongleInit); + detourFunction(0x085106dc, amDongleIsAvailable); + detourFunction(0x08510600, amDongleUpdate); + detourFunction(0x08075012, _putConsole); + } + break; + case ID4: + { + setVariable(0x08d71750, 2); // amBackupDebugLevel + setVariable(0x08d71760, 2); // amCreditDebugLevel + setVariable(0x08d719b8, 2); // amDipswDebugLevel + setVariable(0x08d719bc, 2); // amDongleDebugLevel + setVariable(0x08d719c0, 2); // amEepromDebugLevel + setVariable(0x08d719c4, 2); // amHwmonitorDebugLevel + setVariable(0x08d719c8, 2); // amJvsDebugLevel + setVariable(0x08d719cc, 2); // amLibDebugLevel + setVariable(0x08d719d0, 2); // amMiscDebugLevel + setVariable(0x08d719d8, 2); // amSysDataDebugLevel + setVariable(0x08d719e0, 2); // bcLibDebugLevel + setVariable(0x08d719d4, 2); // amOsinfoDebugLevel + setVariable(0x08d719e4, 0x0FFFFFFF); // s_logMask + detourFunction(0x086e2336, amDongleInit); + detourFunction(0x086e0d81, amDongleIsAvailable); + detourFunction(0x086e17e5, amDongleUpdate); + detourFunction(0x0808f9a8, _putConsole); + } default: // Don't do any patches for random games break;