aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authortwinaphex2015-04-04 19:17:58 +0200
committertwinaphex2015-04-04 19:17:58 +0200
commit998ff8f6009ca7a4d8db9039baf239a1931b5e63 (patch)
treef6f1d15076e8a3f97d066693ed3ed83c6cf43898 /libpcsxcore
parentcb4c1aa6827011c7f564da8adf98fa7be9072b2a (diff)
parent85f2398236b54db46340dad14330102f281ca4f3 (diff)
downloadpcsx_rearmed-998ff8f6009ca7a4d8db9039baf239a1931b5e63.tar.gz
pcsx_rearmed-998ff8f6009ca7a4d8db9039baf239a1931b5e63.tar.bz2
pcsx_rearmed-998ff8f6009ca7a4d8db9039baf239a1931b5e63.zip
Merge https://github.com/notaz/pcsx_rearmed
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/psxmem.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index 86da68c..6277220 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -49,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);
@@ -72,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);