Fix parts of The House Of The Dead 4
This commit is contained in:
parent
9a9a714da3
commit
330bccfb35
@ -16,10 +16,10 @@ Working is defined by getting into attract mode and running the game, but not ne
|
||||
- The House Of The Dead 4
|
||||
- The House Of The Dead 4 Special
|
||||
- The House Of The Dead Ex
|
||||
- After Burner Climax
|
||||
|
||||
## Games that do not work or haven't been tested
|
||||
|
||||
- After Burner Climax
|
||||
- Hummer
|
||||
- Initial D 4
|
||||
- Initial D 5
|
||||
|
@ -247,12 +247,14 @@ int baseboardIoctl(int fd, unsigned int request, void *data)
|
||||
case BASEBOARD_GET_SERIAL:
|
||||
{
|
||||
memcpy(&sharedMemory[serialCommand.destAddress + 96], SERIAL_STRING, strlen(SERIAL_STRING));
|
||||
_data[1] = 1; // Set the status to success
|
||||
}
|
||||
break;
|
||||
|
||||
case BASEBOARD_GET_SENSE_LINE:
|
||||
{
|
||||
_data[2] = getSenseLine();
|
||||
_data[1] = 1; // Set the status to success
|
||||
}
|
||||
break;
|
||||
|
||||
@ -263,6 +265,7 @@ int baseboardIoctl(int fd, unsigned int request, void *data)
|
||||
memcpy(&sharedMemory[jvsCommand.destAddress], outputBuffer, outputPacket.length + 3);
|
||||
_data[2] = jvsCommand.destAddress;
|
||||
_data[3] = outputPacket.length + 3;
|
||||
_data[1] = 1; // Set the status to success
|
||||
}
|
||||
else if (jvsFileDescriptor >= 0)
|
||||
{
|
||||
@ -273,6 +276,7 @@ int baseboardIoctl(int fd, unsigned int request, void *data)
|
||||
|
||||
_data[2] = jvsCommand.destAddress;
|
||||
_data[3] = count;
|
||||
_data[1] = (count > 0); // Success if we receive any sort of data back
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -284,9 +288,6 @@ int baseboardIoctl(int fd, unsigned int request, void *data)
|
||||
// Acknowledge the command
|
||||
_data[0] |= 0xF0000000;
|
||||
|
||||
// Set the status to success
|
||||
_data[1] = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
@ -60,7 +60,10 @@ int eepromIoctl(int fd, unsigned int request, void *data)
|
||||
{
|
||||
// The below is copied from what SEGABOOT expects
|
||||
uint32_t *functions = data;
|
||||
functions[0] = 0x20000 | 0x100000 | 0x400000 | 0x8000000;
|
||||
functions[0] = 0x20000 | 0x40000 | 0x100000 | 0x400000 | 0x8000000;
|
||||
|
||||
// The following is taken from the eeprom init sequence in The House Of The Dead 4 so lets add em on!
|
||||
functions[0] = functions[0] | 0x20000 | 0x40000 | 0x80000 | 0x100000 | 0x200000 | 0x400000 | 0x1000000 | 0x2000000;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "hook.h"
|
||||
|
||||
@ -107,6 +108,24 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
void setVariable(uint32_t address, uint32_t value)
|
||||
{
|
||||
int pagesize = sysconf(_SC_PAGE_SIZE);
|
||||
|
||||
uint32_t *variable = (uint32_t *)address;
|
||||
|
||||
void *toModify = (void *)(address - (address % pagesize));
|
||||
|
||||
int prot = mprotect(toModify, pagesize, PROT_WRITE);
|
||||
if (prot != 0)
|
||||
{
|
||||
printf("Variable change error %d\n", prot);
|
||||
abort();
|
||||
}
|
||||
|
||||
*variable = value;
|
||||
}
|
||||
|
||||
void __attribute__((constructor)) hook_init()
|
||||
{
|
||||
printf("SEGA Lindbergh Loader\nRobert Dilley 2022\nNot for public consumption\n\n");
|
||||
@ -146,13 +165,31 @@ void __attribute__((constructor)) hook_init()
|
||||
securityBoardSetDipResolution(getConfig()->width, getConfig()->height);
|
||||
|
||||
printf("Loader init success\n");
|
||||
|
||||
// The Hosue Of The Dead 4 C Set all Debug Variables;
|
||||
/*
|
||||
setVariable(0x0a737c60, 2); // amBackupDebugLevel
|
||||
setVariable(0x0a737c64, 2); // amChunkDataDebugLevel
|
||||
setVariable(0x0a737c80, 2); // amCreditDebugLevel
|
||||
setVariable(0x0a737ed8, 2); // amDipswDebugLevel
|
||||
setVariable(0x0a737edc, 2); // amDiskDebugLevel
|
||||
setVariable(0x0a737ee0, 2); // amDongleDebugLevel
|
||||
setVariable(0x0a737ee4, 2); // amEepromDebugLevel
|
||||
setVariable(0x0a737ee8, 2); // amHmDebugLevel
|
||||
setVariable(0x0a737ef0, 2); // amJvsDebugLevel
|
||||
setVariable(0x0a737f14, 2); // amLibDebugLevel
|
||||
setVariable(0x0a737f18, 2); // amMiscDebugLevel
|
||||
setVariable(0x0a737f1c, 2); // amSysDataDebugLevel
|
||||
setVariable(0x0a737f20, 2); // bcLibDebugLevel
|
||||
setVariable(0x0a737f24, 0x0FFFFFFF); // s_logMask
|
||||
*/
|
||||
}
|
||||
|
||||
int open(const char *pathname, int flags)
|
||||
{
|
||||
int (*_open)(const char *pathname, int flags) = dlsym(RTLD_NEXT, "open");
|
||||
|
||||
//printf("Open %s\n", pathname);
|
||||
// printf("Open %s\n", pathname);
|
||||
|
||||
if (strcmp(pathname, "/dev/lbb") == 0)
|
||||
{
|
||||
@ -170,7 +207,7 @@ int open(const char *pathname, int flags)
|
||||
|
||||
if (strcmp(pathname, "/dev/ttyS0") == 0 || strcmp(pathname, "/dev/tts/0") == 0)
|
||||
{
|
||||
if(hooks[SERIAL0] != -1)
|
||||
if (hooks[SERIAL0] != -1)
|
||||
return -1;
|
||||
|
||||
hooks[SERIAL0] = _open(HOOK_FILE_NAME, flags);
|
||||
@ -180,7 +217,7 @@ int open(const char *pathname, int flags)
|
||||
|
||||
if (strcmp(pathname, "/dev/ttyS1") == 0 || strcmp(pathname, "/dev/tts/1") == 0)
|
||||
{
|
||||
if(hooks[SERIAL1] != -1)
|
||||
if (hooks[SERIAL1] != -1)
|
||||
return -1;
|
||||
|
||||
hooks[SERIAL1] = _open(HOOK_FILE_NAME, flags);
|
||||
@ -197,6 +234,16 @@ int open(const char *pathname, int flags)
|
||||
return _open(pathname, flags);
|
||||
}
|
||||
|
||||
int open64(const char *pathname, int flags)
|
||||
{
|
||||
return open(pathname, flags);
|
||||
}
|
||||
|
||||
int sem_wait(sem_t *sem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *fopen(const char *restrict pathname, const char *restrict mode)
|
||||
{
|
||||
FILE *(*_fopen)(const char *restrict pathname, const char *restrict mode) = dlsym(RTLD_NEXT, "fopen");
|
||||
@ -317,7 +364,8 @@ ssize_t read(int fd, void *buf, size_t count)
|
||||
}
|
||||
|
||||
// If we don't hook the serial just reply with nothing
|
||||
if(fd == hooks[SERIAL0] || fd == hooks[SERIAL1]) {
|
||||
if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user