For kof2003 you'll need the following code to get it working (already on fbaplus, aplies for 0.2.95.23)
add this to the top of neogeo.h and delete this from other neogeo src's
#include "bitswap.h"
Now add this in neogeo.h:
extern int nNeoPCM2SNKProtection;
extern int nNeoPCM2PLAYMOREProtection;
extern int nNeoTextROMFixType;
now in neo_run.cpp look for this:
static int nSRAMProtAddress;
add this BEFORE
int nNeoPCM2SNKProtection = 0;
int nNeoPCM2PLAYMOREProtection = 0;
int nNeoTextROMFixType = 0;
look for this:
static unsigned char *Neo68KBIOS, *Neo68KVectors, *NeoZ80BIOS;
delete "static" statement in that line
look for this:
Neo68KBIOS = Next; Next += 0x20000; // 68K boardROM
replace "0x20000" with "nCodeSize"
look for this:
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_TRACKBALL) {
nNewBIOS = 9;
}
add this after:
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) == HARDWARE_SNK_PCB_BIOS) {
nNewBIOS = 10;
}
OPTIONAL look for this:
// Load the BIOS ROMs
if (nBIOS >= 0) {
BurnLoadRom(Neo68KBIOS, 0x00080 + nBIOS, 1);
} else {
BurnLoadRom(Neo68KBIOS, 0x00080 + 6, 1);
}
add this after:
// Hacks for Neo-Geo MVS BIOS
// Thanks to IQ_132 & BisonSAS for the patches and info
if (nBIOS < 3 || nBIOS == 9 || nBIOS == 10) {
int ofst = 0;
if (nBIOS == 0) ofst = 0x1C28; // (vs-bios.rom) JP, MVS, ? slot, Ver. 5
// if (nBIOS == 0) ofst = 0x1B00; // (sp-j2.rom) JP, MVS, ? slot, Ver. 5
// (sp1.jipan.1024) JP, MVS, 4 slot, Ver. 3
if (nBIOS == 1) ofst = 0x1AD6; // (usa_2slt.bin) US, MVS, 2 slot, Ver. 5
// (sp-e.sp1) AS, MVS, 6 slow, Ver. 5
if (nBIOS == 2) ofst = 0x0B00; // (asia-s3.rom) AS, MVS, 1 slot, Ver. 6, no z80 BIOS
// if (nBIOS == 2) ofst = 0x1B00; // (sp-s.sp1) AS, MVS, 4 slot, Ver. 3
// (sp-s2.sp1) AS, MVS, 1 slot, Ver. 5
if (nBIOS == 9) ofst = 0x0C2A; // (236-bios.bin) AS, MVS, ? slot, Ver T1 (irrmaze BIOS)
if (nBIOS == 10) ofst = 0x0C24; // (271-bios.bin) JP, MVS, ? slot, Ver. 6 (kof2003 BIOS)
//#if defined NEOGEO_HACKS
// Remove memory check for now
*((unsigned short*)(Neo68KBIOS + ofst + 0x010000)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x010002)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x010016)) = 0x4EF9;
*((unsigned short*)(Neo68KBIOS + ofst + 0x010018)) = 0x00C1;
*((unsigned short*)(Neo68KBIOS + ofst + 0x01001A)) = 0x006A + ofst;
// Patch Calendar errors
*((unsigned short*)(Neo68KBIOS + ofst + 0x010114)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x010116)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x01011C)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x01011E)) = 0x4E71;
//#endif // NEOGEO_HACKS
// Patch checksum test
*((unsigned short*)(Neo68KBIOS + ofst + 0x010162)) = 0x4E71;
*((unsigned short*)(Neo68KBIOS + ofst + 0x010164)) = 0x4E71;
}
Look for this:
if (pInfo->nTextOffset != -1) {
// Load S ROM data
BurnLoadRom(NeoTextROM + 0x020000, pInfo->nTextOffset, 1);
add ALL this after:
switch (nNeoTextROMFixType) {
// Original code for MAME by fataku
case 1: {
for ( int i = 0; i < 0x20000; i++ ) {
(NeoTextROM+0x20000)[i] = BITSWAP08((NeoTextROM+0x20000)[i],3,2,4,5,1,6,0,7);
}
break;
}
// Original code from mame traduced by FerchogtX
case 2: {
unsigned char* tmp = (unsigned char*)malloc(0x20000);
memcpy( tmp + 0x000000, NeoTextROM + 0x020000 + 0x010000, 0x010000 );
memcpy( tmp + 0x010000, NeoTextROM + 0x020000 + 0x000000, 0x010000 );
memcpy( NeoTextROM + 0x20000, tmp, 0x020000 );
free( tmp );
break;
}
// Thanks also to HappyASR for the info
case 3: {
unsigned char* tmp = (unsigned char*)malloc(0x20000);
if (tmp) {
memcpy( tmp, NeoTextROM + 0x20000, 0x20000 );
// descrambling the S1 by dorriGa
for ( int j = 0; j < 0x20000; j += 0x000010 ) {
memcpy( NeoTextROM + 0x20000 + j, tmp + j + 0x000008, 8);
memcpy( NeoTextROM + 0x20000 + j + 0x000008, tmp + j, 8);
}
}
free( tmp );
break;
}
// Original code by HalRIN
case 4: {
unsigned char* tmp = (unsigned char*)malloc(0x40000);
int i, ofst;
memcpy( tmp, NeoTextROM + 0x20000, 0x40000 );
for( i = 0; i < 0x40000; i++ ) {
ofst = BITSWAP24((i & 0x1ffff),23,22,21,20,19,18,17,3,0,1,4,2,13,14,16,15,5,6,11,10,9,8,7,12);
ofst += (i >> 17) << 17;
(NeoTextROM+0x20000)[i] = tmp[ofst];
}
memcpy( tmp, NeoTextROM + 0x20000, 0x40000 );
memcpy( NeoTextROM + 0x20000 + 0x08000, tmp + 0x10000, 0x8000 );
memcpy( NeoTextROM + 0x20000 + 0x10000, tmp + 0x08000, 0x8000 );
memcpy( NeoTextROM + 0x20000 + 0x28000, tmp + 0x30000, 0x8000 );
memcpy( NeoTextROM + 0x20000 + 0x30000, tmp + 0x28000, 0x8000 );
free( tmp );
break;
}
// Converted by Jimmy_Page (www.neofighters.com)
case 5: {
for ( int i = 0; i < 0x20000; i++ ) {
(NeoTextROM+0x20000)[i] = BITSWAP08((NeoTextROM+0x20000)[i],7,6,0,4,3,2,1,5);
}
break;
}
// Thanks to IQ_132, this is to keep saving the descrambled data when needed
case 6: {
// kof2002b_gfx_decrypt(NeoTextROM + 0x20000, 0x20000);
break;
}
}
look for this:
// Extract data from the end of C ROMS
BurnUpdateProgress(0.0, _T("Generating text layer graphics..."), 0);
NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);
add this after:
// Original convertion by IQ_132 (This is for svcchaos, kof2003 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);
}
}
look for this:
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 this after:
// Neo-PCM2 SNK(c) 1999 Sound Chip Emulation
// Original code by the MAME team, converted to FBA code by IQ_132
if (nNeoPCM2SNKProtection != 0) {
// thanks to ElSemi for the NEO-PCM2 info
unsigned short *rom = (unsigned short*)(YM2610ADPCMAROM);
int value = nNeoPCM2SNKProtection;
if( rom != NULL ) {
// swap address lines on the whole ROMs
unsigned short *buffer = (unsigned short*)malloc((value / 2) * sizeof(unsigned short));
if (!buffer) return 1;
for(int i = 0; i < nYM2610ADPCMASize / 2; i += (value / 2) ) {
memcpy( buffer, &rom[ i ], value );
for(int j = 0; j < (value / 2); j++ ) {
rom[ i + j ] = buffer[ j ^ (value / 4) ];
}
}
free(buffer);
}
}
// Neo-PCM2 PLAYMORE(c) 2002 Sound Chip Emulation
// Some code by Fataku & some by the vconv (from 2ch) - FBA conversion by iq_132
if (nNeoPCM2PLAYMOREProtection != 0) {
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
};
int value = (nNeoPCM2PLAYMOREProtection - 1);
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];
rom[ofst] = (buf[((i + addrs[value][0]) & 0xffffff)] ^ xordata[value][(ofst & 0x07)]);
}
free(buf);
}
look for this:
if (nBIOS == -1 || nBIOS == 9) {
// Write system type & region code into BIOS ROM
*((unsigned short*)(Neo68KBIOS + 0x000400)) = ((NeoSystem & 4) << 13) | (NeoSystem & 0x03);
}
replace with this:
if (nBIOS == -1 || nBIOS == 9 || nBIOS == 10) {
// Write system type & region code into BIOS ROM
*((unsigned short*)(Neo68KBIOS + 0x000400)) = ((NeoSystem & 4) << 13) | (NeoSystem & 0x03);
}
look for this:
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}
replace with this:
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_CUSTOM_BANKING)) {
SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FFFFF, SM_ROM);
}
}
find this:
nNeoSRAMProtection = -1;
nNeoTextROMSize = -1;
add this after:
nNeoPCM2SNKProtection = 0; // Exits Neo-PCM2 emulation
nNeoPCM2PLAYMOREProtection = 0;
nNeoTextROMFixType = 0; // Exit text layer fix
In neogeo.cpp:
replace the whole NeoLoadCode funtion with this one:
// This function loads the 68K ROMs (fix by NetBug)
int NeoLoadCode(int nOffset, int nNum, unsigned char* pDest)
{
int nRomSize = 0;
unsigned char* pROM = pDest;
struct BurnRomInfo ri;
// Load the ROMs
for (int i = 0; i < nNum; i++) {
ri.nType = 0;
ri.nLen = 0;
BurnDrvGetRomInfo(&ri,nOffset+i);
nRomSize =ri.nLen;
if (BurnLoadRom(pROM, nOffset + i, 1)) {
return 1;
}
pROM +=nRomSize;
BurnDrvGetRomInfo(&ri, nOffset + i);
// Swap the blocks in the ROM if needed.
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPP && i && ri.nLen == 0x400000) {
for (unsigned int k = 0; k < (ri.nLen >> 1); k++) {
unsigned char n = pROM[k];
pROM[k] = pROM[k + (ri.nLen >> 1)];
pROM[k + (ri.nLen >> 1)] = n;
}
}
// Swap the blocks in the ROM if needed.
if (BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPP && nRomSize == 0x200000) {
for (int j = 0; j < nNum; j++) {
for (int k = 0; k < (nRomSize >> 1); k++) {
unsigned char n = pDest[k];
pDest[k] = pDest[k + (nRomSize >> 1)];
pDest[k + (nRomSize >> 1)] = n;
}
}
}
}
return 0;
}
Continues on next post...