funworld.c: Proper decryption of rcdino4 code pages. [Peter Ferrie]

This commit is contained in:
Scott Stone 2014-04-27 17:48:00 +00:00
parent 121359ecbc
commit 0b84fba6b4

View File

@ -6144,7 +6144,7 @@ DRIVER_INIT_MEMBER(funworld_state, rcdino4)
int sizeg = memregion("gfx1")->bytes();
int startg = 0;
int i, a;
int i, a, j;
/*****************************
* Program ROM decryption *
@ -6169,6 +6169,138 @@ DRIVER_INIT_MEMBER(funworld_state, rcdino4)
a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
rom[a] = buffer[i];
}
j = 0;
for (i = 0x8101; i < 0x8173;)
{
rom[i] ^= 0xb8;
switch (j)
{
case 0:
case 2:
case 4:
case 5:
{
i += 2;
break;
}
case 1:
case 3:
case 6:
{
i += 3;
break;
}
default: /* case 7 */
{
i += 2;
j = 0;
}
}
++j;
}
/* I could not find any obvious pattern to these */
rom[0x8174] ^= 0xb8;
rom[0x8176] ^= 0xb8;
rom[0x8177] ^= 0xb8;
rom[0x8179] ^= 0xb8;
rom[0x817b] ^= 0xb8;
rom[0x817d] ^= 0xb8;
rom[0x8180] ^= 0xb8;
rom[0x8183] ^= 0xb8;
rom[0x8185] ^= 0xb8;
rom[0x8187] ^= 0xb8;
rom[0x818a] ^= 0xb8;
rom[0x818c] ^= 0xb8;
rom[0x818f] ^= 0xb8;
rom[0x8192] ^= 0xb8;
rom[0x8195] ^= 0xb8;
rom[0x8198] ^= 0xb8;
rom[0x819b] ^= 0xb8;
rom[0x819d] ^= 0xb8;
rom[0x81a0] ^= 0xb8;
rom[0x81b2] ^= 0xb8;
rom[0x81b3] ^= 0xb8;
rom[0x81b4] ^= 0xb8;
rom[0x81b5] ^= 0xb8;
rom[0x81b7] ^= 0xb8;
rom[0x81b9] ^= 0xb8;
rom[0x81bb] ^= 0xb8;
rom[0x81bd] ^= 0xb8;
rom[0x81bf] ^= 0xb8;
rom[0x81c1] ^= 0xb8;
rom[0x81c3] ^= 0xb8;
rom[0x81c5] ^= 0xb8;
rom[0x81c7] ^= 0xb8;
rom[0x81c9] ^= 0xb8;
rom[0x81cb] ^= 0xb8;
rom[0x81cd] ^= 0xb8;
rom[0x81ce] ^= 0xb8;
rom[0x81d0] ^= 0xb8;
rom[0x81d2] ^= 0xb8;
rom[0x81d3] ^= 0xb8;
rom[0x81d5] ^= 0xb8;
rom[0x81d6] ^= 0xb8;
rom[0x81d8] ^= 0xb8;
rom[0x81db] ^= 0xb8;
rom[0x81dd] ^= 0xb8;
rom[0x81df] ^= 0xb8;
rom[0x81e0] ^= 0xb8;
rom[0x81e2] ^= 0xb8;
rom[0x81e5] ^= 0xb8;
rom[0x81e7] ^= 0xb8;
rom[0x81ea] ^= 0xb8;
rom[0x81ec] ^= 0xb8;
rom[0x81ef] ^= 0xb8;
rom[0x81f1] ^= 0xb8;
rom[0x81f4] ^= 0xb8;
rom[0x81f6] ^= 0xb8;
rom[0x81f9] ^= 0xb8;
rom[0x81fb] ^= 0xb8;
rom[0x81fe] ^= 0xb8;
rom[0x8201] ^= 0x32;
rom[0x8204] ^= 0x32;
rom[0x8207] ^= 0x32;
rom[0x8209] ^= 0x32;
rom[0x820a] ^= 0x32;
rom[0x820d] ^= 0x32;
rom[0x820e] ^= 0x32;
rom[0x8210] ^= 0x32;
rom[0x8212] ^= 0x32;
rom[0x8213] ^= 0x32;
rom[0x8214] ^= 0x32;
rom[0x8215] ^= 0x32;
rom[0x8216] ^= 0x32;
rom[0x8217] ^= 0x32;
rom[0x8219] ^= 0x32;
rom[0x821b] ^= 0x32;
rom[0x821d] ^= 0x32;
rom[0x821f] ^= 0x32;
rom[0x8221] ^= 0x32;
rom[0x8223] ^= 0x32;
rom[0x8225] ^= 0x32;
rom[0x8226] ^= 0x32;
rom[0x8227] ^= 0x32;
rom[0x822a] ^= 0x32;
rom[0x822c] ^= 0x32;
rom[0x822d] ^= 0x32;
rom[0x8230] ^= 0x32;
rom[0x8232] ^= 0x32;
rom[0x8254] ^= 0x32;
rom[0x8255] ^= 0x32;
rom[0x8256] ^= 0x32;
rom[0x8259] ^= 0x32;
rom[0x825a] ^= 0x32;
rom[0x825c] ^= 0x32;
}