[Project64] Add IsSettingSet for settings type
This commit is contained in:
parent
91e1e22f38
commit
be1f6c9521
|
@ -58,6 +58,11 @@ CSettingTypeApplication::~CSettingTypeApplication()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSettingTypeApplication::IsSettingSet(void) const
|
||||||
|
{
|
||||||
|
return m_SettingsIniFile ? m_SettingsIniFile->EntryExists(SectionName(), m_KeyNameIdex.c_str()) : false;
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Initialize(const char * /*AppName*/)
|
void CSettingTypeApplication::Initialize(const char * /*AppName*/)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
|
|
||||||
virtual bool IndexBasedSetting(void) const { return false; }
|
virtual bool IndexBasedSetting(void) const { return false; }
|
||||||
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
||||||
|
virtual bool IsSettingSet(void) const;
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load(int32_t Index, bool & Value) const;
|
virtual bool Load(int32_t Index, bool & Value) const;
|
||||||
|
|
|
@ -22,6 +22,11 @@ CSettingTypeApplicationPath::~CSettingTypeApplicationPath()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSettingTypeApplicationPath::IsSettingSet(void) const
|
||||||
|
{
|
||||||
|
return CSettingTypeApplication::IsSettingSet();
|
||||||
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplicationPath::Load(int Index, stdstr & Value) const
|
bool CSettingTypeApplicationPath::Load(int Index, stdstr & Value) const
|
||||||
{
|
{
|
||||||
bool bRes = CSettingTypeApplication::Load(Index, Value);
|
bool bRes = CSettingTypeApplication::Load(Index, Value);
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
virtual ~CSettingTypeApplicationPath();
|
virtual ~CSettingTypeApplicationPath();
|
||||||
|
|
||||||
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||||
|
bool IsSettingSet(void) const;
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
|
|
||||||
virtual SettingType GetSettingType(void) const = 0;
|
virtual SettingType GetSettingType(void) const = 0;
|
||||||
virtual bool IndexBasedSetting(void) const = 0;
|
virtual bool IndexBasedSetting(void) const = 0;
|
||||||
|
virtual bool IsSettingSet(void) const = 0;
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load(int32_t Index, bool & Value) const = 0;
|
virtual bool Load(int32_t Index, bool & Value) const = 0;
|
||||||
|
|
|
@ -62,6 +62,11 @@ void CSettingTypeCheats::GameChanged ( void * /*Data */ )
|
||||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSettingTypeCheats::IsSettingSet(void) const
|
||||||
|
{
|
||||||
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
||||||
|
virtual bool IsSettingSet ( void ) const;
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
||||||
|
bool IsSettingSet(void) const { return false; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t /*Index*/, bool & /*Value*/ ) const { return false; };
|
bool Load ( int32_t /*Index*/, bool & /*Value*/ ) const { return false; };
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
||||||
|
virtual bool IsSettingSet(void) const { return false; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
|
|
|
@ -30,6 +30,12 @@ CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
|
||||||
g_Settings->UnregisterChangeCB(m_UseSelected, this, (CSettings::SettingChangedFunc)DirectoryChanged);
|
g_Settings->UnregisterChangeCB(m_UseSelected, this, (CSettings::SettingChangedFunc)DirectoryChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSettingTypeSelectedDirectory::IsSettingSet(void) const
|
||||||
|
{
|
||||||
|
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
||||||
|
return g_Settings->IsSettingSet(DirSettingId);
|
||||||
|
}
|
||||||
|
|
||||||
bool CSettingTypeSelectedDirectory::Load(int /*Index*/, bool & /*Value*/) const
|
bool CSettingTypeSelectedDirectory::Load(int /*Index*/, bool & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -75,9 +81,9 @@ void CSettingTypeSelectedDirectory::Save(int /*Index*/, uint32_t /*Value*/)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Save(int /*Index*/, const stdstr & /*Value*/)
|
void CSettingTypeSelectedDirectory::Save(int Index, const stdstr & Value)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
Save(Index, Value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Save(int /*Index*/, const char * Value)
|
void CSettingTypeSelectedDirectory::Save(int /*Index*/, const char * Value)
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
virtual bool IndexBasedSetting(void) const { return false; }
|
virtual bool IndexBasedSetting(void) const { return false; }
|
||||||
virtual SettingType GetSettingType(void) const { return SettingType_SelectedDirectory; }
|
virtual SettingType GetSettingType(void) const { return SettingType_SelectedDirectory; }
|
||||||
|
virtual bool IsSettingSet(void) const;
|
||||||
|
|
||||||
const char * GetName(void) const { return m_Name.c_str(); }
|
const char * GetName(void) const { return m_Name.c_str(); }
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
||||||
|
bool IsSettingSet(void) const { return false; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
#include "SettingsType-TempNumber.h"
|
#include "SettingsType-TempNumber.h"
|
||||||
|
|
||||||
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
||||||
m_value(initialValue)
|
m_value(initialValue),
|
||||||
|
m_initialValue(initialValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +45,9 @@ void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) con
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
Value = m_initialValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
||||||
|
bool IsSettingSet(void) const { return false; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
|
@ -47,4 +48,5 @@ private:
|
||||||
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
||||||
|
|
||||||
uint32_t m_value;
|
uint32_t m_value;
|
||||||
|
uint32_t m_initialValue;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
||||||
|
bool IsSettingSet(void) const { return false; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
|
|
|
@ -1139,6 +1139,17 @@ void CSettings::SettingTypeChanged(SettingType Type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSettings::IsSettingSet(SettingID Type)
|
||||||
|
{
|
||||||
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
||||||
|
if (FindInfo == m_SettingInfo.end())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return FindInfo->second->IsSettingSet();
|
||||||
|
}
|
||||||
|
|
||||||
void CSettings::UnknownSetting(SettingID /*Type*/)
|
void CSettings::UnknownSetting(SettingID /*Type*/)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
SettingType GetSettingType(SettingID Type);
|
SettingType GetSettingType(SettingID Type);
|
||||||
bool IndexBasedSetting(SettingID Type);
|
bool IndexBasedSetting(SettingID Type);
|
||||||
void SettingTypeChanged(SettingType Type);
|
void SettingTypeChanged(SettingType Type);
|
||||||
|
bool IsSettingSet(SettingID Type);
|
||||||
|
|
||||||
// static functions for plugins
|
// static functions for plugins
|
||||||
static uint32_t GetSetting(CSettings * _this, SettingID Type);
|
static uint32_t GetSetting(CSettings * _this, SettingID Type);
|
||||||
|
|
Loading…
Reference in New Issue