initial hle support for lightrec
authornotaz <notasas@gmail.com>
Sat, 2 Sep 2023 19:54:16 +0000 (22:54 +0300)
committernotaz <notasas@gmail.com>
Mon, 4 Sep 2023 21:04:28 +0000 (00:04 +0300)
frontend/libretro.c
libpcsxcore/new_dynarec/emu_if.c
libpcsxcore/psxbios.c
libpcsxcore/r3000a.h

index a115fc6..b1af9f1 100644 (file)
@@ -1948,18 +1948,13 @@ static void update_variables(bool in_flight)
 
    {
       R3000Acpu *prev_cpu = psxCpu;
-#if defined(LIGHTREC)
-      bool can_use_dynarec = found_bios;
-#else
-      bool can_use_dynarec = 1;
-#endif
 
 #ifdef _3DS
       if (!__ctr_svchax)
          Config.Cpu = CPU_INTERPRETER;
       else
 #endif
-      if (strcmp(var.value, "disabled") == 0 || !can_use_dynarec)
+      if (strcmp(var.value, "disabled") == 0)
          Config.Cpu = CPU_INTERPRETER;
       else if (strcmp(var.value, "enabled") == 0)
          Config.Cpu = CPU_DYNAREC;
index f879ad8..e21003c 100644 (file)
@@ -297,7 +297,8 @@ static void ari64_notify(enum R3000Anote note, void *data) {
        case R3000ACPU_NOTIFY_BEFORE_SAVE:
                break;
        case R3000ACPU_NOTIFY_AFTER_LOAD:
-               ari64_reset();
+               if (data == NULL)
+                       ari64_reset();
                psxInt.Notify(note, data);
                break;
        }
index dc726e4..fdac556 100644 (file)
@@ -47,6 +47,8 @@
 #define PSXBIOS_LOG(...)
 #endif
 
+#define PTR_1 (void *)(size_t)1
+
 char *biosA0n[256] = {
 // 0x00
        "open",         "lseek",        "read",         "write",
@@ -384,9 +386,13 @@ static inline void softCall(u32 pc) {
        ra = 0x80001000;
        psxRegs.CP0.n.SR &= ~0x404; // disable interrupts
 
+       psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, PTR_1);
+
        while (pc0 != 0x80001000 && ++lim < 1000000)
                psxCpu->ExecuteBlock(EXEC_CALLER_HLE);
 
+       psxCpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, PTR_1);
+
        if (lim == 1000000)
                PSXBIOS_LOG("softCall @%x hit lim\n", pc);
        ra = sra;
@@ -403,9 +409,13 @@ static inline void softCallInException(u32 pc) {
                return;
        ra = 0x80001000;
 
+       psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, PTR_1);
+
        while (!returned_from_exception() && pc0 != 0x80001000 && ++lim < 1000000)
                psxCpu->ExecuteBlock(EXEC_CALLER_HLE);
 
+       psxCpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, PTR_1);
+
        if (lim == 1000000)
                PSXBIOS_LOG("softCallInException @%x hit lim\n", pc);
        if (pc0 == 0x80001000)
index 912a41f..fb5e1db 100644 (file)
@@ -45,7 +45,7 @@ enum R3000Aexception {
 enum R3000Anote {
        R3000ACPU_NOTIFY_CACHE_ISOLATED = 0,
        R3000ACPU_NOTIFY_CACHE_UNISOLATED = 1,
-       R3000ACPU_NOTIFY_BEFORE_SAVE,
+       R3000ACPU_NOTIFY_BEFORE_SAVE,  // data arg - hle if non-null
        R3000ACPU_NOTIFY_AFTER_LOAD,
 };