[Project64] Fix up plugin registering settings with default setting

This commit is contained in:
zilmar 2016-03-22 07:55:44 +11:00
parent bdc109b0b8
commit ec23b07302
2 changed files with 23 additions and 14 deletions

View File

@ -46,7 +46,7 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char *
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
m_KeyName(Name),
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),

View File

@ -524,26 +524,35 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
switch (DataType)
{
case Data_DWORD:
if (DefaultID == Default_None)
{
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId;
_this->m_NextAutoSettingId += 1;
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), (int)Value));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
else
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), DefaultID));
if (DefaultID == Default_None)
{
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), (int)Value));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
else
{
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
}
break;
case Data_String:
if (DefaultID == Default_None)
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), ""));
}
else
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), DefaultID));
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId;
_this->m_NextAutoSettingId += 1;
if (DefaultID == Default_None)
{
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), ""));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
else
{
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), DefaultID));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
}
break;
default: