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[] =
29 /* Bomberman Fantasy Race */
30 "SLES01712", "SLPS01525", "SLPS91138", "SLPM87102", "SLUS00823",
32 "SCES02834", "SCUS94570", "SCUS94616", "SCUS94654",
33 /* Final Fantasy IV */
34 "SCES03840", "SLPM86028", "SLUS01360",
35 /* Spot Goes to Hollywood */
36 "SLES00330", "SLPS00394", "SLUS00014",
37 /* Vampire Hunter D */
38 "SLES02731", "SLPS02477", "SLPS03198", "SLUS01138",
41 static const char * const gpu_busy_hack_db[] =
44 "SLPS01919", "SLPS01920",
47 #define HACK_ENTRY(var, list) \
48 { #var, &Config.hacks.var, list, ARRAY_SIZE(list) }
54 const char * const * id_list;
59 HACK_ENTRY(cdr_read_timing, cdr_read_hack_db),
60 HACK_ENTRY(gpu_slow_list_walking, gpu_slow_llist_db),
61 HACK_ENTRY(gpu_busy_hack, gpu_busy_hack_db),
66 const char * const id;
69 cycle_multiplier_overrides[] =
71 /* note: values are = (10000 / gui_option) */
72 /* Internal Section - fussy about timings */
74 /* Super Robot Taisen Alpha - on the edge with 175,
75 * changing memcard settings is enough to break/unbreak it */
78 /* Brave Fencer Musashi - cd sectors arrive too fast */
81 #if defined(DRC_DISABLE) || defined(LIGHTREC) /* new_dynarec has a hack for this game */
82 /* Parasite Eve II - internal timer checks */
88 /* Discworld Noir - audio skips if CPU runs too fast */
92 /* Judge Dredd - could also be poor MDEC timing */
102 const char * const id;
105 lightrec_hacks_db[] =
107 /* Formula One Arcade */
108 { "SCES03886", LIGHTREC_HACK_INV_DMA_ONLY },
110 /* Formula One '99 */
111 { "SLUS00870", LIGHTREC_HACK_INV_DMA_ONLY },
112 { "SCPS10101", LIGHTREC_HACK_INV_DMA_ONLY },
113 { "SCES01979", LIGHTREC_HACK_INV_DMA_ONLY },
114 { "SLES01979", LIGHTREC_HACK_INV_DMA_ONLY },
116 /* Formula One 2000 */
117 { "SLUS01134", LIGHTREC_HACK_INV_DMA_ONLY },
118 { "SCES02777", LIGHTREC_HACK_INV_DMA_ONLY },
119 { "SCES02778", LIGHTREC_HACK_INV_DMA_ONLY },
120 { "SCES02779", LIGHTREC_HACK_INV_DMA_ONLY },
122 /* Formula One 2001 */
123 { "SCES03404", LIGHTREC_HACK_INV_DMA_ONLY },
124 { "SCES03423", LIGHTREC_HACK_INV_DMA_ONLY },
125 { "SCES03424", LIGHTREC_HACK_INV_DMA_ONLY },
126 { "SCES03524", LIGHTREC_HACK_INV_DMA_ONLY },
129 /* Function for automatic patching according to GameID. */
130 void Apply_Hacks_Cdrom()
134 memset(&Config.hacks, 0, sizeof(Config.hacks));
136 for (i = 0; i < ARRAY_SIZE(hack_db); i++)
138 for (j = 0; j < hack_db[i].id_list_len; j++)
140 if (strncmp(CdromId, hack_db[i].id_list[j], 9))
143 SysPrintf("using hack: %s\n", hack_db[i].name);
148 /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
149 for (i = 0; i < ARRAY_SIZE(MemorycardHack_db); i++)
151 if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
153 /* Disable the second memory card slot for the game */
155 /* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
161 /* Dynarec game-specific hacks */
162 new_dynarec_hacks_pergame = 0;
163 Config.cycle_multiplier_override = 0;
165 for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++)
167 if (strcmp(CdromId, cycle_multiplier_overrides[i].id) == 0)
169 Config.cycle_multiplier_override = cycle_multiplier_overrides[i].mult;
170 new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M;
171 SysPrintf("using cycle_multiplier_override: %d\n",
172 Config.cycle_multiplier_override);
179 for (i = 0; drc_is_lightrec() && i < ARRAY_SIZE(lightrec_hacks_db); i++) {
180 if (strcmp(CdromId, lightrec_hacks_db[i].id) == 0)
182 lightrec_hacks = lightrec_hacks_db[i].hacks;
183 SysPrintf("using lightrec_hacks: 0x%x\n", lightrec_hacks);