I looked at the MAME source and the drivers were similar, but something has to be wrong with the protection scheme cause it don't work, anyone got the fix?
// Fatal Fury 2
static struct BurnRomInfo fatfury2RomDesc[] = {
{"047-p1.bin" , 0x080000, 0xbe40ea92, 0x10}, // 0 68K code
{"047-p2.bin" , 0x080000, 0x2a9beac5, 0x10}, // 1
{"047-s1.bin" , 0x020000, 0xd7dbbf39, 1}, // 2 Text layer tiles
{"047-c1.bin" , 0x200000, 0xf72a939e, 1}, // 3 Sprite data
{"047-c2.bin" , 0x200000, 0x05119a0d, 1}, // 4
{"047-c3.bin" , 0x200000, 0x01e00738, 1}, // 5
{"047-c4.bin" , 0x200000, 0x9fe27432, 1}, // 6
{"047-m1.bin" , 0x020000, 0x820b0ba7, 0x10}, // 7 Z80 code
{"047-v1.bin" , 0x200000, 0xd9d00784, 2}, // 8 Sound data
{"047-v2.bin" , 0x200000, 0x2c9a4b33, 2}, // 9
};
STDROMPICKEXT(fatfury2, fatfury2, neogeo);
STD_ROM_FN(fatfury2);
static int prot_data;
unsigned char __fastcall fatfury2ReadByteProtection(unsigned int sekAddress)
{
unsigned short res = (prot_data >> 24) & 0xFF;
switch (sekAddress) {
case 0x255551:
case 0x2FFFF1:
case 0x200001:
case 0x2FF001:
case 0x236001:
case 0x236009:
return res;
case 0x236005:
case 0x23600D:
return ((res & 0xF0) >> 4) | ((res & 0x0F) << 4);
// default:
// printf(" - prot %06X read", sekAddress);
}
return 0;
}
void __fastcall fatfury2WriteByteProtection(unsigned int sekAddress, unsigned char /*byteValue*/)
{
switch (sekAddress) {
case 0x255553: // data == 0x5555; read back from 55550, ffff0, 00000, ff000
prot_data = 0xFF00FF00;
break;
case 0x256783: // data == 0x1234; read back from 36000 *or* 36004
prot_data = 0xF05A3601;
break;
case 0x242813: // data == 0x1824; read back from 36008 *or* 3600c
prot_data = 0x81422418;
break;
case 0x255551:
case 0x2FFFF1:
case 0x2FF001:
case 0x236001:
case 0x236005:
case 0x236009:
case 0x23600D:
prot_data <<= 8;
break;
// default:
// printf(" - prot %06X -> %02X", sekAddress, byteValue);
}
}
static void fatfury2Patch()
{
*((unsigned short*)(Neo68KROM01 + 0xB820)) = 0x4E71;
*((unsigned short*)(Neo68KROM01 + 0xB822)) = 0x4E71;
}
static int fatfury2Init()
{
int nRet;
pNeoInitCallback = fatfury2Patch;
nRet = NeoInit();
if (nRet == 0) {
// Install protection handler
SekMapHandler(5, 0x200000, 0x2FFFFF, SM_WRITE);
SekSetWriteByteHandler(5, fatfury2WriteByteProtection);
SekSetReadByteHandler(5, fatfury2ReadByteProtection);
}
return nRet;
}
struct BurnDriver BurnDrvFatfury2 = {
{"fatfury2", "Fatal Fury 2", "Japanese title is: Garou Densetsu 2: arata-naru tatakai", "SNK", "Neo Geo", "1992", NULL, "neogeo"},
BDF_GAME_WORKING, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_SWAPC,
NULL, fatfury2RomInfo, fatfury2RomName, neogeoInputInfo, neogeoDIPInfo,
fatfury2Init, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};