mirror of
https://github.com/holub/mame
synced 2025-04-26 02:07:14 +03:00
goldstar.cpp: improvements to wcat3 decryption. Still something important missing, but at least the game seems to work with some prodding (nw)
This commit is contained in:
parent
e7f9e94106
commit
6272fe0942
@ -13459,13 +13459,13 @@ ROM_START( wcat3 )
|
||||
ROM_LOAD( "wcat3.g14", 0x0100, 0x0100, CRC(dcd53d2c) SHA1(bbcb4266117c3cd1c8ef0e5046d3558c8293313a) )
|
||||
|
||||
ROM_REGION( 0x40, "proms2", 0 )
|
||||
ROM_LOAD( "wcat3.d12", 0x0000, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) )
|
||||
ROM_LOAD( "wcat3.d13", 0x0000, 0x0020, CRC(eab832ed) SHA1(0fbc8914ba1805cfc6698fe7f137a934e63a4f89) )
|
||||
|
||||
ROM_REGION( 0x100, "unkprom", 0 )
|
||||
ROM_LOAD( "wcat3.f3", 0x0000, 0x0100, CRC(1d668d4a) SHA1(459117f78323ea264d3a29f1da2889bbabe9e4be) )
|
||||
|
||||
ROM_REGION( 0x40, "unkprom2", 0 )
|
||||
ROM_LOAD( "wcat3.d13", 0x0000, 0x0020, CRC(eab832ed) SHA1(0fbc8914ba1805cfc6698fe7f137a934e63a4f89) )
|
||||
ROM_LOAD( "wcat3.d12", 0x0000, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) )
|
||||
ROM_END
|
||||
|
||||
|
||||
@ -17066,32 +17066,62 @@ void goldstar_state::init_ladylinre()
|
||||
|
||||
void wingco_state::init_wcat3()
|
||||
{
|
||||
// the following is very preliminary and only good to decrypt text strings. Treat everything as incomplete and probably incorrect.
|
||||
// there must be some more conditions and/or some errors as the game needs to be soft resets 4-5 times before working apparently fine
|
||||
// see from 0xb0 - 0xcf range for an example (comparable to range 0x96 - 0xb5 in lucky8)
|
||||
uint8_t *rom = memregion("maincpu")->base();
|
||||
|
||||
static const uint8_t op_convtable[8][8] =
|
||||
{
|
||||
// opcodes address
|
||||
// 0 1 2 3 4 5 6 7
|
||||
{ 0x10, 0x00, 0x80, 0x90, 0x30, 0x20, 0xa0, 0xb0 }, // 0x000
|
||||
{ 0x10, 0x00, 0x80, 0x90, 0x30, 0x20, 0xa0, 0xb0 }, // 0x001
|
||||
{ 0x20, 0xa0, 0x00, 0x80, 0x10, 0x90, 0x30, 0xb0 }, // 0x004
|
||||
{ 0x00, 0x20, 0x10, 0x30, 0x80, 0xa0, 0x90, 0xb0 }, // 0x005
|
||||
{ 0x20, 0x80, 0x00, 0xa0, 0x30, 0x90, 0x10, 0xb0 }, // 0x400
|
||||
{ 0x00, 0x80, 0x10, 0x90, 0x20, 0xa0, 0x30, 0xb0 }, // 0x401
|
||||
{ 0x20, 0x80, 0x00, 0xa0, 0x30, 0x90, 0x10, 0xb0 }, // 0x404
|
||||
{ 0x80, 0xa0, 0x10, 0x30, 0x00, 0x20, 0x90, 0xb0 }, // 0x405
|
||||
};
|
||||
|
||||
static const uint8_t convtable[8][8] =
|
||||
{
|
||||
// data address
|
||||
// 0 1 2 3 4 5 6 7
|
||||
{ 0x00, 0x10, 0x20, 0x30, 0x80, 0x90, 0xa0, 0xb0 }, // 0x000
|
||||
{ 0x10, 0x00, 0x90, 0x80, 0x20, 0x30, 0xa0, 0xb0 }, // 0x001
|
||||
{ 0x20, 0xa0, 0x00, 0x80, 0x10, 0x90, 0x30, 0xb0 }, // 0x004 // verify 0x00, 0x90, 0xa0
|
||||
{ 0x80, 0x20, 0x90, 0x30, 0x00, 0xa0, 0x10, 0xb0 }, // 0x005
|
||||
{ 0x00, 0x10, 0x20, 0x30, 0x80, 0x90, 0xa0, 0xb0 }, // 0x400
|
||||
{ 0x10, 0x00, 0x90, 0x80, 0x20, 0x30, 0xa0, 0xb0 }, // 0x401
|
||||
{ 0x00, 0x80, 0x20, 0xa0, 0x10, 0x90, 0x30, 0xb0 }, // 0x404
|
||||
{ 0x00, 0x80, 0x20, 0xa0, 0x10, 0x90, 0x30, 0xb0 }, // 0x405
|
||||
};
|
||||
|
||||
for (int i = 0x0000; i < 0x10000; i++)
|
||||
{
|
||||
uint8_t x = rom[i];
|
||||
|
||||
m_decrypted_opcodes[i] = x;
|
||||
// translation table from address
|
||||
uint8_t row = (BIT(i, 0) + (BIT(i, 2) << 1) + (BIT(i, 10) << 2));
|
||||
|
||||
// offset in the table from source data
|
||||
uint8_t col = (BIT(x, 4) + (BIT(x, 5) << 1) + (BIT(x, 7) << 2));
|
||||
|
||||
m_decrypted_opcodes[i] = (x & ~0xb0) | op_convtable[row][col];
|
||||
}
|
||||
|
||||
// data encryption seems to involve only bits 4, 5 and 7 and some conditional XORs
|
||||
for (int i = 0x4000; i < 0x10000; i++)
|
||||
for (int i = 0x0000; i < 0x10000; i++)
|
||||
{
|
||||
uint8_t x = rom[i];
|
||||
|
||||
switch (i & 0x405)
|
||||
{
|
||||
case 0x001: x = bitswap<8>(BIT(x, 6) ? x ^ 0x10 : x, 5, 6, 7, 4, 3, 2, 1, 0); break;
|
||||
case 0x004: x = bitswap<8>(!BIT(x, 7) ? x ^ 0x20 : x, 4, 6, 5, 7, 3, 2, 1, 0); break;
|
||||
case 0x005: x = bitswap<8>(BIT(x, 7) ? x ^ 0x80 : x, 7, 6, 4, 5, 3, 2, 1, 0); break;
|
||||
case 0x401: x = bitswap<8>(!BIT(x, 7) ? x ^ 0x10 : x, 5, 6, 7, 4, 3, 2, 1, 0); break;
|
||||
case 0x404: x = bitswap<8>(x, 4, 6, 5, 7, 3, 2, 1, 0); break;
|
||||
case 0x405: x = bitswap<8>(x, 4, 6, 5, 7, 3, 2, 1, 0); break;
|
||||
}
|
||||
// translation table from address
|
||||
uint8_t row = (BIT(i, 0) + (BIT(i, 2) << 1) + (BIT(i, 10) << 2));
|
||||
|
||||
rom[i] = x;
|
||||
// offset in the table from source data
|
||||
uint8_t col = (BIT(x, 4) + (BIT(x, 5) << 1) + (BIT(x, 7) << 2));
|
||||
|
||||
rom[i] = (x & ~0xb0) | convtable[row][col];
|
||||
}
|
||||
}
|
||||
|
||||
@ -18165,7 +18195,7 @@ GAME( 198?, ladylinrb, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladyl
|
||||
GAME( 198?, ladylinrc, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinrc, ROT0, "TAB Austria", "Lady Liner (encrypted, set 2)", 0 )
|
||||
GAME( 198?, ladylinrd, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinrd, ROT0, "TAB Austria", "Lady Liner (encrypted, set 3)", 0 )
|
||||
GAME( 198?, ladylinre, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinre, ROT0, "TAB Austria", "Lady Liner (encrypted, set 4)", 0 )
|
||||
GAME( 198?, wcat3, 0, wcat3, lucky8, wingco_state, init_wcat3, ROT0, "E.A.I.", "Wild Cat 3", MACHINE_NOT_WORKING )
|
||||
GAME( 1995, wcat3, 0, wcat3, lucky8, wingco_state, init_wcat3, ROT0, "E.A.I.", "Wild Cat 3", MACHINE_NOT_WORKING | MACHINE_WRONG_COLORS ) // decryption partially wrong, needs soft resets before running. Bad PROM decode
|
||||
|
||||
GAME( 1985, luckylad, 0, luckylad, luckylad, wingco_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Lady (Wing, encrypted)", MACHINE_NOT_WORKING | MACHINE_WRONG_COLORS ) // controls / dips, colors not correctly decoded
|
||||
GAME( 1991, megaline, 0, megaline, megaline, unkch_state, empty_init, ROT0, "Fun World", "Mega Lines", MACHINE_NOT_WORKING )
|
||||
|
Loading…
Reference in New Issue
Block a user