From: techmetx11 Date: Mon, 21 Aug 2023 15:21:25 +0000 (+0100) Subject: Add hack for unlicensed games that don't handle the Z80 bus properly X-Git-Tag: v2.00~172^2 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67db32a4ac32fba0c081ca43fdd309674f3eca5;p=picodrive.git Add hack for unlicensed games that don't handle the Z80 bus properly --- diff --git a/pico/cart.c b/pico/cart.c index e8293abc..339b9fe7 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -1210,6 +1210,8 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram, PicoIn.quirks |= PQUIRK_MARSCHECK_HACK; else if (strcmp(p, "force_6btn") == 0) PicoIn.quirks |= PQUIRK_FORCE_6BTN; + else if (strcmp(p, "no_z80_bus_lock") == 0) + PicoIn.quirks |= PQUIRK_NO_Z80_BUS_LOCK; else { elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p); goto bad_nomsg; diff --git a/pico/carthw.cfg b/pico/carthw.cfg index 64e9152c..013b04cf 100644 --- a/pico/carthw.cfg +++ b/pico/carthw.cfg @@ -4,10 +4,11 @@ # prot - simple copy protection devices in unlicensed cartridges (see prot. below) # # cartridge properties (prop = ...): -# no_sram - don't emulate sram/EEPROM even if ROM headers tell it's there -# no_eeprom - save storage is not EEPROM, even if ROM headers tell it is -# filled_sram - save storage needs to be initialized with FFh instead of 00h -# force_6btn - game only supports 6 button pad (32X X-men proto) +# no_sram - don't emulate sram/EEPROM even if ROM headers tell it's there +# no_eeprom - save storage is not EEPROM, even if ROM headers tell it is +# filled_sram - save storage needs to be initialized with FFh instead of 00h +# force_6btn - game only supports 6 button pad (32X X-men proto) +# no_z80_bus_lock - don't emulate z80 bus getting closed to the 68k when bus is released # # mappers (hw = ...): # ssf2_mapper - used in Super Street Fighter2 @@ -526,3 +527,20 @@ check_crc32 = 0xee9fc429 hw = prot prot_ro_value16 = 0x400000,-2,0x6300 +# Unlicensed homebrew games made by V.M.V. +# to prevent bus conflicts between the audio drivers in 68k and Z80 + +[Ben 10 (Unl)] +check_str = 0x180, "GM 00000000-00" +check_crc32 = 0x6732aab4 +prop = no_z80_bus_lock + +[Mario 3: Vokrug Sveta (Unl)] +check_str = 0x180, "GM 00000000-00" +check_crc32 = 0xe302585a +prop = no_z80_bus_lock + +[Mario 4: Kosmicheskaya Odisseya (Unl)] +check_csum = 8224 +check_crc32 = 0x20ed0de8 +prop = no_z80_bus_lock diff --git a/pico/carthw_cfg.c b/pico/carthw_cfg.c index 02f8c111..97e7ddae 100644 --- a/pico/carthw_cfg.c +++ b/pico/carthw_cfg.c @@ -387,4 +387,16 @@ static const char builtin_carthw_cfg[] = "check_crc32=0xee9fc429\n" "hw=prot\n" "prot_ro_value16=0x400000,-2,0x6300\n" + "[]\n" + "check_str=0x180,\"GM 00000000-00\"\n" + "check_crc32=0x6732aab4\n" + "prop=no_z80_bus_lock\n" + "[]\n" + "check_str=0x180,\"GM 00000000-00\"\n" + "check_crc32=0xe302585a\n" + "prop=no_z80_bus_lock\n" + "[]\n" + "check_csum=8224\n" + "check_crc32=0x20ed0de8\n" + "prop=no_z80_bus_lock\n" ; diff --git a/pico/memory.c b/pico/memory.c index 818080fd..6ee6282b 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -675,7 +675,7 @@ static void PicoWrite16_sram(u32 a, u32 d) static u32 PicoRead8_z80(u32 a) { u32 d = 0xff; - if ((Pico.m.z80Run & 1) || Pico.m.z80_reset) { + if (!(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK) && ((Pico.m.z80Run & 1) || Pico.m.z80_reset)) { elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc); // open bus. Pulled down if MegaCD2 is attached. return 0; @@ -699,7 +699,7 @@ static u32 PicoRead16_z80(u32 a) static void PicoWrite8_z80(u32 a, u32 d) { - if ((Pico.m.z80Run & 1) || Pico.m.z80_reset) { + if (!(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK) && ((Pico.m.z80Run & 1) || Pico.m.z80_reset)) { // verified on real hw elprintf(EL_ANOMALY, "68k z80 write with no bus or reset! [%06x] %02x @ %06x", a, d&0xff, SekPc); return; diff --git a/pico/pico.h b/pico/pico.h index 2ef46928..f17d93de 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -99,6 +99,7 @@ extern void *p32x_bios_g, *p32x_bios_m, *p32x_bios_s; #define PQUIRK_BLACKTHORNE_HACK (1<<1) #define PQUIRK_WWFRAW_HACK (1<<2) #define PQUIRK_MARSCHECK_HACK (1<<3) +#define PQUIRK_NO_Z80_BUS_LOCK (1<<4) // the emulator is configured and some status is reported // through this global state (not saved in savestates)