X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fdatabase.c;h=f947b068d345bda15cd16ce0408d6e55561715ab;hp=1ea8d43bf135e6ebf0537b0ca254c61863425cbf;hb=688bdb9526d42181368e64ceaa6828727a10188c;hpb=cbd88286c7e8473e1062fbe740ec59a302031531 diff --git a/libpcsxcore/database.c b/libpcsxcore/database.c index 1ea8d43b..f947b068 100644 --- a/libpcsxcore/database.c +++ b/libpcsxcore/database.c @@ -5,16 +5,32 @@ /* 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", +}; + +#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), }; static const struct @@ -42,10 +58,24 @@ cycle_multiplier_overrides[] = /* Function for automatic patching according to GameID. */ void Apply_Hacks_Cdrom() { - 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; + } + } + /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */ - for(i=0;i