Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal database for problematic games #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CFLAGS += -DPCNT
endif

# core
OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/database.o libpcsxcore/debug.o \
libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
Expand Down
36 changes: 36 additions & 0 deletions libpcsxcore/database.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "misc.h"
#include "../plugins/dfsound/spu_config.h"
#include "sio.h"

/* It's duplicated from emu_if.c */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))

static const char MemorycardHack_db[8][10] =
{
/* Lifeforce Tenka, also known as Codename Tenka */
{"SLES00613"},
{"SLED00690"},
{"SLES00614"},
{"SLES00615"},
{"SLES00616"},
{"SLES00617"},
{"SCUS94409"}
};

/* Function for automatic patching according to GameID. */
void Apply_Hacks_Cdrom()
{
uint32_t i;

/* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
for(i=0;i<ARRAY_SIZE(MemorycardHack_db);i++)
{
if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
{
/* Disable the second memory card slot for the game */
Config.Mcd2[0] = 0;
/* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
McdDisable[1] = 1;
}
}
}
6 changes: 6 additions & 0 deletions libpcsxcore/database.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef DATABASE_H
#define DATABASE_H

extern void Apply_Hacks_Cdrom();

#endif
3 changes: 3 additions & 0 deletions libpcsxcore/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "mdec.h"
#include "gpu.h"
#include "ppf.h"
#include "database.h"
#include <zlib.h>

char CdromId[10] = "";
Expand Down Expand Up @@ -389,6 +390,8 @@ int CheckCdrom() {
SysPrintf(_("CD-ROM Label: %.32s\n"), CdromLabel);
SysPrintf(_("CD-ROM ID: %.9s\n"), CdromId);
SysPrintf(_("CD-ROM EXE Name: %.255s\n"), exename);

Apply_Hacks_Cdrom();

BuildPPFCache();

Expand Down
1 change: 1 addition & 0 deletions libpcsxcore/sio.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern "C" {
#define MCD_SIZE (1024 * 8 * 16)

extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
extern char McdDisable[2];

void sioWrite8(unsigned char value);
void sioWriteStat16(unsigned short value);
Expand Down