From de65bd4229ca7dae1ccfab4b266165514bb37a3b Mon Sep 17 00:00:00 2001 From: Roberto Fresca Date: Wed, 7 May 2014 18:43:01 +0000 Subject: [PATCH] rcdino4 improvements... - Improved decryption, game boots now. [Peter Ferrie] - Created a dedicated machine driver. [Roberto Fresca] - Adjusted the tilemap size accordingly. [Roberto Fresca] - Added the proper color banking. [Roberto Fresca] - Hooked DIP switches and proper inputs. [Roberto Fresca] --- src/mame/drivers/funworld.c | 361 +++++++++++++++++++++++------------- 1 file changed, 237 insertions(+), 124 deletions(-) diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index 3e0dfa3ed39..3d98cf2085e 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -2677,6 +2677,62 @@ static INPUT_PORTS_START( chinatow ) PORT_DIPSETTING( 0x90, "1 coin 10 credits" ) INPUT_PORTS_END +static INPUT_PORTS_START( rcdino4 ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no remote credits */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Stop 1") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) PORT_NAME("Clear / Bet") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Stop 5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Stop 4") + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Stop 2") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Stop 3") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Ticket") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x01, "Test Mode" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "Royal Flush" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPNAME( 0x04, 0x04, "5 of a Kind" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:5,4") + PORT_DIPSETTING( 0x08, "1C-10C" ) + PORT_DIPSETTING( 0x10, "1C-1C" ) + PORT_DIPSETTING( 0x18, "1C-2C" ) + PORT_DIPSETTING( 0x00, "1C-5C" ) + PORT_DIPNAME( 0x60, 0x60, "Payment Type" ) PORT_DIPLOCATION("SW1:3,2") + PORT_DIPSETTING( 0x00, "Ticket + Hopper" ) + PORT_DIPSETTING( 0x20, "Ticket" ) + PORT_DIPSETTING( 0x40, "Hopper" ) + PORT_DIPSETTING( 0x60, "Ticket + Hopper" ) + PORT_DIPNAME( 0x80, 0x80, "Pagamenti (Payment)" ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x80, "Pagamenti (Payment) A" ) + PORT_DIPSETTING( 0x00, "Pagamenti (Payment) B" ) +INPUT_PORTS_END + static INPUT_PORTS_START( royal ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no remote credits */ @@ -2989,14 +3045,6 @@ static MACHINE_CONFIG_DERIVED( witchryl, fw1stpal ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( chinatow, fw2ndpal ) - MCFG_CPU_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */ - MCFG_CPU_PROGRAM_MAP(chinatow_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", funworld_state, nmi_line_pulse) - MCFG_VIDEO_START_OVERRIDE(funworld_state, chinatow) -MACHINE_CONFIG_END - - static MACHINE_CONFIG_DERIVED( lunapark, fw1stpal ) MCFG_CPU_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */ MCFG_CPU_PROGRAM_MAP(lunapark_map) // mirrored video RAM (4000/5000 to 6000/7000). @@ -3006,6 +3054,22 @@ static MACHINE_CONFIG_DERIVED( lunapark, fw1stpal ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( chinatow, fw2ndpal ) + MCFG_CPU_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */ + MCFG_CPU_PROGRAM_MAP(chinatow_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", funworld_state, nmi_line_pulse) + MCFG_VIDEO_START_OVERRIDE(funworld_state, chinatow) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( rcdino4, fw1stpal ) + MCFG_CPU_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */ + MCFG_CPU_PROGRAM_MAP(chinatow_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", funworld_state, nmi_line_pulse) + MCFG_VIDEO_START_OVERRIDE(funworld_state, chinatow) +MACHINE_CONFIG_END + + + /************************* * Rom Load * *************************/ @@ -6138,6 +6202,89 @@ static void decrypt_rcdino4(UINT8 *rom, int size, UINT8 *gfxrom, int sizeg, UINT } + + +static UINT8 rcdino4_add[] = +{ +/* 0 1 2 3 4 5 6 7 8 9 a b c d e f*/ +/*0*/ 1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 9, 3, 9, 9, +/*1*/ 2, 2, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 9, 9, 9, +/*2*/ 3, 9, 9, 9, 9, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 9, +/*3*/ 2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9, +/*4*/ 1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 3, 3, 9, 9, +/*5*/ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9, +/*6*/ 1, 9, 9, 9, 2, 2, 9, 9, 1, 2, 1, 9, 3, 3, 3, 9, +/*7*/ 9, 2, 9, 9, 9, 9, 9, 9, 9, 3, 1, 9, 9, 3, 9, 9, +/*8*/ 2, 9, 9, 9, 2, 2, 2, 9, 1, 9, 1, 9, 9, 3, 3, 9, +/*9*/ 2, 2, 9, 9, 9, 2, 9, 9, 1, 3, 9, 9, 3, 3, 3, 9, +/*a*/ 2, 9, 2, 9, 2, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 2, +/*b*/ 2, 2, 9, 9, 9, 2, 9, 9, 9, 3, 9, 9, 9, 3, 9, 9, +/*c*/ 2, 9, 9, 9, 2, 2, 2, 9, 1, 2, 1, 9, 3, 3, 3, 9, +/*d*/ 2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9, +/*e*/ 2, 9, 9, 9, 2, 9, 2, 9, 1, 2, 1, 9, 3, 9, 3, 9, +/*f*/ 2, 9, 9, 9, 9, 2, 9, 9, 1, 3, 1, 9, 9, 3, 9, 9 +}; + +static UINT8 rcdino4_keys40[] = +{ +/* 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d*/ + 0x36, 0x54, 0x47, 0x6b, 0xce, 0x95, 0xa2, 0x66, 0x3a, 0x46, 0x53, 0xd7, 0xc4, 0xa4, +/* 4e 4f*/ + 0x00, 0x00, +/* 50*/ + 0x56 +}; + +static UINT8 rcdino4_keys80[] = +{ +/* 81 82 83 84 85 */ + 0xb8, 0x32, 0x1c, 0x23, 0xe2, +/* 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* 92 93 94 95 96 97 */ + 0x4c, 0x00, 0x3d, 0x00, 0xd9, 0x16, +/* 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* a4 a5 a6*/ + 0x5e, 0x73, 0x69, +/* a7 a8 a9*/ + 0x00, 0x00, 0x00, +/* aa*/ + 0xa6, +/* ab ac ad ae af*/ + 0x00, 0x00, 0x00, 0x00, 0x00, +/* b0 b1*/ + 0xc3, 0x40, +/* b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* c3 c4 c5*/ + 0x92, 0xb7, 0x24, +/* c6 c7 c8 c9*/ + 0x00, 0x00, 0x00, 0x00, +/* ca*/ + 0x62, +/* cb cc cd ce cf*/ + 0x00, 0x00, 0x00, 0x00, 0x00, +/* d0*/ + 0x84, +/* d1 d2 d3 d4 d5*/ + 0x00, 0x00, 0x00, 0x00, 0x00, +/* d6*/ + 0xea, +/* d7 d8 d9 da db dc dd de df*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* e0*/ + 0x17, +/* e1 e2 e3*/ + 0x00, 0x00, 0x00, +/* e4*/ + 0xc0, +/* e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* f8 f9 fa fb fc fd fe*/ + 0x06, 0x1e, 0x28, 0x5a, 0xcf, 0x79, 0x11 +}; + DRIVER_INIT_MEMBER(funworld_state, rcdino4) /***************************************************** @@ -6157,135 +6304,101 @@ DRIVER_INIT_MEMBER(funworld_state, rcdino4) j = 0; - for (i = 0x8101; i < 0x8173;) + for (i = 0x40; i < (0x40 + _countof(rcdino4_keys40));) { - rom[i] ^= 0xb8; + UINT8 key; - switch (j) + key = rcdino4_keys40[i - 0x40]; + + do { - case 0: - case 2: - case 4: - case 5: - { - i += 2; - break; - } + UINT8 c; + int add; - case 1: - case 3: - case 6: - { - i += 3; - break; - } + c = rom[(i << 8) + j] ^ key; + add = rcdino4_add[c]; - default: /* case 7 */ + if (add == 9) { - i += 2; - j = 0; + ++j; + } + else + { + rom[(i << 8) + j] = c; + j += add; } } - ++j; + while (j < 0x100); + + j &= 0xff; + ++i; } - /* I could not find any obvious pattern to these */ + j = 1; - rom[0x8174] ^= 0xb8; - rom[0x8176] ^= 0xb8; - rom[0x8177] ^= 0xb8; - rom[0x8179] ^= 0xb8; - rom[0x817b] ^= 0xb8; - rom[0x817d] ^= 0xb8; - rom[0x8180] ^= 0xb8; - rom[0x8183] ^= 0xb8; - rom[0x8185] ^= 0xb8; - rom[0x8187] ^= 0xb8; - rom[0x818a] ^= 0xb8; - rom[0x818c] ^= 0xb8; - rom[0x818f] ^= 0xb8; - rom[0x8192] ^= 0xb8; - rom[0x8195] ^= 0xb8; - rom[0x8198] ^= 0xb8; - rom[0x819b] ^= 0xb8; - rom[0x819d] ^= 0xb8; - rom[0x81a0] ^= 0xb8; - rom[0x81b2] ^= 0xb8; - rom[0x81b3] ^= 0xb8; - rom[0x81b4] ^= 0xb8; - rom[0x81b5] ^= 0xb8; - rom[0x81b7] ^= 0xb8; - rom[0x81b9] ^= 0xb8; - rom[0x81bb] ^= 0xb8; - rom[0x81bd] ^= 0xb8; - rom[0x81bf] ^= 0xb8; - rom[0x81c1] ^= 0xb8; - rom[0x81c3] ^= 0xb8; - rom[0x81c5] ^= 0xb8; - rom[0x81c7] ^= 0xb8; - rom[0x81c9] ^= 0xb8; - rom[0x81cb] ^= 0xb8; - rom[0x81cd] ^= 0xb8; - rom[0x81ce] ^= 0xb8; - rom[0x81d0] ^= 0xb8; - rom[0x81d2] ^= 0xb8; - rom[0x81d3] ^= 0xb8; - rom[0x81d5] ^= 0xb8; - rom[0x81d6] ^= 0xb8; - rom[0x81d8] ^= 0xb8; - rom[0x81db] ^= 0xb8; - rom[0x81dd] ^= 0xb8; - rom[0x81df] ^= 0xb8; - rom[0x81e0] ^= 0xb8; - rom[0x81e2] ^= 0xb8; - rom[0x81e5] ^= 0xb8; - rom[0x81e7] ^= 0xb8; - rom[0x81ea] ^= 0xb8; - rom[0x81ec] ^= 0xb8; - rom[0x81ef] ^= 0xb8; - rom[0x81f1] ^= 0xb8; - rom[0x81f4] ^= 0xb8; - rom[0x81f6] ^= 0xb8; - rom[0x81f9] ^= 0xb8; - rom[0x81fb] ^= 0xb8; - rom[0x81fe] ^= 0xb8; + for (i = 0x81; i < (0x81 + _countof(rcdino4_keys80));) + { + UINT8 key; - rom[0x8201] ^= 0x32; - rom[0x8204] ^= 0x32; - rom[0x8207] ^= 0x32; - rom[0x8209] ^= 0x32; - rom[0x820a] ^= 0x32; - rom[0x820d] ^= 0x32; - rom[0x820e] ^= 0x32; - rom[0x8210] ^= 0x32; - rom[0x8212] ^= 0x32; - rom[0x8213] ^= 0x32; - rom[0x8214] ^= 0x32; - rom[0x8215] ^= 0x32; - rom[0x8216] ^= 0x32; - rom[0x8217] ^= 0x32; - rom[0x8219] ^= 0x32; - rom[0x821b] ^= 0x32; - rom[0x821d] ^= 0x32; - rom[0x821f] ^= 0x32; - rom[0x8221] ^= 0x32; - rom[0x8223] ^= 0x32; - rom[0x8225] ^= 0x32; - rom[0x8226] ^= 0x32; - rom[0x8227] ^= 0x32; - rom[0x822a] ^= 0x32; - rom[0x822c] ^= 0x32; - rom[0x822d] ^= 0x32; - rom[0x8230] ^= 0x32; - rom[0x8232] ^= 0x32; - rom[0x8254] ^= 0x32; - rom[0x8255] ^= 0x32; - rom[0x8256] ^= 0x32; - rom[0x8259] ^= 0x32; - rom[0x825a] ^= 0x32; - rom[0x825c] ^= 0x32; + key = rcdino4_keys80[i - 0x81]; + do + { + UINT8 c; + int add; + + c = rom[(i << 8) + j] ^ key; + add = rcdino4_add[c]; + + if (((i == 0x81) + && (j >= 0xa3) && (j <= 0xb1) /* text string */ + ) + || ((i == 0x82) + && (j >= 0x35) && (j <= 0x53) /* table of addresses */ + ) + || ((i == 0x85) + && (j >= 0x7e) && (j <= 0x8d) /* '0'-'9', 'A'-'F' */ + ) + || ((i == 0x94) + && (j == 0xbf) /* set of masks */ + ) + || ((i == 0x96) + && ((j == 0x39) || (j == 0x3c)) /* set of masks */ + ) + || ((i == 0xaa) + && (j >= 0xf2) /* table of addresses */ + ) + || ((i == 0xc4) + && (j >= 0xdc) /* zeroes and things */ + ) + || ((i == 0xd0) + && (j >= 0xd2) /* text and zeroes */ + ) + || (add == 9) + ) + { + ++j; + } + else + { + rom[(i << 8) + j] = c; + j += add; + } + } + while (j < 0x100); + + j &= 0xff; + do {} while (!rcdino4_keys80[++i - 0x81]); + + if ((i == 0xa4) + || (i == 0xb0) + || (i == 0xf8) + ) + { + j = 0; /* re-align offset after skipping some pages */ + } + } } DRIVER_INIT_MEMBER(funworld_state, rcdinch) @@ -6396,7 +6509,7 @@ GAMEL( 1993, jolycdic, jollycrd, cuoreuno, jolycdic, funworld_state, tabblue, // Dino 4 encrypted hardware... GAMEL( 1997, pool10e, pool10, cuoreuno, cuoreuno, funworld_state, dino4, ROT0, "C.M.C.", "Pool 10 (Italian, Dino 4 hardware, encrypted)", 0, layout_jollycrd ) -GAME( 1998, rcdino4, 0, cuoreuno, cuoreuno, funworld_state, rcdino4, ROT0, "", "unknown encrypted Royal Card (Dino4 HW)", GAME_NOT_WORKING ) +GAME( 1998, rcdino4, 0, rcdino4, rcdino4, funworld_state, rcdino4, ROT0, "", "unknown encrypted Royal Card (Dino4 HW)", GAME_NOT_WORKING ) GAMEL( 1998, chinatow, 0, chinatow, chinatow, funworld_state, rcdinch, ROT0, "", "China Town (Ver 1B, Dino4 HW)", 0, layout_jollycrd ) // MCU based games...