From 945e9574ef016fd11e2d0c2c14afb754960f30c8 Mon Sep 17 00:00:00 2001 From: dkeruza Date: Tue, 12 Dec 2023 21:51:34 -0500 Subject: [PATCH] XF86 hook, more games, cleanin up a bit. --- .vscode/c_cpp_properties.json | 22 ++ .vscode/settings.json | 4 +- src/hookcrc32/Makefile | 8 +- src/hookcrc32/{hookcrc32.so => getcrc} | Bin 17020 -> 17756 bytes src/hookcrc32/getcrc.c | 38 +++ src/hookcrc32/hookcrc32.c | 95 -------- src/lindbergh/baseboard.c | 1 + src/lindbergh/config.c | 56 ++++- src/lindbergh/config.h | 6 + src/lindbergh/graphics.c | 24 +- src/lindbergh/hook.c | 3 +- src/lindbergh/hook.h | 2 +- src/lindbergh/jvs.c | 6 +- src/lindbergh/patch.c | 314 +++++++++++++++++++------ 14 files changed, 396 insertions(+), 183 deletions(-) create mode 100644 .vscode/c_cpp_properties.json rename src/hookcrc32/{hookcrc32.so => getcrc} (51%) create mode 100644 src/hookcrc32/getcrc.c delete mode 100644 src/hookcrc32/hookcrc32.c diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..9f0e080 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,22 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${default}" + ], + "defines": [ + "__USE_POSIX", + "__USE_MISC" + ], + "cppStandard": "gnu++17", + "cStandard": "c99", + "intelliSenseMode": "linux-gcc-x86", + "forcedInclude": [ + "${workspaceFolder}/../vscode-preinclude.h" + ], + "compilerArgs": [] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index e5a1ae4..af2744c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,7 @@ "segaeax.h": "c", "passthrough.h": "c" }, - "C_Cpp.errorSquiggles": "disabled" + "C_Cpp.errorSquiggles": "disabled", + "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", + "C_Cpp.default.compilerPath": "/usr/bin/gcc" } diff --git a/src/hookcrc32/Makefile b/src/hookcrc32/Makefile index 4a2e6f4..697b510 100644 --- a/src/hookcrc32/Makefile +++ b/src/hookcrc32/Makefile @@ -1,17 +1,15 @@ CC=gcc -m32 CFLAGS = -g -O0 -fPIC -m32 -Wall -Werror -Wno-unused-variable -Wno-unused-function -LD = g++ -m32 -LDFLAGS = -Wl,-z,defs -rdynamic -static-libstdc++ -static-libgcc -lc -ldl -lGL -lglut -lX11 -lm -lpthread -shared -nostdlib BUILD = build OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) -all: hookcrc32.so +all: getcrc hookcrc32.so: $(OBJS) - $(LD) $(OBJS) $(LDFLAGS) $(CFLAGS) -o hookcrc32.so + $(LD) $(OBJS) $(LDFLAGS) $(CFLAGS) -o getcrc rm -f *.o clean: - rm -f hookcrc32.so + rm -f getcrc diff --git a/src/hookcrc32/hookcrc32.so b/src/hookcrc32/getcrc similarity index 51% rename from src/hookcrc32/hookcrc32.so rename to src/hookcrc32/getcrc index 1744282b972c3c36632d8e9758806f9860b7cf5b..adce8c35755f1b77cca371f717916aa765c5025d 100755 GIT binary patch literal 17756 zcmeHPe{fXCecyL?Pj~ut`U!|1HV-V@*r1byWDE#w32`7fU<3#PgYC!Z?n!s%bf?_C zlZ9(ASf-64s{>8ObuzB)hGv>HW}4J?Cz+%fIl_i`k`_B@#+^Ddv{jlTk!x&7LJG(M?{k^;2-M8=UySIAMzh#r6D8f!o;S{7^suZFX<+ty*B&|Xd zWn!7A7q^KbuqdaeuoG#nD3a$T+g z&%z!U5c2J(eL_s%XTdti+5v1geL7IgKt2OG;UZ`P<@7-~3w;|#Koe})&Yzm08OUw0 z<6z5sAYZ2mkptMS%d_7OImnw5>u0xjK%U?JMW~BF|0qObG}6}?4K+j~vDAn!8TYNU zWVMhn_M0EvCH|(%x#COdH!DwX+55|Ts=nFtR{x<>w66y+j?{4+5tFu0MJPGkk;S1V z>tvf)FKw7;LttVo%K((i@zI0^RPs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+ for (size_t j = 0; j < 8; j++) { + uint32_t b = (ch ^ crc) & 1; + crc >>= 1; + if (b) + crc = crc ^ 0xEDB88320; + ch >>= 1; + } + } + return ~crc; +} + +int main(int argc, char *argv[]) +{ + printf("You have entered %d arguments:\n", argc); + + for (int i = 0; i < argc; i++) { + printf("%s\n", argv[i]); + } + FILE *f; + char buffer[128]; + int crc = 0; + f = fopen(argv[1], "r+b"); + fseek(f, 10, SEEK_SET); + fread(buffer,128,1,f); + crc = __crc32(buffer, 128); + printf("Crc32: 0x%x\n", crc); + + return 0; +} diff --git a/src/hookcrc32/hookcrc32.c b/src/hookcrc32/hookcrc32.c deleted file mode 100644 index 4181782..0000000 --- a/src/hookcrc32/hookcrc32.c +++ /dev/null @@ -1,95 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include - -static struct { - ElfW(Addr) start, end; -} *segments; -static int n; -static int (*real_main)(int argc,char **argv); - -uint32_t __crc32(const char *s,size_t n) { - uint32_t crc=0xFFFFFFFF; - - for(size_t i=0;i>=1; - if(b) crc=crc^0xEDB88320; - ch>>=1; - } - } - return ~crc; -} - -static int callback(struct dl_phdr_info *info, size_t size, void *data) { - /*n = info->dlpi_phnum; - segments = malloc(n * sizeof *segments); - for(int i = 0; i < n; ++i) { - segments[i].start = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr; - segments[i].end = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr + info->dlpi_phdr[i].p_memsz; - } - char *type; - int p_type; - printf("Name: \"%s\" (%d segments)\n", info->dlpi_name, info->dlpi_phnum); - for (int j = 0; j < info->dlpi_phnum; j++) { - p_type = info->dlpi_phdr[j].p_type; - type = (p_type == PT_LOAD) ? "PT_LOAD" : - (p_type == PT_DYNAMIC) ? "PT_DYNAMIC" : - (p_type == PT_INTERP) ? "PT_INTERP" : - (p_type == PT_NOTE) ? "PT_NOTE" : - (p_type == PT_INTERP) ? "PT_INTERP" : - (p_type == PT_PHDR) ? "PT_PHDR" : - (p_type == PT_TLS) ? "PT_TLS" : - (p_type == PT_GNU_EH_FRAME) ? "PT_GNU_EH_FRAME" : - (p_type == PT_GNU_STACK) ? "PT_GNU_STACK" : - (p_type == PT_GNU_RELRO) ? "PT_GNU_RELRO" : NULL; - - printf(" %2d: [%14p; memsz:0x%7x; size:0x%7x] flags: 0x%x; ", j, - (void *) (info->dlpi_addr + info->dlpi_phdr[j].p_vaddr), - info->dlpi_phdr[j].p_memsz, info->dlpi_phdr[j].p_filesz ,info->dlpi_phdr[j].p_flags); - if (type != NULL) - printf("%s\n", type); - else - printf("[other (0x%x)]\n", p_type);*/ - if((info->dlpi_phnum >= 3) && (info->dlpi_phdr[2].p_type == PT_LOAD) && (info->dlpi_phdr[2].p_flags == 5)) - { - // printf("Aca voy a dumpear el codigo:\n"); - //FILE *file = fopen("dump.bin","w+b"); - - //fwrite((void *)(info->dlpi_addr + info->dlpi_phdr[2].p_vaddr)+10,128,1,file); - //fclose(file); - int crc = 0; - crc = __crc32((void *)(info->dlpi_addr + info->dlpi_phdr[2].p_vaddr+10),128); - printf("Crc32: 0x%x\n",crc); - } - //} - return 1; -} - -__attribute__((__constructor__)) -static void setup(void) { - dl_iterate_phdr(callback, NULL); - //real_main = dlsym(RTLD_NEXT, "main"); - exit(0); -} - -__attribute__((__destructor__)) -static void teardown(void) { - free(segments); -} -/* -__attribute__((__noinline__)) -int main(int argc,char **argv) { - ElfW(Addr) addr = (ElfW(Addr))__builtin_extract_return_addr(__builtin_return_address(0)); - for(int i = 0; i < n; ++i) { - if(addr >= segments[i].start && addr < segments[i].end) { - // Do Nothing - return 0; - } - } - return real_main(argc, argv); -}*/ \ No newline at end of file diff --git a/src/lindbergh/baseboard.c b/src/lindbergh/baseboard.c index 970611a..e2d6fca 100644 --- a/src/lindbergh/baseboard.c +++ b/src/lindbergh/baseboard.c @@ -4,6 +4,7 @@ #include /* File control definitions */ #include /* Error number definitions */ #include /* Standard library functions like malloc, free, exit, and atoi */ +#include #include "baseboard.h" diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index bc9dd31..f6d4188 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -54,6 +54,13 @@ static int detectGame(uint32_t elf_crc) return 0; } + if (elf_crc == 0x5df569f5) + { + config.game = THE_HOUSE_OF_THE_DEAD_4_STRIPPED; + config.gameStatus = WORKING; + return 0; + } + if (elf_crc == 0x7235bda8) { config.game = THE_HOUSE_OF_THE_DEAD_4_TEST; @@ -61,6 +68,20 @@ static int detectGame(uint32_t elf_crc) 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; @@ -114,11 +135,24 @@ static int detectGame(uint32_t elf_crc) return 0; } + if (elf_crc == 0x7f3f9f0c) + { + config.game = ID4_E; + config.gameStatus = NOT_WORKING; + return 0; + } + if (elf_crc == 0xfb096f81) { config.game = SRTV; config.emulateDriveboard = 1; - config.emulateMotionboard = 1; + config.gameStatus = NOT_WORKING; + return 0; + } + + if (elf_crc == 0x77ebac34) + { + config.game = RAMBO; config.gameStatus = NOT_WORKING; return 0; } @@ -127,11 +161,17 @@ static int detectGame(uint32_t elf_crc) { config.game = RTUNED; config.emulateDriveboard = 1; - config.emulateMotionboard = 1; config.gameStatus = WORKING; return 0; } + if (elf_crc == 0x4c768eb4) + { + config.game = TOO_SPICY; + config.gameStatus = WORKING; + return 0; + } + if (elf_crc == 0xc4b7e89) { config.game = VT3; @@ -175,6 +215,12 @@ char *getGameName() return "The House of the Dead 4"; case THE_HOUSE_OF_THE_DEAD_4_TEST: return "The House of the Dead 4 - Test Menu"; + case THE_HOUSE_OF_THE_DEAD_4_STRIPPED: + return "The House of the Dead 4"; + case THE_HOUSE_OF_THE_DEAD_EX: + return "The House of the Dead EX"; + case THE_HOUSE_OF_THE_DEAD_EX_TEST: + return "The House of the Dead EX - Test Menu"; case LETS_GO_JUNGLE: return "Let's Go Jungle! Lost on the Island of Spice"; case LETS_GO_JUNGLE_SPECIAL: @@ -184,10 +230,16 @@ char *getGameName() return "After Burner Climax"; case ID4: return "Initial D 4"; + case ID4_E: + return "Initial D 4 Export"; case SRTV: return "SEGA Race TV"; + case RAMBO: + return "Rambo"; case RTUNED: return "R-Tuned Ultimate Street Racing"; + case TOO_SPICY: + return "Too Spicy"; case VT3: return "Virtua Tennis 3"; case VT3_TESTMODE: diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index f6891ad..70c478d 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -11,6 +11,9 @@ typedef enum SEGABOOT_2_6, THE_HOUSE_OF_THE_DEAD_4, THE_HOUSE_OF_THE_DEAD_4_TEST, + THE_HOUSE_OF_THE_DEAD_4_STRIPPED, + THE_HOUSE_OF_THE_DEAD_EX, + THE_HOUSE_OF_THE_DEAD_EX_TEST, OUTRUN, OUTRUN_TEST, LETS_GO_JUNGLE, @@ -18,8 +21,11 @@ typedef enum ABC_2006, ABC_2007, ID4, + ID4_E, SRTV, + RAMBO, RTUNED, + TOO_SPICY, VT3, VT3_TESTMODE, VF5_REVC diff --git a/src/lindbergh/graphics.c b/src/lindbergh/graphics.c index 11973a5..5ce49c9 100644 --- a/src/lindbergh/graphics.c +++ b/src/lindbergh/graphics.c @@ -163,11 +163,11 @@ int XNextEvent(Display *display, XEvent *event_return) { case 28: setSwitch(SYSTEM, BUTTON_TEST, event_return->type == KeyPress); - //securityBoardSetSwitch(BUTTON_TEST, event_return->type == KeyPress); + // securityBoardSetSwitch(BUTTON_TEST, event_return->type == KeyPress); break; case 39: setSwitch(PLAYER_1, BUTTON_SERVICE, event_return->type == KeyPress); - //securityBoardSetSwitch(BUTTON_SERVICE, event_return->type == KeyPress); + // securityBoardSetSwitch(BUTTON_SERVICE, event_return->type == KeyPress); break; case 14: incrementCoin(PLAYER_1, event_return->type == KeyPress); @@ -248,11 +248,29 @@ int XSetStandardProperties(Display *display, Window window, const char *window_n return _XSetStandardProperties(display, window, gameTitle, icon_name, icon_pixmap, argv, argc, hints); } -Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modeline) +Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modesinfo) { return 0; } +int XF86VidModeGetAllModeLines(Display *display, int screen, int *modecount_return, XF86VidModeModeInfo ***modesinfo) +{ + int (*_XF86VidModeGetAllModeLines)(Display *display, int screen, int *modecount_return, XF86VidModeModeInfo ***modesinfo) = dlsym(RTLD_NEXT, "XF86VidModeGetAllModeLines"); + + if (_XF86VidModeGetAllModeLines(display, screen, modecount_return, modesinfo) != 1) + { + printf("Error: Could not get list of screen modes.\n"); + exit(1); + } + else + { + XF86VidModeModeInfo **modes = *modesinfo; + modes[0]->hdisplay = getConfig()->width; + modes[0]->vdisplay = getConfig()->height; + } + return true; +} + typedef unsigned int uint; int glXSwapIntervalSGI(int interval) diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index 0919cb6..41eaf09 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -673,7 +673,8 @@ char *getenv(const char *name) { char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv"); - if ((strcmp(name, "TEA_DIR") == 0) && getConfig()->game == VT3) + if ((strcmp(name, "TEA_DIR") == 0) && ((getConfig()->game == VT3) || (getConfig()->game == VT3_TESTMODE) || + ((getConfig()->game == RAMBO)) || (getConfig()->game == TOO_SPICY))) { if (getcwd(envpath, 100) == NULL) return ""; diff --git a/src/lindbergh/hook.h b/src/lindbergh/hook.h index 36e0d2a..2b215b2 100644 --- a/src/lindbergh/hook.h +++ b/src/lindbergh/hook.h @@ -1,3 +1,4 @@ + uint32_t get_crc32(const char *s,size_t n); void getCPUID(); typedef struct @@ -6,4 +7,3 @@ typedef struct unsigned edx; unsigned ecx; }cpuvendor; - diff --git a/src/lindbergh/jvs.c b/src/lindbergh/jvs.c index bdd8208..0f8d57b 100644 --- a/src/lindbergh/jvs.c +++ b/src/lindbergh/jvs.c @@ -260,10 +260,13 @@ JVSStatus processPacket() outputPacket.data[outputPacket.length] = REPORT_SUCCESS; outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0]; outputPacket.length += 2; + + //printf("SW=%08d\r", io.state.inputSwitch[0]); + for (int i = 0; i < inputPacket.data[index + 1]; i++) { for (int j = 0; j < inputPacket.data[index + 2]; j++) - { + { outputPacket.data[outputPacket.length++] = io.state.inputSwitch[i + 1] >> (8 - (j * 8)); } } @@ -623,7 +626,6 @@ int setSwitch(JVSPlayer player, JVSInput switchNumber, int value) { io.state.inputSwitch[player] &= ~switchNumber; } - return 1; } diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index 79b3b77..02e7790 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -72,11 +72,16 @@ static void detourFunction(uint32_t address, void *function) memcpy((void *)address, cave, 5); } -int stub0() +int stubRetZero() { return 0; } +int stubRetOne() +{ + return 1; +} + int amDongleInit() { return 0; @@ -94,17 +99,17 @@ int amDongleUpdate() int amLibInit() { - uint32_t *amLibContext = (uint32_t *)0x08dfa2c0;//0x0809cb00; + uint32_t *amLibContext = (uint32_t *)0x08dfa2c0; // 0x0809cb00; *amLibContext = 1; - uint32_t *amLibInitializad = (uint32_t *)0x08dfa2c4;//0x0809cb04; - uint16_t *amLibPort1 = (uint16_t *)(0x08dfa2c4 + 4);//(0x0809cb04 + 4); - uint16_t *amLibPort2 = (uint16_t *)(0x08dfa2c4 + 4);//(0x0809cb04 + 6); - uint32_t *bcLibInitialized = (uint32_t *)(0x08dfa2c4 + 8);//0x0809cb0c; + uint32_t *amLibInitializad = (uint32_t *)0x08dfa2c4; // 0x0809cb04; + uint16_t *amLibPort1 = (uint16_t *)(0x08dfa2c4 + 4); //(0x0809cb04 + 4); + uint16_t *amLibPort2 = (uint16_t *)(0x08dfa2c4 + 4); //(0x0809cb04 + 6); + uint32_t *bcLibInitialized = (uint32_t *)(0x08dfa2c4 + 8); // 0x0809cb0c; *amLibInitializad = 1; *amLibPort1 = 0xd000; *amLibPort2 = 0x0004; *bcLibInitialized = 0; - int res = ((int (*)(void))0x084dedc4)();//0x08065d80)(); + int res = ((int (*)(void))0x084dedc4)(); // 0x08065d80)(); if (res == 1) *bcLibInitialized = 1; return 0; @@ -112,13 +117,13 @@ int amLibInit() int amDipswInit() { - uint32_t *amDipswContext = (uint32_t *)0x08df9cec;//0x0809c12c; - uint32_t *amDipswContext1 = (uint32_t *)(0x08df9cec + 4);//(0x0809c12c + 4); - uint32_t *amDipswContext2 = (uint32_t *)(0x08df9cec + 8);//(0x0809c12c + 8); - uint32_t *amDipswContext3 = (uint32_t *)(0x08df9cec + 12);//(0x0809c12c + 12); - //typedef void *(*___constant_c_and_count_memset)(uint32_t *, int, size_t); + uint32_t *amDipswContext = (uint32_t *)0x08df9cec; // 0x0809c12c; + uint32_t *amDipswContext1 = (uint32_t *)(0x08df9cec + 4); //(0x0809c12c + 4); + uint32_t *amDipswContext2 = (uint32_t *)(0x08df9cec + 8); //(0x0809c12c + 8); + uint32_t *amDipswContext3 = (uint32_t *)(0x08df9cec + 12); //(0x0809c12c + 12); + // typedef void *(*___constant_c_and_count_memset)(uint32_t *, int, size_t); //___constant_c_and_count_memset func = (___constant_c_and_count_memset)//0x0805c3d5; - //func(amDipswContext, 0, 4); + // func(amDipswContext, 0, 4); *amDipswContext = 1; *amDipswContext1 = 1; *amDipswContext2 = 1; @@ -137,7 +142,7 @@ void print_binary(unsigned int number) int amDipswGetData(uint8_t *dip) { - //printf("amDipswGetData Called!!!!!\n"); + // printf("amDipswGetData Called!!!!!\n"); uint8_t result; uint32_t data; @@ -145,19 +150,19 @@ int amDipswGetData(uint8_t *dip) result = (~data & 4) != 0; // Test Button if ((~data & 8) != 0) - result |= 2; // Service Button + result |= 2; // Service Button if ((~data & 0x10) != 0) - result |= 4; // ?? + result |= 4; // ?? if ((char)data >= 0) - result |= 8; // ?? + result |= 8; // ?? if ((~data & 0x100) != 0) - result |= 0x10; // Rotation + result |= 0x10; // Rotation if ((~data & 0x200) != 0) - result |= 0x20; // Resolution Dip 4 + result |= 0x20; // Resolution Dip 4 if ((~data & 0x400) != 0) - result |= 0x40; // Resolution Dip 5 + result |= 0x40; // Resolution Dip 5 if ((~data & 0x800) != 0) - result |= 0x80; // Resolution Dip 6 + result |= 0x80; // Resolution Dip 6 *dip = result; return 0; } @@ -221,6 +226,7 @@ int initPatch() { case RTUNED: { + // Security detourFunction(0x08366846, amDongleInit); detourFunction(0x08365301, amDongleIsAvailable); detourFunction(0x08365cf7, amDongleUpdate); @@ -229,17 +235,18 @@ int initPatch() case SRTV: { + // Security detourFunction(0x084d5b40, amDongleInit); detourFunction(0x084d45f9, amDongleIsAvailable); detourFunction(0x084d4fef, amDongleUpdate); - detourFunction(0x084d44fc, stub0); + // Fixes + detourFunction(0x084d44fc, stubRetZero); // Stub amDipswSetLed detourFunction(0x084d4485, amDipswGetData); - detourFunction(0x084d9118, amLibInit); - detourFunction(0x084d438c, amDipswInit); } break; case ABC_2006: { + // Debug Messages setVariable(0x0a0a37e4, 2); // amBackupDebugLevel setVariable(0x0a0a3800, 2); // amCreditDebugLevel setVariable(0x0a0a3a58, 2); // amDipswDebugLevel @@ -252,13 +259,20 @@ int initPatch() setVariable(0x0a0a3a74, 2); // amOsinfoDebugLevel setVariable(0x0a0a3a78, 2); // amSysDataDebugLevel setVariable(0x0a0a3a80, 2); // bcLibDebugLevel + // Security detourFunction(0x081e4980, amDongleInit); detourFunction(0x081e4cce, amDongleIsAvailable); detourFunction(0x081e4bfa, amDongleUpdate); + // Fixes + detourFunction(0x081e48b6, amDipswGetData); + detourFunction(0x081e492e, stubRetZero); // Stub amDipswSetLed + // Does not work + setVariable(0x08061c31, 0x0000000c); // Force HD resolution } break; case ABC_2007: { + // Debug Messages setVariable(0x0a0a0d24, 2); // amBackupDebugLevel setVariable(0x0a0a0d40, 2); // amCreditDebugLevel setVariable(0x0a0a0f98, 2); // amDipswDebugLevel @@ -271,14 +285,18 @@ int initPatch() setVariable(0x0a0a0fb4, 2); // amOsinfoDebugLevel setVariable(0x0a0a0fb8, 2); // amSysDataDebugLevel setVariable(0x0a0a0fc0, 2); // bcLibDebugLevel + // Security detourFunction(0x081e3424, amDongleInit); detourFunction(0x081e3772, amDongleIsAvailable); detourFunction(0x081e369e, amDongleUpdate); - setVariable(0x081e7945, 0x00000001); // Test + // Fixes + detourFunction(0x081e335a, amDipswGetData); + detourFunction(0x081e33d2, stubRetZero); // Stub amDipswSetLed } break; case OUTRUN: { + // Debug Messages setVariable(0x0893a24c, 2); // amBackupDebugLevel setVariable(0x0893a260, 2); // amCreditDebugLevel setVariable(0x0893a4b8, 2); // amDipswDebugLevel @@ -291,14 +309,19 @@ int initPatch() setVariable(0x0893a4d4, 2); // amOsinfoDebugLevel setVariable(0x0893a4d8, 2); // amSysDataDebugLevel setVariable(0x0893a4e0, 2); // bcLibDebugLevel + // Security detourFunction(0x08190e80, amDongleInit); detourFunction(0x08191201, amDongleIsAvailable); detourFunction(0x08191125, amDongleUpdate); + // Fixes + detourFunction(0x08190db6, amDipswGetData); + detourFunction(0x08190e2e, stubRetZero); // Stub amDipswSetLed } break; case THE_HOUSE_OF_THE_DEAD_4: { + // Debug Messages setVariable(0x0a737c60, 2); // amBackupDebugLevel setVariable(0x0a737c64, 2); // amChunkDataDebugLevel setVariable(0x0a737c80, 2); // amCreditDebugLevel @@ -313,71 +336,128 @@ int initPatch() setVariable(0x0a737f1c, 2); // amSysDataDebugLevel setVariable(0x0a737f20, 2); // bcLibDebugLevel setVariable(0x0a737f24, 0x0FFFFFFF); // s_logMask + // Security detourFunction(0x08320178, amDongleInit); detourFunction(0x08320459, amDongleIsAvailable); detourFunction(0x083203c0, amDongleUpdate); + // Fixes + detourFunction(0x0831ddd7, amDipswGetData); + detourFunction(0x0831de4f, stubRetZero); // Stub amDipswSetLed + // CPU patch to support AMD processors setVariable(0x0837d6aa, cpu_vendor.ebx); setVariable(0x0837d6ba, cpu_vendor.edx); setVariable(0x0837d6c5, cpu_vendor.ecx); } break; + case THE_HOUSE_OF_THE_DEAD_4_STRIPPED: + { + //// Security + detourFunction(0x0831ad04, amDongleInit); + detourFunction(0x0831b017, amDongleIsAvailable); + detourFunction(0x0831af7e, amDongleUpdate); + //// Fixes + detourFunction(0x0831875f, amDipswGetData); + detourFunction(0x083187d7, stubRetZero); // Stub amDipswSetLed + //// CPU patch to support AMD processors + setVariable(0x0837963a, cpu_vendor.ebx); + setVariable(0x0837964a, cpu_vendor.edx); + setVariable(0x08379655, cpu_vendor.ecx); + } + break; case THE_HOUSE_OF_THE_DEAD_4_TEST: { detourFunction(0x080677a0, amDongleInit); detourFunction(0x08067a81, amDongleIsAvailable); detourFunction(0x080679e8, amDongleUpdate); + // Fixes + detourFunction(0x08067653, amDipswGetData); + detourFunction(0x080676cb, stubRetZero); // Stub amDipswSetLed + // CPU patch to support AMD processors setVariable(0x0807217a, cpu_vendor.ebx); setVariable(0x0807218a, cpu_vendor.edx); setVariable(0x08072195, cpu_vendor.ecx); } break; + case THE_HOUSE_OF_THE_DEAD_EX: + { + detourFunction(0x084ba886, amDongleInit); + detourFunction(0x084b9341, amDongleIsAvailable); + detourFunction(0x084b9d37, amDongleUpdate); + // Fixes + detourFunction(0x084b6a69, amDipswGetData); + detourFunction(0x084b6adf, stubRetZero); // Stub amDipswSetLed + // CPU patch to support AMD processors + setVariable(0x0849E2AD, cpu_vendor.ebx); + setVariable(0x0849E2B7, cpu_vendor.edx); + setVariable(0x0849E2C1, cpu_vendor.ecx); + } + break; + case THE_HOUSE_OF_THE_DEAD_EX_TEST: + { + detourFunction(0x08078996, amDongleInit); + detourFunction(0x08077451, amDongleIsAvailable); + detourFunction(0x08077e47, amDongleUpdate); + // Fixes + detourFunction(0x080772dd, amDipswGetData); + detourFunction(0x08077353, stubRetZero); // Stub amDipswSetLed + // CPU patch to support AMD processors + setVariable(0x080847BD, cpu_vendor.ebx); + setVariable(0x080847C7, cpu_vendor.edx); + setVariable(0x080847D1, cpu_vendor.ecx); + } + break; case VF5_REVC: { + // Security detourFunction(0x085c6010, amDongleInit); detourFunction(0x085c63cc, amDongleIsAvailable); detourFunction(0x085c62f0, amDongleUpdate); - detourFunction(0x080b3426, stub0); // Stub returns 0 - detourFunction(0x080cb6d4, stub0); // Stub returns 0 - detourFunction(0x0840889e, stub0); // Stub returns 0 - detourFunction(0x0840ab90, stub0); // Stub returns 0 - setVariable(0x080e17af, 0x000000b8); // Patch IDK what - setVariable(0x080e17b3, 0x01e88300); // Patch IDK what + // Fixes and patches to bypss network check + detourFunction(0x085c5f46, amDipswGetData); + detourFunction(0x085c5fbe, stubRetZero); // Stub amDipswSetLed + detourFunction(0x080b3426, stubRetZero); // Stub returns 0 + detourFunction(0x080cb6d4, stubRetZero); // Stub returns 0 + detourFunction(0x0840889e, stubRetZero); // Stub returns 0 + detourFunction(0x0840ab90, stubRetZero); // Stub returns 0 + setVariable(0x080e17af, 0x000000b8); // Patch IDK what + setVariable(0x080e17b3, 0x01e88300); // Patch IDK what } 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 + 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(0x08074a8c, _putConsole); // Debug Messages - + // Security detourFunction(0x084e50d8, amDongleInit); detourFunction(0x084e5459, amDongleIsAvailable); detourFunction(0x084e537d, amDongleUpdate); - detourFunction(0x084e500e, amDipswGetData); - setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle setVariable(0x0807b76a, 0xc2839090); // Patch initializeArcadeBackup - setVariable(0x082E006b, 0x00000780); // Set ResX - setVariable(0x082E0078, 0x00000438); // Set ResY + // Fixes + detourFunction(0x084e500e, amDipswGetData); + detourFunction(0x084e5086, stubRetZero); // Stub amDipswSetLed + setVariable(0x0840d858, 0x1c899090); // No more Full Screen from the Game + // Set Resolution + // setVariable(0x082E006b, 0x00000780); // Set ResX + // setVariable(0x082E0078, 0x00000438); // Set ResY - detourFunction(0x084e5086, stub0); // Stub amDipswSetLed - setVariable(0x0840d858, 0x1c899090); // No more Full Screen from the Game // From Teknoparrot AMDFIX - setVariable(0x083ef701, 0x00036ee9); // AMDFIX - setVariable(0x084032e0, 0x8b90c933); // fix shader compilation with AMD GPUs - setVariable(0x08523950, 0x000000c3); // Remove ADXM_SetupFramework (Not necessary) + // setVariable(0x083ef701, 0x00036ee9); // AMDFIX + // setVariable(0x084032e0, 0x8b90c933); // fix shader compilation with AMD GPUs + // setVariable(0x08523950, 0x000000c3); // Remove ADXM_SetupFramework (Not necessary) } break; case LETS_GO_JUNGLE_SPECIAL: @@ -395,18 +475,23 @@ int initPatch() setVariable(0x08c45680, 2); // bcLibDebugLevel setVariable(0x08c45674, 2); // amOsinfoDebugLevel setVariable(0x08c45684, 0x0FFFFFFF); // s_logMask + detourFunction(0x08075012, _putConsole); + // Security detourFunction(0x08510320, amDongleInit); detourFunction(0x085106dc, amDongleIsAvailable); detourFunction(0x08510600, amDongleUpdate); - detourFunction(0x08075012, _putConsole); - // setVariable(0x08303C4B, 0x00000780); // Set ResX - // setVariable(0x08303C58, 0x00000438); // Set ResY setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle - setVariable(0x0807e609, 0x90909090); // Patch initializeArcadeBackup - setVariable(0x0807e60D, 0xC2839090); // Patch initializeArcadeBackup - setVariable(0x087d47f7, 0x62ab8500); // Seat Test?? - setVariable(0x08438954, 0x1c899090); // No more Full Screen from the Game + setVariable(0x0807e609, 0xc2839090); // Patch initializeArcadeBackup + // Fixes + detourFunction(0x08510256, amDipswGetData); + detourFunction(0x085102ce, stubRetZero); // Stub amDipswSetLed + setVariable(0x08438954, 0x1c899090); // No more Full Screen from the Game + // Set Resolution + // setVariable(0x08303C4B, 0x00000780); // Set ResX + // setVariable(0x08303C58, 0x00000438); // Set ResY + + // setVariable(0x087d47f7, 0x62ab8500); // Seat Test?? } break; case ID4: @@ -424,16 +509,71 @@ int initPatch() setVariable(0x08d719e0, 2); // bcLibDebugLevel setVariable(0x08d719d4, 2); // amOsinfoDebugLevel setVariable(0x08d719e4, 0x0FFFFFFF); // s_logMask + // detourFunction(0x0808f9a8, _putConsole); // Crashes the game sometimes. + // Security detourFunction(0x086e2336, amDongleInit); detourFunction(0x086e0d81, amDongleIsAvailable); detourFunction(0x086e17e5, amDongleUpdate); + // Fixes detourFunction(0x086e0c0d, amDipswGetData); - detourFunction(0x086e0c84, stub0); - detourFunction(0x0808f9a8, _putConsole); - setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle - setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle - setVariable(0x0807e609, 0x90909090); // Patch initializeArcadeBackup - setVariable(0x0807e60D, 0xC2839090); // Patch initializeArcadeBackup + detourFunction(0x086e0c84, stubRetZero); // amDipswSetLED + detourFunction(0x0821e6dc, stubRetOne); // isEthLinkUp + setVariable(0x082cb411, 0x0927c020); // tickInitStoreNetwork + setVariable(0x082cb6d9, 0x000150e9); // tickWaitDHCP + setVariable(0x082cb6dd, 0x448b5100); // tickWaitDHCP + // Set Resolution + setVariable(0x0835664d, 0x0000f0e9); // Force resolution set + setVariable(0x08356743, 0x00000780); // Set ResX + setVariable(0x08356748, 0x00000438); // Set ResY + // FrameBuffer Resolution (No effect that I know) + /* + setVariable(0x08248037, 0x00000780); // Set ResX + setVariable(0x0824802f, 0x00000438); // Set ResY + setVariable(0x082480f7, 0x00000780); // Set ResX + setVariable(0x082480ef, 0x00000438); // Set ResY + setVariable(0x082481b7, 0x00000780); // Set ResX + setVariable(0x082481af, 0x00000438); // Set ResY + setVariable(0x08248216, 0x00000780); // Set ResX + setVariable(0x0824820e, 0x00000438); // Set ResY + + setVariable(0x082489a7, 0x00000780); // Set ResX + setVariable(0x0824899f, 0x00000438); // Set ResY + setVariable(0x08248a32, 0x00000780); // Set ResX + setVariable(0x08248a2a, 0x00000438); // Set ResY + */ + + + // Hooked in graphics.c + //setVariable(0x085599f2, 0x0001d2e9); // Force not supported resolutions + //setVariable(0x085599f6, 0x01bb0000); // Force not supported resolutions + + // IDK if the following work (taken from TP) + // setVariable(0x08548ef3, 0x8990c031); // Shader Compiler + // setVariable(0x08799d8c, 0x082c9f52); // childTerminationHanlder + } + break; + case ID4_E: + { + // Debug + // detourFunction(0x08090478, _putConsole); // Crashes the game sometimes. + // Security + detourFunction(0x087106e6, amDongleInit); + detourFunction(0x0870f131, amDongleIsAvailable); + detourFunction(0x0870fb95, amDongleUpdate); + // Fixes + detourFunction(0x0870efbd, amDipswGetData); + detourFunction(0x0870f034, stubRetZero); // amDipswSetLed + setVariable(0x087a05e8, 0x08194748); // PTR_~cRealCardIF SIGSEV + detourFunction(0x08230fde, stubRetOne); // isEthLinkUp + setVariable(0x082df87d, 0x000154e9); // tickWaitDHCP + setVariable(0x082df881, 0x448b5100); // tickWaitDHCP + setVariable(0x082e0ec9, 0x3d8960eb); // tickInitAddress + // setVariable(0x08580979, 0x000126e9); // Avoid Full Screen set from Game + // Set Resolution + // setVariable(0x0837b12d, 0x0000f0e9); // Force set resolution + // setVariable(0x0837b223, 0x00000550); // Set ResX + // setVariable(0x0837b228, 0x00000300); // Set ResY + // setVariable(0x085700d3, 0x8990c031); // Fix something with the Shaders?? } break; case SEGABOOT_2_4_SYM: @@ -441,28 +581,56 @@ int initPatch() detourFunction(0x0805e8b0, amDongleInit); detourFunction(0x0805ebc3, amDongleIsAvailable); detourFunction(0x0805eb2a, amDongleUpdate); - //detourFunction(0x08062cf8, amLibInit); - //detourFunction(0x0805c200, amDipswInit); detourFunction(0x0805c30b, amDipswGetData); } break; case VT3: { + // Security detourFunction(0x0831c724, amDongleInit); detourFunction(0x0831ca37, amDongleIsAvailable); detourFunction(0x0831c99e, amDongleUpdate); + // Fixes detourFunction(0x0831c5d7, amDipswGetData); - detourFunction(0x0831c64f, stub0); - setVariable(0x0827ae1b, 0x34891beb); //Disable Fullscreen + detourFunction(0x0831c64f, stubRetZero); + setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game } + break; case VT3_TESTMODE: { + // Security detourFunction(0x0815f610, amDongleInit); detourFunction(0x0815f923, amDongleIsAvailable); detourFunction(0x0815f88a, amDongleUpdate); + // Fixes detourFunction(0x0815d06b, amDipswGetData); - detourFunction(0x0815d0e3, stub0); - //setVariable(0x0827ae1b, 0x34891beb); //Disable Fullscreen + detourFunction(0x0815d0e3, stubRetZero); + } + break; + case RAMBO: + { + // Security + detourFunction(0x082c4746, amDongleInit); + detourFunction(0x082c3201, amDongleIsAvailable); + detourFunction(0x082c3bf7, amDongleUpdate); + // Fixes + detourFunction(0x082c308d, amDipswGetData); + detourFunction(0x082c3103, stubRetZero); + } + break; + case TOO_SPICY: + { + // Security + detourFunction(0x0831cf02, amDongleInit); + detourFunction(0x0831b94d, amDongleIsAvailable); + detourFunction(0x0831c3b1, amDongleUpdate); + // Fixes + detourFunction(0x0831907d, amDipswGetData); + detourFunction(0x083190f4, stubRetZero); + // CPU patch to support AMD processors + setVariable(0x08399ADA, cpu_vendor.ebx); + setVariable(0x08399AEA, cpu_vendor.edx); + setVariable(0x08399AF5, cpu_vendor.ecx); } break; default: