3 #include "new_dynarec/new_dynarec.h"
4 #include "lightrec/plugin.h"
6 /* It's duplicated from emu_if.c */
7 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
9 /* Corresponds to LIGHTREC_OPT_INV_DMA_ONLY of lightrec.h */
10 #define LIGHTREC_HACK_INV_DMA_ONLY (1 << 0)
14 static const char * const MemorycardHack_db[] =
16 /* Lifeforce Tenka, also known as Codename Tenka */
17 "SLES00613", "SLED00690", "SLES00614", "SLES00615",
18 "SLES00616", "SLES00617", "SCUS94409"
21 static const char * const cdr_read_hack_db[] =
23 /* T'ai Fu - Wrath of the Tiger */
27 static const char * const gpu_slow_llist_db[] =
30 "SCES02834", "SCUS94570", "SCUS94616", "SCUS94654",
31 /* Final Fantasy IV */
32 "SCES03840", "SLPM86028", "SLUS01360",
33 /* Spot Goes to Hollywood */
34 "SLES00330", "SLPS00394", "SLUS00014",
35 /* Vampire Hunter D */
36 "SLES02731", "SLPS02477", "SLPS03198", "SLUS01138",
39 static const char * const gpu_busy_hack_db[] =
42 "SLPS01919", "SLPS01920",
45 #define HACK_ENTRY(var, list) \
46 { #var, &Config.hacks.var, list, ARRAY_SIZE(list) }
52 const char * const * id_list;
57 HACK_ENTRY(cdr_read_timing, cdr_read_hack_db),
58 HACK_ENTRY(gpu_slow_list_walking, gpu_slow_llist_db),
59 HACK_ENTRY(gpu_busy_hack, gpu_busy_hack_db),
64 const char * const id;
67 cycle_multiplier_overrides[] =
69 /* note: values are = (10000 / gui_option) */
70 /* Internal Section - fussy about timings */
72 /* Super Robot Taisen Alpha - on the edge with 175,
73 * changing memcard settings is enough to break/unbreak it */
76 /* Brave Fencer Musashi - cd sectors arrive too fast */
79 #if defined(DRC_DISABLE) || defined(LIGHTREC) /* new_dynarec has a hack for this game */
80 /* Parasite Eve II - internal timer checks */
86 /* Discworld Noir - audio skips if CPU runs too fast */
90 /* Judge Dredd - could also be poor MDEC timing */
100 const char * const id;
103 lightrec_hacks_db[] =
105 /* Formula One Arcade */
106 { "SCES03886", LIGHTREC_HACK_INV_DMA_ONLY },
108 /* Formula One '99 */
109 { "SLUS00870", LIGHTREC_HACK_INV_DMA_ONLY },
110 { "SCPS10101", LIGHTREC_HACK_INV_DMA_ONLY },
111 { "SCES01979", LIGHTREC_HACK_INV_DMA_ONLY },
112 { "SLES01979", LIGHTREC_HACK_INV_DMA_ONLY },
114 /* Formula One 2000 */
115 { "SLUS01134", LIGHTREC_HACK_INV_DMA_ONLY },
116 { "SCES02777", LIGHTREC_HACK_INV_DMA_ONLY },
117 { "SCES02778", LIGHTREC_HACK_INV_DMA_ONLY },
118 { "SCES02779", LIGHTREC_HACK_INV_DMA_ONLY },
120 /* Formula One 2001 */
121 { "SCES03404", LIGHTREC_HACK_INV_DMA_ONLY },
122 { "SCES03423", LIGHTREC_HACK_INV_DMA_ONLY },
123 { "SCES03424", LIGHTREC_HACK_INV_DMA_ONLY },
124 { "SCES03524", LIGHTREC_HACK_INV_DMA_ONLY },
127 /* Function for automatic patching according to GameID. */
128 void Apply_Hacks_Cdrom()
132 memset(&Config.hacks, 0, sizeof(Config.hacks));
134 for (i = 0; i < ARRAY_SIZE(hack_db); i++)
136 for (j = 0; j < hack_db[i].id_list_len; j++)
138 if (strncmp(CdromId, hack_db[i].id_list[j], 9))
141 SysPrintf("using hack: %s\n", hack_db[i].name);
146 /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
147 for (i = 0; i < ARRAY_SIZE(MemorycardHack_db); i++)
149 if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
151 /* Disable the second memory card slot for the game */
153 /* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
159 /* Dynarec game-specific hacks */
160 new_dynarec_hacks_pergame = 0;
161 Config.cycle_multiplier_override = 0;
163 for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++)
165 if (strcmp(CdromId, cycle_multiplier_overrides[i].id) == 0)
167 Config.cycle_multiplier_override = cycle_multiplier_overrides[i].mult;
168 new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M;
169 SysPrintf("using cycle_multiplier_override: %d\n",
170 Config.cycle_multiplier_override);
177 for (i = 0; drc_is_lightrec() && i < ARRAY_SIZE(lightrec_hacks_db); i++) {
178 if (strcmp(CdromId, lightrec_hacks_db[i].id) == 0)
180 lightrec_hacks = lightrec_hacks_db[i].hacks;
181 SysPrintf("using lightrec_hacks: 0x%x\n", lightrec_hacks);