Merge Icache emulation from PCSX Redux + Senquack changes from PCSX4ALL
[pcsx_rearmed.git] / libpcsxcore / lightrec / plugin.c
index 79bf021..3e68a9c 100644 (file)
@@ -401,11 +401,11 @@ static int lightrec_plugin_init(void)
                        lightrec_map, ARRAY_SIZE(lightrec_map),
                        &lightrec_ops);
 
-       fprintf(stderr, "M=0x%lx, P=0x%lx, R=0x%lx, H=0x%lx\n",
-                       (uintptr_t) psxM,
-                       (uintptr_t) psxP,
-                       (uintptr_t) psxR,
-                       (uintptr_t) psxH);
+       // fprintf(stderr, "M=0x%lx, P=0x%lx, R=0x%lx, H=0x%lx\n",
+       //              (uintptr_t) psxM,
+       //              (uintptr_t) psxP,
+       //              (uintptr_t) psxR,
+       //              (uintptr_t) psxH);
 
 #ifndef _WIN32
        signal(SIGPIPE, exit);
@@ -549,7 +549,7 @@ static void lightrec_plugin_execute_block(void)
        }
 
        if ((psxRegs.cycle & ~0xfffffff) != old_cycle_counter) {
-               printf("RAM usage: Lightrec %u KiB, IR %u KiB, CODE %u KiB, "
+               SysDLog("RAM usage: Lightrec %u KiB, IR %u KiB, CODE %u KiB, "
                       "MIPS %u KiB, TOTAL %u KiB, avg. IPI %f\n",
                       lightrec_get_mem_usage(MEM_FOR_LIGHTREC) / 1024,
                       lightrec_get_mem_usage(MEM_FOR_IR) / 1024,
@@ -578,6 +578,25 @@ static void lightrec_plugin_clear(u32 addr, u32 size)
                lightrec_invalidate(lightrec_state, addr, size * 4);
 }
 
+#ifdef ICACHE_EMULATION
+static void lightrec_plugin_notify(int note, void *data)
+{
+       /*
+       To change once proper icache emulation is emulated
+       switch (note)
+       {
+               case R3000ACPU_NOTIFY_CACHE_UNISOLATED:
+                       lightrec_plugin_clear(0, 0x200000/4);
+                       break;
+               case R3000ACPU_NOTIFY_CACHE_ISOLATED:
+               // Sent from psxDma3().
+               case R3000ACPU_NOTIFY_DMA3_EXE_LOAD:
+               default:
+                       break;
+       }*/
+}
+#endif
+
 static void lightrec_plugin_shutdown(void)
 {
        lightrec_destroy(lightrec_state);
@@ -596,5 +615,8 @@ R3000Acpu psxRec =
        lightrec_plugin_execute,
        lightrec_plugin_execute_block,
        lightrec_plugin_clear,
+#ifdef ICACHE_EMULATION
+       lightrec_plugin_notify,
+#endif
        lightrec_plugin_shutdown,
 };