Improve SetLoc CDROM command from Duckstation
[pcsx_rearmed.git] / libpcsxcore / psxinterpreter.c
index db8e73b..6c19f06 100644 (file)
@@ -39,7 +39,9 @@ static u32 branchPC;
 #define debugI()
 #endif
 
-#ifdef NDEBUG
+#ifndef NDEBUG
+#include "debug.h"
+#else
 void StartDebugger() {}
 void ProcessDebug() {}
 void StopDebugger() {}
@@ -854,7 +856,13 @@ void psxBASIC(struct psxCP2Regs *regs) {
 
 void psxHLE() {
 //     psxHLEt[psxRegs.code & 0xffff]();
-       psxHLEt[psxRegs.code & 0x07]();         // HDHOSHY experimental patch
+//     psxHLEt[psxRegs.code & 0x07]();         // HDHOSHY experimental patch
+    uint32_t hleCode = psxRegs.code & 0x03ffffff;
+    if (hleCode >= (sizeof(psxHLEt) / sizeof(psxHLEt[0]))) {
+        psxNULL();
+    } else {
+        psxHLEt[hleCode]();
+    }
 }
 
 void (*psxBSC[64])() = {