Add preliminary Puzzli2 protection simulation and remove patches. Also remove some comments.

This commit is contained in:
iq_132 2011-12-27 04:09:55 +00:00
parent a52079546a
commit 8d1fd98c23
4 changed files with 117 additions and 69 deletions

View File

@ -4,38 +4,6 @@
#include "pgm.h"
/*
IGS PolyGame Master game IDs
ID# Year Game
01 1997 Oriental Legend
02 1997 Dragon World 2
03 1998 The Killing Blade
04 1998 Dragon World 3
05 1999 Oriental Legend Super
06 1999 Knights of Valour / Knights of Valour Plus / Knights of Valour Superheroes
07 1999 Photo Y2k
08 1999 Puzzle Star
09 2001 Puzzli 2 Super
10 2001 Martial Masters
11 2001 Photo Y2k2
12 2000 Knights of Valour 2 / Knights of Valour 2 Plus
13 2001 DoDonPachi 2 - Bee Storm
14? 2001 Dragon World 2001
44 2002 DoDonPachi Dai-Ou-Jou / DoDonPachi Dai-Ou-Jou Black Label
45 2002 Demon Front
46 2003 The Gladiator
47 2002 Ketsui Kizuna Jigoku Tachi
48 2003 Espgaluda
52? 2004 Happy 6in1
53 2004 Oriental Legend Special Plus
54 2004 Knights of Valour Super Heroes Plus
56 2005 S.V.G. - Spectral vs Generation
57 2005 The Killing Blade Plus
*/
static struct BurnRomInfo emptyRomDesc[] = {
{ "", 0, 0, 0 },
};
@ -1669,27 +1637,10 @@ static struct BurnRomInfo puzzli2RomDesc[] = {
STDROMPICKEXT(puzzli2, puzzli2, pgm)
STD_ROM_FN(puzzli2)
static void puzzli2_decrypt()
{
pgm_decrypt_puzzli2();
*((UINT16*)(PGM68KROM + 0x0268c0)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x0268c2)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x0268c4)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x03877a)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x04cee0)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x0548ec)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x0548fc)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x054948)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x05496A)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x0549FA)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(PGM68KROM + 0x054A0A)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
}
static INT32 puzzli2Init()
{
pPgmInitCallback = puzzli2_decrypt;
pPgmProtCallback = install_protection_asic27_kov; // simulation
pPgmInitCallback = pgm_decrypt_puzzli2;
pPgmProtCallback = install_protection_asic27a_puzzli2; // simulation
// pPgmProtCallback = install_protection_asic27a_kovsh;
return pgmInit();
@ -3254,6 +3205,7 @@ struct BurnDriverD BurnDrvkovlsqh2 = {
448, 224, 4, 3
};
// Knights of Valour: Luan Shi Quan Huang 2 / Sangoku Senki: Luan Shi Quan Huang (ver. 200CN)
static struct BurnRomInfo kovlsqhRomDesc[] = {
@ -3548,4 +3500,3 @@ struct BurnDriver BurnDrvKovsgqyzb = {
kovsgqyzInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x600,
448, 224, 4, 3
};

View File

@ -74,6 +74,7 @@ void install_protection_asic27a_ddp2();
void install_protection_asic27a_svg();
void install_protection_asic27a_ketsui();
void install_protection_asic27a_ddp3();
void install_protection_asic27a_puzzli2();
// pgm_crypt
void pgm_decrypt_kov();

View File

@ -3,23 +3,6 @@
#include "pgm.h"
#include "bitswap.h"
/*
Some xor tables used to decrypt the program roms contain asci text
IGS #### RD ? YR MO DAY - GAME
IGS 0004 RD 1 02 10 15 - ketsui
IGS 0005 RD 1 02 12 03 - theglad
IGS 0007 RD 1 03 09 09 - espgaluda
IGS 0008 RD 1 03 12 15 - happy6in1
IGS 0009 rd 1 04 02 19 - kovshp
IGS 0013 RD 1 04 07 27 - oldsplus
IGS 0024 RD 1 05 09 08 - killbldp
IGS 0055 RD 4 02 06 21 - Sheng Dan Wu Xian (non-PGM, but uses asic27A)
The later games (ones that use ASIC27/ASIC27A) have ram-based xor tables. The
internal ASIC program uploads the xor to the 0x50000000 - 0x500003ff region.
*/
void pgm_decrypt_dw2()
{
UINT16 *src = (UINT16 *)PGM68KROM;

View File

@ -2173,6 +2173,119 @@ void install_protection_asic27a_ddp3()
}
// preliminary
static INT32 puzzli_54_trigger = 0;
static void __fastcall puzzli2_asic_write(UINT32 offset, UINT16 data)
{
switch (offset & 0x06)
{
case 0: ddp3value = data; return;
case 2:
{
if ((data >> 8) == 0xff) ddp3key = 0xffff;
ddp3value ^= ddp3key;
// bprintf (0, _T("ASIC Command: %2.2x, Value: %4.4x,\n"), (data ^ ddp3key) & 0xff, ddp3value);
switch ((data ^ ddp3key) & 0xff)
{
case 0x13: // ASIC status?
ddp3response = 0x74<<16; // 2d or 74! (based on?)
break;
case 0x31:
{
// how is this selected? command 54?
// just a wild guess
if (puzzli_54_trigger) {
// pc == 1387de
ddp3response = 0x63<<16; // ?
} else {
// pc == 14cf58
ddp3response = 0xd2<<16;
}
puzzli_54_trigger = 0;
}
break;
case 0x38: // Reset
ddp3response = 0x78<<16;
ddp3key = 0;
puzzli_54_trigger = 0;
break;
case 0x41: // ASIC status?
ddp3response = 0x74<<16;
break;
case 0x47: // ASIC status?
ddp3response = 0x74<<16;
break;
case 0x52: // ASIC status?
{
// how is this selected?
//if (ddp3value == 6) {
ddp3response = (0x74<<16)|1; // |1?
//} else {
// ddp3response = 0x74<<16;
//}
}
break;
case 0x54: // ??
puzzli_54_trigger = 1;
ddp3response = 0x36<<16;
break;
case 0x61: // ??
ddp3response = 0x36<<16;
break;
case 0x63: // probably read from a data table?
ddp3response = 0; // wrong...
break;
case 0x67: // probably read from a data table?
ddp3response = 0; // wrong...
break;
default:
// bprintf (0, _T("ASIC Command %2.2x unknown!\n"), (data ^ ddp3key) & 0xff);
ddp3response = 0x74<<16;
break;
}
ddp3key = (ddp3key + 0x0100) & 0xff00;
if (ddp3key == 0xff00) ddp3key = 0x0100;
ddp3key |= ddp3key >> 8;
}
return;
case 4: return;
}
}
void install_protection_asic27a_puzzli2()
{
pPgmResetCallback = reset_ddp3;
pPgmScanCallback = ddp3Scan;
SekOpen(0);
SekMapHandler(4, 0x500000, 0x500005, SM_READ | SM_WRITE);
SekSetReadWordHandler(4, ddp3_asic_read);
SekSetWriteWordHandler(4, puzzli2_asic_write);
SekClose();
}
//-----------------------------------------------------------------------------------------------------
// Save states