Fixed DSI/ISI crashes

#296
This commit is contained in:
ogamespec 2023-08-16 12:49:32 +03:00
parent 86775aec93
commit 63303f1572
3 changed files with 9 additions and 4 deletions

View file

@ -63,7 +63,7 @@
},
"CacheLog": {
"help": "Set cache operations log mode",
"help": "Set cache operations log mode (0: none, 1: cache commands, 2: all)",
"args": 1,
"usage": [
"Syntax: CacheLog <0|1|2>",

View file

@ -78,6 +78,10 @@ static void DITransferComplete()
PIAssertInt(PI_INTERRUPT_DI);
}
if (di.log) {
Report(Channel::DI, "TransferComplete\n");
}
DVD::DDU->SetTransferCallbacks(DIHostToDduCallbackCommand, DIDduToHostCallback);
}
@ -129,7 +133,8 @@ static uint8_t DIHostToDduCallbackData()
if (DILEN)
{
uint32_t dimar = DIMAR & DI_DIMAR_MASK;
PIReadBurst(dimar, di.dmaFifo);
uint8_t* ptr = (uint8_t *)MIGetMemoryPointerForIO(dimar);
memcpy(ptr, di.dmaFifo, 32);
DIMAR += 32;
DILEN -= 32;
}

View file

@ -969,7 +969,7 @@ namespace Gekko
if (pa >= cacheSize)
return;
if (IsDirty(pa))
if (IsDirty(pa) && !IsInvalid(pa))
{
CastOut(pa);
SetDirty(pa, false);
@ -1009,7 +1009,7 @@ namespace Gekko
if (pa >= cacheSize)
return;
if (IsDirty(pa))
if (IsDirty(pa) && !IsInvalid(pa))
{
CastOut(pa);
SetDirty(pa, false);