psxinterpreter: use cycle_multiplier also
[pcsx_rearmed.git] / libpcsxcore / database.c
1 #include "misc.h"
2 #include "sio.h"
3 #include "new_dynarec/new_dynarec.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 static const struct
21 {
22         const char * const id;
23         int mult;
24 }
25 cycle_multiplier_overrides[] =
26 {
27         /* Internal Section - fussy about timings */
28         { "SLPS01868", 202 },
29         /* Super Robot Taisen Alpha - on the edge with 175,
30          * changing memcard settings is enough to break/unbreak it */
31         { "SLPS02528", 190 },
32         { "SLPS02636", 190 },
33 #ifdef DRC_DISABLE /* new_dynarec has a hack for this game */
34         /* Parasite Eve II - internal timer checks */
35         { "SLUS01042", 125 },
36         { "SLUS01055", 125 },
37         { "SLES02558", 125 },
38         { "SLES12558", 125 },
39 #endif
40 };
41
42 /* Function for automatic patching according to GameID. */
43 void Apply_Hacks_Cdrom()
44 {
45         uint32_t i;
46         
47         /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
48         for(i=0;i<ARRAY_SIZE(MemorycardHack_db);i++)
49         {
50                 if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
51                 {
52                         /* Disable the second memory card slot for the game */
53                         Config.Mcd2[0] = 0;
54                         /* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
55                         McdDisable[1] = 1;
56                 }
57         }
58
59         /* Dynarec game-specific hacks */
60         new_dynarec_hacks_pergame = 0;
61         Config.cycle_multiplier_override = 0;
62
63         for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++)
64         {
65                 if (strcmp(CdromId, cycle_multiplier_overrides[i].id) == 0)
66                 {
67                         Config.cycle_multiplier_override = cycle_multiplier_overrides[i].mult;
68                         new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M;
69                         SysPrintf("using cycle_multiplier_override: %d\n",
70                                 Config.cycle_multiplier_override);
71                         break;
72                 }
73         }
74 }