lightrec: try to clean up intergarion, fix -O0
[pcsx_rearmed.git] / libpcsxcore / lightrec / plugin.c
index fe99e73..b347bb6 100644 (file)
@@ -15,6 +15,9 @@
 
 #include "../frontend/main.h"
 
+#include "mem.h"
+#include "plugin.h"
+
 #if (defined(__arm__) || defined(__aarch64__)) && !defined(ALLOW_LIGHTREC_ON_ARM)
 #error "Lightrec should not be used on ARM (please specify DYNAREC=ari64 to make)"
 #endif
@@ -289,6 +292,9 @@ static struct lightrec_mem_map lightrec_map[] = {
                .length = 0x200000,
                .mirror_of = &lightrec_map[PSX_MAP_KERNEL_USER_RAM],
        },
+       [PSX_MAP_CODE_BUFFER] = {
+               .length = CODE_BUFFER_SIZE,
+       },
 };
 
 static void lightrec_enable_ram(struct lightrec_state *state, bool enable)
@@ -311,6 +317,13 @@ static int lightrec_plugin_init(void)
        lightrec_map[PSX_MAP_SCRATCH_PAD].address = psxH;
        lightrec_map[PSX_MAP_PARALLEL_PORT].address = psxP;
 
+       if (LIGHTREC_CUSTOM_MAP) {
+               lightrec_map[PSX_MAP_MIRROR1].address = psxM + 0x200000;
+               lightrec_map[PSX_MAP_MIRROR2].address = psxM + 0x400000;
+               lightrec_map[PSX_MAP_MIRROR3].address = psxM + 0x600000;
+               lightrec_map[PSX_MAP_CODE_BUFFER].address = code_buffer;
+       }
+
        lightrec_debug = !!getenv("LIGHTREC_DEBUG");
        lightrec_very_debug = !!getenv("LIGHTREC_VERY_DEBUG");
        use_lightrec_interpreter = !!getenv("LIGHTREC_INTERPRETER");