Browse Source

32x: add 6btn quirk

notaz 10 years ago
parent
commit
a76fad4129
7 changed files with 33 additions and 8 deletions
  1. 5 0
      pico/cart.c
  2. 9 4
      pico/carthw.cfg
  3. 6 4
      pico/carthw_cfg.c
  4. 4 0
      pico/media.c
  5. 1 0
      pico/pico.c
  6. 4 0
      pico/pico.h
  7. 4 0
      platform/common/emu.c

+ 5 - 0
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)) {

+ 9 - 4
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.

+ 6 - 4
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"

+ 4 - 0
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);

+ 1 - 0
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;
 

+ 4 - 0
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

+ 4 - 0
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;