From: notaz Date: Sat, 2 Sep 2023 19:54:16 +0000 (+0300) Subject: initial hle support for lightrec X-Git-Tag: r24~168 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da9b9ae28406f3bec5b2bd5905783971b991bec;p=pcsx_rearmed.git initial hle support for lightrec --- diff --git a/frontend/libretro.c b/frontend/libretro.c index a115fc67..b1af9f15 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -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; diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index f879ad8c..e21003c0 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -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; } diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index dc726e48..fdac5562 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -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) diff --git a/libpcsxcore/r3000a.h b/libpcsxcore/r3000a.h index 912a41f6..fb5e1db6 100644 --- a/libpcsxcore/r3000a.h +++ b/libpcsxcore/r3000a.h @@ -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, };