From a76fad41291b7be0b42554353d6775dcdff065e0 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 20 Aug 2013 00:54:03 +0300 Subject: [PATCH] 32x: add 6btn quirk --- pico/cart.c | 5 +++++ pico/carthw.cfg | 13 +++++++++---- pico/carthw_cfg.c | 10 ++++++---- pico/media.c | 4 ++++ pico/pico.c | 1 + pico/pico.h | 4 ++++ platform/common/emu.c | 4 ++++ 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pico/cart.c b/pico/cart.c index db742a8..6a835b6 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -643,6 +643,8 @@ static int rom_strcmp(int rom_offset, const char *s1) { int i, len = strlen(s1); const char *s_rom = (const char *)Pico.rom; + if (rom_offset + len > Pico.romsize) + return 0; for (i = 0; i < len; i++) if (s1[i] != s_rom[(i + rom_offset) ^ 1]) return 1; @@ -897,10 +899,13 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram) SRam.flags &= ~SRF_EEPROM; else if (strcmp(p, "filled_sram") == 0) *fill_sram = 1; + else if (strcmp(p, "force_6btn") == 0) + PicoQuirks |= PQUIRK_FORCE_6BTN; else { elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p); goto bad_nomsg; } + elprintf(EL_STATUS, "game prop: %s", p); continue; } else if (is_expr("eeprom_type", &p)) { diff --git a/pico/carthw.cfg b/pico/carthw.cfg index ac918bf..d61161c 100644 --- a/pico/carthw.cfg +++ b/pico/carthw.cfg @@ -8,6 +8,7 @@ # 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) # # mappers (hw = ...): # ssf2_mapper - used in Super Street Fighter2 @@ -60,6 +61,12 @@ prop = filled_sram check_str = 0x150, "MICRO MACHINES II" prop = filled_sram +# X-Men proto +[X-Men (prototype)] +check_str = 0x150, "32X SAMPLE PROGRAM" +check_str = 0x32b74c, "Bishop Level" +prop = force_6btn + # The SSF2 mapper [Super Street Fighter II - The New Challengers (U)] check_str = 0x150, "SUPER STREET FIGHTER2 The New Challengers" @@ -68,11 +75,9 @@ prop = no_sram # The Pier Solar mapper, custom eeprom location [Pier Solar and the Great Architects] -check_str = 0x150, "PIER SOLAR™&THE GREAT ARCHITECTS© WaterMelon™" +check_str = 0x150, "PIER" +check_str = 0x610, "Respect" hw = piersolar_mapper -sram_range = 0xa13009,0xa1300b -eeprom_type = 3 -eeprom_lines = 2,1,0 # detect *_in_1 based on first game and if it's larger than it should be, # as some dumps look like to be incomplete. diff --git a/pico/carthw_cfg.c b/pico/carthw_cfg.c index 14aec3e..0974fa0 100644 --- a/pico/carthw_cfg.c +++ b/pico/carthw_cfg.c @@ -22,15 +22,17 @@ static const char builtin_carthw_cfg[] = "check_str=0x150,\"MICRO MACHINES II\"\n" "prop=filled_sram\n" "[]\n" + "check_str=0x150,\"32X SAMPLE PROGRAM\"\n" + "check_str=0x32b74c,\"Bishop Level\"\n" + "prop=force_6btn\n" + "[]\n" "check_str=0x150,\"SUPER STREET FIGHTER2 The New Challengers\"\n" "hw=ssf2_mapper\n" "prop=no_sram\n" "[]\n" - "check_str=0x150,\"PIER SOLAR\x99&THE GREAT ARCHITECTS\xa9 WaterMelon\x99\"\n" + "check_str=0x150,\"PIER\"\n" + "check_str=0x610,\"Respect\"\n" "hw=piersolar_mapper\n" - "sram_range=0xa13009,0xa1300b\n" - "eeprom_type=3\n" - "eeprom_lines=2,1,0\n" "[]\n" "check_str=0x120,\"FLICKY\"\n" "check_size_gt=0x020000\n" diff --git a/pico/media.c b/pico/media.c index ade8ded..c03846d 100644 --- a/pico/media.c +++ b/pico/media.c @@ -212,6 +212,7 @@ enum media_type_e PicoLoadMedia(const char *filename, Stop_CD(); PicoCartUnload(); PicoAHW = 0; + PicoQuirks = 0; if (media_type == PM_CD) { @@ -296,6 +297,9 @@ enum media_type_e PicoLoadMedia(const char *filename, } } + if (PicoQuirks & PQUIRK_FORCE_6BTN) + PicoSetInputDevice(0, PICO_INPUT_PAD_6BTN); + out: if (rom_data) free(rom_data); diff --git a/pico/pico.c b/pico/pico.c index 859935e..bbc514f 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -16,6 +16,7 @@ int PicoSkipFrame; // skip rendering frame? int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU int PicoPadInt[2]; // internal copy int PicoAHW; // active addon hardware: PAHW_* +int PicoQuirks; // game-specific quirks int PicoRegionOverride; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe int PicoAutoRgnOrder; diff --git a/pico/pico.h b/pico/pico.h index c0aa6da..e1bcf03 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -77,6 +77,10 @@ extern int PicoOpt; // bitfield #define PAHW_PICO (1<<3) #define PAHW_SMS (1<<4) extern int PicoAHW; // Pico active hw + +#define PQUIRK_FORCE_6BTN (1<<0) +extern int PicoQuirks; + extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP diff --git a/platform/common/emu.c b/platform/common/emu.c index 5807c1b..c2f4109 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -444,6 +444,10 @@ int emu_reload_rom(const char *rom_fname_in) break; } + // make quirks visible in UI + if (PicoQuirks & PQUIRK_FORCE_6BTN) + currentConfig.input_dev0 = PICO_INPUT_PAD_6BTN; + menu_romload_end(); menu_romload_started = 0; -- 2.39.2