| 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 | new_dynarec_clock_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 | }; |
| 34 | |
| 35 | /* Function for automatic patching according to GameID. */ |
| 36 | void Apply_Hacks_Cdrom() |
| 37 | { |
| 38 | uint32_t i; |
| 39 | |
| 40 | /* Apply Memory card hack for Codename Tenka. (The game needs one of the memory card slots to be empty) */ |
| 41 | for(i=0;i<ARRAY_SIZE(MemorycardHack_db);i++) |
| 42 | { |
| 43 | if (strncmp(CdromId, MemorycardHack_db[i], 9) == 0) |
| 44 | { |
| 45 | /* Disable the second memory card slot for the game */ |
| 46 | Config.Mcd2[0] = 0; |
| 47 | /* This also needs to be done because in sio.c, they don't use Config.Mcd2 for that purpose */ |
| 48 | McdDisable[1] = 1; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /* Dynarec game-specific hacks */ |
| 53 | new_dynarec_hacks_pergame = 0; |
| 54 | cycle_multiplier_override = 0; |
| 55 | |
| 56 | for (i = 0; i < ARRAY_SIZE(new_dynarec_clock_overrides); i++) |
| 57 | { |
| 58 | if (strcmp(CdromId, new_dynarec_clock_overrides[i].id) == 0) |
| 59 | { |
| 60 | cycle_multiplier_override = new_dynarec_clock_overrides[i].mult; |
| 61 | new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M; |
| 62 | SysPrintf("using new_dynarec clock override: %d\n", |
| 63 | cycle_multiplier_override); |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | } |