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
This commit is contained in:
hrydgard
2009-09-13 08:54:46 +00:00
parent 700f2ff694
commit 512053fa5e
20 changed files with 87 additions and 149 deletions
+8 -7
View File
@@ -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);
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ struct CConfig
CConfig();
void Load();
void GameIniLoad();
void GameIniLoad(const char *game_ini);
void Save();
};
@@ -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();
@@ -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)
{
@@ -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())
@@ -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);
+1 -2
View File
@@ -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)
@@ -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);
+2 -11
View File
@@ -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();