aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2016-02-28 23:36:59 +0200
committernotaz2016-02-28 23:36:59 +0200
commit5644b26c23a4abd9511c56f39c369a46017585b8 (patch)
treef26f084d2347e81470e7db613bad9edd05e65e37 /libpcsxcore
parent397614d0d77c7b99f6ecc6d938a36d8df66dcb18 (diff)
downloadpcsx_rearmed-5644b26c23a4abd9511c56f39c369a46017585b8.tar.gz
pcsx_rearmed-5644b26c23a4abd9511c56f39c369a46017585b8.tar.bz2
pcsx_rearmed-5644b26c23a4abd9511c56f39c369a46017585b8.zip
psxmem: use rounding that's more likely to work
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/psxmem.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index 6277220..14fd911 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -43,7 +43,7 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag)
{
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
- int tried_to_align = 0;
+ int try_ = 0;
unsigned long mask;
void *req, *ret;
@@ -73,15 +73,15 @@ retry:
return NULL;
}
- if (((addr ^ (long)ret) & 0x00ffffff) && !tried_to_align)
+ if (((addr ^ (unsigned long)ret) & ~0xff000000l) && try_ < 2)
{
psxUnmap(ret, size, tag);
// try to use similarly aligned memory instead
// (recompiler needs this)
- mask = (addr - 1) & ~addr & 0x07ffffff;
- addr = (unsigned long)(ret + mask) & ~mask;
- tried_to_align = 1;
+ mask = try_ ? 0xffff : 0xffffff;
+ addr = ((unsigned long)ret + mask) & ~mask;
+ try_++;
goto retry;
}
}
@@ -137,13 +137,8 @@ int psxMemInit() {
psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
#ifndef RAM_FIXED
-#ifdef __BLACKBERRY_QNX__
if (psxM == NULL)
psxM = psxMap(0x77000000, 0x00210000, 0, MAP_TAG_RAM);
-#else
- if (psxM == NULL)
- psxM = psxMap(0x78000000, 0x00210000, 0, MAP_TAG_RAM);
-#endif
#endif
if (psxM == NULL) {
SysMessage(_("mapping main RAM failed"));