Jump to content

Kof2003b Now Working On Fba


Recommended Posts

some good news for anyone that rather uses the kawaks 1.48dev version of kof2003 (not the PCB version), ferchogtx of romshare recently posted a driver that works with that version in fba.

 

i tried to do this for fba-xxx but its different in the neo_run.cpp part and all i got was errors ;)

 

heres the info:

// The King of Fighters 2003 (bootleg)

static struct BurnRomInfo kof2003bRomDesc[] = {
{"271-p1bl.bin", 0x400000,  0x92ed6ee3, 0x10}, //  0 68K code /* scrambled, maybe P1 is P2 ROM */
{"271-p2bl.bin", 0x400000,  0x5d3d8bb3, 0x10}, //  1       /* and P2 is P1 ROM */

{"271-s1bl.bin", 0x020000,  0x3ba05252,    1}, //  2 Text layer tiles /* scrambled */

{"271-c1d.bin" , 0x1000000, 0xc29acd28,    1}, //  3 Sprite data
{"271-c2d.bin" , 0x1000000, 0x328e80b1,    1}, //  4
{"271-c3d.bin" , 0x1000000, 0x020a11f1,    1}, //  5
{"271-c4d.bin" , 0x1000000, 0x991b5ed2,    1}, //  6
{"271-c5d.bin" , 0x1000000, 0xc2de8b66,    1}, //  7 /* The last 2 CxD roms contains S1-ROM */
{"271-c6d.bin" , 0x1000000, 0x3ff750db,    1}, //  8 /* data (512 KB) only, no sprite data */

{"271-m1d.bin" , 0x080000,  0x0e86af8f, 0x10}, //  9 Z80 code /* overdumped? */

{"271-v1d.bin" , 0x1000000, 0x2058ec5e,    2}, //  10 Sound data /* comes from 4 V-ROMs dump */
};

STDROMPICKEXT(kof2003b, kof2003b, neogeo);
STD_ROM_FN(kof2003b);

static unsigned short kof2003_tbl[0x1000];


unsigned char __fastcall kof2003ReadByteBankSwitch(unsigned int sekAddress)
{
return *(((unsigned char *)kof2003_tbl)+((sekAddress^1)-0x2fe000));
}


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

static void kof2003WriteBankSwitch(unsigned int sekAddress,unsigned short wordValue,unsigned short valueMask)
{
int address=(sekAddress-0x2fe000)/2,bankaddress;
kof2003_tbl[address]=(wordValue&valueMask)|(~valueMask&kof2003_tbl[address]);
if(address!=0xff8 && address!=0xff9 ) return;
bankaddress=(kof2003_tbl[0xff8]>>8)|(kof2003_tbl[0xff9]<<8);
*(((unsigned char *)kof2003_tbl)+0x1ff0)=0xa0;
*(((unsigned char *)kof2003_tbl)+0x1ff1)&=0xfe;
*(((unsigned char *)kof2003_tbl)+0x1ff3)&=0x7f;
SekMapMemory(Neo68KROM02+bankaddress,0x200000,0x2  fdfff,SM_ROM);
Neo68KROM01[0x58196]=kof2003_tbl[0xff9]&0xff;
}

void __fastcall kof2003WriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
unsigned short valueMask=0xffff;
kof2003WriteBankSwitch(sekAddress,wordValue,value  Mask);
}

void __fastcall kof2003WriteByteBankSwitch(unsigned int sekAddress, unsigned char byteValue)
{
unsigned short wordValue=0,valueMask=0xff;
if(!(sekAddress&1)) {
 wordValue=byteValue<<8;
 valueMask<<=8;
}
else{
 wordValue=byteValue;
}
kof2003WriteBankSwitch(sekAddress,wordValue,value  Mask);
}

void kof2003_RomExchange()
{
memcpy(Neo68KROM01+0x100000,Neo68KROM01,0x600000)  ;
memcpy(Neo68KROM01,Neo68KROM01+0x700000,0x100000)  ;
memset(Neo68KROM01+0x700000,0,0x100000);
}

static void kof2003MapHandler()
{
// Install BankSwitch handler
SekMapHandler(5,	0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5,  kof2003ReadWordBankSwitch);
SekSetReadByteHandler(5,  kof2003ReadByteBankSwitch);

SekMapHandler(5,	0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, kof2003WriteWordBankSwitch);
SekSetWriteByteHandler(5, kof2003WriteByteBankSwitch);
}

static int kof2003bInit()
{
int nRet;

memset(kof2003_tbl,0,0x2000);

nTextBankswitch=1;
pNeoInitCallback=kof2003_RomExchange;

nRet=NeoInit();
if(!nRet)
 kof2003MapHandler();
return nRet;
}

struct BurnDriver BurnDrvkof2003b = {
{"kof2003b", "The King of Fighters 2003 (bootleg)", "Some effects missing", "SNK Playmore Corporation", "Neo Geo", "2003", "kof2003", "neogeo"},
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
};

 

in neogeo.h:

in // neo_run.ccp definitions:

extern int nTextBankswitch;

 

in neorun.ccp:

search for this:

int nNeoSRAMProtection = -1;

 

put this bellow:

int nTextBankswitch = -1; // Text fix for kof2003b and ms5plus

 

serach for this:

// Load Text layer tiledata
{
 // Load boardROM data
 BurnLoadRom(NeoTextROM,	0x00080 + 0x14, 1);

 if (pInfo->nTextOffset != -1) {
 	// Load S ROM data
 	BurnLoadRom(NeoTextROM + 0x020000, pInfo->nTextOffset, 1);
 } else {
 	// Extract data from the end of C ROMS
 	BurnUpdateProgress(0.0, "Generating text layer graphics...", 0);
 	NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);
 }
 
}

 

replace with this:

// Load Text layer tiledata
{
 // Load boardROM data
 BurnLoadRom(NeoTextROM,	0x00080 + 0x14, 1);

 if (pInfo->nTextOffset != -1) {
 	// Load S ROM data
 	BurnLoadRom(NeoTextROM + 0x020000, pInfo->nTextOffset, 1);

 /* Original code from mame traduced by FerchogtX */
 /* Thanks also to HappyASR for the info */
 if (nTextBankswitch == 1) {
 	unsigned char* dst = (unsigned char*)malloc(0x20000);
 	unsigned char* roms1 = NeoTextROM+0x20000;
 	if ( dst )
 	{
   memcpy(dst,roms1,0x20000);
   // descrambling the S1 by dorriGa
   for ( int j=0;j<0x20000; j+=0x000010)
   {
   	memcpy( roms1+j, dst+j+0x000008,8);
   	memcpy( roms1+j+0x000008, dst+j,8);
   }
 	}
 	free( dst );
 }

 } else {
 	// Extract data from the end of C ROMS
 	BurnUpdateProgress(0.0, "Generating text layer graphics...", 0);
 	NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);
 }
 
}

 

search for this:

int NeoExit()

 

in the neoexit function, below to nNeoSRAMProtection = -1; paste this:

nTextBankswitch = -1; // Turns off textfix when you quit a game

 

don't forget also:

if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_CONTROLMASK) != HARDWARE_SNK_GAMBLING) {
   	//// added
   	if (!(BurnDrvGetHardwareCode() & HARDWARE_SNK_NEWBANKSYSTEM)) {
   	////end
     nNeo68KROMBank = -1U;
     Bankswitch(0);
   	//// added
   	}
   	////end
   }
 }

 

and this in neogeo.h:

#define HARDWARE_SNK_NEWBANKSYSTEM 0x0200

 

this will fix text layers in kof2003b ans also ms5plus, just put this line in ms5plus init:

nTextBankswitch=1;

Edited by Prican25
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...