[Project64] Make sure variable when no system are static

This commit is contained in:
zilmar 2016-06-16 20:59:13 +10:00
parent acc5c6ed24
commit 6093ed6a41
6 changed files with 27 additions and 12 deletions

View File

@ -111,8 +111,8 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
// parameters here.. just needed to we can config the DLL. // parameters here.. just needed to we can config the DLL.
if (System == NULL) if (System == NULL)
{ {
uint8_t Buffer[100]; static uint8_t Buffer[100];
uint32_t Value = 0; static uint32_t Value = 0;
Info.HEADER = Buffer; Info.HEADER = Buffer;
Info.RDRAM = Buffer; Info.RDRAM = Buffer;

View File

@ -64,7 +64,7 @@ bool CControl_Plugin::LoadFunctions(void)
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window) bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
uint8_t Buffer[100]; static uint8_t Buffer[100];
for (int32_t i = 0; i < 4; i++) for (int32_t i = 0; i < 4; i++)
{ {

View File

@ -189,10 +189,11 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
// We are initializing the plugin before any rom is loaded so we do not have any correct // We are initializing the plugin before any rom is loaded so we do not have any correct
// parameters here.. it's just needed so we can config the DLL. // parameters here.. it's just needed so we can config the DLL.
WriteTrace(TraceGFXPlugin, TraceDebug, "System = %X",System);
if (System == NULL) if (System == NULL)
{ {
uint8_t Buffer[100]; static uint8_t Buffer[100];
uint32_t Value = 0; static uint32_t Value = 0;
Info.HEADER = Buffer; Info.HEADER = Buffer;
Info.RDRAM = Buffer; Info.RDRAM = Buffer;

View File

@ -22,7 +22,8 @@ m_PluginDir(g_Settings->LoadStringVal(PluginDirSetting)),
m_Gfx(NULL), m_Gfx(NULL),
m_Audio(NULL), m_Audio(NULL),
m_RSP(NULL), m_RSP(NULL),
m_Control(NULL) m_Control(NULL),
m_initilized(false)
{ {
CreatePlugins(); CreatePlugins();
g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged); g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
@ -145,10 +146,6 @@ void CPlugins::CreatePlugins(void)
{ {
WriteTrace(TracePlugins, TraceInfo, "Start"); WriteTrace(TracePlugins, TraceInfo, "Start");
#ifdef ANDROID
//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
DestroyGfxPlugin();
#endif
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX"); LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio"); LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP"); LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
@ -256,18 +253,26 @@ void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWi
void CPlugins::RomOpened(void) void CPlugins::RomOpened(void)
{ {
WriteTrace(TracePlugins, TraceDebug, "Start");
m_Gfx->RomOpened(m_MainWindow); m_Gfx->RomOpened(m_MainWindow);
m_RSP->RomOpened(m_MainWindow); m_RSP->RomOpened(m_MainWindow);
m_Audio->RomOpened(m_MainWindow); m_Audio->RomOpened(m_MainWindow);
m_Control->RomOpened(m_MainWindow); m_Control->RomOpened(m_MainWindow);
WriteTrace(TracePlugins, TraceDebug, "Done");
} }
void CPlugins::RomClosed(void) void CPlugins::RomClosed(void)
{ {
WriteTrace(TracePlugins, TraceDebug, "Start");
m_Gfx->RomClose(m_MainWindow); m_Gfx->RomClose(m_MainWindow);
m_RSP->RomClose(m_MainWindow); m_RSP->RomClose(m_MainWindow);
m_Audio->RomClose(m_MainWindow); m_Audio->RomClose(m_MainWindow);
m_Control->RomClose(m_MainWindow); m_Control->RomClose(m_MainWindow);
WriteTrace(TracePlugins, TraceDebug, "Done");
} }
bool CPlugins::Initiate(CN64System * System) bool CPlugins::Initiate(CN64System * System)
@ -292,6 +297,7 @@ bool CPlugins::Initiate(CN64System * System)
if (!m_RSP->Initiate(this, System)) { return false; } if (!m_RSP->Initiate(this, System)) { return false; }
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done"); WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
WriteTrace(TracePlugins, TraceDebug, "Done"); WriteTrace(TracePlugins, TraceDebug, "Done");
m_initilized = true;
return true; return true;
} }
@ -313,6 +319,11 @@ bool CPlugins::Reset(CN64System * System)
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).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; bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
#ifdef ANDROID
//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;
#endif
//if GFX and Audio has changed we also need to force reset of RSP //if GFX and Audio has changed we also need to force reset of RSP
if (bGfxChange || bAudioChange) if (bGfxChange || bAudioChange)
bRspChange = true; bRspChange = true;

View File

@ -133,6 +133,8 @@ public:
inline RenderWindow * MainWindow(void) const { return m_MainWindow; } inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; } inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
inline bool initilized ( void ) const { return m_initilized; }
private: private:
CPlugins(void); // Disable default constructor CPlugins(void); // Disable default constructor
CPlugins(const CPlugins&); // Disable copy constructor CPlugins(const CPlugins&); // Disable copy constructor
@ -161,6 +163,7 @@ private:
stdstr m_AudioFile; stdstr m_AudioFile;
stdstr m_RSPFile; stdstr m_RSPFile;
stdstr m_ControlFile; stdstr m_ControlFile;
bool m_initilized;
}; };
//Dummy Functions //Dummy Functions

View File

@ -135,8 +135,8 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
// parameters here.. just needed to we can config the DLL. // parameters here.. just needed to we can config the DLL.
if (System == NULL) if (System == NULL)
{ {
uint8_t Buffer[100]; static uint8_t Buffer[100];
uint32_t Value = 0; static uint32_t Value = 0;
Info.ProcessDlist = DummyCheckInterrupts; Info.ProcessDlist = DummyCheckInterrupts;
Info.ProcessRdpList = DummyCheckInterrupts; Info.ProcessRdpList = DummyCheckInterrupts;