From b0dd2a52b1158b6647fa3f45798582a80d5a0b86 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 25 Sep 2023 22:09:28 -0700 Subject: [PATCH] Core: Stop leaking file loaders. Also fixes remote disc streaming caching getting invalidated constantly. --- Core/System.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Core/System.cpp b/Core/System.cpp index 3158d6a5bafe..0c7bf42fb4c9 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -91,7 +91,7 @@ MetaFileSystem pspFileSystem; ParamSFOData g_paramSFO; static GlobalUIState globalUIState; CoreParameter g_CoreParameter; -static FileLoader *loadedFile; +static FileLoader *g_loadedFile; // For background loading thread. static std::mutex loadingLock; // For loadingReason updates. @@ -324,6 +324,7 @@ bool CPU_Init(std::string *errorString, FileLoader *loadedFile) { // If they shut down early, we'll catch it when load completes. // Note: this may return before init is complete, which is checked if CPU_IsReady(). + g_loadedFile = loadedFile; if (!LoadFile(&loadedFile, &g_CoreParameter.errorString)) { CPU_Shutdown(); g_CoreParameter.fileToStart.clear(); @@ -368,8 +369,8 @@ void CPU_Shutdown() { Memory::Shutdown(); HLEPlugins::Shutdown(); - delete loadedFile; - loadedFile = nullptr; + delete g_loadedFile; + g_loadedFile = nullptr; delete g_CoreParameter.mountIsoLoader; delete g_symbolMap; @@ -380,8 +381,8 @@ void CPU_Shutdown() { // TODO: Maybe loadedFile doesn't even belong here... void UpdateLoadedFile(FileLoader *fileLoader) { - delete loadedFile; - loadedFile = fileLoader; + delete g_loadedFile; + g_loadedFile = fileLoader; } void Core_UpdateState(CoreState newState) {