From 03dff3284b5ee89a768f7e4e63b7cbb4ffe74a63 Mon Sep 17 00:00:00 2001 From: Luca Elia Date: Sat, 25 Jul 2015 16:16:38 +0200 Subject: [PATCH] Decrypted external ARM code in slqz3 [Dave] --- src/mame/drivers/igs_m027.c | 10 +++++++- src/mame/machine/pgmcrypt.c | 49 +++++++++++++++++++++++++++++++++++++ src/mame/machine/pgmcrypt.h | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c index dc137e5bc98..989a31f298d 100644 --- a/src/mame/drivers/igs_m027.c +++ b/src/mame/drivers/igs_m027.c @@ -66,6 +66,7 @@ public: DECLARE_DRIVER_INIT(zhongguo); DECLARE_DRIVER_INIT(klxyj); DECLARE_DRIVER_INIT(fearless); + DECLARE_DRIVER_INIT(slqz3); TILE_GET_INFO_MEMBER(get_tx_tilemap_tile_info); TILE_GET_INFO_MEMBER(get_bg_tilemap_tile_info); virtual void video_start(); @@ -998,13 +999,20 @@ DRIVER_INIT_MEMBER(igs_m027_state,zhongguo) pgm_create_dummy_internal_arm_region(); } +DRIVER_INIT_MEMBER(igs_m027_state,slqz3) +{ + slqz3_decrypt(machine()); + //sdwx_gfx_decrypt(machine()); + pgm_create_dummy_internal_arm_region(); +} + /*************************************************************************** Game Drivers ***************************************************************************/ -GAME( 1999, slqz3, 0, igs_majhong, sdwx, igs_m027_state, sdwx, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 3", GAME_IS_SKELETON ) +GAME( 1999, slqz3, 0, igs_majhong, sdwx, igs_m027_state, slqz3, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 3 (China, VS107C)", GAME_IS_SKELETON ) GAME( 2002, sdwx, 0, igs_majhong, sdwx, igs_m027_state, sdwx, ROT0, "IGS", "Sheng Dan Wu Xian", GAME_IS_SKELETON ) // aka Christmas 5 Line? GAME( 200?, sddz, 0, igs_majhong, sdwx, igs_m027_state, sddz, ROT0, "IGS", "Super Dou Di Zhu", GAME_IS_SKELETON ) GAME( 2000, zhongguo, 0, igs_majhong, sdwx, igs_m027_state, zhongguo, ROT0, "IGS", "Zhong Guo Chu Da D", GAME_IS_SKELETON ) diff --git a/src/mame/machine/pgmcrypt.c b/src/mame/machine/pgmcrypt.c index a030083f87c..a026eaf9a36 100644 --- a/src/mame/machine/pgmcrypt.c +++ b/src/mame/machine/pgmcrypt.c @@ -1478,3 +1478,52 @@ void pgm_decrypt_pgm3in1(running_machine &machine) src[i] = x; } } + + +// IGS MAHJONG CHINA VS107C +static const UINT8 slqz3_tab[0x100] = { + 0xef, 0xdf, 0x90, 0x60, 0x46, 0x43, 0x33, 0x38, 0x92, 0x2d, 0x5a, 0x08, 0x0d, 0x2f, 0x05, 0x75, + 0xa1, 0x42, 0x17, 0x12, 0xdb, 0xa2, 0xdd, 0x5d, 0x0c, 0xec, 0xdc, 0xf7, 0xc1, 0x76, 0xe0, 0x24, + 0x65, 0xef, 0x41, 0x83, 0x35, 0x38, 0x78, 0x0e, 0x65, 0x82, 0xe3, 0x55, 0x90, 0xa8, 0xd5, 0xf7, + 0x66, 0xcf, 0xe2, 0x61, 0x91, 0x3c, 0x69, 0xcb, 0xe7, 0x75, 0x62, 0x6f, 0xd7, 0x9b, 0x69, 0x0c, + 0x0d, 0x07, 0x0c, 0x9c, 0x68, 0x24, 0x51, 0x51, 0x1f, 0x8d, 0x8b, 0xd6, 0x2e, 0x67, 0x5f, 0xc3, + 0x13, 0x45, 0x21, 0xa1, 0x69, 0x9a, 0x05, 0xda, 0x7d, 0x10, 0xda, 0x7f, 0x34, 0x9f, 0xf3, 0x64, + 0x35, 0xf9, 0x16, 0x1c, 0xd4, 0x60, 0x02, 0xf3, 0x42, 0xc7, 0x42, 0x29, 0xf3, 0x2c, 0x31, 0x71, + 0x50, 0x35, 0x4e, 0xaa, 0x9f, 0x09, 0xc3, 0xdd, 0x2f, 0x72, 0x30, 0x77, 0xc7, 0x30, 0xbc, 0xc8, + 0x51, 0xa0, 0x5e, 0xbb, 0xc3, 0x8e, 0x69, 0xd7, 0x4f, 0x57, 0x56, 0x77, 0xcb, 0x43, 0xd6, 0x46, + 0x62, 0x21, 0x18, 0xfd, 0x7d, 0x24, 0x58, 0x61, 0xec, 0xfe, 0xa9, 0x77, 0x59, 0x3b, 0x03, 0x0a, + 0x07, 0x00, 0x12, 0x61, 0x77, 0xa8, 0x15, 0xa1, 0xd6, 0xd0, 0xd3, 0x57, 0x73, 0x62, 0xb9, 0xbb, + 0x3e, 0x60, 0x87, 0x22, 0xb7, 0xbf, 0xd6, 0xf9, 0x17, 0x86, 0xea, 0x02, 0xbe, 0x23, 0xba, 0xd3, + 0xdd, 0x0d, 0x3e, 0x8c, 0x65, 0xa0, 0xf8, 0xd8, 0x2f, 0x35, 0xc6, 0x26, 0x6c, 0x81, 0xe6, 0x29, + 0x50, 0x30, 0x4a, 0x8e, 0xfa, 0xc2, 0x1e, 0xfd, 0xa7, 0xa5, 0x98, 0x53, 0x18, 0x94, 0xff, 0x1d, + 0x41, 0x2f, 0xff, 0x58, 0x33, 0xdc, 0x2b, 0x67, 0x4b, 0xdd, 0xd3, 0x56, 0x9c, 0xb2, 0x09, 0x4e, + 0x9b, 0xb1, 0xee, 0x58, 0x0a, 0xe4, 0x42, 0x56, 0x26, 0x23, 0x2c, 0x3f, 0x14, 0x73, 0x46, 0x9a +}; + +void slqz3_decrypt(running_machine &machine) +{ + int i; + UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base(); + + int rom_size = 0x200000; + + for(i=0; i