summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/igs036crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/igs036crypt.c')
-rw-r--r--src/mame/machine/igs036crypt.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/mame/machine/igs036crypt.c b/src/mame/machine/igs036crypt.c
index 2c10945dc1d..7cf5140ad65 100644
--- a/src/mame/machine/igs036crypt.c
+++ b/src/mame/machine/igs036crypt.c
@@ -8,16 +8,16 @@ previous IGS encryption schemes. Basically, it consists on a rotation-based
non-trivial obfuscation layered upon a simple address-based XOR encryption
(similar to the ones found in previous IGS circuits).
-The scheme works on 16-bits words and is probably designed to depend on 24 bits of
-(word-) address; in what follows, we will refer to the 8 lowest ones simply as the
+The scheme works on 16-bits words and is probably designed to depend on 24 bits of
+(word-) address; in what follows, we will refer to the 8 lowest ones simply as the
lowest bits of the address, and the other 16 as the highest bits the address.
The address-based XOR is thought to be comprised of 16 one-bit XOR controlled
by a certain combination of one or two of the highest address bits (but only
-15 of them are observed, probably due to the fact that no game uses more than
+15 of them are observed, probably due to the fact that no game uses more than
2^22 of the 2^24 address space). Every one of the one-bit XORs affects a different bit
-of the word. The game key acts by masking on/off those XORs for every combination
-of the lowest address bits. Thus, a complete key can be described by 256 16-bits values.
+of the word. The game key acts by masking on/off those XORs for every combination
+of the lowest address bits. Thus, a complete key can be described by 256 16-bits values.
This use of the key is pretty similar to the one found in previous instantiations of
IGS circuits.
@@ -48,7 +48,7 @@ On a different note, the unused tail of the ROMs are pattern-filled and, more in
that region appears to be hiding 20-bytes values (SHA-1 hashes?) located at
positions which vary per set. See the table below.
-driver 20-bytes value position in the ROM
+driver 20-bytes value position in the ROM
--------- ----------------------------------
orleg2o $763984-$763997
orleg2 $76C77C-$76C78F
@@ -77,7 +77,7 @@ UINT16 igs036_decryptor::decrypt(UINT16 cipherword, int word_address)const
{
// key-independent manipulation
int aux = deobfuscate(cipherword, word_address);
-
+
// key-dependent manipulation
for (int i=0; i<16; ++i)
{
@@ -87,7 +87,7 @@ UINT16 igs036_decryptor::decrypt(UINT16 cipherword, int word_address)const
aux ^= (1<<i);
}
}
-
+
return aux^0x1a3a;
}
@@ -107,17 +107,17 @@ int igs036_decryptor::rotation(int address)const
const int group14[] = {14, 9, 3, 2}; // 14 is a guess
const int group13[] = {13,10, 6, 1};
const int group12[] = {12, 8, 4, 0};
-
+
// rotation depending on all the address bits
int enabled0 = rot_enabled(address, group15);
int rot = enabled0 * rot_group(address, group15) * 9;
-
+
int enabled1 = enabled0 ^ rot_enabled(address, group14);
rot += enabled1 * rot_group(address, group14) * 1;
-
+
int enabled2 = enabled0 ^ rot_enabled(address, group13);
rot += enabled2 * rot_group(address, group13) * 2;
-
+
int enabled3 = enabled0 ^ rot_enabled(address, group12);
rot += enabled3 * rot_group(address, group12) * 4;
@@ -143,7 +143,7 @@ int igs036_decryptor::rot_enabled(int address, const int* group)const
break;
}
}
-
+
return enabled;
}
@@ -157,7 +157,7 @@ UINT16 igs036_decryptor::rol(UINT16 num, int shift)const
{
UINT16 r = num<<shift;
UINT16 l = num>>(16-shift);
-
+
return r|l;
}
@@ -175,10 +175,10 @@ const UINT16 igs036_decryptor::triggers[16][2] = {
// of function on the 8 lowest word-address bits. Some comments:
// * Bits #5 & #6 are unused so, in fact, they only depend on 6 address bits
// * The functions are clearly low-complexity boolean functions on those 6 bits
-// rather than, say, random lookup tables
-// * There are quite a number of functionally equivalent ways to implement
-// those boolean functions, so the given implementation (by multiplexing
-// over some simple functions) shouldn't be taken too seriously: while it's
+// rather than, say, random lookup tables
+// * There are quite a number of functionally equivalent ways to implement
+// those boolean functions, so the given implementation (by multiplexing
+// over some simple functions) shouldn't be taken too seriously: while it's
// functionally correct, it doesn't neccesarily represent the way the hardware
// is calculating them.
@@ -233,38 +233,38 @@ int (*igs036_decryptor::rot_direction[4][8])(int) = {
// if any. The only exception is DDPDOJ (see below).
const UINT16 orleg2_key[0x100] = {
- 0x8100, 0x9202, 0x3000, 0x1200, 0x0100, 0x0800, 0x2100, 0xab05,
- 0x130a, 0xba0a, 0x0308, 0x9200, 0x8306, 0xab0f, 0x200c, 0x0301,
- 0x9010, 0x1b13, 0x1310, 0x1b11, 0x8104, 0x0212, 0x8204, 0x8214,
- 0x8302, 0x1111, 0x8300, 0x1b19, 0x0110, 0x8202, 0x0310, 0x0301,
- 0x8322, 0xb202, 0xb200, 0x9121, 0x8222, 0x0a26, 0x2000, 0x0321,
- 0xb000, 0x0020, 0x9328, 0x3909, 0x230a, 0x8929, 0x8224, 0x2204,
- 0x0322, 0x9b33, 0x0300, 0x9311, 0x8120, 0x8810, 0x0330, 0x0004,
- 0x832a, 0x8a0a, 0x0100, 0x1131, 0x0138, 0x093d, 0x8128, 0x081c,
- 0xe342, 0x8101, 0xf140, 0x0000, 0x6144, 0x2004, 0x8204, 0x4044,
- 0xa302, 0xdb4b, 0x1000, 0xa200, 0xc044, 0xe044, 0x010c, 0x0204,
- 0x1212, 0xdb53, 0xd050, 0xcb41, 0x4150, 0xc347, 0x4340, 0x0101,
- 0x5252, 0xd959, 0x1310, 0xc040, 0xc252, 0xc959, 0x4340, 0x8919,
- 0x2202, 0x3800, 0xe340, 0x2101, 0x0326, 0x2307, 0x4360, 0x8321,
- 0x3000, 0xbb0b, 0x5068, 0xf848, 0x436a, 0xab0b, 0xa10c, 0xe240,
- 0xc140, 0xc363, 0x8300, 0x4961, 0x0004, 0xc860, 0x0324, 0x0000,
- 0xd070, 0x8101, 0xd070, 0x1331, 0x0104, 0x4a6e, 0x4348, 0x4a78,
- 0xa282, 0xb282, 0x0200, 0x2200, 0x8180, 0x8080, 0x8080, 0x0800,
- 0x1302, 0x9989, 0x2008, 0x2000, 0xa386, 0x0b0f, 0x828c, 0xa280,
- 0x9392, 0x9292, 0x1010, 0x8080, 0x0206, 0x8383, 0x8294, 0x0911,
- 0x8382, 0x0a0a, 0x9190, 0x1010, 0x0008, 0x0b0b, 0x8098, 0x8b9d,
- 0x1120, 0x0820, 0x2200, 0xa080, 0x81a4, 0xa286, 0xa380, 0xaa80,
- 0x0120, 0x1020, 0xb088, 0x1020, 0x2000, 0x0b2b, 0x2100, 0x2a0c,
- 0x9292, 0x98b0, 0x1330, 0x8880, 0x8396, 0x0b17, 0x8080, 0x0325,
- 0x0000, 0x99b9, 0x92b0, 0x82a0, 0x8184, 0x0020, 0x0330, 0x0818,
- 0xe1c0, 0xa981, 0xd1c0, 0xd0c0, 0x6140, 0x4242, 0xc2c4, 0x6345,
- 0xb088, 0x7141, 0x4040, 0xa181, 0x220e, 0xe0c4, 0x4144, 0x6a4c,
- 0xd0d0, 0x9a92, 0x1310, 0xd9d1, 0x8392, 0xc0c4, 0x8284, 0x8890,
- 0xc0c0, 0x8282, 0x8280, 0x9090, 0x4342, 0x0a0a, 0x4240, 0xc1d5,
- 0xb080, 0xb282, 0xc1e0, 0x90a0, 0xa084, 0x4b63, 0x81a0, 0xeac0,
- 0x7242, 0x5363, 0x7348, 0x0321, 0x022a, 0x6949, 0x4360, 0x8aa8,
- 0x8282, 0x0303, 0x8180, 0x1331, 0x83a2, 0x4b53, 0x4364, 0x83b1,
- 0x121a, 0x80a0, 0x1238, 0x0000, 0x82ba, 0x0030, 0xc0c0, 0x4264,
+ 0x8100, 0x9202, 0x3000, 0x1200, 0x0100, 0x0800, 0x2100, 0xab05,
+ 0x130a, 0xba0a, 0x0308, 0x9200, 0x8306, 0xab0f, 0x200c, 0x0301,
+ 0x9010, 0x1b13, 0x1310, 0x1b11, 0x8104, 0x0212, 0x8204, 0x8214,
+ 0x8302, 0x1111, 0x8300, 0x1b19, 0x0110, 0x8202, 0x0310, 0x0301,
+ 0x8322, 0xb202, 0xb200, 0x9121, 0x8222, 0x0a26, 0x2000, 0x0321,
+ 0xb000, 0x0020, 0x9328, 0x3909, 0x230a, 0x8929, 0x8224, 0x2204,
+ 0x0322, 0x9b33, 0x0300, 0x9311, 0x8120, 0x8810, 0x0330, 0x0004,
+ 0x832a, 0x8a0a, 0x0100, 0x1131, 0x0138, 0x093d, 0x8128, 0x081c,
+ 0xe342, 0x8101, 0xf140, 0x0000, 0x6144, 0x2004, 0x8204, 0x4044,
+ 0xa302, 0xdb4b, 0x1000, 0xa200, 0xc044, 0xe044, 0x010c, 0x0204,
+ 0x1212, 0xdb53, 0xd050, 0xcb41, 0x4150, 0xc347, 0x4340, 0x0101,
+ 0x5252, 0xd959, 0x1310, 0xc040, 0xc252, 0xc959, 0x4340, 0x8919,
+ 0x2202, 0x3800, 0xe340, 0x2101, 0x0326, 0x2307, 0x4360, 0x8321,
+ 0x3000, 0xbb0b, 0x5068, 0xf848, 0x436a, 0xab0b, 0xa10c, 0xe240,
+ 0xc140, 0xc363, 0x8300, 0x4961, 0x0004, 0xc860, 0x0324, 0x0000,
+ 0xd070, 0x8101, 0xd070, 0x1331, 0x0104, 0x4a6e, 0x4348, 0x4a78,
+ 0xa282, 0xb282, 0x0200, 0x2200, 0x8180, 0x8080, 0x8080, 0x0800,
+ 0x1302, 0x9989, 0x2008, 0x2000, 0xa386, 0x0b0f, 0x828c, 0xa280,
+ 0x9392, 0x9292, 0x1010, 0x8080, 0x0206, 0x8383, 0x8294, 0x0911,
+ 0x8382, 0x0a0a, 0x9190, 0x1010, 0x0008, 0x0b0b, 0x8098, 0x8b9d,
+ 0x1120, 0x0820, 0x2200, 0xa080, 0x81a4, 0xa286, 0xa380, 0xaa80,
+ 0x0120, 0x1020, 0xb088, 0x1020, 0x2000, 0x0b2b, 0x2100, 0x2a0c,
+ 0x9292, 0x98b0, 0x1330, 0x8880, 0x8396, 0x0b17, 0x8080, 0x0325,
+ 0x0000, 0x99b9, 0x92b0, 0x82a0, 0x8184, 0x0020, 0x0330, 0x0818,
+ 0xe1c0, 0xa981, 0xd1c0, 0xd0c0, 0x6140, 0x4242, 0xc2c4, 0x6345,
+ 0xb088, 0x7141, 0x4040, 0xa181, 0x220e, 0xe0c4, 0x4144, 0x6a4c,
+ 0xd0d0, 0x9a92, 0x1310, 0xd9d1, 0x8392, 0xc0c4, 0x8284, 0x8890,
+ 0xc0c0, 0x8282, 0x8280, 0x9090, 0x4342, 0x0a0a, 0x4240, 0xc1d5,
+ 0xb080, 0xb282, 0xc1e0, 0x90a0, 0xa084, 0x4b63, 0x81a0, 0xeac0,
+ 0x7242, 0x5363, 0x7348, 0x0321, 0x022a, 0x6949, 0x4360, 0x8aa8,
+ 0x8282, 0x0303, 0x8180, 0x1331, 0x83a2, 0x4b53, 0x4364, 0x83b1,
+ 0x121a, 0x80a0, 0x1238, 0x0000, 0x82ba, 0x0030, 0xc0c0, 0x4264,
};
const UINT16 m312cn_key[0x100] = {