Core: Change Project64.rdb so it use 1's and 0's instead of "Yes" or "No"

This commit is contained in:
zilmar 2023-02-13 21:05:57 +10:30
parent e14e10f4b0
commit 2db5c81af5
7 changed files with 1081 additions and 1085 deletions

File diff suppressed because it is too large Load Diff

View File

@ -134,12 +134,12 @@
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationPath.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-ApplicationPath.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-GameSetting.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-GameSetting.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-GameSettingIndex.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-GameSettingIndex.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDB.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBCpuType.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RDBCpuType.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBOnOff.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RDBOnOff.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBRamSize.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RDBRamSize.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBSaveChip.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RDBSaveChip.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBUser.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RDBUser.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBYesNo.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RelativePath.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RelativePath.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RomDatabase.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RomDatabase.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RomDatabaseIndex.cpp" /> <ClCompile Include="Settings\SettingType\SettingsType-RomDatabaseIndex.cpp" />
@ -265,11 +265,11 @@
<ClInclude Include="Settings\SettingType\SettingsType-Base.h" /> <ClInclude Include="Settings\SettingType\SettingsType-Base.h" />
<ClInclude Include="Settings\SettingType\SettingsType-GameSetting.h" /> <ClInclude Include="Settings\SettingType\SettingsType-GameSetting.h" />
<ClInclude Include="Settings\SettingType\SettingsType-GameSettingIndex.h" /> <ClInclude Include="Settings\SettingType\SettingsType-GameSettingIndex.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDB.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBCpuType.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RDBCpuType.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBOnOff.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RDBOnOff.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBRamSize.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RDBRamSize.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBSaveChip.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RDBSaveChip.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBYesNo.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RelativePath.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RelativePath.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RomDatabase.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RomDatabase.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RomDatabaseIndex.h" /> <ClInclude Include="Settings\SettingType\SettingsType-RomDatabaseIndex.h" />

View File

@ -156,9 +156,6 @@
<ClCompile Include="Settings\SettingType\SettingsType-RDBSaveChip.cpp"> <ClCompile Include="Settings\SettingType\SettingsType-RDBSaveChip.cpp">
<Filter>Source Files\Settings\SettingType</Filter> <Filter>Source Files\Settings\SettingType</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Settings\SettingType\SettingsType-RDBYesNo.cpp">
<Filter>Source Files\Settings\SettingType</Filter>
</ClCompile>
<ClCompile Include="Settings\SettingType\SettingsType-RelativePath.cpp"> <ClCompile Include="Settings\SettingType\SettingsType-RelativePath.cpp">
<Filter>Source Files\Settings\SettingType</Filter> <Filter>Source Files\Settings\SettingType</Filter>
</ClCompile> </ClCompile>
@ -435,6 +432,9 @@
<ClCompile Include="Settings\SettingType\SettingsType-RDBUser.cpp"> <ClCompile Include="Settings\SettingType\SettingsType-RDBUser.cpp">
<Filter>Source Files\Settings\SettingType</Filter> <Filter>Source Files\Settings\SettingType</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Settings\SettingType\SettingsType-RDB.cpp">
<Filter>Source Files\Settings\SettingType</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="stdafx.h"> <ClInclude Include="stdafx.h">
@ -476,9 +476,6 @@
<ClInclude Include="Settings\SettingType\SettingsType-RDBSaveChip.h"> <ClInclude Include="Settings\SettingType\SettingsType-RDBSaveChip.h">
<Filter>Header Files\Settings\SettingType</Filter> <Filter>Header Files\Settings\SettingType</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Settings\SettingType\SettingsType-RDBYesNo.h">
<Filter>Header Files\Settings\SettingType</Filter>
</ClInclude>
<ClInclude Include="Settings\SettingType\SettingsType-RelativePath.h"> <ClInclude Include="Settings\SettingType\SettingsType-RelativePath.h">
<Filter>Header Files\Settings\SettingType</Filter> <Filter>Header Files\Settings\SettingType</Filter>
</ClInclude> </ClInclude>
@ -824,6 +821,9 @@
<ClInclude Include="Settings\SettingType\SettingsType-RDBUser.h"> <ClInclude Include="Settings\SettingType\SettingsType-RDBUser.h">
<Filter>Header Files\Settings\SettingType</Filter> <Filter>Header Files\Settings\SettingType</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Settings\SettingType\SettingsType-RDB.h">
<Filter>Header Files\Settings\SettingType</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Version.h.in"> <None Include="Version.h.in">

View File

@ -9,7 +9,7 @@
#include "Settings/SettingType/SettingsType-RDBOnOff.h" #include "Settings/SettingType/SettingsType-RDBOnOff.h"
#include "Settings/SettingType/SettingsType-RDBRamSize.h" #include "Settings/SettingType/SettingsType-RDBRamSize.h"
#include "Settings/SettingType/SettingsType-RDBSaveChip.h" #include "Settings/SettingType/SettingsType-RDBSaveChip.h"
#include "Settings/SettingType/SettingsType-RDBYesNo.h" #include "Settings/SettingType/SettingsType-RDB.h"
#include "Settings/SettingType/SettingsType-RelativePath.h" #include "Settings/SettingType/SettingsType-RelativePath.h"
#include "Settings/SettingType/SettingsType-RomDatabase.h" #include "Settings/SettingType/SettingsType-RomDatabase.h"
#include "Settings/SettingType/SettingsType-RomDatabaseIndex.h" #include "Settings/SettingType/SettingsType-RomDatabaseIndex.h"
@ -147,13 +147,13 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type", CPU_Recompiler)); AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type", CPU_Recompiler));
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSizeKnown)); AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSizeKnown));
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", Default_CounterFactor)); AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", Default_CounterFactor));
AddHandler(Rdb_DelayDP, new CSettingTypeRDBYesNo("Delay DP", true)); AddHandler(Rdb_DelayDP, new CSettingTypeRDB("Delay DP", true));
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI", false)); AddHandler(Rdb_DelaySi, new CSettingTypeRDB("Delay SI", false));
AddHandler(Rdb_32Bit, new CSettingTypeRDBYesNo("32bit", false)); AddHandler(Rdb_32Bit, new CSettingTypeRDB("32bit", false));
AddHandler(Rdb_FastSP, new CSettingTypeRDBYesNo("Fast SP", true)); AddHandler(Rdb_FastSP, new CSettingTypeRDB("Fast SP", true));
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio", Default_FixedAudio)); AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio", Default_FixedAudio));
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Audio-Sync Audio", Default_SyncViaAudio)); AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Audio-Sync Audio", Default_SyncViaAudio));
AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDBYesNo("Audio Signal", false)); AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDB("Audio Signal", false));
AddHandler(Rdb_TLB_VAddrStart, new CSettingTypeRomDatabase("TLB: Vaddr Start", (uint32_t)0)); AddHandler(Rdb_TLB_VAddrStart, new CSettingTypeRomDatabase("TLB: Vaddr Start", (uint32_t)0));
AddHandler(Rdb_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len", (uint32_t)0)); AddHandler(Rdb_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len", (uint32_t)0));
AddHandler(Rdb_TLB_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start", (uint32_t)0)); AddHandler(Rdb_TLB_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start", (uint32_t)0));
@ -161,7 +161,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio RDB", Plugin_UseHleAudio)); AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio RDB", Plugin_UseHleAudio));
AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0)); AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0));
AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup)); AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup));
AddHandler(Rdb_RegCache, new CSettingTypeRDBYesNo("Reg Cache", true)); AddHandler(Rdb_RegCache, new CSettingTypeRDB("Reg Cache", true));
#ifdef ANDROID #ifdef ANDROID
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", false)); AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", false));
#else #else
@ -175,9 +175,9 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC", true)); AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC", true));
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh", Default_ViRefreshRate)); AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh", Default_ViRefreshRate));
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes", Default_AiCountPerBytes)); AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes", Default_AiCountPerBytes));
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false)); AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDB("AudioResetOnLoad", false));
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false)); AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDB("AllowROMWrites", false));
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false)); AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDB("CRC-Recalc", false));
AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", false)); AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", false));
AddHandler(Rdb_RandomizeSIPIInterrupts, new CSettingTypeRomDatabase("Randomize SI/PI Interrupts", Default_RandomizeSIPIInterrupts)); AddHandler(Rdb_RandomizeSIPIInterrupts, new CSettingTypeRomDatabase("Randomize SI/PI Interrupts", Default_RandomizeSIPIInterrupts));
AddHandler(Rdb_DiskSeekTiming, new CSettingTypeRomDatabase("DiskSeekTiming", Default_DiskSeekTiming)); AddHandler(Rdb_DiskSeekTiming, new CSettingTypeRomDatabase("DiskSeekTiming", Default_DiskSeekTiming));

View File

@ -0,0 +1,112 @@
#include "stdafx.h"
#include "SettingsType-RDB.h"
#include "SettingsType-RomDatabase.h"
CSettingTypeRDB::CSettingTypeRDB(const char * Name, SettingID DefaultSetting) :
CSettingTypeRomDatabase(Name, DefaultSetting)
{
}
CSettingTypeRDB::CSettingTypeRDB(const char * Name, uint32_t DefaultValue) :
CSettingTypeRomDatabase(Name, DefaultValue)
{
}
CSettingTypeRDB::~CSettingTypeRDB()
{
}
bool CSettingTypeRDB::Load(uint32_t Index, bool & Value) const
{
uint32_t dwValue = 0;
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(), m_KeyName.c_str(), Value, dwValue);
if (bRes)
{
Value = dwValue != 0;
}
if (!bRes && m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
}
else
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
return bRes;
}
bool CSettingTypeRDB::Load(uint32_t /*Index*/, uint32_t & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
bool CSettingTypeRDB::Load(uint32_t /*Index*/, std::string & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
// Return the default values
void CSettingTypeRDB::LoadDefault(uint32_t /*Index*/, bool & Value) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
void CSettingTypeRDB::LoadDefault(uint32_t /*Index*/, uint32_t & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDB::LoadDefault(uint32_t /*Index*/, std::string & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
// Update the settings
void CSettingTypeRDB::Save(uint32_t /*Index*/, bool Value)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
}
void CSettingTypeRDB::Save(uint32_t /*Index*/, uint32_t Value)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
}
void CSettingTypeRDB::Save(uint32_t /*Index*/, const std::string & /*Value*/)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDB::Save(uint32_t /*Index*/, const char * /*Value*/)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDB::Delete(uint32_t /*Index*/)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), nullptr);
}

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <Project64-core/Settings/SettingType/SettingsType-RomDatabase.h> #include <Project64-core/Settings/SettingType/SettingsType-RomDatabase.h>
class CSettingTypeRDBYesNo : class CSettingTypeRDB :
public CSettingTypeRomDatabase public CSettingTypeRomDatabase
{ {
public: public:
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting); CSettingTypeRDB(const char * Name, SettingID DefaultSetting);
CSettingTypeRDBYesNo(const char * Name, uint32_t DefaultValue); CSettingTypeRDB(const char * Name, uint32_t DefaultValue);
~CSettingTypeRDBYesNo(); ~CSettingTypeRDB();
//return the values //return the values
virtual bool Load(uint32_t Index, bool & Value) const; virtual bool Load(uint32_t Index, bool & Value) const;
@ -29,7 +29,7 @@ public:
virtual void Delete(uint32_t Index); virtual void Delete(uint32_t Index);
private: private:
CSettingTypeRDBYesNo(void); CSettingTypeRDB(void);
CSettingTypeRDBYesNo(const CSettingTypeRDBYesNo &); CSettingTypeRDB(const CSettingTypeRDB &);
CSettingTypeRDBYesNo & operator=(const CSettingTypeRDBYesNo &); CSettingTypeRDB & operator=(const CSettingTypeRDB &);
}; };

View File

@ -1,116 +0,0 @@
#include "stdafx.h"
#include "SettingsType-RDBYesNo.h"
#include "SettingsType-RomDatabase.h"
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
CSettingTypeRomDatabase(Name, DefaultSetting)
{
}
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, uint32_t DefaultValue) :
CSettingTypeRomDatabase(Name, DefaultValue)
{
}
CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
{
}
bool CSettingTypeRDBYesNo::Load(uint32_t Index, bool & Value) const
{
stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
if (!bRes)
{
LoadDefault(Index, Value);
return false;
}
const char * String = strValue.c_str();
if (_stricmp(String, "Yes") == 0)
{
Value = true;
}
else if (_stricmp(String, "No") == 0)
{
Value = false;
}
else if (_stricmp(String, "Default") == 0)
{
LoadDefault(Index, Value);
return false;
}
else
{
WriteTrace(TraceSettings, TraceError, "Invalid yes/no setting value (Section: %s Key: %s Value: %s)", m_SectionIdent->c_str(), String, m_KeyName.c_str(), strValue.c_str());
LoadDefault(Index, Value);
return false;
}
return true;
}
bool CSettingTypeRDBYesNo::Load(uint32_t /*Index*/, uint32_t & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
bool CSettingTypeRDBYesNo::Load(uint32_t /*Index*/, std::string & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
// Return the default values
void CSettingTypeRDBYesNo::LoadDefault(uint32_t /*Index*/, bool & Value) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
void CSettingTypeRDBYesNo::LoadDefault(uint32_t /*Index*/, uint32_t & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDBYesNo::LoadDefault(uint32_t /*Index*/, std::string & /*Value*/) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
// Update the settings
void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, bool Value)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
}
void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, uint32_t Value)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
}
void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, const std::string & /*Value*/)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, const char * /*Value*/)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeRDBYesNo::Delete(uint32_t /*Index*/)
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), nullptr);
}