Skip to content

Commit fc73089

Browse files
committed
Add internal database for problematic games.
1 parent fbf19ce commit fc73089

5 files changed

Lines changed: 47 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CFLAGS += -DPCNT
3939
endif
4040

4141
# core
42-
OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
42+
OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/database.o libpcsxcore/debug.o \
4343
libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
4444
libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
4545
libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \

libpcsxcore/database.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "misc.h"
2+
#include "../plugins/dfsound/spu_config.h"
3+
#include "sio.h"
4+
5+
/* It's duplicated from emu_if.c */
6+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
7+
8+
static const char MemorycardHack_db[8][10] =
9+
{
10+
/* Lifeforce Tenka, also known as Codename Tenka */
11+
{"SLES00613"},
12+
{"SLED00690"},
13+
{"SLES00614"},
14+
{"SLES00615"},
15+
{"SLES00616"},
16+
{"SLES00617"},
17+
{"SCUS94409"}
18+
};
19+
20+
/* Function for automatic patching according to GameID. */
21+
void Apply_Hacks_Cdrom()
22+
{
23+
uint32_t i;
24+
25+
/* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
26+
for(i=0;i<ARRAY_SIZE(MemorycardHack_db);i++)
27+
{
28+
if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
29+
{
30+
/* Disable the second memory card slot for the game */
31+
Config.Mcd2[0] = 0;
32+
/* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
33+
McdDisable[1] = 1;
34+
}
35+
}
36+
}

libpcsxcore/database.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef DATABASE_H
2+
#define DATABASE_H
3+
4+
extern void Apply_Hacks_Cdrom();
5+
6+
#endif

libpcsxcore/misc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "mdec.h"
2727
#include "gpu.h"
2828
#include "ppf.h"
29+
#include "database.h"
2930
#include <zlib.h>
3031

3132
char CdromId[10] = "";
@@ -389,6 +390,8 @@ int CheckCdrom() {
389390
SysPrintf(_("CD-ROM Label: %.32s\n"), CdromLabel);
390391
SysPrintf(_("CD-ROM ID: %.9s\n"), CdromId);
391392
SysPrintf(_("CD-ROM EXE Name: %.255s\n"), exename);
393+
394+
Apply_Hacks_Cdrom();
392395

393396
BuildPPFCache();
394397

libpcsxcore/sio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extern "C" {
3434
#define MCD_SIZE (1024 * 8 * 16)
3535

3636
extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
37+
extern char McdDisable[2];
3738

3839
void sioWrite8(unsigned char value);
3940
void sioWriteStat16(unsigned short value);

0 commit comments

Comments
 (0)