From 512053fa5e06e20ed63e32aa30429a55a02e7d67 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 13 Sep 2009 08:54:46 +0000 Subject: [PATCH] Kill some horribly ugly hackery :( It's just not right to pass entire IniFile objects across DLLs. Only POD (plain-old-data, like int, float, char, char[] etc) are safe to pass across DLL boundaries. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4257 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/Core.cpp | 4 +- Source/Core/Core/Src/CoreParameter.cpp | 2 - Source/Core/Core/Src/CoreParameter.h | 4 +- Source/Core/Core/Src/HW/VideoInterface.cpp | 4 +- Source/Core/Core/Src/HW/VideoInterface.h | 4 +- Source/Core/Core/Src/PluginManager.cpp | 12 +++-- Source/Core/Core/Src/PluginManager.h | 2 +- Source/Core/DolphinWX/Src/BootManager.cpp | 53 ++++++------------- Source/Core/VideoCommon/Src/Config.cpp | 46 +++++----------- Source/Core/VideoCommon/Src/Config.h | 2 +- Source/PluginSpecs/PluginSpecs.h | 11 ++-- Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp | 15 +++--- Source/Plugins/Plugin_DSP_HLE/Src/Config.h | 2 +- .../Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp | 4 -- .../Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp | 39 +++++++------- Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 4 ++ .../Plugin_VideoDX9/Src/TextureCache.cpp | 4 +- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 3 +- .../Plugin_VideoOGL/Src/TextureMngr.cpp | 8 ++- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 13 +---- 20 files changed, 87 insertions(+), 149 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 53a39eac4a..e31661fadc 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -705,7 +705,7 @@ void Callback_VideoCopiedToXFB(bool video_update) double wait_frametime = (1000.0 / targetfps); if (Timer.GetTimeDifference() >= wait_frametime * frames) - no_framelimit=Timer.GetTimeDifference(); + no_framelimit = (u32)Timer.GetTimeDifference(); while (Timer.GetTimeDifference() < wait_frametime * frames) { @@ -756,7 +756,7 @@ void Callback_VideoCopiedToXFB(bool video_update) int TargetVPS = (int)(VideoInterface::TargetRefreshRate + 0.5); - float Speed = ((VPS > 0 ? VPS : VideoInterface::ActualRefreshRate) / TargetVPS) * 100.0f; + float Speed = ((VPS > 0.0f ? VPS : VideoInterface::ActualRefreshRate) / TargetVPS) * 100.0f; // Settings are shown the same for both extended and summary info std::string SSettings = StringFromFormat(" | Core: %s %s", diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index fd4f966e7f..2cbb14d610 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -47,8 +47,6 @@ void SCoreStartupParameter::LoadDefaults() bWii = false; SelectedLanguage = 0; iTLBHack = 0; - delete gameIni; - gameIni = NULL; bJITOff = false; // debugger only settings bJITLoadStoreOff = false; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 02585c1b8a..9a4dd6d21a 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -37,9 +37,6 @@ struct SCoreStartupParameter // Windows/GUI related void* hMainWindow; - // game ini - IniFile *gameIni; - // Settings bool bEnableDebugging; bool bAutomaticStart; bool bBootToPause; bool bUseJIT; @@ -116,6 +113,7 @@ struct SCoreStartupParameter std::string m_strDVDRoot; std::string m_strUniqueID; std::string m_strName; + std::string m_strGameIni; // Constructor just calls LoadDefaults SCoreStartupParameter(); diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index 53334467ad..dde5dbb5a4 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -338,8 +338,8 @@ static u32 s_lineCount = 0; static u32 s_upperFieldBegin = 0; static u32 s_lowerFieldBegin = 0; -double TargetRefreshRate = 0.0; -double ActualRefreshRate = 0.0; +float TargetRefreshRate = 0.0; +float ActualRefreshRate = 0.0; s64 SyncTicksProgress = 0; void DoState(PointerWrap &p) diff --git a/Source/Core/Core/Src/HW/VideoInterface.h b/Source/Core/Core/Src/HW/VideoInterface.h index 4b7a33dad5..61ae81b21e 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.h +++ b/Source/Core/Core/Src/HW/VideoInterface.h @@ -44,8 +44,8 @@ namespace VideoInterface void Update(); // urgh, ugly externs. - extern double ActualRefreshRate; - extern double TargetRefreshRate; + extern float ActualRefreshRate; + extern float TargetRefreshRate; extern s64 SyncTicksProgress; // UpdateInterrupts: check if we have to generate a new VI Interrupt diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 3a606e821c..9f11132db3 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -15,15 +15,11 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ - - // File description /* ------------ - This file controls when plugins are loaded and unloaded from memory. Its functions scan for valid plugins when Dolphin is booted, and open the debugging and config windows. The PluginManager is created once when Dolphin starts and is closed when Dolphin is closed. - */ // Include @@ -58,7 +54,6 @@ CPluginManager::CPluginManager() // Start LogManager m_PluginGlobals->logManager = LogManager::GetInstance(); m_PluginGlobals->eventHandler = EventHandler::GetInstance(); - m_PluginGlobals->config = (void *)&SConfig::GetInstance(); m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter); @@ -104,6 +99,13 @@ CPluginManager::~CPluginManager() // Function: Point the m_pad[] and other variables to a certain plugin bool CPluginManager::InitPlugins() { + // Update pluginglobals. + if (SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.size() == 0) + { + PanicAlert("Bad gameini filename"); + } + strcpy(m_PluginGlobals->game_ini, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); + strcpy(m_PluginGlobals->unique_id, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str()); if (!GetDSP()) { PanicAlert("Can't init DSP Plugin"); return false; diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index 6c676d1619..134c389118 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -71,7 +71,7 @@ private: bool m_Initialized; CPluginInfos m_PluginInfos; - PLUGIN_GLOBALS* m_PluginGlobals; + PLUGIN_GLOBALS *m_PluginGlobals; Common::PluginPAD *m_pad[4]; Common::PluginVideo *m_video; Common::PluginWiimote *m_wiimote[4]; diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 18f49b41db..4d85ae7bc7 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -71,11 +71,7 @@ namespace BootManager extern "C" HINSTANCE wxGetInstance(); #endif - - - // Boot the ISO or file -// ---------------- bool BootCore(const std::string& _rFilename) { SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter; @@ -117,40 +113,28 @@ bool BootCore(const std::string& _rFilename) // ==================================================== // Load game specific settings - // ---------------- - // Released when you LoadDefaults - IniFile *ini = new IniFile(); + IniFile game_ini; std::string unique_id = StartUp.GetUniqueID(); - if (unique_id.size() == 6 && ini->Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str())) + StartUp.m_strGameIni = FULL_GAMECONFIG_DIR + unique_id + ".ini"; + if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str())) { - StartUp.gameIni = ini; - // ------------------------------------------------ // General settings - // ---------------- - ini->Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore); - ini->Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); - ini->Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers); - ini->Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); - ini->Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); - - // ------------------------------------------------ + game_ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore); + game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); + game_ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers); + game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); + game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); // Wii settings - // ---------------- if (StartUp.bWii) { - //bRefreshList = false; - FILE* pStream; // file handle - u16 IPL_PGS = 0x17CC; // progressive scan - u16 IPL_AR = 0x04D9; // widescreen - - ini->Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan); - ini->Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen); - + game_ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan); + game_ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen); // Save the update Wii SYSCONF settings - pStream = NULL; - pStream = fopen(WII_SYSCONF_FILE, "r+b"); - if (pStream != NULL) + FILE* pStream = fopen(WII_SYSCONF_FILE, "r+b"); + if (pStream) { + const int IPL_PGS = 0x17CC; // progressive scan + const int IPL_AR = 0x04D9; // widescreen fseek(pStream, IPL_PGS, 0); fputc(StartUp.bProgressiveScan ? 1 : 0, pStream); fseek(pStream, IPL_AR, 0); @@ -162,15 +146,8 @@ bool BootCore(const std::string& _rFilename) PanicAlert("Could not write to %s", WII_SYSCONF_FILE); } } - // --------------- - } else { - delete ini; - ini = NULL; - } - // ===================== + } - - // ================================================================= // Run the game // -------------- #if defined(HAVE_WX) && HAVE_WX diff --git a/Source/Core/VideoCommon/Src/Config.cpp b/Source/Core/VideoCommon/Src/Config.cpp index 0168715263..331c91aed0 100644 --- a/Source/Core/VideoCommon/Src/Config.cpp +++ b/Source/Core/VideoCommon/Src/Config.cpp @@ -105,40 +105,20 @@ void Config::Load(const char *ini_file) SetEnableAlert(bTmp); } -void Config::GameIniLoad(IniFile *iniFile) +void Config::GameIniLoad(const char *ini_file) { - if (! iniFile) - return; - - if (iniFile->Exists("Video", "ForceFiltering")) - iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0); - - if (iniFile->Exists("Video", "MaxAnisotropy")) - iniFile->Get("Video", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x) - - if (iniFile->Exists("Video", "EFBCopyDisable")) - iniFile->Get("Video", "EFBCopyDisable", &bEFBCopyDisable, 0); - - if (iniFile->Exists("Video", "EFBCopyDisableHotKey")) - iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0); - - if (iniFile->Exists("Video", "EFBToRAMEnable")) - iniFile->Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0); - - if (iniFile->Exists("Video", "SafeTextureCache")) - iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false); - - if (iniFile->Exists("Video", "MSAA")) - iniFile->Get("Video", "MSAA", &iMultisampleMode, 0); - - if (iniFile->Exists("Video", "DstAlphaPass")) - iniFile->Get("Video", "DstAlphaPass", &bDstAlphaPass, false); - - if (iniFile->Exists("Video", "UseXFB")) - iniFile->Get("Video", "UseXFB", &bUseXFB, 0); - - if (iniFile->Exists("Video", "ProjectionHack")) - iniFile->Get("Video", "ProjectionHack", &iPhackvalue, 0); + IniFile iniFile; + iniFile.Load(ini_file); + iniFile.Get("Video", "ForceFiltering", &bForceFiltering, 0); + iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x) + iniFile.Get("Video", "EFBCopyDisable", &bEFBCopyDisable, 0); + iniFile.Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0); + iniFile.Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0); + iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache, false); + iniFile.Get("Video", "MSAA", &iMultisampleMode, 0); + iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass, false); + iniFile.Get("Video", "UseXFB", &bUseXFB, 0); + iniFile.Get("Video", "ProjectionHack", &iPhackvalue, 0); } void Config::Save(const char *ini_file) diff --git a/Source/Core/VideoCommon/Src/Config.h b/Source/Core/VideoCommon/Src/Config.h index 435a94a09b..de4e94d0c5 100644 --- a/Source/Core/VideoCommon/Src/Config.h +++ b/Source/Core/VideoCommon/Src/Config.h @@ -55,7 +55,7 @@ struct Config { Config(); void Load(const char *ini_file); - void GameIniLoad(IniFile *iniFile); + void GameIniLoad(const char *ini_file); void Save(const char *ini_file); void UpdateProjectionHack(); diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index d1538090d7..c6f4af2fcf 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -84,9 +84,6 @@ enum PLUGIN_TYPE { #define STATE_MODE_MEASURE 3 - - - // Export structs // ------------ typedef struct @@ -96,16 +93,16 @@ typedef struct char Name[100]; // Name of the DLL } PLUGIN_INFO; +// TODO: Remove, or at least remove the void pointers and replace with data. +// This design is just wrong and ugly - the plugins shouldn't have this much access. typedef struct { void *eventHandler; - void *config; void *logManager; + char game_ini[MAX_PATH]; + char unique_id[16]; } PLUGIN_GLOBALS; - - - // GLOBAL I N T E R F A C E // ____________________________________________________________________________ // Function: GetDllInfo diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp index da207b679a..0c7bf06e02 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp @@ -49,12 +49,13 @@ void CConfig::Save() file.Save(FULL_CONFIG_DIR "DSP.ini"); } -void CConfig::GameIniLoad() { - IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; - if (! iniFile) - return; - - if (iniFile->Exists("HLEaudio", "UseRE0Fix")) - iniFile->Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, 0); +void CConfig::GameIniLoad(const char *game_ini) +{ + if (game_ini && strlen(game_ini)) + { + IniFile iniFile; + iniFile.Load(game_ini); + iniFile.Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, 0); + } } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h index 7e7f60f66b..ca70665610 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h @@ -28,7 +28,7 @@ struct CConfig CConfig(); void Load(); - void GameIniLoad(); + void GameIniLoad(const char *game_ini); void Save(); }; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index fb521760a7..5932901268 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -31,10 +31,6 @@ END_EVENT_TABLE() DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { - // Load config settings - g_Config.Load(); - g_Config.GameIniLoad(); - // Center window CenterOnParent(); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index edea3fb0be..3139672321 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -78,7 +78,7 @@ void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii) ci << (resizeTo - 1); // write ci cType << type; // write cType - std::string FileName = FULL_MAIL_LOGS_DIR + ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID(); + std::string FileName = FULL_MAIL_LOGS_DIR + std::string(globals->unique_id); FileName += "_sep"; FileName += ci.str(); FileName += "_sep"; FileName += cType.str(); FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log"; @@ -98,25 +98,24 @@ void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap) vsprintf(Msg, _fmt, ap); #if defined(HAVE_WX) && HAVE_WX -if(m_DebuggerFrame->ScanMails) +if (m_DebuggerFrame->ScanMails) { - if(strcmp(Msg, "Begin") == 0) + if (strcmp(Msg, "Begin") == 0) { TmpMailLog = ""; } - else if(strcmp(Msg, "End") == 0) + else if (strcmp(Msg, "End") == 0) { - if(saveNext && saveNext < 100) // limit because saveNext is not initialized + if (saveNext && saveNext < 100) // limit because saveNext is not initialized { - // Save the timestamps and comment - std::ostringstream ci; - ci << (saveNext - 1); + std::ostringstream ci; + ci << (saveNext - 1); TmpMailLog += "\n\n"; TmpMailLog += "-----------------------------------------------------------------------\n"; - TmpMailLog += "Current mail: " + ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID() + " mail " + ci.str() + "\n"; - if(Wii) +// TmpMailLog += "Current mail: " + std::string(globals->unique_id) + " mail " + ci + "\n"; + if (Wii) TmpMailLog += "Current CRC: " + StringFromFormat("0x%08x \n\n", _CRC); for (u32 i = 0; i < sMailTime.size(); i++) @@ -128,7 +127,7 @@ if(m_DebuggerFrame->ScanMails) sMailLog.push_back(TmpMailLog); // Save file to disc - if(m_DebuggerFrame->StoreMails) + if (m_DebuggerFrame->StoreMails) { SaveLogFile(TmpMailLog, saveNext, 1, Wii); } @@ -158,7 +157,7 @@ void CUCode_AX::SaveMail(bool Wii, u32 _uMail) { #if defined(HAVE_WX) && HAVE_WX if (!m_DebuggerFrame) return; -if(m_DebuggerFrame->ScanMails) +if (m_DebuggerFrame->ScanMails) { int i = 0; std::string sTemp; @@ -171,7 +170,7 @@ if(m_DebuggerFrame->ScanMails) { // Make a new row for each AX-Command u16 axcomm = Memory_Read_U16(_uMail + i); - if(axcomm < 15 && axcomm != 0) // we can at most write 8 messages per log + if (axcomm < 15 && axcomm != 0) // we can at most write 8 messages per log { *sAct += "\n"; } @@ -195,7 +194,7 @@ if(m_DebuggerFrame->ScanMails) u32 addnew = 0; for (u32 j = 0; j < m_DebuggerFrame->sMail.size(); j++) { - if(m_DebuggerFrame->sMail.at(j).length() != sTemp.length()) + if (m_DebuggerFrame->sMail.at(j).length() != sTemp.length()) { //wxMessageBox( wxString::Format("%s \n\n%s", m_DebuggerFrame->sMail.at(i).c_str(), // sTemp.c_str()) ); @@ -205,7 +204,7 @@ if(m_DebuggerFrame->ScanMails) // In case the mail didn't match any saved mail, save it - if(addnew == m_DebuggerFrame->sMail.size()) + if (addnew == m_DebuggerFrame->sMail.size()) { //Console::Print("%i | %i\n", addnew, m_DebuggerFrame->sMail.size()); u32 resizeTo = (u32)(m_DebuggerFrame->sMail.size() + 1); @@ -225,7 +224,7 @@ if(m_DebuggerFrame->ScanMails) m_DebuggerFrame->sFullMail.push_back(lMail); // enable the radio button and update view - if(resizeTo <= m_DebuggerFrame->m_RadioBox[3]->GetCount()) + if (resizeTo <= m_DebuggerFrame->m_RadioBox[3]->GetCount()) { m_DebuggerFrame->m_RadioBox[3]->Enable(resizeTo - 1, true); m_DebuggerFrame->m_RadioBox[3]->Select(resizeTo - 1); @@ -236,7 +235,7 @@ if(m_DebuggerFrame->ScanMails) // ------------------------------------ // Save as file - if(m_DebuggerFrame->StoreMails) + if (m_DebuggerFrame->StoreMails) { //Console::Print("m_DebuggerFrame->sMail.size(): %i | resizeTo:%i\n", m_DebuggerFrame->sMail.size(), resizeTo); SaveLogFile(lMail, resizeTo, 0, Wii); @@ -294,7 +293,7 @@ static void ProcessUpdates(AXParamBlock &PB) const u16 updpar = Memory_Read_U16(updaddr + k); const u16 upddata = Memory_Read_U16(updaddr + k + 2); // some safety checks, I hope it's enough - if(updaddr > 0x80000000 && updaddr < 0x817fffff + if (updaddr > 0x80000000 && updaddr < 0x817fffff && updpar < 63 && updpar > 3 && upddata >= 0 // updpar > 3 because we don't want to change // 0-3, those are important //&& (upd0 || upd1 || upd2 || upd3 || upd4) // We should use these in some way to I think @@ -408,7 +407,7 @@ void CUCode_AX::SaveLog(const char* _fmt, ...) { #if defined(HAVE_WX) && HAVE_WX va_list ap; va_start(ap, _fmt); - if(m_DebuggerFrame) SaveLog_(false, _fmt, ap); + if (m_DebuggerFrame) SaveLog_(false, _fmt, ap); va_end(ap); #endif } @@ -443,7 +442,7 @@ bool CUCode_AX::AXTask(u32& _uMail) bool bExecuteList = true; #if defined(HAVE_WX) && HAVE_WX - if(m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging + if (m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging #endif while (bExecuteList) { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index a500296b1c..41d2844518 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -179,6 +179,10 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void DllConfig(HWND _hParent) { #if defined(HAVE_WX) && HAVE_WX + // Load config settings + g_Config.Load(); + g_Config.GameIniLoad(globals->game_ini); + if (!m_ConfigFrame) m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent)); else if (!m_ConfigFrame->GetParent()->IsShown()) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index a855f00094..0b659d8596 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -33,8 +33,6 @@ #include "TextureDecoder.h" #include "TextureCache.h" -#include "../../../Core/Core/Src/ConfigManager.h" // FIXME - u8 *TextureCache::temp = NULL; TextureCache::TexCache TextureCache::textures; @@ -235,7 +233,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, char szTemp[MAX_PATH]; char szDir[MAX_PATH]; - const char* uniqueId = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(); + const char* uniqueId = globals->unique_id; bool bCheckedDumpDir = false; sprintf(szDir,"%s/%s",FULL_DUMP_TEXTURES_DIR,uniqueId); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 39f1d91759..bb1636799d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -177,8 +177,7 @@ void UpdateFPSDisplay(const char *text) bool Init() { g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini"); - IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; - g_Config.GameIniLoad(iniFile); + g_Config.GameIniLoad(globals->game_ini); UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line if (initCount == 0) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index f5674740a5..a8e733d7bb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -52,8 +52,6 @@ #include "FileUtil.h" #include "HiresTextures.h" -#include "../../../Core/Core/Src/ConfigManager.h" // FIXME - u8 *TextureMngr::temp = NULL; TextureMngr::TexCache TextureMngr::textures; @@ -161,7 +159,7 @@ void TextureMngr::Init() { temp = (u8*)AllocateMemoryPages(TEMP_SIZE); TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter); - HiresTextures::Init(((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str()); + HiresTextures::Init(globals->unique_id); } void TextureMngr::Invalidate(bool shutdown) @@ -342,7 +340,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width int oldWidth = width; int oldHeight = height; - sprintf(texPathTemp, "%s_%08x_%i", ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(), texHash, tex_format); + sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, texHash, tex_format); dfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp); if (dfmt != PC_TEX_FMT_NONE) @@ -467,7 +465,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width char szTemp[MAX_PATH]; char szDir[MAX_PATH]; - const char* uniqueId = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(); + const char* uniqueId = globals->unique_id; bool bCheckedDumpDir = false; sprintf(szDir,"%s/%s",FULL_DUMP_TEXTURES_DIR,uniqueId); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 5417eb0278..8f24c5c6b6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -70,11 +70,6 @@ GFXDebuggerOGL *m_DebuggerFrame = NULL; #endif // HAVE_WX #include "Config.h" - -// Having to include this is TERRIBLY ugly. FIXME x100 -#include "Globals.h" -#include "../../../Core/Core/Src/ConfigManager.h" // FIXME - #include "LookUpTables.h" #include "ImageWrite.h" #include "Render.h" @@ -286,9 +281,7 @@ void CocaAddResolutions() { void DllConfig(HWND _hParent) { g_Config.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); - // UGLY - IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; - g_Config.GameIniLoad(iniFile); + g_Config.GameIniLoad(globals->game_ini); g_Config.UpdateProjectionHack(); UpdateActiveConfig(); #if defined(HAVE_WX) && HAVE_WX @@ -326,9 +319,7 @@ void Initialize(void *init) InitXFBConvTables(); g_Config.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); - // UGLY - IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; - g_Config.GameIniLoad(iniFile); + g_Config.GameIniLoad(globals->game_ini); #if defined(HAVE_WX) && HAVE_WX g_Config.UpdateProjectionHack();