mirror of https://github.com/PCSX2/pcsx2.git
spu2-x: Some changes to how the ini file writing works in Linux. (still buggy)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3072 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
65facf6958
commit
94ae54d6c0
|
@ -19,63 +19,53 @@
|
||||||
#include <wx/fileconf.h>
|
#include <wx/fileconf.h>
|
||||||
|
|
||||||
wxConfigBase *oldConfig;
|
wxConfigBase *oldConfig;
|
||||||
wxString path;
|
wxFileConfig *spuConfig;
|
||||||
|
wxString path(L"~/.pcsx2/inis/spu2-x.ini");
|
||||||
|
bool pathSet = false;
|
||||||
|
|
||||||
wxFileConfig *setIni(const wchar_t* Section)
|
void initIni()
|
||||||
{
|
{
|
||||||
wxConfig *tempConfig;
|
spuConfig = new wxFileConfig(L"", L"", path, L"", wxCONFIG_USE_LOCAL_FILE);
|
||||||
|
|
||||||
oldConfig = wxConfigBase::Get(false);
|
|
||||||
|
|
||||||
tempConfig = new wxFileConfig(L"", L"", path, L"", wxCONFIG_USE_LOCAL_FILE);
|
|
||||||
wxConfigBase::Set(tempConfig);
|
|
||||||
tempConfig->SetPath(L"/");
|
|
||||||
tempConfig->SetPath(Section);
|
|
||||||
return tempConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeIni(wxFileConfig *tempConfig)
|
void setIni(const wchar_t* Section)
|
||||||
{
|
{
|
||||||
tempConfig->Flush();
|
if (spuConfig == NULL) initIni();
|
||||||
|
spuConfig->SetPath(wxsFormat(L"/%s", Section));
|
||||||
if (oldConfig != NULL) wxConfigBase::Set(oldConfig);
|
|
||||||
delete tempConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgSetSettingsDir(const char* dir)
|
void CfgSetSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
path = wxString::FromAscii(dir) + L"spu2-x.ini";
|
FileLog("CfgSetSettingsDir(%s)\n", dir);
|
||||||
|
path = wxString::FromAscii(dir) + L"/spu2-x.ini";
|
||||||
|
pathSet = true;
|
||||||
|
initIni();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgWriteBool(const wchar_t* Section, const wchar_t* Name, bool Value)
|
void CfgWriteBool(const wchar_t* Section, const wchar_t* Name, bool Value)
|
||||||
{
|
{
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
config->Write(Name, Value);
|
spuConfig->Write(Name, Value);
|
||||||
writeIni(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgWriteInt(const wchar_t* Section, const wchar_t* Name, int Value)
|
void CfgWriteInt(const wchar_t* Section, const wchar_t* Name, int Value)
|
||||||
{
|
{
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
config->Write(Name, Value);
|
spuConfig->Write(Name, Value);
|
||||||
writeIni(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wstring& Data)
|
void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wstring& Data)
|
||||||
{
|
{
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
config->Write(Name, Data);
|
spuConfig->Write(Name, Data);
|
||||||
writeIni(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CfgReadBool(const wchar_t *Section,const wchar_t* Name, bool Default)
|
bool CfgReadBool(const wchar_t *Section,const wchar_t* Name, bool Default)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
config->Read(Name, &ret, Default);
|
spuConfig->Read(Name, &ret, Default);
|
||||||
writeIni(config);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -84,25 +74,22 @@ int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
config->Read(Name, &ret, Default);
|
spuConfig->Read(Name, &ret, Default);
|
||||||
writeIni(config);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
|
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
|
||||||
{
|
{
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
wcscpy(Data, config->Read(Name, Default));
|
wcscpy(Data, spuConfig->Read(Name, Default));
|
||||||
writeIni(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, int DataSize, const wchar_t* Default)
|
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, int DataSize, const wchar_t* Default)
|
||||||
{
|
{
|
||||||
wxConfig *config = setIni(Section);
|
setIni(Section);
|
||||||
Data = config->Read(Name, Default);
|
Data = spuConfig->Read(Name, Default);
|
||||||
writeIni(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wstring& Data, int DataSize, const wchar_t* Default)
|
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wstring& Data, int DataSize, const wchar_t* Default)
|
||||||
|
|
|
@ -54,6 +54,14 @@ bool asyncMixingEnabled = false;
|
||||||
|
|
||||||
void ReadSettings()
|
void ReadSettings()
|
||||||
{
|
{
|
||||||
|
// For some reason this can be called before we know what ini file we're writing to.
|
||||||
|
// Lets not try to read it if that happens.
|
||||||
|
if (!pathSet)
|
||||||
|
{
|
||||||
|
FileLog("Read called without the path set.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Interpolation = CfgReadInt( L"MIXING",L"Interpolation", 1 );
|
Interpolation = CfgReadInt( L"MIXING",L"Interpolation", 1 );
|
||||||
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
||||||
ReverbBoost = CfgReadInt( L"MIXING",L"Reverb_Boost", 0 );
|
ReverbBoost = CfgReadInt( L"MIXING",L"Reverb_Boost", 0 );
|
||||||
|
@ -76,12 +84,19 @@ void ReadSettings()
|
||||||
Clampify( SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX );
|
Clampify( SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX );
|
||||||
|
|
||||||
WriteSettings();
|
WriteSettings();
|
||||||
|
spuConfig->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void WriteSettings()
|
void WriteSettings()
|
||||||
{
|
{
|
||||||
|
if (!pathSet)
|
||||||
|
{
|
||||||
|
FileLog("Write called without the path set.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CfgWriteInt(L"MIXING",L"Interpolation",Interpolation);
|
CfgWriteInt(L"MIXING",L"Interpolation",Interpolation);
|
||||||
CfgWriteBool(L"MIXING",L"Disable_Effects",EffectsDisabled);
|
CfgWriteBool(L"MIXING",L"Disable_Effects",EffectsDisabled);
|
||||||
CfgWriteInt(L"MIXING",L"Reverb_Boost",ReverbBoost);
|
CfgWriteInt(L"MIXING",L"Reverb_Boost",ReverbBoost);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <wx/fileconf.h>
|
||||||
|
|
||||||
extern bool DebugEnabled;
|
extern bool DebugEnabled;
|
||||||
|
|
||||||
|
@ -109,5 +110,6 @@ void ReadSettings();
|
||||||
void WriteSettings();
|
void WriteSettings();
|
||||||
void configure();
|
void configure();
|
||||||
void AboutBox();
|
void AboutBox();
|
||||||
|
extern wxFileConfig *spuConfig;
|
||||||
|
extern bool pathSet;
|
||||||
#endif // CONFIG_H_INCLUDED
|
#endif // CONFIG_H_INCLUDED
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<Option compiler="gcc" />
|
<Option compiler="gcc" />
|
||||||
<Compiler>
|
<Compiler>
|
||||||
<Add option="-g" />
|
<Add option="-g" />
|
||||||
|
<Add option="-DPCSX2_DEVBUILD" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Linker>
|
<Linker>
|
||||||
<Add library="../../../../deps/debug/libsoundtouch-dbg.a" />
|
<Add library="../../../../deps/debug/libsoundtouch-dbg.a" />
|
||||||
|
|
Loading…
Reference in New Issue