1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

unload modules upon stopping I guess we won't find out what's wrong if we don't let it fail

This commit is contained in:
Peter Tissen 2014-07-12 13:52:37 +02:00
parent 14050c7302
commit f75a3c8f60
2 changed files with 13 additions and 3 deletions

View File

@ -271,7 +271,7 @@ initialized(false)
ModuleManager::~ModuleManager() ModuleManager::~ModuleManager()
{ {
m_mod_init.clear(); UnloadModules();
} }
bool ModuleManager::IsLoadedFunc(u32 id) bool ModuleManager::IsLoadedFunc(u32 id)
@ -332,6 +332,7 @@ u32 ModuleManager::GetFuncNumById(u32 id)
return id; return id;
} }
//to load the default modules after calling this call Init() again
void ModuleManager::UnloadModules() void ModuleManager::UnloadModules()
{ {
for (u32 i = 0; i<3; ++i) for (u32 i = 0; i<3; ++i)
@ -345,6 +346,16 @@ void ModuleManager::UnloadModules()
} }
} }
//reset state of the module manager
//this could be done by calling the destructor and then a placement-new
//to avoid repeating the initial values here but the defaults aren't
//complicated enough to complicate this by using the placement-new
m_mod_init.clear();
m_max_module_id = 0;
m_module_2_count = 0;
initialized = false;
memset(m_modules, 0, 3 * 0xFF * sizeof(Module*));
std::lock_guard<std::mutex> lock(m_funcs_lock); std::lock_guard<std::mutex> lock(m_funcs_lock);
m_modules_funcs_list.clear(); m_modules_funcs_list.clear();
} }

View File

@ -415,8 +415,7 @@ void Emulator::Stop()
GetKeyboardManager().Close(); GetKeyboardManager().Close();
GetMouseManager().Close(); GetMouseManager().Close();
GetCallbackManager().Clear(); GetCallbackManager().Clear();
// TODO: not all modules unload cleanly, so we're not unloading them for now GetModuleManager().UnloadModules();
//GetModuleManager().UnloadModules();
CurGameInfo.Reset(); CurGameInfo.Reset();
Memory.Close(); Memory.Close();