mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
pgm2 : use uploaded tables for kov2nl / orleg2 [David Haywood] (#2906)
pgm2 : use uploaded tables for kov2nl / orleg2 [David Haywood]
This commit is contained in:
parent
e66ea1de8d
commit
cc626ab319
@ -90,6 +90,27 @@ READ32_MEMBER(pgm2_state::rtc_r)
|
||||
return machine().time().seconds();
|
||||
}
|
||||
|
||||
READ8_MEMBER(pgm2_state::encryption_r)
|
||||
{
|
||||
return m_encryption_table[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pgm2_state::encryption_w)
|
||||
{
|
||||
m_encryption_table[offset] = data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(pgm2_state::encryption_do_w)
|
||||
{
|
||||
if (m_has_decrypted == 0)
|
||||
{
|
||||
igs036_decryptor decrypter(m_encryption_table);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INTERRUPT_GEN_MEMBER(pgm2_state::igs_interrupt)
|
||||
{
|
||||
m_arm_aic->set_irq(0x47);
|
||||
@ -150,7 +171,7 @@ static ADDRESS_MAP_START( pgm2_map, AS_PROGRAM, 32, pgm2_state )
|
||||
|
||||
// internal to IGS036? - various other writes down here on startup too - could be other standard ATMEL peripherals like the ARM_AIC mixed with custom bits
|
||||
AM_RANGE(0xffffec00, 0xffffec5f) AM_RAM
|
||||
AM_RANGE(0xfffffc00, 0xfffffcff) AM_RAM // confirmed as encryption table for main program rom (see code at 3950)
|
||||
AM_RANGE(0xfffffc00, 0xfffffcff) AM_READWRITE8(encryption_r,encryption_w, 0xffffffff) // confirmed as encryption table for main program rom (see code at 3950)
|
||||
|
||||
AM_RANGE(0xfffff000, 0xfffff14b) AM_DEVICE("arm_aic", arm_aic_device, regs_map)
|
||||
|
||||
@ -159,7 +180,7 @@ static ADDRESS_MAP_START( pgm2_map, AS_PROGRAM, 32, pgm2_state )
|
||||
|
||||
AM_RANGE(0xfffffd28, 0xfffffd2b) AM_READ(rtc_r)
|
||||
|
||||
// AM_RANGE(0xfffffa08, 0xfffffa0b) AM_WRITE(table_done_w) // after uploading encryption? table might actually send it or enable external ROM?
|
||||
AM_RANGE(0xfffffa08, 0xfffffa0b) AM_WRITE(encryption_do_w) // after uploading encryption? table might actually send it or enable external ROM?
|
||||
AM_RANGE(0xfffffa0c, 0xfffffa0f) AM_READ(unk_startup_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -266,6 +287,8 @@ WRITE_LINE_MEMBER(pgm2_state::irq)
|
||||
|
||||
void pgm2_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_encryption_table));
|
||||
save_item(NAME(m_has_decrypted));
|
||||
}
|
||||
|
||||
void pgm2_state::machine_reset()
|
||||
@ -751,8 +774,7 @@ DRIVER_INIT_MEMBER(pgm2_state,orleg2)
|
||||
src = (uint16_t *)memregion("sprites_colour")->base();
|
||||
sprite_colour_decode(src, 0x4000000);
|
||||
|
||||
igs036_decryptor decrypter(orleg2_key);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 0;
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20020114, 0x20020117, read32_delegate(FUNC(pgm2_state::orleg2_speedup_r),this));
|
||||
}
|
||||
@ -767,8 +789,7 @@ DRIVER_INIT_MEMBER(pgm2_state,kov2nl)
|
||||
src = (uint16_t *)memregion("sprites_colour")->base();
|
||||
sprite_colour_decode(src, 0x4000000);
|
||||
|
||||
igs036_decryptor decrypter(kov2_key);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 0;
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20020470, 0x20020473, read32_delegate(FUNC(pgm2_state::kov2nl_speedup_r), this));
|
||||
}
|
||||
@ -785,6 +806,7 @@ DRIVER_INIT_MEMBER(pgm2_state,ddpdojh)
|
||||
|
||||
igs036_decryptor decrypter(ddpdoj_key);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 1;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(pgm2_state,kov3)
|
||||
@ -799,6 +821,7 @@ DRIVER_INIT_MEMBER(pgm2_state,kov3)
|
||||
|
||||
igs036_decryptor decrypter(kov3_key);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 1;
|
||||
}
|
||||
|
||||
void pgm2_state::decrypt_kov3_module(uint32_t addrxor, uint16_t dataxor)
|
||||
@ -844,6 +867,7 @@ DRIVER_INIT_MEMBER(pgm2_state,kof98umh)
|
||||
|
||||
igs036_decryptor decrypter(kof98umh_key);
|
||||
decrypter.decrypter_rom(memregion("user1"));
|
||||
m_has_decrypted = 1;
|
||||
}
|
||||
|
||||
/* PGM2 */
|
||||
|
@ -49,6 +49,10 @@ public:
|
||||
DECLARE_READ32_MEMBER(orleg2_speedup_r);
|
||||
DECLARE_READ32_MEMBER(kov2nl_speedup_r);
|
||||
|
||||
DECLARE_READ8_MEMBER(encryption_r);
|
||||
DECLARE_WRITE8_MEMBER(encryption_w);
|
||||
DECLARE_WRITE32_MEMBER(encryption_do_w);
|
||||
|
||||
DECLARE_DRIVER_INIT(kov2nl);
|
||||
DECLARE_DRIVER_INIT(orleg2);
|
||||
DECLARE_DRIVER_INIT(ddpdojh);
|
||||
@ -91,6 +95,9 @@ private:
|
||||
|
||||
uint32_t m_sprites_mask_mask;
|
||||
uint32_t m_sprites_colour_mask;
|
||||
|
||||
uint8_t m_encryption_table[0x100];
|
||||
int m_has_decrypted; // so we only do it once.
|
||||
|
||||
// devices
|
||||
required_device<cpu_device> m_maincpu;
|
||||
|
@ -234,25 +234,6 @@ int (*igs036_decryptor::rot_direction[4][8])(int) = {
|
||||
// while simple, seems to be pretty robust, so few errors should be expected,
|
||||
// if any. The exceptions are DDPDOJ & KOF98UMH (see below).
|
||||
|
||||
const uint8_t orleg2_key[0x100] = {
|
||||
0x93, 0x88, 0x22, 0x08, 0x03, 0x02, 0x23, 0xa5, 0x01, 0xa0, 0x11, 0x88, 0x8d, 0xa5, 0x26, 0x09,
|
||||
0x82, 0x01, 0x01, 0x01, 0x97, 0x08, 0x94, 0x8c, 0x99, 0x0b, 0x99, 0x01, 0x0b, 0x98, 0x09, 0x19,
|
||||
0x91, 0xa8, 0xa0, 0x8b, 0x80, 0x04, 0x22, 0x09, 0xaa, 0x1a, 0x81, 0x23, 0x21, 0x83, 0x8c, 0x2c,
|
||||
0x11, 0x81, 0x31, 0xa9, 0x93, 0xa2, 0x01, 0x3e, 0x91, 0xb0, 0x3b, 0x0b, 0x03, 0x07, 0x93, 0x26,
|
||||
0xf1, 0x9b, 0xe3, 0x1a, 0x67, 0x2e, 0x84, 0x4e, 0xb9, 0xc1, 0x0a, 0xb8, 0xce, 0xee, 0x07, 0x0c,
|
||||
0x00, 0xc1, 0xc2, 0xd1, 0x43, 0xdd, 0x51, 0x1b, 0x48, 0xc3, 0x09, 0xda, 0xc8, 0xc3, 0x59, 0x83,
|
||||
0x30, 0x22, 0xf1, 0x3b, 0x05, 0x2d, 0x41, 0x89, 0x2a, 0xa1, 0x42, 0xe2, 0x41, 0xa1, 0xa7, 0xe8,
|
||||
0xf3, 0xd9, 0xb1, 0x53, 0x36, 0xd2, 0x15, 0x3a, 0xca, 0xbb, 0xca, 0x09, 0x3f, 0x54, 0x71, 0x40,
|
||||
0xb0, 0xa8, 0x10, 0x38, 0x83, 0x8a, 0x82, 0x02, 0x09, 0x83, 0x32, 0x3a, 0xad, 0x05, 0x84, 0xa8,
|
||||
0x81, 0x88, 0x02, 0x9a, 0x14, 0x99, 0x84, 0x03, 0x99, 0x10, 0x8b, 0x0a, 0x12, 0x11, 0x82, 0x85,
|
||||
0x03, 0x12, 0x30, 0xba, 0x87, 0xac, 0xa1, 0xa0, 0x1b, 0x0a, 0xa2, 0x0a, 0x2a, 0x01, 0x2b, 0x24,
|
||||
0xa0, 0x82, 0x01, 0xb2, 0xa5, 0x25, 0xb2, 0x1d, 0x3a, 0x83, 0x88, 0x98, 0xbf, 0x1a, 0x09, 0x22,
|
||||
0xf3, 0xb3, 0xc3, 0xca, 0x63, 0x48, 0xc4, 0x6d, 0xa2, 0x6b, 0x5a, 0xbb, 0x24, 0xee, 0x4f, 0x64,
|
||||
0xc2, 0x80, 0x01, 0xc3, 0x81, 0xde, 0x94, 0x82, 0xda, 0x98, 0x98, 0x8a, 0x59, 0x10, 0x58, 0xcf,
|
||||
0xa2, 0xa8, 0xd3, 0x8a, 0xa6, 0x41, 0x83, 0xe0, 0x68, 0x49, 0x61, 0x19, 0x00, 0x63, 0x49, 0x80,
|
||||
0xb0, 0x39, 0xb3, 0x09, 0x91, 0x61, 0x55, 0x89, 0x20, 0x9a, 0x00, 0x3a, 0x80, 0x0a, 0xfa, 0x5c,
|
||||
};
|
||||
|
||||
const uint8_t m312cn_key[0x100] = {
|
||||
0x01, 0x09, 0x02, 0xab, 0x23, 0x20, 0xa2, 0x03, 0x10, 0x9b, 0xba, 0x33, 0x04, 0x2e, 0x27, 0x23,
|
||||
0x92, 0x11, 0x13, 0x93, 0x13, 0x86, 0x83, 0x02, 0x18, 0x8a, 0x8b, 0x9a, 0x10, 0x0f, 0x13, 0x83,
|
||||
@ -329,25 +310,6 @@ const uint8_t kov3_key[0x100] = {
|
||||
0x10, 0x09, 0xe0, 0x39, 0x02, 0xfe, 0x47, 0x44, 0x2a, 0x51, 0x21, 0x49, 0x04, 0x1d, 0x2d, 0xed,
|
||||
};
|
||||
|
||||
const uint8_t kov2_key[0x100] = {
|
||||
0x02, 0x2b, 0x81, 0x1b, 0xa3, 0x86, 0x83, 0x2a, 0x1b, 0x0b, 0xa0, 0xbb, 0x8b, 0x05, 0x26, 0x0d,
|
||||
0x12, 0x81, 0x92, 0x83, 0x11, 0x96, 0x90, 0x80, 0x91, 0x10, 0x92, 0x81, 0x0b, 0x12, 0x94, 0x1c,
|
||||
0x30, 0x9b, 0x20, 0xab, 0x83, 0xac, 0x03, 0x0d, 0xa3, 0x2a, 0xa9, 0x01, 0xa0, 0x82, 0x29, 0xa8,
|
||||
0x82, 0x3b, 0x80, 0x08, 0x26, 0x2c, 0x27, 0x94, 0x33, 0x23, 0xab, 0x01, 0x8d, 0x91, 0xb5, 0xbf,
|
||||
0x50, 0xaa, 0xf2, 0x03, 0xe7, 0x4c, 0x61, 0xc7, 0xf0, 0x73, 0xf3, 0x20, 0xe7, 0x60, 0x45, 0xa1,
|
||||
0x11, 0x12, 0xc0, 0x51, 0xc2, 0xc4, 0x15, 0xd5, 0xd9, 0x80, 0x10, 0xc0, 0x10, 0xc7, 0xc3, 0xc8,
|
||||
0x33, 0x5b, 0xb2, 0x93, 0xc5, 0x2d, 0xe5, 0xe1, 0x91, 0x43, 0xa0, 0x89, 0x4b, 0x05, 0x0a, 0x44,
|
||||
0x53, 0x82, 0x52, 0xaa, 0x24, 0xb9, 0x12, 0x5b, 0x18, 0x10, 0xd8, 0xda, 0x42, 0x6d, 0xc9, 0xd0,
|
||||
0x22, 0xb8, 0x33, 0x10, 0x24, 0xa0, 0x84, 0x23, 0x20, 0x19, 0x81, 0x89, 0x0a, 0x0a, 0x24, 0x02,
|
||||
0x83, 0x0a, 0x90, 0x11, 0x94, 0x0c, 0x05, 0x8c, 0x90, 0x1b, 0x9b, 0x82, 0x9d, 0x9b, 0x1c, 0x1d,
|
||||
0x23, 0x32, 0x02, 0x9a, 0x86, 0x05, 0xa5, 0x26, 0x28, 0x2b, 0x39, 0x98, 0xae, 0xae, 0x2a, 0xaa,
|
||||
0x23, 0x83, 0x01, 0x98, 0x81, 0x0d, 0xa6, 0xb2, 0x99, 0x01, 0xb3, 0x01, 0x07, 0x09, 0x88, 0x02,
|
||||
0x83, 0xf0, 0x32, 0x09, 0xc2, 0x6c, 0x21, 0xa1, 0x90, 0xb3, 0x31, 0x51, 0xed, 0xaf, 0x45, 0xc5,
|
||||
0x02, 0xd1, 0xd3, 0xc0, 0x15, 0xcc, 0x42, 0xd4, 0x03, 0x59, 0x19, 0x93, 0x9a, 0x8e, 0x14, 0x04,
|
||||
0x42, 0x08, 0xf0, 0x88, 0xe0, 0x65, 0xa3, 0x4c, 0xe2, 0xe2, 0xb1, 0xb1, 0x20, 0x03, 0xc8, 0x41,
|
||||
0xf3, 0x80, 0x93, 0x40, 0x57, 0x69, 0xa1, 0x5b, 0xea, 0xb9, 0x58, 0xcb, 0x04, 0x64, 0x08, 0xf5,
|
||||
};
|
||||
|
||||
// DDPDOJ & KOF98UMH caused lots of problems to the automatic recovery
|
||||
// process, so they have needed a good amount of manual examination.
|
||||
// It is much more probable for these keys to still contain errors
|
||||
|
@ -25,12 +25,10 @@ private:
|
||||
int rot_group(int address, const int* group)const;
|
||||
};
|
||||
|
||||
extern const uint8_t orleg2_key[0x100];
|
||||
extern const uint8_t m312cn_key[0x100];
|
||||
extern const uint8_t cjddzsp_key[0x100];
|
||||
extern const uint8_t cjdh2_key[0x100];
|
||||
extern const uint8_t kov3_key[0x100];
|
||||
extern const uint8_t kov2_key[0x100];
|
||||
extern const uint8_t ddpdoj_key[0x100];
|
||||
extern const uint8_t kof98umh_key[0x100];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user