2010-05-31 00:21:08 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "SettingType/SettingsType-Application.h"
|
2012-09-26 23:13:09 +00:00
|
|
|
#include "SettingType/SettingsType-ApplicationPath.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "SettingType/SettingsType-ApplicationIndex.h"
|
2008-11-14 20:51:06 +00:00
|
|
|
#include "SettingType/SettingsType-Cheats.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "SettingType/SettingsType-GameSetting.h"
|
2008-11-14 20:51:06 +00:00
|
|
|
#include "SettingType/SettingsType-GameSettingIndex.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "SettingType/SettingsType-RelativePath.h"
|
2008-11-14 20:51:06 +00:00
|
|
|
#include "SettingType/SettingsType-RomDatabase.h"
|
|
|
|
#include "SettingType/SettingsType-RomDatabaseIndex.h"
|
|
|
|
#include "SettingType/SettingsType-RDBCpuType.h"
|
|
|
|
#include "SettingType/SettingsType-RDBRamSize.h"
|
|
|
|
#include "SettingType/SettingsType-RDBSaveChip.h"
|
|
|
|
#include "SettingType/SettingsType-RDBYesNo.h"
|
|
|
|
#include "SettingType/SettingsType-RDBOnOff.h"
|
|
|
|
#include "SettingType/SettingsType-SelectedDirectory.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "SettingType/SettingsType-TempString.h"
|
|
|
|
#include "SettingType/SettingsType-TempNumber.h"
|
|
|
|
#include "SettingType/SettingsType-TempBool.h"
|
|
|
|
|
|
|
|
CSettings * _Settings = NULL;
|
|
|
|
|
|
|
|
CSettings::CSettings()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CSettings::~CSettings()
|
|
|
|
{
|
2010-06-04 06:25:07 +00:00
|
|
|
CSettingTypeApplication::CleanUp();
|
|
|
|
CSettingTypeRomDatabase::CleanUp();
|
|
|
|
CSettingTypeGame::CleanUp();
|
|
|
|
CSettingTypeCheats::CleanUp();
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
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;
|
|
|
|
while (item != NULL)
|
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * current_item = item;
|
|
|
|
item = item->Next;
|
|
|
|
delete current_item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::AddHandler ( SettingID TypeID, CSettingType * Handler )
|
|
|
|
{
|
2012-09-22 05:53:39 +00:00
|
|
|
SETTING_MAP::_Pairib res = m_SettingInfo.insert(SETTING_MAP::value_type(TypeID,Handler));
|
|
|
|
if (!res.second)
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
delete Handler;
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::AddHowToHandleSetting ()
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
//information - temp keys
|
|
|
|
AddHandler(Info_ShortCutsChanged, new CSettingTypeTempBool(false));
|
|
|
|
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
//Support Files
|
2012-09-26 23:13:09 +00:00
|
|
|
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config","Project64.cfg"));
|
|
|
|
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("","ConfigFile",SupportFile_SettingsDefault));
|
|
|
|
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config","Project64.cfg"));
|
|
|
|
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("","RomDatabase",SupportFile_RomDatabaseDefault));
|
|
|
|
AddHandler(SupportFile_RomDatabaseDefault, new CSettingTypeRelativePath("Config","Project64.rdb"));
|
|
|
|
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("","Cheats",SupportFile_CheatsDefault));
|
|
|
|
AddHandler(SupportFile_CheatsDefault, new CSettingTypeRelativePath("Config","Project64.cht"));
|
|
|
|
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("","Notes",SupportFile_NotesDefault));
|
|
|
|
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config","Project64.rdn"));
|
|
|
|
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("","ExtInfo",SupportFile_ExtInfoDefault));
|
|
|
|
AddHandler(SupportFile_ExtInfoDefault, new CSettingTypeRelativePath("Config","Project64.rdx"));
|
|
|
|
AddHandler(SupportFile_ShortCuts, new CSettingTypeApplicationPath("","ShortCuts",SupportFile_ShortCutsDefault));
|
|
|
|
AddHandler(SupportFile_ShortCutsDefault, new CSettingTypeRelativePath("Config","Project64.sc3"));
|
|
|
|
AddHandler(SupportFile_RomListCache, new CSettingTypeApplicationPath("","RomListCache",SupportFile_ShortCutsDefault));
|
|
|
|
AddHandler(SupportFile_RomListCacheDefault,new CSettingTypeRelativePath("Config","Project64.cache3"));
|
|
|
|
AddHandler(SupportFile_7zipCache, new CSettingTypeApplicationPath("","7zipCache",SupportFile_7zipCacheDefault));
|
|
|
|
AddHandler(SupportFile_7zipCacheDefault, new CSettingTypeRelativePath("Config","Project64.zcache"));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
//AddHandler(SyncPluginDir, new CSettingTypeRelativePath("SyncPlugin",""));
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
//Settings location
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Setting_ApplicationName, new CSettingTypeTempString(""));
|
|
|
|
AddHandler(Setting_UseFromRegistry, new CSettingTypeApplication("Settings","Use Registry",(DWORD)false));
|
2008-12-11 10:31:10 +00:00
|
|
|
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("","Rdb Editor", false));
|
2008-12-01 18:19:49 +00:00
|
|
|
AddHandler(Setting_PluginPageFirst, new CSettingTypeApplication("","Plugin Page First", false));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Setting_DisableScrSaver, new CSettingTypeApplication("","Disable Screen Saver",(DWORD)true));
|
|
|
|
AddHandler(Setting_AutoSleep, new CSettingTypeApplication("","Auto Sleep", (DWORD)true));
|
|
|
|
AddHandler(Setting_AutoStart, new CSettingTypeApplication("","Auto Start", (DWORD)true));
|
2011-01-02 10:40:00 +00:00
|
|
|
AddHandler(Setting_AutoFullscreen, new CSettingTypeApplication("","Auto Full Screen", (DWORD)false));
|
2008-12-11 10:31:10 +00:00
|
|
|
AddHandler(Setting_AutoZipInstantSave,new CSettingTypeApplication("","Auto Zip Saves", (DWORD)true));
|
|
|
|
AddHandler(Setting_EraseGameDefaults, new CSettingTypeApplication("","Erase on default", (DWORD)true));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("","Remember Cheats", (DWORD)false));
|
|
|
|
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("","Current Language",""));
|
2012-09-27 03:42:28 +00:00
|
|
|
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang",""));
|
|
|
|
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Directory","Lang",Setting_LanguageDirDefault));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name",Game_GameName));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type",SaveChip_Auto));
|
2012-10-23 08:07:06 +00:00
|
|
|
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type",CPU_SyncCores));
|
2008-12-11 10:31:10 +00:00
|
|
|
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size",0x400000));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor",2));
|
|
|
|
AddHandler(Rdb_UseTlb, new CSettingTypeRDBYesNo("Use TLB",true));
|
2012-10-05 23:53:11 +00:00
|
|
|
AddHandler(Rdb_DelayDP, new CSettingTypeRDBYesNo("Delay DP",true));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI",false));
|
2010-10-23 18:53:01 +00:00
|
|
|
AddHandler(Rdb_32Bit, new CSettingTypeRDBYesNo("32bit",true));
|
2010-07-23 10:45:35 +00:00
|
|
|
AddHandler(Rdb_FastSP, new CSettingTypeRDBYesNo("Fast SP",true));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_Status, new CSettingTypeRomDatabase("Status","Unknown"));
|
2008-12-04 10:41:51 +00:00
|
|
|
AddHandler(Rdb_NotesCore, new CSettingTypeRomDatabase("Core Note",""));
|
|
|
|
AddHandler(Rdb_NotesPlugin, new CSettingTypeRomDatabase("Plugin Note",""));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio",true));
|
|
|
|
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Sync Audio",false));
|
|
|
|
AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDBYesNo("Audio Signal",false));
|
|
|
|
AddHandler(Rdb_TLB_VAddrStart, new CSettingTypeRomDatabase("TLB: Vaddr Start",0));
|
|
|
|
AddHandler(Rdb_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len",0));
|
|
|
|
AddHandler(Rdb_TLB_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start",0));
|
|
|
|
AddHandler(Rdb_UseHleGfx, new CSettingTypeRomDatabase("HLE GFX",Plugin_UseHleGfx));
|
|
|
|
AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio",Plugin_UseHleAudio));
|
|
|
|
AddHandler(Rdb_LoadRomToMemory, new CSettingTypeRomDatabase("Rom In Memory",false));
|
|
|
|
AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz",60));
|
|
|
|
AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind",FuncFind_PhysicalLookup));
|
|
|
|
AddHandler(Rdb_RegCache, new CSettingTypeRDBYesNo("Reg Cache",true));
|
2012-10-23 08:07:06 +00:00
|
|
|
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking",true));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_SMM_Cache, new CSettingTypeRomDatabase("SMM-Cache",true));
|
2010-06-16 07:31:47 +00:00
|
|
|
AddHandler(Rdb_SMM_StoreInstruc, new CSettingTypeRomDatabase("SMM-StoreInstr",false));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Rdb_SMM_PIDMA, new CSettingTypeRomDatabase("SMM-PI DMA",true));
|
|
|
|
AddHandler(Rdb_SMM_TLB, new CSettingTypeRomDatabase("SMM-TLB",true));
|
|
|
|
AddHandler(Rdb_SMM_Protect, new CSettingTypeRomDatabase("SMM-Protect",false));
|
|
|
|
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true));
|
|
|
|
AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat","",""));
|
2008-12-04 10:41:51 +00:00
|
|
|
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
|
|
|
|
AddHandler(Game_GameName, new CSettingTypeTempString(""));
|
2008-12-04 10:41:51 +00:00
|
|
|
AddHandler(Game_GoodName, new CSettingTypeGame("Good Name",Rdb_GoodName));
|
2009-12-28 22:22:50 +00:00
|
|
|
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));
|
2008-12-04 10:41:51 +00:00
|
|
|
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",(DWORD)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_UseTlb, new CSettingTypeGame("Use TLB",Rdb_UseTlb));
|
2012-10-05 23:53:11 +00:00
|
|
|
AddHandler(Game_DelayDP, new CSettingTypeGame("Delay DP",Rdb_DelayDP));
|
2008-12-04 10:41:51 +00:00
|
|
|
AddHandler(Game_DelaySI, new CSettingTypeGame("Delay SI",Rdb_DelaySi));
|
|
|
|
AddHandler(Game_RspAudioSignal, new CSettingTypeGame("Audio Signal",Rdb_RspAudioSignal));
|
2010-10-23 18:53:01 +00:00
|
|
|
AddHandler(Game_32Bit, new CSettingTypeGame("32bit",Rdb_32Bit));
|
2010-07-23 10:45:35 +00:00
|
|
|
AddHandler(Game_FastSP, new CSettingTypeGame("SP Hack",Rdb_FastSP));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Game_CurrentSaveState, new CSettingTypeTempNumber(0));
|
2008-12-04 10:41:51 +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_LoadRomToMemory, new CSettingTypeGame("Rom In Memory",Rdb_LoadRomToMemory));
|
|
|
|
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));
|
|
|
|
AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking",Rdb_BlockLinking));
|
2010-06-16 07:31:47 +00:00
|
|
|
AddHandler(Game_SMM_StoreInstruc, new CSettingTypeGame("SMM-StoreInst",Rdb_SMM_StoreInstruc));
|
2008-12-04 10:41:51 +00:00
|
|
|
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));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
//User Interface
|
|
|
|
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));
|
|
|
|
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("","Display CPU Usage", (DWORD)false));
|
|
|
|
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("","Display Frame Rate", (DWORD)true));
|
|
|
|
AddHandler(UserInterface_InFullScreen, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("","Frame Rate Display Type", (DWORD)FR_VIs));
|
|
|
|
AddHandler(UserInterface_MainWindowTop, new CSettingTypeApplication("Main Window","Top" ,Default_None));
|
|
|
|
AddHandler(UserInterface_MainWindowLeft, new CSettingTypeApplication("Main Window","Left" ,Default_None));
|
|
|
|
AddHandler(UserInterface_AlwaysOnTop, new CSettingTypeApplication("","Always on top", (DWORD)false));
|
|
|
|
|
|
|
|
AddHandler(RomBrowser_Enabled, new CSettingTypeApplication("Rom Browser","Rom Browser",true));
|
|
|
|
AddHandler(RomBrowser_ColoumnsChanged, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(RomBrowser_Top, new CSettingTypeApplication("Rom Browser","Top" ,Default_None));
|
|
|
|
AddHandler(RomBrowser_Left, new CSettingTypeApplication("Rom Browser","Left" ,Default_None));
|
|
|
|
AddHandler(RomBrowser_Width, new CSettingTypeApplication("Rom Browser","Width", (DWORD)640));
|
|
|
|
AddHandler(RomBrowser_Height, new CSettingTypeApplication("Rom Browser","Height", (DWORD)480));
|
|
|
|
AddHandler(RomBrowser_PosIndex, new CSettingTypeApplicationIndex("Rom Browser\\Field Pos","Field",Default_None));
|
|
|
|
AddHandler(RomBrowser_WidthIndex, new CSettingTypeApplicationIndex("Rom Browser\\Field Width","Field",Default_None));
|
|
|
|
AddHandler(RomBrowser_SortFieldIndex, new CSettingTypeApplicationIndex("Rom Browser", "Sort Field", Default_None));
|
|
|
|
AddHandler(RomBrowser_SortAscendingIndex, new CSettingTypeApplicationIndex("Rom Browser", "Sort Ascending", Default_None));
|
|
|
|
AddHandler(RomBrowser_Recursive, new CSettingTypeApplication("Rom Browser","Recursive", false));
|
|
|
|
AddHandler(RomBrowser_Maximized, new CSettingTypeApplication("Rom Browser","Maximized", false));
|
|
|
|
|
|
|
|
AddHandler(Directory_RecentGameDirCount, new CSettingTypeApplication("","Remembered Rom Dirs",(DWORD)10));
|
|
|
|
AddHandler(Directory_RecentGameDirIndex, new CSettingTypeApplicationIndex("Recent Dir","Recent Dir",Default_None));
|
|
|
|
|
|
|
|
//Directory_Game,
|
|
|
|
AddHandler(Directory_Game, new CSettingTypeSelectedDirectory(Directory_GameInitial,Directory_GameSelected,Directory_GameUseSelected));
|
|
|
|
AddHandler(Directory_GameInitial, new CSettingTypeRelativePath("Game Directory",""));
|
|
|
|
AddHandler(Directory_GameSelected, new CSettingTypeApplication("Directory","Game",Directory_GameInitial));
|
|
|
|
AddHandler(Directory_GameUseSelected, new CSettingTypeApplication("Directory","Game - Use Selected",false));
|
|
|
|
|
|
|
|
AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory(Directory_PluginInitial,Directory_PluginSelected,Directory_PluginUseSelected));
|
|
|
|
AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin",""));
|
2012-09-27 03:40:40 +00:00
|
|
|
AddHandler(Directory_PluginSelected, new CSettingTypeApplicationPath("Directory","Plugin",Directory_PluginInitial));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Directory_PluginUseSelected, new CSettingTypeApplication("Directory","Plugin - Use Selected",false));
|
2010-05-31 00:21:08 +00:00
|
|
|
AddHandler(Directory_PluginSync, new CSettingTypeRelativePath("SyncPlugin",""));
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
AddHandler(Directory_SnapShot, new CSettingTypeSelectedDirectory(Directory_SnapShotInitial,Directory_SnapShotSelected,Directory_SnapShotUseSelected));
|
|
|
|
AddHandler(Directory_SnapShotInitial, new CSettingTypeRelativePath("Screenshots",""));
|
2012-09-27 03:40:40 +00:00
|
|
|
AddHandler(Directory_SnapShotSelected, new CSettingTypeApplicationPath("Directory","Snap Shot",Directory_SnapShotInitial));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Directory_SnapShotUseSelected, new CSettingTypeApplication("Directory","Snap Shot - Use Selected",false));
|
|
|
|
|
|
|
|
AddHandler(Directory_NativeSave, new CSettingTypeSelectedDirectory(Directory_NativeSaveInitial,Directory_NativeSaveSelected,Directory_NativeSaveUseSelected));
|
|
|
|
AddHandler(Directory_NativeSaveInitial, new CSettingTypeRelativePath("Save",""));
|
2012-09-27 03:40:40 +00:00
|
|
|
AddHandler(Directory_NativeSaveSelected, new CSettingTypeApplicationPath("Directory","Save",Directory_NativeSaveInitial));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Directory_NativeSaveUseSelected,new CSettingTypeApplication("Directory","Save - Use Selected",false));
|
|
|
|
|
|
|
|
AddHandler(Directory_InstantSave, new CSettingTypeSelectedDirectory(Directory_InstantSaveInitial,Directory_InstantSaveSelected,Directory_InstantSaveUseSelected));
|
|
|
|
AddHandler(Directory_InstantSaveInitial, new CSettingTypeRelativePath("Save",""));
|
2012-09-27 03:40:40 +00:00
|
|
|
AddHandler(Directory_InstantSaveSelected, new CSettingTypeApplicationPath("Directory","Instant Save",Directory_InstantSaveInitial));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Directory_InstantSaveUseSelected,new CSettingTypeApplication("Directory","Instant Save - Use Selected",false));
|
|
|
|
|
|
|
|
AddHandler(Directory_Texture, new CSettingTypeSelectedDirectory(Directory_TextureInitial,Directory_TextureSelected,Directory_TextureUseSelected));
|
|
|
|
AddHandler(Directory_TextureInitial, new CSettingTypeRelativePath("textures-load",""));
|
2012-09-27 03:40:40 +00:00
|
|
|
AddHandler(Directory_TextureSelected, new CSettingTypeApplicationPath("Directory","Texture Dir",Directory_InstantSaveInitial));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Directory_TextureUseSelected, new CSettingTypeApplication("Directory","Texture Dir - Use Selected",false));
|
|
|
|
|
2008-11-27 14:34:13 +00:00
|
|
|
AddHandler(Directory_LastSave, new CSettingTypeApplication("Directory","Last Save Directory", Directory_InstantSave));
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(GameRunning_CPU_Running, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false));
|
|
|
|
AddHandler(GameRunning_CPU_PausedType, new CSettingTypeTempNumber(Default_None));
|
|
|
|
AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString(""));
|
|
|
|
AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true));
|
|
|
|
AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60));
|
|
|
|
|
|
|
|
AddHandler(File_RecentGameFileCount, new CSettingTypeApplication("","Remembered Rom Files",(DWORD)10));
|
|
|
|
AddHandler(File_RecentGameFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None));
|
|
|
|
|
|
|
|
AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger","Debugger",false));
|
2012-09-28 20:07:45 +00:00
|
|
|
AddHandler(Debugger_ShowTLBMisses, new CSettingTypeApplication("Debugger","Show TLB Misses",false));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Debugger_ShowUnhandledMemory, new CSettingTypeApplication("Debugger","Show Unhandled Memory",false));
|
|
|
|
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));
|
2012-09-30 13:07:00 +00:00
|
|
|
AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger","Show Div by zero",false));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Debugger_GenerateDebugLog, new CSettingTypeApplication("Debugger","Generate Debug Code",false));
|
|
|
|
AddHandler(Debugger_ProfileCode, new CSettingTypeApplication("Debugger","Profile Code", (DWORD)false));
|
|
|
|
AddHandler(Debugger_AppLogLevel, new CSettingTypeApplication("Logging","Log Level",(DWORD)TraceError));
|
|
|
|
AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging","Log Auto Flush",(DWORD)false));
|
|
|
|
AddHandler(Debugger_GenerateLogFiles, new CSettingTypeApplication("Debugger","Generate Log Files", false));
|
|
|
|
|
|
|
|
|
|
|
|
AddHandler(Beta_IsBetaVersion, new CSettingTypeTempBool(true));
|
|
|
|
AddHandler(Beta_UserName, new CSettingTypeTempString("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
|
|
|
|
AddHandler(Beta_EmailAddress, new CSettingTypeTempString("????????????????????????????????????????????????????????????????????????????????"));
|
|
|
|
AddHandler(Beta_UserNameMD5, new CSettingTypeTempString("CBBABA8D2262FF1F7A47CEAD87FC4304"));
|
|
|
|
AddHandler(Beta_EmailAddressMD5, new CSettingTypeTempString("47A3D7CBF1DA291D5EB30DCAAF21B9F8"));
|
|
|
|
AddHandler(Beta_IsValidExe, new CSettingTypeTempBool(true));
|
|
|
|
|
|
|
|
//Plugin
|
|
|
|
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin","RSP Dll", "RSP\\RSP 1.7.dll"));
|
|
|
|
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin","Graphics Dll", "GFX\\Jabo_Direct3D8.dll"));
|
|
|
|
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin","Audio Dll", "Audio\\Jabo_Dsound.dll"));
|
|
|
|
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin","Controller Dll","Input\\Jabo_DInput.dll"));
|
|
|
|
|
|
|
|
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", ""));
|
|
|
|
|
2008-11-27 14:34:13 +00:00
|
|
|
AddHandler(Plugin_RSP_Changed, new CSettingTypeTempBool(true));
|
|
|
|
AddHandler(Plugin_GFX_Changed, new CSettingTypeTempBool(true));
|
|
|
|
AddHandler(Plugin_AUDIO_Changed, new CSettingTypeTempBool(true));
|
|
|
|
AddHandler(Plugin_CONT_Changed, new CSettingTypeTempBool(true));
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP","HLE GFX",true));
|
|
|
|
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP","HLE Audio",false));
|
|
|
|
|
|
|
|
// cheats
|
|
|
|
AddHandler(Cheat_Entry, new CSettingTypeCheats(""));
|
2010-09-22 21:43:42 +00:00
|
|
|
AddHandler(Cheat_Active, new CSettingTypeGameIndex("Cheat","",(DWORD)false));
|
2008-11-14 20:51:06 +00:00
|
|
|
AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat",".exten","??? - Not Set"));
|
|
|
|
AddHandler(Cheat_Notes, new CSettingTypeCheats("_N"));
|
|
|
|
AddHandler(Cheat_Options, new CSettingTypeCheats("_O"));
|
2010-05-14 23:28:15 +00:00
|
|
|
AddHandler(Cheat_Range, new CSettingTypeCheats("_R"));
|
|
|
|
AddHandler(Cheat_RangeNotes, new CSettingTypeCheats("_RN"));
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
DWORD CSettings::FindGameSetting ( CSettings * _this, char * Name )
|
|
|
|
{
|
|
|
|
for (SETTING_MAP::iterator iter = _this->m_SettingInfo.begin(); iter != _this->m_SettingInfo.end(); iter++)
|
|
|
|
{
|
|
|
|
CSettingType * Setting = iter->second;
|
|
|
|
if (Setting->GetSettingType() != SettingType_GameSetting)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSettingTypeGame * GameSetting = (CSettingTypeGame *)Setting;
|
2010-09-22 21:43:42 +00:00
|
|
|
if (_stricmp(GameSetting->GetKeyName(),Name) != 0)
|
2008-12-04 10:41:51 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return iter->first;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
DWORD CSettings::GetSetting ( CSettings * _this, SettingID Type )
|
|
|
|
{
|
|
|
|
return _this->LoadDword(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * CSettings::GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
if (Buffer && BufferSize > 0)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
Buffer[0] = 0;
|
2008-11-14 20:51:06 +00:00
|
|
|
_this->LoadString(Type, Buffer,BufferSize);
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SetSetting ( CSettings * _this, SettingID ID, unsigned int Value )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
_this->SaveDword(ID,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SetSettingSz ( CSettings * _this, SettingID ID, const char * Value )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
_this->SaveString(ID,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
|
|
|
|
SettingType Type, const char * Category, const char * DefaultStr,
|
2008-09-18 03:15:49 +00:00
|
|
|
DWORD Value )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
switch (Type)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
case SettingType_ConstValue:
|
|
|
|
if (DataType != Data_DWORD)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
_this->AddHandler(ID,new CSettingTypeTempNumber(Value));
|
|
|
|
break;
|
2008-11-14 20:51:06 +00:00
|
|
|
case SettingType_ConstString:
|
|
|
|
if (DataType != Data_String)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
_this->AddHandler(ID,new CSettingTypeTempString(DefaultStr));
|
|
|
|
break;
|
2008-11-14 20:51:06 +00:00
|
|
|
case SettingType_CfgFile:
|
|
|
|
case SettingType_Registry:
|
|
|
|
switch (DataType)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
case Data_DWORD:
|
2008-11-14 20:51:06 +00:00
|
|
|
if (DefaultID == Default_None)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
_this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,Value));
|
|
|
|
} else {
|
|
|
|
_this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
2008-11-14 20:51:06 +00:00
|
|
|
if (DefaultID == Default_None)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
_this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,""));
|
|
|
|
} else {
|
|
|
|
_this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-11-14 20:51:06 +00:00
|
|
|
case SettingType_GameSetting:
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
stdstr_f Name("%s-%s",Category,DefaultStr);
|
|
|
|
switch (DataType)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
case Data_DWORD:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),Value));
|
|
|
|
} else {
|
|
|
|
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
|
|
|
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),""));
|
|
|
|
} else {
|
|
|
|
_this->AddHandler(ID,new CSettingTypeGame(Name.c_str(),DefaultID));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SettingType_RomDatabase:
|
|
|
|
switch (DataType)
|
|
|
|
{
|
|
|
|
case Data_DWORD:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
2008-11-15 21:38:19 +00:00
|
|
|
_this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,(int)Value,true));
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
2008-11-15 21:38:19 +00:00
|
|
|
_this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,(SettingID)Value,true));
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Data_String:
|
|
|
|
if (DefaultID == Default_None)
|
|
|
|
{
|
2008-11-15 21:38:19 +00:00
|
|
|
_this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,"",true));
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
2008-11-15 21:38:19 +00:00
|
|
|
_this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,DefaultID,true));
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-09-18 03:15:49 +00:00
|
|
|
default:
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::Initilize( const char * AppName )
|
|
|
|
{
|
|
|
|
AddHowToHandleSetting();
|
|
|
|
CSettingTypeApplication::Initilize(AppName);
|
|
|
|
CSettingTypeRomDatabase::Initilize();
|
2008-11-14 20:51:06 +00:00
|
|
|
CSettingTypeGame::Initilize();
|
|
|
|
CSettingTypeCheats::Initilize();
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
_Settings->SaveString(Setting_ApplicationName,AppName);
|
2008-09-18 03:15:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBool ( SettingID Type )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
bool Value = false;
|
|
|
|
LoadBool(Type,Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBool ( SettingID Type, bool & Value )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2008-11-14 20:51:06 +00:00
|
|
|
return FindInfo->second->Load(0,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBoolIndex( SettingID Type, int index )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
bool Value = false;
|
|
|
|
LoadBoolIndex(Type,index,Value);
|
|
|
|
return Value;
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadBoolIndex( SettingID Type, int index , bool & Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
2008-11-14 20:51:06 +00:00
|
|
|
return false;
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
return FindInfo->second->Load(index,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD CSettings::LoadDword ( SettingID Type )
|
|
|
|
{
|
|
|
|
DWORD Value = 0;
|
|
|
|
LoadDword(Type,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadDword ( SettingID Type, DWORD & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2008-11-14 20:51:06 +00:00
|
|
|
return FindInfo->second->Load(0,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD CSettings::LoadDwordIndex( SettingID Type, int index)
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
DWORD Value;
|
|
|
|
LoadDwordIndex(Type,index,Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSettings::LoadDwordIndex( SettingID Type, int index, DWORD & Value)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
return FindInfo->second->Load(index,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
stdstr CSettings::LoadString ( SettingID Type )
|
|
|
|
{
|
|
|
|
stdstr Value;
|
|
|
|
LoadString(Type,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
bool CSettings::LoadString ( SettingID Type, stdstr & Value )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
return FindInfo->second->Load(0,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
bool CSettings::LoadString ( SettingID Type, char * Buffer, int BufferSize )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
bool bRes = false;
|
2008-09-18 03:15:49 +00:00
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2008-11-14 20:51:06 +00:00
|
|
|
stdstr Value;
|
|
|
|
bRes = FindInfo->second->Load(0,Value);
|
|
|
|
int len = BufferSize;
|
2010-09-22 21:43:42 +00:00
|
|
|
if ((Value.length() + 1) < (size_t)len)
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
len = Value.length() + 1;
|
|
|
|
}
|
|
|
|
strncpy(Buffer,Value.c_str(),len);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
return bRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
stdstr CSettings::LoadStringIndex ( SettingID Type, int index )
|
|
|
|
{
|
|
|
|
stdstr Value;
|
|
|
|
LoadStringIndex(Type,index,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
bool CSettings::LoadStringIndex ( SettingID Type, int index, stdstr & Value )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
return FindInfo->second->Load(index,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
bool CSettings::LoadStringIndex ( SettingID /*Type*/, int /*index*/, char * /*Buffer*/, int /*BufferSize*/ )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
//Load the default value for the setting
|
|
|
|
bool CSettings::LoadDefaultBool ( SettingID Type )
|
|
|
|
{
|
|
|
|
bool Value = false;
|
|
|
|
LoadDefaultBool(Type,Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::LoadDefaultBool ( SettingID Type, bool & Value )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
} else {
|
2008-11-14 20:51:06 +00:00
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->LoadDefault(0,Value);
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
bool CSettings::LoadDefaultBoolIndex ( SettingID /*Type*/, int /*index*/ )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::LoadDefaultBoolIndex ( SettingID /*Type*/, int /*index*/, bool & /*Value*/ )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DWORD CSettings::LoadDefaultDword ( SettingID Type )
|
|
|
|
{
|
|
|
|
DWORD Value = 0;
|
|
|
|
LoadDefaultDword(Type,Value);
|
2008-09-18 03:15:49 +00:00
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void CSettings::LoadDefaultDword ( SettingID Type, DWORD & Value)
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
} else {
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->LoadDefault(0,Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
DWORD CSettings::LoadDefaultDwordIndex ( SettingID /*Type*/, int /*index*/ )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::LoadDefaultDwordIndex ( SettingID /*Type*/, int /*index*/, DWORD & /*Value*/)
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stdstr CSettings::LoadDefaultString ( SettingID Type )
|
|
|
|
{
|
|
|
|
stdstr Value;
|
|
|
|
LoadDefaultString(Type,Value);
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::LoadDefaultString ( SettingID Type, stdstr & Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
} else {
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->LoadDefault(0,Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::LoadDefaultString ( SettingID /*Type*/, char * /*Buffer*/, int /*BufferSize*/ )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
stdstr CSettings::LoadDefaultStringIndex ( SettingID /*Type*/, int /*index*/ )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::LoadDefaultStringIndex ( SettingID /*Type*/, int /*index*/, stdstr & /*Value*/ )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::LoadDefaultStringIndex ( SettingID /*Type*/, int /*index*/, char * /*Buffer*/, int /*BufferSize*/ )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void CSettings::SaveBool ( SettingID Type, bool Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->Save(0,Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveBoolIndex( SettingID Type, int index, bool Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index,Value);
|
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
void CSettings::SaveDword ( SettingID Type, DWORD Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->Save(0,Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveDwordIndex ( SettingID Type, int index, DWORD Value )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index,Value);
|
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void CSettings::SaveString ( SettingID Type, const stdstr & Value )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->Save(0,Value);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveString ( SettingID Type, const char * Buffer )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->Save(0,Buffer);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveStringIndex( SettingID Type, int index, const char * Buffer )
|
|
|
|
{
|
2008-11-14 20:51:06 +00:00
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Save(index,Buffer);
|
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::SaveStringIndex( SettingID Type, int index, const stdstr & Value )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
SaveStringIndex(Type,index,Value.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::DeleteSetting( SettingID Type )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-11-14 20:51:06 +00:00
|
|
|
} else {
|
|
|
|
FindInfo->second->Delete(0);
|
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::DeleteSettingIndex( SettingID Type, int index )
|
|
|
|
{
|
|
|
|
SETTING_HANDLER FindInfo = m_SettingInfo.find(Type);
|
|
|
|
if (FindInfo == m_SettingInfo.end())
|
|
|
|
{
|
|
|
|
//if not found do nothing
|
|
|
|
UnknownSetting(Type);
|
|
|
|
}
|
|
|
|
if (FindInfo->second->IndexBasedSetting())
|
|
|
|
{
|
|
|
|
FindInfo->second->Delete(index);
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
NotifyCallBacks(Type);
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 09:20:53 +00:00
|
|
|
void CSettings::UnknownSetting (SettingID /*Type*/)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
2010-06-22 20:36:28 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
2008-09-18 03:15:49 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::NotifyCallBacks( SettingID Type )
|
|
|
|
{
|
|
|
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
|
|
|
if (Callback == m_Callback.end())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (SETTING_CHANGED_CB * item = Callback->second; item != NULL; item = item->Next)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
new_item->Next = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2010-06-04 06:25:07 +00:00
|
|
|
item->Next = new_item;
|
2008-09-18 03:15:49 +00:00
|
|
|
} else {
|
|
|
|
m_Callback.insert(SETTING_CALLBACK::value_type(Type,new_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSettings::UnregisterChangeCB(SettingID Type,void * Data, SettingChangedFunc Func)
|
|
|
|
{
|
2010-06-04 06:25:07 +00:00
|
|
|
bool bRemoved = false;
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
//Find out the information for handling the setting type from the list
|
2010-06-04 06:25:07 +00:00
|
|
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
|
|
|
if (Callback != m_Callback.end())
|
|
|
|
{
|
|
|
|
SETTING_CHANGED_CB * PrevItem = NULL;
|
|
|
|
SETTING_CHANGED_CB * item = Callback->second;
|
|
|
|
|
|
|
|
while (item)
|
|
|
|
{
|
|
|
|
if (Callback->first == Type && item->Data == Data && item->Func == Func)
|
|
|
|
{
|
|
|
|
bRemoved = true;
|
|
|
|
if (PrevItem == NULL)
|
|
|
|
{
|
|
|
|
if (item->Next)
|
|
|
|
{
|
|
|
|
SettingID Type = Callback->first;
|
|
|
|
_SETTING_CHANGED_CB * Next = item->Next;
|
|
|
|
m_Callback.erase(Callback);
|
|
|
|
m_Callback.insert(SETTING_CALLBACK::value_type(Type,Next));
|
|
|
|
} else {
|
|
|
|
m_Callback.erase(Callback);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PrevItem->Next = item->Next;
|
|
|
|
}
|
|
|
|
delete item;
|
|
|
|
item = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PrevItem = item;
|
|
|
|
item = item->Next;
|
|
|
|
}
|
|
|
|
} else {
|
2008-09-18 03:15:49 +00:00
|
|
|
UnknownSetting(Type);
|
|
|
|
return;
|
|
|
|
}
|
2010-06-04 06:25:07 +00:00
|
|
|
|
|
|
|
if (!bRemoved)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2010-06-04 06:25:07 +00:00
|
|
|
_Notify->BreakPoint(__FILE__,__LINE__);
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|