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 #define HACK_ENTRY(var, list) \
40 { #var, &Config.hacks.var, list, ARRAY_SIZE(list) }
46 const char * const * id_list;
51 HACK_ENTRY(cdr_read_timing, cdr_read_hack_db),
52 HACK_ENTRY(gpu_slow_list_walking, gpu_slow_llist_db),
57 const char * const id;
60 cycle_multiplier_overrides[] =
62 /* note: values are = (10000 / gui_option) */
63 /* Internal Section - fussy about timings */
65 /* Super Robot Taisen Alpha - on the edge with 175,
66 * changing memcard settings is enough to break/unbreak it */
69 /* Brave Fencer Musashi - cd sectors arrive too fast */
72 #if defined(DRC_DISABLE) || defined(LIGHTREC) /* new_dynarec has a hack for this game */
73 /* Parasite Eve II - internal timer checks */
79 /* Discworld Noir - audio skips if CPU runs too fast */
83 /* Judge Dredd - could also be poor MDEC timing */
93 const char * const id;
98 /* Formula One Arcade */
99 { "SCES03886", LIGHTREC_HACK_INV_DMA_ONLY },
101 /* Formula One '99 */
102 { "SLUS00870", LIGHTREC_HACK_INV_DMA_ONLY },
103 { "SCPS10101", LIGHTREC_HACK_INV_DMA_ONLY },
104 { "SCES01979", LIGHTREC_HACK_INV_DMA_ONLY },
105 { "SLES01979", LIGHTREC_HACK_INV_DMA_ONLY },
107 /* Formula One 2000 */
108 { "SLUS01134", LIGHTREC_HACK_INV_DMA_ONLY },
109 { "SCES02777", LIGHTREC_HACK_INV_DMA_ONLY },
110 { "SCES02778", LIGHTREC_HACK_INV_DMA_ONLY },
111 { "SCES02779", LIGHTREC_HACK_INV_DMA_ONLY },
113 /* Formula One 2001 */
114 { "SCES03404", LIGHTREC_HACK_INV_DMA_ONLY },
115 { "SCES03423", LIGHTREC_HACK_INV_DMA_ONLY },
116 { "SCES03424", LIGHTREC_HACK_INV_DMA_ONLY },
117 { "SCES03524", LIGHTREC_HACK_INV_DMA_ONLY },
120 /* Function for automatic patching according to GameID. */
121 void Apply_Hacks_Cdrom()
125 memset(&Config.hacks, 0, sizeof(Config.hacks));
127 for (i = 0; i < ARRAY_SIZE(hack_db); i++)
129 for (j = 0; j < hack_db[i].id_list_len; j++)
131 if (strncmp(CdromId, hack_db[i].id_list[j], 9))
134 SysPrintf("using hack: %s\n", hack_db[i].name);
139 /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */
140 for (i = 0; i < ARRAY_SIZE(MemorycardHack_db); i++)
142 if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0)
144 /* Disable the second memory card slot for the game */
146 /* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */
152 /* Dynarec game-specific hacks */
153 new_dynarec_hacks_pergame = 0;
154 Config.cycle_multiplier_override = 0;
156 for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++)
158 if (strcmp(CdromId, cycle_multiplier_overrides[i].id) == 0)
160 Config.cycle_multiplier_override = cycle_multiplier_overrides[i].mult;
161 new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M;
162 SysPrintf("using cycle_multiplier_override: %d\n",
163 Config.cycle_multiplier_override);
170 for (i = 0; drc_is_lightrec() && i < ARRAY_SIZE(lightrec_hacks_db); i++) {
171 if (strcmp(CdromId, lightrec_hacks_db[i].id) == 0)
173 lightrec_hacks = lightrec_hacks_db[i].hacks;
174 SysPrintf("using lightrec_hacks: 0x%x\n", lightrec_hacks);