summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/39in1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/39in1.cpp')
-rw-r--r--src/mame/drivers/39in1.cpp71
1 files changed, 39 insertions, 32 deletions
diff --git a/src/mame/drivers/39in1.cpp b/src/mame/drivers/39in1.cpp
index 3aa567d8bf3..691526f5cf4 100644
--- a/src/mame/drivers/39in1.cpp
+++ b/src/mame/drivers/39in1.cpp
@@ -23,8 +23,8 @@
* 'Hardware Check' with an error
* - rodent should be correctly decrypted but expects something different
from the CPLD (probably)
- * - 19in1, 48in1, 48in1a, 48in1b seem to have a slightly different encryption
- * - 60in1 expects something different from the CPLD (probably)
+ * - 19in1, 48in1, 48in1a, 48in1b, 60in1 have more conditional XORs,
+ * encryption isn't completely beaten yet
*
* 39in1 notes:
* The actual PCB just normally boots up to the game, whereas in MAME it
@@ -90,6 +90,7 @@ private:
inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... );
void decrypt(uint8_t xor00, uint8_t xor08, uint8_t xor10, uint8_t xor20, uint8_t xor40, uint8_t bit7, uint8_t bit6, uint8_t bit5, uint8_t bit4, uint8_t bit3, uint8_t bit2, uint8_t bit1, uint8_t bit0);
+ void further_decrypt(uint8_t xor400, uint8_t xor800, uint8_t xor1000, uint8_t xor2000, uint8_t xor4000, uint8_t xor8000);
};
@@ -299,6 +300,28 @@ void _39in1_state::decrypt(uint8_t xor00, uint8_t xor08, uint8_t xor10, uint8_t
rom[i] = bitswap<8>(rom[i] ^ xor00, bit7, bit6, bit5, bit4, bit3, bit2, bit1, bit0);
}
+}
+
+void _39in1_state::further_decrypt(uint8_t xor400, uint8_t xor800, uint8_t xor1000, uint8_t xor2000, uint8_t xor4000, uint8_t xor8000) // later versions have more conditional XORs
+{
+ uint8_t *rom = memregion("maincpu")->base();
+
+ for (int i = 0; i < 0x80000; i += 2)
+ {
+ if (i & 0x400)
+ rom[i] ^= xor400; // always 0x00 in the available dumps
+ if (i & 0x800)
+ rom[i] ^= xor800;
+ if (i & 0x1000)
+ rom[i] ^= xor1000;
+ if (i & 0x2000)
+ rom[i] ^= xor2000;
+ if (i & 0x4000)
+ rom[i] ^= xor4000; // TODO: currently unverified if the games actually use this
+ if (i & 0x8000)
+ rom[i] ^= xor8000; // TODO: currently unverified if the games actually use this
+ // TODO: 0x10000, 0x20000, 0x40000?
+ }
/*{
char filename[256];
@@ -306,8 +329,8 @@ void _39in1_state::decrypt(uint8_t xor00, uint8_t xor08, uint8_t xor10, uint8_t
FILE *fp = fopen(filename, "w+b");
if (fp)
{
- fwrite(rom, 0x80000, 1, fp);
- fclose(fp);
+ fwrite(rom, 0x80000, 1, fp);
+ fclose(fp);
}
}*/
}
@@ -315,26 +338,11 @@ void _39in1_state::decrypt(uint8_t xor00, uint8_t xor08, uint8_t xor10, uint8_t
void _39in1_state::init_39in1() { driver_init(); decrypt(0xc0, 0x02, 0x40, 0x04, 0x80, 7, 2, 5, 6, 0, 3, 1, 4); m_mcu_ipt_pc = 0xe3af4; } // good
void _39in1_state::init_4in1a() { driver_init(); decrypt(0x25, 0x01, 0x80, 0x04, 0x40, 6, 0, 2, 1, 7, 5, 4, 3); m_mcu_ipt_pc = 0x45814; } // good
void _39in1_state::init_4in1b() { driver_init(); decrypt(0x43, 0x80, 0x04, 0x40, 0x08, 2, 4, 0, 6, 7, 3, 1, 5); m_mcu_ipt_pc = 0x57628; } // good
-void _39in1_state::init_19in1() { driver_init(); decrypt(0x00, 0x04, 0x01, 0x80, 0x40, 2, 1, 7, 4, 5, 0, 6, 3); m_mcu_ipt_pc = 0x00000; } // TODO: seems to have different bitswaps depending on XOR address
-void _39in1_state::init_48in1() { driver_init(); decrypt(0x00, 0x01, 0x40, 0x00, 0x20, 5, 3, 2, 1, 4, 6, 0, 7); m_mcu_ipt_pc = 0x00000; } // applies to both 48in1 and 48in1b, same main CPU ROM. TODO: see above
+void _39in1_state::init_19in1() { driver_init(); decrypt(0x00, 0x04, 0x01, 0x80, 0x40, 2, 1, 7, 4, 5, 0, 6, 3); further_decrypt(0x00, 0x01, 0x00, 0x10, 0x00, 0x00); m_mcu_ipt_pc = 0x00000; } // TODO: 0x4000, 0x8000, 0x10000, 0x20000, 0x40000 conditional XORs?
+void _39in1_state::init_48in1() { driver_init(); decrypt(0x00, 0x01, 0x40, 0x00, 0x20, 5, 3, 2, 1, 4, 6, 0, 7); further_decrypt(0x00, 0x01, 0x20, 0x10, 0x00, 0x00); m_mcu_ipt_pc = 0x00000; } // applies to both 48in1 and 48in1b, same main CPU ROM. TODO: see above
void _39in1_state::init_48in1a() { init_48in1(); m_mcu_ipt_pc = 0x00000; } // same encryption as 48in1
void _39in1_state::init_rodent() { init_4in1b(); /*m_mcu_ipt_pc = 0x?????;*/ } // same encryption as 4in1b, thus good, but doesn't boot because of different CPLD calls
-
-void _39in1_state::init_60in1() // different encryption scheme
-{
- driver_init();
- // TODO: Machine is marked as MNW; is this decrypt correct?
- uint8_t *ROM = memregion("maincpu")->base();
- for (int i = 0; i < 0x80000; i += 2)
- {
- if ((i%2)==0)
- {
- ROM[i] = bitswap<8>(ROM[i],5,1,4,2,0,7,6,3)^bitswap<8>(i, 6,0,4,13,0,5,3,11);
- }
- }
-
- // m_mcu_ipt_pc = 0x?????;
-}
+void _39in1_state::init_60in1() { driver_init(); decrypt(0x00, 0x40, 0x10, 0x80, 0x20, 5, 1, 4, 2, 0, 7, 6, 3); further_decrypt(0x00, 0x01, 0x00, 0x10, 0x00, 0x00); m_mcu_ipt_pc = 0x00000; } // TODO: see 19in1
void _39in1_state::_39in1(machine_config &config)
{
@@ -466,7 +474,6 @@ ROM_START( 19in1 )
ROM_LOAD16_WORD_SWAP( "19in1_eeprom.bin", 0x000, 0x200, NO_DUMP )
ROM_END
-// TODO: encryption is different from 39in1 and 60in1
ROM_START( rodent )
ROM_REGION( 0x80000, "maincpu", 0 )
ROM_LOAD( "exterminator.u2", 0x00000, 0x80000, CRC(23c1d21f) SHA1(349565b0f0a015196827707cabb8d9ce6560d2cc) )
@@ -478,12 +485,12 @@ ROM_START( rodent )
ROM_LOAD( "93c66.u32", 0x000, 0x200, CRC(c311c7bc) SHA1(8328002b7f6a8b7a3ffca079b7960bc990211d7b) )
ROM_END
-GAME(2004, 4in1a, 39in1, _39in1, 39in1, _39in1_state, init_4in1a, ROT90, "bootleg", "4 in 1 MAME bootleg (set 1, ver 3.00, PLZ-V014)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 4in1b, 39in1, _39in1, 39in1, _39in1_state, init_4in1b, ROT90, "bootleg", "4 in 1 MAME bootleg (set 2, PLZ-V001)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 19in1, 39in1, _39in1, 39in1, _39in1_state, init_19in1, ROT90, "bootleg", "19 in 1 MAME bootleg (SAC-V000)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 39in1, 0, _39in1, 39in1, _39in1_state, init_39in1, ROT90, "bootleg", "39 in 1 MAME bootleg (GNO-V000)", MACHINE_IMPERFECT_SOUND)
-GAME(2004, 48in1, 39in1, _39in1, 39in1, _39in1_state, init_48in1, ROT90, "bootleg", "48 in 1 MAME bootleg (set 1, ver 3.09)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 48in1b, 39in1, _39in1, 39in1, _39in1_state, init_48in1, ROT90, "bootleg", "48 in 1 MAME bootleg (set 2, ver 3.09, alt flash)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 48in1a, 39in1, _39in1, 39in1, _39in1_state, init_48in1a, ROT90, "bootleg", "48 in 1 MAME bootleg (set 3, ver 3.02)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2004, 60in1, 39in1, _39in1, 39in1, _39in1_state, init_60in1, ROT90, "bootleg", "60 in 1 MAME bootleg (ver 3.00)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
-GAME(2005, rodent, 0, _39in1, 39in1, _39in1_state, init_rodent, ROT0, "The Game Room", "Rodent Exterminator", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 4in1a, 39in1, _39in1, 39in1, _39in1_state, init_4in1a, ROT90, "bootleg", "4 in 1 MAME bootleg (set 1, ver 3.00, PLZ-V014)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 4in1b, 39in1, _39in1, 39in1, _39in1_state, init_4in1b, ROT90, "bootleg", "4 in 1 MAME bootleg (set 2, PLZ-V001)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 19in1, 39in1, _39in1, 39in1, _39in1_state, init_19in1, ROT90, "bootleg", "19 in 1 MAME bootleg (BAR-V000)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 39in1, 0, _39in1, 39in1, _39in1_state, init_39in1, ROT90, "bootleg", "39 in 1 MAME bootleg (GNO-V000)", MACHINE_IMPERFECT_SOUND)
+GAME(2004, 48in1, 39in1, _39in1, 39in1, _39in1_state, init_48in1, ROT90, "bootleg", "48 in 1 MAME bootleg (set 1, ver 3.09, HPH-V000)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 48in1b, 39in1, _39in1, 39in1, _39in1_state, init_48in1, ROT90, "bootleg", "48 in 1 MAME bootleg (set 2, ver 3.09, HPH-V000, alt flash)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 48in1a, 39in1, _39in1, 39in1, _39in1_state, init_48in1a, ROT90, "bootleg", "48 in 1 MAME bootleg (set 3, ver 3.02, HPH-V000)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2004, 60in1, 39in1, _39in1, 39in1, _39in1_state, init_60in1, ROT90, "bootleg", "60 in 1 MAME bootleg (ver 3.00, ICD-V000)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)
+GAME(2005, rodent, 0, _39in1, 39in1, _39in1_state, init_rodent, ROT0, "The Game Room", "Rodent Exterminator", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND)