From 7cbd42bc54a6cb410e0ab599cbae3a456fad19c6 Mon Sep 17 00:00:00 2001 From: kub Date: Sat, 15 Jun 2024 09:28:04 +0000 Subject: [PATCH] md, minor cleanup for region code handling --- pico/cart.c | 4 ---- pico/pico.c | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pico/cart.c b/pico/cart.c index 339b9fe7..13218031 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -1341,10 +1341,6 @@ static void PicoCartDetect(const char *carthw_cfg) memset(Pico.sv.data, 0xff, Pico.sv.size); } - // Unusual region 'code' - if (rom_strcmp(0x1f0, "EUROPE") == 0 || rom_strcmp(0x1f0, "Europe") == 0) - *(u32 *) (Pico.rom + 0x1f0) = CPU_LE4(0x20204520); - // tweak for Blackthorne: master SH2 overwrites stack of slave SH2 being in PWM // interrupt. On real hardware, nothing happens since slave fetches the values // it has written from its cache, but picodrive doesn't emulate caching. diff --git a/pico/pico.c b/pico/pico.c index 0e7e1d8f..b84fda6e 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -97,15 +97,21 @@ PICO_INTERNAL void PicoDetectRegion(void) { int support=0, hw=0, i; unsigned char pal=0; + char *pr = (char *)(Pico.rom + 0x1f0); if (PicoIn.regionOverride) { support = PicoIn.regionOverride; } + else if (strcmp(pr, "EUROPE") == 0 || strcmp(pr, "Europe") == 0) + { + // Unusual cartridge region 'code' + support|=8; + } else { // Read cartridge region data: - unsigned short *rd = (unsigned short *)(Pico.rom + 0x1f0); + unsigned short *rd = (unsigned short *)pr; int region = (rd[0] << 16) | rd[1]; for (i = 0; i < 4; i++) -- 2.39.5