Thanks. Replace and done.
/************************ Fatal Fury 2 *************************
todo: emulate, not patch!
***************************************************************/
int neogeo_prot_data;
static READ16_HANDLER( fatfury2_protection_16_r )
{
UINT16 res = (neogeo_prot_data >> 24) & 0xff;
switch (offset)
{
case 0x55550/2:
case 0xffff0/2:
case 0x00000/2:
case 0xff000/2:
case 0x36000/2:
case 0x36008/2:
return res;
case 0x36004/2:
case 0x3600c/2:
return ((res & 0xf0) >> 4) | ((res & 0x0f) << 4);
default:
logerror("unknown protection read at pc %06x, offset %08x\n",activecpu_get_pc(),offset<<1);
return 0;
}
}
static WRITE16_HANDLER( fatfury2_protection_16_w )
{
switch (offset)
{
case 0x11112/2: /* data == 0x1111; expects 0xFF000000 back */
neogeo_prot_data = 0xFF000000;
break;
case 0x33332/2: /* data == 0x3333; expects 0x0000FFFF back */
neogeo_prot_data = 0x0000FFFF;
break;
case 0x44442/2: /* data == 0x4444; expects 0x00FF0000 back */
neogeo_prot_data = 0x00FF0000;
break;
case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */
neogeo_prot_data = 0xff00ff00;
break;
case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */
neogeo_prot_data = 0xf05a3601;
break;
case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */
neogeo_prot_data = 0x81422418;
break;
case 0x55550/2:
case 0xffff0/2:
case 0xff000/2:
case 0x36000/2:
case 0x36004/2:
case 0x36008/2:
case 0x3600c/2:
neogeo_prot_data <<= 8;
break;
default:
logerror("unknown protection write at pc %06x, offset %08x, data %02x\n",activecpu_get_pc(),offset,data);
break;
}
}
void fatfury2_install_protection(void)
{
/* Hacks the program rom of Fatal Fury 2, needed either in arcade or console mode */
/* otherwise at level 2 you cannot hit the opponent and other problems */
/* there seems to also be another protection check like the countless ones */
/* patched above by protecting a SRAM location, but that trick doesn't work */
/* here (or maybe the SRAM location to protect is different), so I patch out */
/* the routine which trashes memory. Without this, the game goes nuts after */
/* the first bonus stage. */
// UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
// mem16[0xb820/2] = 0x4e71;
// mem16[0xb822/2] = 0x4e71;
/* again, the protection involves reading and writing addresses in the */
/* 0x2xxxxx range. There are several checks all around the code. */
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_w);
}
/************************ Fatal Fury 3 *************************
is this still needed? -- some people report other lockups
in this.
***************************************************************/
void fatfury3_install_protection(void)
{
/* patch the first word, it must be 0x0010 not 0x0000 (initial stack pointer) */
UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
mem16[0x0000/2] = 0x0010;
}