1
0
mirror of synced 2024-11-24 05:40:10 +01:00

XF86 hook, more games, cleanin up a bit.

This commit is contained in:
dkeruza 2023-12-12 21:51:34 -05:00
parent f38162cd09
commit 945e9574ef
14 changed files with 396 additions and 183 deletions

22
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -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
}

View File

@ -10,5 +10,7 @@
"segaeax.h": "c", "segaeax.h": "c",
"passthrough.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"
} }

View File

@ -1,17 +1,15 @@
CC=gcc -m32 CC=gcc -m32
CFLAGS = -g -O0 -fPIC -m32 -Wall -Werror -Wno-unused-variable -Wno-unused-function 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 BUILD = build
OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
all: hookcrc32.so all: getcrc
hookcrc32.so: $(OBJS) hookcrc32.so: $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) $(CFLAGS) -o hookcrc32.so $(LD) $(OBJS) $(LDFLAGS) $(CFLAGS) -o getcrc
rm -f *.o rm -f *.o
clean: clean:
rm -f hookcrc32.so rm -f getcrc

38
src/hookcrc32/getcrc.c Normal file
View File

@ -0,0 +1,38 @@
#include <link.h>
#include <stdio.h>
uint32_t __crc32(const char *s, size_t n) {
uint32_t crc = 0xFFFFFFFF;
for (size_t i = 0; i < n; i++) {
char ch = s[i];
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;
}

View File

@ -1,95 +0,0 @@
#define _GNU_SOURCE
#include <dlfcn.h>
#include <link.h>
#include <stdio.h>
#include <stdlib.h>
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<n;i++) {
char ch=s[i];
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;
}
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);
}*/

View File

@ -4,6 +4,7 @@
#include <fcntl.h> /* File control definitions */ #include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */ #include <errno.h> /* Error number definitions */
#include <stdlib.h> /* Standard library functions like malloc, free, exit, and atoi */ #include <stdlib.h> /* Standard library functions like malloc, free, exit, and atoi */
#include <sys/select.h>
#include "baseboard.h" #include "baseboard.h"

View File

@ -54,6 +54,13 @@ static int detectGame(uint32_t elf_crc)
return 0; return 0;
} }
if (elf_crc == 0x5df569f5)
{
config.game = THE_HOUSE_OF_THE_DEAD_4_STRIPPED;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0x7235bda8) if (elf_crc == 0x7235bda8)
{ {
config.game = THE_HOUSE_OF_THE_DEAD_4_TEST; config.game = THE_HOUSE_OF_THE_DEAD_4_TEST;
@ -61,6 +68,20 @@ static int detectGame(uint32_t elf_crc)
return 0; 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) if (elf_crc == 0x6d055308)
{ {
config.game = OUTRUN; config.game = OUTRUN;
@ -114,11 +135,24 @@ static int detectGame(uint32_t elf_crc)
return 0; return 0;
} }
if (elf_crc == 0x7f3f9f0c)
{
config.game = ID4_E;
config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0xfb096f81) if (elf_crc == 0xfb096f81)
{ {
config.game = SRTV; config.game = SRTV;
config.emulateDriveboard = 1; config.emulateDriveboard = 1;
config.emulateMotionboard = 1; config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0x77ebac34)
{
config.game = RAMBO;
config.gameStatus = NOT_WORKING; config.gameStatus = NOT_WORKING;
return 0; return 0;
} }
@ -127,7 +161,13 @@ static int detectGame(uint32_t elf_crc)
{ {
config.game = RTUNED; config.game = RTUNED;
config.emulateDriveboard = 1; config.emulateDriveboard = 1;
config.emulateMotionboard = 1; config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0x4c768eb4)
{
config.game = TOO_SPICY;
config.gameStatus = WORKING; config.gameStatus = WORKING;
return 0; return 0;
} }
@ -175,6 +215,12 @@ char *getGameName()
return "The House of the Dead 4"; return "The House of the Dead 4";
case THE_HOUSE_OF_THE_DEAD_4_TEST: case THE_HOUSE_OF_THE_DEAD_4_TEST:
return "The House of the Dead 4 - Test Menu"; 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: case LETS_GO_JUNGLE:
return "Let's Go Jungle! Lost on the Island of Spice"; return "Let's Go Jungle! Lost on the Island of Spice";
case LETS_GO_JUNGLE_SPECIAL: case LETS_GO_JUNGLE_SPECIAL:
@ -184,10 +230,16 @@ char *getGameName()
return "After Burner Climax"; return "After Burner Climax";
case ID4: case ID4:
return "Initial D 4"; return "Initial D 4";
case ID4_E:
return "Initial D 4 Export";
case SRTV: case SRTV:
return "SEGA Race TV"; return "SEGA Race TV";
case RAMBO:
return "Rambo";
case RTUNED: case RTUNED:
return "R-Tuned Ultimate Street Racing"; return "R-Tuned Ultimate Street Racing";
case TOO_SPICY:
return "Too Spicy";
case VT3: case VT3:
return "Virtua Tennis 3"; return "Virtua Tennis 3";
case VT3_TESTMODE: case VT3_TESTMODE:

View File

@ -11,6 +11,9 @@ typedef enum
SEGABOOT_2_6, SEGABOOT_2_6,
THE_HOUSE_OF_THE_DEAD_4, THE_HOUSE_OF_THE_DEAD_4,
THE_HOUSE_OF_THE_DEAD_4_TEST, 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,
OUTRUN_TEST, OUTRUN_TEST,
LETS_GO_JUNGLE, LETS_GO_JUNGLE,
@ -18,8 +21,11 @@ typedef enum
ABC_2006, ABC_2006,
ABC_2007, ABC_2007,
ID4, ID4,
ID4_E,
SRTV, SRTV,
RAMBO,
RTUNED, RTUNED,
TOO_SPICY,
VT3, VT3,
VT3_TESTMODE, VT3_TESTMODE,
VF5_REVC VF5_REVC

View File

@ -163,11 +163,11 @@ int XNextEvent(Display *display, XEvent *event_return)
{ {
case 28: case 28:
setSwitch(SYSTEM, BUTTON_TEST, event_return->type == KeyPress); setSwitch(SYSTEM, BUTTON_TEST, event_return->type == KeyPress);
//securityBoardSetSwitch(BUTTON_TEST, event_return->type == KeyPress); // securityBoardSetSwitch(BUTTON_TEST, event_return->type == KeyPress);
break; break;
case 39: case 39:
setSwitch(PLAYER_1, BUTTON_SERVICE, event_return->type == KeyPress); setSwitch(PLAYER_1, BUTTON_SERVICE, event_return->type == KeyPress);
//securityBoardSetSwitch(BUTTON_SERVICE, event_return->type == KeyPress); // securityBoardSetSwitch(BUTTON_SERVICE, event_return->type == KeyPress);
break; break;
case 14: case 14:
incrementCoin(PLAYER_1, event_return->type == KeyPress); 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); 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; 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; typedef unsigned int uint;
int glXSwapIntervalSGI(int interval) int glXSwapIntervalSGI(int interval)

View File

@ -673,7 +673,8 @@ char *getenv(const char *name)
{ {
char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv"); 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) if (getcwd(envpath, 100) == NULL)
return ""; return "";

View File

@ -1,3 +1,4 @@
uint32_t get_crc32(const char *s,size_t n); uint32_t get_crc32(const char *s,size_t n);
void getCPUID(); void getCPUID();
typedef struct typedef struct
@ -6,4 +7,3 @@ typedef struct
unsigned edx; unsigned edx;
unsigned ecx; unsigned ecx;
}cpuvendor; }cpuvendor;

View File

@ -260,6 +260,9 @@ JVSStatus processPacket()
outputPacket.data[outputPacket.length] = REPORT_SUCCESS; outputPacket.data[outputPacket.length] = REPORT_SUCCESS;
outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0]; outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0];
outputPacket.length += 2; outputPacket.length += 2;
//printf("SW=%08d\r", io.state.inputSwitch[0]);
for (int i = 0; i < inputPacket.data[index + 1]; i++) for (int i = 0; i < inputPacket.data[index + 1]; i++)
{ {
for (int j = 0; j < inputPacket.data[index + 2]; j++) for (int j = 0; j < inputPacket.data[index + 2]; j++)
@ -623,7 +626,6 @@ int setSwitch(JVSPlayer player, JVSInput switchNumber, int value)
{ {
io.state.inputSwitch[player] &= ~switchNumber; io.state.inputSwitch[player] &= ~switchNumber;
} }
return 1; return 1;
} }

View File

@ -72,11 +72,16 @@ static void detourFunction(uint32_t address, void *function)
memcpy((void *)address, cave, 5); memcpy((void *)address, cave, 5);
} }
int stub0() int stubRetZero()
{ {
return 0; return 0;
} }
int stubRetOne()
{
return 1;
}
int amDongleInit() int amDongleInit()
{ {
return 0; return 0;
@ -94,17 +99,17 @@ int amDongleUpdate()
int amLibInit() int amLibInit()
{ {
uint32_t *amLibContext = (uint32_t *)0x08dfa2c0;//0x0809cb00; uint32_t *amLibContext = (uint32_t *)0x08dfa2c0; // 0x0809cb00;
*amLibContext = 1; *amLibContext = 1;
uint32_t *amLibInitializad = (uint32_t *)0x08dfa2c4;//0x0809cb04; uint32_t *amLibInitializad = (uint32_t *)0x08dfa2c4; // 0x0809cb04;
uint16_t *amLibPort1 = (uint16_t *)(0x08dfa2c4 + 4);//(0x0809cb04 + 4); uint16_t *amLibPort1 = (uint16_t *)(0x08dfa2c4 + 4); //(0x0809cb04 + 4);
uint16_t *amLibPort2 = (uint16_t *)(0x08dfa2c4 + 4);//(0x0809cb04 + 6); uint16_t *amLibPort2 = (uint16_t *)(0x08dfa2c4 + 4); //(0x0809cb04 + 6);
uint32_t *bcLibInitialized = (uint32_t *)(0x08dfa2c4 + 8);//0x0809cb0c; uint32_t *bcLibInitialized = (uint32_t *)(0x08dfa2c4 + 8); // 0x0809cb0c;
*amLibInitializad = 1; *amLibInitializad = 1;
*amLibPort1 = 0xd000; *amLibPort1 = 0xd000;
*amLibPort2 = 0x0004; *amLibPort2 = 0x0004;
*bcLibInitialized = 0; *bcLibInitialized = 0;
int res = ((int (*)(void))0x084dedc4)();//0x08065d80)(); int res = ((int (*)(void))0x084dedc4)(); // 0x08065d80)();
if (res == 1) if (res == 1)
*bcLibInitialized = 1; *bcLibInitialized = 1;
return 0; return 0;
@ -112,13 +117,13 @@ int amLibInit()
int amDipswInit() int amDipswInit()
{ {
uint32_t *amDipswContext = (uint32_t *)0x08df9cec;//0x0809c12c; uint32_t *amDipswContext = (uint32_t *)0x08df9cec; // 0x0809c12c;
uint32_t *amDipswContext1 = (uint32_t *)(0x08df9cec + 4);//(0x0809c12c + 4); uint32_t *amDipswContext1 = (uint32_t *)(0x08df9cec + 4); //(0x0809c12c + 4);
uint32_t *amDipswContext2 = (uint32_t *)(0x08df9cec + 8);//(0x0809c12c + 8); uint32_t *amDipswContext2 = (uint32_t *)(0x08df9cec + 8); //(0x0809c12c + 8);
uint32_t *amDipswContext3 = (uint32_t *)(0x08df9cec + 12);//(0x0809c12c + 12); uint32_t *amDipswContext3 = (uint32_t *)(0x08df9cec + 12); //(0x0809c12c + 12);
//typedef void *(*___constant_c_and_count_memset)(uint32_t *, int, size_t); // typedef void *(*___constant_c_and_count_memset)(uint32_t *, int, size_t);
//___constant_c_and_count_memset func = (___constant_c_and_count_memset)//0x0805c3d5; //___constant_c_and_count_memset func = (___constant_c_and_count_memset)//0x0805c3d5;
//func(amDipswContext, 0, 4); // func(amDipswContext, 0, 4);
*amDipswContext = 1; *amDipswContext = 1;
*amDipswContext1 = 1; *amDipswContext1 = 1;
*amDipswContext2 = 1; *amDipswContext2 = 1;
@ -137,7 +142,7 @@ void print_binary(unsigned int number)
int amDipswGetData(uint8_t *dip) int amDipswGetData(uint8_t *dip)
{ {
//printf("amDipswGetData Called!!!!!\n"); // printf("amDipswGetData Called!!!!!\n");
uint8_t result; uint8_t result;
uint32_t data; uint32_t data;
@ -145,19 +150,19 @@ int amDipswGetData(uint8_t *dip)
result = (~data & 4) != 0; // Test Button result = (~data & 4) != 0; // Test Button
if ((~data & 8) != 0) if ((~data & 8) != 0)
result |= 2; // Service Button result |= 2; // Service Button
if ((~data & 0x10) != 0) if ((~data & 0x10) != 0)
result |= 4; // ?? result |= 4; // ??
if ((char)data >= 0) if ((char)data >= 0)
result |= 8; // ?? result |= 8; // ??
if ((~data & 0x100) != 0) if ((~data & 0x100) != 0)
result |= 0x10; // Rotation result |= 0x10; // Rotation
if ((~data & 0x200) != 0) if ((~data & 0x200) != 0)
result |= 0x20; // Resolution Dip 4 result |= 0x20; // Resolution Dip 4
if ((~data & 0x400) != 0) if ((~data & 0x400) != 0)
result |= 0x40; // Resolution Dip 5 result |= 0x40; // Resolution Dip 5
if ((~data & 0x800) != 0) if ((~data & 0x800) != 0)
result |= 0x80; // Resolution Dip 6 result |= 0x80; // Resolution Dip 6
*dip = result; *dip = result;
return 0; return 0;
} }
@ -221,6 +226,7 @@ int initPatch()
{ {
case RTUNED: case RTUNED:
{ {
// Security
detourFunction(0x08366846, amDongleInit); detourFunction(0x08366846, amDongleInit);
detourFunction(0x08365301, amDongleIsAvailable); detourFunction(0x08365301, amDongleIsAvailable);
detourFunction(0x08365cf7, amDongleUpdate); detourFunction(0x08365cf7, amDongleUpdate);
@ -229,17 +235,18 @@ int initPatch()
case SRTV: case SRTV:
{ {
// Security
detourFunction(0x084d5b40, amDongleInit); detourFunction(0x084d5b40, amDongleInit);
detourFunction(0x084d45f9, amDongleIsAvailable); detourFunction(0x084d45f9, amDongleIsAvailable);
detourFunction(0x084d4fef, amDongleUpdate); detourFunction(0x084d4fef, amDongleUpdate);
detourFunction(0x084d44fc, stub0); // Fixes
detourFunction(0x084d44fc, stubRetZero); // Stub amDipswSetLed
detourFunction(0x084d4485, amDipswGetData); detourFunction(0x084d4485, amDipswGetData);
detourFunction(0x084d9118, amLibInit);
detourFunction(0x084d438c, amDipswInit);
} }
break; break;
case ABC_2006: case ABC_2006:
{ {
// Debug Messages
setVariable(0x0a0a37e4, 2); // amBackupDebugLevel setVariable(0x0a0a37e4, 2); // amBackupDebugLevel
setVariable(0x0a0a3800, 2); // amCreditDebugLevel setVariable(0x0a0a3800, 2); // amCreditDebugLevel
setVariable(0x0a0a3a58, 2); // amDipswDebugLevel setVariable(0x0a0a3a58, 2); // amDipswDebugLevel
@ -252,13 +259,20 @@ int initPatch()
setVariable(0x0a0a3a74, 2); // amOsinfoDebugLevel setVariable(0x0a0a3a74, 2); // amOsinfoDebugLevel
setVariable(0x0a0a3a78, 2); // amSysDataDebugLevel setVariable(0x0a0a3a78, 2); // amSysDataDebugLevel
setVariable(0x0a0a3a80, 2); // bcLibDebugLevel setVariable(0x0a0a3a80, 2); // bcLibDebugLevel
// Security
detourFunction(0x081e4980, amDongleInit); detourFunction(0x081e4980, amDongleInit);
detourFunction(0x081e4cce, amDongleIsAvailable); detourFunction(0x081e4cce, amDongleIsAvailable);
detourFunction(0x081e4bfa, amDongleUpdate); detourFunction(0x081e4bfa, amDongleUpdate);
// Fixes
detourFunction(0x081e48b6, amDipswGetData);
detourFunction(0x081e492e, stubRetZero); // Stub amDipswSetLed
// Does not work
setVariable(0x08061c31, 0x0000000c); // Force HD resolution
} }
break; break;
case ABC_2007: case ABC_2007:
{ {
// Debug Messages
setVariable(0x0a0a0d24, 2); // amBackupDebugLevel setVariable(0x0a0a0d24, 2); // amBackupDebugLevel
setVariable(0x0a0a0d40, 2); // amCreditDebugLevel setVariable(0x0a0a0d40, 2); // amCreditDebugLevel
setVariable(0x0a0a0f98, 2); // amDipswDebugLevel setVariable(0x0a0a0f98, 2); // amDipswDebugLevel
@ -271,14 +285,18 @@ int initPatch()
setVariable(0x0a0a0fb4, 2); // amOsinfoDebugLevel setVariable(0x0a0a0fb4, 2); // amOsinfoDebugLevel
setVariable(0x0a0a0fb8, 2); // amSysDataDebugLevel setVariable(0x0a0a0fb8, 2); // amSysDataDebugLevel
setVariable(0x0a0a0fc0, 2); // bcLibDebugLevel setVariable(0x0a0a0fc0, 2); // bcLibDebugLevel
// Security
detourFunction(0x081e3424, amDongleInit); detourFunction(0x081e3424, amDongleInit);
detourFunction(0x081e3772, amDongleIsAvailable); detourFunction(0x081e3772, amDongleIsAvailable);
detourFunction(0x081e369e, amDongleUpdate); detourFunction(0x081e369e, amDongleUpdate);
setVariable(0x081e7945, 0x00000001); // Test // Fixes
detourFunction(0x081e335a, amDipswGetData);
detourFunction(0x081e33d2, stubRetZero); // Stub amDipswSetLed
} }
break; break;
case OUTRUN: case OUTRUN:
{ {
// Debug Messages
setVariable(0x0893a24c, 2); // amBackupDebugLevel setVariable(0x0893a24c, 2); // amBackupDebugLevel
setVariable(0x0893a260, 2); // amCreditDebugLevel setVariable(0x0893a260, 2); // amCreditDebugLevel
setVariable(0x0893a4b8, 2); // amDipswDebugLevel setVariable(0x0893a4b8, 2); // amDipswDebugLevel
@ -291,14 +309,19 @@ int initPatch()
setVariable(0x0893a4d4, 2); // amOsinfoDebugLevel setVariable(0x0893a4d4, 2); // amOsinfoDebugLevel
setVariable(0x0893a4d8, 2); // amSysDataDebugLevel setVariable(0x0893a4d8, 2); // amSysDataDebugLevel
setVariable(0x0893a4e0, 2); // bcLibDebugLevel setVariable(0x0893a4e0, 2); // bcLibDebugLevel
// Security
detourFunction(0x08190e80, amDongleInit); detourFunction(0x08190e80, amDongleInit);
detourFunction(0x08191201, amDongleIsAvailable); detourFunction(0x08191201, amDongleIsAvailable);
detourFunction(0x08191125, amDongleUpdate); detourFunction(0x08191125, amDongleUpdate);
// Fixes
detourFunction(0x08190db6, amDipswGetData);
detourFunction(0x08190e2e, stubRetZero); // Stub amDipswSetLed
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4: case THE_HOUSE_OF_THE_DEAD_4:
{ {
// Debug Messages
setVariable(0x0a737c60, 2); // amBackupDebugLevel setVariable(0x0a737c60, 2); // amBackupDebugLevel
setVariable(0x0a737c64, 2); // amChunkDataDebugLevel setVariable(0x0a737c64, 2); // amChunkDataDebugLevel
setVariable(0x0a737c80, 2); // amCreditDebugLevel setVariable(0x0a737c80, 2); // amCreditDebugLevel
@ -313,71 +336,128 @@ int initPatch()
setVariable(0x0a737f1c, 2); // amSysDataDebugLevel setVariable(0x0a737f1c, 2); // amSysDataDebugLevel
setVariable(0x0a737f20, 2); // bcLibDebugLevel setVariable(0x0a737f20, 2); // bcLibDebugLevel
setVariable(0x0a737f24, 0x0FFFFFFF); // s_logMask setVariable(0x0a737f24, 0x0FFFFFFF); // s_logMask
// Security
detourFunction(0x08320178, amDongleInit); detourFunction(0x08320178, amDongleInit);
detourFunction(0x08320459, amDongleIsAvailable); detourFunction(0x08320459, amDongleIsAvailable);
detourFunction(0x083203c0, amDongleUpdate); detourFunction(0x083203c0, amDongleUpdate);
// Fixes
detourFunction(0x0831ddd7, amDipswGetData);
detourFunction(0x0831de4f, stubRetZero); // Stub amDipswSetLed
// CPU patch to support AMD processors
setVariable(0x0837d6aa, cpu_vendor.ebx); setVariable(0x0837d6aa, cpu_vendor.ebx);
setVariable(0x0837d6ba, cpu_vendor.edx); setVariable(0x0837d6ba, cpu_vendor.edx);
setVariable(0x0837d6c5, cpu_vendor.ecx); setVariable(0x0837d6c5, cpu_vendor.ecx);
} }
break; 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: case THE_HOUSE_OF_THE_DEAD_4_TEST:
{ {
detourFunction(0x080677a0, amDongleInit); detourFunction(0x080677a0, amDongleInit);
detourFunction(0x08067a81, amDongleIsAvailable); detourFunction(0x08067a81, amDongleIsAvailable);
detourFunction(0x080679e8, amDongleUpdate); detourFunction(0x080679e8, amDongleUpdate);
// Fixes
detourFunction(0x08067653, amDipswGetData);
detourFunction(0x080676cb, stubRetZero); // Stub amDipswSetLed
// CPU patch to support AMD processors
setVariable(0x0807217a, cpu_vendor.ebx); setVariable(0x0807217a, cpu_vendor.ebx);
setVariable(0x0807218a, cpu_vendor.edx); setVariable(0x0807218a, cpu_vendor.edx);
setVariable(0x08072195, cpu_vendor.ecx); setVariable(0x08072195, cpu_vendor.ecx);
} }
break; 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: case VF5_REVC:
{ {
// Security
detourFunction(0x085c6010, amDongleInit); detourFunction(0x085c6010, amDongleInit);
detourFunction(0x085c63cc, amDongleIsAvailable); detourFunction(0x085c63cc, amDongleIsAvailable);
detourFunction(0x085c62f0, amDongleUpdate); detourFunction(0x085c62f0, amDongleUpdate);
detourFunction(0x080b3426, stub0); // Stub returns 0 // Fixes and patches to bypss network check
detourFunction(0x080cb6d4, stub0); // Stub returns 0 detourFunction(0x085c5f46, amDipswGetData);
detourFunction(0x0840889e, stub0); // Stub returns 0 detourFunction(0x085c5fbe, stubRetZero); // Stub amDipswSetLed
detourFunction(0x0840ab90, stub0); // Stub returns 0 detourFunction(0x080b3426, stubRetZero); // Stub returns 0
setVariable(0x080e17af, 0x000000b8); // Patch IDK what detourFunction(0x080cb6d4, stubRetZero); // Stub returns 0
setVariable(0x080e17b3, 0x01e88300); // Patch IDK what 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; break;
case LETS_GO_JUNGLE: case LETS_GO_JUNGLE:
{ {
setVariable(0x08c083a4, 2); // amBackupDebugLevel setVariable(0x08c083a4, 2); // amBackupDebugLevel
setVariable(0x08c083c0, 2); // amCreditDebugLevel setVariable(0x08c083c0, 2); // amCreditDebugLevel
setVariable(0x08c08618, 2); // amDipswDebugLevel setVariable(0x08c08618, 2); // amDipswDebugLevel
setVariable(0x08c0861c, 2); // amDongleDebugLevel setVariable(0x08c0861c, 2); // amDongleDebugLevel
setVariable(0x08c08620, 2); // amEepromDebugLevel setVariable(0x08c08620, 2); // amEepromDebugLevel
setVariable(0x08c08624, 2); // amHwmonitorDebugLevel setVariable(0x08c08624, 2); // amHwmonitorDebugLevel
setVariable(0x08c08628, 2); // amJvsDebugLevel setVariable(0x08c08628, 2); // amJvsDebugLevel
setVariable(0x08c0862c, 2); // amLibDebugLevel setVariable(0x08c0862c, 2); // amLibDebugLevel
setVariable(0x08c08630, 2); // amMiscDebugLevel setVariable(0x08c08630, 2); // amMiscDebugLevel
setVariable(0x08c08638, 2); // amSysDataDebugLevel setVariable(0x08c08638, 2); // amSysDataDebugLevel
setVariable(0x08c08640, 2); // bcLibDebugLevel setVariable(0x08c08640, 2); // bcLibDebugLevel
setVariable(0x08c08634, 2); // amOsinfoDebugLevel setVariable(0x08c08634, 2); // amOsinfoDebugLevel
setVariable(0x08c08644, 0x0FFFFFFF); // s_logMask setVariable(0x08c08644, 0x0FFFFFFF); // s_logMask
detourFunction(0x08074a8c, _putConsole); // Debug Messages detourFunction(0x08074a8c, _putConsole); // Debug Messages
// Security
detourFunction(0x084e50d8, amDongleInit); detourFunction(0x084e50d8, amDongleInit);
detourFunction(0x084e5459, amDongleIsAvailable); detourFunction(0x084e5459, amDongleIsAvailable);
detourFunction(0x084e537d, amDongleUpdate); detourFunction(0x084e537d, amDongleUpdate);
detourFunction(0x084e500e, amDipswGetData);
setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle
setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle
setVariable(0x0807b76a, 0xc2839090); // Patch initializeArcadeBackup setVariable(0x0807b76a, 0xc2839090); // Patch initializeArcadeBackup
setVariable(0x082E006b, 0x00000780); // Set ResX // Fixes
setVariable(0x082E0078, 0x00000438); // Set ResY 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 // From Teknoparrot AMDFIX
setVariable(0x083ef701, 0x00036ee9); // AMDFIX // setVariable(0x083ef701, 0x00036ee9); // AMDFIX
setVariable(0x084032e0, 0x8b90c933); // fix shader compilation with AMD GPUs // setVariable(0x084032e0, 0x8b90c933); // fix shader compilation with AMD GPUs
setVariable(0x08523950, 0x000000c3); // Remove ADXM_SetupFramework (Not necessary) // setVariable(0x08523950, 0x000000c3); // Remove ADXM_SetupFramework (Not necessary)
} }
break; break;
case LETS_GO_JUNGLE_SPECIAL: case LETS_GO_JUNGLE_SPECIAL:
@ -395,18 +475,23 @@ int initPatch()
setVariable(0x08c45680, 2); // bcLibDebugLevel setVariable(0x08c45680, 2); // bcLibDebugLevel
setVariable(0x08c45674, 2); // amOsinfoDebugLevel setVariable(0x08c45674, 2); // amOsinfoDebugLevel
setVariable(0x08c45684, 0x0FFFFFFF); // s_logMask setVariable(0x08c45684, 0x0FFFFFFF); // s_logMask
detourFunction(0x08075012, _putConsole);
// Security
detourFunction(0x08510320, amDongleInit); detourFunction(0x08510320, amDongleInit);
detourFunction(0x085106dc, amDongleIsAvailable); detourFunction(0x085106dc, amDongleIsAvailable);
detourFunction(0x08510600, amDongleUpdate); detourFunction(0x08510600, amDongleUpdate);
detourFunction(0x08075012, _putConsole);
// setVariable(0x08303C4B, 0x00000780); // Set ResX
// setVariable(0x08303C58, 0x00000438); // Set ResY
setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle
setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle
setVariable(0x0807e609, 0x90909090); // Patch initializeArcadeBackup setVariable(0x0807e609, 0xc2839090); // Patch initializeArcadeBackup
setVariable(0x0807e60D, 0xC2839090); // Patch initializeArcadeBackup // Fixes
setVariable(0x087d47f7, 0x62ab8500); // Seat Test?? detourFunction(0x08510256, amDipswGetData);
setVariable(0x08438954, 0x1c899090); // No more Full Screen from the Game 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; break;
case ID4: case ID4:
@ -424,16 +509,71 @@ int initPatch()
setVariable(0x08d719e0, 2); // bcLibDebugLevel setVariable(0x08d719e0, 2); // bcLibDebugLevel
setVariable(0x08d719d4, 2); // amOsinfoDebugLevel setVariable(0x08d719d4, 2); // amOsinfoDebugLevel
setVariable(0x08d719e4, 0x0FFFFFFF); // s_logMask setVariable(0x08d719e4, 0x0FFFFFFF); // s_logMask
// detourFunction(0x0808f9a8, _putConsole); // Crashes the game sometimes.
// Security
detourFunction(0x086e2336, amDongleInit); detourFunction(0x086e2336, amDongleInit);
detourFunction(0x086e0d81, amDongleIsAvailable); detourFunction(0x086e0d81, amDongleIsAvailable);
detourFunction(0x086e17e5, amDongleUpdate); detourFunction(0x086e17e5, amDongleUpdate);
// Fixes
detourFunction(0x086e0c0d, amDipswGetData); detourFunction(0x086e0c0d, amDipswGetData);
detourFunction(0x086e0c84, stub0); detourFunction(0x086e0c84, stubRetZero); // amDipswSetLED
detourFunction(0x0808f9a8, _putConsole); detourFunction(0x0821e6dc, stubRetOne); // isEthLinkUp
setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x082cb411, 0x0927c020); // tickInitStoreNetwork
setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle setVariable(0x082cb6d9, 0x000150e9); // tickWaitDHCP
setVariable(0x0807e609, 0x90909090); // Patch initializeArcadeBackup setVariable(0x082cb6dd, 0x448b5100); // tickWaitDHCP
setVariable(0x0807e60D, 0xC2839090); // Patch initializeArcadeBackup // 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; break;
case SEGABOOT_2_4_SYM: case SEGABOOT_2_4_SYM:
@ -441,28 +581,56 @@ int initPatch()
detourFunction(0x0805e8b0, amDongleInit); detourFunction(0x0805e8b0, amDongleInit);
detourFunction(0x0805ebc3, amDongleIsAvailable); detourFunction(0x0805ebc3, amDongleIsAvailable);
detourFunction(0x0805eb2a, amDongleUpdate); detourFunction(0x0805eb2a, amDongleUpdate);
//detourFunction(0x08062cf8, amLibInit);
//detourFunction(0x0805c200, amDipswInit);
detourFunction(0x0805c30b, amDipswGetData); detourFunction(0x0805c30b, amDipswGetData);
} }
break; break;
case VT3: case VT3:
{ {
// Security
detourFunction(0x0831c724, amDongleInit); detourFunction(0x0831c724, amDongleInit);
detourFunction(0x0831ca37, amDongleIsAvailable); detourFunction(0x0831ca37, amDongleIsAvailable);
detourFunction(0x0831c99e, amDongleUpdate); detourFunction(0x0831c99e, amDongleUpdate);
// Fixes
detourFunction(0x0831c5d7, amDipswGetData); detourFunction(0x0831c5d7, amDipswGetData);
detourFunction(0x0831c64f, stub0); detourFunction(0x0831c64f, stubRetZero);
setVariable(0x0827ae1b, 0x34891beb); //Disable Fullscreen setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game
} }
break;
case VT3_TESTMODE: case VT3_TESTMODE:
{ {
// Security
detourFunction(0x0815f610, amDongleInit); detourFunction(0x0815f610, amDongleInit);
detourFunction(0x0815f923, amDongleIsAvailable); detourFunction(0x0815f923, amDongleIsAvailable);
detourFunction(0x0815f88a, amDongleUpdate); detourFunction(0x0815f88a, amDongleUpdate);
// Fixes
detourFunction(0x0815d06b, amDipswGetData); detourFunction(0x0815d06b, amDipswGetData);
detourFunction(0x0815d0e3, stub0); detourFunction(0x0815d0e3, stubRetZero);
//setVariable(0x0827ae1b, 0x34891beb); //Disable Fullscreen }
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; break;
default: default: