From 63303f1572b7e313881e0b9f7ac537722606f25e Mon Sep 17 00:00:00 2001 From: ogamespec Date: Wed, 16 Aug 2023 12:49:32 +0300 Subject: [PATCH] Fixed DSI/ISI crashes #296 --- build/Data/Json/GekkoCoreJdi.json | 2 +- src/di.cpp | 7 ++++++- src/gekko.cpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/Data/Json/GekkoCoreJdi.json b/build/Data/Json/GekkoCoreJdi.json index 5ce7251e..db996525 100644 --- a/build/Data/Json/GekkoCoreJdi.json +++ b/build/Data/Json/GekkoCoreJdi.json @@ -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>", diff --git a/src/di.cpp b/src/di.cpp index 018fe670..85043571 100644 --- a/src/di.cpp +++ b/src/di.cpp @@ -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; } diff --git a/src/gekko.cpp b/src/gekko.cpp index 1cc219d5..31b3a7fa 100644 --- a/src/gekko.cpp +++ b/src/gekko.cpp @@ -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);