Split glide settings in to Glide.rdb

This commit is contained in:
zilmar 2015-02-06 12:40:57 +11:00
parent 40efe91224
commit 1711cb1d08
10 changed files with 4179 additions and 1993 deletions

4027
Config/Glide.rdb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ Cheats=..\..\Config\Project64.cht
ExtInfo=..\..\Config\Project64.rdx
Notes=..\..\Config\Project64.rdn
RomDatabase=..\..\Config\Project64.rdb
GlideRDB=..\..\Config\Glide.rdb
RomListCache=..\..\Config\Project64.cache3
ShortCuts=..\..\Config\Project64.sc3

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@ Source: "{#BaseDir}\Config\Blank Project64.rdb"; DestDir: "{app}"; DestName: "Pr
Source: "{#BaseDir}\Config\Project64.cht"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdx"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Glide.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Lang\Brazilian Portuguese.pj.Lang"; DestDir: "{app}\Lang"
Source: "{#BaseDir}\Lang\Bulgarian.pj.Lang"; DestDir: "{app}\Lang"
Source: "{#BaseDir}\Lang\Chinese (Simplified).pj.Lang"; DestDir: "{app}\Lang"

View File

@ -25,6 +25,8 @@ enum SettingID {
SupportFile_SettingsDefault,
SupportFile_RomDatabase,
SupportFile_RomDatabaseDefault,
SupportFile_GlideRDB,
SupportFile_GlideRDBDefault,
SupportFile_Cheats,
SupportFile_CheatsDefault,
SupportFile_Notes,

View File

@ -12,32 +12,36 @@
#include "SettingsType-RomDatabase.h"
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault ) :
m_KeyName(Name),
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault)
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault ) :
m_KeyName(Name),
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault)
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault ) :
m_KeyName(Name),
m_KeyName(StripNameSection(Name)),
m_DefaultStr(DefaultValue),
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault)
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
@ -46,7 +50,8 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultS
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_DeleteOnDefault(DeleteOnDefault)
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
@ -57,6 +62,7 @@ CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
void CSettingTypeRomDatabase::Initilize( void )
{
m_SettingsIniFile = new CIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
m_GlideIniFile = new CIniFile(g_Settings->LoadString(SupportFile_GlideRDB).c_str());
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
@ -71,6 +77,11 @@ void CSettingTypeRomDatabase::CleanUp( void )
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
}
if (m_GlideIniFile)
{
delete m_GlideIniFile;
m_GlideIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
@ -96,7 +107,15 @@ bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const
{
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value,Value);
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
else
{
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
if (!bRes)
{
LoadDefault(Index,Value);
@ -107,7 +126,15 @@ bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
{
stdstr temp_value;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,temp_value);
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
else
{
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
if (bRes)
{
Value = temp_value;
@ -172,7 +199,14 @@ void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
{
Notify().BreakPoint(__FILE__,__LINE__);
}
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Save ( int Index, ULONG Value )
@ -191,7 +225,14 @@ void CSettingTypeRomDatabase::Save ( int Index, ULONG Value )
return;
}
}
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
@ -200,7 +241,14 @@ void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value.c_str());
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
}
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
@ -209,7 +257,14 @@ void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
@ -218,5 +273,30 @@ void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
}
bool CSettingTypeRomDatabase::IsGlideSetting (LPCSTR Name)
{
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return true;
}
return false;
}
LPCSTR CSettingTypeRomDatabase::StripNameSection (LPCSTR Name)
{
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return &Name[8];
}
return Name;
}

View File

@ -13,18 +13,6 @@
class CSettingTypeRomDatabase :
public CSettingType
{
protected:
mutable stdstr m_KeyName;
const LPCSTR m_DefaultStr;
const int m_DefaultValue;
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile;
static void GameChanged ( void * /*Data */ );
public:
CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault = false );
@ -57,5 +45,23 @@ public:
static void Initilize ( void );
static void CleanUp ( void );
protected:
static void GameChanged ( void * /*Data */ );
static bool IsGlideSetting (LPCSTR Name);
static LPCSTR StripNameSection (LPCSTR Name);
virtual LPCSTR Section ( void ) const { return m_SectionIdent->c_str(); }
mutable stdstr m_KeyName;
const LPCSTR m_DefaultStr;
const int m_DefaultValue;
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
bool m_GlideSetting;
static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile;
static CIniFile * m_GlideIniFile;
};

View File

@ -16,6 +16,11 @@ CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIde
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_GlideSetting)
{
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIdent, LPCSTR Name, bool DefaultValue, bool DeleteOnDefault ) :
@ -23,6 +28,11 @@ CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIde
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_GlideSetting)
{
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIdent, LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault ) :
@ -30,6 +40,11 @@ CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIde
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_GlideSetting)
{
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIdent, LPCSTR Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
@ -37,154 +52,13 @@ CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(LPCSTR SectionIde
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_GlideSetting)
{
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
{
}
bool CSettingTypeRomDatabaseSetting::Load ( int /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/* DWORD temp_value = Value;
bool bRes = Load(Index,temp_value);
Value = temp_value != 0;
return bRes;*/
return false;
}
bool CSettingTypeRomDatabaseSetting::Load ( int Index, ULONG & Value ) const
{
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value,Value);
if (!bRes)
{
LoadDefault(Index,Value);
}
return bRes;
}
bool CSettingTypeRomDatabaseSetting::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*stdstr temp_value;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,temp_value);
if (bRes)
{
Value = temp_value;
}
else
{
LoadDefault(Index,Value);
}
return bRes;*/
return false;
}
//return the default values
void CSettingTypeRomDatabaseSetting::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}*/
}
void CSettingTypeRomDatabaseSetting::LoadDefault ( int /*Index*/, ULONG & Value ) const
{
if (m_DefaultSetting == Default_None) { return; }
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
void CSettingTypeRomDatabaseSetting::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultStr;
} else {
g_Settings->LoadString(m_DefaultSetting,Value);
}
}*/
}
//Update the settings
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, bool /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
Notify().BreakPoint(__FILE__,__LINE__);
}
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);
*/
}
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, ULONG /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
ULONG defaultValue = 0;
LoadDefault(Index,defaultValue);
if (defaultValue == Value)
{
Delete(Index);
return;
}
}
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);
*/
}
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value.c_str());
*/
}
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, const char * /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value);*/
}
void CSettingTypeRomDatabaseSetting::Delete ( int /*Index*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);*/
}

View File

@ -23,29 +23,11 @@ public:
virtual ~CSettingTypeRomDatabaseSetting();
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_RdbSetting; }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
private:
virtual LPCSTR Section ( void ) const { return m_SectionIdent.c_str(); }
stdstr m_SectionIdent;
};

View File

@ -83,6 +83,8 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config","Project64.cfg"));
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("","RomDatabase",SupportFile_RomDatabaseDefault));
AddHandler(SupportFile_RomDatabaseDefault, new CSettingTypeRelativePath("Config","Project64.rdb"));
AddHandler(SupportFile_GlideRDB, new CSettingTypeApplicationPath("","GlideRDB",SupportFile_GlideRDBDefault));
AddHandler(SupportFile_GlideRDBDefault, new CSettingTypeRelativePath("Config","Glide.rdb"));
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("","Cheats",SupportFile_CheatsDefault));
AddHandler(SupportFile_CheatsDefault, new CSettingTypeRelativePath("Config","Project64.cht"));
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("","Notes",SupportFile_NotesDefault));