summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2023-10-18 20:04:30 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2023-10-18 20:04:30 +0200
commit8ae9e495868721db02d6df6c396bd5e1f4fa694a (patch)
treeac1b479caced5e73ecbbd2b2f321e43f3012f952 /src
parentf1caaeccea83351374a7bc4dd6f6ed92bc5314fa (diff)
subsino/subsino_crypt.cpp: added xors and bitswaps for the newly dumped newhunterc set. It still needs work on the driver side.
Diffstat (limited to 'src')
-rw-r--r--src/mame/subsino/subsino.cpp9
-rw-r--r--src/mame/subsino/subsino_crypt.cpp99
-rw-r--r--src/mame/subsino/subsino_crypt.h14
3 files changed, 72 insertions, 50 deletions
diff --git a/src/mame/subsino/subsino.cpp b/src/mame/subsino/subsino.cpp
index 05278b7dc30..2065ce626ce 100644
--- a/src/mame/subsino/subsino.cpp
+++ b/src/mame/subsino/subsino.cpp
@@ -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 )
diff --git a/src/mame/subsino/subsino_crypt.cpp b/src/mame/subsino/subsino_crypt.cpp
index 2e7f71e5fff..2e8fb56cb2f 100644
--- a/src/mame/subsino/subsino_crypt.cpp
+++ b/src/mame/subsino/subsino_crypt.cpp
@@ -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:
diff --git a/src/mame/subsino/subsino_crypt.h b/src/mame/subsino/subsino_crypt.h
index b9365fadd83..0a5d9a2f163 100644
--- a/src/mame/subsino/subsino_crypt.h
+++ b/src/mame/subsino/subsino_crypt.h
@@ -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);