void CPlugins::Reset ( void ) { bool bGfxChange = _stricmp(m_GfxFile.c_str(),g_Settings->LoadString(Game_Plugin_Gfx).c_str()) != 0; bool bAudioChange = _stricmp(m_AudioFile.c_str(),g_Settings->LoadString(Game_Plugin_Audio).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(),g_Settings->LoadString(Game_Plugin_RSP).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(),g_Settings->LoadString(Game_Plugin_Controller).c_str()) != 0; if (bGfxChange) { DestroyGfxPlugin(); } if (bAudioChange) { DestroyAudioPlugin(); } if (bRspChange) { DestroyRspPlugin(); } if (bContChange) { DestroyControlPlugin(); } CreatePlugins(); }
bool CPlugins::Reset ( CN64System * System ) { WriteTrace(TraceDebug,__FUNCTION__ ": Start"); bool bGfxChange = _stricmp(m_GfxFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0; bool bAudioChange = _stricmp(m_AudioFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; //if GFX and Audio has changed we also need to force reset of RSP if (bGfxChange || bAudioChange) bRspChange = true; if (bGfxChange) { DestroyGfxPlugin(); } if (bAudioChange) { DestroyAudioPlugin(); } if (bRspChange) { DestroyRspPlugin(); } if (bContChange) { DestroyControlPlugin(); } CreatePlugins(); if (m_Gfx && bGfxChange) { WriteTrace(TraceGfxPlugin,__FUNCTION__ ": Gfx Initiate Starting"); if (!m_Gfx->Initiate(System,m_RenderWindow)) { return false; } WriteTrace(TraceGfxPlugin,__FUNCTION__ ": Gfx Initiate Done"); } if (m_Audio && bAudioChange) { WriteTrace(TraceDebug,__FUNCTION__ ": Audio Initiate Starting"); if (!m_Audio->Initiate(System,m_RenderWindow)) { return false; } WriteTrace(TraceDebug,__FUNCTION__ ": Audio Initiate Done"); } if (m_Control && bContChange) { WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Starting"); if (!m_Control->Initiate(System,m_RenderWindow)) { return false; } WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Done"); } if (m_RSP && bRspChange) { WriteTrace(TraceRSP,__FUNCTION__ ": RSP Initiate Starting"); if (!m_RSP->Initiate(this,System)) { return false; } WriteTrace(TraceRSP,__FUNCTION__ ": RSP Initiate Done"); } WriteTrace(TraceDebug,__FUNCTION__ ": Done"); return true; }
CPlugins::~CPlugins (void) { g_Settings->UnregisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged); g_Settings->UnregisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged); DestroyGfxPlugin(); DestroyAudioPlugin(); DestroyRspPlugin(); DestroyControlPlugin(); }
bool CPlugins::Reset(CN64System * System) { WriteTrace(TracePlugins, TraceDebug, "Start"); bool bGfxChange = _stricmp(m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0; bool bAudioChange = _stricmp(m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; if (g_Settings->LoadBool(Plugin_ForceGfxReset)) { //this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround bGfxChange = true; } //if GFX and Audio has changed we also need to force reset of RSP if (bGfxChange || bAudioChange) { bRspChange = true; } if (bGfxChange) { DestroyGfxPlugin(); } if (bAudioChange) { DestroyAudioPlugin(); } if (bRspChange) { DestroyRspPlugin(); } if (bContChange) { DestroyControlPlugin(); } CreatePlugins(); if (m_Gfx && bGfxChange) { WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting"); if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; } WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done"); } if (m_Audio && bAudioChange) { WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting"); if (!m_Audio->Initiate(System, m_MainWindow)) { return false; } WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done"); } if (m_Control && bContChange) { WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting"); if (!m_Control->Initiate(System, m_MainWindow)) { return false; } WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done"); } if (m_RSP && bRspChange) { WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting"); if (!m_RSP->Initiate(this, System)) { return false; } WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done"); } WriteTrace(TracePlugins, TraceDebug, "Done"); return true; }