From 8b3426a96e24cd6456829166b49e8830c9a4464d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 5 Dec 2020 13:40:44 +1000 Subject: [PATCH] System: Reinitialize code cache on hw settings change/disc swap Basically, anything which could allocate large amounts of memory and potentially overlap with our fastmem area. --- src/core/host_interface.cpp | 3 +++ src/core/system.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index fdcf68423..2afa60129 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -660,6 +660,9 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings) g_settings.display_line_start_offset != old_settings.display_line_start_offset || g_settings.display_line_end_offset != old_settings.display_line_end_offset) { + if (g_settings.IsUsingCodeCache()) + CPU::CodeCache::Reinitialize(); + g_gpu->UpdateSettings(); } diff --git a/src/core/system.cpp b/src/core/system.cpp index f5ea83eeb..ecbf39982 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1609,6 +1609,10 @@ bool InsertMedia(const char* path) UpdateMemoryCards(); } + // reinitialize recompiler, because especially with preloading this might overlap the fastmem area + if (g_settings.IsUsingCodeCache()) + CPU::CodeCache::Reinitialize(); + return true; }