aboutsummaryrefslogtreecommitdiff
path: root/frontend/plugin_lib.c
diff options
context:
space:
mode:
authornotaz2012-11-27 17:08:39 +0200
committernotaz2012-11-28 18:49:33 +0200
commit87e5b45fe1aa734289cf57531c89988cfafff524 (patch)
treebf4021d500e21181bc9f7689234df14b7863d3de /frontend/plugin_lib.c
parentf33a0f965a62ca6a8392d16efad00c2bbd878351 (diff)
downloadpcsx_rearmed-87e5b45fe1aa734289cf57531c89988cfafff524.tar.gz
pcsx_rearmed-87e5b45fe1aa734289cf57531c89988cfafff524.tar.bz2
pcsx_rearmed-87e5b45fe1aa734289cf57531c89988cfafff524.zip
clean up mmap hacks
still messy but perhaps beter
Diffstat (limited to 'frontend/plugin_lib.c')
-rw-r--r--frontend/plugin_lib.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index 73ddc82..095d3be 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -30,6 +30,7 @@
#include "pl_gun_ts.h"
#include "../libpcsxcore/new_dynarec/new_dynarec.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
+#include "../libpcsxcore/psxmem_map.h"
#include "../plugins/gpulib/cspace.h"
#include "../plugins/dfinput/externals.h"
@@ -697,15 +698,8 @@ static void pl_get_layer_pos(int *x, int *y, int *w, int *h)
*h = g_layer_h;
}
-static void *pl_mmap(unsigned int size)
-{
- return plat_mmap(0, size, 0, 0);
-}
-
-static void pl_munmap(void *ptr, unsigned int size)
-{
- plat_munmap(ptr, size);
-}
+static void *pl_mmap(unsigned int size);
+static void pl_munmap(void *ptr, unsigned int size);
struct rearmed_cbs pl_rearmed_cbs = {
pl_get_layer_pos,
@@ -773,6 +767,27 @@ void pl_start_watchdog(void)
fprintf(stderr, "could not start watchdog: %d\n", ret);
}
+static void *pl_emu_mmap(unsigned long addr, size_t size, int is_fixed,
+ enum psxMapTag tag)
+{
+ return plat_mmap(addr, size, 0, is_fixed);
+}
+
+static void pl_emu_munmap(void *ptr, size_t size, enum psxMapTag tag)
+{
+ plat_munmap(ptr, size);
+}
+
+static void *pl_mmap(unsigned int size)
+{
+ return psxMapHook(0, size, 0, MAP_TAG_VRAM);
+}
+
+static void pl_munmap(void *ptr, unsigned int size)
+{
+ psxUnmapHook(ptr, size, MAP_TAG_VRAM);
+}
+
void pl_init(void)
{
extern unsigned int hSyncCount; // from psxcounters
@@ -785,4 +800,7 @@ void pl_init(void)
pl_rearmed_cbs.gpu_hcnt = &hSyncCount;
pl_rearmed_cbs.gpu_frame_count = &frame_counter;
+
+ psxMapHook = pl_emu_mmap;
+ psxUnmapHook = pl_emu_munmap;
}