Welcome!
Final Burn Neo => FBN Development => Topic started by: bms888 on January 18, 2005, 10:52:21 PM
-
/***************************** Neo PVC protection *********************/
static unsigned short CartRAM[0x1000];
// for save states
unsigned char *NeoCartRAM = (unsigned char *)CartRAM;
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;
}
unsigned char __fastcall pvcReadByteBankSwitch(unsigned int sekAddress)
{
return pvc_r8(sekAddress);
}
unsigned short __fastcall pvcReadWordBankSwitch(unsigned int sekAddress)
{
return CartRAM[(sekAddress-0x2fe000)/2];
}
// Special Bankswitch
void pvc_CalcBank2() // on writes to f0-f3
{
unsigned int offset;
// Make this universal for kof2003b + kof2003p
if ((!strcmp(BurnDrvText(0), "kof2k4eh")) || (!strcmp(BurnDrvText(0), "kof2k4ex"))) {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff1)<<0);
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
} else {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff0)<<0);
*((unsigned char *) (CartRAM+((0x2ffff0-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
Neo68KROM01[0x58196]=pvc_r8(0x2ffff3);
}
SekMapMemory(Neo68KROM02+offset,0x200000,0x2fdfff,SM_ROM);
}
void __fastcall pvcWriteByteBankSwitch2(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
void __fastcall pvcWriteWordBankSwitch2(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2]=wordValue;
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
static void pvcMapHandler2()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvcWriteWordBankSwitch2);
SekSetWriteByteHandler(5, pvcWriteByteBankSwitch2);
}
static void pcbBiosMapHandler()
{
SekMapMemory(Neo68KBIOS+0x20000,0xC20000,0xC3FFFF,SM_ROM); // for PCB BIOS
}
-
these code can working on mslug5,mslug5b,svcboot,svcsplus,kof2003b,kof2k3up,kof2k4ex....^_^
-
maybe I will open the pvc_port code in someday,bye.
-
oh,everyone! this code maybe help you:
// Code by iq_132 -- http://neosource.1emu.net/
static void interleave_pdata()
{
int i, j=0;
UINT8 *src = Neo68KROM01;
UINT8 *dst = (UINT8 *)malloc(0x800000);
for (i=0;i<0x800000;i=i+4){
dst[i+0]=src[j];
dst[i+1]=src[j+1];
dst[i+2]=src[j+0x400000];
dst[i+3]=src[j+0x400001];
j=j+2;
}
memcpy(Neo68KROM01,dst,0x800000);
free(dst);
}
// Neo-PVC Code for PCB and MVS games with this protection
// Original code by(?) HalRIN -- http://www52.tok2.com/home/foge/
static void do_neopvc(int game)
{
unsigned int xor1[ 2 ][ 0x20 ] = { // kof2003 does not use xor1
// for svcchaos
{0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8,
0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f},
// for mslug5
{0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29,
0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03},
};
unsigned int xor2[ 3 ][ 0x20 ] = {
// for kof2003
{0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa,
0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0B, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9},
// for svcchaos
{0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4,
0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26},
// for mslug5
{0x36, 0x09, 0xb0, 0x64, 0x95, 0x0f, 0x90, 0x42, 0x6e, 0x0f, 0x30, 0xf6, 0xe5, 0x08, 0x30, 0x64,
0x08, 0x04, 0x00, 0x2f, 0x72, 0x09, 0xa0, 0x13, 0xc9, 0x0b, 0xa0, 0x3e, 0xc2, 0x00, 0x40, 0x2b},
};
int i, ofst, ofst2 = 0x00300, rom_size = 0x800000;
unsigned char *rom = Neo68KROM01;
unsigned char *buf = (unsigned char*)malloc( rom_size );
if (game!=1)
for( i = 0; i < 0x100000; i++ )
rom[ i ] ^= xor1[ game-2 ][ (i % 0x20) ];
for( i = 0x100000; i < 0x800000; i++ )
rom[ i ] ^= xor2[ game-1 ][ (i % 0x20) ];
for( i = 0x100000; i < 0x800000; i += 4 ){
unsigned short *rom16 = (unsigned short *)&rom[ i + 1 ];
if (game==1) *rom16 = BITSWAP16( *rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0 );
if (game!=1) *rom16 = BITSWAP16( *rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
}
memcpy( buf, rom, rom_size );
for( i = 0; i < 0x10; i++ ){
ofst = (i & 0xf0) + BITSWAP08( (i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2 );
if (game==2)
ofst = (i & 0xf0) + BITSWAP08( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x800000; i += 0x100 ){
if (game==2) ofst2=0x00a00;
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ ofst2) + (BITSWAP08( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);
if (game==3)
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP08( ((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2 ) << 12);
memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}
if (game==1) {
buf = (unsigned char*)malloc( 0x900000 );
memcpy( buf, rom, 0x900000 );
memcpy( &rom[ 0x100000 ], &buf[ 0x800000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x700000 );
} else {
memcpy( buf, rom, rom_size );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
}
free(buf);
}
-
kof2003b you can try this code:
static void kof2003bDecrypt()
{
int sec[]={ 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
int i, rom_size = 0x800000;
UINT8 *src = Neo68KROM01;
UINT8 *dst = (UINT8 *)malloc( rom_size );
memcpy( dst, src, rom_size );
for( i=0; i<8; ++i ){
memcpy( src+i*0x100000, dst+sec[i]*0x100000, 0x100000 );
}
free( dst );
}
static int kof2003bInit()
{
int nRet;
memset(CartRAM,0,0x2000);
nNeoTextROMFixType = 3;
pNeoInitCallback = kof2003bDecrypt;
nRet=NeoInit();
if(!nRet)
pvcMapHandler2();
pcbBiosMapHandler();
return nRet;
}
-
Ms5plus BankSwitch code is here:
void __fastcall ms5plusWriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
if (sekAddress==0x2ffff4){
unsigned int offset=wordValue<<0x10;
SekMapMemory(Neo68KROM01+offset,0x200000,0x2fdfff,SM_ROM);
}
}
static void ms5plusMapHandler()
{
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, ms5plusWriteWordBankSwitch);
}
-
If the next... FBA can't support chinese roms path and use GCC,i will give up to updata FBA,just updata Mame Plus,that's one reason of i open this BankSwitch code.
-
Holy cow! Thanks bms :)
-
Holy cow! Thanks bms :)
No thx,you can remove all kof2003b_tbl and old BankSwitch code now,^_^!
-
Thanks BMS :D
But now I have no idea where to add this code :(
-
James. It's essentially the same as the bootleg bankswitch code; just set it up like that.
-
static void mslug5PVCDecrypt()
{
interleave_pdata();
do_neopvc(3);
// AES Patch
unsigned short *mem16 = (unsigned short *)Neo68KROM01;
mem16[ 0x122A/2 ] = 0x4e71;
mem16[ 0x122C/2 ] = 0x4e71;
}
-
static void svcchaos_px_patch()
{
// To patch svcchaos NEO LOGO Loop bug in FBA
unsigned short *mem16 = (unsigned short *)Neo68KROM01;
mem16[ 0x9DF0/2 ] = 0x4E71;
mem16[ 0x9DF2/2 ] = 0x4E71;
mem16[ 0x9E08/2 ] = 0x4E71;
mem16[ 0x9E0A/2 ] = 0x4E71;
}
static void svcchaosPVCDecrypt()
{
do_neopvc(2);
svcchaos_px_patch();
}
-
static void kof2003PVCDecrypt()
{
interleave_pdata();
do_neopvc(1);
// 0xF9 for Good CRC, 0x75 to patch black screen in FBA
Neo68KROM01[ 0x0816 ] = 0x75;
}
-
But svcchaos & kof2003 use pvcMapHandler, not pvcMapHandler2,bye!
-
Good work bms888!
Thanks for the codes, i will update my old bankswitch codes for those one :D
Now im just wating for ur mv0_proto code hehe lol :D
Thanks again
See ya
-
these code can working on mslug5,mslug5b,svcboot,svcsplus,kof2003b,kof2k3up,kof2k4ex....^_^
You mean along with the first bank code, remember that this carts except ms5 uses 2 bankswitches... I'll test it.
Thanks and see ya!!!!!!! :D
-
Good work bms888!
Thanks for the codes, i will update my old bankswitch codes for those one :D
Now im just wating for ur mv0_proto code hehe lol :D
Thanks again
See ya
Ok, the new PVC code out in EGCG forums now!
http://bbs.emu-zone.org/egcg/showthread.php?t=14
-
Ok, the new PVC code out in EGCG forums now!
http://bbs.emu-zone.org/egcg/showthread.php?t=14
Great!!!!!
Thanks a lot bms888 now the patch codes wont be needed !!! :D :D :D :D
See ya
-
Thanks BMS :) Very good stuff there ;)
-
I am most grateful to BMS for your job. ;)
Have a great year!
-
Sadly I cannot veiw that site for some reason Can anyone post the code here ?
-
Here ya go James :)
static unsigned short CartRAM[0x1000];
// for save states
unsigned char *NeoCartRAM = (unsigned char *)CartRAM;
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;
}
unsigned char __fastcall pvcReadByteBankSwitch(unsigned int sekAddress)
{
return pvc_r8(sekAddress);
}
unsigned short __fastcall pvcReadWordBankSwitch(unsigned int sekAddress)
{
return CartRAM[(sekAddress-0x2fe000)/2];
}
// Special Bankswitch
void pvc_CalcBank() // 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)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
SekMapMemory(Neo68KROM+0x100000+offset,0x200000,0x2fdfff,SM_ROM);
}
// These perform some palette calculations
// Unpack palette word to RGB dword
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 __fastcall pvcWriteByteBankSwitch(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)pvc_CalcBank();
}
void __fastcall pvcWriteWordBankSwitch(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)pvc_CalcBank();
}
// Special Bankswitch
void pvc_CalcBank2() // on writes to f0-f3
{
unsigned int offset;
// Make this universal for kof2003b + kof2003p
if ((!strcmp(BurnDrvGetTextA(DRV_NAME), "kof2k4eh")) || (!strcmp(BurnDrvGetTextA(DRV_NAME), "kof2k4ex"))) {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff1)<<0);
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
} else {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff0)<<0);
*((unsigned char *) (CartRAM+((0x2ffff0-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
Neo68KROM[0x58196]=pvc_r8(0x2ffff3);
}
SekMapMemory(Neo68KROM+0x100000+offset,0x200000,0x2fdfff,SM_ROM);
}
void __fastcall pvcWriteByteBankSwitch2(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
void __fastcall pvcWriteWordBankSwitch2(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2]=wordValue;
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
static void pvcMapHandler()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvcWriteWordBankSwitch);
SekSetWriteByteHandler(5, pvcWriteByteBankSwitch);
}
static void pvcMapHandler2()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvcWriteWordBankSwitch2);
SekSetWriteByteHandler(5, pvcWriteByteBankSwitch2);
}
static void pcbBiosMapHandler()
{
SekMapMemory(Neo68KBIOS+0x20000,0xC20000,0xC3FFFF,SM_ROM); // for PCB BIOS
}
static void kof03pvcMapHandler()
{
pvcMapHandler();
pcbBiosMapHandler(); // for PCB BIOS
}
// Metal Slug 5
static struct BurnRomInfo mslug5RomDesc[] = {
{ "268-p1.bin", 0x400000, 0xd0466792, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "268-p2.bin", 0x400000, 0xfbf6b61e, 1 | BRF_ESS | BRF_PRG }, // 1
{ "268-c1.bin", 0x800000, 0x27d59de8, 3 | BRF_GRA }, // 2 Sprite data
{ "268-c2.bin", 0x800000, 0xe600dee1, 3 | BRF_GRA }, // 3
{ "268-c3.bin", 0x800000, 0xb650f098, 3 | BRF_GRA }, // 4
{ "268-c4.bin", 0x800000, 0x10499589, 3 | BRF_GRA }, // 5
{ "268-c5.bin", 0x800000, 0x19352405, 3 | BRF_GRA }, // 6
{ "268-c6.bin", 0x800000, 0xb1531523, 3 | BRF_GRA }, // 7
{ "268-c7.bin", 0x800000, 0xfe2c1338, 3 | BRF_GRA }, // 8
{ "268-c8.bin", 0x800000, 0xecce3141, 3 | BRF_GRA }, // 9
{ "268-m1d.bin", 0x040000, 0x6866d696, 4 | BRF_ESS | BRF_PRG }, // 10 Z80 code (decrypted)
{ "268-m1.bin", 0x040000, 0x88c11f51, 0 | BRF_PRG | BRF_OPT }, // 11 Z80 code
/* This uses Neo-PCM2 PLAYMORE(c) 2002 Chip */
{ "268-v1.bin", 0x800000, 0x33c6305c, 5 | BRF_SND }, // 12
{ "268-v2.bin", 0x800000, 0x1afb848e, 5 | BRF_SND }, // 13
};
STDROMPICKEXT(mslug5, mslug5, neogeo);
STD_ROM_FN(mslug5);
static void mslug5PVCDecrypt()
{
interleave_pdata();
do_neopvc(3);
// AES Patch
unsigned short *mem16 = (unsigned short *)Neo68KROM;
mem16[ 0x122A/2 ] = 0x4e71;
mem16[ 0x122C/2 ] = 0x4e71;
}
static int mslug5Init()
{
int nRet;
memset(CartRAM,0,0x2000);
pNeoInitCallback = mslug5PVCDecrypt;
nNeoProtectionXor = 0x19;
nNeoPCM2PLAYMOREByteswap = 3;
nRet = NeoInit();
if (!nRet)
pvcMapHandler();
return nRet;
}
struct BurnDriver BurnDrvmslug5 = {
"mslug5", NULL, "neogeo", "2003",
"Metal Slug 5\0", "Eecrypted C & V-ROMS", "SNK Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B | HARDWARE_SNK_NEWBANKSYSTEM,
NULL, mslug5RomInfo, mslug5RomName, neogeoInputInfo, neogeoDIPInfo,
mslug5Init, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
// SvC Chaos: SNK vs Capcom (PCB board)
static struct BurnRomInfo svcchaosRomDesc[] = {
{ "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-m1d.bin", 0x020000, 0xFD4F0FF9, 4 | BRF_ESS | BRF_PRG }, // 3 Z80 code (decrypted)
{ "269-m1.bin", 0x080000, 0xF6819D00, 0 | BRF_PRG | BRF_OPT }, // 4 Z80 code
/* This uses Neo-PCM2 PLAYMORE(c) 2002 Chip */
{ "269-v1.bin", 0x800000, 0xC659B34C, 5 | BRF_SND }, // 5
{ "269-v2.bin", 0x800000, 0xDD903835, 5 | BRF_SND }, // 6
};
STDROMPICKEXT(svcchaos, svcchaos, neosvc);
STD_ROM_FN(svcchaos);
static void svcchaos_px_patch()
{
// To patch svcchaos NEO LOGO Loop bug with ASM core
unsigned short *mem16 = (unsigned short *)Neo68KROM;
mem16[ 0x9DF0/2 ] = 0x4E71;
mem16[ 0x9DF2/2 ] = 0x4E71;
mem16[ 0x9E08/2 ] = 0x4E71;
mem16[ 0x9E0A/2 ] = 0x4E71;
}
static void svcchaosPVCDecrypt()
{
do_neopvc(2);
svcchaos_px_patch();
}
static int svcchaosInit()
{
int nRet;
memset(CartRAM,0,0x2000);
pNeoInitCallback = svcchaosPVCDecrypt;
nNeoProtectionXor = 0x57;
nNeoTextROMSize = 0x080000;
nNeoTextROMFixType = 8;
nNeoPCM2PLAYMOREByteswap = 5;
nRet = NeoInit();
if (!nRet)
kof03pvcMapHandler();
return nRet;
}
struct BurnDriver BurnDrvsvcchaos = {
"svcchaos", NULL, "neogeo", "2003",
"SvC Chaos: SNK vs Capcom\0", "PCB version", "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_NEWBANKSYSTEM,
NULL, svcchaosRomInfo, svcchaosRomName, neogeoInputInfo, neogeoDIPInfo,
svcchaosInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
// SvC Chaos: SNK vs Capcom (MVS Cart)
static struct BurnRomInfo svchaosaRomDesc[] = {
{ "269-p1a.bin", 0x400000, 0x38e2005e, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "269-p2a.bin", 0x400000, 0x6d13797c, 1 | BRF_ESS | BRF_PRG }, // 1
{ "269-c1r.bin", 0x800000, 0x887b4068, 3 | BRF_GRA }, // 2 Sprite data
{ "269-c2r.bin", 0x800000, 0x4e8903e4, 3 | BRF_GRA }, // 3
{ "269-c3r.bin", 0x800000, 0x7d9c55b0, 3 | BRF_GRA }, // 4
{ "269-c4r.bin", 0x800000, 0x8acb5bb6, 3 | BRF_GRA }, // 5
{ "269-c5r.bin", 0x800000, 0x097a4157, 3 | BRF_GRA }, // 6
{ "269-c6r.bin", 0x800000, 0xe19df344, 3 | BRF_GRA }, // 7
{ "269-c7r.bin", 0x800000, 0xd8f0340b, 3 | BRF_GRA }, // 8
{ "269-c8r.bin", 0x800000, 0x2570b71b, 3 | BRF_GRA }, // 9
{ "269-m1d.bin", 0x020000, 0xFD4F0FF9, 4 | BRF_ESS | BRF_PRG }, // 10 Z80 code (decrypted)
{ "269-m1.bin", 0x080000, 0xF6819D00, 0 | BRF_PRG | BRF_OPT }, // 11 Z80 code
/* This uses Neo-PCM2 PLAYMORE(c) 2002 Chip */
{ "269-v1.bin", 0x800000, 0xC659B34C, 5 | BRF_SND }, // 12
{ "269-v2.bin", 0x800000, 0xDD903835, 5 | BRF_SND }, // 13
};
STDROMPICKEXT(svchaosa, svchaosa, neogeo);
STD_ROM_FN(svchaosa);
static void svchaosaPVCDecrypt()
{
interleave_pdata();
svcchaosPVCDecrypt();
}
static int svchaosaInit()
{
int nRet;
memset(CartRAM,0,0x2000);
pNeoInitCallback = svchaosaPVCDecrypt;
nNeoProtectionXor = 0x57;
nNeoTextROMSize = 0x080000;
nNeoPCM2PLAYMOREByteswap = 5;
nRet = NeoInit();
if (!nRet)
pvcMapHandler();
return nRet;
}
struct BurnDriver BurnDrvsvchaosa = {
"svchaosa", "svcchaos", "neogeo", "2003",
"SvC Chaos: SNK vs Capcom (set 2)\0", "MVS version", "Capcom / Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ENCRYPTED_B | HARDWARE_SNK_ALTERNATE_TEXT | HARDWARE_SNK_NEWBANKSYSTEM,
NULL, svchaosaRomInfo, svchaosaRomName, neogeoInputInfo, neogeoDIPInfo,
svchaosaInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
// The King Of Fighters 2003
static struct BurnRomInfo kof2003RomDesc[] = {
{ "271-p1.bin", 0x400000, 0xb9da070c, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "271-p2.bin", 0x400000, 0xda3118c4, 1 | BRF_ESS | BRF_PRG }, // 1
{ "271-p3d.bin", 0x100000, 0x59d376da, 1 | BRF_ESS | BRF_PRG }, // 2
// { "271-p3.bin", 0x100000, 0x5cefd0d2, 1 | BRF_ESS | BRF_PRG }, // 2
{ "271-c1d.bin", 0x1000000, 0xc29acd28, 3 | BRF_GRA }, // 3 Sprite data
{ "271-c2d.bin", 0x1000000, 0x328e80b1, 3 | BRF_GRA }, // 4
{ "271-c3d.bin", 0x1000000, 0x020a11f1, 3 | BRF_GRA }, // 5
{ "271-c4d.bin", 0x1000000, 0x991b5ed2, 3 | BRF_GRA }, // 6
{ "271-c5d.bin", 0x1000000, 0xc2de8b66, 3 | BRF_GRA }, // 7
{ "271-c6d.bin", 0x1000000, 0x3ff750db, 3 | BRF_GRA }, // 8
{ "271-m1d.bin", 0x080000, 0x0e86af8f, 4 | BRF_ESS | BRF_PRG }, // 9 Z80 code (decrypted)
// { "271-m1.bin", 0x080000, 0xd6bcf2bc, 0 | BRF_PRG | BRF_OPT }, // 10 Z80 code
/* This uses Neo-PCM2 PLAYMORE(c) 2002 Chip */
{ "271-v1.bin", 0x1000000, 0x1d96154b, 5 | BRF_SND }, // 11
};
STDROMPICKEXT(kof2003, kof2003, neokof03);
STD_ROM_FN(kof2003);
static void kof2003PVCDecrypt()
{
interleave_pdata();
do_neopvc(1);
// 0xF9 for Good CRC, 0x75 to patch black screen with ASM core
Neo68KROM[ 0x0816 ]=0x75;
}
static int kof2003Init()
{
int nRet;
memset(CartRAM,0,0x2000);
nNeoTextROMSize = 0x100000;
pNeoInitCallback = kof2003PVCDecrypt;
nNeoTextROMFixType = 8;
nNeoPCM2PLAYMOREByteswap = 6;
nRet=NeoInit();
if(!nRet)
kof03pvcMapHandler();
return nRet;
}
struct BurnDriver BurnDrvkof2003 = {
"kof2003", NULL, "neogeo", "2003",
"The King of Fighters 2003\0", "Decrypted C-ROMS", "SNK Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_ALTERNATE_TEXT | HARDWARE_SNK_NEWBANKSYSTEM,
NULL, kof2003RomInfo, kof2003RomName, neogeoInputInfo, neogeoDIPInfo,
kof2003Init, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
static void svchaosaPVCDecrypt()
{
interleave_pdata();
svcchaosPVCDecrypt();
}
// The King Of Fighters 2003 (bootleg)
static struct BurnRomInfo kof2003bRomDesc[] = {
{ "271-p1bl.bin", 0x400000, 0x92ed6ee3, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "271-p2bl.bin", 0x400000, 0x5d3d8bb3, 1 | BRF_ESS | BRF_PRG }, // 1
{ "271-s1bl.bin", 0x020000, 0x482c48a5, 2 | BRF_GRA }, // 2 Text layer tiles
{ "271-c1d.bin", 0x1000000, 0xc29acd28, 3 | BRF_GRA }, // 3 Sprite data
{ "271-c2d.bin", 0x1000000, 0x328e80b1, 3 | BRF_GRA }, // 4
{ "271-c3d.bin", 0x1000000, 0x020a11f1, 3 | BRF_GRA }, // 5
{ "271-c4d.bin", 0x1000000, 0x991b5ed2, 3 | BRF_GRA }, // 6
{ "271-m1d.bin", 0x080000, 0x0e86af8f, 4 | BRF_ESS | BRF_PRG }, // 9 Z80 code (decrypted)
{ "271-v1d.bin", 0x1000000, 0x2964F36E, 5 | BRF_SND }, // 10
};
STDROMPICKEXT(kof2003b, kof2003b, neokof03);
STD_ROM_FN(kof2003b);
static void kof2003bDecrypt()
{
int sec[]={ 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
int i, rom_size = 0x800000;
UINT8 *src = Neo68KROM;
UINT8 *dst = (UINT8 *)malloc( rom_size );
memcpy( dst, src, rom_size );
for( i=0; i<8; ++i ){
memcpy( src+i*0x100000, dst+sec[i]*0x100000, 0x100000 );
}
free( dst );
}
static int kof2003bInit()
{
int nRet;
memset(CartRAM,0,0x2000);
nNeoTextROMFixType = 3;
pNeoInitCallback = kof2003bDecrypt;
nRet=NeoInit();
if(!nRet)
pvcMapHandler2();
pcbBiosMapHandler();
return nRet;
}
struct BurnDriver BurnDrvkof2003b = {
"kof2003b", "kof2003", "neogeo", "2003",
"The King of Fighters 2003 (bootleg)\0", "Decrypted C-ROMS", "SNK Playmore Corporation", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_NEWBANKSYSTEM,
NULL, kof2003bRomInfo, kof2003bRomName, neogeoInputInfo, neogeoDIPInfo,
kof2003bInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
-
Thank you :D
-
Are neosvc and neokof03 seperate bios sets? If so could somebody please post the names/CRCs of the roms that should be in them?
Thankies ^_^
-
Tested again the new bankcode... SVCnd (using the same encrypted P rom) boots perfectly the first time you load the game, but if you reset you get again the NEO-GEO logo loop..., maybe I'm missing something...
I'll wait until IQ_132 release the drivers as he promised, his drivers always work XD
See ya!!!!!! :D
-
Nevermind, i made a clean compile and worked...
See ya!!!!!! :D
-
Tested again the new bankcode... SVCnd (using the same encrypted P rom) boots perfectly the first time you load the game, but if you reset you get again the NEO-GEO logo loop..., maybe I'm missing something...
I'll wait until IQ_132 release the drivers as he promised, his drivers always work XD
See ya!!!!!! :D
the probl here is that I cannot load the saves, thera are lots of busg and if I press reset th reset bug occurs...
-
Sorry for my ignorance but :P where i have to add this code?? im confused
static unsigned short CartRAM[0x1000];
// for save states
unsigned char *NeoCartRAM = (unsigned char *)CartRAM;
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;
}
unsigned char __fastcall pvcReadByteBankSwitch(unsigned int sekAddress)
{
return pvc_r8(sekAddress);
}
unsigned short __fastcall pvcReadWordBankSwitch(unsigned int sekAddress)
{
return CartRAM[(sekAddress-0x2fe000)/2];
}
// Special Bankswitch
void pvc_CalcBank() // 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)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
SekMapMemory(Neo68KROM+0x100000+offset,0x200000,0x 2fdfff,SM_ROM);
}
// These perform some palette calculations
// Unpack palette word to RGB dword
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 __fastcall pvcWriteByteBankSwitch(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)pvc_CalcBank();
}
void __fastcall pvcWriteWordBankSwitch(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)pvc_CalcBank();
}
// Special Bankswitch
void pvc_CalcBank2() // on writes to f0-f3
{
unsigned int offset;
// Make this universal for kof2003b + kof2003p
if ((!strcmp(BurnDrvGetTextA(DRV_NAME), "kof2k4eh")) || (!strcmp(BurnDrvGetTextA(DRV_NAME), "kof2k4ex"))) {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff1)<<0);
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
} else {
offset=(pvc_r8(0x2ffff2)<<16)|(pvc_r8(0x2ffff3)<<8)|(pvc_r8(0x2ffff0)<<0);
*((unsigned char *) (CartRAM+((0x2ffff0-0x2fe000)^1)))&=0xfe;
*((unsigned char *) (CartRAM+((0x2ffff1-0x2fe000)^1)))=0xa0;
*((unsigned char *) (CartRAM+((0x2ffff2-0x2fe000)^1)))&=0x7f;
Neo68KROM[0x58196]=pvc_r8(0x2ffff3);
}
SekMapMemory(Neo68KROM+0x100000+offset,0x200000,0x 2fdfff,SM_ROM);
}
void __fastcall pvcWriteByteBankSwitch2(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
void __fastcall pvcWriteWordBankSwitch2(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2]=wordValue;
if(sekAddress>=0x2ffff0 && sekAddress<=0x2ffff3)pvc_CalcBank2();
}
static void pvcMapHandler()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvcWriteWordBankSwitch);
SekSetWriteByteHandler(5, pvcWriteByteBankSwitch);
}
static void pvcMapHandler2()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, pvcWriteWordBankSwitch2);
SekSetWriteByteHandler(5, pvcWriteByteBankSwitch2);
}
static void pcbBiosMapHandler()
{
SekMapMemory(Neo68KBIOS+0x20000,0xC20000,0xC3FFFF, SM_ROM); // for PCB BIOS
}
static void kof03pvcMapHandler()
{
pvcMapHandler();
pcbBiosMapHandler(); // for PCB BIOS
}
ThanX in advance :)
-
Sorry for my ignorance but :P where i have to add this code?? im confused
ThanX in advance :)
I made a especial cpp for those codes, but u have to declare somethings on "neogeo.h", so its better to put in the middle or on the begining of d_neogeo.cpp :D
See ya
-
Sorry for reviving this thread, but I'd like to ask for a bit of help here.
I've tried to add all of this PVC code to FBA, but it doesn't seem to work with KOF2003. I take it that, with this code, the original PCB kof2003 should be working, right? I think there must be something to do with the BIOS file (271-bios.bin) that comes together with the game. Is there some special way to load it?
I've tried a lot of things, but none allowed the game to run. Has anyone succeeded in making the game go? If so, can you explain exactly how did you implement that PVC code, please?
Thanks in advance. :)
-
Check this post, it may help you:
http://neo-source.com/index.php?topic=342.msg2830#msg2830
-
Once again, thank you for the great help, IQ. :)
-
No problem, as always, I'm just happy to help. ;)
-
Hey guys.
Before anything, let me just say that I'm only posting in this thread again because I guess this post of mine has something to do with the original idea of the topic -- just so that I don't need to open a new thread for this same topic. Anyway, it's just something I'd like to know out of curiosity, since the doubt just occurred to me while I was looking at my Kof2003 driver.
Is there any specific reason as to why we have to use a P3 rom that seems to be decrypted (the oen that usually comes with the romset kof2003.zip) insted of the original scrambled P3? I mean, since all that PVC code was figured out, I was just wondering why is that. Does it mean there's still no code that emulates the original P3 protection?
Obviously it's no big deal, really. But if there's code available to do it that I'm still not aware of, I'd prefer to use the original encrypted P3 too, just for "authenticity's sake," you know. ;)
Sorry for being an ass about it and thanks in advance. :)
-
Yeah, I was wondering the same thing... I'd really like to see the p3 decryption code.
-
Well, I take it that it shouldn't be too hard (for those experienced, of course :p), since the encrypted one doesn't even prevent the game from running... it just messes up with the colors. Maybe nobody ever gave it a shot, seeing as how people focused in the PVC code anyway so that the game could be playable first (well, thankfully).
-
The encrypted P3 ROM stills unemulated, the PVC bankswitch code or the PVC protection chip doesn't work for it, it seems that this roms has a different encription that no one has figured yet (i guess), that's the reason why we use a p3d... but anyway seems strange because if there is a p3d... then the encription is broken since someone figured how to decript it... looks weird some times...
See ya!!!!! :biggrin:
-
>>but anyway seems strange because if there is a p3d... then the encription is broken since someone figured how to decript it...
Exactly, that was my point. Really looks strange, but oh well. Anyway, if there's someone working on that, I guess we'll get to know it eventually.