igs/pgm.cpp, igs/pgmcrypt.cpp: Use uploaded XOR tables for some games with their IGS027A internal ROMs dumped. (#12736)

This commit is contained in:
mamehaze 2024-09-05 17:14:43 +01:00 committed by GitHub
parent a186cda2f4
commit b1909d925a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 93 deletions

View File

@ -291,25 +291,6 @@ void pgm_dfront_decrypt(running_machine &machine)
}
static const uint8_t ddp2_tab[256] = {
0x2a, 0x4a, 0x39, 0x98, 0xac, 0x39, 0xb2, 0x55, 0x72, 0xf3, 0x7b, 0x3c, 0xee, 0x94, 0x6e, 0xd5,
0xcd, 0xbc, 0x9a, 0xd0, 0x45, 0x7d, 0x49, 0x68, 0xb1, 0x61, 0x54, 0xef, 0xa2, 0x84, 0x29, 0x20,
0x32, 0x52, 0x82, 0x04, 0x38, 0x69, 0x9f, 0x24, 0x46, 0xf4, 0x3f, 0xc2, 0xf1, 0x25, 0xac, 0x2d,
0xdf, 0x2d, 0xb4, 0x51, 0xc7, 0xb5, 0xe5, 0x88, 0xbd, 0x3b, 0x5a, 0x25, 0x5b, 0xc7, 0xae, 0x5f,
0x43, 0xcf, 0x89, 0xd9, 0xe2, 0x63, 0xc6, 0x76, 0x21, 0x2b, 0x77, 0xc0, 0x27, 0x98, 0xfd, 0x09,
0xe1, 0x8c, 0x26, 0x2e, 0x92, 0x99, 0xbc, 0xbe, 0x0e, 0xba, 0xbf, 0x70, 0xe7, 0xb7, 0xe9, 0x37,
0x5c, 0xd1, 0x5e, 0xad, 0x22, 0x17, 0xc5, 0x67, 0x9d, 0xc6, 0xfb, 0x53, 0xc7, 0x4d, 0x32, 0xb4,
0xf2, 0x43, 0x53, 0x7c, 0x01, 0xfe, 0xd2, 0x91, 0x40, 0x85, 0xa3, 0xe8, 0xdf, 0xdb, 0xff, 0x6c,
0x64, 0x15, 0xcd, 0x8e, 0x07, 0x82, 0x78, 0x8d, 0x4e, 0x2d, 0x66, 0x8a, 0x62, 0x6f, 0xd3, 0x6a,
0xae, 0x16, 0x44, 0x1e, 0xed, 0xc4, 0x12, 0x7a, 0xbe, 0x05, 0x06, 0xce, 0x9b, 0x8a, 0xf7, 0xf8,
0x74, 0x23, 0x73, 0x74, 0xb8, 0x13, 0xc2, 0x42, 0xea, 0xf9, 0x7f, 0xa9, 0xaf, 0x56, 0xd6, 0xb3,
0xb7, 0xc4, 0x47, 0x31, 0x67, 0xaa, 0x58, 0x8b, 0x47, 0x1b, 0xf5, 0x75, 0x95, 0x8f, 0xf0, 0x3a,
0x85, 0x76, 0x59, 0x24, 0x0c, 0xd7, 0x00, 0xb3, 0xdc, 0xfc, 0x65, 0x34, 0xde, 0xfa, 0xd8, 0xc3,
0xc3, 0x5e, 0xe3, 0x9e, 0x02, 0x28, 0x50, 0x81, 0x95, 0x2f, 0xe4, 0xb5, 0xa0, 0x4d, 0xa1, 0x36,
0x9d, 0x18, 0x6d, 0x79, 0x19, 0x3b, 0x1d, 0xb8, 0xe1, 0xcc, 0x61, 0x1a, 0xe2, 0x31, 0x4c, 0x3f,
0xdc, 0xca, 0xd4, 0xda, 0xcd, 0xd2, 0x83, 0xca, 0xeb, 0x4f, 0xf2, 0x2f, 0x2d, 0x2a, 0xec, 0x1f
};
void pgm_ddp2_decrypt(running_machine &machine)
{
auto const src = reinterpret_cast<u16 *>(machine.root_device().memregion("user1")->base());
@ -329,32 +310,10 @@ void pgm_ddp2_decrypt(running_machine &machine)
IGS27_CRYPT7_ALT
IGS27_CRYPT8_ALT
x ^= ddp2_tab[(i>> 1) & 0xff] << 8;
src[i] = x;
}
}
static const uint8_t mm_tab[256] = {
0xd0, 0x45, 0xbc, 0x84, 0x93, 0x60, 0x7d, 0x49, 0x68, 0xb1, 0x54, 0xa2, 0x05, 0x29, 0x41, 0x20,
0x04, 0x08, 0x52, 0x25, 0x89, 0xf4, 0x69, 0x9f, 0x24, 0x46, 0x3d, 0xf1, 0xf9, 0xab, 0xa6, 0x2d,
0x18, 0x19, 0x6d, 0x33, 0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c9, 0xcc, 0x32, 0x1c, 0xb4,
0xd9, 0xe2, 0xcf, 0x90, 0xb9, 0x2b, 0x63, 0xc6, 0x76, 0x21, 0x77, 0x27, 0xfc, 0xfd, 0x0a, 0x09,
0x7c, 0x01, 0x43, 0xdb, 0x53, 0x85, 0xfe, 0x78, 0x91, 0x40, 0xa3, 0xdf, 0x4f, 0xff, 0x10, 0x6c
};
void pgm_mm_decrypt(running_machine &machine) // and dw2001
{
auto const src = reinterpret_cast<u16 *>(machine.root_device().memregion("user1")->base());
@ -374,30 +333,11 @@ void pgm_mm_decrypt(running_machine &machine) // and dw2001
IGS27_CRYPT7
IGS27_CRYPT8_ALT
x ^= mm_tab[(i>> 1) & 0xff] << 8;
src[i] = x;
}
}
static const uint8_t kov2_tab[256] = {
0x11, 0x4a, 0x38, 0x98, 0xac, 0x39, 0xb2, 0x55, 0x72, 0xf3, 0x7b, 0x3c, 0xee, 0x94, 0x6e, 0xd5,
0x41, 0xbc, 0x93, 0xd0, 0x45, 0x7d, 0x49, 0x68, 0xb1, 0x60, 0x54, 0xef, 0xa2, 0x84, 0x29, 0x20,
0xa6, 0x52, 0x89, 0x04, 0x08, 0x69, 0x9f, 0x24, 0x46, 0xf4, 0x3d, 0xc3, 0xf1, 0x25, 0xab, 0x2d,
0xe6, 0x2c, 0xa4, 0x51, 0xa7, 0xb5, 0xe5, 0x88, 0xbd, 0x0b, 0x5a, 0x35, 0x5b, 0xc7, 0xae, 0x5f,
0x0a, 0xcf, 0xb9, 0xd9, 0xe2, 0x63, 0xc6, 0x76, 0x21, 0x2b, 0x77, 0xc0, 0x27, 0x90, 0xfd, 0x09,
0x30, 0x8c, 0x96, 0x2e, 0x92, 0x99, 0xbb, 0xbe, 0x0e, 0xba, 0xbf, 0x80, 0xe7, 0xb7, 0xe9, 0x37,
0x1c, 0xd1, 0x5c, 0xad, 0x22, 0x17, 0xc5, 0x67, 0x9d, 0xf6, 0xfb, 0x23, 0xc9, 0x4b, 0x32, 0xb4,
0x10, 0x43, 0x53, 0x7c, 0x01, 0xfe, 0x78, 0x91, 0x40, 0x85, 0xa3, 0xe8, 0xdf, 0xdb, 0xff, 0x6c,
0xb6, 0x15, 0xcb, 0x8e, 0x07, 0x82, 0x70, 0x8d, 0x4e, 0xdd, 0x66, 0x7a, 0x62, 0x6f, 0xd3, 0x6a,
0x3e, 0x16, 0x44, 0x1e, 0xed, 0x64, 0x12, 0x9a, 0x7e, 0x05, 0x06, 0xce, 0x9b, 0x8a, 0xf7, 0xf8,
0x03, 0x26, 0x71, 0x74, 0xa8, 0x13, 0xc2, 0x42, 0xea, 0xf9, 0x7f, 0xa9, 0xaf, 0x56, 0xd6, 0xb3,
0x57, 0xc4, 0x47, 0x31, 0x6b, 0xaa, 0x58, 0x8b, 0x48, 0x1b, 0xf5, 0x75, 0x95, 0x8f, 0xf0, 0x3a,
0x87, 0x73, 0x59, 0x14, 0x0c, 0xd7, 0x00, 0xb0, 0xdc, 0xfc, 0x65, 0x34, 0xde, 0xfa, 0xd8, 0xc1,
0x86, 0x5e, 0xe3, 0x9e, 0x02, 0x28, 0x50, 0x81, 0x97, 0x2f, 0xe4, 0xa5, 0xa0, 0x4d, 0xa1, 0x36,
0x5d, 0x18, 0x6d, 0x79, 0x19, 0x3b, 0x1d, 0xb8, 0xe1, 0xcc, 0x61, 0x1a, 0xe0, 0x33, 0x4c, 0x3f,
0x9c, 0xc8, 0xd4, 0xda, 0xcd, 0xd2, 0x83, 0xca, 0xeb, 0x4f, 0xf2, 0x0f, 0x0d, 0x2a, 0xec, 0x1f
};
void pgm_kov2_decrypt(running_machine &machine)
{
@ -418,31 +358,10 @@ void pgm_kov2_decrypt(running_machine &machine)
IGS27_CRYPT7_ALT
IGS27_CRYPT8_ALT
x ^= kov2_tab[(i >> 1) & 0xff] << 8;
src[i] = x;
}
}
static const uint8_t kov2p_tab[256] = {
0x44, 0x47, 0xb8, 0x28, 0x03, 0xa2, 0x21, 0xbc, 0x17, 0x32, 0x4e, 0xe2, 0xd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, 0x73, 0x69, 0x27, 0xbc, 0x80, 0xdf, 0x30, 0xa4, 0x05, 0xd8,
0xe7, 0xd2, 0xb7, 0x4b, 0x3c, 0x10, 0x8c, 0x5d, 0x8a, 0xd7, 0x68, 0x7a, 0x61, 0x07, 0xf9, 0xa5,
0x88, 0xda, 0xdf, 0x0c, 0x42, 0x1b, 0x11, 0xe0, 0xd1, 0x93, 0x7c, 0x63, 0x39, 0xc5, 0xed, 0x43,
0x46, 0xdb, 0x30, 0x26, 0xd0, 0xdf, 0x7a, 0x86, 0x3e, 0x2e, 0x04, 0xbf, 0x49, 0x2a, 0xf9, 0x66
};
void pgm_kov2p_decrypt(running_machine &machine)
{
auto const src = reinterpret_cast<u16 *>(machine.root_device().memregion("user1")->base());
@ -462,8 +381,6 @@ void pgm_kov2p_decrypt(running_machine &machine)
IGS27_CRYPT7
IGS27_CRYPT8_ALT
x ^= kov2p_tab[(i >> 1) & 0xff] << 8;
src[i] = x;
}
}
@ -1506,8 +1423,6 @@ void pgm_dwpc_decrypt(running_machine &machine)
IGS27_CRYPT7_ALT
IGS27_CRYPT8
x ^= mm_tab[(i>> 1) & 0xff] << 8;
src[i] = x;
}
}

View File

@ -113,16 +113,25 @@ void pgm_arm_type2_state::kov2_mem(address_map &map)
map(0xd10000, 0xd10001).rw(FUNC(pgm_arm_type2_state::arm7_latch_68k_r), FUNC(pgm_arm_type2_state::arm7_latch_68k_w)); /* ARM7 Latch */
}
u32 pgm_arm_type2_state::external_rom_r(offs_t offset)
{
return m_external_rom[offset] ^ m_xor_table[offset & 0x00ff];
}
void pgm_arm_type2_state::xor_table_w(offs_t offset, u8 data)
{
m_xor_table[offset] = (u32(data) << 24) | (u32(data) << 8);
}
void pgm_arm_type2_state::_55857F_arm7_map(address_map &map)
{
map(0x00000000, 0x00003fff).rom();
map(0x08000000, 0x083fffff).rom().region("user1", 0);
map(0x08000000, 0x083fffff).rom().r(FUNC(pgm_arm_type2_state::external_rom_r));
map(0x10000000, 0x100003ff).ram();
map(0x18000000, 0x1800ffff).ram().share("arm_ram");
map(0x38000000, 0x38000003).rw(FUNC(pgm_arm_type2_state::arm7_latch_arm_r), FUNC(pgm_arm_type2_state::arm7_latch_arm_w)); /* 68k Latch */
map(0x48000000, 0x4800ffff).rw(FUNC(pgm_arm_type2_state::arm7_shareram_r), FUNC(pgm_arm_type2_state::arm7_shareram_w)).share("arm7_shareram");
map(0x50000000, 0x500003ff).ram();
map(0x50000000, 0x500003ff).ram().umask32(0x000000ff).w(FUNC(pgm_arm_type2_state::xor_table_w));
}
/******* ARM 55857F *******/
@ -150,9 +159,11 @@ void pgm_arm_type2_state::kov2_latch_init()
{
m_kov2_latchdata_68k_w = 0;
m_kov2_latchdata_arm_w = 0;
std::fill(std::begin(m_xor_table), std::end(m_xor_table), 0);
save_item(NAME(m_kov2_latchdata_68k_w));
save_item(NAME(m_kov2_latchdata_arm_w));
save_item(NAME(m_xor_table));
}
void pgm_arm_type2_state::kov2_arm_region_w(offs_t offset, u32 data, u32 mem_mask)

View File

@ -4,12 +4,15 @@
class pgm_arm_type2_state : public pgm_state
{
public:
pgm_arm_type2_state(const machine_config &mconfig, device_type type, const char *tag)
: pgm_state(mconfig, type, tag),
m_arm_ram(*this, "arm_ram"),
m_arm7_shareram(*this, "arm7_shareram"),
m_prot(*this, "prot") {
pgm_arm_type2_state(const machine_config &mconfig, device_type type, const char *tag) :
pgm_state(mconfig, type, tag),
m_arm_ram(*this, "arm_ram"),
m_arm7_shareram(*this, "arm7_shareram"),
m_prot(*this, "prot"),
m_external_rom(*this, "user1")
{
}
void init_kov2();
void init_kov2p();
void init_martmast();
@ -30,7 +33,12 @@ private:
required_shared_ptr<u32> m_arm7_shareram;
optional_device<cpu_device> m_prot;
required_region_ptr<u32> m_external_rom;
u32 m_xor_table[0x100];
u32 external_rom_r(offs_t offset);
void xor_table_w(offs_t offset, u8 data);
u32 arm7_latch_arm_r(offs_t offset, u32 mem_mask = ~0);
void arm7_latch_arm_w(offs_t offset, u32 data, u32 mem_mask = ~0);
u32 arm7_shareram_r(offs_t offset, u32 mem_mask = ~0);