[Project64] update Game Settings to use uint32_t index

This commit is contained in:
zilmar 2018-04-23 17:32:49 +10:00
parent 83b280f761
commit 0f41a6459c
4 changed files with 51 additions and 51 deletions

View File

@ -12,8 +12,8 @@
#include "SettingsType-Application.h" #include "SettingsType-Application.h"
#include "SettingsType-GameSetting.h" #include "SettingsType-GameSetting.h"
bool CSettingTypeGame::m_RdbEditor = false; bool CSettingTypeGame::m_RdbEditor = false;
bool CSettingTypeGame::m_EraseDefaults = true; bool CSettingTypeGame::m_EraseDefaults = true;
stdstr * CSettingTypeGame::m_SectionIdent = NULL; stdstr * CSettingTypeGame::m_SectionIdent = NULL;
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue) : CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue) :
@ -76,7 +76,7 @@ void CSettingTypeGame::UpdateSettings(void * /*Data */)
} }
} }
bool CSettingTypeGame::Load(int Index, bool & Value) const bool CSettingTypeGame::Load(uint32_t Index, bool & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -92,7 +92,7 @@ bool CSettingTypeGame::Load(int Index, bool & Value) const
return CSettingTypeApplication::Load(Index, Value); return CSettingTypeApplication::Load(Index, Value);
} }
bool CSettingTypeGame::Load(int Index, uint32_t & Value) const bool CSettingTypeGame::Load(uint32_t Index, uint32_t & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -108,7 +108,7 @@ bool CSettingTypeGame::Load(int Index, uint32_t & Value) const
return CSettingTypeApplication::Load(Index, Value); return CSettingTypeApplication::Load(Index, Value);
} }
bool CSettingTypeGame::Load(int Index, stdstr & Value) const bool CSettingTypeGame::Load(uint32_t Index, std::string & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -125,7 +125,7 @@ bool CSettingTypeGame::Load(int Index, stdstr & Value) const
} }
//return the default values //return the default values
void CSettingTypeGame::LoadDefault(int Index, bool & Value) const void CSettingTypeGame::LoadDefault(uint32_t Index, bool & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -144,7 +144,7 @@ void CSettingTypeGame::LoadDefault(int Index, bool & Value) const
} }
} }
void CSettingTypeGame::LoadDefault(int Index, uint32_t & Value) const void CSettingTypeGame::LoadDefault(uint32_t Index, uint32_t & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -163,7 +163,7 @@ void CSettingTypeGame::LoadDefault(int Index, uint32_t & Value) const
} }
} }
void CSettingTypeGame::LoadDefault(int Index, stdstr & Value) const void CSettingTypeGame::LoadDefault(uint32_t Index, std::string & Value) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
@ -183,7 +183,7 @@ void CSettingTypeGame::LoadDefault(int Index, stdstr & Value) const
} }
//Update the settings //Update the settings
void CSettingTypeGame::Save(int Index, bool Value) void CSettingTypeGame::Save(uint32_t Index, bool Value)
{ {
if (m_EraseDefaults) if (m_EraseDefaults)
{ {
@ -212,7 +212,7 @@ void CSettingTypeGame::Save(int Index, bool Value)
} }
} }
void CSettingTypeGame::Save(int Index, uint32_t Value) void CSettingTypeGame::Save(uint32_t Index, uint32_t Value)
{ {
if (m_EraseDefaults) if (m_EraseDefaults)
{ {
@ -241,12 +241,12 @@ void CSettingTypeGame::Save(int Index, uint32_t Value)
} }
} }
void CSettingTypeGame::Save(int Index, const stdstr & Value) void CSettingTypeGame::Save(uint32_t Index, const std::string & Value)
{ {
Save(Index, Value.c_str()); Save(Index, Value.c_str());
} }
void CSettingTypeGame::Save(int Index, const char * Value) void CSettingTypeGame::Save(uint32_t Index, const char * Value)
{ {
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName) if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
{ {
@ -275,7 +275,7 @@ void CSettingTypeGame::Save(int Index, const char * Value)
} }
} }
void CSettingTypeGame::Delete(int Index) void CSettingTypeGame::Delete(uint32_t Index)
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {

View File

@ -28,30 +28,30 @@ public:
CSettingTypeGame(const char * Name, SettingID DefaultSetting ); CSettingTypeGame(const char * Name, SettingID DefaultSetting );
virtual ~CSettingTypeGame(); virtual ~CSettingTypeGame();
virtual bool IndexBasedSetting ( void ) const { return false; } virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
static void Initialize( void ); static void Initialize( void );
static void CleanUp ( void ); static void CleanUp ( void );
//return the values //return the values
virtual bool Load ( int32_t Index, bool & Value ) const; virtual bool Load (uint32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const; virtual bool Load (uint32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t Index, stdstr & Value ) const; virtual bool Load (uint32_t Index, std::string & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int32_t Index, bool & Value ) const; virtual void LoadDefault (uint32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const; virtual void LoadDefault (uint32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const; virtual void LoadDefault (uint32_t Index, std::string & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int32_t Index, bool Value ); virtual void Save (uint32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value ); virtual void Save (uint32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value ); virtual void Save (uint32_t Index, const std::string & Value );
virtual void Save ( int32_t Index, const char * Value ); virtual void Save (uint32_t Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int32_t Index ); virtual void Delete (uint32_t Index );
private: private:
CSettingTypeGame(void); // Disable default constructor CSettingTypeGame(void); // Disable default constructor

View File

@ -38,66 +38,66 @@ CSettingTypeGameIndex::~CSettingTypeGameIndex()
{ {
} }
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const bool CSettingTypeGameIndex::Load (uint32_t Index, bool & Value ) const
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(Index,Value); return CSettingTypeGame::Load(Index,Value);
} }
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const bool CSettingTypeGameIndex::Load (uint32_t /*Index*/, uint32_t & /*Value*/ ) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return false; return false;
} }
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const bool CSettingTypeGameIndex::Load (uint32_t Index, std::string & Value ) const
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(0,Value); return CSettingTypeGame::Load(0,Value);
} }
//return the default values //return the default values
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const void CSettingTypeGameIndex::LoadDefault (uint32_t Index, bool & Value ) const
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::LoadDefault(0,Value); CSettingTypeGame::LoadDefault(0,Value);
} }
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const void CSettingTypeGameIndex::LoadDefault (uint32_t /*Index*/, uint32_t & /*Value*/ ) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const void CSettingTypeGameIndex::LoadDefault (uint32_t /*Index*/, std::string & /*Value*/ ) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeGameIndex::Save ( int Index, bool Value ) void CSettingTypeGameIndex::Save (uint32_t Index, bool Value )
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(Index,Value); CSettingTypeGame::Save(Index,Value);
} }
void CSettingTypeGameIndex::Save(int Index, uint32_t Value) void CSettingTypeGameIndex::Save(uint32_t Index, uint32_t Value)
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value); CSettingTypeGame::Save(0,Value);
} }
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ ) void CSettingTypeGameIndex::Save (uint32_t /*Index*/, const std::string & /*Value*/ )
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
void CSettingTypeGameIndex::Save ( int Index, const char * Value ) void CSettingTypeGameIndex::Save (uint32_t Index, const char * Value )
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value); CSettingTypeGame::Save(0,Value);
} }
void CSettingTypeGameIndex::Delete ( int Index ) void CSettingTypeGameIndex::Delete (uint32_t Index )
{ {
m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex = stdstr_f("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Delete(0); CSettingTypeGame::Delete(0);

View File

@ -21,27 +21,27 @@ public:
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ); CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
~CSettingTypeGameIndex(); ~CSettingTypeGameIndex();
virtual bool IndexBasedSetting ( void ) const { return true; } virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
//return the values //return the values
virtual bool Load ( int32_t Index, bool & Value ) const; virtual bool Load ( uint32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const; virtual bool Load ( uint32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t Index, stdstr & Value ) const; virtual bool Load ( uint32_t Index, std::string & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int32_t Index, bool & Value ) const; virtual void LoadDefault (uint32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const; virtual void LoadDefault (uint32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const; virtual void LoadDefault (uint32_t Index, std::string & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int32_t Index, bool Value ); virtual void Save (uint32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value ); virtual void Save (uint32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value ); virtual void Save (uint32_t Index, const std::string & Value );
virtual void Save ( int32_t Index, const char * Value ); virtual void Save (uint32_t Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int32_t Index ); virtual void Delete (uint32_t Index );
private: private:
CSettingTypeGameIndex(void); // Disable default constructor CSettingTypeGameIndex(void); // Disable default constructor