1
0
mirror of synced 2025-02-20 04:21:07 +01:00

more patches / cleaned CRC / added game status.

This commit is contained in:
dkeruza 2023-11-22 15:45:41 -05:00
parent 3c2ef889e7
commit 0ee6d12393
6 changed files with 134 additions and 15 deletions

View File

@ -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__))

Binary file not shown.

View File

@ -7,6 +7,8 @@
EmulatorConfig config = {0};
extern uint32_t elf_crc;
FILE *configFile = NULL;
#define CONFIG_PATH "lindbergh.conf"
@ -31,26 +33,24 @@ static char *getNextToken(char *buffer, char *seperator, char **saveptr)
static int detectGame(uint32_t elf_crc)
{
// For a better way of doing this, we should look for strings inside the game
// This will allow patching the game and for it to still be detected.
// strings %s | grep "RIDE TURN TEST" && strings %s | grep "PLEASE SHOOT GRID"
// shows you its hotd4S for example
if (elf_crc == 0x93ea7e11)
{
config.game = SEGABOOT_2_4;
config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0xbc0c9ffa)
{
config.game = THE_HOUSE_OF_THE_DEAD_4;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0x7235bda8)
{
config.game = THE_HOUSE_OF_THE_DEAD_4_TEST;
config.gameStatus = WORKING;
return 0;
}
@ -59,6 +59,7 @@ static int detectGame(uint32_t elf_crc)
config.game = OUTRUN;
config.emulateDriveboard = 1;
config.emulateMotionboard = 1;
config.gameStatus = WORKING;
return 0;
}
@ -67,24 +68,42 @@ static int detectGame(uint32_t elf_crc)
config.game = OUTRUN_TEST;
config.emulateDriveboard = 1;
config.emulateMotionboard = 1;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0xd4726d61)
{
config.game = LETS_GO_JUNGLE;
config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0xbbabc0e0)
{
config.game = LETS_GO_JUNGLE_SPECIAL;
config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0xcc02de7d)
{
config.game = ABC_2006;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0x152530dd)
{
config.game = ABC_2007;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0x4e9ccf33)
{
config.game = ID4;
config.gameStatus = NOT_WORKING;
return 0;
}
@ -93,6 +112,7 @@ static int detectGame(uint32_t elf_crc)
config.game = SRTV;
config.emulateDriveboard = 1;
config.emulateMotionboard = 1;
config.gameStatus = NOT_WORKING;
return 0;
}
@ -101,18 +121,21 @@ static int detectGame(uint32_t elf_crc)
config.game = RTUNED;
config.emulateDriveboard = 1;
config.emulateMotionboard = 1;
config.gameStatus = WORKING;
return 0;
}
if (elf_crc == 0xc4b7e89)
{
config.game = VT3;
config.gameStatus = NOT_WORKING;
return 0;
}
if (elf_crc == 0x1bf1b627)
{
config.game = VF5_REVC;
config.gameStatus = NOT_WORKING;
return 0;
}
@ -138,9 +161,13 @@ char *getGameName()
return "The House of the Dead 4 - Test Menu";
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 ABC_2006:
case ABC_2007:
return "After Burner Climax";
case ID4:
return "Initial D 4";
case SRTV:
return "SEGA Race TV";
case RTUNED:
@ -206,7 +233,6 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
if (strcmp(colour, "RED") == 0)
config->lindberghColour = 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");

View File

@ -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();

View File

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

View File

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