mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
32x, hacks for roms with caching related problems
This commit is contained in:
parent
ebd9c86a6c
commit
fe8f2d963e
7 changed files with 89 additions and 28 deletions
|
@ -816,7 +816,7 @@ static void p32x_sh2reg_write8(u32 a, u32 d, SH2 *sh2)
|
|||
Pico32x.sh2_regs[0] &= ~0x80;
|
||||
Pico32x.sh2_regs[0] |= d & 0x80;
|
||||
|
||||
if ((d ^ old) & 1)
|
||||
if ((old ^ d) & 1)
|
||||
p32x_pwm_schedule_sh2(sh2);
|
||||
if ((old ^ d) & 2)
|
||||
p32x_update_cmd_irq(sh2, 0);
|
||||
|
@ -1776,7 +1776,7 @@ static void REGPARM(3) sh2_write16_rom(u32 a, u32 d, SH2 *sh2)
|
|||
// 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)
|
||||
if ((a1 & 0x3e0000) == 0x3e0000 && (PicoIn.quirks & PQUIRK_WWFRAW_HACK))
|
||||
((u16 *)sh2->p_rom)[a1 / 2] = d;
|
||||
else
|
||||
sh2_write16_unmapped(a, d, sh2);
|
||||
|
@ -1951,6 +1951,16 @@ void *p32x_sh2_get_mem_ptr(u32 a, u32 *mask, SH2 *sh2)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int p32x_sh2_mem_is_rom(u32 a, SH2 *sh2)
|
||||
{
|
||||
if ((a & 0xc6000000) == 0x02000000) {
|
||||
// ROM, but mind tweak for WWF Raw
|
||||
return !(PicoIn.quirks & PQUIRK_WWFRAW_HACK) || (a & 0x3f0000) < 0x3e0000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int p32x_sh2_memcpy(u32 dst, u32 src, int count, int size, SH2 *sh2)
|
||||
{
|
||||
u32 mask;
|
||||
|
|
|
@ -137,15 +137,7 @@ static void dmac_memcpy(struct dma_chan *chan, SH2 *sh2)
|
|||
|
||||
if (!up || chan->tcr < 4)
|
||||
return;
|
||||
#if MARS_CHECK_HACK
|
||||
// XXX Mars Check Program copies 32K longwords (128KB) from a 64KB buffer in
|
||||
// ROM or DRAM to SDRAM in 4-longword mode, overwriting an SDRAM comm area in
|
||||
// turn, which crashes the test on emulators without CPU cache emulation.
|
||||
// This may be a bug in Mars Check. As a kludge limit the transfer to 64KB,
|
||||
// which is what the check program test uses for checking the result.
|
||||
// A better way would clearly be to have a mechanism to patch the ROM...
|
||||
if (size == 3 && chan->tcr == 32768 && chan->dar == 0x06020000) size = 1;
|
||||
#endif
|
||||
|
||||
if (size == 3) size = 2; // 4-word xfer mode still counts in words
|
||||
// XXX check TCR being a multiple of 4 in 4-word xfer mode?
|
||||
// XXX check alignment of sar/dar, generating a bus error if unaligned?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue