X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fdatabase.c;h=b35658ba97f331e94698c13331e0633f33a7caa6;hb=26665bc5cb481a2087beb78793b3bef1be7c1597;hp=f383e361623894e293521421cf7722d7284bbb2b;hpb=eedfe8060a20c8a9120ff8cab55110a1e2470887;p=pcsx_rearmed.git diff --git a/libpcsxcore/database.c b/libpcsxcore/database.c index f383e361..b35658ba 100644 --- a/libpcsxcore/database.c +++ b/libpcsxcore/database.c @@ -1,29 +1,147 @@ #include "misc.h" -#include "../plugins/dfsound/spu_config.h" #include "sio.h" +#include "ppf.h" +#include "new_dynarec/new_dynarec.h" /* It's duplicated from emu_if.c */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -static const char MemorycardHack_db[8][10] = +static const char * const MemorycardHack_db[] = { /* Lifeforce Tenka, also known as Codename Tenka */ - {"SLES00613"}, - {"SLED00690"}, - {"SLES00614"}, - {"SLES00615"}, - {"SLES00616"}, - {"SLES00617"}, - {"SCUS94409"} + "SLES00613", "SLED00690", "SLES00614", "SLES00615", + "SLES00616", "SLES00617", "SCUS94409" +}; + +static const char * const cdr_read_hack_db[] = +{ + /* T'ai Fu - Wrath of the Tiger */ + "SLUS00787", +}; + +static const char * const gpu_slow_llist_db[] = +{ + /* Bomberman Fantasy Race */ + "SLES01712", "SLPS01525", "SLPS91138", "SLPM87102", "SLUS00823", + /* Crash Bash */ + "SCES02834", "SCUS94570", "SCUS94616", "SCUS94654", + /* Final Fantasy IV */ + "SCES03840", "SLPM86028", "SLUS01360", + /* Simple 1500 Series Vol. 57: The Meiro */ + "SLPM86715", + /* Spot Goes to Hollywood */ + "SLES00330", "SLPS00394", "SLUS00014", + /* Tiny Tank */ + "SCES01338", "SCES02072", "SCES02072", "SCES02072", "SCES02072", "SCUS94427", + /* Vampire Hunter D */ + "SLES02731", "SLPS02477", "SLPS03198", "SLUS01138", +}; + +static const char * const gpu_busy_hack_db[] = +{ + /* ToHeart (Japan) */ + "SLPS01919", "SLPS01920", +}; + +static const char * const gpu_centering_hack_db[] = +{ + /* Gradius Gaiden */ + "SLPM86042", "SLPM86103", "SLPM87323", + /* Sexy Parodius */ + "SLPM86009", +}; + +static const char * const dualshock_timing1024_hack_db[] = +{ + /* Judge Dredd - could also be poor cdrom+mdec+dma timing */ + "SLUS00630", "SLES00755", +}; + +static const char * const dualshock_init_analog_hack_db[] = +{ + /* Formula 1 Championship Edition */ + "SLUS00546", +}; + +#define HACK_ENTRY(var, list) \ + { #var, &Config.hacks.var, list, ARRAY_SIZE(list) } + +static const struct +{ + const char *name; + boolean *var; + const char * const * id_list; + size_t id_list_len; +} +hack_db[] = +{ + HACK_ENTRY(cdr_read_timing, cdr_read_hack_db), + HACK_ENTRY(gpu_slow_list_walking, gpu_slow_llist_db), + HACK_ENTRY(gpu_busy, gpu_busy_hack_db), + HACK_ENTRY(gpu_centering, gpu_centering_hack_db), + HACK_ENTRY(gpu_timing1024, dualshock_timing1024_hack_db), + HACK_ENTRY(dualshock_init_analog, dualshock_init_analog_hack_db), +}; + +static const struct +{ + int mult; + const char * const id[4]; +} +cycle_multiplier_overrides[] = +{ + /* note: values are = (10000 / gui_option) */ + /* Internal Section - fussy about timings */ + { 202, { "SLPS01868" } }, + /* Super Robot Taisen Alpha - on the edge with 175, + * changing memcard settings is enough to break/unbreak it */ + { 190, { "SLPS02528", "SLPS02636" } }, + /* Brave Fencer Musashi - cd sectors arrive too fast */ + { 170, { "SLUS00726", "SLPS01490" } }, +#if defined(DRC_DISABLE) || defined(LIGHTREC) /* new_dynarec has a hack for this game */ + /* Parasite Eve II - internal timer checks */ + { 125, { "SLUS01042", "SLUS01055", "SLES02558", "SLES12558" } }, +#endif + /* Discworld Noir - audio skips if CPU runs too fast */ + { 222, { "SLES01549", "SLES02063", "SLES02064" } }, + /* Digimon World */ + { 153, { "SLUS01032", "SLES02914" } }, + /* Syphon Filter - reportedly hangs under unknown conditions */ + { 169, { "SCUS94240" } }, + /* Psychic Detective - some weird race condition in the game's cdrom code */ + { 222, { "SLUS00165", "SLUS00166", "SLUS00167" } }, + { 222, { "SLES00070", "SLES10070", "SLES20070" } }, + /* Zero Divide - sometimes too fast */ + { 200, { "SLUS00183", "SLES00159", "SLPS00083", "SLPM80008" } }, }; /* Function for automatic patching according to GameID. */ -void Apply_Hacks_Cdrom() +void Apply_Hacks_Cdrom(void) { - uint32_t i; - + size_t i, j; + + memset(&Config.hacks, 0, sizeof(Config.hacks)); + + for (i = 0; i < ARRAY_SIZE(hack_db); i++) + { + for (j = 0; j < hack_db[i].id_list_len; j++) + { + if (strncmp(CdromId, hack_db[i].id_list[j], 9)) + continue; + *hack_db[i].var = 1; + SysPrintf("using hack: %s\n", hack_db[i].name); + break; + } + } + + if (Config.hacks.dualshock_init_analog) { + // assume the default is off, see LoadPAD1plugin() + for (i = 0; i < 8; i++) + padToggleAnalog(i); + } + /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */ - for(i=0;i