Your code is very long, I use pvc code for this game.maybe short.^_^
// The King of Fighters 10th Anniversary (bootleg / hack)
static struct BurnRomInfo kof10thRomDesc[] = {
{"kf10-p1.bin", 0x800000, 0xB1FD0C43, 1 | BRF_ESS | BRF_PRG }, // 0 68K code (Is supposed to have the text data)
{"kf10-c1a.bin", 0x400000, 0x3BBC0364, 3 | BRF_GRA }, // 1 Sprite data
{"kf10-c2a.bin", 0x400000, 0x91230075, 3 | BRF_GRA }, // 2
{"kf10-c1b.bin", 0x400000, 0xB5ABFC28, 3 | BRF_GRA }, // 3
{"kf10-c2b.bin", 0x400000, 0x6CC4C6E1, 3 | BRF_GRA }, // 4
{"kf10-c3a.bin", 0x400000, 0x5B3D4A16, 3 | BRF_GRA }, // 5
{"kf10-c4a.bin", 0x400000, 0xC6F3419B, 3 | BRF_GRA }, // 6
{"kf10-c3b.bin", 0x400000, 0x9D2BBA19, 3 | BRF_GRA }, // 7
{"kf10-c4b.bin", 0x400000, 0x5A4050CB, 3 | BRF_GRA }, // 8
{"kf10-c5a.bin", 0x400000, 0xA289D1E1, 3 | BRF_GRA }, // 9
{"kf10-c6a.bin", 0x400000, 0xE6494B5D, 3 | BRF_GRA }, // 10
{"kf10-c5b.bin", 0x400000, 0x404FFF02, 3 | BRF_GRA }, // 11
{"kf10-c6b.bin", 0x400000, 0xF2CCFC9E, 3 | BRF_GRA }, // 12
{"kf10-c7a.bin", 0x400000, 0xBE79C5A8, 3 | BRF_GRA }, // 13
{"kf10-c8a.bin", 0x400000, 0xA5952CA4, 3 | BRF_GRA }, // 14
{"kf10-c7b.bin", 0x400000, 0x3FDB3542, 3 | BRF_GRA }, // 15
{"kf10-c8b.bin", 0x400000, 0x661B7A52, 3 | BRF_GRA }, // 16
{"kf10-m1.bin", 0x020000, 0xF6FAB859, 4 | BRF_ESS | BRF_PRG }, // 17 Z80 code
{"kf10-v1.bin", 0x800000, 0x0FC9A58D, 5 | BRF_SND }, // 18 Sound data (Decrypted data from kof2002)
{"kf10-v2.bin", 0x800000, 0xB8C475A4, 5 | BRF_SND }, // 19
};
STDROMPICKEXT(kof10th, kof10th, neogeo);
STD_ROM_FN(kof10th);
static void kof10th_decode()
{
int i, j, size = 0x800000;
UINT16 *prom = (UINT16*)Neo68KROM;
UINT16 *buf = (UINT16*)malloc(size);
UINT16 *srom = (UINT16*)NeoTextROM+0x20000;
// HappyASR fixed order
memcpy(buf+0x000000/2, prom+0x600000/2, 0x100000);
memcpy(buf+0x100000/2, prom+0x000000/2, 0x600000);
// Re-order the P data
// memcpy(buf+0x000000/2, prom+0x700000/2, 0x100000);
// memcpy(buf+0x100000/2, prom+0x000000/2, 0x400000);
// memcpy(buf+0x500000/2, prom+0x400000/2, 0x200000);
for (i=0;i j=BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,1,8,7,6,0,4,3,2,9,5);
prom[j]=buf[i];
}
free(buf);
for (i=0;i<0x10000/2;i++) {
srom[i+0x00000/2]=BITSWAP16(prom[i+0x600000/2]^0xf3f3,7,6,0,4,3,2,1,5,15,14,8,12,11,10,9,13);
srom[i+0x10000/2]=BITSWAP16(prom[i+0x6d0000/2]^0xf3f3,7,6,0,4,3,2,1,5,15,14,8,12,11,10,9,13);
}
for (i=0;i<0x4000/2;i++) {
srom[i+0x02000/2]=BITSWAP16(prom[i+0x6c2000/2]^0xf3f3,7,6,0,4,3,2,1,5,15,14,8,12,11,10,9,13);
srom[i+0x12000/2]=BITSWAP16(prom[i+0x612000/2]^0xf3f3,7,6,0,4,3,2,1,5,15,14,8,12,11,10,9,13);
}
for (i=0;i<0x20000/2;i++) {
srom[i+0x40000/2]=BITSWAP16(prom[i+0x600000/2]^0xf3f3,7,6,0,4,3,2,1,5,15,14,8,12,11,10,9,13);
}
memcpy(NeoTextROM+0x80000, NeoTextROM+0x40000, 0x20000);
for (i=0;i<0x40;i++) {
prom[0xe0000/2+i]=((prom[0x531680/2+i]^(0xc11d-0xc0c8))^prom[0x531600/2+i]);
}
for (i=0;i<0x270;i++) {
prom[0xe1000/2+i]=((prom[0x531970/2+i]^(0xc11d-0xc0d9))^prom[0x531700/2+i]);
}
prom[0x00124/2] = 0x000D; // Run code that gives XOR for RAM moves and forces SoftDIPs
prom[0x00126/2] = 0xF7A8; // (how to play off and always teamplay). Also forces USA region.
prom[0x08bf4/2] = 0x4Ef9; // Run code to change 8x8 tiles (needed for neogeo logo tiles)
prom[0x08bf6/2] = 0x000D;
prom[0x08bf8/2] = 0xF980;
prom[0xe1154/2] = 0x125C;
prom[0xdf986/2] = 0x168C;
prom[0xdf998/2] = 0x1668;
prom[0xdd880/2] = 0x4E75;
prom[0xdd89e/2] = 0x4E75;
prom[0xdd8bc/2] = 0x4E75;
}
// Thanks to HappyASR for the info
void __fastcall kf10thWriteByteBankSwitch(unsigned int sekAddress, unsigned char byteValue)
{
pvc_w8(sekAddress,byteValue);
}
void __fastcall kf10thWriteWordBankSwitch(unsigned int sekAddress, unsigned short wordValue)
{
CartRAM[(sekAddress-0x2fe000)/2]=wordValue;
if(sekAddress==0x2ffff0)
SekMapMemory(Neo68KROM+0x100000+wordValue*0x100000,0x200000,0x2fdfff,SM_ROM);
}
static void kof10thMapHandler()
{
// Install BankSwitch handler
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_READ);
SekSetReadWordHandler(5, pvcReadWordBankSwitch);
SekSetReadByteHandler(5, pvcReadByteBankSwitch);
SekMapHandler(5, 0x2fe000, 0x2fffff, SM_WRITE);
SekSetWriteWordHandler(5, kf10thWriteWordBankSwitch);
SekSetWriteByteHandler(5, kf10thWriteByteBankSwitch);
}
static int kof10thInit()
{
int nRet;
memset(CartRAM,0,sizeof(CartRAM));
pNeoInitCallback = kof10th_decode;
nNeoTextROMSize = 0x080000; // minor glitches in Neo-Geo logo texts
nRet = NeoInit();
if (nRet == 0) {
kof10thMapHandler();
}
return nRet;
}
struct BurnDriver BurnDrvkof10th = {
"kof10th", "kof2002", "neogeo", "2004",
"The King of Fighters 10th Anniversary (hack)\0", "Hack of \"The King of Fighters 2002\"", "SNK Playmore", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_BOOTLEG, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_CUSTOM_BANKING,
NULL, kof10thRomInfo, kof10thRomName, neogeoInputInfo, neogeoDIPInfo,
kof10thInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};