Author Topic: SVC Chaos driver infos.  (Read 47018 times)

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #90 on: March 06, 2006, 07:09:03 PM »
Maybe is a problem with the bankswitch you have... I'll post my whole svcpcb source + decrypted C sets, mine works just fine :)
See ya!!!!! :biggrin:

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #91 on: March 06, 2006, 07:32:49 PM »
Here my complete Driver:
d_neogeo.cpp:
add this after neotrackball BIOS info:
Code: [Select]
static struct BurnRomInfo PCB269RomDesc[] = {
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "269-bios.bin",   0x080000, 0xb4590283, BRF_BIOS },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "sm1.sm1",        0x020000, 0x97Cf998B, BRF_ESS | BRF_PRG | BRF_BIOS }, // 10 Z80 program
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "sfix.sfx",       0x020000, 0x354029FC, BRF_GRA | BRF_BIOS }, // 14 Text layer tiles
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },
{ "",                      0,          0, 0 },

{ "000-lo.lo",      0x010000, 0xE09E253C, BRF_ESS | BRF_PRG | BRF_BIOS }, // 18 Zoom table
};


STD_ROM_PICK(PCB269);
STD_ROM_FN(PCB269);
now after the neotrackball DIP settings add this:
Code: [Select]
static struct BurnDIPInfo PCB269DIPList[] = {
// Offset
{0x19, 0xF0, 0x00, 0x00, NULL},

// Defaults
{0x00, 0xFF, 0xFF, 0x00, NULL},
{0x01, 0xFF, 0x7F, 0x00, NULL},
// Fake DIPs
{0x02, 0xFF, 0xFF, 0x86, NULL},

{0, 0xFE, 0, 2,   "Autofire"},
{0x0D, 0x01, 0x04, 0x00, "Off"},
{0x0D, 0x01, 0x04, 0x04, "On"},

// DIP 1
{0, 0xFE, 0, 2,   "Setting mode"},
{0x00, 0x01, 0x01, 0x00, "Off"},
{0x00, 0x01, 0x01, 0x01, "On"},

// 1 or 2 coin slots
{0, 0xFE, 0, 2,   "Coin chutes"},
{0x00, 0x02, 0x02, 0x00, "1"},
{0x02, 0x00, 0x3F, 0x06, NULL},
{0x00, 0x02, 0x02, 0x02, "2"},
{0x02, 0x00, 0x3F, 0x06, NULL},
// 2 or 4 coin slots
{0, 0xFE, 0, 2,   "Coin chutes"},
{0x00, 0x82, 0x02, 0x00, "2"},
{0x02, 0x00, 0x3F, 0x06, NULL},
{0x00, 0x82, 0x02, 0x02, "4"},
{0x02, 0x00, 0x3F, 0x06, NULL},

{0, 0xFE, 0, 5,   "Commmunicaton"},
{0x00, 0x01, 0x38, 0x00, "Disabled"},
{0x00, 0x01, 0x38, 0x08, "Setting 1"},
{0x00, 0x01, 0x38, 0x10, "Setting 2"},
{0x00, 0x01, 0x38, 0x18, "Setting 3"},
{0x00, 0x01, 0x38, 0x20, "Setting 4"},
{0x00, 0x01, 0x38, 0x28, "Setting 5"},
{0x00, 0x01, 0x38, 0x30, "Setting 6"},
{0x00, 0x01, 0x38, 0x38, "Setting 7"},
{0, 0xFE, 0, 2,   "Free play"},
{0x00, 0x01, 0x40, 0x00, "Off"},
{0x00, 0x01, 0x40, 0x40, "On"},
{0, 0xFE, 0, 2,   "Stop mode"},
{0x00, 0x01, 0x80, 0x00, "Off"},
{0x00, 0x01, 0x80, 0x80, "On"},

// Region
{0, 0xFD, 0, 2,   "Region"},
{0x02, 0x02, 0x03, 0x02, "Asia / Europe"},
{0x02, 0x00, 0x30, 0x00, NULL},
{0x02, 0x02, 0x03, 0x03, "Japan"},
{0x02, 0x00, 0x30, 0x00, NULL},
};
now... add this drivers:
Code: [Select]
// SvC Chaos - SNK vs CAPCOM (PCB board)

static struct BurnRomInfo svcpcbRomDesc[] = {
{ "269-p1.bin",           0x2000000, 0x432CFDFC, 1 | BRF_ESS | BRF_PRG }, // 0 68K code

{ "269-c1.bin",           0x2000000, 0x1B608F9C, 3 | BRF_GRA },   // 1 Sprite data
{ "269-c2.bin",           0x2000000, 0x5A95F294, 3 | BRF_GRA },   // 2

{ "269-m1_decrypted.bin", 0x080000,  0x7b7bf462, 4 | BRF_ESS | BRF_PRG }, // 3 Z80 code (decrypted)
{ "269-m1.bin",           0x080000,  0xf6819d00, 0 | BRF_PRG | BRF_OPT }, // 4

// This uses Neo-PCM2 PLAYMORE(c) 2002 Protection chip
{ "269-v1.bin",           0x800000,  0xC659B34C, 5 | BRF_SND },   // 5 Sound data
{ "269-v2.bin",           0x800000,  0xDD903835, 5 | BRF_SND },   // 6
};

STDROMPICKEXT(svcpcb, svcpcb, PCB269);
STD_ROM_FN(svcpcb);

static int svcpcbInit()
{
nNeoProtectionXor = 0x57;
nNeoTextROMSize = 0x080000;
return NeoPVCInit(svcpcbPVCDecrypt, 1, 5, 7);
}

struct BurnDriver BurnDrvsvcpcb = {
"svcpcb", NULL, NULL, "2003", // boardrom is NULL because it NOT a neogeo cart
"SvC Chaos - SNK vs CAPCOM (JAMMA PCB)\0", "PCB Custom board / Asia / Japan", "Capcom / Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B | HARDWARE_SNK_ALTERNATE_TEXT | HARDWARE_SNK_PCB_BIOS,
NULL, svcpcbRomInfo, svcpcbRomName, neogeoInputInfo, PCB269DIPInfo,
svcpcbInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};

// SvC Chaos - SNK vs CAPCOM (PCB board, decrypted C-ROMs)

static struct BurnRomInfo svcpcbnRomDesc[] = {
{ "269-p1.bin",           0x2000000, 0x432CFDFC, 1 | BRF_ESS | BRF_PRG }, //  0 68K code

{ "svcn_c1.rom",          0x2000000, 0x382ce01f, 3 | BRF_GRA },   //  1 Sprite data
{ "svcn_c2.rom",          0x2000000, 0x88ad01ec, 3 | BRF_GRA },   //  2

{ "269-m1_decrypted.bin", 0x080000,  0x7b7bf462, 4 | BRF_ESS | BRF_PRG }, // 3 Z80 code (decrypted)

{ "269-v1.bin",           0x800000,  0xc659b34c, 5 | BRF_SND },   //  4 Sound data
{ "269-v2.bin",           0x800000,  0xdd903835, 5 | BRF_SND },   //  5
};

STDROMPICKEXT(svcpcbn, svcpcbn, PCB269);
STD_ROM_FN(svcpcbn);

struct BurnDriver BurnDrvsvcpcbn = {
"svcpcbn", "svcpcb", NULL, "2003",
"SvC Chaos - SNK vs CAPCOM (JAMMA PCB, decrypted C)\0", "PCB Custom board / Asia / Japan, decrypted C-ROMs", "Capcom / Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ALTERNATE_TEXT | HARDWARE_SNK_PCB_BIOS,
NULL, svcpcbnRomInfo, svcpcbnRomName, neogeoInputInfo, PCB269DIPInfo,
svcpcbInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
perfect... now the rest: the bankswitch
Code: [Select]
// ----------------------------------------------------------------------------
// Extra code for Neo-PVC Protection
// ----------------------------------------------------------------------------
// General Bankswitch & Protections for PVC Protected games
// ========================================================
unsigned short CartRAM[0x1000];

unsigned char pvc_r8(unsigned int sekAddress)
{
return *(((unsigned char*)CartRAM) + ((sekAddress^1) - 0x2fe000));
}

void pvc_w8(unsigned int sekAddress, unsigned char byteValue)
{
*(((unsigned char*)CartRAM) + ((sekAddress^1) - 0x2fe000)) = byteValue;
}

// These perform some palette calculations
// Unpack palette word to RGB dword, thanks to bms888
void pvc_prot1() // on writes to e0/e1
{
unsigned char b1, b2;
b1 = pvc_r8(0x2fffe0);
b2 = pvc_r8(0x2fffe1);

pvc_w8(0x2fffe3,(((b2>>0)&0xf)<<1)|((b1>>4)&1));
pvc_w8(0x2fffe2,(((b2>>4)&0xf)<<1)|((b1>>5)&1));
pvc_w8(0x2fffe5,(((b1>>0)&0xf)<<1)|((b1>>6)&1));
pvc_w8(0x2fffe4, (b1>>7));
}

// pack RGB dword to palette word
void pvc_prot2() // on writes to e8/e9/ea/eb
{
unsigned char b1, b2, b3, b4;
b1 = pvc_r8(0x2fffe8);
b2 = pvc_r8(0x2fffe9);
b3 = pvc_r8(0x2fffea);
b4 = pvc_r8(0x2fffeb);

pvc_w8(0x2fffed,(b2>>1)|((b1>>1)<<4));
pvc_w8(0x2fffec,(b4>>1)|((b2&1)<<4)|((b1&1)<<5)|((b4&1)<<6)|((b3&1)<<7));
}

void mv0WriteBankSwitch() // on writes to f0-f3
{
unsigned int offset = (pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff0)<<0);
*(((unsigned char*)CartRAM) + (0x2ffff0-0x2fe000)) = 0xA0; // Modified
*(((unsigned char*)CartRAM) + (0x2ffff1-0x2fe000)) &= 0xFE;
*(((unsigned char*)CartRAM) + (0x2ffff3-0x2fe000)) &= 0x7F;
if ((BurnDrvGetFlags() & BDF_BOOTLEG) && (Neo68KROM[0x108] == 0x69)) {
SekMapMemory(Neo68KROM + offset, 0x200000, 0x2fdfff, SM_ROM);
} else {
SekMapMemory(Neo68KROM + 0x100000 + offset, 0x200000, 0x2fdfff, SM_ROM);
}
}

unsigned char __fastcall mv0ReadByteBankSwitch(unsigned int sekAddress)
{
return pvc_r8(sekAddress);
}

unsigned short __fastcall mv0ReadWordBankSwitch(unsigned int sekAddress)
{
return CartRAM[(sekAddress-0x2fe000)/2];
}

void __fastcall mv0WriteByteBankSwitch(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
if (sekAddress>=0x2fffe0 && sekAddress<=0x2fffe1) pvc_prot1();
else if(sekAddress>=0x2fffe8 && sekAddress<=0x2fffeb) pvc_prot2();
else if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3) mv0WriteBankSwitch();
}

void __fastcall mv0WriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2] = wordValue;
if (sekAddress>=0x2fffe0 && sekAddress<=0x2fffe1) pvc_prot1();
else if(sekAddress>=0x2fffe8 && sekAddress<=0x2fffeb) pvc_prot2();
else if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3) mv0WriteBankSwitch();
}

// This is needed for the scan function and savestates
unsigned char *NeoCartRAM = (unsigned char*)CartRAM;

int NeoPVCScan(int nAction, int* /*pnMin*/)
{
struct BurnArea ba;

if (nAction & ACB_MEMORY_RAM) {
ba.Data = NeoCartRAM;
ba.nLen = 0x00002000;
ba.nAddress = 0;
ba.szName = "Neo-PVC 68K RAM";
BurnAcb(&ba);
}

return 0;
}

void NeoPVCMapBank()
{
// Don't map memory to the 68K BankAdress, PVC games don't use it (it seems...)
return;
}

// Install handlers
int NeoPVCInit(void(*pInitCallback)(), int nGameInit, void(*pBIOSCallBack)(),int nPCM2Value, int nTextDecValue)
{
int nRet;
extern unsigned char *Neo68KBIOS;

// Set up Extra RAM for PVC games (mslug5 doesn't use this)
memset(CartRAM, 0, sizeof(CartRAM));

pNeoInitCallback = pInitCallback;
pNeoBankswitchCallback = NeoPVCMapBank;
pNeoScanCallback = NeoPVCScan;

// Special handlers for sound and text if necesary
nNeoPCM2PLAYMOREProtection = nPCM2Value; // Neo-PCM2 PLAYMORE (c) type
nNeoTextROMFixType = nTextDecValue; // Text encryption handler

if ((nRet = NeoInit()) == 0) {
// Install Normal BankSwitch handler
SekMapHandler(5,  0x2fe000,  0x2fffff,  SM_READ);
SekSetReadWordHandler(5,  mv0ReadWordBankSwitch);
SekSetReadByteHandler(5,  mv0ReadByteBankSwitch);

SekMapHandler(5,  0x2fe000,  0x2fffff,  SM_WRITE);
SekSetWriteWordHandler(5, mv0WriteWordBankSwitch);
SekSetWriteByteHandler(5, mv0WriteByteBankSwitch);

if (nGameInit == 2) {
// Handler for kof2003 BIOS
SekMapMemory(Neo68KBIOS + 0x20000, 0xC20000, 0xC3FFFF, SM_ROM);
}
}
return nRet;
}
decryption for this sets:
Code: [Select]
// ----------------------------------------------------------------------------
// mslug5, svcchaos, kof2003

static void Neo68KROM32WORDSWAP(unsigned char* Neo68KROMData, int nROMsize)
{
// Interleave data in the 68K code

unsigned short *ROMData = (unsigned short*)Neo68KROMData;
unsigned short *tmp = (unsigned short*)malloc(nROMsize);
for (int i = 0; i < 0x200000; i++) {
tmp[i * 2 + 0] = ROMData[i];
tmp[i * 2 + 1] = ROMData[i + 0x200000];
}
memcpy(ROMData, tmp, nROMsize);
free(tmp);
}

// By IQ_132 -- http://neosource.1emu.net/
static void Neo_PVC_PLAYMORE_2003(int g) // 0 mslug5, 1 kof2003, 2 kof2003a, 3 svcchaos
{
const unsigned char b0[4][8] = {
{ 6, 7, 4, 5, 2, 3, 0, 1 },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 1, 0, 3, 2, 5, 4, 7, 6 },
{ 6, 7, 4, 5, 2, 3, 0, 1 },
};

const unsigned char b1[4][8] = {
{ 1, 0, 3, 2, 5, 4, 7, 6 },
{ 1, 0, 3, 2, 4, 5, 6, 7 },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 2, 3, 0, 1, 4, 5, 6, 7 },
};

unsigned int adxor[4] = { 0x00700, 0x00300, 0x00800, 0x00A00 };

unsigned char *pTemp = (unsigned char*)malloc(0x900000);

int x1 = 0xFF; if (g == 0) x1 = 0; // mslug5 fix

for(int i = 0; i < 0x100000; i++)
pTemp[i] = Neo68KROM[i] ^ x1 ^ Neo68KROM[0x0FFFE0 + (i % 0x20)];

for(int i = 0x100000; i < 0x800000; i++)
pTemp[i] = Neo68KROM[i] ^ 0xFF ^ Neo68KROM[0x7FFFE0 + (i % 0x20)];

for(int i = 0x100000; i < 0x800000; i += 4) {
unsigned short *rom16 = (unsigned short*)&pTemp[i + 1];
*rom16 = (*rom16&0xF00F) | BITSWAP08((*rom16>>4)&0xFF, b0[g][0], b0[g][1], b0[g][2], b0[g][3], b0[g][4], b0[g][5], b0[g][6], b0[g][7])<<4;
}

for(int i = 0; i < 0x10; i++) {
int j = (i & 0xf0) + BITSWAP08((i & 0x0f), 7, 6, 5, 4, b1[g][0], b1[g][1], b1[g][2], b1[g][3]);
memcpy(Neo68KROM + i * 0x10000, pTemp + j * 0x10000, 0x10000);
}

if ((g == 1) || (g == 2))
memcpy(Neo68KROM + 0x100000, Neo68KROM + 0x800000, 0x100000); // move P3 (kof2003/a)

for(int i = 0x100000; i < 0x700000; i += 0x100) {
int j = (i & 0xf000ff) + ((i & 0x000f00) ^ adxor[g]) + (BITSWAP08(((i & 0x0ff000) >> 12), b1[g][4], b1[g][5], b1[g][6], b1[g][7], 1, 0, 3, 2) << 12);
memcpy(Neo68KROM + i + 0x100000, pTemp + j, 0x100);
}

free(pTemp);
}

void svcpcbPVCDecrypt()
{
Neo_PVC_PLAYMORE_2003(3);
}
ok... we're complete with inits... now let's go to:
neo_run.cpp:
add this befor SRAMProtaddres:
Code: [Select]
int nNeoPCM2PLAYMOREProtection = 0;
int nNeoTextROMFixType = 0;
now in ROMIndex replace:
Code: [Select]
Neo68KBIOS = Next; Next += 0x20000; // 68K boardROMwith:
Code: [Select]
Neo68KBIOS = Next; Next += nCodeSize; // 68K boardROMnow in NeoLoad68KBIOS function after the SNK_TRACKBALL flag add:
Code: [Select]
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_PCB_BIOS) {
nNewBIOS = 10;
}
remember that your bios should be the number 10 in the BIOS list added in d_neogeo.cpp
now in neogeoReset function after:
Code: [Select]
NeoLoad68KBIOS((NeoSystem & 0x07) ^ 4);add:
Code: [Select]
// Does this is tied directly to the harddip or there's a bankswitch somewhere?
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_PCB_BIOS) {
if (!strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "svcpcbn")) {
int harddip3 = (NeoSystem & 0x03)&1;
switch (NeoSystem & 0x03) {
case 0x02:
case 0x03:
memcpy(Neo68KBIOS, Neo68KBIOS + 0x20000 + harddip3 * 0x20000, 0x20000);
break;
}
}
}
now let's go to:
neogeo.cpp:
replace the old NeoLoadSprites function with this one:
Code: [Select]
// This function loads and pre-processes the sprite data
int NeoLoadSprites(int nOffset, int nNum, unsigned char* pDest, unsigned int nSpriteSize)
{
struct BurnRomInfo ri;
ri.nType = 0;
ri.nLen = 0;

unsigned int nRomSize = 0;

if ((BurnDrvGetHardwareCode() & (HARDWARE_SNK_ENCRYPTED_A | HARDWARE_SNK_ENCRYPTED_B)) && (nSpriteSize != 0x6000000)) {
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_ENCRYPTED_A) {
NeoGfxDecryptCMC42Init();
} else {
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_ENCRYPTED_B) {
NeoGfxDecryptCMC50Init();
}
}

unsigned char* pBuf = (unsigned char*)malloc(0x800000 * 2);
if (pBuf == NULL) {
return 1;
}

for (int i = 0; i < (nNum >> 1); i++) {
int k = 4, n = i;
if ((nSpriteSize == 0x4000000) && (nNum == 2)) {
pBuf = (unsigned char*)malloc(nSpriteSize);
BurnLoadRom(pBuf + 0x0000000, nOffset + (i << 1), 1);
BurnLoadRom(pBuf + 0x2000000, nOffset + 1 + (i << 1), 1);
k = 16, n = 0, i = 2;

svcchaos_cx_decrypt(pBuf);
} else {
BurnLoadRom(pBuf + 0, nOffset + (i << 1), 2);
BurnLoadRom(pBuf + 1, nOffset + 1 + (i << 1), 2);
}

for (int j = 0; j < k; j++) {
BurnUpdateProgress(1.0 / ((double)(nSpriteSize/0x800000) * 8.0 / 3.0), j ? NULL : _T("Decrypting graphics..."), 0);
NeoGfxDecryptDoBlock(nNeoProtectionXor, pBuf + j * 0x400000, n * 0x800000 * 2 + j * 0x400000, 0x400000, nSpriteSize);
}
}

free(pBuf);

} else {
nSpriteSize = 0;

// Compute correct size to gaps into account (Kizuna)
for (int i = 0; i < nNum - 2; i++) {
BurnDrvGetRomInfo(&ri, nOffset + i);
if (ri.nLen > nRomSize) {
nRomSize = ri.nLen;
}
}

for (int i = 0; i < (nNum >> 1); i++) {
BurnLoadRom(pDest + nSpriteSize + 0, nOffset + (i << 1), 2);
BurnLoadRom(pDest + nSpriteSize + 1, nOffset + 1 + (i << 1), 2);

BurnDrvGetRomInfo(&ri, nOffset + (i << 1));

if (i < (nNum >> 1) - 1) {
nSpriteSize += nRomSize << 1;
} else {
nSpriteSize += ri.nLen << 1;
}
}
}

// Swap data for viewpoin, aof, ssideki, kotm2, more
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPC) {
unsigned char* pBuf = (unsigned char*)malloc(0x600000);

if (pBuf) {
for (int i = 0x200000; i < 0x600000; i++) {
pBuf[i] = pDest[i];
}
for (int i = 0; i < 0x100000; i++) {
((short*)(pDest + 0x200000))[i] = ((short*)(pBuf + 0x400000))[i];
((short*)(pDest + 0x400000))[i] = ((short*)(pBuf + 0x200000))[i];
}

free(pBuf);
} else {
return 1;
}
}
return 0;
}
now in neo_decrypt.cpp:
add this:
Code: [Select]
// Original MAME by HalRIN - http://www52.tok2.com/home/foge/
// Ported to FBA and modified by IQ_132 - http://neosource.1emu.net/
// SvC Chaos: SNK vs CAPCOM C-ROM decryption (Version 2)
void svcchaos_cx_decrypt(unsigned char* rom)
{
const unsigned char xor1[ 4 ] = {0x34, 0x21, 0xc4, 0xe9,};
unsigned char *pTemp = (unsigned char*)malloc(0x800000);

for (int i = 0; i < 8; i++) {
int ofst;
unsigned char *gfxrom = rom+i*0x800000;

for(int j = 0; j < 0x800000; j++) {
gfxrom[ j ] ^= xor1[ (j % 4) ];
}

for(int j = 0; j < 0x800000; j += 4) {
UINT32 *rom32 = (UINT32*)&gfxrom[ j ];
*rom32 = BITSWAP32(*rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
}

memcpy( pTemp, gfxrom, 0x800000 );
for(int j = 0; j < 0x800000/4; j++ ) {
ofst =  BITSWAP24((j & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05);
ofst ^= 0x0c8923;
ofst += (j & 0xffe00000);
memcpy( &gfxrom[ j * 4 ], &pTemp[ ofst * 4 ], 0x04 );
}
}
free(pTemp);
}
now un burn.h:
add this after the gambling flags
Code: [Select]
#define HARDWARE_SNK_PCB_BIOS (0x6000) // Uses custom BIOSnow finally, don't forget to declare the following in neogeo.h:
Code: [Select]
extern int nNeoPCM2PLAYMOREProtection;
extern int nNeoTextROMFixType;

void svcchaos_cx_decrypt(unsigned char* rom);
this should be all to have the game workig... it works for me :)
See ya!!!!!! :biggrin:

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: SVC Chaos driver infos.
« Reply #92 on: March 06, 2006, 07:39:38 PM »
I forgot something:
in neorun.cpp:
after:
Code: [Select]
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPV) {
for (int i = 0; i < 0x00200000; i++) {
unsigned char n = YM2610ADPCMAROM[i];
YM2610ADPCMAROM[i] = YM2610ADPCMAROM[0x00200000 + i];
YM2610ADPCMAROM[0x00200000 + i] = n;
}
}
add:
Code: [Select]
// Neo-PCM2 PLAYMORE(c) 2002 Sound Chip Emulation
if (nNeoPCM2PLAYMOREProtection != 0) {
Neo_PCM2_PLAYMORE_2002(nNeoPCM2PLAYMOREProtection);
}
look for:
Code: [Select]
BurnUpdateProgress(0.0, _T("Generating text layer graphics..."), 0);
NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);
add after:
Code: [Select]
// Original convertion by IQ_132 (This is for svcpcb, kf2k3pcb and clones)
if (nNeoTextROMFixType == 7) {
for( int i = 0; i < nNeoTextROMSize; i++ ) {
(NeoTextROM+0x20000)[i] = BITSWAP08((NeoTextROM+0x20000)[i]^0xd2,4,0,7,2,5,1,6,3);
}
}
now in neoexit function add to the very end:
Code: [Select]
nNeoPCM2PLAYMOREProtection = 0;
nNeoTextROMFixType = 0; // Exit text layer fix
in neo_decrypt add:
Code: [Select]
// Neo-PCM2 PLAYMORE(c) 2002 Sound Chip Emulation
// Some code by Fataku & some by the vconv (from 2ch) - FBA conversion by iq_132
void Neo_PCM2_PLAYMORE_2002(int value)
{
unsigned int addrs[7][2] = {
{0x000000,0xA5000}, //kof2002
{0xFFCE20,0x01000}, //matrimelee
{0xFE2CF6,0x4E001}, //mslug5
{0xFEB2C0,0x0A000}, //samsho5
{0xFFAC28,0xC2000}, //svcchaos
{0xFF14EA,0xA7001}, //kof2003
{0xFFB440,0x02000}, //samsh5sp
};

  unsigned int xordata[7][8] = {
{0xF9,0xE0,0x5D,0xF3,0xEA,0x92,0xBE,0xEF}, //kof2002
  {0xC4,0x83,0xA8,0x5F,0x21,0x27,0x64,0xAF}, //matrimelee
{0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, //mslug5
{0xCB,0x29,0x7D,0x43,0xD2,0x3A,0xC2,0xB4}, //samsho5
{0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, //svcchaos
{0x4B,0xA4,0x63,0x46,0xF0,0x91,0xEA,0x62}, //kof2003
{0x4B,0xA4,0x63,0x46,0xF0,0x91,0xEA,0x62}, //samsh5sp
};

unsigned char *rom = YM2610ADPCMAROM;
unsigned char *buf = (unsigned char*)malloc(0x1000000);
int ofst;

memcpy(buf,rom,0x1000000);
for(int i=0; i<0x1000000; i++) {
ofst = (i & 0xfefffe) | ((i & 0x010000) >> 16) | ((i & 0x000001) << 16);
ofst ^= addrs[value-1][1];
rom[ofst] = (buf[((i + addrs[value-1][0]) & 0xffffff)] ^ xordata[value-1][(ofst & 0x07)]);
}
free(buf);
}
and declare in neogeo.h:
Code: [Select]
void Neo_PCM2_PLAYMORE_2002(int value);see ya!!!!!! :biggrin:

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: SVC Chaos driver infos.
« Reply #93 on: March 30, 2006, 11:53:53 AM »
A little lower ram Cx decrypt ^^

Replace this:
Code: [Select]
for (int i = 0; i < (nNum >> 1); i++) {
int k = 4, n = i;
if ((nSpriteSize == 0x4000000) && (nNum == 2)) {
pBuf = (unsigned char*)malloc(nSpriteSize);
BurnLoadRom(pBuf + 0x0000000, nOffset + (i << 1), 1);
BurnLoadRom(pBuf + 0x2000000, nOffset + 1 + (i << 1), 1);
k = 16, n = 0, i = 2;

svcchaos_cx_decrypt(pBuf);
} else {
BurnLoadRom(pBuf + 0, nOffset + (i << 1), 2);
BurnLoadRom(pBuf + 1, nOffset + 1 + (i << 1), 2);
}

With this:
Code: [Select]
int svcpcb = 0; // hack for svc's non-standard 32mb Cx roms

for (int i = 0; i < (nNum + svcpcb >> 1); i++) {
int k = 4, n = i;
if ((nSpriteSize == 0x4000000) && (nNum == 2)) { // svc pcb
pBuf = (unsigned char*)malloc(0x2000000);
BurnLoadRom(pBuf, nOffset + i, 1);
k = 8, n = i * 2, svcpcb = 2;

svcpcb_cx_decrypt(pBuf);
} else {
BurnLoadRom(pBuf + 0, nOffset + (i << 1), 2);
BurnLoadRom(pBuf + 1, nOffset + 1 + (i << 1), 2);
}

In the following function, replace i < 8 with i < 4
Code: [Select]
void svcchaos_cx_decrypt(unsigned char* rom)
{
const unsigned char xor1[ 4 ] = {0x34, 0x21, 0xc4, 0xe9,};
unsigned char *pTemp = (unsigned char*)malloc(0x800000);

for (int i = 0; i < 8; i++) {