From cc67a333c543a9e25ed5438d994e3bdf1032c61e Mon Sep 17 00:00:00 2001 From: Souryo Date: Mon, 20 Jul 2015 23:20:41 -0400 Subject: [PATCH] Fixed SRAM bug when closing emulator (FolderUtilities would get destroyed before Console, which caused a crash while trying to save the .sav file) --- Core/Console.cpp | 5 +++++ Core/Console.h | 1 + InteropDLL/ConsoleWrapper.cpp | 1 + 3 files changed, 7 insertions(+) diff --git a/Core/Console.cpp b/Core/Console.cpp index de8bb6a8..6b55762e 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -25,6 +25,11 @@ shared_ptr Console::GetInstance() return Console::Instance; } +void Console::Release() +{ + Console::Instance.reset(new Console()); +} + void Console::Initialize(string filename) { MessageManager::SendNotification(ConsoleNotificationType::GameStopped); diff --git a/Core/Console.h b/Core/Console.h index 396ae1b1..6672af22 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -61,4 +61,5 @@ class Console static string GetROMPath(); static shared_ptr GetInstance(); + static void Release(); }; diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp index e62c5b31..0200e803 100644 --- a/InteropDLL/ConsoleWrapper.cpp +++ b/InteropDLL/ConsoleWrapper.cpp @@ -122,6 +122,7 @@ namespace InteropEmu { DllExport void __stdcall Release() { + Console::Release(); GameServer::StopServer(); GameClient::Disconnect(); MessageManager::RegisterMessageManager(nullptr);