static unsigned int rom_crc32(int size)\r
{\r
unsigned int crc;\r
- elprintf(EL_STATUS, "caclulating CRC32..");\r
+ elprintf(EL_STATUS, "calculating CRC32..");\r
if (size <= 0 || size > Pico.romsize) size = Pico.romsize;\r
\r
// have to unbyteswap for calculation..\r
PicoIn.AHW = PAHW_PICO;\r
else if (strcmp(p, "prot") == 0)\r
carthw_sprot_startup();\r
+ else if (strcmp(p, "flash") == 0)\r
+ carthw_flash_startup();\r
else if (strcmp(p, "ssf2_mapper") == 0)\r
carthw_ssf2_startup();\r
else if (strcmp(p, "x_in_1_mapper") == 0)\r
# svp - Sega Virtua Processor
# pico - Sega Pico (not really cart hw, but convenient to support here)
# prot - simple copy protection devices in unlicensed cartridges (see prot. below)
+# flash - protection through reading the flash chip ID
#
# cartridge properties (prop = ...):
# no_sram - don't emulate sram/EEPROM even if ROM headers tell it's there
hw = sf004_mapper
sram_range = 0x200000,0x207fff
+# Escape 2042, reads flash ID for protection
+[Escape 2042]
+check_str = 0x120, "Escape 2042"
+hw = flash
+
# detect *_in_1 based on first game and if it's larger than it should be,
# as some dumps look like to be incomplete.
# This will also pick overdumps, but those should still work with the mapper applied.
prot_ro_value16 = 0x400004,-2,0xaa00
prot_ro_value16 = 0x400006,-2,0xf000
-[16 Tiles Mahjong 1+2 (Unl)] # Zhang majiang
+[16 Tiles Mahjong 1+2 (Unl)] # Shi liu zhang majiang
check_str = 0xfe, "WISEGAME IS TRADE MARKER"
hw = prot
prot_ro_value16 = 0x400002,-2,0xaa00
prot_ro_value16 = 0x400004,-2,0xc900
prot_ro_value16 = 0x400006,-2,0xf000
+[13 Tiles Mahjong] # Shi san zhang majiang
+check_str = 0x104, " "
+check_crc32 = 0x83397760
+hw = prot
+prot_ro_value16 = 0x400000,-2,0x6300
+prot_ro_value16 = 0x400002,-2,0x9800
+prot_ro_value16 = 0x400004,-2,0xaa00
+prot_ro_value16 = 0x400006,-2,0xf000
+
[Super Poker (Unl)] # Chaoji puke
check_csum = 0xffff
check_crc32 = 0xdd02797c
carthw_chunks = carthw_sf00x_state;
}
+/* Simple protection through reading flash ID */
+static int flash_writecount;
+
+static carthw_state_chunk carthw_flash_state[] =
+{
+ { CHUNK_CARTHW, sizeof(flash_writecount), &flash_writecount },
+ { 0, 0, NULL }
+};
+
+static u32 PicoRead16_flash(u32 a) { return (a&6) ? 0x2257 : 0x0020; }
+
+static void PicoWrite16_flash(u32 a, u32 d)
+{
+ int banksz = (1<<M68K_MEM_SHIFT)-1;
+ switch (++flash_writecount) {
+ case 3: cpu68k_map_set(m68k_read16_map, 0, banksz, PicoRead16_flash, 1);
+ break;
+ case 4: cpu68k_map_read_mem(0, banksz, Pico.rom, 0);
+ flash_writecount = 0;
+ break;
+ }
+}
+
+static void carthw_flash_mem_setup(void)
+{
+ cpu68k_map_set(m68k_write16_map, 0, 0x7fffff, PicoWrite16_flash, 1);
+}
+
+void carthw_flash_startup(void)
+{
+ elprintf(EL_STATUS, "Flash prot emu startup");
+
+ PicoCartMemSetup = carthw_flash_mem_setup;
+ carthw_chunks = carthw_flash_state;
+}
+
/* Simple unlicensed ROM protection emulation */
static struct {
u32 addr;
void carthw_sf002_startup(void);
void carthw_sf004_startup(void);
+void carthw_flash_startup(void);
void carthw_sprot_startup(void);
void carthw_sprot_new_location(unsigned int a,
unsigned int mask, unsigned short val, int is_ro);
"hw=sf004_mapper\n"
"sram_range=0x200000,0x207fff\n"
"[]\n"
+ "check_str=0x120,\"Escape 2042\"\n"
+ "hw=flash\n"
+ "[]\n"
"check_str=0x120,\"FLICKY\"\n"
"check_size_gt=0x020000\n"
"hw=x_in_1_mapper\n"
"hw=radica_mapper\n"
"[]\n"
"check_str=0x150,\"STREET FIGHTER\"\n"
- "check_str=0x161,\"SPECIAL CHAMPION EDITION\"\n"
"check_size_gt=0x300000\n"
"hw=radica_mapper\n"
"[]\n"
"prot_ro_value16=0x400004,-2,0xc900\n"
"prot_ro_value16=0x400006,-2,0xf000\n"
"[]\n"
+ "check_str=0x104,\" \"\n"
+ "check_crc32=0x83397760\n"
+ "hw=prot\n"
+ "prot_ro_value16=0x400000,-2,0x6300\n"
+ "prot_ro_value16=0x400002,-2,0x9800\n"
+ "prot_ro_value16=0x400004,-2,0xaa00\n"
+ "prot_ro_value16=0x400006,-2,0xf000\n"
+ "[]\n"
"check_csum=0xffff\n"
"check_crc32=0xdd02797c\n"
"hw=prot\n"