From 42f8b4953192ece0ed8d59ab307cf2e4aa1c5745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 19 Jan 2025 22:34:38 +0100 Subject: [PATCH 1/3] Unbreak Tekken 6, logging fix --- Core/HLE/sceKernelInterrupt.cpp | 2 +- Core/HLE/sceKernelModule.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index b33cfea25aae..1fefb0393299 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -600,7 +600,7 @@ static u32 sceKernelMemset(u32 addr, u32 fillc, u32 n) { } } NotifyMemInfo(MemBlockFlags::WRITE, addr, n, "KernelMemset"); - return hleLogDebug(Log::sceIntc, addr); + return hleLogDebug(Log::sceKernel, addr); } static u32 sceKernelMemcpy(u32 dst, u32 src, u32 size) { diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index fec40ab21d9a..5902abec1abf 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -2143,7 +2143,8 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { if (!module) { if (magic == 0x46535000) { - // TODO: What's actually going on here? + // TODO: What's actually going on here? This is needed to keep Tekken 6 working, the "proper" error breaks it, when it tries to load PARAM.SFO as a module. + error = -1; return hleDelayResult(hleLogError(Log::Loader, error, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic), "module loaded", 500); } From 7d852b456d4c2c86aa3691d02620aa82a587dada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 20 Jan 2025 11:55:19 +0100 Subject: [PATCH 2/3] Crazy Taxi workaround. See #19894 --- GPU/GPUCommon.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 1f507a386712..e0ab9df04ee8 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -748,18 +748,20 @@ DLResult GPUCommon::ProcessDLQueue() { for (int listIndex = GetNextListIndex(); listIndex != -1; listIndex = GetNextListIndex()) { DisplayList &list = dls[listIndex]; - if (!Memory::IsValidAddress(list.pc)) { - ERROR_LOG(Log::G3D, "DL PC = %08x WTF!!!!", list.pc); - return DLResult::Error; + if (list.state == PSP_GE_DL_STATE_PAUSED) { + return DLResult::Done; } - DEBUG_LOG(Log::G3D, "%s DL execution at %08x - stall = %08x (startingTicks=%lld)", - list.pc == list.startpc ? "Starting" : "Resuming", list.pc, list.stall, startingTicks); - - if (list.state == PSP_GE_DL_STATE_PAUSED) { + // Temporary workaround for Crazy Taxi, see #19894 + if (list.state == PSP_GE_DL_STATE_NONE) { + WARN_LOG(Log::G3D, "Discarding display list with state NONE (pc=%08x). This is odd.", list.pc); + dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end()); return DLResult::Done; } + DEBUG_LOG(Log::G3D, "%s DL execution at %08x - stall = %08x (startingTicks=%lld)", + list.pc == list.startpc ? "Starting" : "Resuming", list.pc, list.stall, startingTicks); + if (!resumingFromDebugBreak_) { // TODO: Need to be careful when *resuming* a list (when it wasn't from a stall...) currentList = &list; @@ -771,6 +773,11 @@ DLResult GPUCommon::ProcessDLQueue() { gstate_c.offsetAddr = list.offsetAddr; + if (!Memory::IsValidAddress(list.pc)) { + ERROR_LOG(Log::G3D, "DL PC = %08x WTF!!!!", list.pc); + return DLResult::Done; + } + cycleLastPC = list.pc; cyclesExecuted += 60; downcount = list.stall == 0 ? 0x0FFFFFFF : (list.stall - list.pc) / 4; @@ -842,6 +849,7 @@ DLResult GPUCommon::ProcessDLQueue() { // don't do anything - though dunno about error... break; case GPUSTATE_STALL: + // Resume work on this same display list later. return DLResult::Done; default: return DLResult::Error; From 31c1506a570de4a9dbd021d659630f36dfa18d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 20 Jan 2025 11:56:13 +0100 Subject: [PATCH 3/3] Some logging improvements --- Core/HLE/HLE.cpp | 1 + Core/HLE/sceDisplay.cpp | 2 +- Core/HLE/sceGe.cpp | 19 +++++++++---------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index c77802aea66a..3d6535d60356 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -798,6 +798,7 @@ void CallSyscall(MIPSOpcode op) { } } +// TODO: Also add support for argument names. size_t hleFormatLogArgs(char *message, size_t sz, const char *argmask) { char *p = message; size_t used = 0; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 6115116bb90c..bf778fcfc312 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -1099,7 +1099,7 @@ static u32 sceDisplaySetBrightness(int level, int other) { static u32 sceDisplaySetHoldMode(u32 hMode) { // Not sure what this does, seems to do nothing in tests and accept all values. holdMode = hMode; - return hleReportError(Log::sceDisplay, 0, "unsupported"); + return hleLogWarning(Log::sceDisplay, 0, "UNIMPL"); } const HLEFunction sceDisplay[] = { diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 3a3e5ff4711f..0493e69d352d 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -332,18 +332,17 @@ bool __GeTriggerWait(GPUSyncType type, SceUID waitId) { return false; } +// Some games spam this, like MediEvil. static u32 sceGeEdramGetAddr() { u32 retVal = 0x04000000; - DEBUG_LOG(Log::sceGe, "%08x = sceGeEdramGetAddr", retVal); hleEatCycles(150); - return retVal; + return hleLogVerbose(Log::sceGe, retVal); } // TODO: Return a different value for the PS3 enhanced-emulator games? static u32 sceGeEdramGetSize() { const u32 retVal = 0x00200000; - DEBUG_LOG(Log::sceGe, "%08x = sceGeEdramGetSize()", retVal); - return retVal; + return hleLogVerbose(Log::sceGe, retVal); } static int __GeSubIntrBase(int callbackId) { @@ -351,9 +350,6 @@ static int __GeSubIntrBase(int callbackId) { } u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { - DEBUG_LOG(Log::sceGe, - "sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d", - listAddress, stallAddress, callbackId, optParamAddr, (int)CoreTiming::GetTicks()); auto optParam = PSPPointer::Create(optParamAddr); bool runList; @@ -369,13 +365,16 @@ u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optP } hleEatCycles(490); hleCoreTimingForceCheck(); - return listID; // We already logged above, logs get confusing if we use hleLogSuccess. + DEBUG_LOG(Log::sceGe, + "%08x=sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%lld", listID, + listAddress, stallAddress, callbackId, optParamAddr, (long long)CoreTiming::GetTicks()); + return hleNoLog(listID); // We already logged above, logs get confusing if we use hleLogSuccess. } u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { DEBUG_LOG(Log::sceGe, - "sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d", - listAddress, stallAddress, callbackId, optParamAddr, (int)CoreTiming::GetTicks()); + "sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%lld", + listAddress, stallAddress, callbackId, optParamAddr, (long long)CoreTiming::GetTicks()); auto optParam = PSPPointer::Create(optParamAddr); bool runList;