2016-01-27 09:11:59 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
2018-04-02 18:30:50 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-Application.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-ApplicationIndex.h"
|
2022-09-26 02:31:54 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-ApplicationPath.h"
|
2018-04-02 18:30:50 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-GameSetting.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-GameSettingIndex.h"
|
2023-02-13 21:35:40 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-RDB.h"
|
2018-04-02 18:30:50 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-RDBCpuType.h"
|
2022-09-26 02:31:54 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-RDBOnOff.h"
|
2018-04-02 18:30:50 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-RDBRamSize.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-RDBSaveChip.h"
|
2022-09-26 02:31:54 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-RelativePath.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-RomDatabase.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-RomDatabaseIndex.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-RomDatabaseSetting.h"
|
2018-04-02 18:30:50 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-SelectedDirectory.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-TempBool.h"
|
2022-09-26 02:31:54 +00:00
|
|
|
#include "Settings/SettingType/SettingsType-TempNumber.h"
|
|
|
|
#include "Settings/SettingType/SettingsType-TempString.h"
|
|
|
|
#include <Common/Platform.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
#include <Common/Trace.h>
|
2022-09-26 02:31:54 +00:00
|
|
|
#include <Project64-core/N64System/N64Types.h>
|
|
|
|
#include <Project64-core/Settings.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-12 11:35:39 +00:00
|
|
|
CSettings * g_Settings = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
CSettings::CSettings() :
|
2017-04-29 05:55:30 +00:00
|
|
|
m_NextAutoSettingId(0x200000)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CSettings::~CSettings()
|
|
|
|
{
|
|
|
|
CSettingTypeApplication::CleanUp();
|
|
|
|
CSettingTypeRomDatabase::CleanUp();
|
2023-01-03 02:38:00 +00:00
|
|
|
CSettingTypeRDBUser::CleanUp();
|
2016-01-27 09:11:59 +00:00
|
|
|
CSettingTypeGame::CleanUp();
|
|
|
|
|
|
|
|
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
|
|
|
|
{
|
|
|
|
delete iter->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (SETTING_CALLBACK::iterator cb_iter = m_Callback.begin(); cb_iter != m_Callback.end(); cb_iter++)
|
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * item = cb_iter->second;
|
2021-04-12 11:35:39 +00:00
|
|
|
while (item != nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * current_item = item;
|
|
|
|
item = item->Next;
|
|
|
|
delete current_item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::AddHandler(SettingID TypeID, CSettingType * Handler)
|
|
|
|
{
|
|
|
|
std::pair<SETTING_MAP::iterator, bool> res = m_SettingInfo.insert(SETTING_MAP::value_type(TypeID, Handler));
|
|
|
|
if (!res.second)
|
|
|
|
{
|
|
|
|
delete res.first->second;
|
|
|
|
m_SettingInfo.erase(res.first);
|
|
|
|
res = m_SettingInfo.insert(SETTING_MAP::value_type(TypeID, Handler));
|
|
|
|
if (!res.second)
|
|
|
|
{
|
|
|
|
delete Handler;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-28 09:37:44 +00:00
|
|
|
void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-01-27 09:54:22 +00:00
|
|
|
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Command settings
|
2016-01-28 09:37:44 +00:00
|
|
|
AddHandler(Cmd_BaseDirectory, new CSettingTypeTempString(BaseDirectory));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Cmd_ShowHelp, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(Cmd_RomFile, new CSettingTypeTempString(""));
|
2019-08-22 11:16:58 +00:00
|
|
|
AddHandler(Cmd_ComboDiskFile, new CSettingTypeTempString(""));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Support files
|
2023-01-03 02:38:00 +00:00
|
|
|
AddHandler(SupportFile_SettingsDirectory, new CSettingTypeTempString(""));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("Settings", "ConfigFile", SupportFile_SettingsDefault));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config", "Project64.cfg"));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("Settings", "RomDatabase", SupportFile_RomDatabaseDefault));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(SupportFile_RomDatabaseDefault, new CSettingTypeRelativePath("Config", "Project64.rdb"));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(SupportFile_VideoRDB, new CSettingTypeApplicationPath("Settings", "VideoRDB", SupportFile_VideoRDBDefault));
|
2017-09-26 20:55:53 +00:00
|
|
|
AddHandler(SupportFile_VideoRDBDefault, new CSettingTypeRelativePath("Config", "Video.rdb"));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(SupportFile_AudioRDB, new CSettingTypeApplicationPath("Settings", "AudioRDB", SupportFile_AudioRDBDefault));
|
2017-09-26 20:55:53 +00:00
|
|
|
AddHandler(SupportFile_AudioRDBDefault, new CSettingTypeRelativePath("Config", "Audio.rdb"));
|
2020-11-19 07:16:07 +00:00
|
|
|
AddHandler(SupportFile_CheatDir, new CSettingTypeApplicationPath("Settings", "CheatDir", SupportFile_CheatDirDefault));
|
|
|
|
AddHandler(SupportFile_CheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats", ""));
|
|
|
|
AddHandler(SupportFile_UserCheatDir, new CSettingTypeApplicationPath("Settings", "UserCheatDir", SupportFile_UserCheatDirDefault));
|
|
|
|
AddHandler(SupportFile_UserCheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats-User", ""));
|
2021-01-17 03:17:58 +00:00
|
|
|
AddHandler(SupportFile_EnhancementDir, new CSettingTypeApplicationPath("Settings", "EnhancementDir", SupportFile_EnhancementDirDefault));
|
2021-05-25 04:13:52 +00:00
|
|
|
AddHandler(SupportFile_EnhancementDirDefault, new CSettingTypeRelativePath("Config\\Enhancements", ""));
|
2021-01-17 03:17:58 +00:00
|
|
|
AddHandler(SupportFile_UserEnhancementDir, new CSettingTypeApplicationPath("Settings", "UserEnhancementDir", SupportFile_UserEnhancementDirDefault));
|
2021-05-25 04:13:52 +00:00
|
|
|
AddHandler(SupportFile_UserEnhancementDirDefault, new CSettingTypeRelativePath("Config\\Enhancements-User", ""));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("Settings", "Notes", SupportFile_NotesDefault));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config", "Project64.rdn"));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("Settings", "ExtInfo", SupportFile_ExtInfoDefault));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(SupportFile_ExtInfoDefault, new CSettingTypeRelativePath("Config", "Project64.rdx"));
|
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Settings location
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Setting_ApplicationName, new CSettingTypeTempString(""));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Setting_UseFromRegistry, new CSettingTypeApplication("Settings", "Use Registry", (uint32_t) false));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("Settings", "Rdb Editor", false));
|
|
|
|
AddHandler(Setting_CN64TimeCritical, new CSettingTypeApplication("Settings", "CN64TimeCritical", false));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Setting_AutoStart, new CSettingTypeApplication("Settings", "Auto Start", (uint32_t) true));
|
|
|
|
AddHandler(Setting_AutoZipInstantSave, new CSettingTypeApplication("Settings", "Auto Zip Saves", (uint32_t) true));
|
|
|
|
AddHandler(Setting_EraseGameDefaults, new CSettingTypeApplication("Settings", "Erase on default", (uint32_t) true));
|
|
|
|
AddHandler(Setting_CheckEmuRunning, new CSettingTypeApplication("Settings", "Check Running", (uint32_t) true));
|
2019-01-14 02:36:28 +00:00
|
|
|
#ifndef _M_X64
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", false));
|
2019-01-14 02:36:28 +00:00
|
|
|
#else
|
|
|
|
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", true));
|
|
|
|
#endif
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Setting_Enhancement, new CSettingTypeApplication("Settings", "Enable Enhancement", (uint32_t) true));
|
|
|
|
|
|
|
|
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (bool)false));
|
2020-10-27 06:30:28 +00:00
|
|
|
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("Settings", "Unique Game Dir", true));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("Settings", "Current Language", ""));
|
2016-06-03 20:42:21 +00:00
|
|
|
AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Setting_SyncViaAudioEnabled, new CSettingTypeTempBool(false, "SyncViaAudioEnabled"));
|
2019-08-12 21:07:33 +00:00
|
|
|
AddHandler(Setting_DiskSaveType, new CSettingTypeApplication("Settings", "Disk Save Type", (uint32_t)1));
|
2021-06-15 05:00:38 +00:00
|
|
|
AddHandler(Setting_UpdateControllerOnRefresh, new CSettingTypeTempBool(false));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2023-01-16 10:23:48 +00:00
|
|
|
AddHandler(Default_RDRamSizeUnknown, new CSettingTypeApplication("Defaults", "Unknown RDRAM Size", 0x800000u));
|
|
|
|
AddHandler(Default_RDRamSizeKnown, new CSettingTypeApplication("Defaults", "Known RDRAM Size", 0x400000u));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Default_UseHleGfx, new CSettingTypeApplication("Defaults", "HLE GFX Default", true));
|
|
|
|
AddHandler(Default_ViRefreshRate, new CSettingTypeApplication("Defaults", "ViRefresh", 1500u));
|
|
|
|
AddHandler(Default_AiCountPerBytes, new CSettingTypeApplication("Defaults", "AiCountPerBytes", 0u));
|
|
|
|
AddHandler(Default_CounterFactor, new CSettingTypeApplication("Defaults", "Counter Factor", 2u));
|
|
|
|
AddHandler(Default_SyncViaAudio, new CSettingTypeApplication("Defaults", "Audio-Sync Audio", true));
|
|
|
|
AddHandler(Default_FixedAudio, new CSettingTypeApplication("Defaults", "Fixed Audio", true));
|
|
|
|
AddHandler(Default_RandomizeSIPIInterrupts, new CSettingTypeApplication("Defaults", "Randomize SI/PI Interrupts", true));
|
|
|
|
AddHandler(Default_SMM_Protect_Memory, new CSettingTypeApplication("Defaults", "SMM-Protect", false));
|
2021-01-29 22:37:27 +00:00
|
|
|
AddHandler(Default_DiskSeekTiming, new CSettingTypeApplication("Defaults", "Disk Seek Timing", (uint32_t)DiskSeek_Turbo));
|
2018-11-25 09:44:15 +00:00
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name", Game_GameName));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Rdb_RPCKey, new CSettingTypeRomDatabase("RPC Key", Game_RPCKey));
|
2018-03-28 08:28:02 +00:00
|
|
|
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type", (uint32_t)SaveChip_Auto));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type", CPU_Recompiler));
|
2023-01-16 10:23:48 +00:00
|
|
|
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSizeKnown));
|
2018-11-25 09:44:15 +00:00
|
|
|
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", Default_CounterFactor));
|
2023-02-13 10:35:57 +00:00
|
|
|
AddHandler(Rdb_DelayDP, new CSettingTypeRDB("Delay DP", true));
|
|
|
|
AddHandler(Rdb_DelaySi, new CSettingTypeRDB("Delay SI", false));
|
|
|
|
AddHandler(Rdb_32Bit, new CSettingTypeRDB("32bit", false));
|
|
|
|
AddHandler(Rdb_FastSP, new CSettingTypeRDB("Fast SP", true));
|
2019-01-27 19:14:27 +00:00
|
|
|
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio", Default_FixedAudio));
|
2018-11-25 09:44:15 +00:00
|
|
|
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Audio-Sync Audio", Default_SyncViaAudio));
|
2023-02-13 10:35:57 +00:00
|
|
|
AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDB("Audio Signal", false));
|
2018-03-28 08:28:02 +00:00
|
|
|
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_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start", (uint32_t)0));
|
2019-01-09 06:09:04 +00:00
|
|
|
AddHandler(Rdb_UseHleGfx, new CSettingTypeRomDatabase("HLE GFX RDB", Plugin_UseHleGfx));
|
2019-01-10 08:44:18 +00:00
|
|
|
AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio RDB", Plugin_UseHleAudio));
|
2018-03-28 08:28:02 +00:00
|
|
|
AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0));
|
|
|
|
AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup));
|
2023-02-13 10:35:57 +00:00
|
|
|
AddHandler(Rdb_RegCache, new CSettingTypeRDB("Reg Cache", true));
|
2023-04-17 09:17:33 +00:00
|
|
|
AddHandler(Rdb_FpuRegCache, new CSettingTypeRDB("FPU Reg Cache", false));
|
2019-02-13 04:42:35 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", false));
|
|
|
|
#else
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking", true));
|
2019-02-13 04:42:35 +00:00
|
|
|
#endif
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Rdb_SMM_Cache, new CSettingTypeRomDatabase("SMM-Cache", true));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Rdb_SMM_StoreInstruc, new CSettingTypeRomDatabase("SMM-StoreInstr", false));
|
|
|
|
AddHandler(Rdb_SMM_PIDMA, new CSettingTypeRomDatabase("SMM-PI DMA", true));
|
|
|
|
AddHandler(Rdb_SMM_TLB, new CSettingTypeRomDatabase("SMM-TLB", true));
|
2020-05-05 02:47:34 +00:00
|
|
|
AddHandler(Rdb_SMM_Protect, new CSettingTypeRomDatabase("SMM-Protect", Default_SMM_Protect_Memory));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC", true));
|
2018-11-25 09:44:15 +00:00
|
|
|
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh", Default_ViRefreshRate));
|
|
|
|
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes", Default_AiCountPerBytes));
|
2023-02-13 10:35:57 +00:00
|
|
|
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDB("AudioResetOnLoad", false));
|
|
|
|
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDB("AllowROMWrites", false));
|
|
|
|
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDB("CRC-Recalc", false));
|
2022-12-26 04:45:28 +00:00
|
|
|
AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", false));
|
2019-10-02 22:18:19 +00:00
|
|
|
AddHandler(Rdb_RandomizeSIPIInterrupts, new CSettingTypeRomDatabase("Randomize SI/PI Interrupts", Default_RandomizeSIPIInterrupts));
|
2021-01-29 22:37:27 +00:00
|
|
|
AddHandler(Rdb_DiskSeekTiming, new CSettingTypeRomDatabase("DiskSeekTiming", Default_DiskSeekTiming));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
|
|
|
|
AddHandler(Game_File, new CSettingTypeTempString(""));
|
2016-04-21 20:29:55 +00:00
|
|
|
AddHandler(Game_UniqueSaveDir, new CSettingTypeTempString(""));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_GameName, new CSettingTypeTempString(""));
|
2017-01-31 15:26:16 +00:00
|
|
|
AddHandler(Cfg_GoodName, new CSettingTypeGame("Good Name", ""));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_TempLoaded, new CSettingTypeTempBool(false));
|
2023-01-16 10:23:48 +00:00
|
|
|
AddHandler(Game_Known, new CSettingTypeTempBool(false));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_SystemType, new CSettingTypeTempNumber(SYSTEM_NTSC));
|
|
|
|
AddHandler(Game_EditPlugin_Gfx, new CSettingTypeGame("Plugin-Gfx", Default_None));
|
|
|
|
AddHandler(Game_EditPlugin_Audio, new CSettingTypeGame("Plugin-Audio", Default_None));
|
|
|
|
AddHandler(Game_EditPlugin_Contr, new CSettingTypeGame("Plugin-Controller", Default_None));
|
|
|
|
AddHandler(Game_EditPlugin_RSP, new CSettingTypeGame("Plugin-RSP", Default_None));
|
|
|
|
AddHandler(Game_Plugin_Gfx, new CSettingTypeGame("Plugin-Gfx", Plugin_GFX_Current));
|
|
|
|
AddHandler(Game_Plugin_Audio, new CSettingTypeGame("Plugin-Audio", Plugin_AUDIO_Current));
|
|
|
|
AddHandler(Game_Plugin_Controller, new CSettingTypeGame("Plugin-Controller", Plugin_CONT_Current));
|
|
|
|
AddHandler(Game_Plugin_RSP, new CSettingTypeGame("Plugin-RSP", Plugin_RSP_Current));
|
|
|
|
AddHandler(Game_SaveChip, new CSettingTypeGame("SaveChip", Rdb_SaveChip));
|
|
|
|
AddHandler(Game_CpuType, new CSettingTypeGame("CpuType", Rdb_CpuType));
|
|
|
|
AddHandler(Game_LastSaveSlot, new CSettingTypeGame("Last Used Save Slot", (uint32_t)0));
|
|
|
|
AddHandler(Game_FixedAudio, new CSettingTypeGame("Fixed Audio", Rdb_FixedAudio));
|
|
|
|
AddHandler(Game_RDRamSize, new CSettingTypeGame("RDRamSize", Rdb_RDRamSize));
|
|
|
|
AddHandler(Game_CounterFactor, new CSettingTypeGame("Counter Factor", Rdb_CounterFactor));
|
|
|
|
AddHandler(Game_DelayDP, new CSettingTypeGame("Delay DP", Rdb_DelayDP));
|
|
|
|
AddHandler(Game_DelaySI, new CSettingTypeGame("Delay SI", Rdb_DelaySi));
|
|
|
|
AddHandler(Game_RspAudioSignal, new CSettingTypeGame("Audio Signal", Rdb_RspAudioSignal));
|
|
|
|
AddHandler(Game_32Bit, new CSettingTypeGame("32bit", Rdb_32Bit));
|
|
|
|
AddHandler(Game_FastSP, new CSettingTypeGame("Fast SP", Rdb_FastSP));
|
2016-06-05 00:59:47 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
AddHandler(Game_CurrentSaveState, new CSettingTypeTempNumber(1));
|
|
|
|
#else
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_CurrentSaveState, new CSettingTypeTempNumber(0));
|
2016-06-05 00:59:47 +00:00
|
|
|
#endif
|
|
|
|
AddHandler(Game_LastSaveTime, new CSettingTypeTempNumber(0));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_SyncViaAudio, new CSettingTypeGame("Sync Audio", Rdb_SyncViaAudio));
|
|
|
|
AddHandler(Game_UseHleGfx, new CSettingTypeGame("HLE GFX", Rdb_UseHleGfx));
|
|
|
|
AddHandler(Game_UseHleAudio, new CSettingTypeGame("HLE Audio", Rdb_UseHleAudio));
|
|
|
|
AddHandler(Game_ScreenHertz, new CSettingTypeGame("ScreenHertz", Rdb_ScreenHertz));
|
|
|
|
AddHandler(Game_FuncLookupMode, new CSettingTypeGame("FuncFind", Rdb_FuncLookupMode));
|
|
|
|
AddHandler(Game_RegCache, new CSettingTypeGame("Reg Cache", Rdb_RegCache));
|
2023-04-17 09:17:33 +00:00
|
|
|
AddHandler(Game_FPURegCache, new CSettingTypeGame("FPU Reg Cache", Rdb_FpuRegCache));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking", Rdb_BlockLinking));
|
|
|
|
AddHandler(Game_SMM_StoreInstruc, new CSettingTypeGame("SMM-StoreInst", Rdb_SMM_StoreInstruc));
|
|
|
|
AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM-Cache", Rdb_SMM_Cache));
|
|
|
|
AddHandler(Game_SMM_PIDMA, new CSettingTypeGame("SMM-PI DMA", Rdb_SMM_PIDMA));
|
|
|
|
AddHandler(Game_SMM_TLB, new CSettingTypeGame("SMM-TLB", Rdb_SMM_TLB));
|
|
|
|
AddHandler(Game_SMM_Protect, new CSettingTypeGame("SMM-Protect", Rdb_SMM_Protect));
|
|
|
|
AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC", Rdb_SMM_ValidFunc));
|
|
|
|
AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh", Rdb_ViRefreshRate));
|
|
|
|
AddHandler(Game_AiCountPerBytes, new CSettingTypeGame("AiCountPerBytes", Rdb_AiCountPerBytes));
|
|
|
|
AddHandler(Game_AudioResetOnLoad, new CSettingTypeGame("AudioResetOnLoad", Rdb_AudioResetOnLoad));
|
|
|
|
AddHandler(Game_AllowROMWrites, new CSettingTypeGame("AllowROMWrites", Rdb_AllowROMWrites));
|
|
|
|
AddHandler(Game_CRC_Recalc, new CSettingTypeGame("CRC-Recalc", Rdb_CRC_Recalc));
|
2016-02-01 12:41:46 +00:00
|
|
|
AddHandler(Game_Transferpak_ROM, new CSettingTypeGame("Tpak-ROM-dir", Default_None));
|
|
|
|
AddHandler(Game_Transferpak_Sav, new CSettingTypeGame("Tpak-Sav-dir", Default_None));
|
2017-04-30 09:24:38 +00:00
|
|
|
AddHandler(Game_LoadSaveAtStart, new CSettingTypeTempBool(false));
|
2019-04-20 03:43:30 +00:00
|
|
|
AddHandler(Game_OverClockModifier, new CSettingTypeGame("OverClockModifier", (uint32_t)1));
|
2017-09-28 11:43:58 +00:00
|
|
|
AddHandler(Game_FullSpeed, new CSettingTypeTempBool(true, "Full Speed"));
|
2022-12-26 04:45:28 +00:00
|
|
|
AddHandler(Game_UnalignedDMA, new CSettingTypeGame("Unaligned DMA", Rdb_UnalignedDMA));
|
2019-10-02 22:18:19 +00:00
|
|
|
AddHandler(Game_RandomizeSIPIInterrupts, new CSettingTypeGame("Randomize SI/PI Interrupts", Rdb_RandomizeSIPIInterrupts));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Game_RPCKey, new CSettingTypeTempString(""));
|
2021-01-29 22:37:27 +00:00
|
|
|
AddHandler(Game_DiskSeekTiming, new CSettingTypeGame("DiskSeekTiming", Rdb_DiskSeekTiming));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// User interface
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("Settings", "Display CPU Usage", (uint32_t) false));
|
|
|
|
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("Settings", "Display Frame Rate", (uint32_t) false));
|
2018-12-20 05:38:26 +00:00
|
|
|
AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("Settings", "Frame Rate Display Type", (uint32_t)FR_VIs));
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory("Dir:Plugin", Directory_PluginInitial, Directory_PluginSelected, Directory_PluginUseSelected, Directory_Plugin));
|
2016-04-13 07:34:19 +00:00
|
|
|
#ifndef _M_X64
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_PluginSelected, new CSettingTypeApplicationPath("Plugin Directory", "Directory", Directory_PluginInitial));
|
|
|
|
AddHandler(Directory_PluginUseSelected, new CSettingTypeApplication("Plugin Directory", "Use Selected", false));
|
2016-08-07 07:01:50 +00:00
|
|
|
|
|
|
|
AddHandler(Directory_PluginSyncInitial, new CSettingTypeRelativePath("SyncPlugin", ""));
|
|
|
|
AddHandler(Directory_PluginSyncSelected, new CSettingTypeApplicationPath("Sync Plugin Directory", "Directory", Directory_PluginInitial));
|
|
|
|
AddHandler(Directory_PluginSyncUseSelected, new CSettingTypeApplication("Sync Plugin Directory", "Use Selected", false));
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
#else
|
|
|
|
AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin64", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_PluginSelected, new CSettingTypeApplicationPath("Plugin64 Directory", "Directory", Directory_PluginInitial));
|
|
|
|
AddHandler(Directory_PluginUseSelected, new CSettingTypeApplication("Plugin64 Directory", "Use Selected", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_PluginSync, new CSettingTypeRelativePath("SyncPlugin64", ""));
|
2016-08-07 07:01:50 +00:00
|
|
|
|
|
|
|
AddHandler(Directory_PluginSyncInitial, new CSettingTypeRelativePath("SyncPlugin64", ""));
|
|
|
|
AddHandler(Directory_PluginSyncSelected, new CSettingTypeApplicationPath("Sync Plugin Directory64", "Directory", Directory_PluginInitial));
|
|
|
|
AddHandler(Directory_PluginSyncUseSelected, new CSettingTypeApplication("Sync Plugin Directory64", "Use Selected", false));
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
#endif
|
2016-08-07 07:01:50 +00:00
|
|
|
AddHandler(Directory_PluginSync, new CSettingTypeSelectedDirectory("Dir:SyncPlugin", Directory_PluginSyncInitial, Directory_PluginSyncSelected, Directory_PluginSyncUseSelected, Directory_PluginSync));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_SnapShot, new CSettingTypeSelectedDirectory("Dir:Snapshot", Directory_SnapShotInitial, Directory_SnapShotSelected, Directory_SnapShotUseSelected, Directory_SnapShot));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_SnapShotInitial, new CSettingTypeRelativePath("Screenshots", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_SnapShotSelected, new CSettingTypeApplicationPath("Snap Shot Directory", "Directory", Directory_SnapShotInitial));
|
|
|
|
AddHandler(Directory_SnapShotUseSelected, new CSettingTypeApplication("Snap Shot Directory", "Use Selected", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_NativeSave, new CSettingTypeSelectedDirectory("Dir:NativeSave", Directory_NativeSaveInitial, Directory_NativeSaveSelected, Directory_NativeSaveUseSelected, Directory_NativeSave));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_NativeSaveInitial, new CSettingTypeRelativePath("Save", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_NativeSaveSelected, new CSettingTypeApplicationPath("Native Save Directory", "Directory", Directory_NativeSaveInitial));
|
|
|
|
AddHandler(Directory_NativeSaveUseSelected, new CSettingTypeApplication("Native Save Directory", "Use Selected", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_InstantSave, new CSettingTypeSelectedDirectory("Dir:InstantSave", Directory_InstantSaveInitial, Directory_InstantSaveSelected, Directory_InstantSaveUseSelected, Directory_InstantSave));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_InstantSaveInitial, new CSettingTypeRelativePath("Save", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_InstantSaveSelected, new CSettingTypeApplicationPath("Instant Save Directory", "Directory", Directory_InstantSaveInitial));
|
|
|
|
AddHandler(Directory_InstantSaveUseSelected, new CSettingTypeApplication("Instant Save Directory", "Use Selected", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_Texture, new CSettingTypeSelectedDirectory("Dir:Texture", Directory_TextureInitial, Directory_TextureSelected, Directory_TextureUseSelected, Directory_Texture));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Directory_TextureInitial, new CSettingTypeRelativePath("Textures", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_TextureSelected, new CSettingTypeApplicationPath("Texture Directory", "Directory", Directory_InstantSaveInitial));
|
|
|
|
AddHandler(Directory_TextureUseSelected, new CSettingTypeApplication("Texture Directory", "Use Selected", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-01 06:30:22 +00:00
|
|
|
AddHandler(Directory_Log, new CSettingTypeSelectedDirectory("Dir:Log", Directory_LogInitial, Directory_LogSelected, Directory_LogUseSelected, Directory_Log));
|
|
|
|
AddHandler(Directory_LogInitial, new CSettingTypeRelativePath("Logs", ""));
|
2016-06-05 01:04:10 +00:00
|
|
|
AddHandler(Directory_LogSelected, new CSettingTypeApplicationPath("Log Directory", "Directory", Directory_InstantSaveInitial));
|
|
|
|
AddHandler(Directory_LogUseSelected, new CSettingTypeApplication("Log Directory", "Use Selected", false));
|
2016-02-01 06:30:22 +00:00
|
|
|
|
2016-04-13 07:34:19 +00:00
|
|
|
AddHandler(RomList_RomListCacheDefault, new CSettingTypeRelativePath("Config", "Project64.cache3"));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(RomList_RomListCache, new CSettingTypeApplicationPath("Settings", "RomListCache", RomList_RomListCacheDefault));
|
2016-04-13 07:34:19 +00:00
|
|
|
AddHandler(RomList_GameDir, new CSettingTypeSelectedDirectory("Dir:Game", RomList_GameDirInitial, RomList_GameDirSelected, RomList_GameDirUseSelected, RomList_GameDir));
|
|
|
|
AddHandler(RomList_GameDirInitial, new CSettingTypeRelativePath("Game Directory", ""));
|
|
|
|
AddHandler(RomList_GameDirSelected, new CSettingTypeApplication("Game Directory", "Directory", RomList_GameDirInitial));
|
|
|
|
AddHandler(RomList_GameDirUseSelected, new CSettingTypeApplication("Game Directory", "Use Selected", false));
|
|
|
|
AddHandler(RomList_GameDirRecursive, new CSettingTypeApplication("Game Directory", "Recursive", false));
|
2018-12-28 11:47:09 +00:00
|
|
|
AddHandler(RomList_ShowFileExtensions, new CSettingTypeApplication("Game Directory", "File Extensions", false));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(RomList_7zipCache, new CSettingTypeApplicationPath("Settings", "7zipCache", RomList_7zipCacheDefault));
|
2016-04-13 07:34:19 +00:00
|
|
|
AddHandler(RomList_7zipCacheDefault, new CSettingTypeRelativePath("Config", "Project64.zcache"));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(GameRunning_CPU_Running, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false));
|
2018-04-14 19:31:19 +00:00
|
|
|
AddHandler(GameRunning_CPU_PausedType, new CSettingTypeTempNumber(PauseType_None));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString(""));
|
2017-09-28 19:32:43 +00:00
|
|
|
AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true, "Limit FPS"));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60));
|
|
|
|
AddHandler(GameRunning_InReset, new CSettingTypeTempBool(false));
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("Settings", "Basic Mode", (uint32_t) true));
|
2018-11-26 00:56:08 +00:00
|
|
|
AddHandler(File_DiskIPLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL ROM Path", Default_None));
|
2019-08-12 11:39:56 +00:00
|
|
|
AddHandler(File_DiskIPLUSAPath, new CSettingTypeApplicationPath("Settings", "Disk IPL USA ROM Path", Default_None));
|
|
|
|
AddHandler(File_DiskIPLTOOLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL TOOL ROM Path", Default_None));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger", "Debugger", false));
|
2022-08-01 01:29:16 +00:00
|
|
|
AddHandler(Debugger_EndOnPermLoop, new CSettingTypeApplication("Debugger", "End On Perm Loop", false));
|
2023-08-31 00:38:49 +00:00
|
|
|
AddHandler(Debugger_FpuExceptionInRecompiler, new CSettingTypeApplication("Debugger", "Fpu Exception In Recompiler", false));
|
2022-08-01 00:30:07 +00:00
|
|
|
AddHandler(Debugger_BreakOnUnhandledMemory, new CSettingTypeApplication("Debugger", "Break On Unhandled Memory", false));
|
2022-08-01 01:08:12 +00:00
|
|
|
AddHandler(Debugger_BreakOnAddressError, new CSettingTypeApplication("Debugger", "Break On Address Error", false));
|
2022-08-01 02:13:17 +00:00
|
|
|
AddHandler(Debugger_StepOnBreakOpCode, new CSettingTypeApplication("Debugger", "Step On Break OpCode", false));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Debugger_ShowPifErrors, new CSettingTypeApplication("Debugger", "Show Pif Errors", false));
|
|
|
|
AddHandler(Debugger_DisableGameFixes, new CSettingTypeApplication("Debugger", "Disable Game Fixes", false));
|
|
|
|
AddHandler(Debugger_ShowDListAListCount, new CSettingTypeApplication("Debugger", "Show Dlist Alist Count", false));
|
|
|
|
AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger", "Show Recompiler Memory size", false));
|
2016-10-02 21:46:05 +00:00
|
|
|
AddHandler(Debugger_RecordExecutionTimes, new CSettingTypeApplication("Debugger", "Record Execution Times", false));
|
2021-09-03 05:11:04 +00:00
|
|
|
AddHandler(Debugger_SilentBreak, new CSettingTypeTempBool(false));
|
2018-01-15 21:14:15 +00:00
|
|
|
AddHandler(Debugger_SteppingOps, new CSettingTypeTempBool(false));
|
2018-01-17 11:36:28 +00:00
|
|
|
AddHandler(Debugger_SkipOp, new CSettingTypeTempBool(false));
|
2017-12-12 10:15:34 +00:00
|
|
|
AddHandler(Debugger_HaveExecutionBP, new CSettingTypeTempBool(false));
|
2018-02-01 17:28:08 +00:00
|
|
|
AddHandler(Debugger_WriteBPExists, new CSettingTypeTempBool(false));
|
2018-02-05 06:43:46 +00:00
|
|
|
AddHandler(Debugger_ReadBPExists, new CSettingTypeTempBool(false));
|
2018-01-16 21:26:54 +00:00
|
|
|
AddHandler(Debugger_WaitingForStep, new CSettingTypeTempBool(false));
|
2019-01-14 09:18:43 +00:00
|
|
|
AddHandler(Debugger_CPULoggingEnabled, new CSettingTypeApplication("Debugger", "Enable CPU Logging", false));
|
|
|
|
AddHandler(Debugger_CPULogBufferSize, new CSettingTypeApplication("Debugger", "CPU Log Buffer Size", (uint32_t)1024));
|
2019-01-17 09:34:24 +00:00
|
|
|
AddHandler(Debugger_ExceptionBreakpoints, new CSettingTypeApplication("Debugger", "Exception Breakpoints", (uint32_t)0));
|
2019-08-20 22:20:49 +00:00
|
|
|
AddHandler(Debugger_FpExceptionBreakpoints, new CSettingTypeApplication("Debugger", "FP Exception Breakpoints", (uint32_t)0));
|
|
|
|
AddHandler(Debugger_IntrBreakpoints, new CSettingTypeApplication("Debugger", "Interrupt Breakpoints", (uint32_t)0));
|
|
|
|
AddHandler(Debugger_RcpIntrBreakpoints, new CSettingTypeApplication("Debugger", "RCP Interrupt Breakpoints", (uint32_t)0));
|
2016-06-04 09:07:20 +00:00
|
|
|
AddHandler(Debugger_DebugLanguage, new CSettingTypeApplication("Debugger", "Debug Language", false));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging", "Log Auto Flush", (uint32_t) false));
|
2016-12-12 19:11:47 +00:00
|
|
|
AddHandler(Debugger_RecordRecompilerAsm, new CSettingTypeApplication("Debugger", "Record Recompiler Asm", false));
|
2021-09-03 05:11:04 +00:00
|
|
|
AddHandler(Debugger_AutorunScripts, new CSettingTypeApplication("Debugger", "Autorun Scripts", ""));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Logging
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Debugger_TraceMD5, new CSettingTypeApplication("Logging", "MD5", (uint32_t)g_ModuleLogLevel[TraceMD5]));
|
2016-04-17 19:34:47 +00:00
|
|
|
AddHandler(Debugger_TraceThread, new CSettingTypeApplication("Logging", "Thread", (uint32_t)g_ModuleLogLevel[TraceThread]));
|
|
|
|
AddHandler(Debugger_TracePath, new CSettingTypeApplication("Logging", "Path", (uint32_t)g_ModuleLogLevel[TracePath]));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Debugger_TraceSettings, new CSettingTypeApplication("Logging", "Settings", (uint32_t)g_ModuleLogLevel[TraceSettings]));
|
|
|
|
AddHandler(Debugger_TraceUnknown, new CSettingTypeApplication("Logging", "Unknown", (uint32_t)g_ModuleLogLevel[TraceUnknown]));
|
|
|
|
AddHandler(Debugger_TraceAppInit, new CSettingTypeApplication("Logging", "App Init", (uint32_t)g_ModuleLogLevel[TraceAppInit]));
|
|
|
|
AddHandler(Debugger_TraceAppCleanup, new CSettingTypeApplication("Logging", "App Cleanup", (uint32_t)g_ModuleLogLevel[TraceAppCleanup]));
|
|
|
|
AddHandler(Debugger_TraceN64System, new CSettingTypeApplication("Logging", "N64 System", (uint32_t)g_ModuleLogLevel[TraceN64System]));
|
|
|
|
AddHandler(Debugger_TracePlugins, new CSettingTypeApplication("Logging", "Plugins", (uint32_t)g_ModuleLogLevel[TracePlugins]));
|
2022-06-27 10:02:38 +00:00
|
|
|
AddHandler(Debugger_TraceVideoPlugin, new CSettingTypeApplication("Logging", "GFX Plugin", (uint32_t)g_ModuleLogLevel[TraceVideoPlugin]));
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Debugger_TraceAudioPlugin, new CSettingTypeApplication("Logging", "Audio Plugin", (uint32_t)g_ModuleLogLevel[TraceAudioPlugin]));
|
|
|
|
AddHandler(Debugger_TraceControllerPlugin, new CSettingTypeApplication("Logging", "Controller Plugin", (uint32_t)g_ModuleLogLevel[TraceControllerPlugin]));
|
|
|
|
AddHandler(Debugger_TraceRSPPlugin, new CSettingTypeApplication("Logging", "RSP Plugin", (uint32_t)g_ModuleLogLevel[TraceRSPPlugin]));
|
|
|
|
AddHandler(Debugger_TraceRSP, new CSettingTypeApplication("Logging", "RSP", (uint32_t)g_ModuleLogLevel[TraceRSP]));
|
|
|
|
AddHandler(Debugger_TraceAudio, new CSettingTypeApplication("Logging", "Audio", (uint32_t)g_ModuleLogLevel[TraceAudio]));
|
|
|
|
AddHandler(Debugger_TraceRegisterCache, new CSettingTypeApplication("Logging", "Register Cache", (uint32_t)g_ModuleLogLevel[TraceRegisterCache]));
|
|
|
|
AddHandler(Debugger_TraceRecompiler, new CSettingTypeApplication("Logging", "Recompiler", (uint32_t)g_ModuleLogLevel[TraceRecompiler]));
|
|
|
|
AddHandler(Debugger_TraceTLB, new CSettingTypeApplication("Logging", "TLB", (uint32_t)g_ModuleLogLevel[TraceTLB]));
|
|
|
|
AddHandler(Debugger_TraceProtectedMEM, new CSettingTypeApplication("Logging", "Protected MEM", (uint32_t)g_ModuleLogLevel[TraceProtectedMem]));
|
|
|
|
AddHandler(Debugger_TraceUserInterface, new CSettingTypeApplication("Logging", "User Interface", (uint32_t)g_ModuleLogLevel[TraceUserInterface]));
|
2016-06-04 08:33:48 +00:00
|
|
|
AddHandler(Debugger_TraceRomList, new CSettingTypeApplication("Logging", "Rom List", (uint32_t)g_ModuleLogLevel[TraceRomList]));
|
|
|
|
AddHandler(Debugger_TraceExceptionHandler, new CSettingTypeApplication("Logging", "Exception Handler", (uint32_t)g_ModuleLogLevel[TraceExceptionHandler]));
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Plugin
|
2016-06-05 01:06:03 +00:00
|
|
|
#ifdef _WIN32
|
2017-09-27 22:14:53 +00:00
|
|
|
#ifdef _DEBUG
|
2023-06-01 07:41:26 +00:00
|
|
|
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "RSP\\Project64-RSP_d.dll"));
|
2021-03-02 22:08:41 +00:00
|
|
|
AddHandler(Plugin_GFX_Default, new CSettingTypeApplication("Plugin", "Graphics Dll Default", "GFX\\Project64-Video_d.dll"));
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", Plugin_GFX_Default));
|
|
|
|
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio_d.dll"));
|
2020-08-03 12:28:13 +00:00
|
|
|
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "Input\\Project64-Input_d.dll"));
|
2017-09-27 22:14:53 +00:00
|
|
|
#else
|
2023-06-01 07:41:26 +00:00
|
|
|
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "RSP\\Project64-RSP.dll"));
|
2021-03-01 09:38:29 +00:00
|
|
|
AddHandler(Plugin_GFX_Default, new CSettingTypeApplication("Plugin", "Graphics Dll Default", "GFX\\Project64-Video.dll"));
|
|
|
|
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", Plugin_GFX_Default));
|
|
|
|
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio.dll"));
|
2020-08-03 12:28:13 +00:00
|
|
|
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "Input\\Project64-Input.dll"));
|
2017-09-27 22:14:53 +00:00
|
|
|
#endif
|
2016-06-05 01:06:03 +00:00
|
|
|
#else
|
|
|
|
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "libProject64-rsp-hle.so"));
|
2022-07-18 12:56:29 +00:00
|
|
|
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "libProject64-video.so"));
|
2016-06-05 01:06:03 +00:00
|
|
|
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "libProject64-audio-android.so"));
|
|
|
|
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "libProject64-input-android.so"));
|
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Plugin_RSP_CurVer, new CSettingTypeApplication("Plugin", "RSP Dll Ver", ""));
|
|
|
|
AddHandler(Plugin_GFX_CurVer, new CSettingTypeApplication("Plugin", "Graphics Dll Ver", ""));
|
|
|
|
AddHandler(Plugin_AUDIO_CurVer, new CSettingTypeApplication("Plugin", "Audio Dll Ver", ""));
|
|
|
|
AddHandler(Plugin_CONT_CurVer, new CSettingTypeApplication("Plugin", "Controller Dll Ver", ""));
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX Plugin", Default_UseHleGfx));
|
2019-01-10 08:44:18 +00:00
|
|
|
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio Plugin", false));
|
2016-08-07 07:12:16 +00:00
|
|
|
AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true));
|
2017-04-26 08:13:55 +00:00
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Logging
|
2016-01-27 09:11:59 +00:00
|
|
|
AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false));
|
|
|
|
AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false));
|
|
|
|
AddHandler(Logging_LogSPRegisters, new CSettingTypeApplication("Logging", "Log SP Registers", false));
|
|
|
|
AddHandler(Logging_LogDPCRegisters, new CSettingTypeApplication("Logging", "Log DPC Registers", false));
|
|
|
|
AddHandler(Logging_LogDPSRegisters, new CSettingTypeApplication("Logging", "Log DPS Registers", false));
|
|
|
|
AddHandler(Logging_LogMIPSInterface, new CSettingTypeApplication("Logging", "Log MIPS Interface", false));
|
|
|
|
AddHandler(Logging_LogVideoInterface, new CSettingTypeApplication("Logging", "Log Video Interface", false));
|
|
|
|
AddHandler(Logging_LogAudioInterface, new CSettingTypeApplication("Logging", "Log Audio Interface", false));
|
|
|
|
AddHandler(Logging_LogPerInterface, new CSettingTypeApplication("Logging", "Log Per Interface", false));
|
|
|
|
AddHandler(Logging_LogRDRAMInterface, new CSettingTypeApplication("Logging", "Log RDRAM Interface", false));
|
|
|
|
AddHandler(Logging_LogSerialInterface, new CSettingTypeApplication("Logging", "Log Serial Interface", false));
|
|
|
|
AddHandler(Logging_LogPRDMAOperations, new CSettingTypeApplication("Logging", "Log PR DMA Operations", false));
|
|
|
|
AddHandler(Logging_LogPRDirectMemLoads, new CSettingTypeApplication("Logging", "Log PR Direct Mem Loads", false));
|
|
|
|
AddHandler(Logging_LogPRDMAMemLoads, new CSettingTypeApplication("Logging", "Log PR DMA Mem Loads", false));
|
|
|
|
AddHandler(Logging_LogPRDirectMemStores, new CSettingTypeApplication("Logging", "Log PR Direct Mem Stores", false));
|
|
|
|
AddHandler(Logging_LogPRDMAMemStores, new CSettingTypeApplication("Logging", "Log PRDMA Mem Stores", false));
|
|
|
|
AddHandler(Logging_LogControllerPak, new CSettingTypeApplication("Logging", "Log Controller Pak", false));
|
|
|
|
AddHandler(Logging_LogCP0changes, new CSettingTypeApplication("Logging", "Log CP0 changes", false));
|
|
|
|
AddHandler(Logging_LogCP0reads, new CSettingTypeApplication("Logging", "Log CP0 reads", false));
|
|
|
|
AddHandler(Logging_LogTLB, new CSettingTypeApplication("Logging", "Log TLB", false));
|
|
|
|
AddHandler(Logging_LogExceptions, new CSettingTypeApplication("Logging", "Log Exceptions", false));
|
|
|
|
AddHandler(Logging_NoInterrupts, new CSettingTypeApplication("Logging", "No Interrupts", false));
|
|
|
|
AddHandler(Logging_LogCache, new CSettingTypeApplication("Logging", "Log Cache", false));
|
|
|
|
AddHandler(Logging_LogRomHeader, new CSettingTypeApplication("Logging", "Generate Log Files", false));
|
|
|
|
AddHandler(Logging_LogUnknown, new CSettingTypeApplication("Logging", "Log Rom Header", false));
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t CSettings::FindSetting(CSettings * _this, const char * Name)
|
|
|
|
{
|
2022-09-26 02:31:54 +00:00
|
|
|
uint32_t setting_id = 0;
|
2016-01-27 09:11:59 +00:00
|
|
|
for (SETTING_MAP::iterator iter = _this->m_SettingInfo.begin(); iter != _this->m_SettingInfo.end(); iter++)
|
|
|
|
{
|
|
|
|
CSettingType * Setting = iter->second;
|
|
|
|
if (Setting->GetSettingType() == SettingType_GameSetting)
|
|
|
|
{
|
|
|
|
CSettingTypeGame * GameSetting = (CSettingTypeGame *)Setting;
|
|
|
|
if (_stricmp(GameSetting->GetKeyName(), Name) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2022-09-26 02:31:54 +00:00
|
|
|
if (setting_id != 0)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
setting_id = iter->first;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2017-09-28 11:43:58 +00:00
|
|
|
else if (Setting->GetSettingType() == SettingType_CfgFile)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
CSettingTypeApplication * CfgSetting = (CSettingTypeApplication *)Setting;
|
|
|
|
if (_stricmp(CfgSetting->GetKeyName(), Name) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2022-09-26 02:31:54 +00:00
|
|
|
if (setting_id != 0)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
setting_id = iter->first;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2017-09-28 11:43:58 +00:00
|
|
|
else if (Setting->GetSettingType() == SettingType_SelectedDirectory)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
CSettingTypeSelectedDirectory * SelectedDirectory = (CSettingTypeSelectedDirectory *)Setting;
|
|
|
|
if (_stricmp(SelectedDirectory->GetName(), Name) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2022-09-26 02:31:54 +00:00
|
|
|
if (setting_id != 0)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
setting_id = iter->first;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2017-09-28 11:43:58 +00:00
|
|
|
else if (Setting->GetSettingType() == SettingType_BoolVariable)
|
|
|
|
{
|
|
|
|
CSettingTypeTempBool * BoolSetting = (CSettingTypeTempBool *)Setting;
|
|
|
|
if (_stricmp(BoolSetting->GetName(), Name) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2022-09-26 02:31:54 +00:00
|
|
|
if (setting_id != 0)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
setting_id = iter->first;
|
2017-09-28 11:43:58 +00:00
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2019-01-10 08:44:18 +00:00
|
|
|
return setting_id;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::FlushSettings(CSettings * /*_this*/)
|
|
|
|
{
|
|
|
|
CSettingTypeApplication::Flush();
|
|
|
|
}
|
|
|
|
|
2016-08-07 08:27:14 +00:00
|
|
|
void CSettings::sRegisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func)
|
|
|
|
{
|
|
|
|
_this->RegisterChangeCB(Type, Data, Func);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::sUnregisterChangeCB(CSettings * _this, SettingID Type, void * Data, SettingChangedFunc Func)
|
|
|
|
{
|
|
|
|
_this->UnregisterChangeCB(Type, Data, Func);
|
|
|
|
}
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
uint32_t CSettings::GetSetting(CSettings * _this, SettingID Type)
|
|
|
|
{
|
|
|
|
return _this->LoadDword(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
const char * CSettings::GetSettingSz(CSettings * _this, SettingID Type, char * Buffer, uint32_t BufferSize)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
if (Buffer && BufferSize > 0)
|
|
|
|
{
|
|
|
|
Buffer[0] = 0;
|
|
|
|
_this->LoadStringVal(Type, Buffer, BufferSize);
|
|
|
|
}
|
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SetSetting(CSettings * _this, SettingID ID, uint32_t Value)
|
|
|
|
{
|
|
|
|
_this->SaveDword(ID, Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SetSettingSz(CSettings * _this, SettingID ID, const char * Value)
|
|
|
|
{
|
|
|
|
_this->SaveString(ID, Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
|
2022-09-26 02:31:54 +00:00
|
|
|
SettingType Type, const char * Category, const char * DefaultStr,
|
|
|
|
uint32_t Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-08-07 08:27:14 +00:00
|
|
|
SettingID RdbSetting;
|
|
|
|
stdstr Name;
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
switch (Type)
|
|
|
|
{
|
|
|
|
case SettingType_ConstValue:
|
|
|
|
if (DataType != Data_DWORD)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_this->AddHandler(ID, new CSettingTypeTempNumber(Value));
|
|
|
|
break;
|
|
|
|
case SettingType_ConstString:
|
|
|
|
if (DataType != Data_String)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_this->AddHandler(ID, new CSettingTypeTempString(DefaultStr));
|
|
|
|
break;
|
|
|
|
case SettingType_CfgFile:
|
|
|
|
case SettingType_Registry:
|
|
|
|
switch (DataType)
|
|
|
|
{
|
|
|
|
case Data_DWORD:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, Value));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, ""));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SettingType_GameSetting:
|
2016-08-07 08:27:14 +00:00
|
|
|
Name.Format("%s-%s", Category, DefaultStr);
|
2016-01-27 09:11:59 +00:00
|
|
|
switch (DataType)
|
|
|
|
{
|
|
|
|
case Data_DWORD:
|
2016-08-07 08:27:14 +00:00
|
|
|
RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
|
|
|
_this->m_NextAutoSettingId += 1;
|
|
|
|
if (DefaultID == Default_None)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2018-03-28 08:28:02 +00:00
|
|
|
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), Value));
|
2016-08-07 08:27:14 +00:00
|
|
|
_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));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
2016-08-07 08:27:14 +00:00
|
|
|
RdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
|
|
|
_this->m_NextAutoSettingId += 1;
|
|
|
|
if (DefaultID == Default_None)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-08-07 08:27:14 +00:00
|
|
|
_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));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
2016-08-07 08:27:14 +00:00
|
|
|
break;
|
2016-01-27 09:11:59 +00:00
|
|
|
case SettingType_RomDatabase:
|
|
|
|
switch (DataType)
|
|
|
|
{
|
|
|
|
case Data_DWORD:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
2018-03-28 08:28:02 +00:00
|
|
|
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, Value, true));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, (SettingID)Value, true));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, "", true));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, DefaultID, true));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SettingType_RdbSetting:
|
|
|
|
switch (DataType)
|
|
|
|
{
|
|
|
|
case Data_DWORD:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
2018-03-28 08:28:02 +00:00
|
|
|
_this->AddHandler(ID, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, Value, true));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-27 20:34:02 +00:00
|
|
|
SettingID AutoRdbSetting = (SettingID)_this->m_NextAutoSettingId;
|
2016-01-27 09:11:59 +00:00
|
|
|
_this->m_NextAutoSettingId += 1;
|
2016-11-27 20:34:02 +00:00
|
|
|
_this->AddHandler(AutoRdbSetting, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, DefaultID, true));
|
|
|
|
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, AutoRdbSetting));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-28 09:37:44 +00:00
|
|
|
bool CSettings::Initialize(const char * BaseDirectory, const char * AppName)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-01-27 09:54:22 +00:00
|
|
|
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
2016-01-28 09:37:44 +00:00
|
|
|
AddHowToHandleSetting(BaseDirectory);
|
2018-12-02 04:31:54 +00:00
|
|
|
CSettingTypeApplication::Initialize();
|
2016-01-27 09:11:59 +00:00
|
|
|
CSettingTypeRomDatabase::Initialize();
|
2023-01-03 02:38:00 +00:00
|
|
|
CSettingTypeRDBUser::Initialize();
|
2016-01-27 09:11:59 +00:00
|
|
|
CSettingTypeGame::Initialize();
|
|
|
|
|
|
|
|
g_Settings->SaveString(Setting_ApplicationName, AppName);
|
2016-01-27 09:54:22 +00:00
|
|
|
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
2016-01-27 09:11:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBool(SettingID Type)
|
|
|
|
{
|
|
|
|
bool Value = false;
|
|
|
|
LoadBool(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBool(SettingID Type, bool & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(0, Value);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadBoolIndex(SettingID Type, uint32_t index)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
bool Value = false;
|
|
|
|
LoadBoolIndex(Type, index, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadBoolIndex(SettingID Type, uint32_t index, bool & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(index, Value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t CSettings::LoadDword(SettingID Type)
|
|
|
|
{
|
|
|
|
uint32_t Value = 0;
|
|
|
|
LoadDword(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadDword(SettingID Type, uint32_t & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(0, Value);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
uint32_t CSettings::LoadDwordIndex(SettingID Type, uint32_t index)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
uint32_t Value;
|
|
|
|
LoadDwordIndex(Type, index, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadDwordIndex(SettingID Type, uint32_t index, uint32_t & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(index, Value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string CSettings::LoadStringVal(SettingID Type)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string Value;
|
2016-01-27 09:11:59 +00:00
|
|
|
LoadStringVal(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadStringVal(SettingID Type, std::string & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(0, Value);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadStringVal(SettingID Type, char * Buffer, uint32_t BufferSize)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
bool bRes = false;
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stdstr Value;
|
|
|
|
bRes = FindInfo->second->Load(0, Value);
|
2022-08-01 03:45:52 +00:00
|
|
|
uint32_t len = BufferSize;
|
2016-01-27 09:11:59 +00:00
|
|
|
if ((Value.length() + 1) < (size_t)len)
|
|
|
|
{
|
2022-08-01 03:45:52 +00:00
|
|
|
len = (uint32_t)(Value.length() + 1);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
strncpy(Buffer, Value.c_str(), len);
|
|
|
|
}
|
|
|
|
return bRes;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string CSettings::LoadStringIndex(SettingID Type, uint32_t index)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string Value;
|
2016-01-27 09:11:59 +00:00
|
|
|
LoadStringIndex(Type, index, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadStringIndex(SettingID Type, uint32_t index, std::string & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
return FindInfo->second->Load(index, Value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadStringIndex(SettingID /*Type*/, uint32_t /*index*/, char * /*Buffer*/, uint32_t /*BufferSize*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Load the default value for the setting
|
2016-01-27 09:11:59 +00:00
|
|
|
bool CSettings::LoadDefaultBool(SettingID Type)
|
|
|
|
{
|
|
|
|
bool Value = false;
|
|
|
|
LoadDefaultBool(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::LoadDefaultBool(SettingID Type, bool & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->LoadDefault(0, Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
bool CSettings::LoadDefaultBoolIndex(SettingID /*Type*/, uint32_t /*index*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultBoolIndex(SettingID /*Type*/, uint32_t /*index*/, bool & /*Value*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
2022-09-26 02:31:54 +00:00
|
|
|
uint32_t CSettings::LoadDefaultDword(SettingID Type)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
uint32_t Value = 0;
|
|
|
|
LoadDefaultDword(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::LoadDefaultDword(SettingID Type, uint32_t & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->LoadDefault(0, Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
uint32_t CSettings::LoadDefaultDwordIndex(SettingID /*Type*/, uint32_t /*index*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultDwordIndex(SettingID /*Type*/, uint32_t /*index*/, uint32_t & /*Value*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string CSettings::LoadDefaultString(SettingID Type)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
stdstr Value;
|
|
|
|
LoadDefaultString(Type, Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultString(SettingID Type, std::string & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->LoadDefault(0, Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultString(SettingID /*Type*/, char * /*Buffer*/, uint32_t /*BufferSize*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
std::string CSettings::LoadDefaultStringIndex(SettingID /*Type*/, uint32_t /*index*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultStringIndex(SettingID /*Type*/, uint32_t /*index*/, std::string & /*Value*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::LoadDefaultStringIndex(SettingID /*Type*/, uint32_t /*index*/, char * /*Buffer*/, uint32_t /*BufferSize*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveBool(SettingID Type, bool Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(0, Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::SaveBoolIndex(SettingID Type, uint32_t index, bool Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index, Value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveDword(SettingID Type, uint32_t Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(0, Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::SaveDwordIndex(SettingID Type, uint32_t index, uint32_t Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index, Value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::SaveString(SettingID Type, const std::string & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(0, Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveString(SettingID Type, const char * Buffer)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
else if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(0, Buffer);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::SaveStringIndex(SettingID Type, uint32_t index, const char * Buffer)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index, Buffer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::SaveStringIndex(SettingID Type, uint32_t index, const std::string & Value)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SaveStringIndex(Type, index, Value.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::DeleteSetting(SettingID Type)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FindInfo->second->Delete(0);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2018-03-28 08:28:02 +00:00
|
|
|
void CSettings::DeleteSettingIndex(SettingID Type, uint32_t index)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
2021-04-02 07:34:50 +00:00
|
|
|
// If not found do nothing
|
2016-01-27 09:11:59 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Delete(index);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingType CSettings::GetSettingType(SettingID Type)
|
|
|
|
{
|
|
|
|
if (Type == Default_None || Type == Default_Constant)
|
|
|
|
{
|
|
|
|
return SettingType_Unknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
return SettingType_Unknown;
|
|
|
|
}
|
|
|
|
return FindInfo->second->GetSettingType();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::IndexBasedSetting(SettingID Type)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return FindInfo->second->IndexBasedSetting();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SettingTypeChanged(SettingType Type)
|
|
|
|
{
|
|
|
|
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
|
|
|
|
{
|
|
|
|
if (iter->second->GetSettingType() == Type)
|
|
|
|
{
|
|
|
|
NotifyCallBacks(iter->first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-06-04 09:03:47 +00:00
|
|
|
|
|
|
|
bool CSettings::IsSettingSet(SettingID Type)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return FindInfo->second->IsSettingSet();
|
|
|
|
}
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
void CSettings::UnknownSetting(SettingID /*Type*/)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::NotifyCallBacks(SettingID Type)
|
|
|
|
{
|
|
|
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
|
|
|
if (Callback == m_Callback.end())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-12 11:35:39 +00:00
|
|
|
for (SETTING_CHANGED_CB * item = Callback->second; item != nullptr; item = item->Next)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
item->Func(item->Data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::RegisterChangeCB(SettingID Type, void * Data, SettingChangedFunc Func)
|
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * new_item = new SETTING_CHANGED_CB;
|
|
|
|
new_item->Data = Data;
|
|
|
|
new_item->Func = Func;
|
2021-04-12 11:35:39 +00:00
|
|
|
new_item->Next = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
|
|
|
if (Callback != m_Callback.end())
|
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * item = Callback->second;
|
|
|
|
while (item->Next)
|
|
|
|
{
|
|
|
|
item = item->Next;
|
|
|
|
}
|
|
|
|
item->Next = new_item;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Callback.insert(SETTING_CALLBACK::value_type(Type, new_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFunc Func)
|
|
|
|
{
|
|
|
|
bool bRemoved = false;
|
|
|
|
|
2021-04-02 07:34:50 +00:00
|
|
|
// Find out the information for handling the setting type from the list
|
2016-01-27 09:11:59 +00:00
|
|
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
|
|
|
if (Callback != m_Callback.end())
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
SETTING_CHANGED_CB * PrevItem = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
SETTING_CHANGED_CB * item = Callback->second;
|
|
|
|
|
|
|
|
while (item)
|
|
|
|
{
|
|
|
|
if (Callback->first == Type && item->Data == Data && item->Func == Func)
|
|
|
|
{
|
|
|
|
bRemoved = true;
|
2021-04-12 11:35:39 +00:00
|
|
|
if (PrevItem == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
if (item->Next)
|
|
|
|
{
|
2016-11-27 20:34:02 +00:00
|
|
|
SettingID CallbackType = Callback->first;
|
2016-01-27 09:11:59 +00:00
|
|
|
SETTING_CHANGED_CB * Next = item->Next;
|
|
|
|
m_Callback.erase(Callback);
|
2016-11-27 20:34:02 +00:00
|
|
|
m_Callback.insert(SETTING_CALLBACK::value_type(CallbackType, Next));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Callback.erase(Callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrevItem->Next = item->Next;
|
|
|
|
}
|
|
|
|
delete item;
|
2021-04-12 11:35:39 +00:00
|
|
|
item = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
PrevItem = item;
|
|
|
|
item = item->Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bRemoved)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
2018-11-26 22:39:56 +00:00
|
|
|
}
|