From 395e02cfad8ff1889adeecc6438f2a513c4b78b7 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 20 Feb 2024 18:22:48 +0100 Subject: misc/matrix.cpp: preliminary (?) decryption --- src/mame/misc/matrix.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mame/misc/matrix.cpp b/src/mame/misc/matrix.cpp index f16c7d061a7..5146648d653 100644 --- a/src/mame/misc/matrix.cpp +++ b/src/mame/misc/matrix.cpp @@ -8,7 +8,7 @@ TODO: - KBDC, not from super I/O; - Don't recognize an attached HDD, check default CMOS settings; - loops at PC=eda2d, reads the NMI vector; -- game roms looks encrypted or bad, may require a missing boot device; +- game ROMs are encrypted (currently at least partially decrypted), may require a missing boot device; Hardware consists of: @@ -58,6 +58,8 @@ public: void matrix(machine_config &config); + void init_decryption(); + private: required_device m_maincpu; required_device m_rtc; @@ -150,7 +152,23 @@ ROM_START( matrix ) ROM_LOAD( "matrix_031203u20.bin", 0x280000, 0x080000, CRC(f87ac4ae) SHA1(ef9b730a1113d36ef6a041fe36d77edfa255ad98) ) ROM_END + +void matrix_state::init_decryption() // at least enough to see strings from various programs like DOS-C, PMODE/W, UPX, etc +{ + uint8_t *rom = memregion("unsorted")->base(); + std::vector buffer(0x300000); + + memcpy(&buffer[0], rom, 0x300000); + + + for (int i = 0; i < 0x300000; i++) + { + rom[i] = buffer[bitswap<24>(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 0, 9, 8, 7, 6, 5, 4, 3, 1, 10, 2)]; + rom[i] = bitswap<8>(rom[i] ^ 0xda, 7, 6, 5, 4, 1, 2, 0, 3); + } +} + } // anonymous namespace -GAME( 200?, matrix, 0, matrix, matrix, matrix_state, empty_init, ROT0, "", "Matrix", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 200?, matrix, 0, matrix, matrix, matrix_state, init_decryption, ROT0, "", "Matrix", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -- cgit v1.2.3