Add hack for unlicensed games that don't handle the Z80 bus properly

This commit is contained in:
techmetx11 2023-08-21 16:21:25 +01:00
parent bccd8832dd
commit a67db32a4a
No known key found for this signature in database
GPG key ID: 20E0C88A0E7E5AF2
5 changed files with 39 additions and 6 deletions

View file

@ -1210,6 +1210,8 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
PicoIn.quirks |= PQUIRK_MARSCHECK_HACK; PicoIn.quirks |= PQUIRK_MARSCHECK_HACK;
else if (strcmp(p, "force_6btn") == 0) else if (strcmp(p, "force_6btn") == 0)
PicoIn.quirks |= PQUIRK_FORCE_6BTN; PicoIn.quirks |= PQUIRK_FORCE_6BTN;
else if (strcmp(p, "no_z80_bus_lock") == 0)
PicoIn.quirks |= PQUIRK_NO_Z80_BUS_LOCK;
else { else {
elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p); elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p);
goto bad_nomsg; goto bad_nomsg;

View file

@ -4,10 +4,11 @@
# prot - simple copy protection devices in unlicensed cartridges (see prot. below) # prot - simple copy protection devices in unlicensed cartridges (see prot. below)
# #
# cartridge properties (prop = ...): # cartridge properties (prop = ...):
# no_sram - don't emulate sram/EEPROM even if ROM headers tell it's there # 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 # 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 # 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) # 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 = ...): # mappers (hw = ...):
# ssf2_mapper - used in Super Street Fighter2 # ssf2_mapper - used in Super Street Fighter2
@ -526,3 +527,20 @@ check_crc32 = 0xee9fc429
hw = prot hw = prot
prot_ro_value16 = 0x400000,-2,0x6300 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

View file

@ -387,4 +387,16 @@ static const char builtin_carthw_cfg[] =
"check_crc32=0xee9fc429\n" "check_crc32=0xee9fc429\n"
"hw=prot\n" "hw=prot\n"
"prot_ro_value16=0x400000,-2,0x6300\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"
; ;

View file

@ -675,7 +675,7 @@ static void PicoWrite16_sram(u32 a, u32 d)
static u32 PicoRead8_z80(u32 a) static u32 PicoRead8_z80(u32 a)
{ {
u32 d = 0xff; 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); elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc);
// open bus. Pulled down if MegaCD2 is attached. // open bus. Pulled down if MegaCD2 is attached.
return 0; return 0;
@ -699,7 +699,7 @@ static u32 PicoRead16_z80(u32 a)
static void PicoWrite8_z80(u32 a, u32 d) 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 // verified on real hw
elprintf(EL_ANOMALY, "68k z80 write with no bus or reset! [%06x] %02x @ %06x", a, d&0xff, SekPc); elprintf(EL_ANOMALY, "68k z80 write with no bus or reset! [%06x] %02x @ %06x", a, d&0xff, SekPc);
return; return;

View file

@ -99,6 +99,7 @@ extern void *p32x_bios_g, *p32x_bios_m, *p32x_bios_s;
#define PQUIRK_BLACKTHORNE_HACK (1<<1) #define PQUIRK_BLACKTHORNE_HACK (1<<1)
#define PQUIRK_WWFRAW_HACK (1<<2) #define PQUIRK_WWFRAW_HACK (1<<2)
#define PQUIRK_MARSCHECK_HACK (1<<3) #define PQUIRK_MARSCHECK_HACK (1<<3)
#define PQUIRK_NO_Z80_BUS_LOCK (1<<4)
// the emulator is configured and some status is reported // the emulator is configured and some status is reported
// through this global state (not saved in savestates) // through this global state (not saved in savestates)