subsino/subsino_crypt.cpp: added xors and bitswaps for the newly dumped newhunterc set. It still needs work on the driver side.

This commit is contained in:
Ivan Vangelista 2023-10-18 20:04:30 +02:00
parent f1caaeccea
commit 8ae9e49586
3 changed files with 72 additions and 50 deletions

View File

@ -291,6 +291,7 @@ public:
void init_victor5();
void init_tisubb();
void init_newhunterb();
void init_newhunterc();
void init_sharkpye();
void init_tisub();
void init_mtrainnv();
@ -4157,6 +4158,12 @@ void subsino_state::init_newhunterb()
subsino_decrypt(rom, tisubb_bitswaps, tisubb_xors, 0x8000);
}
void subsino_state::init_newhunterc()
{
uint8_t *rom = memregion( "program" )->base() + 0x6000;
subsino_decrypt(rom, newhunterc_bitswaps, newhunterc_xors, 0x8000);
}
void subsino_state::init_stbsub()
{
#if 1
@ -4255,7 +4262,7 @@ GAMEL( 1992, tisuba, tisub, tisub, tisub, subsino_state, init_tis
GAMEL( 1992, tisubb, tisub, tisub, tisubb, subsino_state, init_tisubb, ROT0, "American Alpha", "Treasure Island (American Alpha, v3.0N)", 0, layout_tisubb )
GAMEL( 1992, newhunter, tisub, tisub, tisub, subsino_state, init_tisubb, ROT0, "Karam", "New HUNTer", 0, layout_tisubb ) // 1989 on screen, but this bootleg is from 1992
GAMEL( 1993, newhunterb, tisub, newhunterb, tisub, subsino_state, init_newhunterb, ROT0, "bootleg", "New HUNTer (bootleg, set 1)", 0, layout_tisubb )
GAMEL( 1993, newhunterc, tisub, tisub, tisub, subsino_state, init_tisubb, ROT0, "bootleg", "New HUNTer (bootleg, set 2)", MACHINE_NOT_WORKING, layout_tisubb ) // 1989 on screen, but "Copyright 1993 SubSino Corp. Taipei, Taiwan." on program ROM
GAMEL( 1993, newhunterc, tisub, newhunterb, tisub, subsino_state, init_newhunterc, ROT0, "bootleg", "New HUNTer (bootleg, set 2)", MACHINE_NOT_WORKING, layout_tisubb ) // 1989 on screen, but "Copyright 1993 SubSino Corp. Taipei, Taiwan." on program ROM
GAMEL( 1991, crsbingo, 0, crsbingo, crsbingo, subsino_state, init_crsbingo, ROT0, "Subsino", "Poker Carnival", 0, layout_crsbingo )

View File

@ -12,71 +12,84 @@ by David Haywood
// XORs:
extern const uint8_t crsbingo_xors[8] = { 0xbb, 0xcc, 0xcc, 0xdd, 0xaa, 0x11, 0x44, 0xee };
extern const uint8_t sharkpy_xors [8] = { 0xcc, 0xaa, 0x66, 0xaa, 0xee, 0x33, 0xff, 0xff };
extern const uint8_t tisubb_xors [8] = { 0x44, 0x99, 0x55, 0x77, 0xaa, 0x77, 0x88, 0x55 };
extern const uint8_t victor5_xors [8] = { 0x99, 0x99, 0x33, 0x44, 0xbb, 0x88, 0x88, 0xbb };
extern const uint8_t newhunterc_xors[8] = { 0x44, 0xcc, 0xcc, 0xbb, 0xff, 0x44, 0x77, 0xaa };
extern const uint8_t sharkpy_xors[8] = { 0xcc, 0xaa, 0x66, 0xaa, 0xee, 0x33, 0xff, 0xff };
extern const uint8_t tisubb_xors[8] = { 0x44, 0x99, 0x55, 0x77, 0xaa, 0x77, 0x88, 0x55 };
extern const uint8_t victor5_xors[8] = { 0x99, 0x99, 0x33, 0x44, 0xbb, 0x88, 0x88, 0xbb };
extern const uint8_t victor21_xors[8] = { 0x44, 0xbb, 0x66, 0x44, 0xaa, 0x55, 0x88, 0x22 };
// Bitswaps:
void crsbingo_bitswaps(uint8_t *decrypt, int i)
{
if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3,2,5,0,7,6,1,4 );
if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,0,3,6,1,4 );
if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 5, 0, 7, 6, 1, 4);
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 0, 3, 6, 1, 4);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 5, 0, 3, 2, 1, 4);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 4, 3, 6, 5, 0);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 0, 7, 6, 5, 4);
}
void newhunterc_bitswaps(uint8_t *decrypt, int i)
{
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 5, 0, 3, 2, 1, 4);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4); // TODO: verify 7,6
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 0, 3, 6, 1, 4);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 1, 0, 3, 2, 5, 4);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 5, 0, 7, 6, 1, 4);
}
void sharkpy_bitswaps(uint8_t *decrypt, int i)
{
if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3,2,5,4,7,6,1,0 );
if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,6,1,4,3,2,5,0 );
if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,4,7,2,5,0 );
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 0, 7, 6, 5, 4);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 4, 3, 6, 5, 0);
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 0, 7, 2, 5, 4);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 5, 4, 7, 6, 1, 0);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 1, 4, 3, 2, 5, 0);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 4, 7, 2, 5, 0);
}
void tisubb_bitswaps(uint8_t *decrypt, int i)
{
if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,6,1,4,3,2,5,0 );
if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3,6,5,0,7,2,1,4 );
if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 3,2,5,4,7,6,1,0 );
if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 1, 4, 3, 2, 5, 0);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 5, 0, 7, 2, 1, 4);
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 5, 4, 7, 6, 1, 0);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 0, 7, 2, 5, 4);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 0, 7, 2, 5, 4);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 0, 7, 6, 5, 4);
}
void victor5_bitswaps(uint8_t *decrypt, int i)
{
if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 5, 0, 3, 2, 1, 4);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 0, 7, 6, 5, 4);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 5, 0, 3, 2, 1, 4);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 0, 7, 2, 5, 4);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 4, 3, 6, 5, 0);
}
void victor21_bitswaps(uint8_t *decrypt, int i)
{
if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,4,7,2,5,0 );
if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,4,7,6,5,0 );
if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3,6,5,0,7,2,1,4 );
if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,4,3,2,1,0 );
if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,4,7,6,5,0 );
if ((i & 7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 1, 0, 3, 6, 5, 4);
if ((i & 7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 1, 4, 7, 2, 5, 0);
if ((i & 7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 4, 7, 6, 5, 0);
if ((i & 7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7, 2, 5, 4, 3, 6, 1, 0);
if ((i & 7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3, 6, 5, 0, 7, 2, 1, 4);
if ((i & 7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7, 6, 5, 4, 3, 2, 1, 0);
if ((i & 7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3, 2, 1, 4, 7, 6, 5, 0);
}
// Decrypt:

View File

@ -7,15 +7,17 @@
extern const uint8_t crsbingo_xors[8];
extern const uint8_t sharkpy_xors [8];
extern const uint8_t tisubb_xors [8];
extern const uint8_t victor5_xors [8];
extern const uint8_t newhunterc_xors[8];
extern const uint8_t sharkpy_xors[8];
extern const uint8_t tisubb_xors[8];
extern const uint8_t victor5_xors[8];
extern const uint8_t victor21_xors[8];
void crsbingo_bitswaps(uint8_t *decrypt, int i);
void sharkpy_bitswaps (uint8_t *decrypt, int i);
void tisubb_bitswaps (uint8_t *decrypt, int i);
void victor5_bitswaps (uint8_t *decrypt, int i);
void newhunterc_bitswaps(uint8_t *decrypt, int i);
void sharkpy_bitswaps(uint8_t *decrypt, int i);
void tisubb_bitswaps(uint8_t *decrypt, int i);
void victor5_bitswaps(uint8_t *decrypt, int i);
void victor21_bitswaps(uint8_t *decrypt, int i);
void subsino_decrypt(uint8_t *region, void (*bitswaps)(uint8_t *decrypt, int i), const uint8_t *xors, int size);