aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTwinaphex2020-02-21 01:10:05 +0100
committerGitHub2020-02-21 01:10:05 +0100
commit04758b20151324552ada2f31460078f5c6eb01e2 (patch)
treef4659f567e8c80973294c165d77a0ab2ad8e5433
parentdfcd7153048c2f6d479dfcd328ee2c0e1e0784ed (diff)
parent7070d5c660963aec56e1d667211b4a09a62d400d (diff)
downloadpcsx_rearmed-04758b20151324552ada2f31460078f5c6eb01e2.tar.gz
pcsx_rearmed-04758b20151324552ada2f31460078f5c6eb01e2.tar.bz2
pcsx_rearmed-04758b20151324552ada2f31460078f5c6eb01e2.zip
Merge pull request #386 from ZachCook/master
Fix second instance runahead
-rw-r--r--libpcsxcore/lightrec/plugin.c6
-rw-r--r--libpcsxcore/psxmem.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/libpcsxcore/lightrec/plugin.c b/libpcsxcore/lightrec/plugin.c
index 64587be..3cd672a 100644
--- a/libpcsxcore/lightrec/plugin.c
+++ b/libpcsxcore/lightrec/plugin.c
@@ -564,8 +564,10 @@ static void lightrec_plugin_shutdown(void)
static void lightrec_plugin_reset(void)
{
- lightrec_plugin_shutdown();
- lightrec_plugin_init();
+// Called in every frame (or every frame where input changes) when using runahead
+// lightrec_plugin_shutdown();
+// lightrec_plugin_init();
+ lightrec_invalidate_all(lightrec_state);
}
R3000Acpu psxRec =
diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c
index cfd880b..11a01ad 100644
--- a/libpcsxcore/psxmem.c
+++ b/libpcsxcore/psxmem.c
@@ -43,7 +43,11 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag)
{
#ifdef LIGHTREC
+#ifdef MAP_FIXED_NOREPLACE
+ int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
+#else
int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED;
+#endif
#else
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
#endif
@@ -142,6 +146,9 @@ int psxMemInit() {
#ifdef LIGHTREC
psxM = psxMap(0x30000000, 0x00210000, 1, MAP_TAG_RAM);
+ if (psxM == NULL)
+ psxM = psxMap(0x70000000, 0x00210000, 1, MAP_TAG_RAM);
+
#else
psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
#endif
@@ -157,7 +164,12 @@ int psxMemInit() {
psxP = &psxM[0x200000];
#ifdef LIGHTREC
psxH = psxMap(0x4f800000, 0x10000, 0, MAP_TAG_OTHER);
+ if (psxH == NULL)
+ psxH = psxMap(0x8f800000, 0x10000, 0, MAP_TAG_OTHER);
+
psxR = psxMap(0x4fc00000, 0x80000, 0, MAP_TAG_OTHER);
+ if (psxR == NULL)
+ psxR = psxMap(0x8fc00000, 0x80000, 0, MAP_TAG_OTHER);
#else
psxH = psxMap(0x1f800000, 0x10000, 0, MAP_TAG_OTHER);
psxR = psxMap(0x1fc00000, 0x80000, 0, MAP_TAG_OTHER);