added decryption for Gundam Wing: Endless Duel (SNES bootleg) [iq_132]

still doesn't work, probably needs correct boot vectors or some other protection?
This commit is contained in:
David Haywood 2014-08-26 15:58:54 +00:00
parent 8b7fe01cb0
commit 92d59c28ed

View File

@ -844,13 +844,52 @@ DRIVER_INIT_MEMBER(snesb_state,sblast2b)
DRIVER_INIT_MEMBER(snesb_state,endless)
{
INT32 i;
UINT8 *rom = memregion("user3")->base();
int i;
UINT8 *src = memregion("user7")->base();
UINT8 *dst = memregion("user3")->base();
/* there is more to this, 0x800 based block swaps? */
for (i = 0; i < 0x200000; i++)
{
rom[i] = rom[i]^0x55;
static const UINT8 address_tab_high[0x40] = {
0x3b, 0x1d, 0x35, 0x15, 0x39, 0x19, 0x34, 0x13, 0x32, 0x1f, 0x37, 0x17, 0x3d, 0x11, 0x3a, 0x1a,
0x14, 0x3e, 0x18, 0x36, 0x1e, 0x31, 0x10, 0x3c, 0x1b, 0x3f, 0x16, 0x30, 0x12, 0x38, 0x1c, 0x33,
0x2b, 0x0d, 0x25, 0x05, 0x29, 0x09, 0x24, 0x03, 0x22, 0x0f, 0x27, 0x07, 0x2d, 0x01, 0x2a, 0x0a,
0x04, 0x2e, 0x08, 0x26, 0x0e, 0x21, 0x00, 0x2c, 0x0b, 0x2f, 0x06, 0x20, 0x02, 0x28, 0x0c, 0x23
};
static const UINT8 address_tab_low[0x40] = {
0x14, 0x1d, 0x11, 0x3c, 0x0a, 0x29, 0x2d, 0x2e, 0x30, 0x32, 0x16, 0x36, 0x05, 0x25, 0x26, 0x37,
0x20, 0x21, 0x27, 0x28, 0x33, 0x34, 0x23, 0x12, 0x1e, 0x1f, 0x3b, 0x24, 0x2c, 0x35, 0x38, 0x39,
0x3d, 0x0c, 0x2a, 0x0d, 0x22, 0x18, 0x19, 0x1a, 0x03, 0x08, 0x04, 0x3a, 0x0b, 0x0f, 0x15, 0x17,
0x1b, 0x13, 0x00, 0x1c, 0x2b, 0x01, 0x06, 0x2f, 0x07, 0x09, 0x02, 0x31, 0x10, 0x0e, 0x3f, 0x3e
};
static const UINT8 data_high[16] = {
0x88, 0x38, 0x10, 0x98, 0x90, 0x00, 0x08, 0x18, 0x20, 0xb8, 0xa8, 0xa0, 0x30, 0x80, 0x28, 0xb0
};
static const UINT8 data_low[16] = {
0x41, 0x46, 0x02, 0x43, 0x03, 0x00, 0x40, 0x42, 0x04, 0x47, 0x45, 0x05, 0x06, 0x01, 0x44, 0x07
};
for (i = 0; i < 0x200000; i++) {
int j = (address_tab_high[i >> 15] << 15) + (i & 0x7fc0) + address_tab_low[i & 0x3f];
dst[i] = data_high[src[j]>>4] | data_low[src[j]&0xf];
if (i >= 0x00000 && i < 0x10000) {
dst[i] = BITSWAP8(dst[i],2,3,4,1,7,0,6,5);
}
if (i >= 0x10000 && i < 0x20000) {
dst[i] = BITSWAP8(dst[i],1,5,6,0,2,4,7,3) ^ 0xff;
}
if (i >= 0x20000 && i < 0x30000) {
dst[i] = BITSWAP8(dst[i],3,0,1,6,4,5,2,7);
}
if (i >= 0x30000 && i < 0x40000) {
dst[i] = BITSWAP8(dst[i],0,4,2,3,5,6,7,1) ^ 0xff;
}
}
DRIVER_INIT_CALL(snes);