kludges for wwf raw, nfl

This commit is contained in:
kub 2019-03-22 20:18:33 +01:00
parent 122afd9d37
commit 064cc6d103
2 changed files with 23 additions and 0 deletions

View file

@ -4233,6 +4233,14 @@ void scan_block(u32 base_pc, int is_slave, u8 *op_flags, u32 *end_pc_out,
if (opd->imm < end_pc + MAX_LITERAL_OFFSET) {
if (end_literals < opd->imm + opd->size * 2)
end_literals = opd->imm + opd->size * 2;
if (opd->size == 2) {
// tweak for NFL: treat a 32bit literal as an address and check if it
// points to the literal space. In that case handle it like MOVA.
tmp = FETCH32(opd->imm) & ~0x20000000; // MUST ignore wt bit here
if (tmp >= end_pc && tmp < end_pc + MAX_LITERAL_OFFSET)
if (lowest_mova == 0 || tmp < lowest_mova)
lowest_mova = tmp;
}
}
}
}

View file

@ -1487,6 +1487,20 @@ static void REGPARM(3) sh2_write16_da(u32 a, u32 d, SH2 *sh2)
((u16 *)sh2->data_array)[a1 / 2] = d;
}
static void REGPARM(3) sh2_write16_rom(u32 a, u32 d, SH2 *sh2)
{
u32 a1 = a & 0x3fffff;
// tweak for WWF Raw: does writes to ROM area, and it doesn't work without
// allowing this.
// Presumably the write goes to the CPU cache and is read back from there,
// but it would be extremely costly to emulate cache behaviour. Just allow
// writes to that region, hoping that the original ROM values are never used.
if ((a1 & 0x3e0000) == 0x3e0000)
((u16 *)sh2->p_rom)[a1 / 2] = d;
else
sh2_write16_unmapped(a, d, sh2);
}
typedef u32 (sh2_read_handler)(u32 a, SH2 *sh2);
typedef void REGPARM(3) (sh2_write_handler)(u32 a, u32 d, SH2 *sh2);
@ -1911,6 +1925,7 @@ void PicoMemSetup32x(void)
bank_switch_rom_sh2();
sh2_read8_map[0x02/2].mask = sh2_read8_map[0x22/2].mask =
sh2_read16_map[0x02/2].mask = sh2_read16_map[0x22/2].mask = 0x3fffff; // FIXME
sh2_write16_map[0x02/2] = sh2_write16_map[0x22/2] = sh2_write16_rom;
// CS2 - DRAM - done by Pico32xSwapDRAM()
sh2_read8_map[0x04/2].mask = sh2_read8_map[0x24/2].mask =
sh2_read16_map[0x04/2].mask = sh2_read16_map[0x24/2].mask = 0x01ffff;