From 8eae940bf5ec97a5e3da18031995448e4cd6f1a9 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 4 Sep 2024 01:14:28 +1000 Subject: igs/igs_m027.cpp, igs/pgmcrypt.cpp: Use uploaded XOR table for games with internal CPU ROM dumped. * igs/igs_m027a.cpp, igs/pgmcrypt.cpp: Fixed a number of places interpreting ROM as non-native width. * igs/pgmcrypt.cpp: Removed literal ROM region lengths. --- src/mame/igs/igs_m027.cpp | 213 ++++++++++++++++----------- src/mame/igs/pgmcrypt.cpp | 363 ++++++---------------------------------------- 2 files changed, 175 insertions(+), 401 deletions(-) diff --git a/src/mame/igs/igs_m027.cpp b/src/mame/igs/igs_m027.cpp index 4affb7bb209..5c02155412c 100644 --- a/src/mame/igs/igs_m027.cpp +++ b/src/mame/igs/igs_m027.cpp @@ -34,6 +34,11 @@ #include "screen.h" #include "speaker.h" +#include "endianness.h" + +#include + + namespace { class igs_m027_state : public driver_device @@ -41,6 +46,7 @@ class igs_m027_state : public driver_device public: igs_m027_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_external_rom(*this, "user1"), m_igs_mainram(*this, "igs_mainram"), m_maincpu(*this, "maincpu"), m_ppi(*this, "ppi8255"), @@ -50,78 +56,90 @@ public: m_dsw(*this, "DSW%u", 1U) { } - void igs_mahjong(machine_config &config); - void extradraw(machine_config &config); - - void init_sdwx(); - void init_chessc2(); - void init_lhzb4(); - void init_gonefsh2(); - void init_sddz(); - void init_zhongguo(); - void init_klxyj(); - void init_slqz3(); - void init_fruitpar(); - void init_oceanpar(); - void init_amazonia(); - void init_amazoni2(); - void init_qlgs(); - void init_mgzz(); - void init_mgcs3(); - void init_jking02(); - void init_lhdmg(); - void init_lhdmgp(); - void init_lthy(); - void init_luckycrs(); - void init_olympic5(); - void init_extradrw(); + void igs_mahjong(machine_config &config) ATTR_COLD; + void igs_mahjong_xor(machine_config &config) ATTR_COLD; + void extradraw(machine_config &config) ATTR_COLD; + + void init_sdwx() ATTR_COLD; + void init_chessc2() ATTR_COLD; + void init_lhzb4() ATTR_COLD; + void init_gonefsh2() ATTR_COLD; + void init_sddz() ATTR_COLD; + void init_zhongguo() ATTR_COLD; + void init_klxyj() ATTR_COLD; + void init_slqz3() ATTR_COLD; + void init_fruitpar() ATTR_COLD; + void init_oceanpar() ATTR_COLD; + void init_amazonia() ATTR_COLD; + void init_amazoni2() ATTR_COLD; + void init_qlgs() ATTR_COLD; + void init_mgzz() ATTR_COLD; + void init_mgcs3() ATTR_COLD; + void init_jking02() ATTR_COLD; + void init_lhdmg() ATTR_COLD; + void init_lhdmgp() ATTR_COLD; + void init_lthy() ATTR_COLD; + void init_luckycrs() ATTR_COLD; + void init_olympic5() ATTR_COLD; + void init_extradrw() ATTR_COLD; protected: - virtual void machine_start() override; - virtual void video_start() override; + virtual void machine_start() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; private: + required_region_ptr m_external_rom; optional_shared_ptr m_igs_mainram; required_device m_maincpu; - optional_device m_ppi; + required_device m_ppi; required_device m_igs017_igs031; required_device m_screen; required_device m_oki; required_ioport_array<3> m_dsw; + u32 m_xor_table[0x100]; + u32 m_dsw_io_select; + u32 m_unk2_write_count; + + u8 ppi_porta_r(); + + void dsw_io_select_w(u32 data); + + u32 external_rom_r(offs_t offset); + + void xor_table_w(offs_t offset, u8 data); + u32 unk_r(); u32 unk2_r(); u32 lhdmg_unk2_r(); void unk2_w(u32 data); - void dsw_io_select_w(u32 data); - - u8 ppi_porta_r(); - TIMER_DEVICE_CALLBACK_MEMBER(interrupt); - void pgm_create_dummy_internal_arm_region(); - void igs_mahjong_map(address_map &map); - void extradraw_map(address_map &map); + void pgm_create_dummy_internal_arm_region() ATTR_COLD; - u32 m_dsw_io_select; - u32 m_unk2_write_count; + void igs_mahjong_map(address_map &map) ATTR_COLD; + void igs_mahjong_xor_map(address_map &map) ATTR_COLD; + void extradraw_map(address_map &map) ATTR_COLD; }; -void igs_m027_state::video_start() -{ - m_igs017_igs031->video_start(); -} - void igs_m027_state::machine_start() { + std::fill(std::begin(m_xor_table), std::end(m_xor_table), 0); m_dsw_io_select = 7; m_unk2_write_count = 0; + save_item(NAME(m_xor_table)); save_item(NAME(m_dsw_io_select)); save_item(NAME(m_unk2_write_count)); } +void igs_m027_state::video_start() +{ + m_igs017_igs031->video_start(); +} + + /*************************************************************************** Memory Maps @@ -137,7 +155,7 @@ void igs_m027_state::igs_mahjong_map(address_map &map) map(0x38000000, 0x38007fff).rw(m_igs017_igs031, FUNC(igs017_igs031_device::read), FUNC(igs017_igs031_device::write)); - map(0x38008000, 0x38008003).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask32(0x000000ff); + map(0x38008000, 0x38008003).umask32(0x000000ff).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0x38009000, 0x38009003).r(FUNC(igs_m027_state::unk_r)); @@ -146,13 +164,22 @@ void igs_m027_state::igs_mahjong_map(address_map &map) map(0x40000018, 0x4000001b).w(FUNC(igs_m027_state::dsw_io_select_w)); map(0x70000200, 0x70000203).ram(); // ?????????????? - map(0x50000000, 0x500003ff).nopw(); // uploads XOR table to external ROM here map(0xf0000000, 0xf000000f).nopw(); // magic registers } +void igs_m027_state::igs_mahjong_xor_map(address_map &map) +{ + igs_mahjong_map(map); + + map(0x08000000, 0x0807ffff).r(FUNC(igs_m027_state::external_rom_r)); // Game ROM + + map(0x50000000, 0x500003ff).umask32(0x000000ff).w(FUNC(igs_m027_state::xor_table_w)); // uploads XOR table to external ROM here +} + void igs_m027_state::extradraw_map(address_map &map) { igs_mahjong_map(map); + map(0x18088000, 0x1808ffff).ram(); // Extra Draw needs RAM here, maybe just a mirror, maybe due to PCB difference } @@ -383,18 +410,33 @@ u8 igs_m027_state::ppi_porta_r() return data; } + void igs_m027_state::dsw_io_select_w(u32 data) { m_dsw_io_select = data; } +u32 igs_m027_state::external_rom_r(offs_t offset) +{ + return m_external_rom[offset] ^ m_xor_table[offset & 0x00ff]; +} + + +void igs_m027_state::xor_table_w(offs_t offset, u8 data) +{ + m_xor_table[offset] = (u32(data) << 24) | (u32(data) << 8); +} + + // IO? maybe serial? -void igs_m027_state::unk2_w(u32 data) +u32 igs_m027_state::unk_r() { - logerror("%s: unk2_w %08x\n", machine().describe_context(), data); - m_unk2_write_count++; + // this is accessed as a byte, lower 2 bytes are read? + // slqz3 reads test switch in here? writes to the address look like key matrix? + logerror("%s: unk_r\n", machine().describe_context()); + return 0xffffffff; } u32 igs_m027_state::unk2_r() @@ -418,12 +460,10 @@ u32 igs_m027_state::lhdmg_unk2_r() return 0xffffffff ^ 0x400000; } -u32 igs_m027_state::unk_r() +void igs_m027_state::unk2_w(u32 data) { - // this is accessed as a byte, lower 2 bytes are read? - // slqz3 reads test switch in here? writes to the address look like key matrix? - logerror("%s: unk_r\n", machine().describe_context()); - return 0xffffffff; + logerror("%s: unk2_w %08x\n", machine().describe_context(), data); + m_unk2_write_count++; } @@ -449,7 +489,6 @@ void igs_m027_state::igs_mahjong(machine_config &config) m_ppi->in_pb_callback().set_ioport("PORTB"); m_ppi->in_pc_callback().set_ioport("PORTC"); - IGS017_IGS031(config, m_igs017_igs031, 0); m_igs017_igs031->set_text_reverse_bits(true); m_igs017_igs031->set_i8255_tag("ppi8255"); @@ -459,9 +498,17 @@ void igs_m027_state::igs_mahjong(machine_config &config) OKIM6295(config, m_oki, 1000000, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.5); } +void igs_m027_state::igs_mahjong_xor(machine_config &config) +{ + igs_mahjong(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &igs_m027_state::igs_mahjong_xor_map); +} + void igs_m027_state::extradraw(machine_config &config) { igs_mahjong(config); + m_maincpu->set_addrmap(AS_PROGRAM, &igs_m027_state::extradraw_map); } @@ -1361,13 +1408,13 @@ ROM_END void igs_m027_state::pgm_create_dummy_internal_arm_region() { - u16 *temp16 = (u16 *)memregion("maincpu")->base(); + auto const temp16 = util::little_endian_cast(reinterpret_cast(memregion("maincpu")->base())); // fill with RX 14 for (int i = 0; i < 0x4000 / 2; i += 2) { temp16[i] = 0xff1e; - temp16[ i +1] = 0xe12f; + temp16[i + 1] = 0xe12f; } @@ -1544,35 +1591,35 @@ void igs_m027_state::init_lhdmgp() ***************************************************************************/ // Complete dumps -GAME( 1999, slqz3, 0, igs_mahjong, base, igs_m027_state, init_slqz3, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 3 (China, VS107C)", MACHINE_NOT_WORKING ) -GAME( 1999, qlgs, 0, igs_mahjong, qlgs, igs_m027_state, init_qlgs, ROT0, "IGS", "Que Long Gao Shou", MACHINE_NOT_WORKING ) -GAME( 1999, fruitpar, 0, igs_mahjong, base, igs_m027_state, init_fruitpar, ROT0, "IGS", "Fruit Paradise (V214)", MACHINE_NOT_WORKING ) -GAME( 1999, fruitpara, fruitpar, igs_mahjong, base, igs_m027_state, init_fruitpar, ROT0, "IGS", "Fruit Paradise (V206US)", MACHINE_NOT_WORKING ) -GAME( 1999, lhdmg, 0, igs_mahjong, base, igs_m027_state, init_lhdmg, ROT0, "IGS", "Long Hu Da Man Guan", MACHINE_NOT_WORKING ) -GAME( 1999, lhdmgp, lhdmg, igs_mahjong, base, igs_m027_state, init_lhdmgp, ROT0, "IGS", "Long Hu Da Man Guan Plus", MACHINE_NOT_WORKING ) -GAME( 1999, lhzb3, 0, igs_mahjong, base, igs_m027_state, init_lhdmg, ROT0, "IGS", "Long Hu Zhengba III", MACHINE_NOT_WORKING ) // 龙虎争霸Ⅲ -GAME( 2004, lhzb4, 0, igs_mahjong, base, igs_m027_state, init_lhzb4, ROT0, "IGS", "Long Hu Zhengba 4", MACHINE_NOT_WORKING ) // 龙虎争霸4 -GAME( 1999, lthy, 0, igs_mahjong, base, igs_m027_state, init_lthy, ROT0, "IGS", "Long Teng Hu Yue", MACHINE_NOT_WORKING ) -GAME( 2000, zhongguo, 0, igs_mahjong, base, igs_m027_state, init_zhongguo, ROT0, "IGS", "Zhong Guo Chu Da D", MACHINE_NOT_WORKING ) -GAME( 200?, jking02, 0, igs_mahjong, jking02, igs_m027_state, init_jking02, ROT0, "IGS", "Jungle King 2002 (V209US)", MACHINE_NOT_WORKING ) -GAME( 2003, mgzz, 0, igs_mahjong, base, igs_m027_state, init_mgzz, ROT0, "IGS", "Man Guan Zhi Zun (V101CN)", MACHINE_NOT_WORKING ) -GAME( 2000, mgzza, mgzz, igs_mahjong, base, igs_m027_state, init_mgzz, ROT0, "IGS", "Man Guan Zhi Zun (V100CN)", MACHINE_NOT_WORKING ) -GAME( 2007, mgcs3, 0, igs_mahjong, base, igs_m027_state, init_mgcs3, ROT0, "IGS", "Man Guan Caishen 3 (V101CN)", MACHINE_NOT_WORKING ) -GAME( 1999, oceanpar, 0, igs_mahjong, base, igs_m027_state, init_oceanpar, ROT0, "IGS", "Ocean Paradise (V105US)", MACHINE_NOT_WORKING ) // 1999 copyright in ROM -GAME( 1999, oceanpara, oceanpar, igs_mahjong, base, igs_m027_state, init_oceanpar, ROT0, "IGS", "Ocean Paradise (V101US)", MACHINE_NOT_WORKING ) // 1999 copyright in ROM -GAME( 200?, extradrw, 0, extradraw, base, igs_m027_state, init_extradrw, ROT0, "IGS", "Extra Draw", MACHINE_NOT_WORKING ) +GAME( 1999, slqz3, 0, igs_mahjong_xor, base, igs_m027_state, init_slqz3, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 3 (China, VS107C)", MACHINE_NOT_WORKING ) +GAME( 1999, qlgs, 0, igs_mahjong_xor, qlgs, igs_m027_state, init_qlgs, ROT0, "IGS", "Que Long Gao Shou", MACHINE_NOT_WORKING ) +GAME( 1999, fruitpar, 0, igs_mahjong_xor, base, igs_m027_state, init_fruitpar, ROT0, "IGS", "Fruit Paradise (V214)", MACHINE_NOT_WORKING ) +GAME( 1999, fruitpara, fruitpar, igs_mahjong_xor, base, igs_m027_state, init_fruitpar, ROT0, "IGS", "Fruit Paradise (V206US)", MACHINE_NOT_WORKING ) +GAME( 1999, lhdmg, 0, igs_mahjong_xor, base, igs_m027_state, init_lhdmg, ROT0, "IGS", "Long Hu Da Man Guan", MACHINE_NOT_WORKING ) +GAME( 1999, lhdmgp, lhdmg, igs_mahjong_xor, base, igs_m027_state, init_lhdmgp, ROT0, "IGS", "Long Hu Da Man Guan Plus", MACHINE_NOT_WORKING ) +GAME( 1999, lhzb3, 0, igs_mahjong_xor, base, igs_m027_state, init_lhdmg, ROT0, "IGS", "Long Hu Zhengba III", MACHINE_NOT_WORKING ) // 龙虎争霸Ⅲ +GAME( 2004, lhzb4, 0, igs_mahjong_xor, base, igs_m027_state, init_lhzb4, ROT0, "IGS", "Long Hu Zhengba 4", MACHINE_NOT_WORKING ) // 龙虎争霸4 +GAME( 1999, lthy, 0, igs_mahjong_xor, base, igs_m027_state, init_lthy, ROT0, "IGS", "Long Teng Hu Yue", MACHINE_NOT_WORKING ) +GAME( 2000, zhongguo, 0, igs_mahjong_xor, base, igs_m027_state, init_zhongguo, ROT0, "IGS", "Zhong Guo Chu Da D", MACHINE_NOT_WORKING ) +GAME( 200?, jking02, 0, igs_mahjong_xor, jking02, igs_m027_state, init_jking02, ROT0, "IGS", "Jungle King 2002 (V209US)", MACHINE_NOT_WORKING ) +GAME( 2003, mgzz, 0, igs_mahjong_xor, base, igs_m027_state, init_mgzz, ROT0, "IGS", "Man Guan Zhi Zun (V101CN)", MACHINE_NOT_WORKING ) +GAME( 2000, mgzza, mgzz, igs_mahjong_xor, base, igs_m027_state, init_mgzz, ROT0, "IGS", "Man Guan Zhi Zun (V100CN)", MACHINE_NOT_WORKING ) +GAME( 2007, mgcs3, 0, igs_mahjong_xor, base, igs_m027_state, init_mgcs3, ROT0, "IGS", "Man Guan Caishen 3 (V101CN)", MACHINE_NOT_WORKING ) +GAME( 1999, oceanpar, 0, igs_mahjong_xor, base, igs_m027_state, init_oceanpar, ROT0, "IGS", "Ocean Paradise (V105US)", MACHINE_NOT_WORKING ) // 1999 copyright in ROM +GAME( 1999, oceanpara, oceanpar, igs_mahjong_xor, base, igs_m027_state, init_oceanpar, ROT0, "IGS", "Ocean Paradise (V101US)", MACHINE_NOT_WORKING ) // 1999 copyright in ROM +GAME( 200?, extradrw, 0, extradraw, base, igs_m027_state, init_extradrw, ROT0, "IGS", "Extra Draw", MACHINE_NOT_WORKING ) // these have an IGS025 protection device instead of the 8255 -GAME( 2002, chessc2, 0, igs_mahjong, base, igs_m027_state, init_chessc2, ROT0, "IGS", "Chess Challenge II", MACHINE_NOT_WORKING ) +GAME( 2002, chessc2, 0, igs_mahjong_xor, base, igs_m027_state, init_chessc2, ROT0, "IGS", "Chess Challenge II", MACHINE_NOT_WORKING ) // Incomplete dumps -GAME( 1999, amazonia, 0, igs_mahjong, amazonia, igs_m027_state, init_amazonia, ROT0, "IGS", "Amazonia King (V104BR)", MACHINE_NOT_WORKING ) -GAME( 1999, amazonkp, amazonia, igs_mahjong, amazonia, igs_m027_state, init_amazonia, ROT0, "IGS", "Amazonia King Plus (V204BR)", MACHINE_NOT_WORKING ) -GAME( 2005, olympic5, 0, igs_mahjong, base, igs_m027_state, init_olympic5, ROT0, "IGS", "Olympic 5 (V112US)", MACHINE_NOT_WORKING ) // IGS FOR V112US 2005 02 14 -GAME( 2003, olympic5a, olympic5, igs_mahjong, base, igs_m027_state, init_olympic5, ROT0, "IGS", "Olympic 5 (V107US)", MACHINE_NOT_WORKING ) // IGS FOR V107US 2003 10 2 -GAME( 200?, luckycrs, 0, igs_mahjong, base, igs_m027_state, init_luckycrs, ROT0, "IGS", "Lucky Cross (V106SA)", MACHINE_NOT_WORKING ) -GAME( 2003, amazoni2, 0, igs_mahjong, base, igs_m027_state, init_amazoni2, ROT0, "IGS", "Amazonia King II (V202BR)", MACHINE_NOT_WORKING ) -GAME( 2002, sdwx, 0, igs_mahjong, base, igs_m027_state, init_sdwx, ROT0, "IGS", "Sheng Dan Wu Xian", MACHINE_NOT_WORKING ) // aka Christmas 5 Line? (or Amazonia King II, shares roms at least?) -GAME( 200?, sddz, 0, igs_mahjong, base, igs_m027_state, init_sddz, ROT0, "IGS", "Super Dou Di Zhu", MACHINE_NOT_WORKING ) -GAME( 200?, klxyj, 0, igs_mahjong, base, igs_m027_state, init_klxyj, ROT0, "IGS", "Kuai Le Xi You Ji", MACHINE_NOT_WORKING ) +GAME( 1999, amazonia, 0, igs_mahjong, amazonia, igs_m027_state, init_amazonia, ROT0, "IGS", "Amazonia King (V104BR)", MACHINE_NOT_WORKING ) +GAME( 1999, amazonkp, amazonia, igs_mahjong, amazonia, igs_m027_state, init_amazonia, ROT0, "IGS", "Amazonia King Plus (V204BR)", MACHINE_NOT_WORKING ) +GAME( 2005, olympic5, 0, igs_mahjong, base, igs_m027_state, init_olympic5, ROT0, "IGS", "Olympic 5 (V112US)", MACHINE_NOT_WORKING ) // IGS FOR V112US 2005 02 14 +GAME( 2003, olympic5a, olympic5, igs_mahjong, base, igs_m027_state, init_olympic5, ROT0, "IGS", "Olympic 5 (V107US)", MACHINE_NOT_WORKING ) // IGS FOR V107US 2003 10 2 +GAME( 200?, luckycrs, 0, igs_mahjong, base, igs_m027_state, init_luckycrs, ROT0, "IGS", "Lucky Cross (V106SA)", MACHINE_NOT_WORKING ) +GAME( 2003, amazoni2, 0, igs_mahjong, base, igs_m027_state, init_amazoni2, ROT0, "IGS", "Amazonia King II (V202BR)", MACHINE_NOT_WORKING ) +GAME( 2002, sdwx, 0, igs_mahjong, base, igs_m027_state, init_sdwx, ROT0, "IGS", "Sheng Dan Wu Xian", MACHINE_NOT_WORKING ) // aka Christmas 5 Line? (or Amazonia King II, shares roms at least?) +GAME( 200?, sddz, 0, igs_mahjong, base, igs_m027_state, init_sddz, ROT0, "IGS", "Super Dou Di Zhu", MACHINE_NOT_WORKING ) +GAME( 200?, klxyj, 0, igs_mahjong, base, igs_m027_state, init_klxyj, ROT0, "IGS", "Kuai Le Xi You Ji", MACHINE_NOT_WORKING ) // these have an IGS025 protection device instead of the 8255 -GAME( 200?, gonefsh2, 0, igs_mahjong, base, igs_m027_state, init_gonefsh2, ROT0, "IGS", "Gone Fishing 2", MACHINE_NOT_WORKING ) +GAME( 200?, gonefsh2, 0, igs_mahjong, base, igs_m027_state, init_gonefsh2, ROT0, "IGS", "Gone Fishing 2", MACHINE_NOT_WORKING ) diff --git a/src/mame/igs/pgmcrypt.cpp b/src/mame/igs/pgmcrypt.cpp index dc23860e48f..deac38f19ed 100644 --- a/src/mame/igs/pgmcrypt.cpp +++ b/src/mame/igs/pgmcrypt.cpp @@ -1034,30 +1034,11 @@ void hauntedh_decrypt(running_machine &machine) } -static const uint8_t chessc2_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x30, 0x38, 0x32, 0x52, 0x44, 0x34, 0x30, 0x32, 0x31, 0x32, 0x31, 0x31, - 0x28, 0xca, 0x9c, 0xad, 0xbb, 0x2d, 0xf0, 0x41, 0x6e, 0xce, 0xad, 0x73, 0xae, 0x1c, 0xd1, 0x14, - 0x6f, 0x9a, 0x75, 0x18, 0xa8, 0x91, 0x68, 0xe4, 0x09, 0xf4, 0x0f, 0xd7, 0xff, 0x93, 0x7d, 0x1b, - 0xeb, 0x84, 0xce, 0xad, 0x9e, 0xcf, 0xc9, 0xab, 0x18, 0x59, 0xb6, 0xde, 0x82, 0x13, 0x7c, 0x88, - 0x69, 0x63, 0xff, 0x6f, 0x3c, 0xd2, 0xb9, 0x29, 0x09, 0xf8, 0x97, 0xaa, 0x74, 0xa5, 0x16, 0x0d, - 0xf9, 0x51, 0x9e, 0x9f, 0x63, 0xc6, 0x1e, 0x32, 0x8c, 0x0c, 0xe9, 0xa0, 0x56, 0x95, 0xd1, 0x9d, - 0xea, 0xa9, 0x82, 0xc3, 0x30, 0x15, 0x21, 0xd8, 0x8f, 0x10, 0x25, 0x61, 0xe6, 0x6d, 0x75, 0x6d, - 0xcb, 0x08, 0xc3, 0x9b, 0x03, 0x6a, 0x28, 0x6d, 0x42, 0xbf, 0x00, 0xd2, 0x24, 0xfa, 0x08, 0xee, - 0x6b, 0x46, 0xb7, 0x2c, 0x7b, 0xb0, 0xda, 0x86, 0x13, 0x14, 0x73, 0x14, 0x4d, 0x45, 0xd3, 0xd4, - 0xd9, 0x80, 0xf5, 0xb8, 0x76, 0x13, 0x1e, 0xf6, 0xb1, 0x4a, 0xb3, 0x8b, 0xe2, 0x9a, 0x5a, 0x11, - 0x64, 0x11, 0x55, 0xc3, 0x14, 0xfd, 0x1b, 0xce, 0x0c, 0xdc, 0x38, 0xda, 0xa1, 0x84, 0x66, 0xd9, - 0x9b, 0x93, 0xed, 0x0f, 0xb4, 0x19, 0x38, 0x62, 0x53, 0x85, 0xb9, 0xe5, 0x89, 0xcd, 0xfe, 0x9e, - 0x4d, 0xe2, 0x14, 0x9f, 0xf4, 0x53, 0x1c, 0x46, 0xf4, 0x40, 0x2c, 0xcc, 0xda, 0x82, 0x69, 0x15, - 0x88, 0x18, 0x62, 0xb7, 0xb4, 0xd5, 0xaf, 0x4b, 0x9e, 0x48, 0xca, 0xf4, 0x11, 0xec, 0x2d, 0x2c, - 0x9d, 0x91, 0xad, 0xda, 0x13, 0x0a, 0x16, 0x86, 0x41, 0x18, 0x08, 0x01, 0xef, 0x97, 0x11, 0x1f, - 0x1a, 0xe7, 0x0c, 0xc9, 0x6d, 0x9d, 0xb9, 0x49, 0x0b, 0x6b, 0x9e, 0xd4, 0x72, 0x4d, 0x1d, 0x59 -}; - void chessc2_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1072,8 +1053,6 @@ void chessc2_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= chessc2_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -1125,30 +1104,11 @@ void klxyj_decrypt(running_machine &machine) } } -static const uint8_t zhongguo_t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xb6, 0x90, 0x4c, 0x31, 0x70, 0x61, 0x4d, 0x02, 0xcc, 0x7b, 0xb1, 0x57, - 0x06, 0xa0, 0x4b, 0xe2, 0x31, 0xd9, 0xc2, 0x31, 0x45, 0xee, 0x42, 0x48, 0x6b, 0x26, 0x63, 0x7e, - 0x89, 0x40, 0x59, 0x9a, 0x09, 0xb1, 0x5e, 0x2d, 0xef, 0x20, 0x5c, 0x32, 0x1b, 0x20, 0xdf, 0xe5, - 0xda, 0x2d, 0x3b, 0xe1, 0xb4, 0xe9, 0xfa, 0x7d, 0x71, 0x97, 0x88, 0x68, 0x6d, 0xd8, 0x22, 0x82, - 0x1e, 0xa6, 0xfc, 0xfe, 0xe3, 0x8e, 0xb1, 0xb7, 0x0f, 0x32, 0xf1, 0xcf, 0x36, 0xfe, 0x65, 0x8e -}; - void zhongguo_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1163,8 +1123,6 @@ void zhongguo_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= zhongguo_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -1307,31 +1265,11 @@ void lhzb3_decrypt(running_machine &machine) // IGS FOR V000CN 2004 12 01 - -static const uint8_t lhzb4_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x31, 0x36, 0x39, 0x52, 0x44, 0x32, 0x30, 0x34, 0x30, 0x37, 0x33, 0x30, - 0x87, 0xa5, 0x22, 0x6e, 0x2f, 0x89, 0xc6, 0x3b, 0xf3, 0x4d, 0x29, 0xd5, 0x46, 0x17, 0x9c, 0x38, - 0xc2, 0xe4, 0x16, 0x4b, 0x36, 0xfd, 0xe0, 0x7f, 0xf2, 0xbe, 0x83, 0xa6, 0x52, 0x87,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0x39, 0xfb, 0x20, 0xad, 0x59, 0x3c, 0x6c, 0x86, 0x92, 0x56, 0x7d, 0x6f, 0xb0, - 0x29, 0x96, 0x7c, 0x9d, 0xbb, 0xfd, 0x83, 0xf9, 0x7f, 0xb5, 0x0a, 0xf8, 0xe6, 0x77, 0x71, 0x7b -}; - void lhzb4_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1346,8 +1284,6 @@ void lhzb4_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8_ALT - x ^= lhzb4_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -1473,30 +1409,11 @@ void pgm_decrypt_pgm3in1(running_machine &machine) // IGS MAHJONG CHINA VS107C -static const uint8_t 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) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x200000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1512,38 +1429,17 @@ void slqz3_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= slqz3_tab[(i/2) & 0xff] << 8; - src[i] = x; } } //IGS COPYRIGHT 1999.99.99 // V214US -static const uint8_t fruitpar_tab[0x100] = { - 0xe9, 0x0b, 0x95, 0x7e, 0x0d, 0x7d, 0x5c, 0x1e, 0x81, 0x0e, 0xa6, 0xd4, 0x8e, 0x90, 0xd8, 0x54, - 0x27, 0x65, 0x51, 0x08, 0x1c, 0xa0, 0x3b, 0x51, 0x83, 0x60, 0x93, 0x02, 0x64, 0x69, 0x77, 0x1a, - 0xa4, 0x03, 0xb0, 0xc2, 0x34, 0x18, 0x80, 0x87, 0x7a, 0x88, 0xad, 0xd9, 0xff, 0xd0, 0xce, 0xc4, - 0x5b, 0xdc, 0xd5, 0xed, 0x5e, 0x29, 0xdd, 0xcf, 0x80, 0x1f, 0x36, 0x38, 0x8b, 0xae, 0xae, 0xfe, - 0x87, 0x27, 0x22, 0x07, 0xe6, 0x5d, 0x46, 0x79, 0xf1, 0xfc, 0xb1, 0x3d, 0x72, 0x29, 0x2c, 0xba, - 0xa3, 0x5b, 0x3c, 0xcf, 0x57, 0x79, 0xed, 0x12, 0x67, 0x34, 0xe1, 0x48, 0x5f, 0xa7, 0x9a, 0x24, - 0x6a, 0x2e, 0x04, 0x44, 0x7b, 0x84, 0x46, 0x6a, 0xbd, 0x20, 0xca, 0xf7, 0x3e, 0xd1, 0x8b, 0xad, - 0xd7, 0x98, 0x9e, 0xa6, 0x5e, 0xc6, 0x04, 0x90, 0x0f, 0x57, 0xae, 0x2b, 0x38, 0x8d, 0xd2, 0x04, - 0x25, 0xd1, 0x6d, 0x73, 0x4b, 0xc6, 0x19, 0xd3, 0xb8, 0xae, 0x11, 0x01, 0xba, 0x02, 0x82, 0x17, - 0xcf, 0x4d, 0x14, 0x6a, 0xcd, 0x4a, 0xb9, 0xc1, 0x52, 0x3e, 0xb5, 0xd8, 0x6f, 0x98, 0xee, 0x16, - 0x90, 0xc6, 0x76, 0x8a, 0xaf, 0x5a, 0x56, 0x2b, 0xb9, 0x5e, 0x9e, 0x51, 0x40, 0xf4, 0xaa, 0x6e, - 0x63, 0x32, 0xb6, 0x12, 0xfb, 0x3c, 0xa5, 0x1f, 0x07, 0xa3, 0x0d, 0x49, 0x5a, 0xfe, 0x88, 0xd1, - 0x83, 0xc7, 0x37, 0x82, 0xfd, 0x78, 0x97, 0xec, 0x98, 0xe6, 0x88, 0xe0, 0x27, 0xde, 0x9a, 0x2c, - 0x6b, 0xfd, 0x9b, 0x98, 0x40, 0xd5, 0x5f, 0x20, 0x06, 0x3e, 0xcf, 0x74, 0x52, 0xf9, 0x35, 0xae, - 0xd6, 0x8c, 0xc7, 0x53, 0x8e, 0x59, 0x71, 0x8c, 0x2d, 0x00, 0xe7, 0xa5, 0xc7, 0xf8, 0xeb, 0xc7, - 0xbf, 0x68, 0xdc, 0xf2, 0xf4, 0x4c, 0x80, 0x3e, 0x27, 0xc5, 0x13, 0x52, 0xb0, 0xc0, 0x90, 0x25 -}; - void fruitpar_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); // not 100% verified for (int i = 0; i < rom_size / 2; i++) @@ -1559,36 +1455,15 @@ void fruitpar_decrypt(running_machine &machine) IGS27_CRYPT7_ALT IGS27_CRYPT8 - x ^= fruitpar_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } -static const uint8_t oceanpar_tab[0x100] = { - 0xad, 0xe8, 0xf9, 0xf2, 0x2e, 0x20, 0x6c, 0x06, 0xfe, 0xed, 0x42, 0xaf, 0x60, 0x33, 0x7e, 0xa4, - 0x6d, 0xac, 0x09, 0x5e, 0x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 0xe7, 0xbc, 0xfd, 0x06, 0x0a, - 0xa4, 0x97, 0x4c, 0x26, 0xed, 0xf3, 0xf3, 0x4d, 0x6d, 0xd4, 0x3c, 0x4a, 0xd3, 0xae, 0x30, 0xdf, - 0x15, 0xfe, 0xac, 0x3d, 0x1b, 0xe9, 0xae, 0xc5, 0xa9, 0x18, 0xdf, 0xfe, 0x92, 0xd3, 0x60, 0xd7, - 0x1b, 0x5c, 0xd9, 0x1e, 0xad, 0x8e, 0xc0, 0x40, 0xc0, 0xb7, 0xe7, 0x42, 0x04, 0xb2, 0x49, 0x00 -}; - void oceanpar_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); // not 100% verified for (int i = 0; i < rom_size / 2; i++) @@ -1604,8 +1479,6 @@ void oceanpar_decrypt(running_machine &machine) IGS27_CRYPT7_ALT IGS27_CRYPT8 - x ^= oceanpar_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -1728,31 +1601,11 @@ void pgm_dwpc_decrypt(running_machine &machine) } // IGS FOR V100CN 2007 04 18 in the ROM - -static const uint8_t mgcs3_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x32, 0x30, 0x37, 0x52, 0x44, 0x32, 0x30, 0x35, 0x30, 0x38, 0x30, 0x32, // IGS0207RD2050802 - 0x04, 0x12, 0x46, 0xbb, 0x23, 0x66, 0xae, 0x39, 0x71, 0x44, 0x17, 0xe1, 0x0b, 0xa7, 0x41, 0x7b, - 0xb3, 0xa2, 0x38, 0xe9, 0xb7, 0x39, 0xe8, 0x2b, 0x22, 0x82, 0xe4, 0x93, 0x22, 0xfc, 0x73, 0x44, - 0xb9, 0x30, 0xdc, 0xf1, 0xa8, 0x86, 0xf4, 0xd4, 0x98, 0x6a, 0xe5, 0xed, 0x8b, 0x9f, 0x40,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 0x26, 0x6a, 0x50, 0x25, 0x6c, 0x39, 0x45, 0xc3, 0x6b, 0x32 -}; - void mgcs3_decrypt(running_machine &machine) { - auto const src = util::little_endian_cast(reinterpret_cast(machine.root_device().memregion("user1")->base())); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1767,36 +1620,16 @@ void mgcs3_decrypt(running_machine &machine) IGS27_CRYPT7_ALT IGS27_CRYPT8 - x ^= mgcs3_tab[(i >> 1) & 0xff] << 8; - src[i] = x; } } -static const uint8_t mgzz_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x30, 0x38, 0x33, 0x52, 0x44, 0x34, 0x30, 0x32, 0x31, 0x32, 0x31, 0x32, // IGS0083RD4021212 - 0x82, 0x6b, 0xca, 0xbe, 0x9b, 0x9f, 0xc3, 0xa5, 0x8f, 0x2a, 0x9f, 0x0e, 0x26, 0x28, 0x4a, 0x9d, - 0xa2, 0x57, 0xfc, 0x43, 0xf3, 0x34, 0x05, 0x72, 0x1e, 0x59, 0xd9, 0xa0, 0xe7, 0x16, 0x5b, 0xff, - 0xc6, 0x4f, 0x6e, 0x7a, 0x09, 0x96, 0xba, 0xf3, 0x46, 0x89, 0xbb, 0xbc, 0x04, 0x6d, 0x11, 0x54, - 0xa9, 0x0b, 0x03, 0x63, 0xa6, 0xcb, 0x54, 0xf7, 0xe2, 0x0f, 0x4b, 0x01, 0x65, 0xd3, 0xfd, 0x0b, - 0x46, 0x82, 0xde, 0x3c, 0xd7, 0x1b, 0x87, 0x8e, 0x0e, 0x84, 0xca, 0x4d, 0x37, 0x2e, 0xf4, 0xd4, - 0xd8, 0xeb, 0x61, 0x84, 0xe5, 0x0c, 0x46, 0x05, 0x25, 0xbf, 0xbb, 0xc0, 0xe4, 0xa7, 0x07, 0x9d, - 0xda, 0xbd, 0x31, 0xfa, 0x5b, 0x66, 0xc3, 0xec, 0xc1, 0xd5, 0xe1, 0xb9, 0x17, 0xa4, 0x8b, 0x96, - 0x07, 0xae, 0x2f, 0x9d, 0x06, 0x30, 0x73, 0x12, 0xbe, 0x1f, 0x40, 0xd7, 0xbb, 0xcc, 0x12, 0x2d, - 0x5a, 0xb6, 0x7f, 0xad, 0xef, 0xb0, 0x06, 0x86, 0x36, 0x34, 0x1a, 0xf8, 0xfc, 0x06, 0x6f, 0x11, - 0x0e, 0x0c, 0x84, 0xa7, 0x62, 0x6d, 0x71, 0x97, 0x84, 0xe9, 0xf3, 0x3c, 0x44, 0x79, 0xb5, 0x32, - 0x9e, 0x27, 0xe1, 0x4c, 0xea, 0x30, 0xe7, 0xd4, 0x45, 0x57, 0x8d, 0x02, 0x3e, 0x8c, 0x38, 0xbf, - 0xc5, 0xbe, 0x79, 0x9b, 0x51, 0xfd, 0xdb, 0x0b, 0x51, 0xd5, 0xec, 0xe8, 0xd6, 0xe6, 0x89, 0x26, - 0x7e, 0xc8, 0x6f, 0xd1, 0xa4, 0x1e, 0xff, 0x4d, 0xc5, 0xf8, 0x51, 0xce, 0x36, 0x6f, 0x7d, 0x16, - 0x04, 0x7b, 0x26, 0x6f, 0x2c, 0x18, 0x47, 0xe8, 0xfc, 0x99, 0x42, 0xd3, 0xc9, 0x4c, 0x26, 0x7f, - 0xd2, 0x4f, 0x40, 0x32, 0x74, 0xb2, 0xe6, 0x6b, 0x90, 0xcf, 0x7f, 0x56, 0x3a, 0xe5, 0xd7, 0x8f -}; - +// IGS0083RD4021212 void mgzz_decrypt(running_machine &machine) { - auto const src = util::little_endian_cast(reinterpret_cast(machine.root_device().memregion("user1")->base())); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1811,8 +1644,6 @@ void mgzz_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= mgzz_tab[(i >> 1) & 0xff] << 8; - src[i] = x; } } @@ -1865,31 +1696,11 @@ void crzybugsj_decrypt(running_machine &machine) } // IGS MAHJONG S500CN - -static const uint8_t qlgs_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x30, 0x39, 0x38, 0x52, 0x44, 0x34, 0x30, 0x36, 0x30, 0x38, 0x32, 0x38, // IGS0098RD4060828 - 0x64, 0x8d, 0x4a, 0x0c, 0xd4, 0x50, 0xd6, 0xea, 0x9e, 0x5a, 0xd6, 0x31, 0xef, 0x59, 0xbf, 0x13, - 0x09, 0x4b, 0x27, 0x4e, 0x20, 0x0b, 0xbb, 0x5d, 0x79, 0x1b, 0x7e, 0xde, 0xc6, 0xb3, 0x44, 0x43, - 0xbb, 0x0b, 0x6e, 0xbd, 0xf6, 0xe6, 0xe7, 0x65, 0x0e, 0x5f, 0x5f, 0xad, 0xf9, 0xf8, 0xc7, 0x06, - 0xa3, 0xe0, 0x0d, 0xd3, 0xcc, 0x85, 0x19, 0x8e, 0x23, 0x5a, 0x08, 0x39, 0xa1, 0xea, 0xa8, 0x08, - 0x27, 0x1e, 0x34, 0x4d, 0x5b, 0xcb, 0x51, 0xa3, 0xc0, 0x7f, 0x48, 0x5f, 0x14, 0x8d, 0x86, 0x33, - 0xee, 0x56, 0x51, 0x24, 0x98, 0xdb, 0xcd, 0xaf, 0x2b, 0x80, 0x2e, 0x38, 0xe9, 0x23, 0x3f, 0xb3, - 0xdf, 0x5d, 0x14, 0x95, 0xbc, 0x17, 0x0b, 0xfd, 0xec, 0x51, 0x0a, 0x1f, 0xf8, 0x2f, 0xf3, 0xf1, - 0x22, 0x45, 0x6b, 0x1a, 0x3c, 0x24, 0xcd, 0x17, 0xc9, 0x25, 0x69, 0xb0, 0x57, 0x75, 0x01, 0x9a, - 0x1c, 0x61, 0x86, 0x6e, 0xd0, 0xe3, 0x0f, 0xca, 0xca, 0x6e, 0x1a, 0xc5, 0x5e, 0xf7, 0x08, 0x98, - 0x75, 0x44, 0xd3, 0x8b, 0x6e, 0x79, 0x11, 0x1e, 0x35, 0xe0, 0x2e, 0x7a, 0xa2, 0xf8, 0xe6, 0x17, - 0x15, 0xc1, 0x01, 0xae, 0x4f, 0x47, 0x53, 0x61, 0x92, 0x6d, 0xf3, 0x29, 0xfc, 0xfc, 0xbb, 0x81, - 0x21, 0xec, 0x00, 0x51, 0xe8, 0xf1, 0x93, 0x1d, 0xa8, 0x49, 0xf8, 0x6e, 0x83, 0xc5, 0xe5, 0x81, - 0x02, 0x16, 0xff, 0x2e, 0xf1, 0x5a, 0xd0, 0x1c, 0x7d, 0xe7, 0x0c, 0x23, 0x8d, 0x57, 0x05, 0x02, - 0x5e, 0xd4, 0x6b, 0x42, 0x61, 0xa5, 0x49, 0x6a, 0x59, 0xfa, 0x3d, 0x64, 0xb1, 0xf4, 0xf8, 0x2f, - 0x1b, 0xf8, 0xf6, 0xc7, 0x6f, 0x35, 0x7e, 0x52, 0xc3, 0x74, 0xdc, 0x8c, 0xc6, 0x20, 0xde, 0x74 -}; - void qlgs_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1905,36 +1716,16 @@ void qlgs_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= qlgs_tab[(i >> 1) & 0xff] << 8; - src[i] = x; } } -static const uint8_t jking02_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x34, 0x52, 0x44, 0x34, 0x30, 0x31, 0x30, 0x39, 0x32, 0x31, // IGS0004RD4010921 - 0xa5, 0x04, 0x3d, 0x57, 0xe3, 0x8d, 0x44, 0xf3, 0x50, 0x21, 0x8a, 0xe5, 0x75, 0x22, 0x3a, 0xb3, - 0xd5, 0x76, 0x66, 0x07, 0x89, 0xd4, 0xb8, 0x96, 0x20, 0x4e, 0x77, 0x53, 0xb5, 0x20, 0xbd, 0xd6, - 0x52, 0xb8, 0xf7, 0x07, 0x85, 0x05, 0x9d, 0x0f, 0x41, 0x04, 0x33, 0x80, 0xf7, 0x89, 0x81, 0xc3, - 0xf5, 0x4b, 0x0e, 0xc2, 0xfe, 0x33, 0xe3, 0xd7, 0x2b, 0xe6, 0x7e, 0xf5, 0x02, 0x91, 0x14, 0x15, - 0xd4, 0xf4, 0x0c, 0xe4, 0x5c, 0xb2, 0xb8, 0xab, 0x95, 0xd7, 0x56, 0x7e, 0xdc, 0xaa, 0x47, 0xa9, - 0x47, 0xb6, 0x8e, 0x57, 0x44, 0x13, 0x8c, 0x84, 0x76, 0xfa, 0xfa, 0x26, 0xcc, 0x89, 0x27, 0x97, - 0xe3, 0xd2, 0x74, 0x46, 0x9f, 0x2b, 0x0d, 0x9f, 0x04, 0xb1, 0xe9, 0x37, 0x5a, 0x1e, 0x05, 0x3c, - 0x82, 0xce, 0xdc, 0x1d, 0x92, 0x0c, 0x2a, 0x75, 0xb8, 0xa1, 0xe3, 0x3e, 0x4d, 0x9f, 0x6e, 0x33, - 0x38, 0x6a, 0x26, 0x85, 0x86, 0x08, 0x13, 0xc3, 0x47, 0xab, 0xe5, 0x04, 0xab, 0x7d, 0x32, 0x56, - 0x5e, 0xab, 0xf1, 0x6b, 0x21, 0xb4, 0x37, 0x82, 0xa9, 0xf4, 0x30, 0x94, 0xbc, 0x6c, 0x61, 0xc1, - 0x8a, 0xd3, 0x1c, 0xfa, 0x49, 0xe3, 0x44, 0xef, 0x15, 0xdd, 0x42, 0x3b, 0x07, 0x5e, 0x48, 0xce, - 0x94, 0x66, 0xc5, 0x9b, 0x27, 0xa6, 0x29, 0x84, 0x02, 0x0a, 0xdb, 0x82, 0x52, 0x87, 0x77, 0x19, - 0x91, 0x26, 0x4c, 0xfb, 0x21, 0x51, 0x16, 0xfb, 0x26, 0x5e, 0xf8, 0x35, 0xa5, 0x5a, 0xbd, 0x7c, - 0xda, 0x17, 0x50, 0x04, 0xde, 0x78, 0x79, 0x51, 0x7a, 0xfc, 0xda, 0x5f, 0x46, 0x89, 0x29, 0x13, - 0x06, 0x7b, 0xaf, 0xe2, 0x46, 0xed, 0x02, 0xc0, 0x33, 0x46, 0xff, 0x4b, 0xbd, 0x08, 0x0a, 0x38 -}; - +// IGS0004RD4010921 void jking02_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -1950,8 +1741,6 @@ void jking02_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= jking02_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -2228,30 +2017,12 @@ void wldfruit_decrypt(running_machine &machine) } -static const uint8_t lthy_tab[0x100] = { // IGS MAHJONG CHINA S104CN - 0x08, 0xb1, 0x64, 0x36, 0x90, 0xfa, 0x88, 0xbf, 0xca, 0xd6, 0xcf, 0x87, 0x5b, 0x88, 0xf7, 0xc6, - 0x32, 0xfe, 0x7d, 0xcc, 0xc2, 0x3d, 0xfb, 0x0c, 0x81, 0x0c, 0xc2, 0x6c, 0xa0, 0xe0, 0xb3, 0xcc, - 0x0d, 0x08, 0x63, 0xd5, 0xa7, 0x19, 0x6f, 0x03, 0xc1, 0x9c, 0x1c, 0xf6, 0xd9, 0xf7, 0x33, 0xf5, - 0x9a, 0x99, 0x1c, 0xc3, 0x0f, 0x6a, 0x3a, 0xa7, 0x29, 0x71, 0x86, 0xb6, 0x75, 0xc8, 0x6e, 0x64, - 0x16, 0xbd, 0xf0, 0x4a, 0x09, 0x4a, 0xf3, 0x39, 0x9a, 0xb7, 0xe5, 0x81, 0x21, 0x8e, 0x9b, 0x7b, - 0x02, 0xbf, 0x65, 0x5d, 0xe4, 0x14, 0x71, 0x3f, 0x31, 0xd8, 0x62, 0x68, 0xcf, 0xc3, 0x31, 0xdf, - 0x1c, 0x2a, 0x43, 0x2e, 0x2f, 0x64, 0xcc, 0x79, 0x4e, 0x7f, 0x63, 0xc0, 0xab, 0x24, 0xe6, 0x71, - 0x64, 0xc8, 0x91, 0x31, 0xba, 0x15, 0x5a, 0xec, 0x90, 0x98, 0x8f, 0x1b, 0x26, 0xab, 0xb2, 0x55, - 0x17, 0xa5, 0x95, 0x19, 0x91, 0x41, 0xb2, 0xda, 0xd5, 0x4d, 0xcd, 0x4c, 0xef, 0x94, 0xcd, 0xee, - 0xb6, 0x0c, 0xd6, 0xd8, 0x06, 0x44, 0xac, 0xc7, 0x3d, 0x09, 0x44, 0x66, 0xf4, 0x58, 0xac, 0xdf, - 0xff, 0x88, 0x1d, 0xa2, 0xa7, 0xb8, 0x5e, 0x75, 0x27, 0x77, 0x5b, 0xbd, 0x64, 0xb3, 0x06, 0x0b, - 0xf1, 0xe4, 0x6f, 0xea, 0x43, 0x79, 0x1f, 0xe8, 0x31, 0x82, 0xb9, 0xe2, 0xaf, 0xa0, 0xd4, 0x95, - 0xcc, 0x2a, 0x13, 0x62, 0xe9, 0xa1, 0x86, 0x61, 0x3b, 0x56, 0x46, 0xaa, 0x84, 0x5a, 0x4b, 0xe0, - 0x0d, 0xa6, 0x91, 0xfe, 0xe8, 0x8c, 0x6b, 0x66, 0x64, 0x5d, 0x27, 0x27, 0xd0, 0x5c, 0xe4, 0x8e, - 0x75, 0xe3, 0xaf, 0xf1, 0xce, 0xd4, 0xe5, 0xb7, 0x0a, 0x43, 0xc5, 0xac, 0xc5, 0x61, 0x54, 0x84, - 0x02, 0xac, 0x76, 0xad, 0x6c, 0x55, 0x49, 0x59, 0xce, 0xf1, 0xc5, 0xcc, 0xd0, 0x64, 0x93, 0xe3 -}; - +// IGS MAHJONG CHINA S104CN void lthy_decrypt(running_machine &machine) { - auto const src = reinterpret_cast(machine.root_device().memregion("user1")->base()); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -2266,37 +2037,16 @@ void lthy_decrypt(running_machine &machine) IGS27_CRYPT7 // ? IGS27_CRYPT8 // correct 12c0 - x ^= lthy_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } -static const uint8_t lhdmg_tab[0x100] = { - 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, - 0xef, 0xdf, 0x90, 0x60, 0x46, 0x43, 0x33, 0x38, 0x92, 0x2d, 0x5a, 0x08, 0x0d, 0x2f, 0x05, 0x75, - 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, - 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, - 0x07, 0x00, 0x12, 0x61, 0x77, 0xa8, 0x15, 0xa1, 0xd6, 0xd0, 0xd3, 0x57, 0x73, 0x62, 0xb9, 0xbb -}; - void lhdmg_decrypt(running_machine &machine) { - auto const src = util::little_endian_cast(reinterpret_cast(machine.root_device().memregion("user1")->base())); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -2311,37 +2061,16 @@ void lhdmg_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= lhdmg_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } -static const uint8_t lhdmgp_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x30, 0x36, 0x34, 0x52, 0x44, 0x34, 0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 0x97, 0x89, 0x53, 0xd7, 0xab, 0x64, 0xc8, 0x6d, 0xa9, 0x60, 0x2f, 0x33, 0xda, 0xb6, 0xde, - 0xf6, 0x95, 0x15, 0x86, 0x1c, 0x6c, 0xb9, 0x05, 0xe0, 0x96, 0xca, 0x67, 0xcd, 0x9d, 0xf7, 0x3d, - 0x7c, 0x48, 0x53, 0x23, 0x91, 0xcb, 0x6f, 0x8c, 0xf4, 0x2e, 0xb9, 0xd1, 0x4d, 0xfb, 0x15, 0x7a, - 0xc2, 0x2b, 0xb9, 0xcb, 0xf5, 0x53, 0x4e, 0x93, 0x38, 0x0b, 0x45, 0x31, 0x13, 0x9f, 0x76, 0xe7 -}; - void lhdmgp_decrypt(running_machine &machine) { - auto const src = util::little_endian_cast(reinterpret_cast(machine.root_device().memregion("user1")->base())); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { @@ -2356,8 +2085,6 @@ void lhdmgp_decrypt(running_machine &machine) IGS27_CRYPT7 IGS27_CRYPT8 - x ^= lhdmgp_tab[(i>> 1) & 0xff] << 8; - src[i] = x; } } @@ -2366,9 +2093,9 @@ void lhdmgp_decrypt(running_machine &machine) void extradrw_decrypt(running_machine &machine) { - auto const src = util::little_endian_cast(reinterpret_cast(machine.root_device().memregion("user1")->base())); - - int const rom_size = 0x80000; + memory_region *const region = machine.root_device().memregion("user1"); + auto const src = util::little_endian_cast(reinterpret_cast(region->base())); + auto const rom_size = region->bytes(); for (int i = 0; i < rom_size / 2; i++) { -- cgit v1.2.3