X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fpsxmem.c;h=6277220cded77b27bad2772afb4a457b8912d4f3;hb=ce36c10b348009c13282048540d6d9c553bbcc96;hp=259128d1d61ccdcda9e4b28702819de76500ea4c;hpb=3a92bf0b7a2d929f53ae69cf761721c136f9036d;p=pcsx_rearmed.git diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 259128d1..6277220c 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -29,11 +29,7 @@ #include "psxhw.h" #include "debug.h" -#ifdef __LIBRETRO__ #include "memmap.h" -#else -#include -#endif #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON @@ -53,20 +49,21 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed, retry: if (psxMapHook != NULL) { - ret = psxMapHook(addr, size, is_fixed, tag); - goto out; + ret = psxMapHook(addr, size, 0, tag); + if (ret == NULL) + return NULL; + } + else { + /* avoid MAP_FIXED, it overrides existing mappings.. */ + /* if (is_fixed) + flags |= MAP_FIXED; */ + + req = (void *)addr; + ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0); + if (ret == MAP_FAILED) + return NULL; } - /* avoid MAP_FIXED, it overrides existing mappings.. */ - /* if (is_fixed) - flags |= MAP_FIXED; */ - - req = (void *)addr; - ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0); - if (ret == MAP_FAILED) - return NULL; - -out: if (addr != 0 && ret != (void *)addr) { SysMessage("psxMap: warning: wanted to map @%08x, got %p\n", addr, ret); @@ -76,8 +73,7 @@ out: return NULL; } - if (ret != NULL && ((addr ^ (long)ret) & 0x00ffffff) - && !tried_to_align) + if (((addr ^ (long)ret) & 0x00ffffff) && !tried_to_align) { psxUnmap(ret, size, tag);