From 191767f62f4f1e6fa75e59065ce3d01ba198814e Mon Sep 17 00:00:00 2001 From: davidhay Date: Sat, 18 Oct 2008 14:47:41 +0000 Subject: [PATCH] Minor NeoGeo cleanups [JohnBoy] kof2002b set from Kawaks [Kawaks] --- src/mame/drivers/neodrvr.c | 112 ++++++--- src/mame/includes/neogeo.h | 3 +- src/mame/machine/neoboot.c | 41 ++- src/mame/machine/neocrypt.c | 485 +++++++++++++++++++----------------- src/mame/mamedriv.c | 1 + 5 files changed, 370 insertions(+), 272 deletions(-) diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c index 2ba8a7ae925..0cb84c09352 100644 --- a/src/mame/drivers/neodrvr.c +++ b/src/mame/drivers/neodrvr.c @@ -4528,7 +4528,7 @@ ROM_START( kof99 ) /* Original Version - Encrypted Code & GFX */ /* AES VERSION ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4564,7 +4564,7 @@ ROM_START( kof99a ) /* Original Version - Encrypted Code & GFX */ /* MVS VERSION ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4602,7 +4602,7 @@ ROM_START( kof99e ) /* Original Version - Encrypted Code & GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4638,7 +4638,7 @@ ROM_START( kof99n ) /* Original Version - Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4704,7 +4704,7 @@ ROM_START( ganryu ) /* Original Version - Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4733,7 +4733,7 @@ ROM_START( garou ) /* Original Version - Encrypted GFX */ /* later revision */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4769,7 +4769,7 @@ ROM_START( garouo ) /* Original Version - Encrypted GFX */ /* earlier revision * ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4832,7 +4832,7 @@ ROM_START( s1945p ) /* Original Version, Encrypted GFX Roms */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4866,7 +4866,7 @@ ROM_START( preisle2 ) /* Original Version, Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4898,7 +4898,7 @@ ROM_START( mslug3 ) /* Original Version - Encrypted Code & GFX */ /* revision 20 ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4933,7 +4933,7 @@ ROM_START( mslug3h ) /* Original Version - Encrypted GFX */ /* AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -4969,7 +4969,7 @@ ROM_START( kof2000 ) /* Original Version, Encrypted Code + Sound + GFX Roms */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5004,7 +5004,7 @@ ROM_START( kof2000n ) /* Original Version, Encrypted Sound + GFX Roms */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5039,7 +5039,7 @@ ROM_START( bangbead ) /* Original Version - Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5092,7 +5092,7 @@ ROM_START( nitd ) /* Original Version - Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5119,7 +5119,7 @@ ROM_START( sengoku3 ) /* Original Version - Encrypted GFX */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5149,7 +5149,7 @@ ROM_START( kof2001 ) /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5185,7 +5185,7 @@ ROM_START( kof2001h ) /* AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5221,7 +5221,7 @@ ROM_START( mslug4 ) /* Original Version - Encrypted GFX */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5253,7 +5253,7 @@ ROM_START( rotd ) /* Encrypted Set */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5288,7 +5288,7 @@ ROM_START( kof2002 ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5323,7 +5323,7 @@ ROM_START( matrim ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5357,7 +5357,7 @@ ROM_START( pnyaa ) /* Encrypted Set */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5385,7 +5385,7 @@ ROM_START( mslug5 ) /* Encrypted Set */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5420,7 +5420,7 @@ ROM_START( mslug5h ) /* Encrypted Set */ /* AES release of the game but is also ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5455,7 +5455,7 @@ ROM_START( svc ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5488,7 +5488,7 @@ ROM_START( samsho5 ) /* Encrypted Set */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5523,7 +5523,7 @@ ROM_START( samsho5h ) /* Encrypted Set, Alternate Set */ /* AES VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5559,7 +5559,7 @@ ROM_START( kof2003 ) /* Encrypted Code + Sound + GFX Roms */ /* MVS VERSION */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5595,7 +5595,7 @@ ROM_START( kof2003h ) /* Encrypted Code + Sound + GFX Roms */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */ ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5630,7 +5630,7 @@ ROM_START( samsh5sp ) /* Encrypted Set */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5664,7 +5664,7 @@ ROM_START( samsh5sh ) /* Encrypted Set */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5699,7 +5699,7 @@ ROM_START( samsh5sn ) /* Encrypted Set */ ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5734,7 +5734,7 @@ ROM_START( jockeygp ) ROM_Y_ZOOM - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -5815,7 +5815,6 @@ ROM_START( ms5pcb ) /* Encrypted Set */ ROM_LOAD32_WORD_SWAP( "268-p1r.bin", 0x000000, 0x400000, NO_DUMP ) ROM_LOAD32_WORD_SWAP( "268-p2r.bin", 0x000002, 0x400000, NO_DUMP ) - /* The Encrypted Boards do _not_ have an s1 rom, data for it comes from the Cx ROMs */ ROM_REGION( 0x20000, "fixed", 0 ) ROM_FILL( 0x000000, 0x20000, 0 ) ROM_REGION( 0x20000, "fixedbios", 0 ) @@ -6280,6 +6279,34 @@ ROM_END /* The King of Fighters 2002 bootlegs */ +ROM_START( kof2002b ) + ROM_REGION( 0x500000, "main", 0 ) + ROM_LOAD16_WORD_SWAP( "265-p1.bin", 0x000000, 0x100000, CRC(9ede7323) SHA1(ad9d45498777fda9fa58e75781f48e09aee705a6) ) + ROM_LOAD16_WORD_SWAP( "2k2-p2.bin", 0x100000, 0x400000, CRC(6dbee4df) SHA1(9a9646c81b233b44213c624b898c19f83e9a07f8) ) + + NEO_SFIX_128K( "2k2-s1.bin", CRC(2255f5bf) SHA1(8a82b3e9717df30b580b9d0bac0b403f8102a002) ) + + /* Encrypted */ + NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.bin", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) + + ROM_REGION( 0x1000000, "ym", 0 ) + /* Encrypted */ + ROM_LOAD( "265-v1.bin", 0x000000, 0x800000, CRC(15e8f3f5) SHA1(7c9e6426b9fa6db0158baa17a6485ffce057d889) ) + ROM_LOAD( "265-v2.bin", 0x800000, 0x800000, CRC(da41d6f9) SHA1(a43021f1e58947dcbe3c8ca5283b20b649f0409d) ) + + NO_DELTAT_REGION + + ROM_REGION( 0x4000000, "sprites", 0 ) + ROM_LOAD16_BYTE( "2k2-c1.bin", 0x0000000, 0x800000, CRC(f25d3d66) SHA1(eb1da3e171c126d91e851ce141840709a2f62f8a) ) /* Plane 0,1 */ + ROM_LOAD16_BYTE( "2k2-c2.bin", 0x0000001, 0x800000, CRC(e3e66f1d) SHA1(af93e9e134816353d6187a53959c6e418b83ad8d) ) /* Plane 2,3 */ + ROM_LOAD16_BYTE( "2k2-c3.bin", 0x1000000, 0x800000, CRC(8732fa30) SHA1(81c482b375c04bcfbbc69e3e2a2e9ab567c9bb78) ) /* Plane 0,1 */ + ROM_LOAD16_BYTE( "2k2-c4.bin", 0x1000001, 0x800000, CRC(0989fd40) SHA1(355d6b2c528319e41ce89952c5cf5bcc47cd6de0) ) /* Plane 2,3 */ + ROM_LOAD16_BYTE( "2k2-c5.bin", 0x2000000, 0x800000, CRC(60635cd2) SHA1(0cf2c54e003edfcdbed64e0570e6b800e7ed3c1b) ) /* Plane 0,1 */ + ROM_LOAD16_BYTE( "2k2-c6.bin", 0x2000001, 0x800000, CRC(bd736824) SHA1(d897fc8248ace145fef57d8aa393eaebc4a1ccc4) ) /* Plane 2,3 */ + ROM_LOAD16_BYTE( "2k2-c7.bin", 0x3000000, 0x800000, CRC(2da8d8cf) SHA1(ab8aa88b8e1baba88e5fc01d0f3cb55503b6c81a) ) /* Plane 0,1 */ + ROM_LOAD16_BYTE( "2k2-c8.bin", 0x3000001, 0x800000, CRC(2048404a) SHA1(d6d0f049ffc196334825328e0472b04e04bf6695) ) /* Plane 2,3 */ +ROM_END + ROM_START( kf2k2pls ) ROM_REGION( 0x500000, "main", 0 ) ROM_LOAD16_WORD_SWAP( "2k2-p1p.bin", 0x000000, 0x100000, CRC(3ab03781) SHA1(86946c19f1c4d9ab5cde86688d698bf63118a39d) ) @@ -7166,6 +7193,16 @@ static DRIVER_INIT( kof2002 ) DRIVER_INIT_CALL(neogeo); } +static DRIVER_INIT( kof2002b ) +{ + kof2002_decrypt_68k(machine); + neo_pcm2_swap(machine, 0); + neogeo_cmc50_m1_decrypt(machine); + kof2002b_gfx_decrypt(machine, memory_region(machine, "sprites"),0x4000000); + kof2002b_gfx_decrypt(machine, memory_region(machine, "fixed"),0x20000); + DRIVER_INIT_CALL(neogeo); +} + static DRIVER_INIT( kf2k2pls ) { kof2002_decrypt_68k(machine); @@ -7187,7 +7224,7 @@ static DRIVER_INIT( kf2k2mp ) static DRIVER_INIT( kf2k2mp2 ) { - kof2km2_px_decrypt(machine); + kf2k2mp2_px_decrypt(machine); neo_pcm2_swap(machine, 0); neogeo_cmc50_m1_decrypt(machine); neogeo_bootleg_sx_decrypt(machine, 1); @@ -7647,6 +7684,7 @@ GAME( 2003, cthd2003, kof2001, neogeo, neogeo, cthd2003, ROT0, "bootleg", " GAME( 2003, ct2k3sp, kof2001, neogeo, neogeo, ct2k3sp, ROT0, "bootleg", "Crouching Tiger Hidden Dragon 2003 Super Plus (The King of Fighters 2001 bootleg)", 0 ) /* Protected Hack / Bootleg of kof2001 */ GAME( 2003, ct2k3sa, kof2001, neogeo, neogeo, ct2k3sa, ROT0, "bootleg", "Crouching Tiger Hidden Dragon 2003 Super Plus alternate (The King of Fighters 2001 bootleg)", 0 ) /* Hack / Bootleg of kof2001 */ GAME( 2002, kof2002, neogeo, neogeo, neogeo, kof2002, ROT0, "Eolith / Playmore", "The King of Fighters 2002" , 0 ) /* Encrypted GFX */ +GAME( 2002, kof2002b, kof2002, neogeo, neogeo, kof2002b, ROT0, "bootleg", "The King of Fighters 2002 (bootleg)", 0 ) GAME( 2002, kf2k2pls, kof2002, neogeo, neogeo, kf2k2pls, ROT0, "bootleg", "The King of Fighters 2002 Plus (bootleg set 1)" , 0 ) /* Encrypted GFX */ GAME( 2002, kf2k2pla, kof2002, neogeo, neogeo, kf2k2pls, ROT0, "bootleg", "The King of Fighters 2002 Plus (bootleg set 2)" , 0 ) /* Encrypted GFX */ GAME( 2002, kf2k2mp, kof2002, neogeo, neogeo, kf2k2mp, ROT0, "bootleg", "The King of Fighters 2002 Magic Plus (bootleg)" , 0 ) /* Encrypted GFX */ @@ -7680,7 +7718,7 @@ GAME( 2003, samsh5sp, neogeo, neogeo, neogeo, samsh5sp, ROT0, "Yuki Enterp GAME( 2003, samsh5sh, samsh5sp, neogeo, neogeo, samsh5sp, ROT0, "Yuki Enterprise / SNK Playmore", "Samurai Shodown V Special / Samurai Spirits Zero Special (set 2, censored)", 0 ) GAME( 2003, samsh5sn, samsh5sp, neogeo, neogeo, samsh5sp, ROT0, "Yuki Enterprise / SNK Playmore", "Samurai Shodown V Special / Samurai Spirits Zero Special (set 3, less censored)", 0 ) -/* there are other bootlegs kof2002b etc. kof96ep, kf2k1pls? -- work out which should be supported */ +/* there are other bootlegs kof96ep, kf2k1pls etc.? -- work out which should be supported */ /* Alpha Denshi Co. / ADK (changed name in 1993) */ GAME( 1990, maglord, neogeo, neogeo, neogeo, neogeo, ROT0, "Alpha Denshi Co.", "Magician Lord (set 1)", 0 ) diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index ac365fe4ce7..7db6db3cb15 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -93,8 +93,9 @@ void decrypt_kof10th(running_machine *machine); void decrypt_kf10thep(running_machine *machine); void decrypt_kf2k5uni(running_machine *machine); void neogeo_bootleg_sx_decrypt(running_machine *machine, int value); +void kof2002b_gfx_decrypt(running_machine *machine, UINT8 *src, int size); void kf2k2mp_decrypt(running_machine *machine); -void kof2km2_px_decrypt(running_machine *machine); +void kf2k2mp2_px_decrypt(running_machine *machine); void decrypt_cthd2003(running_machine *machine); void patch_cthd2003(running_machine *machine); void decrypt_ct2k3sp(running_machine *machine); diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c index fcbc82c7e74..92c2f931f42 100644 --- a/src/mame/machine/neoboot.c +++ b/src/mame/machine/neoboot.c @@ -299,6 +299,43 @@ void decrypt_kf2k5uni( running_machine *machine ) } +/* The King of Fighters 2002 (bootleg) */ + + +// Thanks to IQ_132 for the info +void kof2002b_gfx_decrypt(running_machine *machine, UINT8 *src, int size) +{ + int i, j; + int t[ 8 ][ 10 ] = + { + { 0, 8, 7, 3, 4, 5, 6, 2, 1 }, + { 1, 0, 8, 4, 5, 3, 7, 6, 2 }, + { 2, 1, 0, 3, 4, 5, 8, 7, 6 }, + { 6, 2, 1, 5, 3, 4, 0, 8, 7 }, + { 7, 6, 2, 5, 3, 4, 1, 0, 8 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + { 2, 1, 0, 4, 5, 3, 6, 7, 8 }, + { 8, 0, 7, 3, 4, 5, 6, 2, 1 }, + }; + + UINT8 *dst = malloc_or_die( 0x10000 ); + + for ( i = 0; i < size; i+=0x10000 ) + { + memcpy( dst, src+i, 0x10000 ); + + for ( j = 0; j < 0x200; j++ ) + { + int n = (( j % 0x40) / 8 ); + int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], + t[n][3], t[n][4], t[n][5], t[n][6], t[n][7], t[n][8]); + memcpy( src+i+ofst*128, dst+j*128, 128 ); + } + } + free( dst ); +} + + /* The King of Fighters 2002 Magic Plus (bootleg) */ @@ -327,7 +364,7 @@ void kf2k2mp_decrypt( running_machine *machine ) /* The King of Fighters 2002 Magic Plus II (bootleg) */ -void kof2km2_px_decrypt( running_machine *machine ) +void kf2k2mp2_px_decrypt( running_machine *machine ) { UINT8 *src = memory_region(machine, "main"); UINT8 *dst = malloc_or_die(0x600000); @@ -1082,6 +1119,6 @@ void matrimbl_decrypt( running_machine *machine ) memcpy( rom-0x10000, rom, 0x10000 ); /* decrypt gfx */ - cthd2003_c( machine, 0); + cthd2003_c( machine, 0 ); } diff --git a/src/mame/machine/neocrypt.c b/src/mame/machine/neocrypt.c index 8b92a7b2742..d6316f2c47a 100644 --- a/src/mame/machine/neocrypt.c +++ b/src/mame/machine/neocrypt.c @@ -669,7 +669,7 @@ void cmc50_neogeo_gfx_decrypt(running_machine *machine, int extra_xor) } -/* svc has an additional scramble on top of the standard CMC scrambling */ +/* ms5pcb and svcpcb have an additional scramble on top of the standard CMC scrambling */ void svcpcb_gfx_decrypt(running_machine *machine) { static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; @@ -718,7 +718,8 @@ void svcpcb_s1data_decrypt(running_machine *machine) } -/* Razoola & Halrin */ +/* kf2k3pcb has an additional scramble on top of the standard CMC scrambling */ +/* Thanks to Razoola & Halrin for the info */ void kf2k3pcb_gfx_decrypt(running_machine *machine) { static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; @@ -749,12 +750,207 @@ void kf2k3pcb_gfx_decrypt(running_machine *machine) } +/* and a further swap on the s1 data */ +void kf2k3pcb_decrypt_s1data(running_machine *machine) +{ + UINT8 *src; + UINT8 *dst; + int i; + int tx_size = memory_region_length( machine, "fixed" ); + int srom_size = memory_region_length( machine, "sprites" ); + + src = memory_region( machine, "sprites" ) + srom_size - 0x1000000 - 0x80000; // Decrypt S + dst = memory_region( machine, "fixed" ); + + for( i = 0; i < tx_size / 2; i++ ) + { + dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; + } + + src = memory_region( machine, "sprites" ) + srom_size - 0x80000; + dst = memory_region( machine, "fixed" ) + 0x80000; + + for( i = 0; i < tx_size / 2; i++ ) + { + dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; + } + + dst = memory_region( machine, "fixed" ); + + for( i = 0; i < tx_size; i++ ) + { + dst[ i ] = BITSWAP8( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 ); + } +} + + +/*************************************************************************** + +NeoGeo 'M' ROM encryption + CMC50 protection chip + +***************************************************************************/ + + +static const UINT8 m1_address_8_15_xor[256] = +{ + 0x0a, 0x72, 0xb7, 0xaf, 0x67, 0xde, 0x1d, 0xb1, 0x78, 0xc4, 0x4f, 0xb5, 0x4b, 0x18, 0x76, 0xdd, + 0x11, 0xe2, 0x36, 0xa1, 0x82, 0x03, 0x98, 0xa0, 0x10, 0x5f, 0x3f, 0xd6, 0x1f, 0x90, 0x6a, 0x0b, + 0x70, 0xe0, 0x64, 0xcb, 0x9f, 0x38, 0x8b, 0x53, 0x04, 0xca, 0xf8, 0xd0, 0x07, 0x68, 0x56, 0x32, + 0xae, 0x1c, 0x2e, 0x48, 0x63, 0x92, 0x9a, 0x9c, 0x44, 0x85, 0x41, 0x40, 0x09, 0xc0, 0xc8, 0xbf, + 0xea, 0xbb, 0xf7, 0x2d, 0x99, 0x21, 0xf6, 0xba, 0x15, 0xce, 0xab, 0xb0, 0x2a, 0x60, 0xbc, 0xf1, + 0xf0, 0x9e, 0xd5, 0x97, 0xd8, 0x4e, 0x14, 0x9d, 0x42, 0x4d, 0x2c, 0x5c, 0x2b, 0xa6, 0xe1, 0xa7, + 0xef, 0x25, 0x33, 0x7a, 0xeb, 0xe7, 0x1b, 0x6d, 0x4c, 0x52, 0x26, 0x62, 0xb6, 0x35, 0xbe, 0x80, + 0x01, 0xbd, 0xfd, 0x37, 0xf9, 0x47, 0x55, 0x71, 0xb4, 0xf2, 0xff, 0x27, 0xfa, 0x23, 0xc9, 0x83, + 0x17, 0x39, 0x13, 0x0d, 0xc7, 0x86, 0x16, 0xec, 0x49, 0x6f, 0xfe, 0x34, 0x05, 0x8f, 0x00, 0xe6, + 0xa4, 0xda, 0x7b, 0xc1, 0xf3, 0xf4, 0xd9, 0x75, 0x28, 0x66, 0x87, 0xa8, 0x45, 0x6c, 0x20, 0xe9, + 0x77, 0x93, 0x7e, 0x3c, 0x1e, 0x74, 0xf5, 0x8c, 0x3e, 0x94, 0xd4, 0xc2, 0x5a, 0x06, 0x0e, 0xe8, + 0x3d, 0xa9, 0xb2, 0xe3, 0xe4, 0x22, 0xcf, 0x24, 0x8e, 0x6b, 0x8a, 0x8d, 0x84, 0x4a, 0xd2, 0x91, + 0x88, 0x79, 0x57, 0xa5, 0x0f, 0xcd, 0xb9, 0xac, 0x3b, 0xaa, 0xb3, 0xd1, 0xee, 0x31, 0x81, 0x7c, + 0xd7, 0x89, 0xd3, 0x96, 0x43, 0xc5, 0xc6, 0xc3, 0x69, 0x7f, 0x46, 0xdf, 0x30, 0x5b, 0x6e, 0xe5, + 0x08, 0x95, 0x9b, 0xfb, 0xb8, 0x58, 0x0c, 0x61, 0x50, 0x5d, 0x3a, 0xa2, 0x29, 0x12, 0xfc, 0x51, + 0x7d, 0x1a, 0x02, 0x65, 0x54, 0x5e, 0x19, 0xcc, 0xdc, 0xdb, 0x73, 0xed, 0xad, 0x59, 0x2f, 0xa3, +}; + +static const UINT8 m1_address_0_7_xor[256] = +{ + 0xf4, 0xbc, 0x02, 0xf7, 0x2c, 0x3d, 0xe8, 0xd9, 0x50, 0x62, 0xec, 0xbd, 0x53, 0x73, 0x79, 0x61, + 0x00, 0x34, 0xcf, 0xa2, 0x63, 0x28, 0x90, 0xaf, 0x44, 0x3b, 0xc5, 0x8d, 0x3a, 0x46, 0x07, 0x70, + 0x66, 0xbe, 0xd8, 0x8b, 0xe9, 0xa0, 0x4b, 0x98, 0xdc, 0xdf, 0xe2, 0x16, 0x74, 0xf1, 0x37, 0xf5, + 0xb7, 0x21, 0x81, 0x01, 0x1c, 0x1b, 0x94, 0x36, 0x09, 0xa1, 0x4a, 0x91, 0x30, 0x92, 0x9b, 0x9a, + 0x29, 0xb1, 0x38, 0x4d, 0x55, 0xf2, 0x56, 0x18, 0x24, 0x47, 0x9d, 0x3f, 0x80, 0x1f, 0x22, 0xa4, + 0x11, 0x54, 0x84, 0x0d, 0x25, 0x48, 0xee, 0xc6, 0x59, 0x15, 0x03, 0x7a, 0xfd, 0x6c, 0xc3, 0x33, + 0x5b, 0xc4, 0x7b, 0x5a, 0x05, 0x7f, 0xa6, 0x40, 0xa9, 0x5d, 0x41, 0x8a, 0x96, 0x52, 0xd3, 0xf0, + 0xab, 0x72, 0x10, 0x88, 0x6f, 0x95, 0x7c, 0xa8, 0xcd, 0x9c, 0x5f, 0x32, 0xae, 0x85, 0x39, 0xac, + 0xe5, 0xd7, 0xfb, 0xd4, 0x08, 0x23, 0x19, 0x65, 0x6b, 0xa7, 0x93, 0xbb, 0x2b, 0xbf, 0xb8, 0x35, + 0xd0, 0x06, 0x26, 0x68, 0x3e, 0xdd, 0xb9, 0x69, 0x2a, 0xb2, 0xde, 0x87, 0x45, 0x58, 0xff, 0x3c, + 0x9e, 0x7d, 0xda, 0xed, 0x49, 0x8c, 0x14, 0x8e, 0x75, 0x2f, 0xe0, 0x6e, 0x78, 0x6d, 0x20, 0xd2, + 0xfa, 0x2d, 0x51, 0xcc, 0xc7, 0xe7, 0x1d, 0x27, 0x97, 0xfc, 0x31, 0xdb, 0xf8, 0x42, 0xe3, 0x99, + 0x5e, 0x83, 0x0e, 0xb4, 0x2e, 0xf6, 0xc0, 0x0c, 0x4c, 0x57, 0xb6, 0x64, 0x0a, 0x17, 0xa3, 0xc1, + 0x77, 0x12, 0xfe, 0xe6, 0x8f, 0x13, 0x71, 0xe4, 0xf9, 0xad, 0x9f, 0xce, 0xd5, 0x89, 0x7e, 0x0f, + 0xc2, 0x86, 0xf3, 0x67, 0xba, 0x60, 0x43, 0xc9, 0x04, 0xb3, 0xb0, 0x1e, 0xb5, 0xc8, 0xeb, 0xa5, + 0x76, 0xea, 0x5c, 0x82, 0x1a, 0x4f, 0xaa, 0xca, 0xe1, 0x0b, 0x4e, 0xcb, 0x6a, 0xef, 0xd1, 0xd6, +}; + + +/* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, + ,and uses this checksum as the basis of the key with which to decrypt + the rom */ + +static UINT16 generate_cs16(UINT8 *rom, int size) +{ + UINT16 cs16; + int i; + cs16 = 0x0000; + for (i=0;i>16)&7; + aux = address&0xffff; + + aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5); + aux = BITSWAP16(aux, + p1[block][15],p1[block][14],p1[block][13],p1[block][12], + p1[block][11],p1[block][10],p1[block][9],p1[block][8], + p1[block][7],p1[block][6],p1[block][5],p1[block][4], + p1[block][3],p1[block][2],p1[block][1],p1[block][0]); + aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; + aux ^= m1_address_8_15_xor[aux&0xff]<<8; + aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); + + return (block<<16)|aux; +} + + +void neogeo_cmc50_m1_decrypt(running_machine *machine) +{ + UINT8* rom = memory_region(machine, "audiocrypt"); + size_t rom_size = 0x80000; + UINT8* rom2 = memory_region(machine, "audio"); + + UINT8* buffer = malloc_or_die(rom_size); + + UINT32 i; + + UINT16 key=generate_cs16(rom,0x10000); + + //printf("key %04x\n",key); + + for (i=0; igamedrv->name; + char filename[256]; + sprintf(filename, "%s_m1.dump", gamename); + + fp=fopen(filename, "w+b"); + if (fp) + { + fwrite(rom, rom_size, 1, fp); + fclose(fp); + } + } + #endif + + + #if 0 + { + FILE *fp; + const char *gamename = machine->gamedrv->name; + char filename[256]; + sprintf(filename, "%s_m1extra.dump", gamename); + + fp=fopen(filename, "w+b"); + if (fp) + { + fwrite(&rom[0xf800], 0x800, 1, fp); + fclose(fp); + } + } + #endif + + free( buffer ); +} + + /*************************************************************************** NeoGeo 'P' ROM encryption ***************************************************************************/ + /* Kof98 uses an early encryption, quite different from the others */ void kof98_decrypt_68k(running_machine *machine) { @@ -1033,7 +1229,7 @@ void samsh5sp_decrypt_68k(running_machine *machine) } -/* mslug5, svc, kof2003 have updated P rom scramble */ +/* kf2k3pcb, kof2003, kof2003h, mslug5 and svc have updated P rom scramble */ void mslug5_decrypt_68k(running_machine *machine) { static const UINT8 xor1[ 0x20 ] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 }; @@ -1124,39 +1320,6 @@ void svc_px_decrypt(running_machine *machine) } -void kf2k3pcb_decrypt_s1data(running_machine *machine) -{ - UINT8 *src; - UINT8 *dst; - int i; - int tx_size = memory_region_length( machine, "fixed" ); - int srom_size = memory_region_length( machine, "sprites" ); - - src = memory_region( machine, "sprites" ) + srom_size - 0x1000000 - 0x80000; // Decrypt S - dst = memory_region( machine, "fixed" ); - - for( i = 0; i < tx_size / 2; i++ ) - { - dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; - } - - src = memory_region( machine, "sprites" ) + srom_size - 0x80000; - dst = memory_region( machine, "fixed" ) + 0x80000; - - for( i = 0; i < tx_size / 2; i++ ) - { - dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; - } - - dst = memory_region( machine, "fixed" ); - - for( i = 0; i < tx_size; i++ ) - { - dst[ i ] = BITSWAP8( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 ); - } -} - - void kf2k3pcb_decrypt_68k(running_machine *machine) { static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 }; @@ -1293,58 +1456,6 @@ void kof2003h_decrypt_68k(running_machine *machine) } -void kof2003biosdecode(running_machine *machine) -{ - static const UINT8 address[0x80]={ - 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, - 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, - 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, - 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, - 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, - 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, - 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, - 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, - 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, - 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, - 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, - 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, - 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, - 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, - 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, - 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, - }; - UINT16*src= (UINT16*)memory_region( machine, "mainbios" ); - UINT16*buf= malloc_or_die(0x80000); - int a,addr; - - for (a=0;a<0x80000/2;a++) - { - //data xor - #ifdef LSB_FIRST - if (src[a] & 0x0004) src[a] ^= 0x0001; - if (src[a] & 0x0010) src[a] ^= 0x0002; - if (src[a] & 0x0020) src[a] ^= 0x0008; - #else - if (src[a] & 0x0400) src[a] ^= 0x0100; - if (src[a] & 0x1000) src[a] ^= 0x0200; - if (src[a] & 0x2000) src[a] ^= 0x0800; - #endif - //address xor - addr = a & ~0xff; - addr |= address[BYTE_XOR_LE(a & 0x7f)]; - if ( a & 0x00008) addr ^= 0x0008; - if ( a & 0x00080) addr ^= 0x0080; - if ( a & 0x00200) addr ^= 0x0100; - if (~a & 0x02000) addr ^= 0x0400; - if (~a & 0x10000) addr ^= 0x1000; - if ( a & 0x02000) addr ^= 0x8000; - buf[addr]=src[a]; - } - memcpy(src,buf,0x80000); - free(buf); -} - - /*************************************************************************** NeoGeo 'V' (PCM) ROM encryption @@ -1411,153 +1522,63 @@ void neo_pcm2_swap(running_machine *machine, int value) } -static const UINT8 m1_address_8_15_xor[256] = +/*************************************************************************** + +NeoGeo 'SP1' (BIOS) ROM encryption + +***************************************************************************/ + + +/* only found on kf2k3pcb */ +void kof2003biosdecode(running_machine *machine) { - 0x0a, 0x72, 0xb7, 0xaf, 0x67, 0xde, 0x1d, 0xb1, 0x78, 0xc4, 0x4f, 0xb5, 0x4b, 0x18, 0x76, 0xdd, - 0x11, 0xe2, 0x36, 0xa1, 0x82, 0x03, 0x98, 0xa0, 0x10, 0x5f, 0x3f, 0xd6, 0x1f, 0x90, 0x6a, 0x0b, - 0x70, 0xe0, 0x64, 0xcb, 0x9f, 0x38, 0x8b, 0x53, 0x04, 0xca, 0xf8, 0xd0, 0x07, 0x68, 0x56, 0x32, - 0xae, 0x1c, 0x2e, 0x48, 0x63, 0x92, 0x9a, 0x9c, 0x44, 0x85, 0x41, 0x40, 0x09, 0xc0, 0xc8, 0xbf, - 0xea, 0xbb, 0xf7, 0x2d, 0x99, 0x21, 0xf6, 0xba, 0x15, 0xce, 0xab, 0xb0, 0x2a, 0x60, 0xbc, 0xf1, - 0xf0, 0x9e, 0xd5, 0x97, 0xd8, 0x4e, 0x14, 0x9d, 0x42, 0x4d, 0x2c, 0x5c, 0x2b, 0xa6, 0xe1, 0xa7, - 0xef, 0x25, 0x33, 0x7a, 0xeb, 0xe7, 0x1b, 0x6d, 0x4c, 0x52, 0x26, 0x62, 0xb6, 0x35, 0xbe, 0x80, - 0x01, 0xbd, 0xfd, 0x37, 0xf9, 0x47, 0x55, 0x71, 0xb4, 0xf2, 0xff, 0x27, 0xfa, 0x23, 0xc9, 0x83, - 0x17, 0x39, 0x13, 0x0d, 0xc7, 0x86, 0x16, 0xec, 0x49, 0x6f, 0xfe, 0x34, 0x05, 0x8f, 0x00, 0xe6, - 0xa4, 0xda, 0x7b, 0xc1, 0xf3, 0xf4, 0xd9, 0x75, 0x28, 0x66, 0x87, 0xa8, 0x45, 0x6c, 0x20, 0xe9, - 0x77, 0x93, 0x7e, 0x3c, 0x1e, 0x74, 0xf5, 0x8c, 0x3e, 0x94, 0xd4, 0xc2, 0x5a, 0x06, 0x0e, 0xe8, - 0x3d, 0xa9, 0xb2, 0xe3, 0xe4, 0x22, 0xcf, 0x24, 0x8e, 0x6b, 0x8a, 0x8d, 0x84, 0x4a, 0xd2, 0x91, - 0x88, 0x79, 0x57, 0xa5, 0x0f, 0xcd, 0xb9, 0xac, 0x3b, 0xaa, 0xb3, 0xd1, 0xee, 0x31, 0x81, 0x7c, - 0xd7, 0x89, 0xd3, 0x96, 0x43, 0xc5, 0xc6, 0xc3, 0x69, 0x7f, 0x46, 0xdf, 0x30, 0x5b, 0x6e, 0xe5, - 0x08, 0x95, 0x9b, 0xfb, 0xb8, 0x58, 0x0c, 0x61, 0x50, 0x5d, 0x3a, 0xa2, 0x29, 0x12, 0xfc, 0x51, - 0x7d, 0x1a, 0x02, 0x65, 0x54, 0x5e, 0x19, 0xcc, 0xdc, 0xdb, 0x73, 0xed, 0xad, 0x59, 0x2f, 0xa3, -}; - -static const UINT8 m1_address_0_7_xor[256] = -{ - 0xf4, 0xbc, 0x02, 0xf7, 0x2c, 0x3d, 0xe8, 0xd9, 0x50, 0x62, 0xec, 0xbd, 0x53, 0x73, 0x79, 0x61, - 0x00, 0x34, 0xcf, 0xa2, 0x63, 0x28, 0x90, 0xaf, 0x44, 0x3b, 0xc5, 0x8d, 0x3a, 0x46, 0x07, 0x70, - 0x66, 0xbe, 0xd8, 0x8b, 0xe9, 0xa0, 0x4b, 0x98, 0xdc, 0xdf, 0xe2, 0x16, 0x74, 0xf1, 0x37, 0xf5, - 0xb7, 0x21, 0x81, 0x01, 0x1c, 0x1b, 0x94, 0x36, 0x09, 0xa1, 0x4a, 0x91, 0x30, 0x92, 0x9b, 0x9a, - 0x29, 0xb1, 0x38, 0x4d, 0x55, 0xf2, 0x56, 0x18, 0x24, 0x47, 0x9d, 0x3f, 0x80, 0x1f, 0x22, 0xa4, - 0x11, 0x54, 0x84, 0x0d, 0x25, 0x48, 0xee, 0xc6, 0x59, 0x15, 0x03, 0x7a, 0xfd, 0x6c, 0xc3, 0x33, - 0x5b, 0xc4, 0x7b, 0x5a, 0x05, 0x7f, 0xa6, 0x40, 0xa9, 0x5d, 0x41, 0x8a, 0x96, 0x52, 0xd3, 0xf0, - 0xab, 0x72, 0x10, 0x88, 0x6f, 0x95, 0x7c, 0xa8, 0xcd, 0x9c, 0x5f, 0x32, 0xae, 0x85, 0x39, 0xac, - 0xe5, 0xd7, 0xfb, 0xd4, 0x08, 0x23, 0x19, 0x65, 0x6b, 0xa7, 0x93, 0xbb, 0x2b, 0xbf, 0xb8, 0x35, - 0xd0, 0x06, 0x26, 0x68, 0x3e, 0xdd, 0xb9, 0x69, 0x2a, 0xb2, 0xde, 0x87, 0x45, 0x58, 0xff, 0x3c, - 0x9e, 0x7d, 0xda, 0xed, 0x49, 0x8c, 0x14, 0x8e, 0x75, 0x2f, 0xe0, 0x6e, 0x78, 0x6d, 0x20, 0xd2, - 0xfa, 0x2d, 0x51, 0xcc, 0xc7, 0xe7, 0x1d, 0x27, 0x97, 0xfc, 0x31, 0xdb, 0xf8, 0x42, 0xe3, 0x99, - 0x5e, 0x83, 0x0e, 0xb4, 0x2e, 0xf6, 0xc0, 0x0c, 0x4c, 0x57, 0xb6, 0x64, 0x0a, 0x17, 0xa3, 0xc1, - 0x77, 0x12, 0xfe, 0xe6, 0x8f, 0x13, 0x71, 0xe4, 0xf9, 0xad, 0x9f, 0xce, 0xd5, 0x89, 0x7e, 0x0f, - 0xc2, 0x86, 0xf3, 0x67, 0xba, 0x60, 0x43, 0xc9, 0x04, 0xb3, 0xb0, 0x1e, 0xb5, 0xc8, 0xeb, 0xa5, - 0x76, 0xea, 0x5c, 0x82, 0x1a, 0x4f, 0xaa, 0xca, 0xe1, 0x0b, 0x4e, 0xcb, 0x6a, 0xef, 0xd1, 0xd6, -}; - - -/* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, - ,and uses this checksum as the basis of the key with which to decrypt - the rom */ - -static UINT16 generate_cs16(UINT8 *rom, int size) -{ - UINT16 cs16; - int i; - cs16 = 0x0000; - for (i=0;i>16)&7; - aux = address&0xffff; - - aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5); - aux = BITSWAP16(aux, - p1[block][15],p1[block][14],p1[block][13],p1[block][12], - p1[block][11],p1[block][10],p1[block][9],p1[block][8], - p1[block][7],p1[block][6],p1[block][5],p1[block][4], - p1[block][3],p1[block][2],p1[block][1],p1[block][0]); - aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; - aux ^= m1_address_8_15_xor[aux&0xff]<<8; - aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); - - return (block<<16)|aux; + for (a=0;a<0x80000/2;a++) + { + //data xor + #ifdef LSB_FIRST + if (src[a] & 0x0004) src[a] ^= 0x0001; + if (src[a] & 0x0010) src[a] ^= 0x0002; + if (src[a] & 0x0020) src[a] ^= 0x0008; + #else + if (src[a] & 0x0400) src[a] ^= 0x0100; + if (src[a] & 0x1000) src[a] ^= 0x0200; + if (src[a] & 0x2000) src[a] ^= 0x0800; + #endif + //address xor + addr = a & ~0xff; + addr |= address[BYTE_XOR_LE(a & 0x7f)]; + if ( a & 0x00008) addr ^= 0x0008; + if ( a & 0x00080) addr ^= 0x0080; + if ( a & 0x00200) addr ^= 0x0100; + if (~a & 0x02000) addr ^= 0x0400; + if (~a & 0x10000) addr ^= 0x1000; + if ( a & 0x02000) addr ^= 0x8000; + buf[addr]=src[a]; + } + memcpy(src,buf,0x80000); + free(buf); } -void neogeo_cmc50_m1_decrypt(running_machine *machine) -{ - UINT8* rom = memory_region(machine, "audiocrypt"); - size_t rom_size = 0x80000; - UINT8* rom2 = memory_region(machine, "audio"); - - UINT8* buffer = malloc_or_die(rom_size); - - UINT32 i; - - UINT16 key=generate_cs16(rom,0x10000); - - //printf("key %04x\n",key); - - for (i=0; igamedrv->name; - char filename[256]; - sprintf(filename, "%s_m1.dump", gamename); - - fp=fopen(filename, "w+b"); - if (fp) - { - fwrite(rom, rom_size, 1, fp); - fclose(fp); - } - } - #endif - - - #if 0 - { - FILE *fp; - const char *gamename = machine->gamedrv->name; - char filename[256]; - sprintf(filename, "%s_m1extra.dump", gamename); - - fp=fopen(filename, "w+b"); - if (fp) - { - fwrite(&rom[0xf800], 0x800, 1, fp); - fclose(fp); - } - } - #endif - - free( buffer ); -} diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index 95625efcbd8..40163499165 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -5789,6 +5789,7 @@ BOMULEUL CHAJARA SEGA ST-V 1997/04/11 DRIVER( ms4plus ) /* bootleg */ DRIVER( rotd ) /* 0264 (c) 2002 Evoga */ DRIVER( kof2002 ) /* 0265 (c) 2002 Eolith / Playmore */ + DRIVER( kof2002b ) /* bootleg */ DRIVER( kf2k2pls ) /* bootleg */ DRIVER( kf2k2pla ) /* bootleg */ DRIVER( kf2k2mp ) /* bootleg */