diff --git a/Project64.ncb b/Project64.ncb deleted file mode 100644 index ad34d4048..000000000 Binary files a/Project64.ncb and /dev/null differ diff --git a/Project64.opt b/Project64.opt deleted file mode 100644 index ca2b8dbd8..000000000 Binary files a/Project64.opt and /dev/null differ diff --git a/Source/Project64/3rd Party/HTML Help/vssver2.scc b/Source/Project64/3rd Party/HTML Help/vssver2.scc deleted file mode 100644 index 33d208251..000000000 Binary files a/Source/Project64/3rd Party/HTML Help/vssver2.scc and /dev/null differ diff --git a/Source/Project64/3rd Party/vssver2.scc b/Source/Project64/3rd Party/vssver2.scc deleted file mode 100644 index b6beb36eb..000000000 Binary files a/Source/Project64/3rd Party/vssver2.scc and /dev/null differ diff --git a/Source/Project64/3rd Party/zlib/vssver2.scc b/Source/Project64/3rd Party/zlib/vssver2.scc deleted file mode 100644 index 839ea9e0c..000000000 Binary files a/Source/Project64/3rd Party/zlib/vssver2.scc and /dev/null differ diff --git a/Source/Project64/Multilanguage.h b/Source/Project64/Multilanguage.h index d09137d61..4bed57f50 100644 --- a/Source/Project64/Multilanguage.h +++ b/Source/Project64/Multilanguage.h @@ -216,6 +216,7 @@ enum LanguageStringID{ PLUG_CTRL = 424, PLUG_HLE_GFX = 425, PLUG_HLE_AUDIO = 426, + PLUG_DEFAULT = 427, //Directory Dialog DIR_PLUGIN = 440, diff --git a/Source/Project64/Multilanguage/Language Class.cpp b/Source/Project64/Multilanguage/Language Class.cpp index 93d95a3ac..7ac1ca94f 100644 --- a/Source/Project64/Multilanguage/Language Class.cpp +++ b/Source/Project64/Multilanguage/Language Class.cpp @@ -167,6 +167,7 @@ void CLanguage::LoadDefaultStrings (void) { DEF_STR(PLUG_CTRL, " Input (controller) plugin: "); DEF_STR(PLUG_HLE_GFX, "Use High Level GFX?"); DEF_STR(PLUG_HLE_AUDIO,"Use High Level Audio?"); + DEF_STR(PLUG_DEFAULT, "** Use System Plugin **"); //Directory Dialog DEF_STR(DIR_PLUGIN, " Plugin Directoy: "); @@ -461,7 +462,7 @@ void CLanguage::LoadCurrentStrings ( bool ShowSelectDialog ) { if (ShowSelectDialog) { - m_SelectedLanguage = _Settings->LoadString(CurrentLanguage); + m_SelectedLanguage = _Settings->LoadString(Setting_CurrentLanguage); } LanguageList LangList = GetLangList(); @@ -917,9 +918,9 @@ LANG_STR CLanguage::GetNextLangString (void * OpenFile) { void CLanguage::SetLanguage ( char * LanguageName ) { - _Settings->SaveString(CurrentLanguage,LanguageName); m_SelectedLanguage = LanguageName; LoadCurrentStrings(false); + _Settings->SaveString(Setting_CurrentLanguage,LanguageName); } bool CLanguage::IsCurrentLang( LanguageFile & File ) diff --git a/Source/Project64/Multilanguage/vssver2.scc b/Source/Project64/Multilanguage/vssver2.scc deleted file mode 100644 index 02f978da5..000000000 Binary files a/Source/Project64/Multilanguage/vssver2.scc and /dev/null differ diff --git a/Source/Project64/N64 System/C Core/C Core Interface.cpp b/Source/Project64/N64 System/C Core/C Core Interface.cpp index b288e5077..5a240cb54 100644 --- a/Source/Project64/N64 System/C Core/C Core Interface.cpp +++ b/Source/Project64/N64 System/C Core/C Core Interface.cpp @@ -176,35 +176,35 @@ void CC_Core::SetSettings ( ) g_Settings = _Settings; if (g_Settings) { - g_HaveDebugger = g_Settings->LoadDword(Debugger); + g_HaveDebugger = g_Settings->LoadBool(Debugger_Enabled); if (g_HaveDebugger) { - g_ShowUnhandledMemory = g_Settings->LoadDword(ShowUnhandledMemory); - g_ShowDListAListCount = g_Settings->LoadDword(ShowDListAListCount); + g_ShowUnhandledMemory = g_Settings->LoadBool(Debugger_ShowUnhandledMemory); + g_ShowDListAListCount = g_Settings->LoadDword(Debugger_ShowDListAListCount); } else { g_ShowUnhandledMemory = false; g_ShowUnhandledMemory = false; } - g_ShowCPUPer = g_Settings->LoadDword(ShowCPUPer); + g_ShowCPUPer = g_Settings->LoadDword(UserInterface_ShowCPUPer); g_ShowTLBMisses = false; - g_UseTlb = g_Settings->LoadDword(UseTLB); - g_CPU_Type = (CPU_TYPE)g_Settings->LoadDword(CPUType); - g_SaveUsing = (SAVE_CHIP_TYPE)g_Settings->LoadDword(SaveChipType); - g_AudioSignal = g_Settings->LoadDword(AudioSignal); - g_RdramSize = g_Settings->LoadDword(RamSize); - g_ShowPifRamErrors = g_Settings->LoadDword(ShowPifRamErrors); - g_CountPerOp = g_Settings->LoadDword(CounterFactor); - g_GenerateLog = g_Settings->LoadDword(GenerateDebugLog); - g_DelaySI = g_Settings->LoadDword(DelaySI); - g_SPHack = g_Settings->LoadDword(ROM_SPHack); - g_FixedAudio = g_Settings->LoadDword(ROM_FixedAudio); - g_LogX86Code = g_Settings->LoadDword(GenerateLogFiles); - g_LookUpMode = (FUNC_LOOKUP_METHOD)g_Settings->LoadDword(FuncLookupMode); - g_DisableRegCaching = !g_Settings->LoadDword(ROM_RegCache); - g_UseLinking = g_Settings->LoadDword(BlockLinking); + g_UseTlb = g_Settings->LoadBool(Game_UseTlb); + g_CPU_Type = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType); + g_SaveUsing = (SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip); + g_AudioSignal = g_Settings->LoadBool(Game_RspAudioSignal); + g_RdramSize = g_Settings->LoadDword(Game_RDRamSize); + g_ShowPifRamErrors = g_Settings->LoadDword(Debugger_ShowPifErrors); + g_CountPerOp = g_Settings->LoadDword(Game_CounterFactor); + g_GenerateLog = g_Settings->LoadDword(Debugger_GenerateDebugLog); + g_DelaySI = g_Settings->LoadBool(Game_DelaySI); + g_SPHack = g_Settings->LoadBool(Game_SPHack); + g_FixedAudio = g_Settings->LoadBool(Game_FixedAudio); + g_LogX86Code = g_Settings->LoadBool(Debugger_GenerateLogFiles); + g_LookUpMode = (FUNC_LOOKUP_METHOD)g_Settings->LoadDword(Game_FuncLookupMode); + g_DisableRegCaching = !g_Settings->LoadBool(Game_RegCache); + g_UseLinking = g_Settings->LoadBool(Game_BlockLinking); g_ShowCompMem = false; - strcpy(g_RomName, g_Settings->LoadString(ROM_NAME).c_str()); + strcpy(g_RomName, g_Settings->LoadString(Game_GameName).c_str()); } } @@ -422,20 +422,18 @@ void DisplayMessage2 ( const char * Message, ... ) const char * GetAppName ( void ) { - static stdstr szAppName = g_Settings->LoadString(ApplicationName); + static stdstr szAppName = g_Settings->LoadString(Setting_ApplicationName); return szAppName.c_str(); } void GetAutoSaveDir( char * Directory ) { - SettingID Dir = g_Settings->LoadDword(UseSaveDirSelected) ? SelectedSaveDirectory : InitialSaveDirectory ; - strcpy(Directory,g_Settings->LoadString(Dir).c_str()); + strcpy(Directory,g_Settings->LoadString(Directory_NativeSave).c_str()); } void GetInstantSaveDir( char * Directory ) { - SettingID Dir = g_Settings->LoadDword(UseInstantDirSelected) ? SelectedInstantSaveDirectory : InitialInstantSaveDirectory ; - strcpy(Directory,g_Settings->LoadString(Dir).c_str()); + strcpy(Directory,g_Settings->LoadString(Directory_InstantSave).c_str()); } void SetFpuLocations( void ) @@ -445,7 +443,7 @@ void SetFpuLocations( void ) BOOL Limit_FPS ( void ) { - return g_Settings->LoadDword(LimitFPS); + return g_Settings->LoadDword(GameRunning_LimitFPS); } void DacrateChanged ( enum SystemType Type ) @@ -455,7 +453,7 @@ void DacrateChanged ( enum SystemType Type ) BOOL Close_C_CPU ( void ) { - if (g_Settings == NULL || !g_Settings->LoadDword(CPU_Running)) + if (g_Settings == NULL || !g_Settings->LoadBool(GameRunning_CPU_Running)) { return true; } @@ -533,7 +531,8 @@ void ApplyGSButtonCheats ( void ) void ChangePluginFunc ( void ) { g_Notify->DisplayMessage(0,MSG_PLUGIN_INIT); - if (g_Settings->LoadDword(GFX_PluginChanged)) + BreakPoint(__FILE__,__LINE__); + /*if (g_Settings->LoadDword(GFX_PluginChanged)) { g_Plugins->Reset(PLUGIN_TYPE_GFX); } @@ -555,7 +554,7 @@ void ChangePluginFunc ( void ) g_Settings->SaveDword(AUDIO_PluginChanged,(DWORD)false); g_Settings->SaveDword(GFX_PluginChanged, (DWORD)false); g_Settings->SaveDword(CONT_PluginChanged, (DWORD)false); - + */ g_Notify->RefreshMenu(); if (!g_Plugins->Initiate(g_N64System)) { g_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT); diff --git a/Source/Project64/N64 System/C Core/Dma.cpp b/Source/Project64/N64 System/C Core/Dma.cpp index 2284f166b..aeedb6182 100644 --- a/Source/Project64/N64 System/C Core/Dma.cpp +++ b/Source/Project64/N64 System/C Core/Dma.cpp @@ -100,10 +100,9 @@ void PI_DMA_WRITE (void) { DWORD i; PI_STATUS_REG |= PI_STATUS_DMA_BUSY; - if ( PI_DRAM_ADDR_REG + PI_WR_LEN_REG + 1 > RdramSize) { -#ifndef EXTERNAL_RELEASE - DisplayError("PI_DMA_WRITE not in Memory"); -#endif + if ( PI_DRAM_ADDR_REG + PI_WR_LEN_REG + 1 > RdramSize) + { + if (ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in Memory"); } PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; MI_INTR_REG |= MI_INTR_PI; CheckInterrupts(); @@ -164,7 +163,7 @@ void PI_DMA_WRITE (void) { CPU_Action.DMAUsed = TRUE; OnFirstDMA(); } - if (g_Recompiler && g_Recompiler->bSMM_PIDMA) + if (g_Recompiler && g_Recompiler->bSMM_PIDMA()) { g_Recompiler->ClearRecompCode_Phys(PI_DRAM_ADDR_REG, PI_WR_LEN_REG,CRecompiler::Remove_DMA); } @@ -176,9 +175,7 @@ void PI_DMA_WRITE (void) { return; } -#ifndef EXTERNAL_RELEASE if (ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in ROM"); } -#endif PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; MI_INTR_REG |= MI_INTR_PI; CheckInterrupts(); diff --git a/Source/Project64/N64 System/C Core/Recompiler Ops.cpp b/Source/Project64/N64 System/C Core/Recompiler Ops.cpp index 4e2769144..587f0c5dc 100644 --- a/Source/Project64/N64 System/C Core/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/C Core/Recompiler Ops.cpp @@ -135,7 +135,7 @@ void Compile_R4300i_Branch (CBlockSection * Section, void (*CompareFunc)(CBlockS CompareFunc(Section); if ((Section->CompilePC & 0xFFC) == 0xFFC) { - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; return; } @@ -220,7 +220,7 @@ void Compile_R4300i_Branch (CBlockSection * Section, void (*CompareFunc)(CBlockS memcpy(&Section->Cont.RegSet,&Section->RegWorking,sizeof(CRegInfo)); memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); } - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { #ifndef EXTERNAL_RELEASE @@ -276,7 +276,7 @@ void Compile_R4300i_BranchLikely (CBlockSection * Section, void (*CompareFunc)(C Section->JumpSection->DelaySlotSection = true; Section->Jump.TargetPC = Section->CompilePC + 4; Section->Jump.RegSet = Section->RegWorking; - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { if (Section->Cont.FallThrough) { @@ -285,7 +285,7 @@ void Compile_R4300i_BranchLikely (CBlockSection * Section, void (*CompareFunc)(C DisplayError("WTF .. problem with Compile_R4300i_BranchLikely"); #endif } - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { if ((Section->CompilePC & 0xFFC) == 0xFFC) { @@ -313,7 +313,7 @@ void Compile_R4300i_BranchLikely (CBlockSection * Section, void (*CompareFunc)(C g_N64System->GetRecompiler()->CompileExit (Section,Section->CompilePC, Section->CompilePC + 8,Section->RegWorking,CExitInfo::Normal,TRUE,NULL); CPU_Message(" "); CPU_Message(" DoDelaySlot"); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { NextInstruction = DO_DELAY_SLOT; @@ -323,7 +323,7 @@ void Compile_R4300i_BranchLikely (CBlockSection * Section, void (*CompareFunc)(C } else if (NextInstruction == DELAY_SLOT_DONE ) { Section->ResetX86Protection(); memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { #ifndef EXTERNAL_RELEASE @@ -1105,12 +1105,12 @@ void Compile_R4300i_J (CBlockSection * Section) { NextInstruction = DO_DELAY_SLOT; if ((Section->CompilePC & 0xFFC) == 0xFFC) { memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } } else if (NextInstruction == DELAY_SLOT_DONE ) { memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { #ifndef EXTERNAL_RELEASE @@ -1169,12 +1169,12 @@ void Compile_R4300i_JAL (CBlockSection * Section) { Section->Jump.LinkLocation2 = NULL; if ((Section->CompilePC & 0xFFC) == 0xFFC) { memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } } else if (NextInstruction == DELAY_SLOT_DONE ) { memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; } else { #ifndef EXTERNAL_RELEASE @@ -2406,7 +2406,7 @@ void Compile_R4300i_SDR (CBlockSection * Section) { void Compile_R4300i_CACHE (CBlockSection * Section){ CPU_Message(" %X %s",Section->CompilePC,R4300iOpcodeName(Opcode.Hex,Section->CompilePC)); - if (_Settings->LoadDword(SMM_Cache) == 0) + if (_Settings->LoadDword(Game_SMM_Cache) == 0) { return; } @@ -2933,7 +2933,7 @@ void Compile_R4300i_SPECIAL_JR (CBlockSection * Section) { Section->Cont.LinkLocation = NULL; Section->Cont.LinkLocation2 = NULL; if ((Section->CompilePC & 0xFFC) == 0xFFC) { - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); NextInstruction = END_BLOCK; return; } @@ -2969,7 +2969,7 @@ void Compile_R4300i_SPECIAL_JR (CBlockSection * Section) { } else { if (Section->IsConst(Opcode.rs)) { memcpy(&Section->Jump.RegSet,&Section->RegWorking,sizeof(CRegInfo)); - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); } else { if (Section->IsMapped(Opcode.rs)) { MoveX86regToVariable(Section->MipsRegLo(Opcode.rs),&PROGRAM_COUNTER, "PROGRAM_COUNTER"); @@ -3027,7 +3027,7 @@ void Compile_R4300i_SPECIAL_JALR (CBlockSection * Section) { Section->Cont.LinkLocation = NULL; Section->Cont.LinkLocation2 = NULL; - GenerateSectionLinkage(Section); + g_N64System->GetRecompiler()->GenerateSectionLinkage(Section); } else { if (Section->IsMapped(Opcode.rs)) { MoveX86regToVariable(Section->MipsRegLo(Opcode.rs),&PROGRAM_COUNTER, "PROGRAM_COUNTER"); diff --git a/Source/Project64/N64 System/C Core/vssver2.scc b/Source/Project64/N64 System/C Core/vssver2.scc deleted file mode 100644 index 927f01fd7..000000000 Binary files a/Source/Project64/N64 System/C Core/vssver2.scc and /dev/null differ diff --git a/Source/Project64/N64 System/Cheat Class.cpp b/Source/Project64/N64 System/Cheat Class.cpp index 357b7f604..612d2e8bf 100644 --- a/Source/Project64/N64 System/Cheat Class.cpp +++ b/Source/Project64/N64 System/Cheat Class.cpp @@ -48,18 +48,18 @@ bool CCheats::LoadCode (int CheatNo, LPCSTR CheatString) if (strncmp(ReadPos,"????",4) == 0) { if (CheatNo < 0 || CheatNo > MaxCheats) { return false; } - stdstr CheatExt = _Settings->LoadString((SettingID)(CheatExtension + CheatNo)); + stdstr CheatExt = _Settings->LoadStringIndex(Cheat_Extension,CheatNo); if (CheatExt.empty()) { return false; } CodeEntry.Value = CheatExt[0] == '$'?(WORD)AsciiToHex(&CheatExt.c_str()[1]):(WORD)atol(CheatExt.c_str()); } else if (strncmp(ReadPos,"??",2) == 0) { if (CheatNo < 0 || CheatNo > MaxCheats) { return false; } - stdstr CheatExt = _Settings->LoadString((SettingID)(CheatExtension + CheatNo)); + stdstr CheatExt = _Settings->LoadStringIndex(Cheat_Extension,CheatNo); if (CheatExt.empty()) { return false; } CodeEntry.Value = (BYTE)(AsciiToHex(ReadPos)); CodeEntry.Value |= (CheatExt[0] == '$'?(BYTE)AsciiToHex(&CheatExt.c_str()[1]):(BYTE)atol(CheatExt.c_str())) << 16; } else if (strncmp(&ReadPos[2],"??",2) == 0) { if (CheatNo < 0 || CheatNo > MaxCheats) { return false; } - stdstr CheatExt = _Settings->LoadString((SettingID)(CheatExtension + CheatNo)); + stdstr CheatExt = _Settings->LoadStringIndex(Cheat_Extension,CheatNo); if (CheatExt.empty()) { return false; } CodeEntry.Value = (WORD)(AsciiToHex(ReadPos) << 16); CodeEntry.Value |= CheatExt[0] == '$'?(BYTE)AsciiToHex(&CheatExt.c_str()[1]):(BYTE)atol(CheatExt.c_str()); @@ -86,14 +86,17 @@ bool CCheats::LoadCode (int CheatNo, LPCSTR CheatString) void CCheats::LoadPermCheats (void) { - if (_Settings->LoadDword(DisableGameFixes)) + if (_Settings->LoadBool(Debugger_DisableGameFixes)) { return; } for (int CheatNo = 0; CheatNo < MaxCheats; CheatNo ++ ) { - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatPermEntry + CheatNo)); - if (LineEntry.empty()) { break; } + stdstr LineEntry; + if (!_Settings->LoadStringIndex(Rdb_GameCheatFix,CheatNo,LineEntry) || LineEntry.empty()) + { + break; + } LoadCode(-1, LineEntry.c_str()); } } @@ -105,19 +108,19 @@ void CCheats::LoadCheats(bool DisableSelected) { for (int CheatNo = 0; CheatNo < MaxCheats; CheatNo ++ ) { - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatEntry + CheatNo)); + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,CheatNo); if (LineEntry.empty()) { break; } - if (!_Settings->LoadDword((SettingID)(CheatActive + CheatNo))) + if (!_Settings->LoadBoolIndex(Cheat_Active,CheatNo)) { continue; } if (DisableSelected) { - _Settings->SaveDword((SettingID)(CheatActive + CheatNo),(DWORD)false); + _Settings->SaveBoolIndex(Cheat_Active,CheatNo,false); continue; } - //Find the start and end of the name which is surronded in "" + //Find the start and end of the name which is surrounded in "" int StartOfName = LineEntry.find("\""); if (StartOfName == -1) { continue; } int EndOfName = LineEntry.find("\"",StartOfName + 1); @@ -514,12 +517,13 @@ void CCheats::AddCodeLayers (int CheatNumber, stdstr &CheatName, WND_HANDLE hPar AddCodeLayers(CheatNumber,(stdstr)(CheatName.substr(strlen(Text) + 1)), hParent, CheatActive); } -stdstr CCheats::GetCheatName(int CheatNo, bool AddExtension) const { +stdstr CCheats::GetCheatName(int CheatNo, bool AddExtension) const +{ if (CheatNo > MaxCheats) { _Notify->BreakPoint(__FILE__,__LINE__); } - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatEntry + CheatNo)); + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,CheatNo); if (LineEntry.length() == 0) { return LineEntry; } - //Find the start and end of the name which is surronded in "" + //Find the start and end of the name which is surrounded in "" int StartOfName = LineEntry.find("\""); if (StartOfName == -1) { return stdstr(""); } int EndOfName = LineEntry.find("\"",StartOfName + 1); @@ -533,7 +537,7 @@ stdstr CCheats::GetCheatName(int CheatNo, bool AddExtension) const { Name.replace("\\","\\*** "); } if (AddExtension && CheatUsesCodeExtensions(LineEntry)) { - stdstr CheatValue(_Settings->LoadString((SettingID)(CheatExtension + CheatNo))); + stdstr CheatValue(_Settings->LoadStringIndex(Cheat_Extension,CheatNo)); Name.Format("%s (=>%s)",Name.c_str(),CheatValue.c_str()); } @@ -563,7 +567,8 @@ bool CCheats::CheatUsesCodeExtensions (const stdstr &LineEntry) { return CodeExtension; } -void CCheats::RefreshCheatManager(void) { +void CCheats::RefreshCheatManager(void) +{ if (m_Window == NULL) { return; } int CurrentEdit = m_EditCheat; @@ -575,7 +580,7 @@ void CCheats::RefreshCheatManager(void) { stdstr Name = GetCheatName(count,true); if (Name.length() == 0) { break; } - AddCodeLayers(count,Name,(WND_HANDLE)TVI_ROOT, _Settings->LoadDword((SettingID)(CheatActive + count)) != 0); + AddCodeLayers(count,Name,(WND_HANDLE)TVI_ROOT, _Settings->LoadBoolIndex(Cheat_Active,count) != 0); } } @@ -771,9 +776,9 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO stdstr_f Cheat("\"%s\"%s",NewCheatName.c_str(),ReadCodeString(hDlg,validcodes,validoptions,nooptions,CodeFormat).c_str()); stdstr Options = ReadOptionsString(hDlg,validcodes,validoptions,nooptions,CodeFormat); - _Settings->SaveString((SettingID)(CheatEntry + _this->m_EditCheat),Cheat.c_str()); - _Settings->SaveString((SettingID)(CheatNotes + _this->m_EditCheat),GetDlgItemStr(hDlg,IDC_NOTES).c_str()); - _Settings->SaveString((SettingID)(CheatOptions + _this->m_EditCheat),Options.c_str()); + _Settings->SaveStringIndex(Cheat_Entry, _this->m_EditCheat,Cheat.c_str()); + _Settings->SaveStringIndex(Cheat_Notes, _this->m_EditCheat,GetDlgItemStr(hDlg,IDC_NOTES)); + _Settings->SaveStringIndex(Cheat_Options, _this->m_EditCheat,Options); _this->RecordCheatValues(hDlg); _this->RefreshCheatManager(); } @@ -815,7 +820,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO break; } - stdstr CheatEntryStr = _Settings->LoadString((SettingID)(CheatEntry + _this->m_EditCheat)); + stdstr CheatEntryStr = _Settings->LoadStringIndex(Cheat_Entry,_this->m_EditCheat); LPCSTR String = CheatEntryStr.c_str(); //Set Cheat Name @@ -845,7 +850,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO SetDlgItemText((HWND)hDlg,IDC_CHEAT_CODES,Buffer.c_str()); //Add option values to screen - stdstr CheatOptionStr = _Settings->LoadString((SettingID)(CheatOptions + _this->m_EditCheat)); + stdstr CheatOptionStr = _Settings->LoadStringIndex(Cheat_Options,_this->m_EditCheat); ReadPos = strchr(CheatOptionStr.c_str(),'$'); Buffer.erase(); if (ReadPos) { @@ -868,7 +873,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO SetDlgItemText((HWND)hDlg,IDC_CHEAT_OPTIONS,Buffer.c_str()); //Add cheat Notes - stdstr CheatNotesStr = _Settings->LoadString((SettingID)(CheatNotes + _this->m_EditCheat)); + stdstr CheatNotesStr = _Settings->LoadStringIndex(Cheat_Notes,_this->m_EditCheat); SetDlgItemText((HWND)hDlg,IDC_NOTES,CheatNotesStr.c_str()); @@ -984,7 +989,7 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW TreeView_HitTest(lpnmh->hwndFrom, &ht); _this->m_hSelectedItem = (WND_HANDLE)ht.hItem; - if (_Settings->LoadDword(BasicMode)) { return true; } + if (_Settings->LoadBool(UserInterface_BasicMode)) { return true; } //Show Menu HMENU hMenu = LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_CHEAT_MENU)); @@ -1031,12 +1036,13 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW item.mask = TVIF_PARAM ; item.hItem = (HTREEITEM)ht.hItem; TreeView_GetItem((HWND)_this->m_hCheatTree,&item); - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatEntry + item.lParam)); - if (CheatUsesCodeExtensions(LineEntry)) { - if (_Settings->LoadString((SettingID)(CheatExtension + item.lParam)) ==_Settings->LoadString(Default_CheatExt)) { + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,item.lParam); + if (CheatUsesCodeExtensions(LineEntry)) + { + stdstr CheatExtension; + if (!_Settings->LoadStringIndex(Cheat_Extension,item.lParam,CheatExtension)) + { SendMessage((HWND)hDlg, UM_CHANGECODEEXTENSION, 0, (LPARAM)ht.hItem); - } - if (_Settings->LoadString((SettingID)(CheatExtension + item.lParam)) ==_Settings->LoadString(Default_CheatExt)) { TV_SetCheckState(_this->m_hCheatTree,(WND_HANDLE)ht.hItem,TV_STATE_CLEAR); break; } @@ -1089,7 +1095,7 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW item.hItem = hItem; TreeView_GetItem((HWND)_this->m_hCheatTree,&item); - stdstr Notes(_Settings->LoadString((SettingID)(CheatNotes + item.lParam))); + stdstr Notes(_Settings->LoadStringIndex(Cheat_Notes,item.lParam)); SetDlgItemText((HWND)hDlg,IDC_NOTES,Notes.c_str()); if (_this->m_AddCheat) { @@ -1113,15 +1119,17 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW TreeView_GetItem((HWND)_this->m_hCheatTree,&item); //Make sure the selected line can use code extensions - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatEntry + item.lParam)); + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,item.lParam); if (!CheatUsesCodeExtensions(LineEntry)) { break; } - stdstr Options(_Settings->LoadString((SettingID)(CheatOptions + item.lParam))); - if (Options.length() > 0) { + stdstr Options; + if (_Settings->LoadStringIndex(Cheat_Options,item.lParam,Options) && Options.length() > 0) + { DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_CodeEx),(HWND)hDlg,(DLGPROC)CheatsCodeExProc,(LPARAM)_this); } else { - stdstr Range(_Settings->LoadString((SettingID)(CheatRange + item.lParam))); - if (Range.length() > 0) { + stdstr Range; + if (_Settings->LoadStringIndex(Cheat_Range,item.lParam,Range) && Range.length() > 0) + { DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_Range),(HWND)hDlg,(DLGPROC)CheatsCodeQuantProc,(LPARAM)_this); } } @@ -1168,8 +1176,8 @@ int CALLBACK CCheats::CheatsCodeExProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, SetDlgItemText((HWND)hDlg,IDC_CHEAT_NAME,CheatName.c_str()); //Read through and add all options to the list box - stdstr Options(_Settings->LoadString((SettingID)(CheatOptions + item.lParam))); - stdstr CurrentExt(_Settings->LoadString((SettingID)(CheatExtension + item.lParam))); + stdstr Options(_Settings->LoadStringIndex(Cheat_Options,item.lParam)); + stdstr CurrentExt(_Settings->LoadStringIndex(Cheat_Extension,item.lParam)); const char * ReadPos = Options.c_str(); while (*ReadPos != 0) { const char * NextComma = strchr(ReadPos,','); @@ -1206,7 +1214,7 @@ int CALLBACK CCheats::CheatsCodeExProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, if (index < 0) { index = 0; } SendMessage(GetDlgItem((HWND)hDlg,IDC_CHEAT_LIST),LB_GETTEXT,index,(LPARAM)CheatExten); - _Settings->SaveString((SettingID)(CheatExtension + item.lParam),CheatExten); + _Settings->SaveStringIndex(Cheat_Extension,item.lParam,CheatExten); _this->m_CheatSelectionChanged = true; } RemoveProp((HWND)hDlg,"Class"); @@ -1238,9 +1246,9 @@ int CALLBACK CCheats::CheatsCodeQuantProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wPar item.mask = TVIF_PARAM ; TreeView_GetItem((HWND)_this->m_hCheatTree,&item); stdstr CheatName = _this->GetCheatName(item.lParam,false); - stdstr RangeNote(_Settings->LoadString((SettingID)(CheatRangeNotes + item.lParam))); - stdstr Range(_Settings->LoadString((SettingID)(CheatRange + item.lParam))); - stdstr Value(_Settings->LoadString((SettingID)(CheatExtension + item.lParam))); + stdstr RangeNote(_Settings->LoadStringIndex(Cheat_RangeNotes, item.lParam)); + stdstr Range(_Settings->LoadStringIndex(Cheat_Range,item.lParam)); + stdstr Value(_Settings->LoadStringIndex(Cheat_Extension,item.lParam)); //Set up language support for dialog SetWindowText((HWND)hDlg, GS(CHEAT_CODE_EXT_TITLE)); @@ -1306,7 +1314,7 @@ int CALLBACK CCheats::CheatsCodeQuantProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wPar if (Value < Start) { Value = Start; } sprintf(CheatExten,"$%X",Value); - _Settings->SaveString((SettingID)(CheatExtension + item.lParam),CheatExten); + _Settings->SaveStringIndex(Cheat_Extension, item.lParam,CheatExten); _this->m_CheatSelectionChanged = true; } RemoveProp((HWND)hDlg,"Class"); @@ -1350,7 +1358,7 @@ int CALLBACK CCheats::ManageCheatsProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, ShowWindow((HWND)_this->m_hSelectCheat,SW_SHOW); RECT * rc = &WndPlac.rcNormalPosition; - if (_Settings->LoadDword(BasicMode)) + if (_Settings->LoadDword(UserInterface_BasicMode)) { RECT * rcAdd = (RECT *)_this->m_rcAdd, * rcList = (RECT *)_this->m_rcList; GetWindowRect(GetDlgItem((HWND)_this->m_hSelectCheat, IDC_CHEATSFRAME), rcList); @@ -1538,16 +1546,18 @@ void CCheats::ChangeChildrenStatus(WND_HANDLE hParent, bool Checked) { //if cheat uses a extension and it is not set then do not set it if (Checked) { - stdstr LineEntry = _Settings->LoadString((SettingID)(CheatEntry + item.lParam)); + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,item.lParam); if (CheatUsesCodeExtensions(LineEntry)) { - if (_Settings->LoadString((SettingID)(CheatExtension + item.lParam)) ==_Settings->LoadString(Default_CheatExt)) { + stdstr CheatExten; + if (!_Settings->LoadStringIndex(Cheat_Extension,item.lParam,CheatExten) || CheatExten.empty()) + { return; } } } //Save Cheat TV_SetCheckState(m_hCheatTree,hParent,Checked?TV_STATE_CHECKED:TV_STATE_CLEAR); - _Settings->SaveDword((SettingID)(CheatActive + item.lParam),Checked); + _Settings->SaveDwordIndex(Cheat_Active,item.lParam,Checked); return; } TV_CHECK_STATE state = TV_STATE_UNKNOWN; diff --git a/Source/Project64/N64 System/Cheat Class.h b/Source/Project64/N64 System/Cheat Class.h index 2f2605f28..807e01023 100644 --- a/Source/Project64/N64 System/Cheat Class.h +++ b/Source/Project64/N64 System/Cheat Class.h @@ -7,6 +7,7 @@ class CCheats { typedef std::vector CODES; typedef std::vector CODES_ARRAY; + enum { MaxCheats = 50000 }; CNotification * const _Notify; CN64Rom * const _Rom; diff --git a/Source/Project64/N64 System/Debugger/vssver2.scc b/Source/Project64/N64 System/Debugger/vssver2.scc deleted file mode 100644 index c44d89bdf..000000000 Binary files a/Source/Project64/N64 System/Debugger/vssver2.scc and /dev/null differ diff --git a/Source/Project64/N64 System/Mips/Memory.cpp b/Source/Project64/N64 System/Mips/Memory.cpp index ab460cccc..da5bb831e 100644 --- a/Source/Project64/N64 System/Mips/Memory.cpp +++ b/Source/Project64/N64 System/Mips/Memory.cpp @@ -86,7 +86,7 @@ void CMipsMemory::AllocateSystemMemory (void) } DWORD RdramMemorySize = 0x20000000; - if ((CPU_TYPE)_Settings->LoadDword(ROM_CPUType) == CPU_SyncCores) + if ((CPU_TYPE)_Settings->LoadDword(Game_CpuType) == CPU_SyncCores) { RdramMemorySize = 0x18000000; } @@ -107,7 +107,7 @@ void CMipsMemory::AllocateSystemMemory (void) DMEM = (unsigned char *)(RDRAM+0x04000000); IMEM = (unsigned char *)(RDRAM+0x04001000); - if (_Settings->LoadDword(RomInMemory)) + if (_Settings->LoadBool(Game_LoadRomToMemory)) { if(VirtualAlloc(RDRAM + 0x10000000, m_RomFileSize, MEM_COMMIT, PAGE_READWRITE)==NULL) { _Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR)); @@ -129,7 +129,7 @@ bool CMipsMemory::AllocateRecompilerMemory ( bool AllocateJumpTable ) JumpTable = NULL; if (AllocateJumpTable) { - DWORD JumpTableSize = _Settings->LoadDword(RomInMemory) ? 0x20000000 : 0x10000000; + DWORD JumpTableSize = _Settings->LoadDword(Game_LoadRomToMemory) ? 0x20000000 : 0x10000000; JumpTable = (void **)VirtualAlloc( NULL, JumpTableSize, MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE ); if( JumpTable == NULL ) { _Notify->DisplayError(MSG_MEM_ALLOC_ERROR); @@ -147,7 +147,7 @@ bool CMipsMemory::AllocateRecompilerMemory ( bool AllocateJumpTable ) return FALSE; } - if (_Settings->LoadDword(RomInMemory)) + if (_Settings->LoadDword(Game_LoadRomToMemory)) { if(VirtualAlloc((BYTE *)JumpTable + 0x10000000, m_RomFileSize, MEM_COMMIT, PAGE_READWRITE)==NULL) { _Notify->DisplayError(MSG_MEM_ALLOC_ERROR); @@ -193,7 +193,7 @@ void CMipsMemory::CheckRecompMem( BYTE * RecompPos ) } void CMipsMemory::FixRDramSize ( void ) { - if (_Settings->LoadDword(RamSize) != m_AllocatedRdramSize) { + if (_Settings->LoadDword(Game_RDRamSize) != m_AllocatedRdramSize) { if (m_AllocatedRdramSize == 0x400000) { if (VirtualAlloc(RDRAM + 0x400000, 0x400000, MEM_COMMIT, PAGE_READWRITE)==NULL) { _Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR)); @@ -213,25 +213,31 @@ bool CMipsMemory::Store64 ( DWORD VAddr, QWORD Value, MemorySize Size ) { _Notify->BreakPoint(__FILE__,__LINE__); return false; } - if (PAddr > _Settings->LoadDword(RamSize) && + if (PAddr > _Settings->LoadDword(Game_RDRamSize) && (PAddr < 0x04000000 || PAddr > 0x04002000)) { -// switch (Size) { -// case _16Bit: -// if (!StoreHalf_NonMemory(PAddr,static_cast(Value))) { -// MemoryFilterFailed("Store word",PAddr,PROGRAM_COUNTER, static_cast(Value)); -// } -// return true; -// break; -// case _32Bit: -// if (!StoreWord_NonMemory(PAddr,static_cast(Value))) { -// MemoryFilterFailed("Store word",PAddr,PROGRAM_COUNTER, static_cast(Value)); -// } -// return true; -// break; -// default: + switch (Size) { + case _8Bit: + if (!StoreByte_NonMemory(PAddr,static_cast(Value))) { + //MemoryFilterFailed("Store word",PAddr,PROGRAM_COUNTER, static_cast(Value)); + } + return true; + break; + case _16Bit: + if (!StoreHalf_NonMemory(PAddr,static_cast(Value))) { + //MemoryFilterFailed("Store word",PAddr,PROGRAM_COUNTER, static_cast(Value)); + } + return true; + break; + case _32Bit: + if (!StoreWord_NonMemory(PAddr,static_cast(Value))) { + //MemoryFilterFailed("Store word",PAddr,PROGRAM_COUNTER, static_cast(Value)); + } + return true; + break; + default: _Notify->BreakPoint(__FILE__,__LINE__); -// } + } return false; } @@ -356,7 +362,7 @@ bool CMipsMemory::LoadPhysical32 ( DWORD PAddr, DWORD & Variable, MemorySize Siz } void CMipsMemory::MemoryFilterFailed( char * FailureType, DWORD MipsAddress, DWORD x86Address, DWORD Value) { - if (_Settings->LoadDword(ShowUnhandledMemory)) { + if (_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { _Notify->DisplayError("Failed to %s\n\nProgram Counter: %X\nMIPS Address: %08X\nX86 Address: %X\n Value: %X", FailureType, _Reg->PROGRAM_COUNTER, MipsAddress, x86Address, Value); } @@ -373,7 +379,7 @@ bool CMipsMemory::Load64 ( DWORD VAddr, QWORD & Variable, MemorySize Size, bool if (!TranslateVaddr(VAddr,PAddr)) { return false; } - if (PAddr > _Settings->LoadDword(RamSize) && + if (PAddr > _Settings->LoadDword(Game_RDRamSize) && (PAddr < 0x04000000 || PAddr > 0x04002000)) { switch (Size) { @@ -629,7 +635,7 @@ bool CMipsMemory::Store64 ( DWORD VAddr, QWORD Value, MemorySize Size ) { _Notify->BreakPoint(__FILE__,__LINE__); return false; } - if (PAddr > _Settings->LoadDword(RamSize) && + if (PAddr > _Settings->LoadDword(Game_RDRamSize) && (PAddr < 0x04000000 || PAddr > 0x04002000)) { switch (Size) { @@ -699,7 +705,7 @@ bool CMipsMemory::StoreByte_NonMemory ( DWORD PAddr, BYTE Value ) { case 0x00500000: case 0x00600000: case 0x00700000: - if (PAddr < _Settings->LoadDword(RamSize)) { + if (PAddr < _Settings->LoadDword(Game_RDRamSize)) { // CRecompiler * Recomp = _System->GetRecompiler(); // if (Recomp) { // Recomp->ClearRecomplierCode(PAddr + 0x80000000,1); @@ -727,7 +733,7 @@ bool CMipsMemory::StoreHalf_NonMemory ( DWORD PAddr, WORD Value ) { case 0x00500000: case 0x00600000: case 0x00700000: - if (PAddr < _Settings->LoadDword(RamSize)) { + if (PAddr < _Settings->LoadDword(Game_RDRamSize)) { // CRecompiler * Recomp = _System->GetRecompiler(); // if (Recomp) { // Recomp->ClearRecomplierCode(PAddr + 0x80000000,1); @@ -765,7 +771,7 @@ bool CMipsMemory::StoreWord_NonMemory ( DWORD PAddr, DWORD Value ) { case 0x00500000: case 0x00600000: case 0x00700000: - if (PAddr < _Settings->LoadDword(RamSize)) { + if (PAddr < _Settings->LoadDword(Game_RDRamSize)) { // CRecompiler * Recomp = _System->GetRecompiler(); // if (Recomp) { // Recomp->ClearRecomplierCode(PAddr + 0x80000000,4); @@ -1144,7 +1150,7 @@ int CMipsMemory::SystemMemoryFilter( DWORD dwExptCode, void * lpExceptionPointer int End = (Start + (lpEP->ContextRecord->Ecx << 2) - 1); if ((int)Start < 0) { _Notify->BreakPoint(__FILE__,__LINE__); } - if ((int)End < _Settings->LoadDword(RamSize)) { + if ((int)End < _Settings->LoadDword(Game_RDRamSize)) { for ( int count = Start & ~0x1000; count < End; count += 0x1000 ) { CBClass->WriteToProtectedMemory(Start, 0xFFF); } diff --git a/Source/Project64/N64 System/Mips/OpCode Class.cpp b/Source/Project64/N64 System/Mips/OpCode Class.cpp index f51ca89a7..96a786860 100644 --- a/Source/Project64/N64 System/Mips/OpCode Class.cpp +++ b/Source/Project64/N64 System/Mips/OpCode Class.cpp @@ -27,8 +27,8 @@ COpcode::COpcode ( CMipsMemory * MMU, DWORD VirtualAddress ): _MMU(MMU), _Reg(MMU->SystemRegisters()), m_OpLen(OpCode_Size), - m_OpcodeCount(_Settings->LoadDword(CounterFactor)), - m_FixedOpcodeCount(_Settings->LoadDword(CounterFactor) != 0) + m_OpcodeCount(_Settings->LoadDword(Game_CounterFactor)), + m_FixedOpcodeCount(_Settings->LoadDword(Game_CounterFactor) != 0) { //setup details about handling opcodes m_NextStep = StepNormal; diff --git a/Source/Project64/N64 System/Mips/TLB class.cpp b/Source/Project64/N64 System/Mips/TLB class.cpp index ee42911d7..ca3cea9f1 100644 --- a/Source/Project64/N64 System/Mips/TLB class.cpp +++ b/Source/Project64/N64 System/Mips/TLB class.cpp @@ -55,11 +55,11 @@ void CTLB::TLB_Reset (bool InvalidateTLB) { for (count = 0; count < 32; count ++) { SetupTLB_Entry(count,false); } //GE Hack - if (_Settings->LoadDword(ROM_TLB_VAddrStart) != 0) + if (_Settings->LoadDword(Rdb_TLB_VAddrStart) != 0) { - DWORD Start = _Settings->LoadDword(ROM_TLB_VAddrStart); //0x7F000000; - DWORD Len = _Settings->LoadDword(ROM_TLB_VAddrLen); //0x01000000; - DWORD PAddr = _Settings->LoadDword(ROM_TLB_PAddrStart); //0x10034b30; + DWORD Start = _Settings->LoadDword(Rdb_TLB_VAddrStart); //0x7F000000; + DWORD Len = _Settings->LoadDword(Rdb_TLB_VAddrLen); //0x01000000; + DWORD PAddr = _Settings->LoadDword(Rdb_TLB_PAddrStart); //0x10034b30; DWORD End = Start + Len; for (count = Start; count < End; count += 0x1000) { TLB_ReadMap[count >> 12] = ((DWORD)m_BasePAddr + (count - Start + PAddr)) - count; diff --git a/Source/Project64/N64 System/Mips/vssver2.scc b/Source/Project64/N64 System/Mips/vssver2.scc deleted file mode 100644 index f0f405c7a..000000000 Binary files a/Source/Project64/N64 System/Mips/vssver2.scc and /dev/null differ diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index a807c2d60..5a977ba5c 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -10,7 +10,8 @@ CN64System::CN64System ( CNotification * Notify, CPlugins * Plugins ): CDebugger(this,_MMU),_Notify(Notify),FPS(Notify),m_CPU_Usage(Notify),m_Profile(Notify), m_Limitor(Notify), _Plugins(Plugins),_Cheats(NULL),_SyncCPU(NULL),_Recomp(NULL), - m_InReset(false), EndEmulation(false), m_OwnRomObject(false), _Audio(NULL) + m_InReset(false), EndEmulation(false), m_OwnRomObject(false), _Audio(NULL), + m_bCleanFrameBox(true) { _Rom = 0; //No rom loaded _MMU = 0; //Since no rom can be loaded, then no system has been created @@ -77,60 +78,60 @@ void CN64System::ExternalEvent ( SystemEvent Event ) { g_CPU_Action->DoSomething = TRUE; break; case CPUUsageTimerChanged: - g_ShowCPUPer = _Settings->LoadDword(ShowCPUPer); + g_ShowCPUPer = _Settings->LoadDword(UserInterface_ShowCPUPer); break; case PauseCPU_FromMenu: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { - _Settings->SaveDword(CPU_Paused_type, PauseType_FromMenu); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_FromMenu); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } break; case PauseCPU_AppLostFocus: - if (!_Settings->LoadDword(CPU_Paused) && !g_CPU_Action->Pause) + if (!_Settings->LoadBool(GameRunning_CPU_Paused) && !g_CPU_Action->Pause) { - _Settings->SaveDword(CPU_Paused_type, PauseType_AppLostFocus); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostFocus); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } break; case PauseCPU_AppLostActive: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; - _Settings->SaveDword(CPU_Paused_type, PauseType_AppLostActive); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostActive); } break; case PauseCPU_SaveGame: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { - _Settings->SaveDword(CPU_Paused_type, PauseType_SaveGame); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SaveGame); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } break; case PauseCPU_LoadGame: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { - _Settings->SaveDword(CPU_Paused_type, PauseType_LoadGame); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_LoadGame); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } break; case PauseCPU_DumpMemory: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { - _Settings->SaveDword(CPU_Paused_type, PauseType_DumpMemory); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_DumpMemory); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } break; case PauseCPU_SearchMemory: - if (!_Settings->LoadDword(CPU_Paused)) + if (!_Settings->LoadBool(GameRunning_CPU_Paused)) { - _Settings->SaveDword(CPU_Paused_type, PauseType_SearchMemory); + _Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SearchMemory); g_CPU_Action->Pause = TRUE; g_CPU_Action->DoSomething = TRUE; } @@ -140,37 +141,37 @@ void CN64System::ExternalEvent ( SystemEvent Event ) { SetEvent(m_hPauseEvent); break; case ResumeCPU_AppGainedFocus: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_AppLostFocus ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_AppLostFocus ) { SetEvent(m_hPauseEvent); } break; case ResumeCPU_AppGainedActive: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_AppLostActive ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_AppLostActive ) { SetEvent(m_hPauseEvent); } break; case ResumeCPU_SaveGame: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_SaveGame ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_SaveGame ) { SetEvent(m_hPauseEvent); } break; case ResumeCPU_LoadGame: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_LoadGame ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_LoadGame ) { SetEvent(m_hPauseEvent); } break; case ResumeCPU_DumpMemory: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_DumpMemory ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_DumpMemory ) { SetEvent(m_hPauseEvent); } break; case ResumeCPU_SearchMemory: - if (_Settings->LoadDword(CPU_Paused_type) == PauseType_SearchMemory ) + if (_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_SearchMemory ) { SetEvent(m_hPauseEvent); } @@ -188,7 +189,7 @@ void CN64System::ExternalEvent ( SystemEvent Event ) { Reset(); _Rom = TempRom; - m_Limitor.SetHertz(_Settings->LoadDword(ScreenHertz)); //Is set in LoadRomSettings + m_Limitor.SetHertz(_Settings->LoadDword(Game_ScreenHertz)); //Is set in LoadRomSettings //Recreate Memory _MMU = new CMipsMemory(this,this,_Rom,_Notify, new CRegisters(this, _Notify)); @@ -241,17 +242,17 @@ void CN64System::ExternalEvent ( SystemEvent Event ) { void CN64System::RunFileImage ( const char * FileLoc ) { - bool RomLoading = _Settings->LoadBool(LoadingRom); + bool RomLoading = _Settings->LoadBool(Info_RomLoading); if (!RomLoading) { - FileImageInfo * Info = new FileImageInfo; + _Settings->SaveBool(Info_RomLoading,true); + HANDLE * hThread = new HANDLE; *hThread = NULL; - _Settings->SaveDword(LoadingRom,(DWORD)true); - //create the needed info into a structure to pass as one paramater //for createing a thread + FileImageInfo * Info = new FileImageInfo; Info->_this = this; Info->FileName = FileLoc; Info->ThreadHandle = hThread; @@ -260,10 +261,11 @@ void CN64System::RunFileImage ( const char * FileLoc ) } } -void CN64System::LoadFileImage ( FileImageInfo * Info ) { +void CN64System::LoadFileImage ( FileImageInfo * Info ) +{ CoInitialize(NULL); - //Make a copy of the passed infomation on to the stack, then free + //Make a copy of the passed information on to the stack, then free //the memory used WriteTrace(TraceDebug,"CN64System::LoadFileImage 1"); FileImageInfo ImageInfo = *Info; @@ -275,7 +277,7 @@ void CN64System::LoadFileImage ( FileImageInfo * Info ) { WriteTrace(TraceDebug,"CN64System::LoadFileImage 2"); //Mark the rom as loading - _Settings->SaveDword(LoadingRom,(DWORD)true); + _Settings->SaveBool(Info_RomLoading,true); _this->_Notify->RefreshMenu(); WriteTrace(TraceDebug,"CN64System::LoadFileImage 3"); @@ -285,7 +287,7 @@ void CN64System::LoadFileImage ( FileImageInfo * Info ) { if (!Rom->LoadN64Image(ImageInfo.FileName.c_str())) { _this->_Notify->DisplayError(Rom->GetError()); delete Rom; - _Settings->SaveDword(LoadingRom,(DWORD)false); + _Settings->SaveBool(Info_RomLoading,false); _this->_Notify->RefreshMenu(); return; } @@ -296,19 +298,19 @@ void CN64System::LoadFileImage ( FileImageInfo * Info ) { WriteTrace(TraceDebug,"CN64System::LoadFileImage 5"); Rom->SaveRomSettingID(); - { + /*{ stdstr &Name = Rom->GetRomName(); _Settings->SaveString(ROM_InternalName,Name.c_str()); - } + }*/ WriteTrace(TraceDebug,"CN64System::LoadFileImage 6"); _this->_Notify->AddRecentRom(ImageInfo.FileName.c_str()); WriteTrace(TraceDebug,"CN64System::LoadFileImage 7"); _this->SetupSystem(Rom,true); WriteTrace(TraceDebug,"CN64System::LoadFileImage 8"); - _Settings->SaveDword(LoadingRom,(DWORD)false); + _Settings->SaveBool(Info_RomLoading,false); _this->_Notify->RefreshMenu(); WriteTrace(TraceDebug,"CN64System::LoadFileImage 9"); - if (_Settings->LoadDword(AutoStart) != 0) + if (_Settings->LoadDword(Setting_AutoStart) != 0) { _this->CPU_Handle = (void *)(*((DWORD *)ImageInfo.ThreadHandle)); _this->CPU_ThreadID = ImageInfo.ThreadID; @@ -332,7 +334,6 @@ void CN64System::LoadFileImage ( FileImageInfo * Info ) { } else { delete ImageInfo.ThreadHandle; //Load rom settings - _this->_Rom->LoadRomSettings(); _this->_Notify->DisplayMessage(5,MSG_WAITING_FOR_START); } WriteTrace(TraceDebug,"CN64System::LoadFileImage 10"); @@ -362,13 +363,13 @@ void CN64System::StartEmulation2 ( bool NewThread ) _Notify->HideRomBrowser(); WriteTrace(TraceDebug,"CN64System::StartEmulation 3"); - RefreshSettings(); + //RefreshSettings(); WriteTrace(TraceDebug,"CN64System::StartEmulation 4"); - m_Limitor.SetHertz(_Settings->LoadDword(ScreenHertz)); //Is set in LoadRomSettings + m_Limitor.SetHertz(_Settings->LoadDword(Game_ScreenHertz)); WriteTrace(TraceDebug,"CN64System::StartEmulation 5"); _MMU->FixRDramSize(); - _Notify->SetWindowCaption(_Settings->LoadString(ROM_NAME).c_str()); + _Notify->SetWindowCaption(_Settings->LoadString(Game_GoodName).c_str()); WriteTrace(TraceDebug,"CN64System::StartEmulation 6"); _Notify->DisplayMessage(5,MSG_PLUGIN_INIT); @@ -377,7 +378,7 @@ void CN64System::StartEmulation2 ( bool NewThread ) WriteTrace(TraceDebug,"CN64System::StartEmulation 8"); if (!_Plugins->Initiate(this)) { WriteTrace(TraceDebug,"CN64System::StartEmulation 8a"); - _Settings->SaveDword(LoadingRom,(DWORD)false); + _Settings->SaveBool(Info_RomLoading,false); _Notify->DisplayError(MSG_PLUGIN_NOT_INIT); //Set handle to NULL so this thread is not terminated CPU_Handle = NULL; @@ -392,15 +393,15 @@ void CN64System::StartEmulation2 ( bool NewThread ) WriteTrace(TraceDebug,"CN64System::StartEmulation 9"); _Cheats = new CCheats(_Rom,_Notify); WriteTrace(TraceDebug,"CN64System::StartEmulation 10"); - _Cheats->LoadCheats(!_Settings->LoadDword(RememberCheats)); + _Cheats->LoadCheats(!_Settings->LoadDword(Setting_RememberCheats)); WriteTrace(TraceDebug,"CN64System::StartEmulation 11"); _Notify->DisplayMessage(5,"Done"); WriteTrace(TraceDebug,"CN64System::StartEmulation 12"); - _Notify->MakeWindowOnTop(_Settings->LoadDword(AlwaysOnTop) != 0); + _Notify->MakeWindowOnTop(_Settings->LoadBool(UserInterface_AlwaysOnTop)); WriteTrace(TraceDebug,"CN64System::StartEmulation 13"); - if (!_Settings->LoadDword(IsValidExe)) + if (!_Settings->LoadBool(Beta_IsValidExe)) { Reset(); return; @@ -409,10 +410,10 @@ void CN64System::StartEmulation2 ( bool NewThread ) //mark the emulation as starting and fix up menus _Notify->DisplayMessage(5,MSG_EMULATION_STARTED); WriteTrace(TraceDebug,"CN64System::StartEmulation 15"); - if (_Settings->LoadDword(AutoFullScreen)) + if (_Settings->LoadBool(Setting_AutoFullscreen)) { - CIniFile RomIniFile(_Settings->LoadString(RomDatabaseFile).c_str()); - stdstr Status = _Settings->LoadString(ROM_Status); + CIniFile RomIniFile(_Settings->LoadString(SupportFile_RomDatabase).c_str()); + stdstr Status = _Settings->LoadString(Rdb_Status); char String[100]; RomIniFile.GetString("Rom Status",stdstr_f("%s.AutoFullScreen", Status.c_str).c_str(),"true",String,sizeof(String)); @@ -458,7 +459,7 @@ void CN64System::CloseCpu ( void ) { if (CPU_Handle == NULL) { return; } Debug_Reset(); - if (_Settings->LoadDword(CPU_Paused)) + if (_Settings->LoadBool(GameRunning_CPU_Paused)) { SetEvent(m_hPauseEvent); } @@ -515,12 +516,12 @@ void CN64System::DisplayRomInfo ( WND_HANDLE hParent ) { void CN64System::Pause(void) { ResetEvent(m_hPauseEvent); - _Settings->SaveDword(CPU_Paused,true); + _Settings->SaveBool(GameRunning_CPU_Paused,true); _Notify->RefreshMenu(); _Notify->DisplayMessage(5,MSG_CPU_PAUSED); WaitForSingleObject(m_hPauseEvent, INFINITE); ResetEvent(m_hPauseEvent); - _Settings->SaveDword(CPU_Paused,(DWORD)false); + _Settings->SaveBool(GameRunning_CPU_Paused,(DWORD)false); _Notify->RefreshMenu(); _Notify->DisplayMessage(5,MSG_CPU_RESUMED); } @@ -532,7 +533,7 @@ stdstr CN64System::ChooseFileToOpen ( WND_HANDLE hParent ) { memset(&FileName, 0, sizeof(FileName)); memset(&openfilename, 0, sizeof(openfilename)); - strcpy(Directory,_Settings->LoadString(RomDirectory).c_str()); + strcpy(Directory,_Settings->LoadString(Directory_Game).c_str()); openfilename.lStructSize = sizeof( openfilename ); openfilename.hwndOwner = (HWND)hParent; @@ -544,7 +545,7 @@ stdstr CN64System::ChooseFileToOpen ( WND_HANDLE hParent ) { if (GetOpenFileName (&openfilename)) { return stdstr(FileName); - } + } return stdstr(""); } @@ -614,9 +615,6 @@ void CN64System::SetupSystem ( CN64Rom * Rom, bool OwnRomObject, bool SavesRead m_OwnRomObject = OwnRomObject; _Rom = Rom; - //Load rom settings - _Rom->LoadRomSettings(); - //Create New system _MMU = new CMipsMemory(this,this,_Rom,_Notify,new CRegisters(this, _Notify),SavesReadOnly); _Reg = _MMU->SystemRegisters(); @@ -639,11 +637,10 @@ void CN64System::SetupSystem ( CN64Rom * Rom, bool OwnRomObject, bool SavesRead } -void CN64System::ExecuteCPU ( void ) { - m_SPHack = _Settings->LoadDword(ROM_SPHack) != 0; - - _Settings->SaveDword(CPU_Running,true); - _Settings->SaveDword(CPU_Paused,(DWORD)false); +void CN64System::ExecuteCPU ( void ) +{ + _Settings->SaveBool(GameRunning_CPU_Running,true); + _Settings->SaveBool(GameRunning_CPU_Paused,false); _Notify->DisplayMessage(5,MSG_EMULATION_STARTED); EndEmulation = false; @@ -654,7 +651,7 @@ void CN64System::ExecuteCPU ( void ) { // C_Core.SetN64System(NULL); C_Core.SetSyncCpu(NULL); - switch ((CPU_TYPE)_Settings->LoadDword(CPUType)) { + switch ((CPU_TYPE)_Settings->LoadDword(Game_CpuType)) { case CPU_Recompiler: ExecuteRecompiler(C_Core); break; case CPU_SyncCores: ExecuteSyncCPU(C_Core); break; default: ExecuteInterpret(C_Core); break; @@ -677,8 +674,10 @@ void CN64System::ExecuteRecompiler (CC_Core & C_Core) { Recompiler.Run(); } -void CN64System::ExecuteSyncCPU (CC_Core & C_Core) { - //execute opcodes while no errors +void CN64System::ExecuteSyncCPU (CC_Core & C_Core) +{ + Notify().BreakPoint(__FILE__,__LINE__); +/* //execute opcodes while no errors _Notify->DisplayMessage(5,"Copy Plugins"); _Plugins->CopyPlugins(_Settings->LoadString(SyncPluginDir)); //copy the plugins @@ -710,23 +709,20 @@ void CN64System::ExecuteSyncCPU (CC_Core & C_Core) { InitializeCPUCore(); Recompiler.Run(); SyncSystem._Rom = NULL; - } + }*/ } void CN64System::CpuStopped ( void ) { void * lCPU_Handle = CPU_Handle; - _Settings->SaveDword(CPU_Running,(DWORD)false); + _Settings->SaveBool(GameRunning_CPU_Running,(DWORD)false); CleanCMemory(); - if (_Settings->LoadDword(InFullScreen)) - { - _Notify->ChangeFullScreen(); - } + _Notify->WindowMode(); if (!m_InReset) { _Notify->RefreshMenu(); _Notify->MakeWindowOnTop(false); _Notify->DisplayMessage(5,MSG_EMULATION_ENDED); - if (_Settings->LoadDword(RomBrowser)) { + if (_Settings->LoadDword(RomBrowser_Enabled)) { _Notify->ShowRomBrowser(); } } @@ -785,7 +781,7 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) { } } - if (m_SPHack) + if (bSPHack()) { if (_MMU->m_MemoryStack != (DWORD)(_MMU->RDRAM + (_Reg->GPR[29].W[0] & 0x1FFFFFFF))) { @@ -851,7 +847,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) { { Error.LogF("Current Time Type is Different: %X %X\r\n",_Reg->GetCurrentTimerType(),SecondCPU->_Reg->GetCurrentTimerType()); } - if (_Settings->LoadDword(ROM_SPHack)) + if (_Settings->LoadDword(Game_SPHack)) { if (_MMU->m_MemoryStack != (DWORD)(_MMU->RDRAM + (_Reg->GPR[29].W[0] & 0x1FFFFFFF))) { @@ -909,7 +905,8 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) { // AddEvent(CloseCPU); } -bool CN64System::SaveState(void) { +bool CN64System::SaveState(void) +{ WriteTrace(TraceDebug,"CN64System::SaveState 1"); if (_Reg->GetTimer(AiTimerDMA) != 0) { return false; } @@ -919,35 +916,35 @@ bool CN64System::SaveState(void) { if ((_Reg->STATUS_REGISTER & STATUS_EXL) != 0) { return false; } //Get the file Name - stdstr FileName, CurrentSaveName = _Settings->LoadString(InstantSaveFile); + stdstr FileName, CurrentSaveName = _Settings->LoadString(GameRunning_InstantSaveFile); if (CurrentSaveName.empty()) { - int Slot = _Settings->LoadDword(CurrentSaveState); + int Slot = _Settings->LoadDword(Game_CurrentSaveState); if (Slot != 0) { - CurrentSaveName.Format("%s.pj%d",_Settings->LoadString(ROM_GoodName).c_str(), Slot); + CurrentSaveName.Format("%s.pj%d",_Settings->LoadString(Game_GoodName).c_str(), Slot); } else { - CurrentSaveName.Format("%s.pj",_Settings->LoadString(ROM_GoodName).c_str()); + CurrentSaveName.Format("%s.pj",_Settings->LoadString(Game_GoodName).c_str()); } - FileName.Format("%s%s",_Settings->LoadString(InstantSaveDirectory).c_str(),CurrentSaveName.c_str()); + FileName.Format("%s%s",_Settings->LoadString(Directory_InstantSave).c_str(),CurrentSaveName.c_str()); stdstr_f ZipFileName("%s.zip",FileName.c_str()); //Make sure the target dir exists - CreateDirectory(_Settings->LoadString(InstantSaveDirectory).c_str(),NULL); + CreateDirectory(_Settings->LoadString(Directory_InstantSave).c_str(),NULL); //delete any old save DeleteFile(FileName.c_str()); DeleteFile(ZipFileName.c_str()); //If ziping save add .zip on the end - if (_Settings->LoadDword(AutoZip)) { + if (_Settings->LoadDword(Setting_AutoZipInstantSave)) { FileName = ZipFileName; } - _Settings->SaveDword(Game_LastSaveSlot,_Settings->LoadDword(CurrentSaveState)); + _Settings->SaveDword(Game_LastSaveSlot,_Settings->LoadDword(Game_CurrentSaveState)); } else { - FileName.Format("%s%s",CurrentSaveName.c_str(), _Settings->LoadDword(AutoZip) ? ".pj.zip" : ".pj"); + FileName.Format("%s%s",CurrentSaveName.c_str(), _Settings->LoadDword(Setting_AutoZipInstantSave) ? ".pj.zip" : ".pj"); } if (FileName.empty()) { return true; } //Open the file - if (_Settings->LoadDword(FuncLookupMode) == FuncFind_ChangeMemory) + if (_Settings->LoadDword(Game_FuncLookupMode) == FuncFind_ChangeMemory) { if (GetRecompiler()) { @@ -956,11 +953,11 @@ bool CN64System::SaveState(void) { } DWORD dwWritten, SaveID_0 = 0x23D8A6C8; - DWORD RdramSize = _Settings->LoadDword(RamSize); + DWORD RdramSize = _Settings->LoadDword(Game_RDRamSize); DWORD NextViTimer = _Reg->GetTimer(ViTimer); DWORD MiInterReg = _Reg->MI_INTR_REG; if (_Reg->GetTimer(AiTimer) != 0) { _Reg->MI_INTR_REG |= MI_INTR_AI; } - if (_Settings->LoadDword(AutoZip)) { + if (_Settings->LoadDword(Setting_AutoZipInstantSave)) { zipFile file; file = zipOpen(FileName.c_str(),0); @@ -1032,7 +1029,7 @@ bool CN64System::SaveState(void) { CloseHandle(hSaveFile); } _Reg->MI_INTR_REG = MiInterReg; - _Settings->SaveString(InstantSaveFile,""); + _Settings->SaveString(GameRunning_InstantSaveFile,""); stdstr SaveMessage = _Lang->GetString(MSG_SAVED_STATE); CPath SavedFileName(FileName); @@ -1043,27 +1040,28 @@ bool CN64System::SaveState(void) { return true; } -bool CN64System::LoadState(void) { - stdstr InstantFileName = _Settings->LoadString(InstantSaveFile); +bool CN64System::LoadState(void) +{ + stdstr InstantFileName = _Settings->LoadString(GameRunning_InstantSaveFile); if (!InstantFileName.empty()) { bool Result = LoadState(InstantFileName.c_str()); - _Settings->SaveString(InstantSaveFile,""); + _Settings->SaveString(GameRunning_InstantSaveFile,""); return Result; } CPath FileName; - FileName.SetDriveDirectory(_Settings->LoadString(InstantSaveDirectory).c_str()); - if (_Settings->LoadDword(CurrentSaveState) != 0) { - FileName.SetNameExtension(stdstr_f("%s.pj%d",_Settings->LoadString(ROM_GoodName).c_str(),_Settings->LoadDword(CurrentSaveState)).c_str()); + FileName.SetDriveDirectory(_Settings->LoadString(Directory_InstantSave).c_str()); + if (_Settings->LoadDword(Game_CurrentSaveState) != 0) { + FileName.SetNameExtension(stdstr_f("%s.pj%d",_Settings->LoadString(Game_GoodName).c_str(),_Settings->LoadDword(Game_CurrentSaveState)).c_str()); } else { - FileName.SetNameExtension(stdstr_f("%s.pj",_Settings->LoadString(ROM_GoodName).c_str()).c_str()); + FileName.SetNameExtension(stdstr_f("%s.pj",_Settings->LoadString(Game_GoodName).c_str()).c_str()); } CPath ZipFileName; ZipFileName = (stdstr&)FileName + ".zip"; - if ((_Settings->LoadDword(AutoZip) && ZipFileName.Exists()) || FileName.Exists()) + if ((_Settings->LoadDword(Setting_AutoZipInstantSave) && ZipFileName.Exists()) || FileName.Exists()) { if (LoadState(FileName)) { @@ -1072,10 +1070,10 @@ bool CN64System::LoadState(void) { } //Use old file Name - if (_Settings->LoadDword(CurrentSaveState) != 0) { - FileName.SetNameExtension(stdstr_f("%s.pj%d",_Settings->LoadString(ROM_NAME).c_str(),_Settings->LoadDword(CurrentSaveState)).c_str()); + if (_Settings->LoadDword(Game_CurrentSaveState) != 0) { + FileName.SetNameExtension(stdstr_f("%s.pj%d",_Settings->LoadString(Game_GameName).c_str(),_Settings->LoadDword(Game_CurrentSaveState)).c_str()); } else { - FileName.SetNameExtension(stdstr_f("%s.pj",_Settings->LoadString(ROM_NAME).c_str()).c_str()); + FileName.SetNameExtension(stdstr_f("%s.pj",_Settings->LoadString(Game_GameName).c_str()).c_str()); } return LoadState(FileName); } @@ -1090,7 +1088,7 @@ bool CN64System::LoadState(LPCSTR FileName) { _splitpath(FileName, drive, dir, fname, ext); stdstr FileNameStr(FileName); - if (_Settings->LoadDword(AutoZip) || _stricmp(ext,".zip") == 0) + if (_Settings->LoadDword(Setting_AutoZipInstantSave) || _stricmp(ext,".zip") == 0) { //If ziping save add .zip on the end if (_stricmp(ext,".zip") != 0) @@ -1137,10 +1135,10 @@ bool CN64System::LoadState(LPCSTR FileName) { MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2); if (result == IDNO) { return FALSE; } } - _MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(RamSize) - 4); + _MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(Game_RDRamSize) - 4); _MMU->UnProtectMemory(0xA4000000,0xA4001FFC); - if (SaveRDRAMSize != _Settings->LoadDword(RamSize)) { - _Settings->SaveDword(RamSize,SaveRDRAMSize); + if (SaveRDRAMSize != _Settings->LoadDword(Game_RDRamSize)) { + _Settings->SaveDword(Game_RDRamSize,SaveRDRAMSize); _MMU->FixRDramSize(); } unzReadCurrentFile(file,&NextVITimer,sizeof(NextVITimer)); @@ -1190,10 +1188,10 @@ bool CN64System::LoadState(LPCSTR FileName) { MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2); if (result == IDNO) { return FALSE; } } - _MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(RamSize) - 4); + _MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(Game_RDRamSize) - 4); _MMU->UnProtectMemory(0xA4000000,0xA4001FFC); - if (SaveRDRAMSize != _Settings->LoadDword(RamSize)) { - _Settings->SaveDword(RamSize,SaveRDRAMSize); + if (SaveRDRAMSize != _Settings->LoadDword(Game_RDRamSize)) { + _Settings->SaveDword(Game_RDRamSize,SaveRDRAMSize); _MMU->FixRDramSize(); } ReadFile( hSaveFile,&NextVITimer,sizeof(NextVITimer),&dwRead,NULL); @@ -1267,7 +1265,7 @@ bool CN64System::LoadState(LPCSTR FileName) { #endif _MMU->m_MemoryStack = (DWORD)(_MMU->RDRAM + (_Reg->GPR[29].W[0] & 0x1FFFFFFF)); - if (_Settings->LoadDword(CPUType) == CPU_SyncCores) { + if (_Settings->LoadDword(Game_CpuType) == CPU_SyncCores) { if (_SyncCPU) { for (int i = 0; i < (sizeof(m_LastSuccessSyncPC)/sizeof(m_LastSuccessSyncPC[0])); i++) { @@ -1285,7 +1283,7 @@ bool CN64System::LoadState(LPCSTR FileName) { // } } WriteTrace(TraceDebug,"CN64System::LoadState 13"); - _Settings->SaveDword(RamSize,SaveRDRAMSize); + _Settings->SaveDword(Game_RDRamSize,SaveRDRAMSize); WriteTrace(TraceDebug,"CN64System::LoadState 14"); stdstr LoadMsg = _Lang->GetString(MSG_LOADED_STATE); WriteTrace(TraceDebug,"CN64System::LoadState 15"); @@ -1322,10 +1320,10 @@ void CN64System::RunRSP ( void ) { m_UnknownCount += 1; break; } - if (bShowDListAListCount) { + if (bShowDListAListCount()) { _Notify->DisplayMessage(0,"Dlist: %d Alist: %d Unknown: %d",m_DlistCount,m_AlistCount,m_UnknownCount); } - if (bShowCPUPer) { + if (bShowCPUPer()) { switch (Task) { case 1: CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RSP_Dlist); break; case 2: CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RSP_Alist); break; @@ -1353,7 +1351,7 @@ void CN64System::RunRSP ( void ) { SP_STATUS_REG &= ~SP_STATUS_SIG2; }*/ - if (bShowCPUPer) { m_CPU_Usage.StartTimer(CPU_UsageAddr); } + if (bShowCPUPer()) { m_CPU_Usage.StartTimer(CPU_UsageAddr); } //if (bProfiling) { m_Profile.StartTimer(ProfileAddr); } WriteTrace(TraceRSP, "RunRSP: check interrupts"); @@ -1363,15 +1361,15 @@ void CN64System::RunRSP ( void ) { } void CN64System::SyncToAudio ( void ) { - if (!bBasicMode && !bLimitFPS ) + if (!bBasicMode() && !bLimitFPS() ) { return; } - if (!bFixedAudio) + if (!bFixedAudio()) { return; } - if (!bSyncToAudio) + if (!bSyncToAudio()) { return; } @@ -1391,7 +1389,7 @@ void CN64System::SyncToAudio ( void ) { } DWORD CPU_UsageAddr = Timer_None; - if (bShowCPUPer) + if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_Idel); } @@ -1403,7 +1401,7 @@ void CN64System::SyncToAudio ( void ) { break; } } - if (bShowCPUPer) + if (bShowCPUPer()) { m_CPU_Usage.StartTimer(CPU_UsageAddr != Timer_None ? CPU_UsageAddr : Timer_R4300 ); } @@ -1414,7 +1412,7 @@ void CN64System::RefreshScreen ( void ) { DWORD CPU_UsageAddr = Timer_None, ProfilingAddr = Timer_None; DWORD OLD_VI_V_SYNC_REG = 0, VI_INTR_TIME = 500000; - if (bShowCPUPer) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RefreshScreen); } + if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RefreshScreen); } //if (bProfiling) { ProfilingAddr = m_Profile.StartTimer(Timer_RefreshScreen); } //Calculate how many cycles to next refresh @@ -1433,7 +1431,7 @@ void CN64System::RefreshScreen ( void ) { } // _Plugins->Control()->UpdateKeys(); - if (bShowCPUPer) { m_CPU_Usage.StartTimer(Timer_UpdateScreen); } + if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_UpdateScreen); } // if (bProfiling) { m_Profile.StartTimer(Timer_UpdateScreen); } __try @@ -1446,26 +1444,26 @@ void CN64System::RefreshScreen ( void ) { WriteTrace(TraceError,"Exception caught in UpdateScreen"); } - if ((bBasicMode || bLimitFPS ) && !bSyncToAudio) { - if (bShowCPUPer) { m_CPU_Usage.StartTimer(Timer_Idel); } + if ((bBasicMode() || bLimitFPS() ) && !bSyncToAudio()) { + if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_Idel); } DWORD FrameRate; - if (m_Limitor.Timer_Process(&FrameRate) && bDisplayFrameRate) { + if (m_Limitor.Timer_Process(&FrameRate) && bDisplayFrameRate()) { FPS.DisplayViCounter(FrameRate); - bCleanFrameBox = true; + m_bCleanFrameBox = true; } - } else if (bDisplayFrameRate) { - if (bShowCPUPer) { m_CPU_Usage.StartTimer(Timer_UpdateFPS); } + } else if (bDisplayFrameRate()) { + if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_UpdateFPS); } FPS.UpdateViCounter(); - bCleanFrameBox = true; + m_bCleanFrameBox = true; } - if (bCleanFrameBox && !bDisplayFrameRate) + if (m_bCleanFrameBox && !bDisplayFrameRate()) { FPS.Reset (true); - bCleanFrameBox = false; + m_bCleanFrameBox = false; } - if (bShowCPUPer) { + if (bShowCPUPer()) { m_CPU_Usage.StopTimer(); m_CPU_Usage.ShowCPU_Usage(); m_CPU_Usage.StartTimer(CPU_UsageAddr != Timer_None ? CPU_UsageAddr : Timer_R4300 ); @@ -1491,7 +1489,7 @@ void CN64System::TLB_Changed ( void ) void CN64System::TLB_Unmapping ( int TlbEntry, int FastTlbEntry, DWORD Vaddr, DWORD Len ) { - if (_Recomp && _Recomp->bSMM_TLB) + if (_Recomp && _Recomp->bSMM_TLB()) { _Recomp->ClearRecompCode_Virt(Vaddr,Len,CRecompiler::Remove_TLB); } diff --git a/Source/Project64/N64 System/N64 Class.h b/Source/Project64/N64 System/N64 Class.h index 61a40d75b..eb164c88c 100644 --- a/Source/Project64/N64 System/N64 Class.h +++ b/Source/Project64/N64 System/N64 Class.h @@ -53,11 +53,11 @@ class CN64System : CSpeedLimitor m_Limitor; bool m_InReset; SystemType m_SystemType; + bool m_bCleanFrameBox; //When Syncing cores this is the PC where it last Sync'ed correctly DWORD m_LastSuccessSyncPC[10]; int m_CyclesToSkip; - bool m_SPHack; //List of Internal events that need to be acted on by CPU EVENT_LIST EventList; diff --git a/Source/Project64/N64 System/N64 Rom Class.cpp b/Source/Project64/N64 System/N64 Rom Class.cpp index 04de12998..694021ec9 100644 --- a/Source/Project64/N64 System/N64 Rom Class.cpp +++ b/Source/Project64/N64 System/N64 Rom Class.cpp @@ -456,69 +456,18 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) { return true; } -void CN64Rom::LoadRomSettings (void) { - //Load Rom Settings - DWORD CPU_Type = _Settings->LoadDword(ROM_CPUType); - DWORD RDRamSize = _Settings->LoadDword(ROM_RamSize); - DWORD LookUpMode = _Settings->LoadDword(ROM_FunctionLookup); - bool UseCustomSMM = _Settings->LoadDword(ROM_CustomSMM) != 0; - - if (RDRamSize != -1 && RDRamSize != 8) { RDRamSize = 0x400000; } - if (RDRamSize == 8) { RDRamSize = 0x800000; } - - //Load system settings if need be - if (CPU_Type == -1) { CPU_Type = _Settings->LoadDword(SYSTEM_CPUType); } - if (RDRamSize == -1) { RDRamSize = _Settings->LoadDword(SYSTEM_RDRamSize); } - if (LookUpMode == -1) { LookUpMode = _Settings->LoadDword(SYSTEM_FunctionLookup); } - - //Save execution settings - _Settings->SaveDword(CPUType, CPU_Type); - _Settings->SaveDword(RamSize, RDRamSize); - _Settings->SaveDword(FuncLookupMode, LookUpMode); - _Settings->SaveDword(SaveChipType, _Settings->LoadDword(ROM_SaveChip)); - _Settings->SaveDword(SMM_Cache, _Settings->LoadDword(UseCustomSMM ? ROM_SMM_Cache : SYSTEM_SMM_Cache)); - _Settings->SaveDword(SMM_PIDMA, _Settings->LoadDword(UseCustomSMM ? ROM_SMM_PIDMA : SYSTEM_SMM_PIDMA)); - _Settings->SaveDword(SMM_TLB, _Settings->LoadDword(UseCustomSMM ? ROM_SMM_TLB : SYSTEM_SMM_TLB)); - _Settings->SaveDword(SMM_Protect, _Settings->LoadDword(UseCustomSMM ? ROM_SMM_Protect : SYSTEM_SMM_Protect)); - _Settings->SaveDword(SMM_ValidFunc, _Settings->LoadDword(UseCustomSMM ? ROM_SMM_ValidFunc : SYSTEM_SMM_ValidFunc)); - _Settings->SaveDword(CounterFactor, _Settings->LoadDword(ROM_CounterFactor)); - _Settings->SaveDword(BlockLinking, _Settings->LoadDword(ROM_BlockLinking)); - _Settings->SaveDword(DelayDlists, _Settings->LoadDword(ROM_DelayDlists)); - _Settings->SaveDword(DelaySI, _Settings->LoadDword(ROM_DelaySI)); - _Settings->SaveDword(UseTLB, _Settings->LoadDword(ROM_UseTlb)); - _Settings->SaveDword(AudioSignal, _Settings->LoadDword(ROM_AudioSignal)); - _Settings->SaveDword(UseJumpTable, _Settings->LoadDword(ROM_UseJumpTable)); - _Settings->SaveDword(RomInMemory, _Settings->LoadDword(ROM_RomInMemory)); - _Settings->SaveDword(SyncViaAudio, _Settings->LoadDword(ROM_SyncAudio)); - _Settings->SaveDword(FirstDMA, true); - _Settings->SaveDword(CurrentSaveState,_Settings->LoadDword(Game_LastSaveSlot)); - - if (_Settings->LoadDword(CounterFactor) == -1) { _Settings->SaveDword(CounterFactor, (DWORD)2); } - if (_Settings->LoadDword(BlockLinking) == -1) { _Settings->SaveDword(BlockLinking, _Settings->LoadDword(SYSTEM_BlockLinking)); } - - DWORD hertz = 60; - switch (m_Country) { - case 0x44: //Germany - case 0x46: //french - case 0x49: //Italian - case 0x50: //Europe - case 0x53: //Spanish - case 0x55: //Australia - case 0x58: // X (PAL) - case 0x59: // X (PAL) - hertz = 50; - break; - } - _Settings->SaveDword(ScreenHertz,hertz); - - -} - //Save the settings of the loaded rom, so all loaded settings about rom will be identified with //this rom -void CN64Rom::SaveRomSettingID ( void ) { - _Settings->SaveString(ROM_NAME,m_RomName.c_str()); - _Settings->SaveString(ROM_IniKey,m_RomIdent.c_str()); +void CN64Rom::SaveRomSettingID ( void ) +{ + _Settings->SaveString(Game_GameName,m_RomName.c_str()); + _Settings->SaveString(Game_IniKey,m_RomIdent.c_str()); +} + +void CN64Rom::ClearRomSettingID ( void ) +{ + _Settings->SaveString(Game_GameName,""); + _Settings->SaveString(Game_IniKey,""); } void CN64Rom::SetError ( LanguageStringID ErrorMsg ) { diff --git a/Source/Project64/N64 System/N64 Rom Class.h b/Source/Project64/N64 System/N64 Rom Class.h index a256576ec..ef839467f 100644 --- a/Source/Project64/N64 System/N64 Rom Class.h +++ b/Source/Project64/N64 System/N64 Rom Class.h @@ -28,7 +28,7 @@ public: ~CN64Rom ( void ); bool LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly = false ); void SaveRomSettingID ( void ); - void LoadRomSettings ( void ); + void ClearRomSettingID ( void ); CICChip CicChipID ( void ); BYTE * GetRomAddress ( void ) { return m_ROMImage; } DWORD GetRomSize ( void ) { return m_RomFileSize; } diff --git a/Source/Project64/N64 System/N64 Types.h b/Source/Project64/N64 System/N64 Types.h index b0aef3734..234c15b10 100644 --- a/Source/Project64/N64 System/N64 Types.h +++ b/Source/Project64/N64 System/N64 Types.h @@ -21,6 +21,7 @@ enum SystemEvent { CloseCPU, PauseCPU_FromMenu, PauseCPU_AppLostActive, + PauseCPU_AppLostActiveDelay, PauseCPU_AppLostFocus, PauseCPU_SaveGame, PauseCPU_LoadGame, @@ -68,7 +69,7 @@ enum FRAMERATE_TYPE { FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2, }; -enum SAVE_CHIP_TYPE { +enum SAVE_CHIP_TYPE { SaveChip_Auto = -1, SaveChip_Eeprom_4K, SaveChip_Eeprom_16K, SaveChip_Sram, SaveChip_FlashRam }; diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp index 9f5733a39..abd8bac6d 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp @@ -6,8 +6,9 @@ #undef PROGRAM_COUNTER #undef RdramSize - -#define LinkBlocks +#undef LookUpMode +#undef LinkBlocks +#undef CountPerOp CRecompiler::CRecompiler(CMipsMemory * MMU, CProfiling & Profile, bool & EndEmulation, bool SyncSystem) : _MMU(MMU), @@ -16,12 +17,6 @@ CRecompiler::CRecompiler(CMipsMemory * MMU, CProfiling & Profile, bool & EndEmul PROGRAM_COUNTER(_Reg->PROGRAM_COUNTER), m_EndEmulation(EndEmulation), m_SyncSystem(SyncSystem), - m_LookUpMode((FUNC_LOOKUP_METHOD)_Settings->LoadDword(FuncLookupMode)), - m_LinkBlocks(_Settings->LoadDword(BlockLinking) != 0), - m_DisableRegCaching(_Settings->LoadDword(ROM_RegCache) == 0), - m_RdramSize(_Settings->LoadDword(RamSize)), - m_CountPerOp(_Settings->LoadDword(CounterFactor)), - m_ValidateFuncs(_Settings->LoadDword(SMM_ValidFunc) != 0), m_Functions(), m_FunctionsDelaySlot() { @@ -41,7 +36,7 @@ void CRecompiler::Run() Start_x86_Log(); } - if (!g_MMU->AllocateRecompilerMemory(m_LookUpMode != FuncFind_VirtualLookup && m_LookUpMode != FuncFind_ChangeMemory)) + if (!g_MMU->AllocateRecompilerMemory(LookUpMode() != FuncFind_VirtualLookup && LookUpMode() != FuncFind_ChangeMemory)) { return; } @@ -52,16 +47,16 @@ void CRecompiler::Run() m_EndEmulation = false; __try { - if (m_LookUpMode == FuncFind_VirtualLookup) + if (LookUpMode() == FuncFind_VirtualLookup) { - if (m_ValidateFuncs) + if (bSMM_ValidFunc()) { RecompilerMain_VirtualTable_validate(); } else { RecompilerMain_VirtualTable(); } } - else if (m_LookUpMode == FuncFind_ChangeMemory) + else if (LookUpMode() == FuncFind_ChangeMemory) { RecompilerMain_ChangeMemory(); } @@ -267,7 +262,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate ( void ) break; } } - if (m_ValidateFuncs) + if (bSMM_ValidFunc()) { if ((*Info->MemLocation[0] != Info->MemContents[0]) || (*Info->MemLocation[1] != Info->MemContents[1])) @@ -299,7 +294,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate ( void ) break; } } - if (m_ValidateFuncs) + if (bSMM_ValidFunc()) { if ((*Info->MemLocation[0] != Info->MemContents[0]) || (*Info->MemLocation[1] != Info->MemContents[1])) @@ -355,7 +350,7 @@ void CRecompiler::RecompilerMain_Lookup( void ) break; } } - if (m_ValidateFuncs) + if (bSMM_ValidFunc()) { if ((*Info->MemLocation[0] != Info->MemContents[0]) || (*Info->MemLocation[1] != Info->MemContents[1])) @@ -378,7 +373,7 @@ void CRecompiler::RecompilerMain_Lookup( void ) __try { if (Addr > 0x10000000) { - if (bRomInMemory) + if (bRomInMemory()) { if (Addr > 0x20000000) { @@ -429,7 +424,7 @@ void CRecompiler::RecompilerMain_Lookup( void ) // VirtualProtect(N64MEM + Addr, 4, PAGE_READONLY, &OldProtect); // } } - if (m_ValidateFuncs) + if (bSMM_ValidFunc()) { if ((*Info->MemLocation[0] != Info->MemContents[0]) || (*Info->MemLocation[1] != Info->MemContents[1])) @@ -479,7 +474,7 @@ void CRecompiler::ResetRecompCode() memset(JumpTable,0,g_MMU->RdramSize()); memset(JumpTable + (0x04000000 >> 2),0,0x1000); memset(JumpTable + (0x04001000 >> 2),0,0x1000); - if (bRomInMemory) + if (bRomInMemory()) { memset(JumpTable + (0x10000000 >> 2),0,RomFileSize); } @@ -559,7 +554,7 @@ FUNCTION_INFO * CRecompiler::CompileDelaySlot(DWORD PC) { return NULL; } - if (StartAddress < m_RdramSize) { + if (StartAddress < RdramSize()) { CPU_Message("====== RDRAM: Delay Slot ======"); } else if (StartAddress >= 0x04000000 && StartAddress <= 0x04000FFC) { CPU_Message("====== DMEM: Delay Slot ======"); @@ -575,7 +570,7 @@ FUNCTION_INFO * CRecompiler::CompileDelaySlot(DWORD PC) CPU_Message("====== recompiled code ======"); Section->AddParent(NULL); - Section->BlockCycleCount() += CountPerOp; + Section->BlockCycleCount() += CountPerOp(); Section->BlockRandomModifier() += 1; switch (Opcode.op) { @@ -738,7 +733,7 @@ FUNCTION_INFO * CRecompiler::CompileDelaySlot(DWORD PC) bool CRecompiler::AnalyseBlock ( CBlockInfo & BlockInfo) { - if (m_LinkBlocks) + if (bLinkBlocks()) { CBlockSection * Section = &BlockInfo.ParentSection; if (!CreateSectionLinkage (Section)) { return false; } @@ -1857,13 +1852,13 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { DWORD StartTime = timeGetTime(); WriteTraceF(TraceRecompiler,"Compile Block-Start: %X-%X",info->VStartPC(),info->VEndPC()); - if (bProfiling) { m_Profile.StartTimer(Timer_GetBlockInfo); } + if (bProfiling()) { m_Profile.StartTimer(Timer_GetBlockInfo); } CBlockInfo BlockInfo(PROGRAM_COUNTER, RecompPos); - if (bProfiling) { m_Profile.StartTimer(Timer_AnalyseBlock); } + if (bProfiling()) { m_Profile.StartTimer(Timer_AnalyseBlock); } if (!AnalyseBlock(BlockInfo)) { return false; } - if (bProfiling) { m_Profile.StartTimer(Timer_CompileBlock); } + if (bProfiling()) { m_Profile.StartTimer(Timer_CompileBlock); } DWORD StartAddress; if (!_MMU->TranslateVaddr(BlockInfo.StartVAddr,StartAddress)) { @@ -1872,7 +1867,7 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { } /* MarkCodeBlock(StartAddress); - if (StartAddress < m_RdramSize) { + if (StartAddress < RdramSize()) { CPU_Message("====== RDRAM: block (%X:%d) ======", StartAddress>>12,N64_Blocks.NoOfRDRamBlocks[StartAddress>>12]); } else if (StartAddress >= 0x04000000 && StartAddress <= 0x04000FFC) { CPU_Message("====== DMEM: block (%d) ======", N64_Blocks.NoOfDMEMBlocks); @@ -1892,7 +1887,7 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { CPU_Message("Start of Block: %X",BlockInfo.StartVAddr ); CPU_Message("No of Sections: %d",BlockInfo.NoOfSections ); CPU_Message("====== recompiled code ======"); - if (m_LinkBlocks) { + if (bLinkBlocks()) { for (int count = 0; count < BlockInfo.NoOfSections; count ++) { DisplaySectionInformation(&BlockInfo.ParentSection,count + 1,CBlockSection::GetNewTestValue()); } @@ -1904,7 +1899,7 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { BlockInfo.ParentSection.RegStart.Initilize(); BlockInfo.ParentSection.RegWorking = BlockInfo.ParentSection.RegStart; - if (m_LinkBlocks) { + if (bLinkBlocks()) { while (GenerateX86Code(BlockInfo,&BlockInfo.ParentSection,CBlockSection::GetNewTestValue())); } else { GenerateX86Code(BlockInfo,&BlockInfo.ParentSection,CBlockSection::GetNewTestValue()); @@ -1912,7 +1907,7 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { CompileExitCode(BlockInfo); CPU_Message("====== End of recompiled code ======"); - if (bProfiling) { m_Profile.StartTimer(Timer_CompileDone); } + if (bProfiling()) { m_Profile.StartTimer(Timer_CompileDone); } info->SetVEndPC(BlockInfo.EndVAddr); info->SetFunctionAddr(BlockInfo.CompiledLocation); @@ -1920,13 +1915,13 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { info->MemLocation[1] = info->MemLocation[0] + 1; info->MemContents[0] = *info->MemLocation[0]; info->MemContents[1] = *info->MemLocation[1]; - if (bSMM_Protect) + if (bSMM_Protect()) { _MMU->ProtectMemory(info->VStartPC(),info->VEndPC()); } NextInstruction = NORMAL; - if (bShowRecompMemSize) + if (bShowRecompMemSize()) { DWORD Size = RecompPos - RecompCode; DWORD MB = Size / 0x100000; @@ -1938,7 +1933,7 @@ bool CRecompiler::Compiler4300iBlock(FUNCTION_INFO * info) { DisplayMessage(0,"Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb",MB,KB,Size, TotalAvaliable); } - if (bProfiling) { m_Profile.StopTimer(); } + if (bProfiling()) { m_Profile.StopTimer(); } DWORD TimeTaken = timeGetTime() - StartTime; WriteTraceF(TraceRecompiler,"Compile Block-Done: %X-%X - Taken: %d",info->VStartPC(),info->VEndPC(),TimeTaken); @@ -2600,7 +2595,7 @@ bool CRecompiler::GenerateX86Code(CBlockInfo & BlockInfo, CBlockSection * Sectio { Section->BlockInfo->EndVAddr = Section->CompilePC; } - Section->BlockCycleCount() += m_CountPerOp; + Section->BlockCycleCount() += CountPerOp(); //CPU_Message("BlockCycleCount = %d",BlockCycleCount); Section->BlockRandomModifier() += 1; //CPU_Message("BlockRandomModifier = %d",BlockRandomModifier); @@ -2842,7 +2837,7 @@ bool CRecompiler::GenerateX86Code(CBlockInfo & BlockInfo, CBlockSection * Sectio Compile_R4300i_UnknownOpcode(Section); break; } - if (m_DisableRegCaching) { WriteBackRegisters(Section); } + if (!bRegCaching()) { WriteBackRegisters(Section); } Section->ResetX86Protection(); /*if ((DWORD)RecompPos > 0x60B452E6) { @@ -2899,7 +2894,7 @@ bool CRecompiler::GenerateX86Code(CBlockInfo & BlockInfo, CBlockSection * Sectio break; case DELAY_SLOT: NextInstruction = DELAY_SLOT_DONE; - Section->BlockCycleCount() -= m_CountPerOp; + Section->BlockCycleCount() -= CountPerOp(); Section->BlockRandomModifier() -= 1; Section->CompilePC -= 4; break; @@ -2967,7 +2962,7 @@ void CRecompiler::CompileExit ( CBlockSection * Section, DWORD JumpPC, DWORD Tar #ifdef LinkBlocks if (bSMM_ValidFunc == false) { - if (LookUpMode == FuncFind_ChangeMemory) + if (LookUpMode() == FuncFind_ChangeMemory) { BreakPoint(__FILE__,__LINE__); // BYTE * Jump, * Jump2; @@ -3002,7 +2997,7 @@ void CRecompiler::CompileExit ( CBlockSection * Section, DWORD JumpPC, DWORD Tar // *((BYTE *)(Jump2))=(BYTE)(RecompPos - Jump2 - 1); // } } - else if (LookUpMode == FuncFind_VirtualLookup) + else if (LookUpMode() == FuncFind_VirtualLookup) { MoveConstToX86reg(TargetPC,x86_EDX); MoveConstToX86reg((DWORD)&m_Functions,x86_ECX); @@ -3015,7 +3010,7 @@ void CRecompiler::CompileExit ( CBlockSection * Section, DWORD JumpPC, DWORD Tar CPU_Message(" NullPointer:"); *((BYTE *)(Jump))=(BYTE)(RecompPos - Jump - 1); } - else if (LookUpMode == FuncFind_PhysicalLookup) + else if (LookUpMode() == FuncFind_PhysicalLookup) { BYTE * Jump2 = NULL; if (TargetPC >= 0x80000000 && TargetPC < 0x90000000) { @@ -3370,7 +3365,7 @@ void SyncRegState (CBlockSection * Section, CRegInfo * SyncTo) { } } -void GenerateSectionLinkage (CBlockSection * Section) { +void CRecompiler::GenerateSectionLinkage (CBlockSection * Section) { CBlockSection ** TargetSection[2]; CJumpInfo * JumpInfo[2]; BYTE * Jump; @@ -3440,10 +3435,10 @@ void GenerateSectionLinkage (CBlockSection * Section) { CPU_Message("PermLoop *** a"); MoveConstToVariable(Section->CompilePC,g_PROGRAM_COUNTER,"PROGRAM_COUNTER"); WriteBackRegisters(Section); - Section->RegWorking.BlockCycleCount() -= CountPerOp; + Section->RegWorking.BlockCycleCount() -= CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&Section->RegWorking.BlockCycleCount(),&Section->RegWorking.BlockRandomModifier(), false); Call_Direct(InPermLoop,"InPermLoop"); - Section->RegWorking.BlockCycleCount() += CountPerOp; + Section->RegWorking.BlockCycleCount() += CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&Section->RegWorking.BlockCycleCount(),&Section->RegWorking.BlockRandomModifier(), true); g_N64System->GetRecompiler()->CompileSystemCheck(-1,Section->RegWorking); @@ -3514,10 +3509,10 @@ CPU_Message("PermLoop *** a"); if (JumpInfo[count]->PermLoop) { CPU_Message("PermLoop *** 1"); MoveConstToVariable(JumpInfo[count]->TargetPC,g_PROGRAM_COUNTER,"PROGRAM_COUNTER"); - JumpInfo[count]->RegSet.BlockCycleCount() -= CountPerOp; + JumpInfo[count]->RegSet.BlockCycleCount() -= CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&JumpInfo[count]->RegSet.BlockCycleCount(),&JumpInfo[count]->RegSet.BlockRandomModifier(), false); Call_Direct(InPermLoop,"InPermLoop"); - JumpInfo[count]->RegSet.BlockCycleCount() += CountPerOp; + JumpInfo[count]->RegSet.BlockCycleCount() += CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&JumpInfo[count]->RegSet.BlockCycleCount(),&JumpInfo[count]->RegSet.BlockRandomModifier(), true); g_N64System->GetRecompiler()->CompileSystemCheck(-1,JumpInfo[count]->RegSet); } else { @@ -3550,10 +3545,10 @@ CPU_Message("PermLoop *** 1"); if (JumpInfo[count]->PermLoop) { CPU_Message("PermLoop *** 2"); MoveConstToVariable(JumpInfo[count]->TargetPC,g_PROGRAM_COUNTER,"PROGRAM_COUNTER"); - JumpInfo[count]->RegSet.BlockCycleCount() -= CountPerOp; + JumpInfo[count]->RegSet.BlockCycleCount() -= CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&JumpInfo[count]->RegSet.BlockCycleCount(),&JumpInfo[count]->RegSet.BlockRandomModifier(), false); Call_Direct(InPermLoop,"InPermLoop"); - JumpInfo[count]->RegSet.BlockCycleCount() += CountPerOp; + JumpInfo[count]->RegSet.BlockCycleCount() += CountPerOp(); g_N64System->GetRecompiler()->UpdateCounters(&JumpInfo[count]->RegSet.BlockCycleCount(),&JumpInfo[count]->RegSet.BlockRandomModifier(), true); g_N64System->GetRecompiler()->CompileSystemCheck(-1,JumpInfo[count]->RegSet); } @@ -3692,7 +3687,7 @@ void CRecompiler::RemoveFunction (FUNCTION_INFO * FunInfo, bool DelaySlot, REMOV } //if no more functions in this block then unprotect the memory - if (bSMM_Protect) + if (bSMM_Protect()) { for (DWORD Addr = StartBlock; Addr <= EndBlock; Addr += 0x1000 ){ FUNCTION_INFO * info = m_Functions.FindFunction(Addr,0xFFF); @@ -3721,7 +3716,7 @@ bool CRecompiler::ClearRecompCode_Phys(DWORD Address, int length, REMOVE_REASON } } } - if (LookUpMode == FuncFind_PhysicalLookup) + if (LookUpMode() == FuncFind_PhysicalLookup) { WriteTraceF(TraceRecompiler,"Reseting Jump Table, Addr: %X len: %d",Address,((length + 3) & ~3)); memset((BYTE *)JumpTable + Address,0,((length + 3) & ~3)); @@ -3750,7 +3745,7 @@ bool CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R } } while (info != NULL); - if (bSMM_Protect) + if (bSMM_Protect()) { DWORD Start = Address & ~0xFFF; info = m_Functions.FindFunction(Start,0xFFF); diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.h b/Source/Project64/N64 System/Recompiler/Recompiler Class.h index b7f56fab7..6541f301d 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.h +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.h @@ -15,18 +15,13 @@ public: private: CMipsMemory * const _MMU; //Memory of the n64 CRegisters * const _Reg; + bool const m_SyncSystem; CProfiling & m_Profile; bool & m_EndEmulation; //Quick access to registers DWORD & PROGRAM_COUNTER; - - //Cached settings - bool const m_SyncSystem, m_LinkBlocks, m_DisableRegCaching, - m_ValidateFuncs; - DWORD const m_RdramSize, m_CountPerOp; - FUNC_LOOKUP_METHOD const m_LookUpMode; - + //Functions CDelaySlotFunctionMap m_FunctionsDelaySlot; CFunctionMap m_Functions; @@ -68,6 +63,7 @@ public: void UpdateCounters ( DWORD * Cycles, DWORD * RandomMod, BOOL CheckTimer); void CompileExit ( CBlockSection * Section, DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(char * Label, DWORD Value)); bool GenerateX86Code (CBlockInfo & BlockInfo, CBlockSection * Section, DWORD Test ); + void GenerateSectionLinkage (CBlockSection * Section); //Self modifying code methods bool ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason ); diff --git a/Source/Project64/N64 System/Recompiler/vssver2.scc b/Source/Project64/N64 System/Recompiler/vssver2.scc deleted file mode 100644 index c7e665888..000000000 Binary files a/Source/Project64/N64 System/Recompiler/vssver2.scc and /dev/null differ diff --git a/Source/Project64/N64 System/vssver2.scc b/Source/Project64/N64 System/vssver2.scc deleted file mode 100644 index 8a346eb79..000000000 Binary files a/Source/Project64/N64 System/vssver2.scc and /dev/null differ diff --git a/Source/Project64/Plugins/Audio Plugin.cpp b/Source/Project64/Plugins/Audio Plugin.cpp index bd63c4f4e..aa1554582 100644 --- a/Source/Project64/Plugins/Audio Plugin.cpp +++ b/Source/Project64/Plugins/Audio Plugin.cpp @@ -66,10 +66,10 @@ CAudioPlugin::CAudioPlugin ( const char * FileName) { info.DefaultStartRange = FirstAudioDefaultSet; info.SettingStartRange = FirstAudioSettings; info.MaximumSettings = MaxPluginSetting; - info.NoDefault = No_Default; - info.DefaultLocation = _Settings->LoadDword(UseSettingFromRegistry) ? SettingLocation_Registry : SettingLocation_CfgFile; + info.NoDefault = Default_None; + info.DefaultLocation = _Settings->LoadDword(Setting_UseFromRegistry) ? SettingType_Registry : SettingType_CfgFile; info.handle = _Settings; - info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingLocation,const char *,const char *, DWORD))CSettings::RegisterSetting; + info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingType,const char *,const char *, DWORD))CSettings::RegisterSetting; info.GetSetting = (unsigned int (*)( void * handle, int ID ))CSettings::GetSetting; info.GetSettingSz = (const char * (*)( void *, int, char *, int ))CSettings::GetSettingSz; info.SetSetting = (void (*)(void *,int,unsigned int))CSettings::SetSetting; diff --git a/Source/Project64/Plugins/Controller Plugin.cpp b/Source/Project64/Plugins/Controller Plugin.cpp index 8d56fbc5d..5bc937cea 100644 --- a/Source/Project64/Plugins/Controller Plugin.cpp +++ b/Source/Project64/Plugins/Controller Plugin.cpp @@ -67,10 +67,10 @@ CControl_Plugin::CControl_Plugin ( const char * FileName) { info.DefaultStartRange = FirstCtrlDefaultSet; info.SettingStartRange = FirstCtrlSettings; info.MaximumSettings = MaxPluginSetting; - info.NoDefault = No_Default; - info.DefaultLocation = _Settings->LoadDword(UseSettingFromRegistry) ? SettingLocation_Registry : SettingLocation_CfgFile; + info.NoDefault = Default_None; + info.DefaultLocation = _Settings->LoadDword(Setting_UseFromRegistry) ? SettingType_Registry : SettingType_CfgFile; info.handle = _Settings; - info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingLocation,const char *,const char *, DWORD))CSettings::RegisterSetting; + info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingType,const char *,const char *, DWORD))CSettings::RegisterSetting; info.GetSetting = (unsigned int (*)( void * handle, int ID ))CSettings::GetSetting; info.GetSettingSz = (const char * (*)( void *, int, char *, int ))CSettings::GetSettingSz; info.SetSetting = (void (*)(void *,int,unsigned int))CSettings::SetSetting; diff --git a/Source/Project64/Plugins/GFX plugin.cpp b/Source/Project64/Plugins/GFX plugin.cpp index f05a90fb1..4b6c5355e 100644 --- a/Source/Project64/Plugins/GFX plugin.cpp +++ b/Source/Project64/Plugins/GFX plugin.cpp @@ -93,10 +93,10 @@ CGfxPlugin::CGfxPlugin ( const char * FileName) { info.DefaultStartRange = FirstGfxDefaultSet; info.SettingStartRange = FirstGfxSettings; info.MaximumSettings = MaxPluginSetting; - info.NoDefault = No_Default; -/* info.DefaultLocation = _Settings->LoadDword(UseSettingFromRegistry) ? InRegistry : LocalSettings; + info.NoDefault = Default_None; + info.DefaultLocation = _Settings->LoadDword(Setting_UseFromRegistry) ? SettingType_Registry : SettingType_CfgFile; info.handle = _Settings; - info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingLocation,const char *,const char *, DWORD))CSettings::RegisterSetting; + info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingType,const char *,const char *, DWORD))CSettings::RegisterSetting; info.GetSetting = (unsigned int (*)( void * handle, int ID ))CSettings::GetSetting; info.GetSettingSz = (const char * (*)( void *, int, char *, int ))CSettings::GetSettingSz; info.SetSetting = (void (*)(void *,int,unsigned int))CSettings::SetSetting; @@ -104,8 +104,8 @@ CGfxPlugin::CGfxPlugin ( const char * FileName) { info.UseUnregisteredSetting = NULL; SetSettingInfo(&info); - _Settings->UnknownSetting_GFX = info.UseUnregisteredSetting; -*/ +// _Settings->UnknownSetting_GFX = info.UseUnregisteredSetting; + PluginOpened(); } // FrameBufferRead = (void (__cdecl *)(DWORD))GetProcAddress( (HMODULE)hDll, "FBRead" ); diff --git a/Source/Project64/Plugins/Plugin Class.cpp b/Source/Project64/Plugins/Plugin Class.cpp index 3fa255de2..66e7b76f7 100644 --- a/Source/Project64/Plugins/Plugin Class.cpp +++ b/Source/Project64/Plugins/Plugin Class.cpp @@ -18,7 +18,7 @@ void CPlugins::CreatePlugins( void ) { Reset(PLUGIN_TYPE_RSP); Reset(PLUGIN_TYPE_CONTROLLER); - if (_Settings->LoadDword(Debugger)) + if (_Settings->LoadBool(Debugger_Enabled)) { Notify().RefreshMenu(); } @@ -151,7 +151,8 @@ void CPlugins::Reset ( void ) { CreatePlugins(); } -void CPlugins::Reset ( PLUGIN_TYPE Type ) { +void CPlugins::Reset ( PLUGIN_TYPE Type ) +{ switch (Type) { case PLUGIN_TYPE_RSP: @@ -166,20 +167,20 @@ void CPlugins::Reset ( PLUGIN_TYPE Type ) { m_RSP = NULL; } { - stdstr_f RspPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentRSP_Plugin).c_str()); + stdstr_f RspPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Plugin_RSP_Current).c_str()); WriteTraceF(TraceRSP,"Loading (%s): Starting",RspPluginFile.c_str()); m_RSP = new CRSP_Plugin(RspPluginFile.c_str()); WriteTrace(TraceRSP,"Loading Done"); } WriteTraceF(TraceRSP,"Current Ver: %s",m_RSP->PluginName().c_str()); - _Settings->SaveString(CurVerRSP_Plugin,m_RSP->PluginName().c_str()); + _Settings->SaveString(Plugin_RSP_CurVer,m_RSP->PluginName().c_str()); //Enable debugger if (m_RSP->EnableDebugging) { WriteTrace(TraceRSP,"EnableDebugging: starting"); - m_RSP->EnableDebugging(_Settings->LoadDword(Debugger)); + m_RSP->EnableDebugging(_Settings->LoadDword(Debugger_Enabled)); WriteTrace(TraceRSP,"EnableDebugging: done"); } break; @@ -195,49 +196,48 @@ void CPlugins::Reset ( PLUGIN_TYPE Type ) { m_Gfx = NULL; } { - stdstr_f GfxPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentGFX_Plugin).c_str()); + stdstr_f GfxPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Gfx).c_str()); WriteTraceF(TraceGfxPlugin,"Loading (%s): Starting",GfxPluginFile.c_str()); m_Gfx = new CGfxPlugin(GfxPluginFile.c_str()); WriteTrace(TraceGfxPlugin,"Loading Done"); } WriteTraceF(TraceGfxPlugin,"Current Ver: %s",m_Gfx->PluginName().c_str()); - _Settings->SaveString(CurVerGFX_Plugin,m_Gfx->PluginName().c_str()); + _Settings->SaveString(Plugin_GFX_CurVer,m_Gfx->PluginName().c_str()); break; case PLUGIN_TYPE_AUDIO: WriteTrace(TraceDebug,"CPlugins::Reset 17"); if (m_Audio) { - WriteTrace(TraceDebug,"CPlugins::Reset 18"); + WriteTrace(TraceDebug,"CPlugins::Reset 18"); m_Audio->Close(); - WriteTrace(TraceDebug,"CPlugins::Reset 19"); + WriteTrace(TraceDebug,"CPlugins::Reset 19"); delete m_Audio; - WriteTrace(TraceDebug,"CPlugins::Reset 20"); + WriteTrace(TraceDebug,"CPlugins::Reset 20"); m_Audio = NULL; - WriteTrace(TraceDebug,"CPlugins::Reset 21"); + WriteTrace(TraceDebug,"CPlugins::Reset 21"); } WriteTrace(TraceDebug,"CPlugins::Reset 22"); - m_Audio = new CAudioPlugin(stdstr_f("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentAUDIO_Plugin).c_str()).c_str()); + m_Audio = new CAudioPlugin(stdstr_f("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Audio).c_str()).c_str()); WriteTrace(TraceDebug,"CPlugins::Reset 23"); - _Settings->SaveString(CurVerAUDIO_Plugin,m_Audio->PluginName().c_str()); + _Settings->SaveString(Plugin_AUDIO_CurVer,m_Audio->PluginName().c_str()); WriteTrace(TraceDebug,"CPlugins::Reset 24"); break; case PLUGIN_TYPE_CONTROLLER: WriteTrace(TraceDebug,"CPlugins::Reset 25"); if (m_Control) { - WriteTrace(TraceDebug,"CPlugins::Reset 26"); + WriteTrace(TraceDebug,"CPlugins::Reset 26"); m_Control->Close(); - WriteTrace(TraceDebug,"CPlugins::Reset 27"); + WriteTrace(TraceDebug,"CPlugins::Reset 27"); delete m_Control; - WriteTrace(TraceDebug,"CPlugins::Reset 28"); + WriteTrace(TraceDebug,"CPlugins::Reset 28"); m_Control = NULL; - WriteTrace(TraceDebug,"CPlugins::Reset 29"); + WriteTrace(TraceDebug,"CPlugins::Reset 29"); } WriteTrace(TraceDebug,"CPlugins::Reset 30"); - m_Control = new CControl_Plugin(stdstr_f("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentCONT_Plugin).c_str()).c_str()); + m_Control = new CControl_Plugin(stdstr_f("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Controller).c_str()).c_str()); WriteTrace(TraceDebug,"CPlugins::Reset 31"); - _Settings->SaveString(CurVerCONT_Plugin,m_Control->PluginName().c_str()); + _Settings->SaveString(Plugin_CONT_CurVer,m_Control->PluginName().c_str()); WriteTrace(TraceDebug,"CPlugins::Reset 32"); break; - } } @@ -305,8 +305,10 @@ void CPlugins::CreatePluginDir ( const stdstr & DstDir ) const { } void CPlugins::CopyPlugins ( const stdstr & DstDir ) const { + Notify().BreakPoint(__FILE__,__LINE__); + //Copy GFX Plugin - stdstr_f srcGfxPlugin("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentGFX_Plugin).c_str()); + /*stdstr_f srcGfxPlugin("%s%s",m_PluginDir.c_str(),_Settings->LoadString(CurrentGFX_Plugin).c_str()); stdstr_f dstGfxPlugin("%s%s",DstDir.c_str(),_Settings->LoadString(CurrentGFX_Plugin).c_str()); if (CopyFile(srcGfxPlugin.c_str(),dstGfxPlugin.c_str(),false) == 0) @@ -337,5 +339,5 @@ void CPlugins::CopyPlugins ( const stdstr & DstDir ) const { if (CopyFile(srcContPlugin.c_str(),dstContPlugin.c_str(),false) == 0) { if (GetLastError() == ERROR_PATH_NOT_FOUND) { CreatePluginDir(dstContPlugin); } CopyFile(srcContPlugin.c_str(),dstContPlugin.c_str(),false); - } + }*/ } diff --git a/Source/Project64/Plugins/Plugin Class.h b/Source/Project64/Plugins/Plugin Class.h index 1acd05f2b..4c9a70ffc 100644 --- a/Source/Project64/Plugins/Plugin Class.h +++ b/Source/Project64/Plugins/Plugin Class.h @@ -50,11 +50,12 @@ typedef struct { void (*SetSetting) ( void * handle, int ID, unsigned int Value ); void (*SetSettingSz) ( void * handle, int ID, const char * Value ); void (*RegisterSetting) ( void * handle, int ID, int DefaultID, SettingDataType Type, - SettingLocation Location, const char * Category, const char * DefaultStr, DWORD Value ); + SettingType Location, const char * Category, const char * DefaultStr, DWORD Value ); void (*UseUnregisteredSetting) (int ID); } PLUGIN_SETTINGS; enum PLUGIN_TYPE { + PLUGIN_TYPE_NONE = 0, PLUGIN_TYPE_RSP = 1, PLUGIN_TYPE_GFX = 2, PLUGIN_TYPE_AUDIO = 3, diff --git a/Source/Project64/Plugins/Plugin List.cpp b/Source/Project64/Plugins/Plugin List.cpp index e8a857626..eb8264ed9 100644 --- a/Source/Project64/Plugins/Plugin List.cpp +++ b/Source/Project64/Plugins/Plugin List.cpp @@ -1,5 +1,138 @@ #include "..\Plugin.h" +CPluginList::CPluginList(bool bAutoFill /* = true */) : + m_PluginDir(_Settings->LoadString(Directory_Plugin),"") +{ + if (bAutoFill) + { + LoadList(); + } +} + +CPluginList::~CPluginList() +{ +} + +int CPluginList::GetPluginCount() const +{ + return m_PluginList.size(); +} + +const CPluginList::PLUGIN * CPluginList::GetPluginInfo ( int indx ) const +{ + if (indx < 0 || indx >= m_PluginList.size()) + { + return NULL; + } + return &m_PluginList[indx]; + +} + +bool CPluginList::LoadList() +{ + m_PluginList.clear(); + AddPluginFromDir(m_PluginDir); + return true; +} + +void CPluginList::AddPluginFromDir ( CPath Dir) +{ + Dir.SetNameExtension("*.*"); + if (Dir.FindFirst(_A_SUBDIR)) + { + do { + AddPluginFromDir(Dir); + } while (Dir.FindNext()); + Dir.UpDirectory(); + } + + Dir.SetNameExtension("*.dll"); + if (Dir.FindFirst()) + { + HMODULE hLib = NULL; + do { + if (hLib) + { + FreeLibrary(hLib); + hLib = NULL; + } + + UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); + hLib = LoadLibrary(Dir); + SetErrorMode(LastErrorMode); + + if (hLib == NULL) + { + continue; + } + + void (__cdecl *GetDllInfo) ( PLUGIN_INFO * PluginInfo ); + GetDllInfo = (void (__cdecl *)(PLUGIN_INFO *))GetProcAddress( hLib, "GetDllInfo" ); + if (GetDllInfo == NULL) + { + continue; + } + + PLUGIN Plugin; + GetDllInfo(&Plugin.Info); + if (!ValidPluginVersion(Plugin.Info)) + { + continue; + } + + Plugin.FullPath = Dir; + Plugin.FileName = ((stdstr &)Dir).substr(((stdstr &)m_PluginDir).length()); + + if (GetProcAddress(hLib,"DllAbout") != NULL) + { + Plugin.AboutFunction = true; + } + m_PluginList.push_back(Plugin); + } while (Dir.FindNext()); + + if (hLib) + { + FreeLibrary(hLib); + hLib = NULL; + } + } +} + +bool CPluginList::ValidPluginVersion ( PLUGIN_INFO & PluginInfo ) { + if (!PluginInfo.MemoryBswaped) + { + return false; + } + + switch (PluginInfo.Type) + { + case PLUGIN_TYPE_RSP: + if (PluginInfo.Version == 0x0001) { return true; } + if (PluginInfo.Version == 0x0100) { return true; } + if (PluginInfo.Version == 0x0101) { return true; } + if (PluginInfo.Version == 0x0102) { return true; } + break; + case PLUGIN_TYPE_GFX: + if (PluginInfo.Version == 0x0102) { return true; } + if (PluginInfo.Version == 0x0103) { return true; } + if (PluginInfo.Version == 0x0104) { return true; } + break; + case PLUGIN_TYPE_AUDIO: + if (PluginInfo.Version == 0x0101) { return true; } + if (PluginInfo.Version == 0x0102) { return true; } + break; + case PLUGIN_TYPE_CONTROLLER: + if (PluginInfo.Version == 0x0100) { return true; } + if (PluginInfo.Version == 0x0101) { return true; } + if (PluginInfo.Version == 0x0102) { return true; } + break; + } + return FALSE; +} + + + +#ifdef tofix CPluginList::CPluginList (CSettings * Settings) { _Settings = Settings; } @@ -98,12 +231,13 @@ PluginList CPluginList::GetPluginList (void) { PluginList Plugins; //Create search path for plugins - char SearchDir[300] = ""; + Notify().BreakPoint(__FILE__,__LINE__); +/* char SearchDir[300] = ""; _Settings->LoadString(PluginDirectory,SearchDir,sizeof(SearchDir)); //recursively scan search dir, and add files in that dir AddPluginFromDir(SearchDir,SearchDir,&Plugins); - + */ return Plugins; } @@ -132,3 +266,5 @@ bool CPluginList::ValidPluginVersion ( PLUGIN_INFO * PluginInfo ) { } return FALSE; } + +#endif \ No newline at end of file diff --git a/Source/Project64/Plugins/Plugin List.h b/Source/Project64/Plugins/Plugin List.h index bddac573b..8289123db 100644 --- a/Source/Project64/Plugins/Plugin List.h +++ b/Source/Project64/Plugins/Plugin List.h @@ -1,6 +1,6 @@ #include "..\\Settings.h" -typedef struct { +/*typedef struct { PLUGIN_INFO info; stdstr FullPath; stdstr FileName; @@ -9,15 +9,42 @@ typedef struct { typedef std::list PluginList; -class CPluginList { - CSettings * _Settings; - +class CPluginList { void AddPluginFromDir ( const char * PluginDir, const char * Dir, PluginList * Plugins ); bool ValidPluginVersion ( PLUGIN_INFO * PluginInfo ); public: - CPluginList ( CSettings * Settings); + CPluginList (); PluginList GetPluginList ( void ); void DllAbout ( void * hParent, const char * PluginFile ); }; +*/ + +class CPluginList +{ +public: + typedef struct { + PLUGIN_INFO Info; + bool AboutFunction; + CPath FullPath; + stdstr FileName; + } PLUGIN; + +private: + typedef std::vector PluginList; + + PluginList m_PluginList; + CPath m_PluginDir; + + void AddPluginFromDir ( CPath Dir); + bool ValidPluginVersion ( PLUGIN_INFO & PluginInfo ); + +public: + CPluginList(bool bAutoFill = true); + ~CPluginList(); + + bool LoadList ( void ); + int GetPluginCount ( void ) const; + const PLUGIN * GetPluginInfo ( int indx ) const; +}; diff --git a/Source/Project64/Plugins/RSP Plugin.cpp b/Source/Project64/Plugins/RSP Plugin.cpp index 580cf3a6d..360eb4ac2 100644 --- a/Source/Project64/Plugins/RSP Plugin.cpp +++ b/Source/Project64/Plugins/RSP Plugin.cpp @@ -63,10 +63,10 @@ CRSP_Plugin::CRSP_Plugin ( const char * FileName) { info.DefaultStartRange = FirstRSPDefaultSet; info.SettingStartRange = FirstRSPSettings; info.MaximumSettings = MaxPluginSetting; - info.NoDefault = No_Default; - info.DefaultLocation = _Settings->LoadDword(UseSettingFromRegistry) ? SettingLocation_Registry : SettingLocation_CfgFile; + info.NoDefault = Default_None; + info.DefaultLocation = _Settings->LoadDword(Setting_UseFromRegistry) ? SettingType_Registry : SettingType_CfgFile; info.handle = _Settings; - info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingLocation,const char *,const char *, DWORD))CSettings::RegisterSetting; + info.RegisterSetting = (void (*)(void *,int,int,SettingDataType,SettingType,const char *,const char *, DWORD))CSettings::RegisterSetting; info.GetSetting = (unsigned int (*)( void * handle, int ID ))CSettings::GetSetting; info.GetSettingSz = (const char * (*)( void *, int, char *, int ))CSettings::GetSettingSz; info.SetSetting = (void (*)(void *,int,unsigned int))CSettings::SetSetting; diff --git a/Source/Project64/Plugins/vssver2.scc b/Source/Project64/Plugins/vssver2.scc deleted file mode 100644 index e5344c87b..000000000 Binary files a/Source/Project64/Plugins/vssver2.scc and /dev/null differ diff --git a/Source/Project64/Project64.dsp b/Source/Project64/Project64.dsp index 70d49c9ed..1eaa3d2ab 100644 --- a/Source/Project64/Project64.dsp +++ b/Source/Project64/Project64.dsp @@ -44,7 +44,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # SUBTRACT CPP /Fr # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -55,8 +55,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# SUBTRACT LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 !ELSEIF "$(CFG)" == "Project64 - Win32 Debug" @@ -72,7 +71,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "./" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # SUBTRACT CPP /Fr # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -101,7 +100,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "EXTERNAL_RELEASE" /YX /FD /EHa /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "EXTERNAL_RELEASE" /YX /FD /EHa /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0xc09 /d "NDEBUG" @@ -139,10 +138,38 @@ SOURCE=".\Settings\SettingType\SettingsType-ApplicationIndex.cpp" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-Cheats.cpp" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-GameSetting.cpp" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-GameSettingIndex.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBCpuType.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBOnOff.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBRamSize.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBSaveChip.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBYesNo.cpp" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-RelativePath.cpp" # End Source File # Begin Source File @@ -151,6 +178,14 @@ SOURCE=".\Settings\SettingType\SettingsType-RomDatabase.cpp" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-RomDatabaseIndex.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-SelectedDirectory.cpp" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-TempBool.cpp" # End Source File # Begin Source File @@ -191,6 +226,14 @@ SOURCE="Settings\Settings Class.cpp" # PROP Default_Filter "" # Begin Source File +SOURCE=".\User Interface\Settings\Settings Page - Advanced Options.cpp" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Directories.cpp" +# End Source File +# Begin Source File + SOURCE=".\User Interface\Settings\Settings Page - Game - General.cpp" # End Source File # Begin Source File @@ -207,9 +250,37 @@ SOURCE=".\User Interface\Settings\Settings Page - Game - Status.cpp" # End Source File # Begin Source File +SOURCE=".\User Interface\Settings\Settings Page - Game Browser.cpp" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Keyboard Shortcuts.cpp" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Options.cpp" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Plugin.cpp" +# End Source File +# Begin Source File + SOURCE=".\User Interface\Settings\Settings Page.cpp" # End Source File # End Group +# Begin Group "WTL Controls Source" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\ModifiedEditBox.cpp" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\PartialGroupBox.cpp" +# End Source File +# End Group # Begin Source File SOURCE="User Interface\Cheats.cpp" @@ -232,6 +303,10 @@ SOURCE="User Interface\Menu Class.cpp" # End Source File # Begin Source File +SOURCE=".\User Interface\MenuShortCuts.cpp" +# End Source File +# Begin Source File + SOURCE="User Interface\Notification Class.cpp" # End Source File # Begin Source File @@ -639,10 +714,38 @@ SOURCE=".\Settings\SettingType\SettingsType-Base.h" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-Cheats.h" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-GameSetting.h" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-GameSettingIndex.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBCpuType.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBOnOff.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBRamSize.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBSaveChip.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-RDBYesNo.h" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-RelativePath.h" # End Source File # Begin Source File @@ -651,6 +754,14 @@ SOURCE=".\Settings\SettingType\SettingsType-RomDatabase.h" # End Source File # Begin Source File +SOURCE=".\Settings\SettingType\SettingsType-RomDatabaseIndex.h" +# End Source File +# Begin Source File + +SOURCE=".\Settings\SettingType\SettingsType-SelectedDirectory.h" +# End Source File +# Begin Source File + SOURCE=".\Settings\SettingType\SettingsType-TempBool.h" # End Source File # Begin Source File @@ -691,6 +802,14 @@ SOURCE="Settings\Settings Class.h" # PROP Default_Filter "" # Begin Source File +SOURCE=".\User Interface\Settings\Settings Page - Advanced Options.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Directories.h" +# End Source File +# Begin Source File + SOURCE=".\User Interface\Settings\Settings Page - Game - General.h" # End Source File # Begin Source File @@ -707,9 +826,49 @@ SOURCE=".\User Interface\Settings\Settings Page - Game - Status.h" # End Source File # Begin Source File +SOURCE=".\User Interface\Settings\Settings Page - Game Browser.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Keyboard Shortcuts.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Options.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\Settings\Settings Page - Plugin.h" +# End Source File +# Begin Source File + SOURCE=".\User Interface\Settings\Settings Page.h" # End Source File # End Group +# Begin Group "WTL Controls Headers" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\ModifiedCheckBox.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\ModifiedComboBox.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\ModifiedEditBox.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\numberctrl.h" +# End Source File +# Begin Source File + +SOURCE=".\User Interface\WTL Controls\PartialGroupBox.h" +# End Source File +# End Group # Begin Source File SOURCE="User Interface\Cheats.h" @@ -736,6 +895,10 @@ SOURCE="User Interface\Menu Class.h" # End Source File # Begin Source File +SOURCE=".\User Interface\MenuShortCuts.h" +# End Source File +# Begin Source File + SOURCE="User Interface\Notification Class.h" # End Source File # Begin Source File @@ -1154,7 +1317,7 @@ SOURCE="..\Bin\Release\Sync Errors.txt" # End Group # Begin Source File -SOURCE="User Interface\about.htm" +SOURCE=".\User Interface\about.htm" # End Source File # End Target # End Project diff --git a/Source/Project64/Project64.plg b/Source/Project64/Project64.plg index 38bfb930f..2f08bc9c5 100644 --- a/Source/Project64/Project64.plg +++ b/Source/Project64/Project64.plg @@ -3,120 +3,329 @@
 

Build Log

---------------------Configuration: Project64 - Win32 Debug-------------------- +--------------------Configuration: Project64 - Win32 External Release--------------------

Command Lines

-Creating command line "rc.exe /l 0xc09 /fo"../../Build/Project64/Debug/UI Resources.res" /i "User Interface" /d "_DEBUG" "D:\My Programs\Emulation\Project64\Source\Project64\User Interface\UI Resources.rc"" -Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP508.tmp" with contents +Creating command line "rc.exe /l 0xc09 /fo"../../Build/Project64/External/UI Resources.res" /i "User Interface" /d "NDEBUG" "D:\My Programs\Emulation\Project64\Source\Project64\User Interface\UI Resources.rc"" +Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPA1.tmp" with contents [ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"../../Bin/Debug/Project64.pdb" /debug /machine:I386 /out:"../../Bin/Debug/Project64.exe" /pdbtype:sept -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-Application.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-ApplicationIndex.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-GameSetting.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-RelativePath.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-RomDatabase.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-TempBool.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-TempNumber.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\SettingsType-TempString.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\N64System Settings.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Notification Settings.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Recompiler Settings.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Setting Config.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Cheats.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Frame Per Second Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Gui Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Main Menu Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Menu Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Notification Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Rom Browser Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Language Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Audio.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Memory Labels Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Memory.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\OpCode Analysis Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\OpCode Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Register Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\System Timing.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\TLB class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\BreakPoints.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\C Core Interface.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\C main.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\C Memory.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\CPU Log.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\CPU.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Dma.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Eeprom.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Exception.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\FlashRam.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Interpreter CPU.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Interpreter Ops.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Logging.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Mempak.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Pif.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\r4300i Commands.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\r4300i Memory.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\r4300i Registers.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Recompiler CPU.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Recompiler Fpu Ops.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Recompiler Ops.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Registers.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Sram.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Sync CPU.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\TLB Display.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Tlb.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Win32Timer.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\x86 fpu.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\X86.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Debugger - Memory Dump.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Debugger - Memory Search.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Debugger - TLB.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Debugger - View Memory.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Debugger.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Delay Slot Map Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Function Info.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Function Map Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Recompiler Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Section Info.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Cheat Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\N64 Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\N64 Rom Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Profiling Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Rom Information Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Speed Limitor Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Audio Plugin.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Controller Plugin.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\GFX plugin.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Plugin Class.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Plugin List.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\RSP Plugin.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\UNZIP.OBJ" -"\My Programs\Emulation\Project64\Build\Project64\Debug\zip.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\7zip.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Processor Info.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Gui Settings.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\main.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\ValidateBinary.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\UI Resources.res" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Config.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Page.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Page - Game - Recompiler.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Page - Game - Status.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Page - Game - General.obj" -"\My Programs\Emulation\Project64\Build\Project64\Debug\Settings Page - Game - Plugin.obj" -"\My Programs\Emulation\Project64\Bin\Debug\Common.lib" -"\My Programs\Emulation\Project64\Bin\Debug\7zip.lib" +/nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "EXTERNAL_RELEASE" /Fp"../../Build/Project64/External/Project64.pch" /YX /Fo"../../Build/Project64/External/" /Fd"../../Build/Project64/External/" /FD /EHa /c +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-Application.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-ApplicationIndex.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-Cheats.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-GameSetting.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-GameSettingIndex.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RDBCpuType.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RDBOnOff.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RDBRamSize.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RDBSaveChip.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RDBYesNo.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RelativePath.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RomDatabase.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-RomDatabaseIndex.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-SelectedDirectory.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-TempBool.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-TempNumber.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\SettingType\SettingsType-TempString.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\N64System Settings.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\Notification Settings.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\Recompiler Settings.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\Settings Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Advanced Options.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Directories.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Game - General.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Game - Plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Game - Recompiler.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Game - Status.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Game Browser.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Keyboard Shortcuts.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Options.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page - Plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings\Settings Page.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\WTL Controls\ModifiedEditBox.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\WTL Controls\PartialGroupBox.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Cheats.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Frame Per Second Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Gui Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Main Menu Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Menu Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\MenuShortCuts.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Notification Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Rom Browser Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\User Interface\Settings Config.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Multilanguage\Language Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\Audio.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\Memory Labels Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\Memory.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\OpCode Analysis Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\OpCode Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\Register Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\System Timing.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Mips\TLB class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\BreakPoints.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\C Core Interface.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\C Memory.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\CPU.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Dma.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Eeprom.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\FlashRam.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Interpreter CPU.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Mempak.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Pif.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Recompiler CPU.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Recompiler Fpu Ops.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Recompiler Ops.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\C Core\Registers.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Debugger\Debugger - Memory Dump.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Debugger\Debugger - Memory Search.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Debugger\Debugger - TLB.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Debugger\Debugger - View Memory.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Debugger\Debugger.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Recompiler\Delay Slot Map Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Recompiler\Function Info.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Recompiler\Function Map Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Recompiler\Recompiler Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Recompiler\Section Info.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Cheat Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\N64 Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\N64 Rom Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Profiling Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Rom Information Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\N64 System\Speed Limitor Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\Audio Plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\Controller Plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\GFX plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\Plugin Class.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\Plugin List.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Plugins\RSP Plugin.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\Settings\Gui Settings.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\main.cpp" +"D:\My Programs\Emulation\Project64\Source\Project64\ValidateBinary.cpp" ] -Creating command line "link.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP508.tmp" +Creating command line "cl.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPA1.tmp" +Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPA2.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"../../Bin/External/Project64.pdb" /machine:I386 /out:"../../Bin/External/Project64.exe" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-Application.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-ApplicationIndex.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-Cheats.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-GameSetting.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-GameSettingIndex.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RDBCpuType.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RDBOnOff.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RDBRamSize.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RDBSaveChip.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RDBYesNo.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RelativePath.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RomDatabase.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-RomDatabaseIndex.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-SelectedDirectory.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-TempBool.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-TempNumber.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\SettingsType-TempString.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\N64System Settings.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Notification Settings.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Recompiler Settings.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Setting Config.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Advanced Options.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Directories.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Game - General.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Game - Plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Game - Recompiler.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Game - Status.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Game Browser.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Keyboard Shortcuts.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Options.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page - Plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Page.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\ModifiedEditBox.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\PartialGroupBox.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Cheats.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Frame Per Second Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Gui Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Main Menu Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Menu Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\MenuShortCuts.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Notification Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Rom Browser Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Settings Config.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Language Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Audio.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Memory Labels Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Memory.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\OpCode Analysis Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\OpCode Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Register Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\System Timing.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\TLB class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\BreakPoints.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\C Core Interface.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\C main.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\C Memory.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\CPU Log.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\CPU.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Dma.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Eeprom.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Exception.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\FlashRam.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Interpreter CPU.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Interpreter Ops.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Logging.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Mempak.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Pif.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\r4300i Commands.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\r4300i Memory.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\r4300i Registers.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Recompiler CPU.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Recompiler Fpu Ops.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Recompiler Ops.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Registers.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Sram.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Sync CPU.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\TLB Display.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Tlb.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Win32Timer.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\x86 fpu.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\X86.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Debugger - Memory Dump.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Debugger - Memory Search.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Debugger - TLB.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Debugger - View Memory.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Debugger.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Delay Slot Map Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Function Info.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Function Map Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Recompiler Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Section Info.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Cheat Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\N64 Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\N64 Rom Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Profiling Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Rom Information Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Speed Limitor Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Audio Plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Controller Plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\GFX plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Plugin Class.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Plugin List.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\RSP Plugin.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\UNZIP.OBJ" +"\My Programs\Emulation\Project64\Build\Project64\External\zip.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\7zip.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Processor Info.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\Gui Settings.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\main.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\ValidateBinary.obj" +"\My Programs\Emulation\Project64\Build\Project64\External\UI Resources.res" +"\My Programs\Emulation\Project64\Bin\External\Common.lib" +"\My Programs\Emulation\Project64\Bin\External\7zip.lib" +] +Creating command line "link.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPA2.tmp"

Output Window

Compiling resources... +Compiling... +SettingsType-Application.cpp +SettingsType-ApplicationIndex.cpp +SettingsType-Cheats.cpp +SettingsType-GameSetting.cpp +SettingsType-GameSettingIndex.cpp +SettingsType-RDBCpuType.cpp +SettingsType-RDBOnOff.cpp +SettingsType-RDBRamSize.cpp +SettingsType-RDBSaveChip.cpp +SettingsType-RDBYesNo.cpp +SettingsType-RelativePath.cpp +SettingsType-RomDatabase.cpp +SettingsType-RomDatabaseIndex.cpp +SettingsType-SelectedDirectory.cpp +SettingsType-TempBool.cpp +SettingsType-TempNumber.cpp +SettingsType-TempString.cpp +N64System Settings.cpp +Notification Settings.cpp +Recompiler Settings.cpp +Settings Class.cpp +Settings Page - Advanced Options.cpp +Settings Page - Directories.cpp +Settings Page - Game - General.cpp +Settings Page - Game - Plugin.cpp +Settings Page - Game - Recompiler.cpp +Settings Page - Game - Status.cpp +Settings Page - Game Browser.cpp +Settings Page - Keyboard Shortcuts.cpp +Settings Page - Options.cpp +C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlwin.h(2353) : warning C4247: 'StartDialogProc' not accessible because 'CSettingsPageImpl' uses 'public' to inherit from 'CDialogImpl' + C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlwin.h(2231) : see declaration of 'StartDialogProc' + C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlwin.h(2346) : while compiling class-template member function 'struct HWND__ *__thiscall ATL::CDialogImpl::Create(struct HWND__ *,long)' +Settings Page - Plugin.cpp +Settings Page.cpp +ModifiedEditBox.cpp +PartialGroupBox.cpp +Cheats.cpp +Frame Per Second Class.cpp +Gui Class.cpp +Main Menu Class.cpp +Menu Class.cpp +MenuShortCuts.cpp +Notification Class.cpp +Rom Browser Class.cpp +Settings Config.cpp +Language Class.cpp +Audio.cpp +Memory Labels Class.cpp +Memory.cpp +OpCode Analysis Class.cpp +OpCode Class.cpp +Register Class.cpp +System Timing.cpp +TLB class.cpp +BreakPoints.cpp +C Core Interface.cpp +C Memory.cpp +CPU.cpp +Dma.cpp +Eeprom.cpp +FlashRam.cpp +Interpreter CPU.cpp +Mempak.cpp +Pif.cpp +Recompiler CPU.cpp +Recompiler Fpu Ops.cpp +Recompiler Ops.cpp +Registers.cpp +Debugger - Memory Dump.cpp +Debugger - Memory Search.cpp +Debugger - TLB.cpp +Debugger - View Memory.cpp +Debugger.cpp +Delay Slot Map Class.cpp +Function Info.cpp +Function Map Class.cpp +Recompiler Class.cpp +Section Info.cpp +Cheat Class.cpp +N64 Class.cpp +N64 Rom Class.cpp +Profiling Class.cpp +Rom Information Class.cpp +Speed Limitor Class.cpp +Audio Plugin.cpp +Controller Plugin.cpp +GFX plugin.cpp +Plugin Class.cpp +Plugin List.cpp +RSP Plugin.cpp +Gui Settings.cpp +main.cpp +ValidateBinary.cpp Linking... -LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library +LINK : warning LNK4089: all references to "OLEAUT32.dll" discarded by /OPT:REF

Results

-Project64.exe - 0 error(s), 1 warning(s) +Project64.exe - 0 error(s), 2 warning(s)
diff --git a/Source/Project64/Settings.h b/Source/Project64/Settings.h index d36849df7..a2b5dfe3c 100644 --- a/Source/Project64/Settings.h +++ b/Source/Project64/Settings.h @@ -1,14 +1,221 @@ #ifndef __SETTINGS__H__ #define __SETTINGS__H__ -#define MaxRomBrowserFields 100 -#define MaxMD5_Per_Rom 10 -#define MaxCheats 500 #define MaxPluginSetting 65535 enum SettingID { //Default values - No_Default, Default_False, Default_True, Default_Language, Default_RdramSize, + Default_None, + Default_Constant, + + //information - temp keys + Info_RomLoading, + Info_ShortCutsChanged, + + //Support Files + SupportFile_Settings, + SupportFile_RomDatabase, + SupportFile_Cheats, + SupportFile_Notes, + SupportFile_ExtInfo, + SupportFile_ShortCuts, + SupportFile_RomListCache, + SupportFile_7zipCache, + + //Settings + Setting_ApplicationName, + Setting_UseFromRegistry, + Setting_RdbEditor, + Setting_DisableScrSaver, + Setting_AutoSleep, + Setting_AutoStart, + Setting_AutoFullscreen, + + Setting_AutoZipInstantSave, + Setting_RememberCheats, + Setting_CurrentLanguage, + + //RDB TLB Settings + Rdb_SaveChip, + Rdb_CpuType, + Rdb_RDRamSize, + Rdb_CounterFactor, + Rdb_UseTlb, + Rdb_DelaySi, + Rdb_SPHack, + Rdb_Status, + Rdb_FixedAudio, + Rdb_SyncViaAudio, + Rdb_RspAudioSignal, + Rdb_TLB_VAddrStart, + Rdb_TLB_VAddrLen, + Rdb_TLB_PAddrStart, + Rdb_UseHleGfx, + Rdb_UseHleAudio, + Rdb_LoadRomToMemory, + Rdb_ScreenHertz, + Rdb_FuncLookupMode, + Rdb_RegCache, + Rdb_BlockLinking, + Rdb_SMM_Cache, + Rdb_SMM_PIDMA, + Rdb_SMM_TLB, + Rdb_SMM_Protect, + Rdb_SMM_ValidFunc, + Rdb_GameCheatFix, + + //Individual Game Settings + Game_IniKey, + Game_GameName, + Game_GoodName, + Game_Plugin_Gfx, + Game_Plugin_Audio, + Game_Plugin_Controller, + Game_Plugin_RSP, + Game_SaveChip, + Game_CpuType, + Game_LastSaveSlot, + Game_FixedAudio, + Game_SyncViaAudio, + Game_SMM_Cache, + Game_SMM_Protect, + Game_SMM_ValidFunc, + Game_SMM_PIDMA, + Game_SMM_TLB, + Game_CurrentSaveState, + Game_RDRamSize, + Game_CounterFactor, + Game_UseTlb, + Game_DelaySI, + Game_SPHack, + Game_FuncLookupMode, + Game_RegCache, + Game_BlockLinking, + Game_ScreenHertz, + Game_RspAudioSignal, + Game_UseHleGfx, + Game_UseHleAudio, + Game_LoadRomToMemory, + + // General Game running info + GameRunning_LoadingInProgress, + GameRunning_CPU_Running, + GameRunning_CPU_Paused, + GameRunning_CPU_PausedType, + GameRunning_InstantSaveFile, + GameRunning_LimitFPS, + GameRunning_ScreenHertz, + + //User Interface + UserInterface_BasicMode, + UserInterface_ShowCPUPer, + UserInterface_DisplayFrameRate, + UserInterface_InFullScreen, + UserInterface_FrameDisplayType, + UserInterface_MainWindowTop, + UserInterface_MainWindowLeft, + UserInterface_AlwaysOnTop, + + RomBrowser_Enabled, + RomBrowser_ColoumnsChanged, + RomBrowser_Top, + RomBrowser_Left, + RomBrowser_Width, + RomBrowser_Height, + RomBrowser_PosIndex, + RomBrowser_WidthIndex, + RomBrowser_SortFieldIndex, + RomBrowser_SortAscendingIndex, + RomBrowser_Recursive, + RomBrowser_Maximized, + + //Directory Info + Directory_LastSave, + Directory_RecentGameDirCount, + Directory_RecentGameDirIndex, + Directory_Game, + Directory_GameInitial, + Directory_GameSelected, + Directory_GameUseSelected, + Directory_Plugin, + Directory_PluginInitial, + Directory_PluginSelected, + Directory_PluginUseSelected, + Directory_SnapShot, + Directory_SnapShotInitial, + Directory_SnapShotSelected, + Directory_SnapShotUseSelected, + Directory_NativeSave, + Directory_NativeSaveInitial, + Directory_NativeSaveSelected, + Directory_NativeSaveUseSelected, + Directory_InstantSave, + Directory_InstantSaveInitial, + Directory_InstantSaveSelected, + Directory_InstantSaveUseSelected, + Directory_Texture, + Directory_TextureInitial, + Directory_TextureSelected, + Directory_TextureUseSelected, + + //File Info + File_RecentGameFileCount, + File_RecentGameFileIndex, + + //Debugger + Debugger_Enabled, + Debugger_ShowUnhandledMemory, + Debugger_ShowPifErrors, + Debugger_ShowCheckOpUsageErrors, + Debugger_GenerateLogFiles, + Debugger_ProfileCode, + Debugger_DisableGameFixes, + Debugger_AppLogLevel, + Debugger_AppLogFlush, + Debugger_GenerateDebugLog, + Debugger_ShowDListAListCount, + Debugger_ShowRecompMemSize, + + //Beta Information + Beta_IsBetaVersion, + Beta_UserName, + Beta_UserNameMD5, + Beta_EmailAddress, + Beta_EmailAddressMD5, + Beta_IsValidExe, + + //Plugins + Plugin_RSP_Current, + Plugin_RSP_CurVer, + Plugin_GFX_Current, + Plugin_GFX_CurVer, + Plugin_AUDIO_Current, + Plugin_AUDIO_CurVer, + Plugin_CONT_Current, + Plugin_CONT_CurVer, + Plugin_UseHleGfx, + Plugin_UseHleAudio, + + //Cheats + Cheat_Entry, + Cheat_Active, + Cheat_Extension, + Cheat_Notes, + Cheat_Options, + Cheat_Range, + Cheat_RangeNotes, + + FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting, + FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting, + FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting, + FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting, + FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting, + FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting, + FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting, + FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting, + + +/* No_Default, Default_False, Default_True, Default_Language, Default_RdramSize, Default_RomStatus,Default_RomBrowserWidth,Default_RomBrowserHeight, Default_RememberedRomFiles, Default_RememberedRomDirs, Default_CheatExt, Default_SelfModCheck, Default_BlockLinking, Default_SaveSlot, Default_FunctionLookup, @@ -36,6 +243,7 @@ enum SettingID { LimitFPS, AlwaysOnTop, GenerateDebugLog, UseHighLevelGfx, UseHighLevelAudio, DisableGameFixes, AppLogLevel, AppLogFlush, DisplayFrameRate, FrameDisplayType, + //Debugger Debugger, ShowUnhandledMemory, ShowPifErrors, ShowDListAListCount, ShowCheckOpUsageErrors, ShowRecompMemSize, ShowPifRamErrors, @@ -79,12 +287,18 @@ enum SettingID { CheatActive, LastCheatActive = CheatActive + MaxCheats, CheatExtension, LastCheatExtension = CheatExtension + MaxCheats, - //Idvidual Game Settings + //Individual Game Settings + Game_SaveChip, Game_LastSaveSlot, + //RDB Settings + Rdb_SaveChip, + + //Default Values + System_SaveChip, + //Rom Settings Default_CPUType, - Default_SaveChip, Default_CFactor, ROM_IniKey, ROM_NAME, @@ -99,7 +313,6 @@ enum SettingID { ROM_Status, ROM_CoreNotes, ROM_PluginNotes, - ROM_SaveChip, ROM_CounterFactor, ROM_CustomSMM, ROM_SMM_Cache, @@ -141,7 +354,6 @@ enum SettingID { CPUType, //DWORD - Current CPU CPU_Paused, //bool - Is CPU Paused CPU_Paused_type, //DWORD - What type of pause is it - SaveChipType, //DWORD - Current Save Type SMM_ChangeMemory, SMM_CheckMemory2, SMM_CheckMemoryCache, @@ -170,6 +382,7 @@ enum SettingID { SMM_ValidFunc, //bool - Self mod method (Compare memory contents of function on finding) SMM_Protect, //bool - Self mod method (Protect Memory from any write to the code pages) SMM_TLB, //bool - Self mod method (clear code on TLB unmapping) +*/ }; #include "Support.h" diff --git a/Source/Project64/Settings/Gui Settings.cpp b/Source/Project64/Settings/Gui Settings.cpp index 0239f1c7e..900b148e3 100644 --- a/Source/Project64/Settings/Gui Settings.cpp +++ b/Source/Project64/Settings/Gui Settings.cpp @@ -1,34 +1,25 @@ #include "..\support.h" #include "..\Settings.h" -bool CGuiSettings::bCPURunning; -bool CGuiSettings::bAutoSleep; +bool CGuiSettings::m_bCPURunning; +bool CGuiSettings::m_bAutoSleep; CGuiSettings::CGuiSettings() { RefreshSettings(); - _Settings->RegisterChangeCB(CPU_Running,this,(CSettings::SettingChangedFunc)CPURunningChanged); - _Settings->RegisterChangeCB(AutoSleep,this,(CSettings::SettingChangedFunc)AutoSleepChanged); + _Settings->RegisterChangeCB(GameRunning_CPU_Running,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Setting_AutoSleep,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } CGuiSettings::~CGuiSettings() { - _Settings->UnregisterChangeCB(CPU_Running,this,(CSettings::SettingChangedFunc)CPURunningChanged); - _Settings->UnregisterChangeCB(AutoSleep,this,(CSettings::SettingChangedFunc)AutoSleepChanged); + _Settings->UnregisterChangeCB(GameRunning_CPU_Running,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Setting_AutoSleep,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } void CGuiSettings::RefreshSettings() { - bCPURunning = _Settings->LoadBool(CPU_Running); - bAutoSleep = _Settings->LoadBool(AutoSleep); + m_bCPURunning = _Settings->LoadBool(GameRunning_CPU_Running); + m_bAutoSleep = _Settings->LoadBool(Setting_AutoSleep); } -void CGuiSettings::CPURunningChanged (CGuiSettings * _this) -{ - _this->bCPURunning = _Settings->LoadBool(CPU_Running); -} - -void CGuiSettings::AutoSleepChanged (CGuiSettings * _this) -{ - _this->bAutoSleep = _Settings->LoadBool(AutoSleep); -} diff --git a/Source/Project64/Settings/Gui Settings.h b/Source/Project64/Settings/Gui Settings.h index eb33a11fd..d6de04de5 100644 --- a/Source/Project64/Settings/Gui Settings.h +++ b/Source/Project64/Settings/Gui Settings.h @@ -2,15 +2,21 @@ class CGuiSettings { - static void CPURunningChanged (CGuiSettings * _this); - static void AutoSleepChanged (CGuiSettings * _this); + static void StaticRefreshSettings (CGuiSettings * _this) + { + _this->RefreshSettings(); + } + + void RefreshSettings ( void ); + + static bool m_bCPURunning; + static bool m_bAutoSleep; protected: CGuiSettings(); virtual ~CGuiSettings(); - void RefreshSettings ( void ); + static inline bool bCPURunning ( void) { return m_bCPURunning; } + static inline bool bAutoSleep ( void) { return m_bAutoSleep; } - static bool bCPURunning; - static bool bAutoSleep; }; \ No newline at end of file diff --git a/Source/Project64/Settings/N64System Settings.cpp b/Source/Project64/Settings/N64System Settings.cpp index c2f8ecde9..b51387130 100644 --- a/Source/Project64/Settings/N64System Settings.cpp +++ b/Source/Project64/Settings/N64System Settings.cpp @@ -1,75 +1,61 @@ #include "..\support.h" #include "..\Settings.h" -bool CN64SystemSettings::bShowCPUPer; //= _Settings->LoadDword(ShowCPUPer) != 0; -bool CN64SystemSettings::bProfiling; //= _Settings->LoadDword(ProfileCode) != 0; -bool CN64SystemSettings::bBasicMode; //= _Settings->LoadDword(BasicMode) != 0; -bool CN64SystemSettings::bLimitFPS; //= _Settings->LoadDword(LimitFPS) != 0; -bool CN64SystemSettings::bShowDListAListCount; //= _Settings->LoadDword(ShowDListAListCount) != 0; -bool CN64SystemSettings::bFixedAudio; //= _Settings->LoadDword(ROM_FixedAudio) != 0; -bool CN64SystemSettings::bSyncToAudio; //7= _Settings->LoadDword(SyncViaAudio) != 0; -bool CN64SystemSettings::bDisplayFrameRate; //7= _Settings->LoadDword(SyncViaAudio) != 0; -bool CN64SystemSettings::bCleanFrameBox = false; //7= _Settings->LoadDword(SyncViaAudio) != 0; +bool CN64SystemSettings::m_bShowCPUPer; +bool CN64SystemSettings::m_bProfiling; +bool CN64SystemSettings::m_bBasicMode; +bool CN64SystemSettings::m_bLimitFPS; +bool CN64SystemSettings::m_bShowDListAListCount; +bool CN64SystemSettings::m_bFixedAudio; +bool CN64SystemSettings::m_bSyncToAudio; +bool CN64SystemSettings::m_bDisplayFrameRate; +bool CN64SystemSettings::m_SPHack; + CN64SystemSettings::CN64SystemSettings() { - _Settings->RegisterChangeCB(ShowCPUPer,this,(CSettings::SettingChangedFunc)ShowCPUPerChanged); - _Settings->RegisterChangeCB(ProfileCode,this,(CSettings::SettingChangedFunc)ProfilingChanged); - _Settings->RegisterChangeCB(BasicMode,this,(CSettings::SettingChangedFunc)BasicModeChanged); - _Settings->RegisterChangeCB(LimitFPS,this,(CSettings::SettingChangedFunc)LimitFPSChanged); - _Settings->RegisterChangeCB(ShowDListAListCount,this,(CSettings::SettingChangedFunc)ShowDListAListCountChanged); - _Settings->RegisterChangeCB(DisplayFrameRate,this,(CSettings::SettingChangedFunc)DisplayFrameRateChanged); + _Settings->RegisterChangeCB(UserInterface_BasicMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(UserInterface_ShowCPUPer,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(UserInterface_DisplayFrameRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Debugger_ShowDListAListCount,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->RegisterChangeCB(GameRunning_LimitFPS,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->RegisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); RefreshSettings(); } CN64SystemSettings::~CN64SystemSettings() { - _Settings->UnregisterChangeCB(ShowCPUPer,this,(CSettings::SettingChangedFunc)ShowCPUPerChanged); - _Settings->UnregisterChangeCB(ProfileCode,this,(CSettings::SettingChangedFunc)ProfilingChanged); - _Settings->UnregisterChangeCB(BasicMode,this,(CSettings::SettingChangedFunc)BasicModeChanged); - _Settings->UnregisterChangeCB(LimitFPS,this,(CSettings::SettingChangedFunc)LimitFPSChanged); - _Settings->UnregisterChangeCB(ShowDListAListCount,this,(CSettings::SettingChangedFunc)ShowDListAListCountChanged); - _Settings->UnregisterChangeCB(DisplayFrameRate,this,(CSettings::SettingChangedFunc)DisplayFrameRateChanged); + _Settings->UnregisterChangeCB(UserInterface_BasicMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(UserInterface_ShowCPUPer,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Debugger_ShowDListAListCount,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->UnregisterChangeCB(GameRunning_LimitFPS,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + _Settings->UnregisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } void CN64SystemSettings::RefreshSettings() { - bShowCPUPer = _Settings->LoadDword(ShowCPUPer) != 0; - bProfiling = _Settings->LoadDword(ProfileCode) != 0; - bBasicMode = _Settings->LoadDword(BasicMode) != 0; - bLimitFPS = _Settings->LoadDword(LimitFPS) != 0; - bShowDListAListCount = _Settings->LoadDword(ShowDListAListCount) != 0; - bFixedAudio = _Settings->LoadDword(ROM_FixedAudio) != 0; - bSyncToAudio = bFixedAudio ? _Settings->LoadDword(SyncViaAudio) != 0 : false; - bDisplayFrameRate = _Settings->LoadDword(DisplayFrameRate) != 0; -} + m_bBasicMode = _Settings->LoadBool(UserInterface_BasicMode); + m_bDisplayFrameRate = _Settings->LoadBool(UserInterface_DisplayFrameRate); -void CN64SystemSettings::ShowCPUPerChanged (CN64SystemSettings * _this) -{ - _this->bShowCPUPer = _Settings->LoadDword(ShowCPUPer) != 0; -} + m_bShowCPUPer = _Settings->LoadBool(UserInterface_ShowCPUPer); + m_bProfiling = _Settings->LoadBool(Debugger_ProfileCode); + m_bShowDListAListCount = _Settings->LoadBool(Debugger_ShowDListAListCount); + m_bLimitFPS = _Settings->LoadBool(GameRunning_LimitFPS); -void CN64SystemSettings::ProfilingChanged (CN64SystemSettings * _this) -{ - _this->bProfiling = _Settings->LoadDword(ProfileCode) != 0; -} - -void CN64SystemSettings::BasicModeChanged (CN64SystemSettings * _this) -{ - _this->bBasicMode = _Settings->LoadDword(BasicMode) != 0; -} - -void CN64SystemSettings::LimitFPSChanged (CN64SystemSettings * _this) -{ - _this->bLimitFPS = _Settings->LoadDword(LimitFPS) != 0; -} - -void CN64SystemSettings::ShowDListAListCountChanged (CN64SystemSettings * _this) -{ - _this->bShowDListAListCount = _Settings->LoadDword(ShowDListAListCount) != 0; -} - -void CN64SystemSettings::DisplayFrameRateChanged (CN64SystemSettings * _this) -{ - _this->bDisplayFrameRate = _Settings->LoadDword(DisplayFrameRate) != 0; + m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio); + m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false; + m_SPHack = _Settings->LoadBool(Game_SPHack); } diff --git a/Source/Project64/Settings/N64System Settings.h b/Source/Project64/Settings/N64System Settings.h index 4c59d0935..843103343 100644 --- a/Source/Project64/Settings/N64System Settings.h +++ b/Source/Project64/Settings/N64System Settings.h @@ -2,27 +2,34 @@ class CN64SystemSettings { - static void ShowCPUPerChanged (CN64SystemSettings * _this); - static void ProfilingChanged (CN64SystemSettings * _this); - static void BasicModeChanged (CN64SystemSettings * _this); - static void LimitFPSChanged (CN64SystemSettings * _this); - static void ShowDListAListCountChanged (CN64SystemSettings * _this); - static void DisplayFrameRateChanged (CN64SystemSettings * _this); - static void FrameRateTypeChanged (CN64SystemSettings * _this); + static void StaticRefreshSettings (CN64SystemSettings * _this) + { + _this->RefreshSettings(); + } + + void RefreshSettings ( void ); + + static bool m_bShowCPUPer; + static bool m_bProfiling; + static bool m_bBasicMode; + static bool m_bLimitFPS; + static bool m_bShowDListAListCount; + static bool m_bFixedAudio; + static bool m_bSyncToAudio; + static bool m_bDisplayFrameRate; + static bool m_SPHack; protected: CN64SystemSettings(); virtual ~CN64SystemSettings(); - void RefreshSettings ( void ); - - static bool bShowCPUPer; - static bool bProfiling; - static bool bBasicMode; - static bool bLimitFPS; - static bool bShowDListAListCount; - static bool bFixedAudio; - static bool bSyncToAudio; - static bool bDisplayFrameRate; - static bool bCleanFrameBox; + inline bool bBasicMode ( void ) const { return m_bBasicMode; } + inline bool bDisplayFrameRate ( void ) const { return m_bDisplayFrameRate; } + inline bool bShowCPUPer ( void ) const { return m_bShowCPUPer; } + inline bool bProfiling ( void ) const { return m_bProfiling; } + inline bool bShowDListAListCount ( void ) const { return m_bShowDListAListCount; } + inline bool bLimitFPS ( void ) const { return m_bLimitFPS; } + inline bool bFixedAudio ( void ) const { return m_bFixedAudio; } + inline bool bSyncToAudio ( void ) const { return m_bSyncToAudio; } + inline bool bSPHack ( void ) const { return m_SPHack; } }; \ No newline at end of file diff --git a/Source/Project64/Settings/Notification Settings.cpp b/Source/Project64/Settings/Notification Settings.cpp index f8d67aeea..3c72f3b91 100644 --- a/Source/Project64/Settings/Notification Settings.cpp +++ b/Source/Project64/Settings/Notification Settings.cpp @@ -1,23 +1,23 @@ #include "..\Settings.h" #include "Notification Settings.h" -bool CNotificationSettings::bInFullScreen; //= _Settings->Load(InFullScreen) != 0; +bool CNotificationSettings::m_bInFullScreen = false; CNotificationSettings::CNotificationSettings() { - bInFullScreen = _Settings->LoadBool(InFullScreen); - _Settings->RegisterChangeCB(InFullScreen,this,(CSettings::SettingChangedFunc)InFullScreenChanged); + _Settings->RegisterChangeCB(UserInterface_InFullScreen,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + RefreshSettings(); } CNotificationSettings::~CNotificationSettings() { if (_Settings) { - _Settings->UnregisterChangeCB(InFullScreen,this,(CSettings::SettingChangedFunc)InFullScreenChanged); + _Settings->UnregisterChangeCB(UserInterface_InFullScreen,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } } -void CNotificationSettings::InFullScreenChanged (CNotificationSettings * _this) +void CNotificationSettings::RefreshSettings() { - bInFullScreen = _Settings->LoadBool(InFullScreen); + m_bInFullScreen = _Settings->LoadBool(UserInterface_InFullScreen); } diff --git a/Source/Project64/Settings/Notification Settings.h b/Source/Project64/Settings/Notification Settings.h index 49de38f47..bf0b1d7d2 100644 --- a/Source/Project64/Settings/Notification Settings.h +++ b/Source/Project64/Settings/Notification Settings.h @@ -1,11 +1,17 @@ class CNotificationSettings { - static void InFullScreenChanged (CNotificationSettings * _this); + static void StaticRefreshSettings (CNotificationSettings * _this) + { + _this->RefreshSettings(); + } + + void RefreshSettings ( void ); + + static bool m_bInFullScreen; protected: CNotificationSettings(); virtual ~CNotificationSettings(); - //Settings that can be changed on the fly - static bool bInFullScreen; + inline bool InFullScreen ( void ) const { return m_bInFullScreen; } }; diff --git a/Source/Project64/Settings/Recompiler Settings.cpp b/Source/Project64/Settings/Recompiler Settings.cpp index 7662d40b2..0ca1d8c70 100644 --- a/Source/Project64/Settings/Recompiler Settings.cpp +++ b/Source/Project64/Settings/Recompiler Settings.cpp @@ -1,47 +1,66 @@ #pragma once #include "..\Settings.h" -bool CRecompilerSettings::bShowRecompMemSize; //= _Settings->LoadDword(ShowRecompMemSize) != 0; -bool CRecompilerSettings::bSMM_Protect; //= _Settings->LoadDword(SMM_Protect) != 0; -bool CRecompilerSettings::bSMM_ValidFunc; //= _Settings->LoadDword(SMM_ValidFunc) != 0; -bool CRecompilerSettings::bSMM_PIDMA; //= _Settings->LoadDword(SMM_PIDMA) != 0; -bool CRecompilerSettings::bSMM_TLB; //= _Settings->LoadDword(SMM_TLB) != 0; -bool CRecompilerSettings::bProfiling; //= _Settings->LoadDword(ProfileCode) != 0; -bool CRecompilerSettings::bRomInMemory; //= _Settings->LoadDword(ProfileCode) != 0; +bool CRecompilerSettings::m_bShowRecompMemSize; +bool CRecompilerSettings::m_bSMM_Protect; +bool CRecompilerSettings::m_bSMM_ValidFunc; +bool CRecompilerSettings::m_bSMM_PIDMA; +bool CRecompilerSettings::m_bSMM_TLB; +bool CRecompilerSettings::m_bProfiling; +bool CRecompilerSettings::m_bRomInMemory; +bool CRecompilerSettings::m_RegCaching; +bool CRecompilerSettings::m_bLinkBlocks; +DWORD CRecompilerSettings::m_RdramSize; +DWORD CRecompilerSettings::m_CountPerOp; +DWORD CRecompilerSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD CRecompilerSettings::CRecompilerSettings() { - bShowRecompMemSize = _Settings->LoadDword(ShowRecompMemSize) != 0; - bSMM_Protect = _Settings->LoadDword(SMM_Protect) != 0; - bSMM_ValidFunc = _Settings->LoadDword(SMM_ValidFunc) != 0; - bSMM_PIDMA = _Settings->LoadDword(SMM_PIDMA) != 0; - bSMM_TLB = _Settings->LoadDword(SMM_TLB) != 0; - bProfiling = _Settings->LoadDword(ProfileCode) != 0; - bRomInMemory = _Settings->LoadDword(RomInMemory) != 0; - _Settings->RegisterChangeCB(ShowRecompMemSize,this,(CSettings::SettingChangedFunc)ShowRecompMemSizeChanged); - _Settings->RegisterChangeCB(ProfileCode,this,(CSettings::SettingChangedFunc)ProfilingChanged); - _Settings->RegisterChangeCB(RomInMemory,this,(CSettings::SettingChangedFunc)RomInMemoryChanged); + _Settings->RegisterChangeCB(Game_SMM_Protect,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_SMM_ValidFunc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_SMM_PIDMA,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_SMM_TLB,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_LoadRomToMemory,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + RefreshSettings(); } CRecompilerSettings::~CRecompilerSettings() { - _Settings->UnregisterChangeCB(ShowRecompMemSize,this,(CSettings::SettingChangedFunc)ShowRecompMemSizeChanged); - _Settings->UnregisterChangeCB(ProfileCode,this,(CSettings::SettingChangedFunc)ProfilingChanged); - _Settings->UnregisterChangeCB(RomInMemory,this,(CSettings::SettingChangedFunc)RomInMemoryChanged); + _Settings->UnregisterChangeCB(Game_SMM_Protect,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_SMM_ValidFunc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_SMM_PIDMA,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_SMM_TLB,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_LoadRomToMemory,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } -void CRecompilerSettings::ShowRecompMemSizeChanged (CRecompilerSettings * _this) +void CRecompilerSettings::RefreshSettings() { - _this->bShowRecompMemSize = _Settings->LoadDword(ShowRecompMemSize) != 0; -} + m_bSMM_Protect = _Settings->LoadBool(Game_SMM_Protect); + m_bSMM_ValidFunc = _Settings->LoadBool(Game_SMM_ValidFunc); + m_bSMM_PIDMA = _Settings->LoadBool(Game_SMM_PIDMA); + m_bSMM_TLB = _Settings->LoadBool(Game_SMM_TLB); + m_bShowRecompMemSize = _Settings->LoadBool(Debugger_ShowRecompMemSize); + m_bProfiling = _Settings->LoadBool(Debugger_ProfileCode); + m_bRomInMemory = _Settings->LoadBool(Game_LoadRomToMemory); - -void CRecompilerSettings::ProfilingChanged (CRecompilerSettings * _this) -{ - _this->bProfiling = _Settings->LoadDword(ProfileCode) != 0; -} - -void CRecompilerSettings::RomInMemoryChanged (CRecompilerSettings * _this) -{ - _this->bRomInMemory = _Settings->LoadDword(RomInMemory) != 0; + m_RegCaching = _Settings->LoadBool(Game_RegCache); + m_bLinkBlocks = _Settings->LoadBool(Game_BlockLinking); + m_RdramSize = _Settings->LoadDword(Game_RDRamSize); + m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); + m_LookUpMode = _Settings->LoadDword(Game_FuncLookupMode); } diff --git a/Source/Project64/Settings/Recompiler Settings.h b/Source/Project64/Settings/Recompiler Settings.h index 6c4bd0fd4..7d4a80ddc 100644 --- a/Source/Project64/Settings/Recompiler Settings.h +++ b/Source/Project64/Settings/Recompiler Settings.h @@ -1,19 +1,44 @@ +#include + class CRecompilerSettings { - static void ShowRecompMemSizeChanged (CRecompilerSettings * _this); - static void RomInMemoryChanged (CRecompilerSettings * _this); - static void ProfilingChanged (CRecompilerSettings * _this); + static void StaticRefreshSettings (CRecompilerSettings * _this) + { + _this->RefreshSettings(); + } + + void RefreshSettings ( void ); + + + //Settings that can be changed on the fly + static bool m_bShowRecompMemSize; + static bool m_bSMM_Protect; + static bool m_bSMM_ValidFunc; + static bool m_bSMM_PIDMA; + static bool m_bSMM_TLB; + static bool m_bProfiling; + static bool m_bRomInMemory; + + static bool m_RegCaching; + static bool m_bLinkBlocks; + static DWORD m_RdramSize; + static DWORD m_CountPerOp; + static DWORD m_LookUpMode; //FUNC_LOOKUP_METHOD public: CRecompilerSettings(); virtual ~CRecompilerSettings(); - //Settings that can be changed on the fly - static bool bShowRecompMemSize; - static bool bSMM_Protect; - static bool bSMM_ValidFunc; - static bool bSMM_PIDMA; - static bool bSMM_TLB; - static bool bProfiling; - static bool bRomInMemory; + inline bool bShowRecompMemSize ( void ) const { return m_bShowRecompMemSize; } + inline bool bSMM_Protect ( void ) const { return m_bSMM_Protect; } + inline bool bSMM_ValidFunc ( void ) const { return m_bSMM_ValidFunc; } + inline bool bSMM_PIDMA ( void ) const { return m_bSMM_PIDMA; } + inline bool bSMM_TLB ( void ) const { return m_bSMM_TLB; } + inline bool bProfiling ( void ) const { return m_bProfiling; } + inline bool bRomInMemory ( void ) const { return m_bRomInMemory; } + inline bool bRegCaching ( void ) const { return m_RegCaching; } + inline bool bLinkBlocks ( void ) const { return m_bLinkBlocks; } + inline DWORD RdramSize ( void ) const { return m_RdramSize; } + inline DWORD CountPerOp ( void ) const { return m_CountPerOp; } + inline FUNC_LOOKUP_METHOD LookUpMode ( void ) const { return (FUNC_LOOKUP_METHOD)m_LookUpMode; } }; \ No newline at end of file diff --git a/Source/Project64/Settings/SettingType/SettingsType-Application.cpp b/Source/Project64/Settings/SettingType/SettingsType-Application.cpp index 15020d1d2..ac81d89ae 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Application.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-Application.cpp @@ -10,7 +10,7 @@ CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, DW m_KeyName(Name), m_DefaultStr(""), m_DefaultValue(DefaultValue), - m_DefaultSetting(No_Default), + m_DefaultSetting(Default_Constant), m_KeyNameIdex(m_KeyName) { } @@ -20,7 +20,7 @@ CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, bo m_KeyName(Name), m_DefaultStr(""), m_DefaultValue(DefaultValue), - m_DefaultSetting(No_Default), + m_DefaultSetting(Default_Constant), m_KeyNameIdex(m_KeyName) { } @@ -30,7 +30,7 @@ CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, LP m_KeyName(Name), m_DefaultStr(DefaultValue), m_DefaultValue(0), - m_DefaultSetting(No_Default), + m_DefaultSetting(Default_Constant), m_KeyNameIdex(m_KeyName) { } @@ -52,8 +52,9 @@ CSettingTypeApplication::~CSettingTypeApplication() void CSettingTypeApplication::Initilize( const char * AppName ) { - m_SettingsIniFile = new CIniFile(_Settings->LoadString(SettingsIniName).c_str()); - m_UseRegistry = _Settings->LoadBool(UseSettingFromRegistry); + m_SettingsIniFile = new CIniFile(_Settings->LoadString(SupportFile_Settings).c_str()); + m_SettingsIniFile->SetAutoFlush(false); + m_UseRegistry = _Settings->LoadBool(Setting_UseFromRegistry); } @@ -61,6 +62,7 @@ void CSettingTypeApplication::CleanUp() { if (m_SettingsIniFile) { + m_SettingsIniFile->SetAutoFlush(true); delete m_SettingsIniFile; m_SettingsIniFile = NULL; } @@ -68,15 +70,30 @@ void CSettingTypeApplication::CleanUp() bool CSettingTypeApplication::Load ( int Index, bool & Value ) const { + bool bRes = false; + if (!m_UseRegistry) { DWORD dwValue; - bool bRes = m_SettingsIniFile->GetNumber(m_Section.c_str(),m_KeyNameIdex.c_str(),m_DefaultValue,dwValue); - Value = dwValue != 0; - return bRes; + bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue); + if (bRes) + { + Value = dwValue != 0; + } + } else { + Notify().BreakPoint(__FILE__,__LINE__); } - Notify().BreakPoint(__FILE__,__LINE__); - return false; + + if (!bRes && m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue != 0; + } else { + _Settings->LoadBool(m_DefaultSetting,Value); + } + } + return bRes; } bool CSettingTypeApplication::Load ( int Index, ULONG & Value ) const @@ -84,45 +101,99 @@ bool CSettingTypeApplication::Load ( int Index, ULONG & Value ) const bool bRes; if (!m_UseRegistry) { - bRes = m_SettingsIniFile->GetNumber(m_Section.c_str(),m_KeyNameIdex.c_str(),m_DefaultValue,Value); + bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } - if (!bRes && m_DefaultSetting != No_Default) + if (!bRes && m_DefaultSetting != Default_None) { - bRes = _Settings->LoadDword(m_DefaultSetting,Value); + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue; + } else { + _Settings->LoadDword(m_DefaultSetting,Value); + } } return bRes; } +LPCSTR CSettingTypeApplication::SectionName ( void ) const +{ + return m_Section.c_str(); +} + bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const { bool bRes; if (!m_UseRegistry) { - bRes = m_SettingsIniFile->GetString(m_Section.c_str(),m_KeyNameIdex.c_str(),m_DefaultStr,Value); + bRes = m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } - if (!bRes && m_DefaultSetting != No_Default) + if (!bRes) { - bRes = _Settings->LoadString(m_DefaultSetting,Value); + CSettingTypeApplication::LoadDefault(Index,Value); } return bRes; } +//return the default values +void CSettingTypeApplication::LoadDefault ( int Index, bool & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue != 0; + } else { + _Settings->LoadBool(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeApplication::LoadDefault ( int Index, ULONG & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue; + } else { + _Settings->LoadDword(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeApplication::LoadDefault ( int Index, stdstr & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultStr; + } else { + _Settings->LoadString(m_DefaultSetting,Value); + } + } +} //Update the settings void CSettingTypeApplication::Save ( int Index, bool Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + if (!m_UseRegistry) + { + m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value); + } else { + Notify().BreakPoint(__FILE__,__LINE__); + } } void CSettingTypeApplication::Save ( int Index, ULONG Value ) { if (!m_UseRegistry) { - m_SettingsIniFile->SaveNumber(m_Section.c_str(),m_KeyNameIdex.c_str(),Value); + m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } @@ -132,7 +203,7 @@ void CSettingTypeApplication::Save ( int Index, const stdstr & Value ) { if (!m_UseRegistry) { - m_SettingsIniFile->SaveString(m_Section.c_str(),m_KeyNameIdex.c_str(),Value.c_str()); + m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str()); } else { Notify().BreakPoint(__FILE__,__LINE__); } @@ -142,7 +213,7 @@ void CSettingTypeApplication::Save ( int Index, const char * Value ) { if (!m_UseRegistry) { - m_SettingsIniFile->SaveString(m_Section.c_str(),m_KeyNameIdex.c_str(),Value); + m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } @@ -162,3 +233,13 @@ stdstr CSettingTypeApplication::FixSectionName(LPCSTR Section) } return SectionName; } + +void CSettingTypeApplication::Delete( int Index ) +{ + if (!m_UseRegistry) + { + m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL); + } else { + Notify().BreakPoint(__FILE__,__LINE__); + } +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-Application.h b/Source/Project64/Settings/SettingType/SettingsType-Application.h index be2d13b3c..8c89e6c16 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Application.h +++ b/Source/Project64/Settings/SettingType/SettingsType-Application.h @@ -4,19 +4,21 @@ class CSettingTypeApplication : public CSettingType { +protected: const LPCSTR m_DefaultStr; const DWORD m_DefaultValue; const SettingID m_DefaultSetting; stdstr FixSectionName (LPCSTR Section); -protected: static CIniFile * m_SettingsIniFile; static bool m_UseRegistry; const stdstr m_Section; - const LPCSTR m_KeyName; + const stdstr m_KeyName; mutable stdstr m_KeyNameIdex; + virtual LPCSTR SectionName ( void ) const; + public: CSettingTypeApplication(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ); CSettingTypeApplication(LPCSTR Section, LPCSTR Name, bool DefaultValue ); @@ -24,19 +26,27 @@ public: CSettingTypeApplication(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ); ~CSettingTypeApplication(); - virtual bool IndexBasedSetting ( void ) const { return false; } - virtual SettingLocation GetSettingsLocation ( void ) const { return m_UseRegistry ? SettingLocation_Registry : SettingLocation_CfgFile; } + virtual bool IndexBasedSetting ( void ) const { return false; } + virtual SettingType GetSettingType ( void ) const { return m_UseRegistry ? SettingType_Registry : SettingType_CfgFile; } //return the values - virtual bool Load ( int Index, bool & Value ) const; - virtual bool Load ( int Index, ULONG & Value ) const; - virtual bool Load ( int Index, stdstr & Value ) const; + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - virtual void Save ( int Index, bool Value ); - virtual void Save ( int Index, ULONG Value ); - virtual void Save ( int Index, const stdstr & Value ); - virtual void Save ( int Index, const char * Value ); + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); // Initilize this class to use ini or registry static void Initilize ( const char * AppName ); diff --git a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp index 604c78613..749151c3e 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.cpp @@ -27,41 +27,68 @@ CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCST bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const { - Notify().BreakPoint(__FILE__,__LINE__); - return false; + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + return CSettingTypeApplication::Load(0,Value); } bool CSettingTypeApplicationIndex::Load ( int Index, ULONG & Value ) const { - m_KeyNameIdex.Format("%s %d",m_KeyName,Index); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); return CSettingTypeApplication::Load(0,Value); } bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const { - m_KeyNameIdex.Format("%s %d",m_KeyName,Index); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); return CSettingTypeApplication::Load(0,Value); } +//return the default values +void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const +{ + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::LoadDefault(0,Value); +} + +void CSettingTypeApplicationIndex::LoadDefault ( int Index, ULONG & Value ) const +{ + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::LoadDefault(0,Value); +} + +void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const +{ + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::LoadDefault(0,Value); +} + //Update the settings void CSettingTypeApplicationIndex::Save ( int Index, bool Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::Save(0,Value); } void CSettingTypeApplicationIndex::Save ( int Index, ULONG Value ) { - m_KeyNameIdex.Format("%s %d",m_KeyName,Index); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); CSettingTypeApplication::Save(0,Value); } void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value ) { - m_KeyNameIdex.Format("%s %d",m_KeyName,Index); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); CSettingTypeApplication::Save(0,Value); } void CSettingTypeApplicationIndex::Save ( int Index, const char * Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::Save(0,Value); +} + +void CSettingTypeApplicationIndex::Delete ( int Index ) +{ + m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index); + CSettingTypeApplication::Save(0,(const char *)NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.h b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.h index cc2834227..9a61c593f 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.h +++ b/Source/Project64/Settings/SettingType/SettingsType-ApplicationIndex.h @@ -18,10 +18,18 @@ public: virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const; + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + //Update the settings virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-Base.h b/Source/Project64/Settings/SettingType/SettingsType-Base.h index c002d7cef..fab2bba3f 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Base.h +++ b/Source/Project64/Settings/SettingType/SettingsType-Base.h @@ -1,36 +1,46 @@ #pragma once -enum SettingLocation { - SettingLocation_ConstString = 0, - SettingLocation_ConstValue = 1, - SettingLocation_CfgFile = 2, - SettingLocation_Registry = 3, - SettingLocation_RelativePath = 4, - TemporarySetting = 5, - SettingLocation_RomDatabase = 6, - CheatSetting = 7, - SettingLocation_GameSetting = 8, - SettingLocation_BoolVariable = 9, - SettingLocation_NumberVariable = 10, - SettingLocation_StringVariable = 11, +enum SettingType { + SettingType_Unknown = -1, + SettingType_ConstString = 0, + SettingType_ConstValue = 1, + SettingType_CfgFile = 2, + SettingType_Registry = 3, + SettingType_RelativePath = 4, + TemporarySetting = 5, + SettingType_RomDatabase = 6, + SettingType_CheatSetting = 7, + SettingType_GameSetting = 8, + SettingType_BoolVariable = 9, + SettingType_NumberVariable = 10, + SettingType_StringVariable = 11, + SettingType_SelectedDirectory = 12, }; class CSettingType { public: - virtual SettingLocation GetSettingsLocation ( void ) const = 0; - virtual bool IndexBasedSetting ( void ) const = 0; + virtual SettingType GetSettingType ( void ) const = 0; + virtual bool IndexBasedSetting ( void ) const = 0; //return the values virtual bool Load ( int Index, bool & Value ) const = 0; virtual bool Load ( int Index, ULONG & Value ) const = 0; virtual bool Load ( int Index, stdstr & Value ) const = 0; + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const = 0; + virtual void LoadDefault ( int Index, ULONG & Value ) const = 0; + virtual void LoadDefault ( int Index, stdstr & Value ) const = 0; + //Update the settings virtual void Save ( int Index, bool Value ) = 0; virtual void Save ( int Index, ULONG Value ) = 0; virtual void Save ( int Index, const stdstr & Value ) = 0; virtual void Save ( int Index, const char * Value ) = 0; + // Delete the setting + virtual void Delete ( int Index ) = 0; + }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp new file mode 100644 index 000000000..7a977649b --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp @@ -0,0 +1,114 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-Cheats.h" + +CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL; +stdstr CSettingTypeCheats::m_SectionIdent; + +CSettingTypeCheats::CSettingTypeCheats(LPCSTR PostFix ) : + m_PostFix(PostFix) +{ +} + +void CSettingTypeCheats::Initilize ( void ) +{ + m_CheatIniFile = new CIniFile(_Settings->LoadString(SupportFile_Cheats).c_str()); + m_CheatIniFile->SetAutoFlush(false); + _Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged); + m_SectionIdent = _Settings->LoadString(Game_IniKey); + GameChanged(NULL); +} + +void CSettingTypeCheats::CleanUp ( void ) +{ + if (m_CheatIniFile) + { + m_CheatIniFile->SetAutoFlush(true); + delete m_CheatIniFile; + m_CheatIniFile = NULL; + } +} + +void CSettingTypeCheats::GameChanged ( void * /*Data */ ) +{ + m_SectionIdent = _Settings->LoadString(Game_IniKey); +} + + +/*stdstr CSettingTypeCheats::FixName ( LPCSTR Section, LPCSTR Name ) +{ +} + +LPCSTR CSettingTypeCheats::SectionName ( void ) const +{ + return ""; +} + +void CSettingTypeCheats::UpdateSettings ( void * ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +}*/ + +bool CSettingTypeCheats::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeCheats::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const +{ + if (m_CheatIniFile == NULL) + { + return false; + } + stdstr_f Key("Cheat%d%s",Index,m_PostFix); + return m_CheatIniFile->GetString(m_SectionIdent.c_str(),Key.c_str(),"",Value); +} + +//return the default values +void CSettingTypeCheats::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeCheats::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::Save ( int Index, ULONG Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeCheats::Delete ( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.h b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h new file mode 100644 index 000000000..c8ea134f4 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h @@ -0,0 +1,55 @@ +#pragma once + +class CSettingTypeCheats : + public CSettingType +{ + +protected: + static CIniFile * m_CheatIniFile; + static stdstr m_SectionIdent; + const LPCSTR m_PostFix; +/* const LPCSTR m_DefaultStr; + const DWORD m_DefaultValue; + const SettingID m_DefaultSetting; + + stdstr FixSectionName (LPCSTR Section); + + static CIniFile * m_SettingsIniFile; + static bool m_UseRegistry; + const stdstr m_Section; + const stdstr m_KeyName; + + virtual LPCSTR SectionName ( void ) const;*/ + static void GameChanged ( void * /*Data */ ); + +public: + CSettingTypeCheats(LPCSTR PostFix ); + ~CSettingTypeCheats(); + + virtual bool IndexBasedSetting ( void ) const { return true; } + virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; } + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); + + // Initilize this class to use ini or registry + static void Initilize ( void ); + static void CleanUp ( void ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp index 392a74726..01059910d 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.cpp @@ -3,57 +3,220 @@ #include "SettingsType-Application.h" #include "SettingsType-GameSetting.h" +bool CSettingTypeGame::m_RdbEditor = false; +stdstr CSettingTypeGame::m_SectionIdent; + CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ) : - CSettingTypeApplication(Section,Name,DefaultValue) + CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultValue) { } CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, DWORD DefaultValue ) : - CSettingTypeApplication(Section,Name,DefaultValue) + CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultValue) { } CSettingTypeGame::CSettingTypeGame(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ) : - CSettingTypeApplication(Section,Name,DefaultSetting) + CSettingTypeApplication("",FixName(Section,Name).c_str(),DefaultSetting) { } -bool CSettingTypeGame::Load ( bool & Value ) const +CSettingTypeGame::~CSettingTypeGame() { - Notify().BreakPoint(__FILE__,__LINE__); - return false; } -bool CSettingTypeGame::Load ( ULONG & Value ) const +void CSettingTypeGame::Initilize ( void ) { - Notify().BreakPoint(__FILE__,__LINE__); - return false; + UpdateSettings(NULL); + _Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings); } -bool CSettingTypeGame::Load ( stdstr & Value ) const +void CSettingTypeGame::CleanUp ( void ) { - Notify().BreakPoint(__FILE__,__LINE__); - return false; + _Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings); } +stdstr CSettingTypeGame::FixName ( LPCSTR Section, LPCSTR Name ) +{ + stdstr FixedName; + if (Section !=- NULL && strlen(Section) > 0) + { + FixedName.Format("%s-%s",Section,Name); + } else { + FixedName.Format("%s",Name); + } + return FixedName; +} + +LPCSTR CSettingTypeGame::SectionName ( void ) const +{ + return m_SectionIdent.c_str(); +} + +void CSettingTypeGame::UpdateSettings ( void * /*Data */ ) +{ + m_RdbEditor = _Settings->LoadBool(Setting_RdbEditor); + stdstr SectionIdent = _Settings->LoadString(Game_IniKey); + + if (SectionIdent != m_SectionIdent) + { + m_SectionIdent = SectionIdent; + _Settings->SettingTypeChanged(SettingType_GameSetting); + _Settings->SettingTypeChanged(SettingType_RomDatabase); + } + +} + +bool CSettingTypeGame::Load ( int Index, bool & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + return _Settings->LoadBoolIndex(m_DefaultSetting,Index,Value); + } else { + return _Settings->LoadBool(m_DefaultSetting,Value); + } + } + return CSettingTypeApplication::Load(Index,Value); +} + +bool CSettingTypeGame::Load ( int Index, ULONG & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + return _Settings->LoadDwordIndex(m_DefaultSetting,Index,Value); + } else { + return _Settings->LoadDword(m_DefaultSetting,Value); + } + } + return CSettingTypeApplication::Load(Index,Value); +} + +bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + return _Settings->LoadStringIndex(m_DefaultSetting,Index,Value); + } else { + return _Settings->LoadString(m_DefaultSetting,Value); + } + } + return CSettingTypeApplication::Load(Index,Value); +} + +//return the default values +void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->LoadDefaultBool(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::LoadDefault(Index,Value); + } +} + +void CSettingTypeGame::LoadDefault ( int Index, ULONG & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->LoadDefaultDword(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::LoadDefault(Index,Value); + } +} + +void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->LoadDefaultString(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::Load(Index,Value); + } +} //Update the settings -void CSettingTypeGame::Save ( bool Value ) +void CSettingTypeGame::Save ( int Index, bool Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->SaveBoolIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->SaveBool(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::Save(Index,Value); + } } -void CSettingTypeGame::Save ( ULONG Value ) +void CSettingTypeGame::Save ( int Index, ULONG Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->SaveDwordIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->SaveDword(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::Save(Index,Value); + } } -void CSettingTypeGame::Save ( const stdstr & Value ) +void CSettingTypeGame::Save ( int Index, const stdstr & Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + Save(Index,Value.c_str()); } -void CSettingTypeGame::Save ( const char * Value ) +void CSettingTypeGame::Save ( int Index, const char * Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->SaveStringIndex(m_DefaultSetting,Index,Value); + } else { + _Settings->SaveString(m_DefaultSetting,Value); + } + } else { + CSettingTypeApplication::Save(Index,Value); + } +} + +void CSettingTypeGame::Delete ( int Index ) +{ + if (m_RdbEditor && _Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) + { + if (_Settings->IndexBasedSetting(m_DefaultSetting)) + { + _Settings->DeleteSettingIndex(m_DefaultSetting,Index); + } else { + _Settings->DeleteSetting(m_DefaultSetting); + } + } else { + CSettingTypeApplication::Delete(Index); + } } diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h index 5a1b2002c..48f861d5e 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSetting.h @@ -3,24 +3,44 @@ class CSettingTypeGame : public CSettingTypeApplication { +protected: + static bool m_RdbEditor; + static stdstr m_SectionIdent; + + static void UpdateSettings ( void * /*Data */ ); + static stdstr FixName ( LPCSTR Section, LPCSTR Name ); + + virtual LPCSTR SectionName ( void ) const; public: CSettingTypeGame(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ); CSettingTypeGame(LPCSTR Section, LPCSTR Name, DWORD DefaultValue ); CSettingTypeGame(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ); - ~CSettingTypeGame(); + virtual ~CSettingTypeGame(); - SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_GameSetting; } + virtual bool IndexBasedSetting ( void ) const { return false; } + virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } + + static void Initilize ( void ); + static void CleanUp ( void ); //return the values - bool Load ( bool & Value ) const; - bool Load ( ULONG & Value ) const; - bool Load ( stdstr & Value ) const; + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - void Save ( bool Value ); - void Save ( ULONG Value ); - void Save ( const stdstr & Value ); - void Save ( const char * Value ); + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp new file mode 100644 index 000000000..40c1972bc --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp @@ -0,0 +1,93 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-Application.h" +#include "SettingsType-GameSetting.h" +#include "SettingsType-GameSettingIndex.h" + + +CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) : + CSettingTypeGame("","", DefaultSetting), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ) : + CSettingTypeGame("","", DefaultValue), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) : + CSettingTypeGame("","", DefaultValue), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeGameIndex::~CSettingTypeGameIndex() +{ +} + +bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const +{ + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + return CSettingTypeGame::Load(Index,Value); +} + +bool CSettingTypeGameIndex::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const +{ + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + return CSettingTypeGame::Load(0,Value); +} + +//return the default values +void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeGameIndex::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeGameIndex::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeGameIndex::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeGameIndex::Save ( int Index, ULONG Value ) +{ + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeGame::Save(0,Value); +} + +void CSettingTypeGameIndex::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeGameIndex::Save ( int Index, const char * Value ) +{ + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeGame::Save(0,Value); +} + +void CSettingTypeGameIndex::Delete ( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.h b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.h new file mode 100644 index 000000000..a55ec35c6 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.h @@ -0,0 +1,36 @@ +#pragma once + +class CSettingTypeGameIndex : + public CSettingTypeGame +{ + stdstr m_PreIndex, m_PostIndex; + +public: + CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ); + CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ); + CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ); + ~CSettingTypeGameIndex(); + + virtual bool IndexBasedSetting ( void ) const { return true; } + virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp new file mode 100644 index 000000000..7d235dddf --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.cpp @@ -0,0 +1,109 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RDBCpuType.h" + +CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting ) : + CSettingTypeRomDatabase(Name,DefaultSetting) +{ +} + +CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue ) : + CSettingTypeRomDatabase(Name,DefaultValue) +{ +} + +CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType() +{ +} + +bool CSettingTypeRDBCpuType::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRDBCpuType::Load ( int Index, ULONG & Value ) const +{ + stdstr strValue; + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + if (!bRes) + { + LoadDefault(Index,Value); + return false; + } + LPCSTR String = strValue.c_str(); + + if (strcmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; } + else if (strcmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; } + else if (strcmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; } + else { Notify().BreakPoint(__FILE__,__LINE__); } + + return true; +} + +bool CSettingTypeRDBCpuType::Load ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +//return the default values +void CSettingTypeRDBCpuType::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBCpuType::LoadDefault ( int Index, ULONG & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue; + } else { + _Settings->LoadDword(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRDBCpuType::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeRDBCpuType::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBCpuType::Save ( int Index, ULONG Value ) +{ + + stdstr strValue; + switch (Value) + { + case CPU_Interpreter: strValue = "Interpreter"; break; + case CPU_Recompiler: strValue = "Recompiler"; break; + case CPU_SyncCores: strValue = "SyncCores"; break; + default: + Notify().BreakPoint(__FILE__,__LINE__); + } + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),strValue.c_str()); +} + +void CSettingTypeRDBCpuType::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBCpuType::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBCpuType::Delete( int Index ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.h b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.h new file mode 100644 index 000000000..6c1e3a5ab --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBCpuType.h @@ -0,0 +1,31 @@ +#pragma once + +class CSettingTypeRDBCpuType : + public CSettingTypeRomDatabase +{ + +public: + CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting ); + CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue ); + ~CSettingTypeRDBCpuType(); + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp new file mode 100644 index 000000000..61a5a36e9 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.cpp @@ -0,0 +1,99 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RDBOnOff.h" + +CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(LPCSTR Name, SettingID DefaultSetting ) : + CSettingTypeRomDatabase(Name,DefaultSetting) +{ +} + +CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(LPCSTR Name, int DefaultValue ) : + CSettingTypeRomDatabase(Name,DefaultValue) +{ +} + + CSettingTypeRDBOnOff::~CSettingTypeRDBOnOff() +{ +} + +bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const +{ + stdstr strValue; + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + if (!bRes) + { + LoadDefault(Index,Value); + return false; + } + LPCSTR String = strValue.c_str(); + + if (strcmp(String,"On") == 0) { Value = true; } + else if (strcmp(String,"Off") == 0) { Value = false; } + else if (strcmp(String,"Global") == 0) + { + LoadDefault(Index,Value); + return false; + } + else { Notify().BreakPoint(__FILE__,__LINE__); } + + return true; +} + +bool CSettingTypeRDBOnOff::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRDBOnOff::Load ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +//return the default values +void CSettingTypeRDBOnOff::LoadDefault ( int Index, bool & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue != 0; + } else { + _Settings->LoadBool(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRDBOnOff::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBOnOff::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + + +//Update the settings +void CSettingTypeRDBOnOff::Save ( int Index, bool Value ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "On" : "Off"); +} + +void CSettingTypeRDBOnOff::Save ( int Index, ULONG Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBOnOff::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBOnOff::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.h b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.h new file mode 100644 index 000000000..352590f67 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBOnOff.h @@ -0,0 +1,28 @@ +#pragma once + +class CSettingTypeRDBOnOff : + public CSettingTypeRomDatabase +{ + +public: + CSettingTypeRDBOnOff(LPCSTR Name, SettingID DefaultSetting ); + CSettingTypeRDBOnOff(LPCSTR Name, int DefaultValue ); + ~CSettingTypeRDBOnOff(); + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp new file mode 100644 index 000000000..d79d39f70 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.cpp @@ -0,0 +1,91 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RDBRamSize.h" + +// == 8 ? 0x800000 : 0x400000 + +CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting ) : + CSettingTypeRomDatabase(Name,DefaultSetting) +{ +} + +CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue ) : + CSettingTypeRomDatabase(Name,DefaultValue) +{ +} + +CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize() +{ +} + +bool CSettingTypeRDBRDRamSize::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRDBRDRamSize::Load ( int Index, ULONG & Value ) const +{ + ULONG ulValue; + bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue); + if (!bRes) + { + LoadDefault(Index,ulValue); + } + Value = 0x400000; + if (ulValue == 8) + { + Value = 0x800000; + } + return bRes; +} + +bool CSettingTypeRDBRDRamSize::Load ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +//return the default values +void CSettingTypeRDBRDRamSize::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeRDBRDRamSize::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::Save ( int Index, ULONG Value ) +{ + + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBRDRamSize::Delete( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.h b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.h new file mode 100644 index 000000000..295534eec --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBRamSize.h @@ -0,0 +1,31 @@ +#pragma once + +class CSettingTypeRDBRDRamSize : + public CSettingTypeRomDatabase +{ + +public: + CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting ); + CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue ); + ~CSettingTypeRDBRDRamSize(); + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp new file mode 100644 index 000000000..6e333ff7f --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.cpp @@ -0,0 +1,110 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RDBSaveChip.h" + +CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting ) : + CSettingTypeRomDatabase(Name,DefaultSetting) +{ +} + +CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue ) : + CSettingTypeRomDatabase(Name,DefaultValue) +{ +} + + CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip() +{ +} + +bool CSettingTypeRDBSaveChip::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRDBSaveChip::Load ( int Index, ULONG & Value ) const +{ + stdstr strValue; + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + if (!bRes) + { + LoadDefault(Index,Value); + return false; + } + LPCSTR String = strValue.c_str(); + + if (strcmp(String,"First Save Type") == 0) { Value = SaveChip_Auto; } + else if (strcmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; } + else if (strcmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; } + else if (strcmp(String,"Sram") == 0) { Value = SaveChip_Sram; } + else if (strcmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; } + else { Notify().BreakPoint(__FILE__,__LINE__); } + + return true; +} + +bool CSettingTypeRDBSaveChip::Load ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +//return the default values +void CSettingTypeRDBSaveChip::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBSaveChip::LoadDefault ( int Index, ULONG & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue; + } else { + _Settings->LoadDword(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRDBSaveChip::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeRDBSaveChip::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBSaveChip::Save ( int Index, ULONG Value ) +{ + switch (Value) + { + case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"First Save Type"); break; + case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break; + case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break; + case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"Sram"); break; + case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),"FlashRam"); break; + default: + Notify().BreakPoint(__FILE__,__LINE__); + } +} + +void CSettingTypeRDBSaveChip::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBSaveChip::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBSaveChip::Delete( int Index ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.h b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.h new file mode 100644 index 000000000..6f785eda5 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBSaveChip.h @@ -0,0 +1,31 @@ +#pragma once + +class CSettingTypeRDBSaveChip : + public CSettingTypeRomDatabase +{ + +public: + CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting ); + CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue ); + ~CSettingTypeRDBSaveChip(); + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp new file mode 100644 index 000000000..c4f4c2535 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.cpp @@ -0,0 +1,94 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RDBYesNo.h" + +CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(LPCSTR Name, SettingID DefaultSetting ) : + CSettingTypeRomDatabase(Name,DefaultSetting) +{ +} + +CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(LPCSTR Name, int DefaultValue ) : + CSettingTypeRomDatabase(Name,DefaultValue) +{ +} + + CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo() +{ +} + +bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const +{ + stdstr strValue; + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); + if (!bRes) + { + LoadDefault(Index,Value); + return false; + } + LPCSTR String = strValue.c_str(); + + if (strcmp(String,"Yes") == 0) { Value = true; } + else if (strcmp(String,"No") == 0) { Value = false; } + else { Notify().BreakPoint(__FILE__,__LINE__); } + + return true; +} + +bool CSettingTypeRDBYesNo::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRDBYesNo::Load ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +//return the default values +void CSettingTypeRDBYesNo::LoadDefault ( int Index, bool & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue != 0; + } else { + _Settings->LoadBool(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRDBYesNo::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBYesNo::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + + +//Update the settings +void CSettingTypeRDBYesNo::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBYesNo::Save ( int Index, ULONG Value ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); +} + +void CSettingTypeRDBYesNo::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRDBYesNo::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.h b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.h new file mode 100644 index 000000000..ac6a2bf20 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RDBYesNo.h @@ -0,0 +1,28 @@ +#pragma once + +class CSettingTypeRDBYesNo : + public CSettingTypeRomDatabase +{ + +public: + CSettingTypeRDBYesNo(LPCSTR Name, SettingID DefaultSetting ); + CSettingTypeRDBYesNo(LPCSTR Name, int DefaultValue ); + ~CSettingTypeRDBYesNo(); + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp index e1f7323fe..fb16ef863 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.cpp @@ -1,4 +1,5 @@ #include "..\..\Settings.h" +#include "..\..\User Interface.h" #include "SettingsType-RelativePath.h" CSettingTypeRelativePath::CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName) @@ -13,6 +14,32 @@ bool CSettingTypeRelativePath::Load ( int Index, stdstr & value ) const return true; } +//return the default values +void CSettingTypeRelativePath::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRelativePath::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRelativePath::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRelativePath::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRelativePath::Save ( int Index, ULONG Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + void CSettingTypeRelativePath::Save ( int Index, const stdstr & Value ) { m_FileName = CPath(CPath::MODULE_DIRECTORY,Value); @@ -23,4 +50,7 @@ void CSettingTypeRelativePath::Save ( int Index, const char * Value ) m_FileName = CPath(CPath::MODULE_DIRECTORY,Value); } - +void CSettingTypeRelativePath::Delete ( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.h b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.h index 359ab13fa..088e8d260 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RelativePath.h +++ b/Source/Project64/Settings/SettingType/SettingsType-RelativePath.h @@ -9,19 +9,26 @@ public: CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName); ~CSettingTypeRelativePath(); - bool IndexBasedSetting ( void ) const { return false; } - SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RelativePath; } + bool IndexBasedSetting ( void ) const { return false; } + SettingType GetSettingType ( void ) const { return SettingType_RelativePath; } //return the values - bool Load ( int Index, bool & Value ) const { return false; }; - bool Load ( int Index, ULONG & Value ) const { return false; }; - bool Load ( int Index, stdstr & Value ) const; + bool Load ( int Index, bool & Value ) const { return false; }; + bool Load ( int Index, ULONG & Value ) const { return false; }; + bool Load ( int Index, stdstr & Value ) const; + + //return the default values + void LoadDefault ( int Index, bool & Value ) const; + void LoadDefault ( int Index, ULONG & Value ) const; + void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - void Save ( int Index, bool Value ) {}; - void Save ( int Index, ULONG Value ) {}; - void Save ( int Index, const stdstr & Value ); - void Save ( int Index, const char * Value ); + void Save ( int Index, bool Value ); + void Save ( int Index, ULONG Value ); + void Save ( int Index, const stdstr & Value ); + void Save ( int Index, const char * Value ); + // Delete the setting + void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp index c3aab7777..2237a2679 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.cpp @@ -9,7 +9,7 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue ) m_KeyName(Name), m_DefaultStr(""), m_DefaultValue(DefaultValue), - m_DefaultSetting(No_Default) + m_DefaultSetting(Default_Constant) { } @@ -17,7 +17,7 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue m_KeyName(Name), m_DefaultStr(""), m_DefaultValue(DefaultValue), - m_DefaultSetting(No_Default) + m_DefaultSetting(Default_Constant) { } @@ -25,7 +25,7 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValu m_KeyName(Name), m_DefaultStr(DefaultValue), m_DefaultValue(0), - m_DefaultSetting(No_Default) + m_DefaultSetting(Default_Constant) { } @@ -37,18 +37,22 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultS { } +CSettingTypeRomDatabase::~CSettingTypeRomDatabase() +{ +} void CSettingTypeRomDatabase::Initilize( void ) { - m_SettingsIniFile = new CIniFile(_Settings->LoadString(RomDatabaseFile).c_str()); + m_SettingsIniFile = new CIniFile(_Settings->LoadString(SupportFile_RomDatabase).c_str()); - _Settings->RegisterChangeCB(ROM_IniKey,NULL,GameChanged); + _Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged); - m_SectionIdent = _Settings->LoadString(ROM_IniKey); + m_SectionIdent = _Settings->LoadString(Game_IniKey); } void CSettingTypeRomDatabase::CleanUp( void ) { + _Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged); if (m_SettingsIniFile) { delete m_SettingsIniFile; @@ -58,45 +62,93 @@ void CSettingTypeRomDatabase::CleanUp( void ) void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ ) { - m_SectionIdent = _Settings->LoadString(ROM_IniKey); + m_SectionIdent = _Settings->LoadString(Game_IniKey); } bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const { - Notify().BreakPoint(__FILE__,__LINE__); - return false; + DWORD temp_value = Value; + bool bRes = Load(Index,temp_value); + Value = temp_value != 0; + return bRes; } bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const { - if (m_SectionIdent.empty()) + bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value,Value); + if (!bRes) { - return false; + LoadDefault(Index,Value); } - Notify().BreakPoint(__FILE__,__LINE__); - return false; + return bRes; } bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const { - bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName,m_DefaultStr,Value); - if (!bRes && m_DefaultSetting != No_Default) + stdstr temp_value; + bool bRes = m_SettingsIniFile->GetString(m_SectionIdent.c_str(),m_KeyName.c_str(),m_DefaultStr,temp_value); + if (bRes) { - _Settings->LoadString(m_DefaultSetting,Value); + Value = temp_value; + } + else + { + LoadDefault(Index,Value); } return bRes; } +//return the default values +void CSettingTypeRomDatabase::LoadDefault ( int Index, bool & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue != 0; + } else { + _Settings->LoadBool(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRomDatabase::LoadDefault ( int Index, ULONG & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultValue; + } else { + _Settings->LoadDword(m_DefaultSetting,Value); + } + } +} + +void CSettingTypeRomDatabase::LoadDefault ( int Index, stdstr & Value ) const +{ + if (m_DefaultSetting != Default_None) + { + if (m_DefaultSetting == Default_Constant) + { + Value = m_DefaultStr; + } else { + _Settings->LoadString(m_DefaultSetting,Value); + } + } +} + + //Update the settings void CSettingTypeRomDatabase::Save ( int Index, bool Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_SettingsIniFile->SaveNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value); } void CSettingTypeRomDatabase::Save ( int Index, ULONG Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_SettingsIniFile->SaveNumber(m_SectionIdent.c_str(),m_KeyName.c_str(),Value); } void CSettingTypeRomDatabase::Save ( int Index, const stdstr & Value ) @@ -108,3 +160,8 @@ void CSettingTypeRomDatabase::Save ( int Index, const char * Value ) { Notify().BreakPoint(__FILE__,__LINE__); } + +void CSettingTypeRomDatabase::Delete ( int Index ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h index c906ea707..97dde2b4f 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabase.h @@ -3,16 +3,12 @@ class CSettingTypeRomDatabase : public CSettingType { - - const LPCSTR m_KeyName; +protected: + mutable stdstr m_KeyName; const LPCSTR m_DefaultStr; const int m_DefaultValue; const SettingID m_DefaultSetting; - /* - static bool m_UseRegistry; - stdstr m_SectionIdent;*/ - static stdstr m_SectionIdent; static CIniFile * m_SettingsIniFile; @@ -23,21 +19,30 @@ public: CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue ); CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue ); CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultSetting ); - ~CSettingTypeRomDatabase(); + + virtual ~CSettingTypeRomDatabase(); - virtual bool IndexBasedSetting ( void ) const { return false; } - virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; } + virtual bool IndexBasedSetting ( void ) const { return false; } + virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; } //return the values - virtual bool Load ( int Index, bool & Value ) const; - virtual bool Load ( int Index, ULONG & Value ) const; - virtual bool Load ( int Index, stdstr & Value ) const; + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - virtual void Save ( int Index, bool Value ); - virtual void Save ( int Index, ULONG Value ); - virtual void Save ( int Index, const stdstr & Value ); - virtual void Save ( int Index, const char * Value ); + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); static void Initilize ( void ); static void CleanUp ( void ); diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp new file mode 100644 index 000000000..b62d8b4fe --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.cpp @@ -0,0 +1,97 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-RomDatabase.h" +#include "SettingsType-RomDatabaseIndex.h" + +CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) : + CSettingTypeRomDatabase("",DefaultValue), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue ) : + CSettingTypeRomDatabase("",DefaultValue), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue ) : + CSettingTypeRomDatabase("",DefaultValue), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) : + CSettingTypeRomDatabase("",DefaultSetting), + m_PreIndex(PreIndex), + m_PostIndex(PostIndex) +{ +} + +CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex() +{ +} + +bool CSettingTypeRomDatabaseIndex::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRomDatabaseIndex::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const +{ + m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + return CSettingTypeRomDatabase::Load(0,Value); +} + +void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const +{ + m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeRomDatabase::LoadDefault(0,Value); +} + +void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, ULONG & Value ) const +{ + m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeRomDatabase::LoadDefault(0,Value); +} + +void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const +{ + m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeRomDatabase::LoadDefault(0,Value); +} + +void CSettingTypeRomDatabaseIndex::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRomDatabaseIndex::Save ( int Index, ULONG Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRomDatabaseIndex::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRomDatabaseIndex::Save ( int Index, const char * Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeRomDatabaseIndex::Delete ( int Index ) +{ + m_SettingsIniFile->SaveString(m_SectionIdent.c_str(),m_KeyName.c_str(),NULL); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.h b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.h new file mode 100644 index 000000000..d27df97a5 --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-RomDatabaseIndex.h @@ -0,0 +1,37 @@ +#pragma once + +class CSettingTypeRomDatabaseIndex : + public CSettingTypeRomDatabase +{ + stdstr m_PreIndex, m_PostIndex; + +public: + CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ); + CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue ); + CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue ); + CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ); + + virtual ~CSettingTypeRomDatabaseIndex(); + + virtual bool IndexBasedSetting ( void ) const { return true; } + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.cpp b/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.cpp new file mode 100644 index 000000000..915719e0c --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.cpp @@ -0,0 +1,77 @@ +#include "..\..\Settings.h" +#include "..\..\User Interface.h" +#include "SettingsType-SelectedDirectory.h" + + +CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) : + m_InitialDir(InitialDir), + m_SelectedDir(SelectedDir), + m_UseSelected(UseSelected) +{ +} + + +CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory() +{ +} + +bool CSettingTypeSelectedDirectory::Load ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeSelectedDirectory::Load ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +bool CSettingTypeSelectedDirectory::Load ( int Index, stdstr & Value ) const +{ + SettingID DirSettingId = _Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir; + return _Settings->LoadString(DirSettingId, Value); +} + +//return the default values +void CSettingTypeSelectedDirectory::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeSelectedDirectory::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeSelectedDirectory::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +//Update the settings +void CSettingTypeSelectedDirectory::Save ( int Index, bool Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeSelectedDirectory::Save ( int Index, ULONG Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeSelectedDirectory::Save ( int Index, const stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeSelectedDirectory::Save ( int Index, const char * Value ) +{ + _Settings->SaveBool(m_UseSelected,true); + _Settings->SaveString(m_SelectedDir,Value); +} + +void CSettingTypeSelectedDirectory::Delete( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.h b/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.h new file mode 100644 index 000000000..1d38f867e --- /dev/null +++ b/Source/Project64/Settings/SettingType/SettingsType-SelectedDirectory.h @@ -0,0 +1,36 @@ +#pragma once + +class CSettingTypeSelectedDirectory : + public CSettingType +{ + SettingID m_InitialDir; + SettingID m_SelectedDir; + SettingID m_UseSelected; + +public: + CSettingTypeSelectedDirectory(SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ); + ~CSettingTypeSelectedDirectory(); + + virtual bool IndexBasedSetting ( void ) const { return false; } + virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; } + + //return the values + virtual bool Load ( int Index, bool & Value ) const; + virtual bool Load ( int Index, ULONG & Value ) const; + virtual bool Load ( int Index, stdstr & Value ) const; + + //return the default values + virtual void LoadDefault ( int Index, bool & Value ) const; + virtual void LoadDefault ( int Index, ULONG & Value ) const; + virtual void LoadDefault ( int Index, stdstr & Value ) const; + + //Update the settings + virtual void Save ( int Index, bool Value ); + virtual void Save ( int Index, ULONG Value ); + virtual void Save ( int Index, const stdstr & Value ); + virtual void Save ( int Index, const char * Value ); + + // Delete the setting + virtual void Delete ( int Index ); +}; + diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp index 71e398b1a..547c44d5d 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempBool.cpp @@ -25,11 +25,27 @@ bool CSettingTypeTempBool::Load ( int Index, stdstr & Value ) const return false; } -void CSettingTypeTempBool::Save ( int Index, bool Value ) +//return the default values +void CSettingTypeTempBool::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempBool::LoadDefault ( int Index, ULONG & Value ) const { Notify().BreakPoint(__FILE__,__LINE__); } +void CSettingTypeTempBool::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempBool::Save ( int Index, bool Value ) +{ + m_value = Value; +} + void CSettingTypeTempBool::Save ( int Index, ULONG Value ) { Notify().BreakPoint(__FILE__,__LINE__); @@ -44,3 +60,8 @@ void CSettingTypeTempBool::Save ( int Index, const char * Value ) { Notify().BreakPoint(__FILE__,__LINE__); } + +void CSettingTypeTempBool::Delete( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempBool.h b/Source/Project64/Settings/SettingType/SettingsType-TempBool.h index ae64dce41..528d679fe 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempBool.h +++ b/Source/Project64/Settings/SettingType/SettingsType-TempBool.h @@ -9,18 +9,26 @@ public: CSettingTypeTempBool(bool initialValue ); ~CSettingTypeTempBool(); - bool IndexBasedSetting ( void ) const { return false; } - SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_BoolVariable; } + bool IndexBasedSetting ( void ) const { return false; } + SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; } //return the values - bool Load ( int Index, bool & Value ) const; - bool Load ( int Index, ULONG & Value ) const; - bool Load ( int Index, stdstr & Value ) const; + bool Load ( int Index, bool & Value ) const; + bool Load ( int Index, ULONG & Value ) const; + bool Load ( int Index, stdstr & Value ) const; + + //return the default values + void LoadDefault ( int Index, bool & Value ) const; + void LoadDefault ( int Index, ULONG & Value ) const; + void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - void Save ( int Index, bool Value ); - void Save ( int Index, ULONG Value ); - void Save ( int Index, const stdstr & Value ); - void Save ( int Index, const char * Value ); + void Save ( int Index, bool Value ); + void Save ( int Index, ULONG Value ); + void Save ( int Index, const stdstr & Value ); + void Save ( int Index, const char * Value ); + + // Delete the setting + void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp index 49fe648ad..fe74ee458 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.cpp @@ -25,6 +25,22 @@ bool CSettingTypeTempNumber::Load ( int Index, stdstr & Value ) const return false; } +//return the default values +void CSettingTypeTempNumber::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempNumber::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempNumber::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + void CSettingTypeTempNumber::Save ( int Index, bool Value ) { Notify().BreakPoint(__FILE__,__LINE__); @@ -32,7 +48,7 @@ void CSettingTypeTempNumber::Save ( int Index, bool Value ) void CSettingTypeTempNumber::Save ( int Index, ULONG Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_value = Value; } void CSettingTypeTempNumber::Save ( int Index, const stdstr & Value ) @@ -44,3 +60,8 @@ void CSettingTypeTempNumber::Save ( int Index, const char * Value ) { Notify().BreakPoint(__FILE__,__LINE__); } + +void CSettingTypeTempNumber::Delete( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.h b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.h index edd0ff1cc..4096543cd 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempNumber.h +++ b/Source/Project64/Settings/SettingType/SettingsType-TempNumber.h @@ -10,19 +10,26 @@ public: CSettingTypeTempNumber(ULONG initialValue); ~CSettingTypeTempNumber(); - bool IndexBasedSetting ( void ) const { return false; } - SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_NumberVariable; } + bool IndexBasedSetting ( void ) const { return false; } + SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; } //return the values - bool Load ( int Index, bool & Value ) const; - bool Load ( int Index, ULONG & Value ) const; - bool Load ( int Index, stdstr & Value ) const; + bool Load ( int Index, bool & Value ) const; + bool Load ( int Index, ULONG & Value ) const; + bool Load ( int Index, stdstr & Value ) const; + + //return the default values + void LoadDefault ( int Index, bool & Value ) const; + void LoadDefault ( int Index, ULONG & Value ) const; + void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - void Save ( int Index, bool Value ); - void Save ( int Index, ULONG Value ); - void Save ( int Index, const stdstr & Value ); - void Save ( int Index, const char * Value ); + void Save ( int Index, bool Value ); + void Save ( int Index, ULONG Value ); + void Save ( int Index, const stdstr & Value ); + void Save ( int Index, const char * Value ); + // Delete the setting + void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp b/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp index 7f506ce73..ce6f4bfa4 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-TempString.cpp @@ -25,6 +25,22 @@ bool CSettingTypeTempString::Load ( int Index, stdstr & Value ) const return true; } +//return the default values +void CSettingTypeTempString::LoadDefault ( int Index, bool & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempString::LoadDefault ( int Index, ULONG & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettingTypeTempString::LoadDefault ( int Index, stdstr & Value ) const +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + void CSettingTypeTempString::Save ( int Index, bool Value ) { Notify().BreakPoint(__FILE__,__LINE__); @@ -44,3 +60,8 @@ void CSettingTypeTempString::Save ( int Index, const char * Value ) { m_value = Value; } + +void CSettingTypeTempString::Delete( int Index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} diff --git a/Source/Project64/Settings/SettingType/SettingsType-TempString.h b/Source/Project64/Settings/SettingType/SettingsType-TempString.h index e882db8c0..d9b5af16d 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-TempString.h +++ b/Source/Project64/Settings/SettingType/SettingsType-TempString.h @@ -10,19 +10,26 @@ public: CSettingTypeTempString(LPCSTR initialValue); ~CSettingTypeTempString(); - bool IndexBasedSetting ( void ) const { return false; } - SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_StringVariable; } - + bool IndexBasedSetting ( void ) const { return false; } + SettingType GetSettingType ( void ) const { return SettingType_StringVariable; } + //return the values - bool Load ( int Index, bool & Value ) const; - bool Load ( int Index, ULONG & Value ) const; - bool Load ( int Index, stdstr & Value ) const; + bool Load ( int Index, bool & Value ) const; + bool Load ( int Index, ULONG & Value ) const; + bool Load ( int Index, stdstr & Value ) const; + + //return the default values + void LoadDefault ( int Index, bool & Value ) const; + void LoadDefault ( int Index, ULONG & Value ) const; + void LoadDefault ( int Index, stdstr & Value ) const; //Update the settings - void Save ( int Index, bool Value ); - void Save ( int Index, ULONG Value ); - void Save ( int Index, const stdstr & Value ); - void Save ( int Index, const char * Value ); + void Save ( int Index, bool Value ); + void Save ( int Index, ULONG Value ); + void Save ( int Index, const stdstr & Value ); + void Save ( int Index, const char * Value ); + // Delete the setting + void Delete ( int Index ); }; diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index 20736c7cc..022a9b9aa 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -3,9 +3,18 @@ #include #include "SettingType/SettingsType-Application.h" #include "SettingType/SettingsType-ApplicationIndex.h" +#include "SettingType/SettingsType-Cheats.h" #include "SettingType/SettingsType-GameSetting.h" -#include "SettingType/SettingsType-RomDatabase.h" +#include "SettingType/SettingsType-GameSettingIndex.h" #include "SettingType/SettingsType-RelativePath.h" +#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" #include "SettingType/SettingsType-TempString.h" #include "SettingType/SettingsType-TempNumber.h" #include "SettingType/SettingsType-TempBool.h" @@ -37,31 +46,225 @@ CSettings::~CSettings() CSettingTypeApplication::CleanUp(); CSettingTypeRomDatabase::CleanUp(); - + CSettingTypeGame::CleanUp(); + CSettingTypeCheats::CleanUp(); } void CSettings::AddHandler ( SettingID TypeID, CSettingType * Handler ) { - m_SettingInfo.insert(SETTING_MAP::value_type(TypeID,Handler)); + SETTING_HANDLER FindInfo = m_SettingInfo.find(TypeID); + if (FindInfo == m_SettingInfo.end()) + { + m_SettingInfo.insert(SETTING_MAP::value_type(TypeID,Handler)); + } else { + delete Handler; + } } void CSettings::AddHowToHandleSetting () { + //information - temp keys + AddHandler(Info_RomLoading, new CSettingTypeTempBool(false)); + AddHandler(Info_ShortCutsChanged, new CSettingTypeTempBool(false)); + + //Support Files - AddHandler(SettingsIniName, new CSettingTypeRelativePath("","Project64.cfg")); - AddHandler(RomDatabaseFile, new CSettingTypeRelativePath("","Project64.rdb")); - AddHandler(CheatIniName, new CSettingTypeRelativePath("","Project64.cht")); - AddHandler(NotesIniName, new CSettingTypeRelativePath("","Project64.rdn")); - AddHandler(ExtIniName, new CSettingTypeRelativePath("","Project64.rdx")); - AddHandler(ShortCutFile, new CSettingTypeRelativePath("","Project64.sc2")); - AddHandler(RomListCache, new CSettingTypeRelativePath("","Project64.cache3")); - AddHandler(ZipCacheIniName, new CSettingTypeRelativePath("","Project64.zcache")); - AddHandler(SyncPluginDir, new CSettingTypeRelativePath("SyncPlugin","")); + AddHandler(SupportFile_Settings, new CSettingTypeRelativePath("","Project64.cfg")); + AddHandler(SupportFile_RomDatabase, new CSettingTypeRelativePath("","Project64.rdb")); + AddHandler(SupportFile_Cheats, new CSettingTypeRelativePath("","Project64.cht")); + AddHandler(SupportFile_Notes, new CSettingTypeRelativePath("","Project64.rdn")); + AddHandler(SupportFile_ExtInfo, new CSettingTypeRelativePath("","Project64.rdx")); + AddHandler(SupportFile_ShortCuts, new CSettingTypeRelativePath("","Project64.sc3")); + AddHandler(SupportFile_RomListCache,new CSettingTypeRelativePath("","Project64.cache3")); + AddHandler(SupportFile_7zipCache, new CSettingTypeRelativePath("","Project64.zcache")); + + //AddHandler(SyncPluginDir, new CSettingTypeRelativePath("SyncPlugin","")); //Settings location - AddHandler(UseSettingFromRegistry,new CSettingTypeApplication("Settings","Use Registry",(DWORD)false)); + AddHandler(Setting_ApplicationName, new CSettingTypeTempString("")); + AddHandler(Setting_UseFromRegistry, new CSettingTypeApplication("Settings","Use Registry",(DWORD)false)); + AddHandler(Setting_RdbEditor, new CSettingTypeApplication("","Rdb Editor", false)); + 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)); + AddHandler(Setting_AutoFullscreen, new CSettingTypeApplication("","Auto Full Screen", (DWORD)true)); + AddHandler(Setting_AutoZipInstantSave,new CSettingTypeApplication("","Auto Zip Saves", (DWORD)true)); -/* INFO(SettingsIniName,No_Default,Data_String,RelativePath,"Project64.cfg","",0); + AddHandler(Setting_RememberCheats, new CSettingTypeApplication("","Remember Cheats", (DWORD)false)); + AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("","Current Language","")); + + AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type",SaveChip_Auto)); + AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type",CPU_Recompiler)); + AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size",4)); + AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor",2)); + AddHandler(Rdb_UseTlb, new CSettingTypeRDBYesNo("Use TLB",true)); + AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI",false)); + AddHandler(Rdb_SPHack, new CSettingTypeRDBYesNo("SP Hack",false)); + AddHandler(Rdb_Status, new CSettingTypeRomDatabase("Status","Unknown")); + 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)); + AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking",false)); + AddHandler(Rdb_SMM_Cache, new CSettingTypeRomDatabase("SMM-Cache",true)); + 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","","")); + + + AddHandler(Game_IniKey, new CSettingTypeTempString("")); + AddHandler(Game_GameName, new CSettingTypeTempString("")); + AddHandler(Game_GoodName, new CSettingTypeRomDatabase("Good Name",Game_GameName)); + 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)); + AddHandler(Game_DelaySI, new CSettingTypeGame("","Delay SI",Rdb_DelaySi)); + AddHandler(Game_RspAudioSignal, new CSettingTypeGame("","Audio Signal",Rdb_RspAudioSignal)); + AddHandler(Game_SPHack, new CSettingTypeGame("","SP Hack",Rdb_SPHack)); + AddHandler(Game_CurrentSaveState, new CSettingTypeTempNumber(0)); + AddHandler(Game_SyncViaAudio, new CSettingTypeGame("","Sync Audio",Rdb_SyncViaAudio)); + AddHandler(Game_UseHleGfx, new CSettingTypeGame("RSP","HLE GFX",Rdb_UseHleGfx)); + AddHandler(Game_UseHleAudio, new CSettingTypeGame("RSP","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)); + 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)); + + //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","")); + AddHandler(Directory_PluginSelected, new CSettingTypeApplication("Directory","Plugin",Directory_PluginInitial)); + AddHandler(Directory_PluginUseSelected, new CSettingTypeApplication("Directory","Plugin - Use Selected",false)); + + AddHandler(Directory_SnapShot, new CSettingTypeSelectedDirectory(Directory_SnapShotInitial,Directory_SnapShotSelected,Directory_SnapShotUseSelected)); + AddHandler(Directory_SnapShotInitial, new CSettingTypeRelativePath("Screenshots","")); + AddHandler(Directory_SnapShotSelected, new CSettingTypeApplication("Directory","Snap Shot",Directory_SnapShotInitial)); + 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","")); + AddHandler(Directory_NativeSaveSelected, new CSettingTypeApplication("Directory","Save",Directory_NativeSaveInitial)); + 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","")); + AddHandler(Directory_InstantSaveSelected, new CSettingTypeApplication("Directory","Instant Save",Directory_InstantSaveInitial)); + 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","")); + AddHandler(Directory_TextureSelected, new CSettingTypeApplication("Directory","Texture Dir",Directory_InstantSaveInitial)); + AddHandler(Directory_TextureUseSelected, new CSettingTypeApplication("Directory","Texture Dir - Use Selected",false)); + + 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)); + 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)); + AddHandler(Debugger_ShowCheckOpUsageErrors, new CSettingTypeApplication("Debugger","Show Check Op Usage Errors",false)); + 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", "")); + + AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP","HLE GFX",true)); + AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP","HLE Audio",false)); + + // cheats + AddHandler(Cheat_Entry, new CSettingTypeCheats("")); + AddHandler(Cheat_Active, new CSettingTypeGameIndex("Cheat","",(bool)false)); + AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat",".exten","??? - Not Set")); + AddHandler(Cheat_Notes, new CSettingTypeCheats("_N")); + AddHandler(Cheat_Options, new CSettingTypeCheats("_O")); + + /* INFO(SettingsIniName,Default_None,Data_String,RelativePath,"Project64.cfg","",0); if (SettingsIniFile == NULL) { SettingsIniFile = new CIniFile(LoadString(SettingsIniName).c_str()); @@ -76,28 +279,28 @@ void CSettings::AddHowToHandleSetting () #define INFO(ID,X,Y,Z,Q,W,E) SettingInfo.insert(SETTING_MAP::value_type(ID,CSettingInfo(ID,X,Y,Z,Q,W,E))) #define INF2(ID,X,Y,Z,Q,W,E,R) SettingInfo.insert(SETTING_MAP::value_type(ID,CSettingInfo(ID,X,Y,Z,Q,W,E,R))) //Default Values - INFO(Default_False, No_Default, Data_DWORD, ConstValue, "","",(DWORD)false); - INFO(Default_True, No_Default, Data_DWORD, ConstValue, "","",(DWORD)true); - INFO(Default_Language, No_Default, Data_String, ConstString, "","",0); - INFO(Default_RomStatus, No_Default, Data_String, ConstString, "Unknown","",0); - INFO(Default_RomBrowserWidth, No_Default, Data_DWORD, ConstValue, "","",640); - INFO(Default_RomBrowserHeight, No_Default, Data_DWORD, ConstValue, "","",480); - INFO(Default_RememberedRomFiles, No_Default, Data_DWORD, ConstValue, "","",MaxRememberedFiles); - INFO(Default_RememberedRomDirs, No_Default, Data_DWORD, ConstValue, "","",MaxRememberedDirs); - INFO(Default_CPUType, No_Default, Data_DWORD, ConstValue, "","",CPU_Recompiler); - INFO(Default_RdramSize, No_Default, Data_DWORD, ConstValue, "","",0x400000); - INFO(Default_SaveChip, No_Default, Data_DWORD, ConstValue, "","",SaveChip_Auto); - INFO(Default_CFactor, No_Default, Data_DWORD, ConstValue, "","",2); - INFO(Default_CheatExt, No_Default, Data_String, ConstString, "?","",0); - INFO(Default_FunctionLookup, No_Default, Data_DWORD, ConstValue, "","",FuncFind_PhysicalLookup); - INFO(Default_BlockLinking, No_Default, Data_DWORD, ConstValue, "","",(DWORD)false); - INFO(Default_SaveSlot, No_Default, Data_DWORD, ConstValue, "","",(DWORD)0); - INFO(Default_LogLevel, No_Default, Data_DWORD, ConstValue, "","",(DWORD)TraceError); - INFO(Default_FrameDisplayType, No_Default, Data_DWORD, ConstValue, "","",FR_VIs); + INFO(Default_False, Default_None, Data_DWORD, ConstValue, "","",(DWORD)false); + INFO(Default_True, Default_None, Data_DWORD, ConstValue, "","",(DWORD)true); + INFO(Default_Language, Default_None, Data_String, ConstString, "","",0); + INFO(Default_RomStatus, Default_None, Data_String, ConstString, "Unknown","",0); + INFO(Default_RomBrowserWidth, Default_None, Data_DWORD, ConstValue, "","",640); + INFO(Default_RomBrowserHeight, Default_None, Data_DWORD, ConstValue, "","",480); + INFO(Default_RememberedRomFiles, Default_None, Data_DWORD, ConstValue, "","",MaxRememberedFiles); + INFO(Default_RememberedRomDirs, Default_None, Data_DWORD, ConstValue, "","",MaxRememberedDirs); + INFO(Default_CPUType, Default_None, Data_DWORD, ConstValue, "","",CPU_Recompiler); + INFO(Default_RdramSize, Default_None, Data_DWORD, ConstValue, "","",0x400000); + INFO(Default_SaveChip, Default_None, Data_DWORD, ConstValue, "","",SaveChip_Auto); + INFO(Default_CFactor, Default_None, Data_DWORD, ConstValue, "","",2); + INFO(Default_CheatExt, Default_None, Data_String, ConstString, "?","",0); + INFO(Default_FunctionLookup, Default_None, Data_DWORD, ConstValue, "","",FuncFind_PhysicalLookup); + INFO(Default_BlockLinking, Default_None, Data_DWORD, ConstValue, "","",(DWORD)false); + INFO(Default_SaveSlot, Default_None, Data_DWORD, ConstValue, "","",(DWORD)0); + INFO(Default_LogLevel, Default_None, Data_DWORD, ConstValue, "","",(DWORD)TraceError); + INFO(Default_FrameDisplayType, Default_None, Data_DWORD, ConstValue, "","",FR_VIs); //Add setting to see if we get settings from file system or registry - INFO(SettingsIniName,No_Default,Data_String,RelativePath,"Project64.cfg","",0); + INFO(SettingsIniName,Default_None,Data_String,RelativePath,"Project64.cfg","",0); if (SettingsIniFile == NULL) { SettingsIniFile = new CIniFile(LoadString(SettingsIniName).c_str()); @@ -107,19 +310,17 @@ void CSettings::AddHowToHandleSetting () SettingLocation SettingLoc = LoadDword(UseSettingFromRegistry) ? InRegistry : LocalSettings; */ //Language - AddHandler(CurrentLanguage,new CSettingTypeApplication("","Current Language","")); +/* AddHandler(CurrentLanguage,new CSettingTypeApplication("","Current Language","")); //Gui Settings AddHandler(RomBrowser, new CSettingTypeApplication("Rom Browser","Rom Browser",true)); - AddHandler(MainWindowTop, new CSettingTypeApplication("Main Window","Top" ,No_Default)); - AddHandler(MainWindowLeft, new CSettingTypeApplication("Main Window","Left" ,No_Default)); - AddHandler(RomBrowserTop, new CSettingTypeApplication("Rom Browser","Top" ,No_Default)); - AddHandler(RomBrowserLeft, new CSettingTypeApplication("Rom Browser","Left" ,No_Default)); + AddHandler(RomBrowserTop, new CSettingTypeApplication("Rom Browser","Top" ,Default_None)); + AddHandler(RomBrowserLeft, new CSettingTypeApplication("Rom Browser","Left" ,Default_None)); AddHandler(RomBrowserHeight, new CSettingTypeApplication("Rom Browser","Height", (DWORD)480)); AddHandler(RomBrowserWidth, new CSettingTypeApplication("Rom Browser","Width", (DWORD)640)); AddHandler(RomBrowserRecursive, new CSettingTypeApplication("Rom Browser","Recursive", false)); AddHandler(RomBrowserMaximized, new CSettingTypeApplication("Rom Browser","Maximized", false)); - AddHandler(RomBrowserSortFieldIndex, new CSettingTypeApplicationIndex("Rom Browser", "Sort Field", No_Default)); + AddHandler(RomBrowserSortFieldIndex, new CSettingTypeApplicationIndex("Rom Browser", "Sort Field", Default_None)); AddHandler(RomBrowserPosIndex, new CSettingTypeApplicationIndex("Rom Browser\\Field Pos","Field",(DWORD)0)); AddHandler(RomBrowserWidthIndex,new CSettingTypeApplicationIndex("Rom Browser\\Field Width","Field",(DWORD)100)); @@ -129,23 +330,23 @@ void CSettings::AddHowToHandleSetting () for (int SortID = 0; SortID <= NoOfSortKeys; SortID++ ) { char Name[300]; _snprintf(Name,sizeof(Name),"Sort Field %d",SortID); - INF2((SettingID)(SortField + SortID),No_Default,Data_String,SettingLoc,Name,"Rom Browser",0,SortField); + INF2((SettingID)(SortField + SortID),Default_None,Data_String,SettingLoc,Name,"Rom Browser",0,SortField); _snprintf(Name,sizeof(Name),"Sort Ascending %d",SortID); INF2((SettingID)(SortAscending + SortID),Default_True,Data_DWORD,SettingLoc,Name,"Rom Browser",0,SortAscending); } for (int Field = 0; Field <= MaxRomBrowserFields; Field++ ) { char Name[300]; _snprintf(Name,sizeof(Name),"Field %02d",Field); - INF2((SettingID)(FirstRomBrowserPos + Field),No_Default,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Pos",0,FirstRomBrowserPos); - INF2((SettingID)(FirstRomBrowserWidth + Field),No_Default,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Width",0,FirstRomBrowserWidth); + INF2((SettingID)(FirstRomBrowserPos + Field),Default_None,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Pos",0,FirstRomBrowserPos); + INF2((SettingID)(FirstRomBrowserWidth + Field),Default_None,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Width",0,FirstRomBrowserWidth); } - INFO(TLBWindowTop,No_Default,Data_DWORD,SettingLoc,"Rom Browser Top","Page Setup",0); - INFO(TLBWindowLeft,No_Default,Data_DWORD,SettingLoc,"Rom Browser Left","Page Setup",0); + INFO(TLBWindowTop,Default_None,Data_DWORD,SettingLoc,"Rom Browser Top","Page Setup",0); + INFO(TLBWindowLeft,Default_None,Data_DWORD,SettingLoc,"Rom Browser Left","Page Setup",0); */ //Beta settings - AddHandler(IsBetaVersion, new CSettingTypeTempBool(true)); +/* AddHandler(IsBetaVersion, new CSettingTypeTempBool(true)); AddHandler(BetaUserName, new CSettingTypeTempString("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")); AddHandler(BetaEmailAddress, new CSettingTypeTempString("????????????????????????????????????????????????????????????????????????????????")); @@ -161,12 +362,8 @@ void CSettings::AddHowToHandleSetting () AddHandler(LimitFPS, new CSettingTypeApplication("","Limit FPS", (DWORD)true)); AddHandler(ProfileCode, new CSettingTypeApplication("","Profile Code", (DWORD)false)); AddHandler(GenerateLogFiles, new CSettingTypeApplication("","Generate Log Files", (DWORD)false)); - AddHandler(AlwaysOnTop, new CSettingTypeApplication("","Always on top", (DWORD)false)); AddHandler(DisableGameFixes, new CSettingTypeApplication("","Disable Game Fixes", (DWORD)false)); - AddHandler(IsValidExe, new CSettingTypeTempBool(true)); - AddHandler(DisplayFrameRate, new CSettingTypeApplication("","Display Frame Rate", (DWORD)true)); - AddHandler(FrameDisplayType, new CSettingTypeApplication("","Frame Rate Display Type", (DWORD)FR_VIs)); //Logging AddHandler(AppLogLevel,new CSettingTypeApplication("Logging","Log Level",(DWORD)TraceError)); @@ -174,63 +371,60 @@ void CSettings::AddHowToHandleSetting () //Recent Files AddHandler(RememberedRomFilesCount, new CSettingTypeApplication("","Remembered Rom Files",(DWORD)10)); - AddHandler(RecentRomFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",No_Default)); + AddHandler(RecentRomFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None)); AddHandler(RememberedRomDirCount, new CSettingTypeApplication("","Remembered Rom Dirs",(DWORD)10)); - AddHandler(RecentRomDirIndex, new CSettingTypeApplicationIndex("Recent Dir","Recent Dir",No_Default)); + AddHandler(RecentRomDirIndex, new CSettingTypeApplicationIndex("Recent Dir","Recent Dir",Default_None)); /* for (count = FirstRecentRom; count != LastRecentRom; count++ ) { char Name[300]; _snprintf(Name,sizeof(Name)," %d",count - FirstRecentRom); - INF2((SettingID)count,No_Default,Data_String,SettingLoc,Name,"",0,FirstRecentRom); + INF2((SettingID)count,Default_None,Data_String,SettingLoc,Name,"",0,FirstRecentRom); } //Recent Dirs for (count = FirstRecentDir; count != LastRecentDir; count++ ) { char Name[300]; _snprintf(Name,sizeof(Name),"Recent Dir %d",count - FirstRecentDir); - INF2((SettingID)count,No_Default,Data_String,SettingLoc,Name,"Recent Dir",0,FirstRecentDir); + INF2((SettingID)count,Default_None,Data_String,SettingLoc,Name,"Recent Dir",0,FirstRecentDir); } INFO(RememberedRomDir,Default_RememberedRomDirs,Data_DWORD,SettingLoc,"Remembered Rom Dirs","",0); //Plugins */ - AddHandler(CurrentRSP_Plugin, new CSettingTypeApplication("Plugin","RSP Dll", "RSP\\RSP 1.7.dll")); - AddHandler(CurrentGFX_Plugin, new CSettingTypeApplication("Plugin","Graphics Dll", "GFX\\Jabo_Direct3D8.dll")); - AddHandler(CurrentAUDIO_Plugin, new CSettingTypeApplication("Plugin","Audio Dll", "Audio\\Jabo_Dsound.dll")); - AddHandler(CurrentCONT_Plugin, new CSettingTypeApplication("Plugin","Controller Dll","Input\\Jabo_DInput.dll")); +/* AddHandler(CurVerRSP_Plugin, new CSettingTypeApplication("Plugin","RSP Dll Ver", "")); AddHandler(CurVerGFX_Plugin, new CSettingTypeApplication("Plugin","Graphics Dll Ver", "")); AddHandler(CurVerAUDIO_Plugin, new CSettingTypeApplication("Plugin","Audio Dll Ver", "")); AddHandler(CurVerCONT_Plugin, new CSettingTypeApplication("Plugin","Controller Dll Ver", "")); - /*INFO(RSP_PluginChanged, No_Default,Data_DWORD,TemporarySetting,"","",0); - INFO(AUDIO_PluginChanged,No_Default,Data_DWORD,TemporarySetting,"","",0); - INFO(GFX_PluginChanged, No_Default,Data_DWORD,TemporarySetting,"","",0); - INFO(CONT_PluginChanged, No_Default,Data_DWORD,TemporarySetting,"","",0); + /*INFO(RSP_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0); + INFO(AUDIO_PluginChanged,Default_None,Data_DWORD,TemporarySetting,"","",0); + INFO(GFX_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0); + INFO(CONT_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0); //Cheats for (count = 0; count < MaxCheats; count++ ) { char Name[300]; _snprintf(Name,sizeof(Name),"Cheat%d",count); - INF2((SettingID)(count + CheatEntry), No_Default,Data_String,CheatSetting,Name,"",0,CheatEntry); + INF2((SettingID)(count + CheatEntry), Default_None,Data_String,CheatSetting,Name,"",0,CheatEntry); _snprintf(Name,sizeof(Name),"Cheat%d",count); - INF2((SettingID)(count + CheatPermEntry),No_Default,Data_String,RomSetting,Name,"",0,CheatEntry); + INF2((SettingID)(count + CheatPermEntry),Default_None,Data_String,RomSetting,Name,"",0,CheatEntry); _snprintf(Name,sizeof(Name),"Cheat%d_O",count); - INF2((SettingID)(count + CheatOptions), No_Default,Data_String,CheatSetting,Name,"",0,CheatOptions); + INF2((SettingID)(count + CheatOptions), Default_None,Data_String,CheatSetting,Name,"",0,CheatOptions); _snprintf(Name,sizeof(Name),"Cheat%d_R",count); - INF2((SettingID)(count + CheatRange), No_Default,Data_String,CheatSetting,Name,"",0,CheatRange); + INF2((SettingID)(count + CheatRange), Default_None,Data_String,CheatSetting,Name,"",0,CheatRange); _snprintf(Name,sizeof(Name),"Cheat%d_RN",count); - INF2((SettingID)(count + CheatRangeNotes), No_Default,Data_String,CheatSetting,Name,"",0,CheatRangeNotes); + INF2((SettingID)(count + CheatRangeNotes), Default_None,Data_String,CheatSetting,Name,"",0,CheatRangeNotes); _snprintf(Name,sizeof(Name),"Cheat%d_N",count); - INF2((SettingID)(count + CheatNotes), No_Default,Data_String,CheatSetting,Name,"",0,CheatNotes); + INF2((SettingID)(count + CheatNotes), Default_None,Data_String,CheatSetting,Name,"",0,CheatNotes); _snprintf(Name,sizeof(Name),"Cheat%d",count); INF2((SettingID)(count + CheatActive), Default_False,Data_DWORD,GameSetting,Name,"",0,CheatActive); @@ -243,6 +437,7 @@ void CSettings::AddHowToHandleSetting () */ //Directories +/* AddHandler(InitialPluginDirectory, new CSettingTypeRelativePath("Plugin","")); AddHandler(InitialRomDirectory, new CSettingTypeRelativePath("Rom Directory","")); AddHandler(InitialSaveDirectory, new CSettingTypeRelativePath("Save","")); @@ -271,10 +466,10 @@ void CSettings::AddHowToHandleSetting () AddHandler(UseInstantDirSelected, new CSettingTypeApplication("Directory","Use Default Instant Dir", InitialPluginDirectory)); AddHandler(UseSnapShotDirSelected, new CSettingTypeApplication("Directory","Use Default Snap Shot Dir", InitialPluginDirectory)); /* - INFO(ApplicationDir,No_Default,Data_String,RelativePath,"","",0); + INFO(ApplicationDir,Default_None,Data_String,RelativePath,"","",0); */ //Debugger - AddHandler(Debugger, new CSettingTypeApplication("Debugger","Debugger",false)); +/* AddHandler(Debugger, new CSettingTypeApplication("Debugger","Debugger",false)); AddHandler(ShowUnhandledMemory, new CSettingTypeApplication("Debugger","Show Unhandled Memory",false)); AddHandler(ShowPifErrors, new CSettingTypeApplication("Debugger","Show Pif Errors",false)); AddHandler(ShowDListAListCount, new CSettingTypeApplication("Debugger","Show Dlist Alist Count",false)); @@ -288,12 +483,15 @@ void CSettings::AddHowToHandleSetting () AddHandler(UseHighLevelAudio, new CSettingTypeApplication("Plugin Directory","RSP",false)); AddHandler(UseHighLevelGfx, new CSettingTypeApplication("Plugin Directory","RSP",true)); - //Idvidual Game Settings + //Indvidual Game Settings + AddHandler(Game_SaveChip, new CSettingTypeGame("","SaveChip",Rdb_SaveChip)); + + /* INFO(Game_LastSaveSlot,Default_SaveSlot,Data_DWORD,GameSetting,"Last Used Save Slot","",0); //Rom Settings */ - AddHandler(ROM_IniKey, new CSettingTypeTempString("")); +/* AddHandler(ROM_IniKey, new CSettingTypeTempString("")); AddHandler(ROM_NAME, new CSettingTypeTempString("")); //AddHandler(ROM_Default, new CSettingTypeTempNumber(-1)); AddHandler(ROM_MD5, new CSettingTypeRomDatabase("MD5","")); @@ -332,7 +530,7 @@ void CSettings::AddHowToHandleSetting () /* for (count = ROM_MD5 + 1; count != ROM_LastMD5; count++ ) { char Name[300]; _snprintf(Name,sizeof(Name),"MD5%d",count - ROM_LastMD5); - INFO((SettingID)count,No_Default,Data_String,RomSetting,Name,"",0); + INFO((SettingID)count,Default_None,Data_String,RomSetting,Name,"",0); } //System Settings @@ -348,42 +546,40 @@ void CSettings::AddHowToHandleSetting () INFO(SYSTEM_SMM_Protect, Default_False, Data_DWORD, SettingLoc,"SMM-Protect","",0); */ // Verifier - AddHandler(BetaUserNameMD5, new CSettingTypeTempString("CBBABA8D2262FF1F7A47CEAD87FC4304")); - AddHandler(BetaEmailAddressMD5, new CSettingTypeTempString("47A3D7CBF1DA291D5EB30DCAAF21B9F8")); - +/* //Currrent Running Information AddHandler(CPU_Paused, new CSettingTypeTempBool(false)); - AddHandler(CPU_Paused_type, new CSettingTypeTempNumber(No_Default)); -/* INFO(RamSize, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(CPUType, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(BlockLinking, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(DelayDlists, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(DelaySI, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(CounterFactor, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(UseJumpTable, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(RomInMemory, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(SyncViaAudio, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(UseTLB, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(AudioSignal, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(FuncLookupMode, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(ApplicationName, No_Default, Data_String, TemporarySetting,"","",0); - INFO(SaveChipType, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(FirstDMA, No_Default, Data_DWORD, TemporarySetting,"","",0); + AddHandler(CPU_Paused_type, new CSettingTypeTempNumber(Default_None)); +/* INFO(RamSize, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(CPUType, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(BlockLinking, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(DelayDlists, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(DelaySI, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(CounterFactor, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(UseJumpTable, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(RomInMemory, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(SyncViaAudio, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(UseTLB, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(AudioSignal, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(FuncLookupMode, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(ApplicationName, Default_None, Data_String, TemporarySetting,"","",0); + INFO(SaveChipType, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(FirstDMA, Default_None, Data_DWORD, TemporarySetting,"","",0); INFO(ShowPifErrors, Default_True, Data_DWORD, TemporarySetting,"","",0); - INFO(CurrentSaveState,No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(InstantSaveFile, No_Default, Data_String, TemporarySetting,"","",0); + INFO(CurrentSaveState,Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(InstantSaveFile, Default_None, Data_String, TemporarySetting,"","",0); */ - AddHandler(CurrentSaveState, new CSettingTypeTempNumber(0)); +/* AddHandler(CurrentSaveState, new CSettingTypeTempNumber(0)); AddHandler(LoadingRom, new CSettingTypeTempBool(false)); AddHandler(CPU_Running, new CSettingTypeTempBool(false)); AddHandler(ScreenHertz, new CSettingTypeTempNumber(60)); AddHandler(InFullScreen, new CSettingTypeTempBool(false)); /* INFO(InFullScreen, Default_False, Data_DWORD, TemporarySetting,"","",0); - INFO(SMM_Cache, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(SMM_PIDMA, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(SMM_TLB, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(SMM_Protect, No_Default, Data_DWORD, TemporarySetting,"","",0); - INFO(SMM_ValidFunc, No_Default, Data_DWORD, TemporarySetting,"","",0); + INFO(SMM_Cache, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(SMM_PIDMA, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(SMM_TLB, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(SMM_Protect, Default_None, Data_DWORD, TemporarySetting,"","",0); + INFO(SMM_ValidFunc, Default_None, Data_DWORD, TemporarySetting,"","",0); #undef INFO */ @@ -397,55 +593,52 @@ DWORD CSettings::GetSetting ( CSettings * _this, SettingID Type ) const char * CSettings::GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize ) { - Notify().BreakPoint(__FILE__,__LINE__); -/* if (Buffer && BufferSize > 0) + if (Buffer && BufferSize > 0) { Buffer[0] = 0; - _this->Load(Type, Buffer, BufferSize); - }*/ + _this->LoadString(Type, Buffer,BufferSize); + } return Buffer; } void CSettings::SetSetting ( CSettings * _this, SettingID ID, unsigned int Value ) { - Notify().BreakPoint(__FILE__,__LINE__); -// _this->SaveDword(ID,Value); + _this->SaveDword(ID,Value); } void CSettings::SetSettingSz ( CSettings * _this, SettingID ID, const char * Value ) { - Notify().BreakPoint(__FILE__,__LINE__); -// _this->SaveString(ID,Value); + _this->SaveString(ID,Value); } -void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType Type, - SettingLocation Location, const char * Category, const char * DefaultStr, +void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType, + SettingType Type, const char * Category, const char * DefaultStr, DWORD Value ) { - switch (Location) + switch (Type) { - case SettingLocation_ConstValue: - if (Type != Data_DWORD) + case SettingType_ConstValue: + if (DataType != Data_DWORD) { Notify().BreakPoint(__FILE__,__LINE__); return; } _this->AddHandler(ID,new CSettingTypeTempNumber(Value)); break; - case SettingLocation_ConstString: - if (Type != Data_String) + case SettingType_ConstString: + if (DataType != Data_String) { Notify().BreakPoint(__FILE__,__LINE__); return; } _this->AddHandler(ID,new CSettingTypeTempString(DefaultStr)); break; - case SettingLocation_CfgFile: - case SettingLocation_Registry: - switch (Type) + case SettingType_CfgFile: + case SettingType_Registry: + switch (DataType) { case Data_DWORD: - if (DefaultID == No_Default) + if (DefaultID == Default_None) { _this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,Value)); } else { @@ -453,7 +646,7 @@ void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID Def } break; case Data_String: - if (DefaultID == No_Default) + if (DefaultID == Default_None) { _this->AddHandler(ID,new CSettingTypeApplication(Category,DefaultStr,"")); } else { @@ -464,17 +657,48 @@ void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID Def Notify().BreakPoint(__FILE__,__LINE__); } break; - case SettingLocation_GameSetting: - switch (Type) + case SettingType_GameSetting: + switch (DataType) { case Data_DWORD: - if (DefaultID == No_Default) + if (DefaultID == Default_None) { _this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,Value)); } else { _this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,DefaultID)); } break; + case Data_String: + if (DefaultID == Default_None) + { + _this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,"")); + } else { + _this->AddHandler(ID,new CSettingTypeGame(Category,DefaultStr,DefaultID)); + } + break; + default: + Notify().BreakPoint(__FILE__,__LINE__); + } + break; + case SettingType_RomDatabase: + switch (DataType) + { + case Data_DWORD: + if (DefaultID == Default_None) + { + _this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,(int)Value)); + } else { + _this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,(SettingID)Value)); + } + break; + case Data_String: + if (DefaultID == Default_None) + { + _this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,"")); + } else { + _this->AddHandler(ID,new CSettingTypeRomDatabase(DefaultStr,DefaultID)); + } + break; default: Notify().BreakPoint(__FILE__,__LINE__); } @@ -506,61 +730,21 @@ bool CSettings::Initilize( const char * AppName ) AddHowToHandleSetting(); CSettingTypeApplication::Initilize(AppName); CSettingTypeRomDatabase::Initilize(); + CSettingTypeGame::Initilize(); + CSettingTypeCheats::Initilize(); -/* strncpy(Registrylocation,"Software\\N64 Emulation\\",sizeof(Registrylocation)); - strncat(Registrylocation,AppName,sizeof(Registrylocation)); - RegistryKey = (int)HKEY_CURRENT_USER; - - if (SettingInfo.size() == 0) { - AddHowToHandleSetting(); - } - - _Settings->SaveString(ApplicationName,AppName); - - RomIniFile = new CIniFile(LoadString(IniName).c_str()); - CheatIniFile = new CIniFile(LoadString(CheatIniName).c_str()); -*/ + _Settings->SaveString(Setting_ApplicationName,AppName); return true; } bool CSettings::LoadBool ( SettingID Type ) { - SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); - if (FindInfo == m_SettingInfo.end()) - { - //if not found do nothing - UnknownSetting(Type); - return 0; - } bool Value = false; - if (FindInfo->second->IndexBasedSetting()) - { - Notify().BreakPoint(__FILE__,__LINE__); - } else { - FindInfo->second->Load(0,Value); - } + LoadBool(Type,Value); return Value; } bool CSettings::LoadBool ( SettingID Type, bool & Value ) -{ - Notify().BreakPoint(__FILE__,__LINE__); - return false; -} - -bool CSettings::LoadBoolIndex( SettingID Type, int index ) -{ - Notify().BreakPoint(__FILE__,__LINE__); - return false; -} - -bool CSettings::LoadBoolIndex( SettingID Type, int index , bool & Value ) -{ - Notify().BreakPoint(__FILE__,__LINE__); - return false; -} - -DWORD CSettings::LoadDword ( SettingID Type ) { SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); if (FindInfo == m_SettingInfo.end()) @@ -569,13 +753,44 @@ DWORD CSettings::LoadDword ( SettingID Type ) UnknownSetting(Type); return 0; } - DWORD Value = 0; if (FindInfo->second->IndexBasedSetting()) { Notify().BreakPoint(__FILE__,__LINE__); } else { - FindInfo->second->Load(0,Value); + return FindInfo->second->Load(0,Value); } + return false; +} + +bool CSettings::LoadBoolIndex( SettingID Type, int index ) +{ + bool Value = false; + LoadBoolIndex(Type,index,Value); + return Value; +} + +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); + return false; + } + if (FindInfo->second->IndexBasedSetting()) + { + return FindInfo->second->Load(index,Value); + } else { + Notify().BreakPoint(__FILE__,__LINE__); + } + return false; +} + +DWORD CSettings::LoadDword ( SettingID Type ) +{ + DWORD Value = 0; + LoadDword(Type,Value); return Value; } @@ -592,32 +807,15 @@ bool CSettings::LoadDword ( SettingID Type, DWORD & Value) { Notify().BreakPoint(__FILE__,__LINE__); } else { - DWORD TempValue = 0; - if (FindInfo->second->Load(0,TempValue)) - { - Value = TempValue; - return true; - } + return FindInfo->second->Load(0,Value); } return false; } DWORD CSettings::LoadDwordIndex( SettingID Type, int index) { - SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); - if (FindInfo == m_SettingInfo.end()) - { - //if not found do nothing - UnknownSetting(Type); - return 0; - } - DWORD Value = 0; - if (FindInfo->second->IndexBasedSetting()) - { - FindInfo->second->Load(index,Value); - } else { - Notify().BreakPoint(__FILE__,__LINE__); - } + DWORD Value; + LoadDwordIndex(Type,index,Value); return Value; } @@ -632,12 +830,7 @@ bool CSettings::LoadDwordIndex( SettingID Type, int index, DWORD & Value) } if (FindInfo->second->IndexBasedSetting()) { - DWORD TempValue = 0; - if (FindInfo->second->Load(index,TempValue)) - { - Value = TempValue; - return true; - } + return FindInfo->second->Load(index,Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } @@ -646,20 +839,8 @@ bool CSettings::LoadDwordIndex( SettingID Type, int index, DWORD & Value) stdstr CSettings::LoadString ( SettingID Type ) { - SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); - if (FindInfo == m_SettingInfo.end()) - { - //if not found do nothing - UnknownSetting(Type); - return 0; - } stdstr Value; - if (FindInfo->second->IndexBasedSetting()) - { - Notify().BreakPoint(__FILE__,__LINE__); - } else { - FindInfo->second->Load(0,Value); - } + LoadString(Type,Value); return Value; } @@ -683,11 +864,38 @@ bool CSettings::LoadString ( SettingID Type, stdstr & Value ) bool CSettings::LoadString ( SettingID Type, char * Buffer, int BufferSize ) { - Notify().BreakPoint(__FILE__,__LINE__); - return false; + SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); + if (FindInfo == m_SettingInfo.end()) + { + //if not found do nothing + UnknownSetting(Type); + return 0; + } + bool bRes = false; + if (FindInfo->second->IndexBasedSetting()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } else { + stdstr Value; + bRes = FindInfo->second->Load(0,Value); + int len = BufferSize; + if ((Value.length() + 1) < len) + { + len = Value.length() + 1; + } + strncpy(Buffer,Value.c_str(),len); + } + return bRes; } stdstr CSettings::LoadStringIndex ( SettingID Type, int index ) +{ + stdstr Value; + LoadStringIndex(Type,index,Value); + return Value; +} + +bool CSettings::LoadStringIndex ( SettingID Type, int index, stdstr & Value ) { SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); if (FindInfo == m_SettingInfo.end()) @@ -696,19 +904,12 @@ stdstr CSettings::LoadStringIndex ( SettingID Type, int index ) UnknownSetting(Type); return 0; } - stdstr Value; if (FindInfo->second->IndexBasedSetting()) { - FindInfo->second->Load(index,Value); + return FindInfo->second->Load(index,Value); } else { Notify().BreakPoint(__FILE__,__LINE__); } - return Value; -} - -bool CSettings::LoadStringIndex ( SettingID Type, int index, stdstr & Value ) -{ - Notify().BreakPoint(__FILE__,__LINE__); return false; } @@ -718,14 +919,156 @@ bool CSettings::LoadStringIndex ( SettingID Type, int index, char * Buffer, int return false; } -void CSettings::SaveBool ( SettingID Type, bool Value ) +//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 ) +{ + SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); + if (FindInfo == m_SettingInfo.end()) + { + //if not found do nothing + UnknownSetting(Type); + } else { + if (FindInfo->second->IndexBasedSetting()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } else { + FindInfo->second->LoadDefault(0,Value); + } + } +} + +bool CSettings::LoadDefaultBoolIndex ( SettingID Type, int index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +void CSettings::LoadDefaultBoolIndex ( SettingID Type, int index , bool & Value ) { Notify().BreakPoint(__FILE__,__LINE__); } -void CSettings::SaveBoolIndex( SettingID Type, int index, bool Value ) +DWORD CSettings::LoadDefaultDword ( SettingID Type ) +{ + DWORD Value = 0; + LoadDefaultDword(Type,Value); + return Value; +} + +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()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } else { + FindInfo->second->LoadDefault(0,Value); + } + } +} + +DWORD CSettings::LoadDefaultDwordIndex ( SettingID Type, int index ) { Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +void CSettings::LoadDefaultDwordIndex ( SettingID Type, int index, DWORD & Value) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +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()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } else { + FindInfo->second->LoadDefault(0,Value); + } + } +} + +void CSettings::LoadDefaultString ( SettingID Type, char * Buffer, int BufferSize ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +stdstr CSettings::LoadDefaultStringIndex ( SettingID Type, int index ) +{ + Notify().BreakPoint(__FILE__,__LINE__); + return false; +} + +void CSettings::LoadDefaultStringIndex ( SettingID Type, int index, stdstr & Value ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +void CSettings::LoadDefaultStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize ) +{ + Notify().BreakPoint(__FILE__,__LINE__); +} + +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()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } 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 { + Notify().BreakPoint(__FILE__,__LINE__); + } + NotifyCallBacks(Type); } void CSettings::SaveDword ( SettingID Type, DWORD Value ) @@ -764,9 +1107,22 @@ void CSettings::SaveDwordIndex ( SettingID Type, int index, DWORD Value ) NotifyCallBacks(Type); } -void CSettings::SaveString ( SettingID Type, const stdstr & value ) +void CSettings::SaveString ( SettingID Type, const stdstr & Value ) { - Notify().BreakPoint(__FILE__,__LINE__); + SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); + if (FindInfo == m_SettingInfo.end()) + { + //if not found do nothing + UnknownSetting(Type); + return; + } + if (FindInfo->second->IndexBasedSetting()) + { + Notify().BreakPoint(__FILE__,__LINE__); + } else { + FindInfo->second->Save(0,Value); + } + NotifyCallBacks(Type); } void CSettings::SaveString ( SettingID Type, const char * Buffer ) @@ -788,10 +1144,27 @@ void CSettings::SaveString ( SettingID Type, const char * Buffer ) void CSettings::SaveStringIndex( SettingID Type, int index, const char * Buffer ) { - Notify().BreakPoint(__FILE__,__LINE__); + 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 { + Notify().BreakPoint(__FILE__,__LINE__); + } + NotifyCallBacks(Type); } void CSettings::SaveStringIndex( SettingID Type, int index, const stdstr & Value ) +{ + SaveStringIndex(Type,index,Value.c_str()); +} + +void CSettings::DeleteSetting( SettingID Type ) { SETTING_HANDLER FindInfo = m_SettingInfo.find(Type); if (FindInfo == m_SettingInfo.end()) @@ -801,13 +1174,67 @@ void CSettings::SaveStringIndex( SettingID Type, int index, const stdstr & Value } if (FindInfo->second->IndexBasedSetting()) { - FindInfo->second->Save(index,Value); + Notify().BreakPoint(__FILE__,__LINE__); + } 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); } else { 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); + } + } +} void CSettings::UnknownSetting (SettingID Type) { #ifdef _DEBUG @@ -846,7 +1273,7 @@ void CSettings::Load(SettingID Type, char * Buffer, int BufferSize) { } CSettingInfo * Info = &FindInfo->second; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,Buffer, BufferSize); } //Copy Default String @@ -916,7 +1343,7 @@ void CSettings::Load(SettingID Type, char * Buffer, int BufferSize) { lResult = RegQueryValueEx(hKeyResults,Info->Name.c_str(),0,&RegType,(LPBYTE)(Buffer),&Bytes); if (RegType != REG_SZ || lResult != ERROR_SUCCESS) { //Reload Defaults just in case data has changed - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,Buffer, BufferSize); } } @@ -1064,7 +1491,7 @@ void CSettings::Load(SettingID Type, DWORD & Value) } CSettingInfo * Info = &FindInfo->second; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,Value); } if (Info->Location == ConstValue) { @@ -1273,7 +1700,7 @@ void CSettings::SaveString(SettingID Type, const char * Buffer) { if (CheatIniFile == NULL) { return; } if (Info->DataType == Data_String) { stdstr DefaultValue; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { DefaultValue = LoadString(Info->DefaultValue); } if (DefaultValue == Buffer) { @@ -1300,7 +1727,7 @@ void CSettings::SaveString(SettingID Type, const char * Buffer) { } stdstr DefaultValue; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { DefaultValue = LoadString(Info->DefaultValue); } @@ -1321,7 +1748,7 @@ void CSettings::SaveString(SettingID Type, const char * Buffer) { } else if (Info->Location == LocalSettings) { if (SettingsIniFile == NULL) { return; } stdstr DefaultValue; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { DefaultValue = LoadString(Info->DefaultValue); } stdstr_f Ident("%s",Info->SubNode.c_str()); @@ -1365,7 +1792,7 @@ void CSettings::SaveDword(SettingID Type, DWORD Value) { if (SettingsIniFile == NULL) { return; } DWORD DefaultValue = 0; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,DefaultValue); } stdstr_f Ident("%s",Info->SubNode.c_str()); @@ -1375,7 +1802,7 @@ void CSettings::SaveDword(SettingID Type, DWORD Value) { } Ident.replace("\\","-"); - if (Info->DefaultValue != No_Default && Value == DefaultValue) { + if (Info->DefaultValue != Default_None && Value == DefaultValue) { SettingsIniFile->SaveString(Ident.c_str(),Info->Name.c_str(),NULL); } else { SettingsIniFile->SaveNumber(Ident.c_str(),Info->Name.c_str(),Value); @@ -1405,10 +1832,10 @@ void CSettings::SaveDword(SettingID Type, DWORD Value) { if (RomIniFile == NULL) { return; } if (Info->DataType == Data_DWORD) { DWORD DefaultValue = 0; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,DefaultValue); } - if (Info->DefaultValue != No_Default && Value == DefaultValue) { + if (Info->DefaultValue != Default_None && Value == DefaultValue) { RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),NULL); } else { RomIniFile->SaveNumber(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Value); @@ -1446,10 +1873,10 @@ void CSettings::SaveDword(SettingID Type, DWORD Value) { // RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String); } else if (Info->DataType == Data_YesNo) { DWORD DefaultValue = 0; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,DefaultValue); } - if (Info->DefaultValue != No_Default && Value == DefaultValue) { + if (Info->DefaultValue != Default_None && Value == DefaultValue) { RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),NULL); } else { RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Value ? "Yes" : "No"); @@ -1486,11 +1913,11 @@ void CSettings::SaveDword(SettingID Type, DWORD Value) { } DWORD DefaultValue = 0; - if (Info->DefaultValue != No_Default) { + if (Info->DefaultValue != Default_None) { Load(Info->DefaultValue,DefaultValue); } - if (Info->DefaultValue != No_Default && Value == DefaultValue) { + if (Info->DefaultValue != Default_None && Value == DefaultValue) { SettingsIniFile->SaveString(Ident,Info->Name.c_str(),NULL); } else { SettingsIniFile->SaveNumber(Ident,Info->Name.c_str(),Value); diff --git a/Source/Project64/Settings/Settings Class.h b/Source/Project64/Settings/Settings Class.h index fe4cd0c29..aeb22f409 100644 --- a/Source/Project64/Settings/Settings Class.h +++ b/Source/Project64/Settings/Settings Class.h @@ -217,46 +217,68 @@ public: bool Initilize ( const char * AppName ); -// void Config (void * ParentWindow, CN64System * System, CMainGui * Gui); -// void ConfigRom (void * ParentWindow, CMainGui * Gui); - //return the values - bool LoadBool ( SettingID Type ); - bool LoadBool ( SettingID Type, bool & Value ); - bool LoadBoolIndex ( SettingID Type, int index ); - bool LoadBoolIndex ( SettingID Type, int index , bool & Value ); - DWORD LoadDword ( SettingID Type ); - bool LoadDword ( SettingID Type, DWORD & Value); - DWORD LoadDwordIndex ( SettingID Type, int index ); - bool LoadDwordIndex ( SettingID Type, int index, DWORD & Value); - stdstr LoadString ( SettingID Type ); - bool LoadString ( SettingID Type, stdstr & Value ); - bool LoadString ( SettingID Type, char * Buffer, int BufferSize ); - stdstr LoadStringIndex ( SettingID Type, int index ); - bool LoadStringIndex ( SettingID Type, int index, stdstr & Value ); - bool LoadStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize ); + bool LoadBool ( SettingID Type ); + bool LoadBool ( SettingID Type, bool & Value ); + bool LoadBoolIndex ( SettingID Type, int index ); + bool LoadBoolIndex ( SettingID Type, int index , bool & Value ); + DWORD LoadDword ( SettingID Type ); + bool LoadDword ( SettingID Type, DWORD & Value); + DWORD LoadDwordIndex ( SettingID Type, int index ); + bool LoadDwordIndex ( SettingID Type, int index, DWORD & Value); + stdstr LoadString ( SettingID Type ); + bool LoadString ( SettingID Type, stdstr & Value ); + bool LoadString ( SettingID Type, char * Buffer, int BufferSize ); + stdstr LoadStringIndex ( SettingID Type, int index ); + bool LoadStringIndex ( SettingID Type, int index, stdstr & Value ); + bool LoadStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize ); + + //Load the default value for the setting + bool LoadDefaultBool ( SettingID Type ); + void LoadDefaultBool ( SettingID Type, bool & Value ); + bool LoadDefaultBoolIndex ( SettingID Type, int index ); + void LoadDefaultBoolIndex ( SettingID Type, int index , bool & Value ); + DWORD LoadDefaultDword ( SettingID Type ); + void LoadDefaultDword ( SettingID Type, DWORD & Value); + DWORD LoadDefaultDwordIndex ( SettingID Type, int index ); + void LoadDefaultDwordIndex ( SettingID Type, int index, DWORD & Value); + stdstr LoadDefaultString ( SettingID Type ); + void LoadDefaultString ( SettingID Type, stdstr & Value ); + void LoadDefaultString ( SettingID Type, char * Buffer, int BufferSize ); + stdstr LoadDefaultStringIndex ( SettingID Type, int index ); + void LoadDefaultStringIndex ( SettingID Type, int index, stdstr & Value ); + void LoadDefaultStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize ); //Update the settings - void SaveBool ( SettingID Type, bool Value ); - void SaveBoolIndex ( SettingID Type, int index, bool Value ); - void SaveDword ( SettingID Type, DWORD Value ); - void SaveDwordIndex ( SettingID Type, int index, DWORD Value ); - void SaveString ( SettingID Type, const stdstr & Value ); - void SaveStringIndex ( SettingID Type, int index, const stdstr & Value ); - void SaveString ( SettingID Type, const char * Buffer ); - void SaveStringIndex ( SettingID Type, int index, const char * Buffer ); + void SaveBool ( SettingID Type, bool Value ); + void SaveBoolIndex ( SettingID Type, int index, bool Value ); + void SaveDword ( SettingID Type, DWORD Value ); + void SaveDwordIndex ( SettingID Type, int index, DWORD Value ); + void SaveString ( SettingID Type, const stdstr & Value ); + void SaveStringIndex ( SettingID Type, int index, const stdstr & Value ); + void SaveString ( SettingID Type, const char * Buffer ); + void SaveStringIndex ( SettingID Type, int index, const char * Buffer ); + // Delete a setting + void DeleteSetting ( SettingID Type ); + void DeleteSettingIndex ( SettingID Type, int index ); + //Register Notification of change - void RegisterChangeCB(SettingID Type,void * Data, SettingChangedFunc Func); - void UnregisterChangeCB(SettingID Type,void * Data, SettingChangedFunc Func); + void RegisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func); + void UnregisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func); + + // information about setting + SettingType GetSettingType ( SettingID Type ); + bool IndexBasedSetting ( SettingID Type ); + void SettingTypeChanged ( SettingType Type ); // static functions for plugins static DWORD GetSetting ( CSettings * _this, SettingID Type ); static LPCSTR GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize ); static void SetSetting ( CSettings * _this, SettingID ID, unsigned int Value ); static void SetSettingSz ( CSettings * _this, SettingID ID, const char * Value ); - static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType Type, - SettingLocation Location, const char * Category, const char * DefaultStr, + static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType, + SettingType Type, const char * Category, const char * DefaultStr, DWORD Value ); private: void NotifyCallBacks ( SettingID Type ); diff --git a/Source/Project64/Settings/vssver2.scc b/Source/Project64/Settings/vssver2.scc deleted file mode 100644 index f0d859e6f..000000000 Binary files a/Source/Project64/Settings/vssver2.scc and /dev/null differ diff --git a/Source/Project64/Support/vssver2.scc b/Source/Project64/Support/vssver2.scc deleted file mode 100644 index 6e4c9fa42..000000000 Binary files a/Source/Project64/Support/vssver2.scc and /dev/null differ diff --git a/Source/Project64/User Interface.h b/Source/Project64/User Interface.h index 6d030de5b..48e4bb855 100644 --- a/Source/Project64/User Interface.h +++ b/Source/Project64/User Interface.h @@ -41,10 +41,12 @@ typedef struct { class CN64System; -#include "./WTL App.h" +#include +#include #include ".\\User Interface\\Rom Browser.h" #include ".\\User Interface\\Gui Class.h" #include ".\\User Interface\\Menu Class.h" +#include ".\\User Interface\\Menu Class.h" #include ".\\User Interface\\Main Menu Class.h" #include ".\\User Interface\\Notification Class.h" #include ".\\User Interface\\Frame Per Second Class.h" diff --git a/Source/Project64/User Interface/Bitmaps/vssver2.scc b/Source/Project64/User Interface/Bitmaps/vssver2.scc deleted file mode 100644 index 422ced426..000000000 Binary files a/Source/Project64/User Interface/Bitmaps/vssver2.scc and /dev/null differ diff --git a/Source/Project64/User Interface/Frame Per Second Class.cpp b/Source/Project64/User Interface/Frame Per Second Class.cpp index 38dbf4716..f78a2c35c 100644 --- a/Source/Project64/User Interface/Frame Per Second Class.cpp +++ b/Source/Project64/User Interface/Frame Per Second Class.cpp @@ -6,10 +6,10 @@ CFramePerSecond::CFramePerSecond (CNotification * Notification): _Notify(Notification) { - m_iFrameRateType = _Settings->LoadDword(FrameDisplayType); - m_ScreenHertz = _Settings->LoadDword(ScreenHertz); - _Settings->RegisterChangeCB(FrameDisplayType,this,(CSettings::SettingChangedFunc)FrameRateTypeChanged); - _Settings->RegisterChangeCB(ScreenHertz,this,(CSettings::SettingChangedFunc)ScreenHertzChanged); + m_iFrameRateType = _Settings->LoadDword(UserInterface_FrameDisplayType); + m_ScreenHertz = _Settings->LoadDword(GameRunning_ScreenHertz); + _Settings->RegisterChangeCB(UserInterface_FrameDisplayType,this,(CSettings::SettingChangedFunc)FrameRateTypeChanged); + _Settings->RegisterChangeCB(GameRunning_ScreenHertz,this,(CSettings::SettingChangedFunc)ScreenHertzChanged); if (m_ScreenHertz == 0) { @@ -24,8 +24,8 @@ CFramePerSecond::CFramePerSecond (CNotification * Notification): CFramePerSecond::~CFramePerSecond() { - _Settings->UnregisterChangeCB(FrameDisplayType,this,(CSettings::SettingChangedFunc)FrameRateTypeChanged); - _Settings->UnregisterChangeCB(ScreenHertz,this,(CSettings::SettingChangedFunc)ScreenHertzChanged); + _Settings->UnregisterChangeCB(UserInterface_FrameDisplayType,this,(CSettings::SettingChangedFunc)FrameRateTypeChanged); + _Settings->UnregisterChangeCB(GameRunning_ScreenHertz,this,(CSettings::SettingChangedFunc)ScreenHertzChanged); } void CFramePerSecond::Reset (bool ClearDisplay) { @@ -107,13 +107,13 @@ void CFramePerSecond::DisplayViCounter(DWORD FrameRate) { void CFramePerSecond::FrameRateTypeChanged (CFramePerSecond * _this) { - _this->m_iFrameRateType = _Settings->LoadDword(FrameDisplayType); + _this->m_iFrameRateType = _Settings->LoadDword(UserInterface_FrameDisplayType); _this->Reset(true); } void CFramePerSecond::ScreenHertzChanged (CFramePerSecond * _this) { - _this->m_ScreenHertz = _Settings->LoadDword(ScreenHertz); + _this->m_ScreenHertz = _Settings->LoadDword(GameRunning_ScreenHertz); _this->Reset(true); } diff --git a/Source/Project64/User Interface/Gui Class.cpp b/Source/Project64/User Interface/Gui Class.cpp index 29d2810ef..dc2127278 100644 --- a/Source/Project64/User Interface/Gui Class.cpp +++ b/Source/Project64/User Interface/Gui Class.cpp @@ -44,8 +44,8 @@ CMainGui::CMainGui (const char * WindowTitle, CNotification * Notify, CN64System m_hacked = false; if (_Settings) { - if (MD5(_Settings->LoadString(BetaUserName)).hex_digest() != _Settings->LoadString(BetaUserNameMD5) || - MD5(_Settings->LoadString(BetaEmailAddress)).hex_digest() != _Settings->LoadString(BetaEmailAddressMD5)) + if (MD5(_Settings->LoadString(Beta_UserName)).hex_digest() != _Settings->LoadString(Beta_UserNameMD5) || + MD5(_Settings->LoadString(Beta_EmailAddress)).hex_digest() != _Settings->LoadString(Beta_EmailAddressMD5)) { m_hacked = true; } @@ -66,6 +66,13 @@ CMainGui::CMainGui (const char * WindowTitle, CNotification * Notify, CN64System m_InvalidExeMsg = RegisterWindowMessage("Invalid"); + if (m_System) + { + _Settings->RegisterChangeCB(RomBrowser_Enabled,this,(CSettings::SettingChangedFunc)RomBowserEnabledChanged); + _Settings->RegisterChangeCB(RomBrowser_ColoumnsChanged,this,(CSettings::SettingChangedFunc)RomBowserColoumnsChanged); + _Settings->RegisterChangeCB(RomBrowser_Recursive,this,(CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); + } + //if this fails then it has already been created RegisterWinClass(); Create(WindowTitle); @@ -75,6 +82,12 @@ CMainGui::CMainGui (const char * WindowTitle, CNotification * Notify, CN64System CMainGui::~CMainGui (void) { WriteTrace(TraceDebug,"CMainGui::~CMainGui - start"); + if (m_System) + { + _Settings->UnregisterChangeCB(RomBrowser_Enabled,this,(CSettings::SettingChangedFunc)RomBowserEnabledChanged); + _Settings->UnregisterChangeCB(RomBrowser_ColoumnsChanged,this,(CSettings::SettingChangedFunc)RomBowserColoumnsChanged); + _Settings->UnregisterChangeCB(RomBrowser_Recursive,this,(CSettings::SettingChangedFunc)RomBrowserRecursiveChanged); + } if (m_hMainWindow) { DestroyWindow((HWND)m_hMainWindow); @@ -82,6 +95,33 @@ CMainGui::~CMainGui (void) WriteTrace(TraceDebug,"CMainGui::~CMainGui - Done"); } +void RomBowserEnabledChanged (CMainGui * Gui) +{ + if (Gui && _Settings->LoadBool(RomBrowser_Enabled)) + { + if (!Gui->RomBrowserVisible()) + { + Gui->ShowRomList(); + } + } else { + if (Gui->RomBrowserVisible()) + { + Gui->HideRomList(); + } + } +} + +void RomBowserColoumnsChanged (CMainGui * Gui) +{ + Gui->ResetRomBrowserColomuns(); +} + +void RomBrowserRecursiveChanged (CMainGui * Gui) +{ + Gui->RefreshRomBrowser(); + Gui->HighLightLastRom(); +} + void CMainGui::ChangeWinSize (long width, long height) { CGuard Guard(m_CS); WINDOWPLACEMENT wndpl; @@ -141,7 +181,7 @@ DWORD CALLBACK AboutIniBoxProc (WND_HANDLE WndHandle, DWORD uMsg, DWORD wParam, //RDB Notify().BreakPoint(__FILE__,__LINE__); - stdstr IniFile = _Settings->LoadString(RomDatabaseFile).c_str(); + stdstr IniFile = _Settings->LoadString(SupportFile_RomDatabase).c_str(); SetDlgItemText(hDlg,IDC_RDB,GS(INI_CURRENT_RDB)); GetPrivateProfileString("Meta","Author","",String,sizeof(String),IniFile.c_str()); if (strlen(String) == 0) { @@ -167,7 +207,7 @@ DWORD CALLBACK AboutIniBoxProc (WND_HANDLE WndHandle, DWORD uMsg, DWORD wParam, //Cheat SetDlgItemText(hDlg,IDC_CHT,GS(INI_CURRENT_CHT)); - IniFile = _Settings->LoadString(CheatIniName).c_str(); + IniFile = _Settings->LoadString(SupportFile_Cheats).c_str(); GetPrivateProfileString("Meta","Author","",String,sizeof(String),IniFile.c_str()); if (strlen(String) == 0) { EnableWindow(GetDlgItem(hDlg,IDC_CHT),FALSE); @@ -192,7 +232,7 @@ DWORD CALLBACK AboutIniBoxProc (WND_HANDLE WndHandle, DWORD uMsg, DWORD wParam, //Extended Info SetDlgItemText(hDlg,IDC_RDX,GS(INI_CURRENT_RDX)); - IniFile = _Settings->LoadString(ExtIniName).c_str();; + IniFile = _Settings->LoadString(SupportFile_ExtInfo).c_str();; GetPrivateProfileString("Meta","Author","",String,sizeof(String),IniFile.c_str()); if (strlen(String) == 0) { EnableWindow(GetDlgItem(hDlg,IDC_RDX),FALSE); @@ -388,15 +428,15 @@ void CMainGui::SaveWindowLoc ( void ) if (m_SaveMainWindowPos) { m_SaveMainWindowPos = false; - _Settings->SaveDword(MainWindowTop,m_SaveMainWindowTop); - _Settings->SaveDword(MainWindowLeft,m_SaveMainWindowLeft); + _Settings->SaveDword(UserInterface_MainWindowTop,m_SaveMainWindowTop); + _Settings->SaveDword(UserInterface_MainWindowLeft,m_SaveMainWindowLeft); } if (m_SaveRomBrowserPos) { m_SaveRomBrowserPos = false; - _Settings->SaveDword(RomBrowserTop,m_SaveRomBrowserTop); - _Settings->SaveDword(RomBrowserLeft,m_SaveRomBrowserLeft); + _Settings->SaveDword(RomBrowser_Top,m_SaveRomBrowserTop); + _Settings->SaveDword(RomBrowser_Left,m_SaveRomBrowserLeft); } } @@ -420,8 +460,8 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam //Move the Main window to the location last executed from or center the window int X = (GetSystemMetrics( SM_CXSCREEN ) - _this->Width()) / 2; int Y = (GetSystemMetrics( SM_CYSCREEN ) - _this->Height()) / 2; - _Settings->LoadDword(MainWindowTop,(DWORD &)Y); - _Settings->LoadDword(MainWindowLeft,(DWORD &)X); + _Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y); + _Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X); _this->SetPos(X,Y); _this->ChangeWinSize(640,480); @@ -439,9 +479,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam { CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); if (_this && - _this->bCPURunning && - !_Settings->LoadDword(CPU_Paused) && - _Settings->LoadDword(DisableScrSaver)) + _this->bCPURunning() && + !_Settings->LoadBool(GameRunning_CPU_Paused) && + _Settings->LoadDword(Setting_DisableScrSaver)) { return 0; } @@ -487,7 +527,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam } } } - if (CGuiSettings::bCPURunning && System) { + if (CGuiSettings::bCPURunning() && System) { CPlugins * Plugins = System->Plugins(); if (Plugins->Gfx() && Plugins->Gfx()->MoveScreen) { WriteTrace(TraceGfxPlugin,"MoveScreen: Starting"); @@ -501,7 +541,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam { CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); static DWORD CallCount = 0; - if (!_Settings->LoadDword(IsValidExe)) + if (!_Settings->LoadBool(Beta_IsValidExe)) { if (CallCount == 0) { @@ -565,7 +605,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); CN64System * System = _this->m_System; -// if (bCPURunning && Settings->Load(CPU_Paused)) { +// if (bCPURunning() && Settings->Load(CPU_Paused)) { // CPlugins * Plugins = System->Plugins(); // if (Plugins->Gfx()->DrawScreen) { // Plugins->Gfx()->DrawScreen(); @@ -578,7 +618,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam { CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); - if (bCPURunning) { + if (bCPURunning()) { CN64System * System = _this->m_System; CPlugins * Plugins = System->Plugins(); if (Plugins && Plugins->Control()->WM_KeyUp) { @@ -591,7 +631,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam { CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); - if (bCPURunning) { + if (bCPURunning()) { CN64System * System = _this->m_System; CPlugins * Plugins = System->Plugins(); if (Plugins && Plugins->Control()->WM_KeyDown) { @@ -609,8 +649,8 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam break; } - if (!bCPURunning) { break; } - if (!bAutoSleep) { break; } + if (!bCPURunning()) { break; } + if (!bAutoSleep()) { break; } CN64System * System = _this->m_System; if (System) { @@ -626,8 +666,8 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam break; } - if (!bCPURunning) { break; } - if (!bAutoSleep) { break; } + if (!bCPURunning()) { break; } + if (!bAutoSleep()) { break; } CN64System * System = _this->m_System; if (System) { @@ -643,9 +683,19 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam if (fActive && _this->RomBrowserVisible()) { PostMessage((HWND)hWnd,WM_BORWSER_TOP,0,0); } - if (!bCPURunning) { break; } - if (!bAutoSleep) { break; } + if (!bCPURunning()) { break; } + CN64System * System = _this->m_System; + if (!fActive && _Settings->LoadBool(UserInterface_InFullScreen)) + { + _this->m_Notify->WindowMode(); + if (bAutoSleep() && System) + { + //System->ExternalEvent(PauseCPU_AppLostActiveDelayed ); + } + break; + } + if (!bAutoSleep()) { break; } if (System) { System->ExternalEvent(fActive ? ResumeCPU_AppGainedActive : PauseCPU_AppLostActive ); @@ -716,7 +766,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam if (CurrentRom) { CurrentRom->SaveRomSettingID(); } else { - _Settings->SaveString(ROM_NAME,""); + Rom.ClearRomSettingID(); } } break; @@ -756,7 +806,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam if (CurrentRom) { CurrentRom->SaveRomSettingID(); } else { - _Settings->SaveString(ROM_NAME,""); + _Settings->SaveString(Game_IniKey,""); } } } else if (_this->m_Menu->ProcessMessage(hWnd,HIWORD(wParam), LOWORD(wParam))) { @@ -769,12 +819,20 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam case WM_DESTROY: WriteTrace(TraceDebug,"WM_DESTROY - start"); { - CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); + CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class"); + if (_this->m_Notify) + { + _this->m_Notify->WindowMode(); + } + CN64System * System = _this->m_System; _this->m_hMainWindow = NULL; WriteTrace(TraceDebug,"WM_DESTROY - 1"); - _this->SaveRomListColoumnInfo(); - WriteTrace(TraceDebug,"WM_DESTROY - 2"); - _this->SaveWindowLoc(); + if (System) + { + _this->SaveRomListColoumnInfo(); + WriteTrace(TraceDebug,"WM_DESTROY - 2"); + _this->SaveWindowLoc(); + } } WriteTrace(TraceDebug,"WM_DESTROY - 3"); RemoveProp((HWND)hWnd,"Class"); diff --git a/Source/Project64/User Interface/Gui Class.h b/Source/Project64/User Interface/Gui Class.h index 334e7b426..648300b19 100644 --- a/Source/Project64/User Interface/Gui Class.h +++ b/Source/Project64/User Interface/Gui Class.h @@ -50,6 +50,10 @@ class CMainGui : friend DWORD CALLBACK AboutIniBoxProc ( WND_HANDLE, DWORD, DWORD, DWORD ); static DWORD CALLBACK MainGui_Proc ( WND_HANDLE, DWORD, DWORD, DWORD ); + friend void RomBowserEnabledChanged (CMainGui * Gui); + friend void RomBowserColoumnsChanged (CMainGui * Gui); + friend void RomBrowserRecursiveChanged (CMainGui * Gui); + public: CMainGui ( const char * WindowTitle = "", CNotification * Notify = 0, CN64System * System = 0 ); ~CMainGui ( void ); diff --git a/Source/Project64/User Interface/Icons/vssver2.scc b/Source/Project64/User Interface/Icons/vssver2.scc deleted file mode 100644 index 65af6577c..000000000 Binary files a/Source/Project64/User Interface/Icons/vssver2.scc and /dev/null differ diff --git a/Source/Project64/User Interface/Main Menu Class.cpp b/Source/Project64/User Interface/Main Menu Class.cpp index c2fb57d71..5d5989fd0 100644 --- a/Source/Project64/User Interface/Main Menu Class.cpp +++ b/Source/Project64/User Interface/Main Menu Class.cpp @@ -1,6 +1,7 @@ #include "..\\User Interface.h" #include "..\\N64 System.h" #include "..\\Plugin.h" +#include "..\\User Interface\\Settings Config.h" #include #include "..\\3rd Party\\HTML Help\\HTMLHELP.H" #include @@ -14,10 +15,44 @@ CMainMenu::CMainMenu ( CMainGui * hMainWindow, CN64System * N64System ): ResetMenu(); hMainWindow->SetWindowMenu(this); + + m_ChangeSettingList.push_back(Info_ShortCutsChanged); + m_ChangeSettingList.push_back(GameRunning_LimitFPS); + m_ChangeSettingList.push_back(UserInterface_InFullScreen); + m_ChangeSettingList.push_back(UserInterface_AlwaysOnTop); + m_ChangeSettingList.push_back(UserInterface_ShowCPUPer); + m_ChangeSettingList.push_back(Debugger_ProfileCode); + m_ChangeSettingList.push_back(Debugger_ShowUnhandledMemory); + m_ChangeSettingList.push_back(Debugger_ShowPifErrors); + m_ChangeSettingList.push_back(Debugger_ShowDListAListCount); + m_ChangeSettingList.push_back(Debugger_ShowRecompMemSize); + m_ChangeSettingList.push_back(Debugger_ShowCheckOpUsageErrors); + m_ChangeSettingList.push_back(Debugger_GenerateLogFiles); + m_ChangeSettingList.push_back(Debugger_DisableGameFixes); + m_ChangeSettingList.push_back(Debugger_AppLogLevel); + m_ChangeSettingList.push_back(Debugger_AppLogFlush); + m_ChangeSettingList.push_back(Debugger_GenerateDebugLog); + m_ChangeSettingList.push_back(Game_CurrentSaveState); + m_ChangeSettingList.push_back(Setting_CurrentLanguage); + + for (SettingList::const_iterator iter = m_ChangeSettingList.begin(); iter != m_ChangeSettingList.end(); iter++) + { + _Settings->RegisterChangeCB(*iter,this,(CSettings::SettingChangedFunc)SettingsChanged); + } } CMainMenu::~CMainMenu() { + for (SettingList::const_iterator iter = m_ChangeSettingList.begin(); iter != m_ChangeSettingList.end(); iter++) + { + _Settings->UnregisterChangeCB(*iter,this,(CSettings::SettingChangedFunc)SettingsChanged); + } +} + + +void CMainMenu::SettingsChanged (CMainMenu * _this ) +{ + _this->ResetMenu(); } int CMainMenu::ProcessAccelerator ( WND_HANDLE hWnd, void * lpMsg ) { @@ -74,7 +109,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men case ID_SYSTEM_PAUSE: _Gui->SaveWindowLoc(); WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE"); - if (_Settings->LoadDword(CPU_Paused)) + if (_Settings->LoadBool(GameRunning_CPU_Paused)) { _System->ExternalEvent(ResumeCPU_FromMenu); } else { @@ -84,7 +119,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men break; case ID_SYSTEM_BITMAP: { - stdstr Dir(_Settings->LoadString(SnapShotDir)); + stdstr Dir(_Settings->LoadString(Directory_SnapShot)); WriteTraceF(TraceGfxPlugin,"CaptureScreen(%s): Starting",Dir.c_str()); _System->Plugins()->Gfx()->CaptureScreen(Dir.c_str()); WriteTrace(TraceGfxPlugin,"CaptureScreen: Done"); @@ -92,9 +127,8 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men break; case ID_SYSTEM_LIMITFPS: WriteTrace(TraceDebug,"ID_SYSTEM_LIMITFPS"); - _Settings->SaveDword(LimitFPS,!_Settings->LoadDword(LimitFPS)); + _Settings->SaveBool(GameRunning_LimitFPS,!_Settings->LoadBool(GameRunning_LimitFPS)); WriteTrace(TraceDebug,"ID_SYSTEM_LIMITFPS 1"); - ResetMenu(); break; case ID_SYSTEM_SAVE: WriteTrace(TraceDebug,"ID_SYSTEM_SAVE"); _System->ExternalEvent(SaveMachineState); break; case ID_SYSTEM_SAVEAS: @@ -106,7 +140,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men memset(&SaveFile, 0, sizeof(SaveFile)); memset(&openfilename, 0, sizeof(openfilename)); - _Settings->LoadString(LastSaveDir, Directory,sizeof(Directory)); + _Settings->LoadString(Directory_LastSave, Directory,sizeof(Directory)); openfilename.lStructSize = sizeof( openfilename ); openfilename.hwndOwner = (HWND)hWnd; @@ -130,11 +164,11 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men _makepath( SaveFile, drive, dir, fname, NULL ); } } - _Settings->SaveString(InstantSaveFile,SaveFile); + _Settings->SaveString(GameRunning_InstantSaveFile,SaveFile); char SaveDir[MAX_PATH]; _makepath( SaveDir, drive, dir, NULL, NULL ); - _Settings->SaveString(LastSaveDir,SaveDir); + _Settings->SaveString(Directory_LastSave,SaveDir); _System->ExternalEvent(SaveMachineState); } @@ -151,7 +185,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men memset(&SaveFile, 0, sizeof(SaveFile)); memset(&openfilename, 0, sizeof(openfilename)); - _Settings->LoadString(LastSaveDir, Directory,sizeof(Directory)); + _Settings->LoadString(Directory_LastSave, Directory,sizeof(Directory)); openfilename.lStructSize = sizeof( openfilename ); openfilename.hwndOwner = (HWND)hWnd; @@ -164,12 +198,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men _System->ExternalEvent(PauseCPU_LoadGame); if (GetOpenFileName (&openfilename)) { - _Settings->SaveString(InstantSaveFile,SaveFile); + _Settings->SaveString(GameRunning_InstantSaveFile,SaveFile); char SaveDir[MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT]; _splitpath( SaveFile, drive, dir, fname, ext ); _makepath( SaveDir, drive, dir, NULL, NULL ); - _Settings->SaveString(LastSaveDir,SaveDir); + _Settings->SaveString(Directory_LastSave,SaveDir); _System->ExternalEvent(LoadMachineState); } @@ -185,19 +219,19 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men _System->ExternalEvent(GSButtonPressed); break; case ID_OPTIONS_DISPLAY_FR: - _Settings->SaveDword(DisplayFrameRate,!_Settings->LoadDword(DisplayFrameRate)); + _Settings->SaveBool(UserInterface_DisplayFrameRate,!_Settings->LoadBool(UserInterface_DisplayFrameRate)); break; case ID_OPTIONS_CHANGE_FR: - switch (_Settings->LoadDword(FrameDisplayType)) + switch (_Settings->LoadDword(UserInterface_FrameDisplayType)) { case FR_VIs: - _Settings->SaveDword(FrameDisplayType,FR_DLs); + _Settings->SaveDword(UserInterface_FrameDisplayType,FR_DLs); break; case FR_DLs: - _Settings->SaveDword(FrameDisplayType,FR_PERCENT); + _Settings->SaveDword(UserInterface_FrameDisplayType,FR_PERCENT); break; default: - _Settings->SaveDword(FrameDisplayType,FR_VIs); + _Settings->SaveDword(UserInterface_FrameDisplayType,FR_VIs); } break; case ID_OPTIONS_INCREASE_SPEED: @@ -210,7 +244,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men _System->ExternalEvent(ChangingFullScreen); break; case ID_OPTIONS_FULLSCREEN2: - if (_Settings->LoadDword(InFullScreen)) + if (_Settings->LoadBool(UserInterface_InFullScreen)) { WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN a"); _Gui->MakeWindowOnTop(false); @@ -220,17 +254,14 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men WriteTrace(TraceGfxPlugin,"ChangeWindow: Done"); ShowCursor(true); _Gui->ShowStatusBar(true); - _Gui->MakeWindowOnTop(_Settings->LoadDword(AlwaysOnTop) != 0); - _Settings->SaveDword(InFullScreen,(DWORD)false); - ResetMenu(); + _Gui->MakeWindowOnTop(_Settings->LoadBool(UserInterface_AlwaysOnTop)); + _Settings->SaveBool(UserInterface_InFullScreen,(DWORD)false); } else { WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b"); ShowCursor(false); WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 1"); _Gui->ShowStatusBar(false); WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 2"); - _Settings->SaveDword(InFullScreen,true); - WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 3"); try { WriteTrace(TraceGfxPlugin,"ChangeWindow: Starting"); _System->Plugins()->Gfx()->ChangeWindow(); @@ -247,20 +278,20 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men _Gui->MakeWindowOnTop(false); WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 5"); Notify().SetGfxPlugin(_System->Plugins()->Gfx()); + WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 3"); + _Settings->SaveBool(UserInterface_InFullScreen,true); WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN b 6"); - ResetMenu(); } WriteTrace(TraceDebug,"ID_OPTIONS_FULLSCREEN 1"); break; case ID_OPTIONS_ALWAYSONTOP: - if (_Settings->LoadDword(AlwaysOnTop)) { - _Settings->SaveDword(AlwaysOnTop,(DWORD)false); + if (_Settings->LoadDword(UserInterface_AlwaysOnTop)) { + _Settings->SaveBool(UserInterface_AlwaysOnTop,false); _Gui->MakeWindowOnTop(false); } else { - _Settings->SaveDword(AlwaysOnTop,true); - _Gui->MakeWindowOnTop(_Settings->LoadDword(CPU_Running) != 0); + _Settings->SaveBool(UserInterface_AlwaysOnTop,true); + _Gui->MakeWindowOnTop(_Settings->LoadBool(GameRunning_CPU_Running)); } - ResetMenu(); break; case ID_OPTIONS_CONFIG_RSP: WriteTrace(TraceDebug,"ID_OPTIONS_CONFIG_RSP"); _System->Plugins()->ConfigPlugin((DWORD)hWnd,PLUGIN_TYPE_RSP); break; case ID_OPTIONS_CONFIG_GFX: WriteTrace(TraceDebug,"ID_OPTIONS_CONFIG_GFX"); _System->Plugins()->ConfigPlugin((DWORD)hWnd,PLUGIN_TYPE_GFX); break; @@ -268,70 +299,65 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men case ID_OPTIONS_CONFIG_CONT: WriteTrace(TraceDebug,"ID_OPTIONS_CONFIG_CONT"); _System->Plugins()->ConfigPlugin((DWORD)hWnd,PLUGIN_TYPE_CONTROLLER); break; case ID_OPTIONS_CPU_USAGE: WriteTrace(TraceDebug,"ID_OPTIONS_CPU_USAGE"); - if (_Settings->LoadDword(ShowCPUPer)) { - _Settings->SaveDword(ShowCPUPer,(DWORD)false); + if (_Settings->LoadBool(UserInterface_ShowCPUPer)) + { + _Settings->SaveBool(UserInterface_ShowCPUPer,false); _Gui->GetNotifyClass()->DisplayMessage(0,""); } else { - _Settings->SaveDword(ShowCPUPer,true); + _Settings->SaveBool(UserInterface_ShowCPUPer,true); } _System->ExternalEvent(CPUUsageTimerChanged); - ResetMenu(); break; - //case ID_OPTIONS_SETTINGS: _Settings->Config((void *)hWnd,_System,_Gui); break; + case ID_OPTIONS_SETTINGS: + { + CSettingConfig SettingConfig; + SettingConfig.Display(hWnd); + } + break; case ID_PROFILE_PROFILE: - _Settings->SaveDword(ProfileCode,!_Settings->LoadDword(ProfileCode)); + _Settings->SaveBool(Debugger_ProfileCode,!_Settings->LoadBool(Debugger_ProfileCode)); _System->ExternalEvent(Profile_StartStop); - ResetMenu(); break; case ID_PROFILE_RESETCOUNTER: _System->ExternalEvent(Profile_ResetLogs); break; case ID_PROFILE_GENERATELOG: _System->ExternalEvent(Profile_GenerateLogs); break; case ID_DEBUG_SHOW_UNHANDLED_MEM: - _Settings->SaveDword(ShowUnhandledMemory,!_Settings->LoadDword(ShowUnhandledMemory)); - ResetMenu(); + _Settings->SaveBool(Debugger_ShowUnhandledMemory,!_Settings->LoadBool(Debugger_ShowUnhandledMemory)); break; case ID_DEBUG_SHOW_PIF_ERRORS: - _Settings->SaveDword(ShowPifErrors,!_Settings->LoadDword(ShowPifErrors)); - ResetMenu(); + _Settings->SaveBool(Debugger_ShowPifErrors,!_Settings->LoadBool(Debugger_ShowPifErrors)); break; case ID_DEBUG_SHOW_DLIST_COUNT: _Gui->GetNotifyClass()->DisplayMessage(0,""); - _Settings->SaveDword(ShowDListAListCount,!_Settings->LoadDword(ShowDListAListCount)); - ResetMenu(); + _Settings->SaveBool(Debugger_ShowDListAListCount,!_Settings->LoadBool(Debugger_ShowDListAListCount)); break; case ID_DEBUG_SHOW_RECOMP_MEM_SIZE: _Gui->GetNotifyClass()->DisplayMessage(0,""); - _Settings->SaveDword(ShowRecompMemSize,!_Settings->LoadDword(ShowRecompMemSize)); - ResetMenu(); + _Settings->SaveBool(Debugger_ShowRecompMemSize,!_Settings->LoadBool(Debugger_ShowRecompMemSize)); break; case ID_DEBUG_SHOW_CHECK_OPUSAGE: - _Settings->SaveDword(ShowCheckOpUsageErrors,!_Settings->LoadDword(ShowCheckOpUsageErrors)); - ResetMenu(); + _Settings->SaveBool(Debugger_ShowCheckOpUsageErrors,!_Settings->LoadBool(Debugger_ShowCheckOpUsageErrors)); break; case ID_DEBUG_GENERATE_LOG_FILES: - _Settings->SaveDword(GenerateLogFiles,!_Settings->LoadDword(GenerateLogFiles)); - ResetMenu(); + _Settings->SaveBool(Debugger_GenerateLogFiles,!_Settings->LoadBool(Debugger_GenerateLogFiles)); break; case ID_DEBUG_DISABLE_GAMEFIX: - _Settings->SaveDword(DisableGameFixes,!_Settings->LoadDword(DisableGameFixes)); - ResetMenu(); + _Settings->SaveBool(Debugger_DisableGameFixes,!_Settings->LoadBool(Debugger_DisableGameFixes)); break; case ID_DEBUGGER_APPLOG_ERRORS: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceError) != 0) { LogLevel &= ~TraceError; } else { - LogLevel |= TraceError; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_SETTINGS: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceSettings) != 0) { LogLevel &= ~TraceSettings; @@ -339,13 +365,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceSettings; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_RECOMPILER: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceRecompiler) != 0) { LogLevel &= ~TraceRecompiler; @@ -353,13 +378,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceRecompiler; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_RSP: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceRSP) != 0) { LogLevel &= ~TraceRSP; @@ -367,13 +391,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceRSP; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_TLB: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceTLB) != 0) { LogLevel &= ~TraceTLB; @@ -381,13 +404,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceTLB; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_GFX_PLUGIN: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceGfxPlugin) != 0) { LogLevel &= ~TraceGfxPlugin; @@ -395,13 +417,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceGfxPlugin; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_DEBUG: { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); if ((LogLevel & TraceDebug) != 0) { LogLevel &= ~TraceDebug; @@ -409,18 +430,15 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men LogLevel |= TraceDebug; } - _Settings->SaveDword(AppLogLevel, LogLevel ); + _Settings->SaveDword(Debugger_AppLogLevel, LogLevel ); } - ResetMenu(); break; case ID_DEBUGGER_APPLOG_FLUSH: - _Settings->SaveDword(AppLogFlush,!_Settings->LoadDword(AppLogFlush)); - ResetMenu(); + _Settings->SaveBool(Debugger_AppLogFlush,!_Settings->LoadBool(Debugger_AppLogFlush)); break; case ID_DEBUGGER_LOGOPTIONS: _Gui->EnterLogOptions(); break; case ID_DEBUGGER_GENERATELOG: - _Settings->SaveDword(GenerateDebugLog,!_Settings->LoadDword(GenerateDebugLog)); - ResetMenu(); + _Settings->SaveBool(Debugger_GenerateDebugLog,!_Settings->LoadBool(Debugger_GenerateDebugLog)); break; case ID_DEBUGGER_DUMPMEMORY: _System->Debug_ShowMemoryDump(); @@ -436,8 +454,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men case ID_DEBUGGER_INTERRUPT_DP: _System->ExternalEvent(Interrupt_DP); break; case ID_CURRENT_SAVE_DEFAULT: Notify().DisplayMessage(3,"Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str()); - _Settings->SaveDword(CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT)); - ResetMenu(); + _Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT)); break; case ID_CURRENT_SAVE_1: case ID_CURRENT_SAVE_2: @@ -450,8 +467,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men case ID_CURRENT_SAVE_9: case ID_CURRENT_SAVE_10: Notify().DisplayMessage(3,"Save Slot (%s) selected",GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str()); - _Settings->SaveDword(CurrentSaveState,(DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1)); - ResetMenu(); + _Settings->SaveDword(Game_CurrentSaveState,(DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1)); break; case ID_HELP_CONTENTS: { @@ -498,11 +514,9 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men } if (MenuID >= ID_RECENT_DIR_START && MenuID < ID_RECENT_DIR_END) { int Offset = MenuID - ID_RECENT_DIR_START; - stdstr Dir = _Settings->LoadStringIndex(RecentRomDirIndex,Offset); + stdstr Dir = _Settings->LoadStringIndex(Directory_RecentGameDirIndex,Offset); if (Dir.length() > 0) { - _Settings->SaveDword(UseRomDirSelected,true); - _Settings->SaveString(SelectedRomDir,Dir.c_str()); - _Settings->SaveString(RomDirectory,Dir.c_str()); + _Settings->SaveString(Directory_Game,Dir.c_str()); _Gui->GetNotifyClass()->AddRecentDir(Dir.c_str()); _Gui->RefreshMenu(); if (_Gui->RomBrowserVisible()) { @@ -524,7 +538,6 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men //See if the language has changed, if not do nothing //Set the language _Lang->SetLanguage(String); - ResetMenu(); _Gui->ResetRomBrowserColomuns(); break; } @@ -533,14 +546,15 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men return true; } -stdstr CMainMenu::ShortCutString(MSC_MAP & ShortCuts, int MenuID, MENU_SHORT_CUT_KEY::ACCESS_MODE AccessLevel) { +/*stdstr CMainMenu::ShortCutString(MSC_MAP & ShortCuts, int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel) { + Notify().BreakPoint(__FILE__,__LINE__); MSC_MAP::iterator MenuItem = ShortCuts.find(MenuID); if (MenuItem == ShortCuts.end()) { return ""; } const SHORTCUT_KEY_LIST & ShortCutList = MenuItem->second.GetAccelItems(); for (SHORTCUT_KEY_LIST::const_iterator item = ShortCutList.begin(); item != ShortCutList.end(); item++) { - MENU_SHORT_CUT_KEY::ACCESS_MODE ItemMode = item->AccessMode(); + CMenuShortCutKey::ACCESS_MODE ItemMode = item->AccessMode(); if ((ItemMode & AccessLevel) != AccessLevel ) { continue; @@ -548,7 +562,7 @@ stdstr CMainMenu::ShortCutString(MSC_MAP & ShortCuts, int MenuID, MENU_SHORT_CU return item->Name(); } return ""; -} +}*/ stdstr CMainMenu::GetFileLastMod (stdstr FileName) { @@ -594,13 +608,13 @@ stdstr CMainMenu::GetSaveSlotString (int Slot) case 10: SlotName = GS(MENU_SLOT_10); break; } - if (!_Settings->LoadBool(CPU_Running)) { return SlotName; } + if (!_Settings->LoadBool(GameRunning_CPU_Running)) { return SlotName; } stdstr LastSaveTime; //check first save name - stdstr & _GoodName = _Settings->LoadString(ROM_GoodName); - stdstr & _InstantSaveDirectory = _Settings->LoadString(InstantSaveDirectory); + stdstr & _GoodName = _Settings->LoadString(Game_GoodName); + stdstr & _InstantSaveDirectory = _Settings->LoadString(Directory_InstantSave); stdstr CurrentSaveName; if (Slot != 0) { CurrentSaveName.Format("%s.pj%d",_GoodName.c_str(), Slot); @@ -609,7 +623,7 @@ stdstr CMainMenu::GetSaveSlotString (int Slot) } stdstr_f FileName("%s%s",_InstantSaveDirectory.c_str(),CurrentSaveName.c_str()); - if (_Settings->LoadDword(AutoZip)) + if (_Settings->LoadDword(Setting_AutoZipInstantSave)) { stdstr_f ZipFileName("%s.zip",FileName.c_str()); LastSaveTime = GetFileLastMod(ZipFileName); @@ -623,14 +637,14 @@ stdstr CMainMenu::GetSaveSlotString (int Slot) // Check old file name if (LastSaveTime.empty()) { - stdstr & _RomName = _Settings->LoadString(ROM_NAME); + stdstr & _RomName = _Settings->LoadString(Game_GameName); if (Slot > 0) { FileName.Format("%s%s.pj%d", _InstantSaveDirectory.c_str(), _RomName.c_str(),Slot); } else { FileName.Format("%s%s.pj",_InstantSaveDirectory.c_str(),_RomName.c_str()); } - if (_Settings->LoadDword(AutoZip)) + if (_Settings->LoadBool(Setting_AutoZipInstantSave)) { stdstr_f ZipFileName("%s.zip",FileName.c_str()); LastSaveTime = GetFileLastMod(ZipFileName); @@ -648,21 +662,18 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { MENU_ITEM Item; //Get all flags - bool inBasicMode = _Settings->LoadBool(BasicMode); - bool CPURunning = _Settings->LoadBool(CPU_Running); - bool RomLoading = _Settings->LoadBool(LoadingRom); - bool RomLoaded = _Settings->LoadString(ROM_NAME).length() > 0; - bool RomList = _Settings->LoadBool(RomBrowser) && !CPURunning; + bool inBasicMode = _Settings->LoadBool(UserInterface_BasicMode); + bool CPURunning = _Settings->LoadBool(GameRunning_CPU_Running); + bool RomLoading = _Settings->LoadBool(GameRunning_LoadingInProgress); + bool RomLoaded = _Settings->LoadString(Game_GameName).length() > 0; + bool RomList = _Settings->LoadBool(RomBrowser_Enabled) && !CPURunning; - //Get Short Cut Info - MSC_MAP & ShortCut = GetShortCutInfo(false); - - MENU_SHORT_CUT_KEY::ACCESS_MODE AccessLevel = MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING; - if (_Settings->LoadBool(CPU_Running)) + CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING; + if (_Settings->LoadBool(GameRunning_CPU_Running)) { - AccessLevel = _Settings->LoadBool(InFullScreen) ? - MENU_SHORT_CUT_KEY::GAME_RUNNING_FULLSCREEN : - MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW; + AccessLevel = _Settings->LoadBool(UserInterface_InFullScreen) ? + CMenuShortCutKey::GAME_RUNNING_FULLSCREEN : + CMenuShortCutKey::GAME_RUNNING_WINDOW; } @@ -682,10 +693,10 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { //Go through the settings to create a list of Recent Roms MenuItemList RecentRomMenu; - DWORD count, RomsToRemember = _Settings->LoadDword(RememberedRomFilesCount); + DWORD count, RomsToRemember = _Settings->LoadDword(File_RecentGameFileCount); for (count = 0; count < RomsToRemember; count++) { - stdstr LastRom = _Settings->LoadStringIndex(RecentRomFileIndex,count); + stdstr LastRom = _Settings->LoadStringIndex(File_RecentGameFileIndex,count); if (LastRom.empty()) { break; @@ -698,11 +709,11 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { /* Recent Dir ****************/ MenuItemList RecentDirMenu; - DWORD DirsToRemember = _Settings->LoadDword(RememberedRomDirCount); + DWORD DirsToRemember = _Settings->LoadDword(Directory_RecentGameDirCount); for (count = 0; count < DirsToRemember; count++) { - stdstr LastDir = _Settings->LoadStringIndex(RecentRomDirIndex,count); + stdstr LastDir = _Settings->LoadStringIndex(Directory_RecentGameDirIndex,count); if (LastDir.empty()) { break; @@ -715,18 +726,18 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { /* File Menu ****************/ MenuItemList FileMenu; - Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, ShortCutString(ShortCut,ID_FILE_OPEN_ROM,AccessLevel)); + Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM,AccessLevel)); FileMenu.push_back(Item); if (!inBasicMode) { - Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO,ShortCutString(ShortCut,ID_FILE_ROM_INFO,AccessLevel)); + Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO,m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO,AccessLevel)); Item.ItemEnabled = RomLoaded; FileMenu.push_back(Item); FileMenu.push_back(MENU_ITEM(SPLITER )); - Item.Reset(ID_FILE_STARTEMULATION,MENU_START, ShortCutString(ShortCut,ID_FILE_STARTEMULATION,AccessLevel) ); + Item.Reset(ID_FILE_STARTEMULATION,MENU_START, m_ShortCuts.ShortCutString(ID_FILE_STARTEMULATION,AccessLevel) ); Item.ItemEnabled = RomLoaded && !CPURunning; FileMenu.push_back(Item); } - Item.Reset(ID_FILE_ENDEMULATION, MENU_END, ShortCutString(ShortCut,ID_FILE_ENDEMULATION,AccessLevel) ); + Item.Reset(ID_FILE_ENDEMULATION, MENU_END, m_ShortCuts.ShortCutString(ID_FILE_ENDEMULATION,AccessLevel) ); Item.ItemEnabled = CPURunning; FileMenu.push_back(Item); FileMenu.push_back(MENU_ITEM(SPLITER )); @@ -734,9 +745,9 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { FileMenu.push_back(Item); if (RomList) { FileMenu.push_back(MENU_ITEM(SPLITER )); - Item.Reset(ID_FILE_ROMDIRECTORY, MENU_CHOOSE_ROM,ShortCutString(ShortCut,ID_FILE_ROMDIRECTORY,AccessLevel) ); + Item.Reset(ID_FILE_ROMDIRECTORY, MENU_CHOOSE_ROM,m_ShortCuts.ShortCutString(ID_FILE_ROMDIRECTORY,AccessLevel) ); FileMenu.push_back(Item); - Item.Reset(ID_FILE_REFRESHROMLIST,MENU_REFRESH,ShortCutString(ShortCut,ID_FILE_REFRESHROMLIST,AccessLevel) ); + Item.Reset(ID_FILE_REFRESHROMLIST,MENU_REFRESH,m_ShortCuts.ShortCutString(ID_FILE_REFRESHROMLIST,AccessLevel) ); FileMenu.push_back(Item); } @@ -764,44 +775,44 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { } } FileMenu.push_back(MENU_ITEM(SPLITER )); - FileMenu.push_back(MENU_ITEM(ID_FILE_EXIT, MENU_EXIT,ShortCutString(ShortCut,ID_FILE_EXIT,AccessLevel) )); + FileMenu.push_back(MENU_ITEM(ID_FILE_EXIT, MENU_EXIT,m_ShortCuts.ShortCutString(ID_FILE_EXIT,AccessLevel) )); /* Current Save ****************/ MenuItemList CurrentSaveMenu; - DWORD _CurrentSaveState = _Settings->LoadDword(CurrentSaveState); - Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_DEFAULT,AccessLevel),NULL,GetSaveSlotString(0)); + DWORD _CurrentSaveState = _Settings->LoadDword(Game_CurrentSaveState); + Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT,AccessLevel),NULL,GetSaveSlotString(0)); if (_CurrentSaveState == 0) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); CurrentSaveMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_1,AccessLevel),NULL,GetSaveSlotString(1)); + Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1,AccessLevel),NULL,GetSaveSlotString(1)); if (_CurrentSaveState == 1) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_2,AccessLevel),NULL,GetSaveSlotString(2)); + Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2,AccessLevel),NULL,GetSaveSlotString(2)); if (_CurrentSaveState == 2) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_3,AccessLevel),NULL,GetSaveSlotString(3)); + Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3,AccessLevel),NULL,GetSaveSlotString(3)); if (_CurrentSaveState == 3) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_4,AccessLevel),NULL,GetSaveSlotString(4)); + Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4,AccessLevel),NULL,GetSaveSlotString(4)); if (_CurrentSaveState == 4) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_5,AccessLevel),NULL,GetSaveSlotString(5)); + Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5,AccessLevel),NULL,GetSaveSlotString(5)); if (_CurrentSaveState == 5) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_6,AccessLevel),NULL,GetSaveSlotString(6)); + Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6,AccessLevel),NULL,GetSaveSlotString(6)); if (_CurrentSaveState == 6) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_7,AccessLevel),NULL,GetSaveSlotString(7)); + Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7,AccessLevel),NULL,GetSaveSlotString(7)); if (_CurrentSaveState == 7) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_8,AccessLevel),NULL,GetSaveSlotString(8)); + Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8,AccessLevel),NULL,GetSaveSlotString(8)); if (_CurrentSaveState == 8) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_9,AccessLevel),NULL,GetSaveSlotString(9)); + Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9,AccessLevel),NULL,GetSaveSlotString(9)); if (_CurrentSaveState == 9) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); - Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING,ShortCutString(ShortCut,ID_CURRENT_SAVE_10,AccessLevel),NULL,GetSaveSlotString(10)); + Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING,m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10,AccessLevel),NULL,GetSaveSlotString(10)); if (_CurrentSaveState == 10) { Item.ItemTicked = true; } CurrentSaveMenu.push_back(Item); @@ -811,74 +822,74 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { MenuItemList ResetMenu; if (inBasicMode) { - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET, ShortCutString(ShortCut,ID_SYSTEM_RESET_SOFT,AccessLevel) )); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT,AccessLevel) )); } else { - ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET_SOFT, ShortCutString(ShortCut,ID_SYSTEM_RESET_SOFT,AccessLevel) )); - ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_HARD, MENU_RESET_HARD, ShortCutString(ShortCut,ID_SYSTEM_RESET_HARD,AccessLevel))); + ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET_SOFT, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT,AccessLevel) )); + ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_HARD, MENU_RESET_HARD, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_HARD,AccessLevel))); SystemMenu.push_back(MENU_ITEM(SUB_MENU,MENU_RESET,EMPTY_STDSTR,&ResetMenu)); } - if (_Settings->LoadBool(CPU_Paused)) { - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_RESUME, ShortCutString(ShortCut,ID_SYSTEM_PAUSE,AccessLevel))); + if (_Settings->LoadBool(GameRunning_CPU_Paused)) { + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_RESUME, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE,AccessLevel))); } else { - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_PAUSE, ShortCutString(ShortCut,ID_SYSTEM_PAUSE,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_PAUSE, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE,AccessLevel))); } - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_BITMAP, MENU_BITMAP, ShortCutString(ShortCut,ID_SYSTEM_BITMAP,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_BITMAP, MENU_BITMAP, m_ShortCuts.ShortCutString(ID_SYSTEM_BITMAP,AccessLevel))); SystemMenu.push_back(MENU_ITEM(SPLITER )); if (!inBasicMode) { - Item.Reset(ID_SYSTEM_LIMITFPS, MENU_LIMIT_FPS,ShortCutString(ShortCut,ID_SYSTEM_LIMITFPS,AccessLevel) ); - if (_Settings->LoadDword(LimitFPS)) { Item.ItemTicked = true; } + Item.Reset(ID_SYSTEM_LIMITFPS, MENU_LIMIT_FPS,m_ShortCuts.ShortCutString(ID_SYSTEM_LIMITFPS,AccessLevel) ); + if (_Settings->LoadBool(GameRunning_LimitFPS)) { Item.ItemTicked = true; } SystemMenu.push_back(Item); SystemMenu.push_back(MENU_ITEM(SPLITER )); } - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, ShortCutString(ShortCut,ID_SYSTEM_SAVE,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVE,AccessLevel))); if (!inBasicMode) { - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVEAS, MENU_SAVE_AS, ShortCutString(ShortCut,ID_SYSTEM_SAVEAS,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVEAS, MENU_SAVE_AS, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVEAS,AccessLevel))); } - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESTORE, MENU_RESTORE, ShortCutString(ShortCut,ID_SYSTEM_RESTORE,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESTORE, MENU_RESTORE, m_ShortCuts.ShortCutString(ID_SYSTEM_RESTORE,AccessLevel))); if (!inBasicMode) { - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_LOAD, MENU_LOAD, ShortCutString(ShortCut,ID_SYSTEM_LOAD,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_LOAD, MENU_LOAD, m_ShortCuts.ShortCutString(ID_SYSTEM_LOAD,AccessLevel))); } SystemMenu.push_back(MENU_ITEM(SPLITER )); SystemMenu.push_back(MENU_ITEM(SUB_MENU, MENU_CURRENT_SAVE, EMPTY_STDSTR, &CurrentSaveMenu )); SystemMenu.push_back(MENU_ITEM(SPLITER )); - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, ShortCutString(ShortCut,ID_SYSTEM_CHEAT,AccessLevel))); - SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, ShortCutString(ShortCut,ID_SYSTEM_GSBUTTON,AccessLevel) )); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT,AccessLevel))); + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON,AccessLevel) )); /* Option Menu ****************/ MenuItemList OptionMenu; - Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN,ShortCutString(ShortCut,ID_OPTIONS_FULLSCREEN,AccessLevel) ); + Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN,m_ShortCuts.ShortCutString(ID_OPTIONS_FULLSCREEN,AccessLevel) ); Item.ItemEnabled = CPURunning; if (_System->Plugins()->Gfx() && _System->Plugins()->Gfx()->ChangeWindow == NULL) { Item.ItemEnabled = false; } OptionMenu.push_back(Item); if (!inBasicMode) { - Item.Reset(ID_OPTIONS_ALWAYSONTOP, MENU_ON_TOP,ShortCutString(ShortCut,ID_OPTIONS_ALWAYSONTOP,AccessLevel) ); - if (_Settings->LoadDword(AlwaysOnTop)) { Item.ItemTicked = true; } + Item.Reset(ID_OPTIONS_ALWAYSONTOP, MENU_ON_TOP,m_ShortCuts.ShortCutString(ID_OPTIONS_ALWAYSONTOP,AccessLevel) ); + if (_Settings->LoadDword(UserInterface_AlwaysOnTop)) { Item.ItemTicked = true; } Item.ItemEnabled = CPURunning; OptionMenu.push_back(Item); } OptionMenu.push_back(MENU_ITEM(SPLITER )); - Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX,ShortCutString(ShortCut,ID_OPTIONS_CONFIG_GFX,AccessLevel)); + Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_GFX,AccessLevel)); if (_System->Plugins()->Gfx() == NULL || _System->Plugins()->Gfx()->Config == NULL) { Item.ItemEnabled = false; } OptionMenu.push_back(Item); - Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO,ShortCutString(ShortCut,ID_OPTIONS_CONFIG_AUDIO,AccessLevel)); + Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_AUDIO,AccessLevel)); if (_System->Plugins()->Audio() == NULL || _System->Plugins()->Audio()->Config == NULL) { Item.ItemEnabled = false; } OptionMenu.push_back(Item); if (!inBasicMode) { - Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP,ShortCutString(ShortCut,ID_OPTIONS_CONFIG_RSP,AccessLevel)); + Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_RSP,AccessLevel)); if (_System->Plugins()->RSP() == NULL || _System->Plugins()->RSP()->Config == NULL) { Item.ItemEnabled = false; } OptionMenu.push_back(Item); } - Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL,ShortCutString(ShortCut,ID_OPTIONS_CONFIG_CONT,AccessLevel)); + Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL,m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_CONT,AccessLevel)); if (_System->Plugins()->Control() == NULL || _System->Plugins()->Control()->Config == NULL) { Item.ItemEnabled = false; } @@ -886,19 +897,19 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { OptionMenu.push_back(MENU_ITEM(SPLITER )); if (!inBasicMode) { - Item.Reset(ID_OPTIONS_CPU_USAGE, MENU_SHOW_CPU,ShortCutString(ShortCut,ID_OPTIONS_CPU_USAGE,AccessLevel) ); - if (_Settings->LoadDword(ShowCPUPer)) { Item.ItemTicked = true; } + Item.Reset(ID_OPTIONS_CPU_USAGE, MENU_SHOW_CPU,m_ShortCuts.ShortCutString(ID_OPTIONS_CPU_USAGE,AccessLevel) ); + if (_Settings->LoadDword(UserInterface_ShowCPUPer)) { Item.ItemTicked = true; } OptionMenu.push_back(Item); } - OptionMenu.push_back(MENU_ITEM(ID_OPTIONS_SETTINGS, MENU_SETTINGS,ShortCutString(ShortCut,ID_OPTIONS_SETTINGS,AccessLevel) )); + OptionMenu.push_back(MENU_ITEM(ID_OPTIONS_SETTINGS, MENU_SETTINGS,m_ShortCuts.ShortCutString(ID_OPTIONS_SETTINGS,AccessLevel) )); /* Profile Menu ****************/ MenuItemList DebugProfileMenu; - if (_Settings->LoadDword(Debugger)) + if (_Settings->LoadDword(Debugger_Enabled)) { Item.Reset(ID_PROFILE_PROFILE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Profile Code" ); - if (_Settings->LoadDword(ProfileCode)) { Item.ItemTicked = true; } + if (_Settings->LoadBool(Debugger_ProfileCode)) { Item.ItemTicked = true; } DebugProfileMenu.push_back(Item); Item.Reset(ID_PROFILE_RESETCOUNTER,EMPTY_STRING,EMPTY_STDSTR,NULL,"Reset Counters" ); if (!CPURunning) { Item.ItemEnabled = false; } @@ -916,7 +927,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { MenuItemList DebugR4300Menu; MenuItemList DebugMemoryMenu; MenuItemList DebugInterrupt; - if (_Settings->LoadDword(Debugger)) { + if (_Settings->LoadDword(Debugger_Enabled)) { /* Debug - Interrupt *******************/ Item.Reset(ID_DEBUGGER_INTERRUPT_SP,EMPTY_STRING,EMPTY_STDSTR,NULL,"SP Interrupt" ); @@ -947,7 +958,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { Item.ItemEnabled = true; DebugR4300Menu.push_back(Item); Item.Reset(ID_DEBUG_DISABLE_GAMEFIX,EMPTY_STRING,EMPTY_STDSTR,NULL,"Disable Game Fixes" ); - if (_Settings->LoadDword(DisableGameFixes)) { + if (_Settings->LoadBool(Debugger_DisableGameFixes)) { Item.ItemTicked = true; } DebugR4300Menu.push_back(Item); @@ -968,7 +979,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { /* Debug - App logging *******************/ { - DWORD LogLevel = _Settings->LoadDword(AppLogLevel); + DWORD LogLevel = _Settings->LoadDword(Debugger_AppLogLevel); Item.Reset(ID_DEBUGGER_APPLOG_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,"Error Messages" ); if ((LogLevel & TraceError) != 0) { Item.ItemTicked = true; } @@ -1001,7 +1012,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { DebugAppLoggingMenu.push_back(MENU_ITEM(SPLITER )); Item.Reset(ID_DEBUGGER_APPLOG_FLUSH,EMPTY_STRING,EMPTY_STDSTR,NULL,"Auto flush file" ); - if (_Settings->LoadDword(AppLogFlush) != 0) { Item.ItemTicked = true; } + if (_Settings->LoadBool(Debugger_AppLogFlush)) { Item.ItemTicked = true; } DebugAppLoggingMenu.push_back(Item); } @@ -1013,7 +1024,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { Item.Reset(ID_DEBUGGER_GENERATELOG,EMPTY_STRING,EMPTY_STDSTR,NULL,"Generate Log" ); - if (_Settings->LoadDword(GenerateDebugLog)) { Item.ItemTicked = true; } + if (_Settings->LoadBool(Debugger_GenerateDebugLog)) { Item.ItemTicked = true; } DebugLoggingMenu.push_back(Item); /* Debugger Main Menu @@ -1053,33 +1064,33 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Unhandled Memory Actions" ); - if (_Settings->LoadDword(ShowUnhandledMemory)) { + if (_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show PIF Errors" ); - if (_Settings->LoadDword(ShowPifErrors)) { + if (_Settings->LoadBool(Debugger_ShowPifErrors)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Alist/Dlist Counters" ); - if (_Settings->LoadDword(ShowDListAListCount)) { + if (_Settings->LoadBool(Debugger_ShowDListAListCount)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Recompile Memory Buffer size" ); - if (_Settings->LoadDword(ShowRecompMemSize)) { + if (_Settings->LoadBool(Debugger_ShowRecompMemSize)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); Item.Reset(ID_DEBUG_SHOW_CHECK_OPUSAGE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Check Opcode Usage Errors" ); - if (_Settings->LoadDword(ShowCheckOpUsageErrors)) { + if (_Settings->LoadBool(Debugger_ShowCheckOpUsageErrors)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); Item.Reset(ID_DEBUG_GENERATE_LOG_FILES,EMPTY_STRING,EMPTY_STDSTR,NULL,"Generate Log Files" ); - if (_Settings->LoadDword(GenerateLogFiles)) { + if (_Settings->LoadBool(Debugger_GenerateLogFiles)) { Item.ItemTicked = true; } DebugMenu.push_back(Item); @@ -1088,10 +1099,10 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { /* Help Menu ****************/ MenuItemList HelpMenu; - if (_Settings->LoadBool(IsBetaVersion)) + if (_Settings->LoadBool(Beta_IsBetaVersion)) { - stdstr_f User("Beta For: %s",_Settings->LoadString(BetaUserName).c_str()); - stdstr_f Email("Email: %s",_Settings->LoadString(BetaEmailAddress).c_str()); + stdstr_f User("Beta For: %s",_Settings->LoadString(Beta_UserName).c_str()); + stdstr_f Email("Email: %s",_Settings->LoadString(Beta_EmailAddress).c_str()); HelpMenu.push_back(MENU_ITEM(NO_ID, EMPTY_STRING,EMPTY_STDSTR,NULL,User )); HelpMenu.push_back(MENU_ITEM(NO_ID, EMPTY_STRING,EMPTY_STDSTR,NULL,Email )); HelpMenu.push_back(MENU_ITEM(SPLITER )); @@ -1123,7 +1134,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { if (RomLoading) { Item.ItemEnabled = false; } MainTitleMenu.push_back(Item); if (!inBasicMode) { - if (_Settings->LoadDword(Debugger)) { + if (_Settings->LoadBool(Debugger_Enabled)) { Item.Reset(SUB_MENU, MENU_DEBUGGER, EMPTY_STDSTR, &DebugMenu); if (RomLoading) { Item.ItemEnabled = false; } MainTitleMenu.push_back(Item); @@ -1138,78 +1149,37 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { void CMainMenu::RebuildAccelerators(void) { //Delete the old accel list - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 6"); - if (m_AccelTable) { - DestroyAcceleratorTable((HACCEL)m_AccelTable); - m_AccelTable = NULL; + WriteTrace(TraceDebug,"CMainMenu::RebuildAccelerators - Start"); + + HACCEL m_OldAccelTable = (HACCEL)m_AccelTable; + m_AccelTable = m_ShortCuts.GetAcceleratorTable(); + if (m_OldAccelTable) { + DestroyAcceleratorTable(m_OldAccelTable); } - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 7"); - //Generate a ACCEL list - MENU_SHORT_CUT_KEY::ACCESS_MODE AccessLevel = MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING; - if (_Settings->LoadBool(CPU_Running)) - { - AccessLevel = _Settings->LoadDword(InFullScreen) != 0 ? - MENU_SHORT_CUT_KEY::GAME_RUNNING_FULLSCREEN : - MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW; - } - MSC_MAP & ShortCuts = GetShortCutInfo(false); - - int size = 0, MaxSize = ShortCuts.size() * 5; - ACCEL * AccelList = new ACCEL[MaxSize]; - - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 8"); - for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) - { - MENU_SHORT_CUT & short_cut = Item->second; - - MENU_SHORT_CUT_KEY::ACCESS_MODE ItemMode = short_cut.AccessMode(); - if ((ItemMode & AccessLevel) != AccessLevel ) - { - continue; - } - - SHORTCUT_KEY_LIST ShortCutAccelList = short_cut.GetAccelItems(); - for (SHORTCUT_KEY_LIST::iterator AccelIter = ShortCutAccelList.begin(); AccelIter != ShortCutAccelList.end(); AccelIter++) - { - if (size >= MaxSize) { break; } - AccelList[size].cmd = Item->first; - AccelList[size].key = AccelIter->Key(); - AccelList[size].fVirt = FVIRTKEY; - if (AccelIter->Alt()) { AccelList[size].fVirt |= FALT; } - if (AccelIter->Ctrl()) { AccelList[size].fVirt |= FCONTROL; } - if (AccelIter->Shift()) { AccelList[size].fVirt |= FSHIFT; } - size += 1; - } - } - - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 9"); - m_AccelTable = CreateAcceleratorTable(AccelList,size); - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 10"); - - delete [] AccelList; + WriteTrace(TraceDebug,"CMainMenu::RebuildAccelerators - Done"); } void CMainMenu::ResetMenu(void) { - WriteTrace(TraceDebug,"CMainMenu::ResetMenu starting"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Start"); - if (!_Settings->LoadBool(InFullScreen)) + m_ShortCuts.Load(); + if (!_Settings->LoadBool(UserInterface_InFullScreen)) { //Create a new window with all the items - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 1"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Create Menu"); MENU_HANDLE hMenu = (MENU_HANDLE)CreateMenu(); FillOutMenu(hMenu); - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 2"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Create Menu Done"); //save old menu to destroy latter MENU_HANDLE OldMenuHandle = m_MenuHandle; //save handle and re-attach to a window - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 3"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Attach Menu"); m_MenuHandle = hMenu; _Gui->SetWindowMenu(this); - //Destroy the old menu - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 4"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Remove plugin menu"); if (_System->Plugins()->Gfx() != NULL && IsMenu((HMENU)_System->Plugins()->Gfx()->GetDebugMenu())) { RemoveMenu((HMENU)OldMenuHandle,(DWORD)_System->Plugins()->Gfx()->GetDebugMenu(), MF_BYCOMMAND); @@ -1218,7 +1188,9 @@ void CMainMenu::ResetMenu(void) { { RemoveMenu((HMENU)OldMenuHandle,(DWORD)_System->Plugins()->RSP()->GetDebugMenu(), MF_BYCOMMAND); } - WriteTrace(TraceDebug,"CMainMenu::ResetMenu 5"); + WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Destroy Old Menu"); + + //Destroy the old menu DestroyMenu((HMENU)OldMenuHandle); } @@ -1227,122 +1199,10 @@ void CMainMenu::ResetMenu(void) { WriteTrace(TraceDebug,"CMainMenu::ResetMenu Done"); } -MSC_MAP CMainMenu::GetShortCutInfo(bool InitialSettings ) { -#define DEF_SCUT(ID,Section, LangID,AccessMode) ShortCuts.insert(MSC_MAP::value_type(ID,MENU_SHORT_CUT(Section,LangID,AccessMode))) - MSC_MAP ShortCuts; - - ShortCuts.clear(); - DEF_SCUT(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_FILE_ROM_INFO, STR_SHORTCUT_FILEMENU, MENU_ROM_INFO, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_FILE_STARTEMULATION, STR_SHORTCUT_FILEMENU, MENU_START, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_FILE_ENDEMULATION, STR_SHORTCUT_FILEMENU, MENU_END, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_FILE_ROMDIRECTORY, STR_SHORTCUT_FILEMENU, MENU_CHOOSE_ROM, MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING ); - DEF_SCUT(ID_FILE_REFRESHROMLIST, STR_SHORTCUT_FILEMENU, MENU_REFRESH, MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING ); - DEF_SCUT(ID_FILE_EXIT, STR_SHORTCUT_FILEMENU, MENU_EXIT, MENU_SHORT_CUT_KEY::ANYTIME ); - - DEF_SCUT(ID_SYSTEM_RESET_SOFT, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_SOFT, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_RESET_HARD, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_HARD, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_PAUSE, STR_SHORTCUT_SYSTEMMENU, MENU_PAUSE, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_BITMAP, STR_SHORTCUT_SYSTEMMENU, MENU_BITMAP, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_LIMITFPS, STR_SHORTCUT_SYSTEMMENU, MENU_LIMIT_FPS, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_SAVE, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_SAVEAS, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE_AS, MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW ); - DEF_SCUT(ID_SYSTEM_RESTORE, STR_SHORTCUT_SYSTEMMENU, MENU_RESTORE, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_SYSTEM_LOAD, STR_SHORTCUT_SYSTEMMENU, MENU_LOAD, MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW ); - DEF_SCUT(ID_SYSTEM_CHEAT, STR_SHORTCUT_SYSTEMMENU, MENU_CHEAT, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_SYSTEM_GSBUTTON, STR_SHORTCUT_SYSTEMMENU, MENU_GS_BUTTON, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - - DEF_SCUT(ID_OPTIONS_DISPLAY_FR, STR_SHORTCUT_OPTIONS, OPTION_DISPLAY_FR,MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_OPTIONS_CHANGE_FR, STR_SHORTCUT_OPTIONS, OPTION_CHANGE_FR, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_OPTIONS_INCREASE_SPEED,STR_SHORTCUT_OPTIONS, STR_INSREASE_SPEED, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_OPTIONS_DECREASE_SPEED,STR_SHORTCUT_OPTIONS, STR_DECREASE_SPEED, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - - DEF_SCUT(ID_CURRENT_SAVE_DEFAULT,STR_SHORTCUT_SAVESLOT, SAVE_SLOT_DEFAULT,MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_1, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_1, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_2, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_2, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_3, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_3, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_4, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_4, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_5, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_5, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_6, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_6, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_7, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_7, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_8, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_8, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_9, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_9, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_CURRENT_SAVE_10, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_10, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - - //Option Menu - DEF_SCUT(ID_OPTIONS_FULLSCREEN, STR_SHORTCUT_OPTIONS, MENU_FULL_SCREEN, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_OPTIONS_ALWAYSONTOP, STR_SHORTCUT_OPTIONS, MENU_ON_TOP, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_OPTIONS_CONFIG_GFX, STR_SHORTCUT_OPTIONS, MENU_CONFG_GFX, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_OPTIONS_CONFIG_AUDIO,STR_SHORTCUT_OPTIONS, MENU_CONFG_AUDIO, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_OPTIONS_CONFIG_CONT, STR_SHORTCUT_OPTIONS, MENU_CONFG_CTRL, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_OPTIONS_CONFIG_RSP, STR_SHORTCUT_OPTIONS, MENU_CONFG_RSP, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - DEF_SCUT(ID_OPTIONS_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, MENU_SHORT_CUT_KEY::GAME_RUNNING ); - DEF_SCUT(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, MENU_SHORT_CUT_KEY::NOT_IN_FULLSCREEN ); - - stdstr FileName = _Settings->LoadString(ShortCutFile); - FILE *file = fopen(FileName.c_str(),"r"); - if (file == NULL || InitialSettings) { - ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_FILE_STARTEMULATION)->second.AddShortCut(VK_F11,false,false,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_FILE_ENDEMULATION)->second.AddShortCut(VK_F12,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_FILE_REFRESHROMLIST)->second.AddShortCut(VK_F5,false,false,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4,false,true,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4,false,true,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_DEFAULT)->second.AddShortCut(0xC0,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_1)->second.AddShortCut('1',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_2)->second.AddShortCut('2',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_3)->second.AddShortCut('3',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_4)->second.AddShortCut('4',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_5)->second.AddShortCut('5',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_6)->second.AddShortCut('6',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_7)->second.AddShortCut('7',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_8)->second.AddShortCut('8',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_9)->second.AddShortCut('9',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_CURRENT_SAVE_10)->second.AddShortCut('0',false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_RETURN,false,true,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_ESCAPE,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A',true,false,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A',true,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW); - ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T',true,false,false,MENU_SHORT_CUT_KEY::GAME_NOT_RUNNING); - ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T',true,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW); - ShortCuts.find(ID_SYSTEM_RESET_SOFT)->second.AddShortCut(VK_F1,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_RESET_HARD)->second.AddShortCut(VK_F1,false,false,true,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_F2,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_PAUSE,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_BITMAP)->second.AddShortCut(VK_F3,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_LIMITFPS)->second.AddShortCut(VK_F4,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_SAVE)->second.AddShortCut(VK_F5,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_RESTORE)->second.AddShortCut(VK_F7,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_SYSTEM_LOAD)->second.AddShortCut('L',true,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW); - ShortCuts.find(ID_SYSTEM_SAVEAS)->second.AddShortCut('S',true,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW); - ShortCuts.find(ID_SYSTEM_CHEAT)->second.AddShortCut('C',true,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING_WINDOW); - ShortCuts.find(ID_SYSTEM_GSBUTTON)->second.AddShortCut(VK_F9,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_OPTIONS_INCREASE_SPEED)->second.AddShortCut(VK_OEM_PLUS,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - ShortCuts.find(ID_OPTIONS_DECREASE_SPEED)->second.AddShortCut(VK_OEM_MINUS,false,false,false,MENU_SHORT_CUT_KEY::GAME_RUNNING); - - } else if (file) { - MENU_SHORT_CUT_KEY::ACCESS_MODE AccessMode; - int ID, key, bCtrl, bAlt, bShift; - - do { - char Line[300]; - if (fgets(Line,sizeof(Line),file) != NULL) { - sscanf(Line,"%d,%d,%d,%d,%d,%d", &ID,&key,&bCtrl,&bAlt,&bShift,&AccessMode); - - MENU_SHORT_CUT_MAP::iterator item = ShortCuts.find(ID); - if (item == ShortCuts.end()) { continue; } - item->second.AddShortCut(key,bCtrl == 1,bAlt == 1,bShift == 1,AccessMode); - } - } while (feof(file) == 0); - - } - return ShortCuts; -} - -LanguageStringID CMainMenu::GetShortCutMenuItemName(MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, MENU_SHORT_CUT_KEY::ACCESS_MODE Access) { - for (MSC_MAP::iterator Item = ShortCuts->begin(); Item != ShortCuts->end(); Item++) { - MENU_SHORT_CUT & short_cut = Item->second; +/*LanguageStringID CMainMenu::GetShortCutMenuItemName(MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, CMenuShortCutKey::ACCESS_MODE Access) { + Notify().BreakPoint(__FILE__,__LINE__); + /*for (MSC_MAP::iterator Item = ShortCuts->begin(); Item != ShortCuts->end(); Item++) { + CMenuShortCutKey & short_cut = Item->second; for (SHORTCUT_KEY_LIST::const_iterator AccelItem = short_cut.GetAccelItems().begin(); AccelItem != short_cut.GetAccelItems().end(); AccelItem++) { if (!AccelItem->Same(key,bCtrl,bAlt,bShift,Access)) { continue; } @@ -1353,7 +1213,8 @@ LanguageStringID CMainMenu::GetShortCutMenuItemName(MSC_MAP * ShortCuts, WORD ke } void CMainMenu::SaveShortCuts(MSC_MAP * ShortCuts) { - stdstr FileName = _Settings->LoadString(ShortCutFile); + Notify().BreakPoint(__FILE__,__LINE__); + stdstr FileName = _Settings->LoadString(SupportFile_ShortCuts); FILE *file = fopen(FileName.c_str(),"w"); for (MSC_MAP::iterator Item = ShortCuts->begin(); Item != ShortCuts->end(); Item++) { for (SHORTCUT_KEY_LIST::const_iterator ShortCut = Item->second.GetAccelItems().begin(); ShortCut != Item->second.GetAccelItems().end(); ShortCut++) { @@ -1362,4 +1223,4 @@ void CMainMenu::SaveShortCuts(MSC_MAP * ShortCuts) { } } fclose(file); -} +}*/ diff --git a/Source/Project64/User Interface/Main Menu Class.h b/Source/Project64/User Interface/Main Menu Class.h index a597be59a..1d1c1e169 100644 --- a/Source/Project64/User Interface/Main Menu Class.h +++ b/Source/Project64/User Interface/Main Menu Class.h @@ -49,29 +49,34 @@ enum MainMenuID { ID_HELP_CONTENTS, ID_HELP_GAMEFAQ, ID_HELP_SUPPORTFORUM, ID_HELP_HOMEPAGE, ID_HELP_ABOUTSETTINGFILES, ID_HELP_ABOUT, }; -class CMainMenu:public CBaseMenu { +class CMainMenu:public CBaseMenu +{ + typedef std::list SettingList; + CMainGui * _Gui; CN64System * _System; //MSC_MAP m_ShortCuts; void * m_AccelTable; bool m_ResetAccelerators; + CShortCuts m_ShortCuts; + SettingList m_ChangeSettingList; void FillOutMenu ( MENU_HANDLE hMenu ); - stdstr ShortCutString(MSC_MAP & ShortCuts, int MenuID, MENU_SHORT_CUT_KEY::ACCESS_MODE AccessLevel); + //stdstr ShortCutString(MSC_MAP & ShortCuts, int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel); stdstr GetSaveSlotString ( int Slot ); stdstr GetFileLastMod ( stdstr FileName ); void RebuildAccelerators ( void ); - + + static void SettingsChanged (CMainMenu * _this ); public: CMainMenu ( CMainGui * Window, CN64System * N64System ); ~CMainMenu(); - int ProcessAccelerator ( WND_HANDLE hWnd, void * lpMsg ); + int ProcessAccelerator ( WND_HANDLE hWnd, void * lpMsg ); bool ProcessMessage ( WND_HANDLE hWnd, DWORD wNotifyCode, DWORD wID); void ResetMenu ( void ); void ResetAccelerators ( void ) { m_ResetAccelerators = true; } - MSC_MAP GetShortCutInfo ( bool InitialSettings ); - void SaveShortCuts ( MSC_MAP * ShortCuts ); - LanguageStringID GetShortCutMenuItemName (MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, MENU_SHORT_CUT_KEY::ACCESS_MODE Access); +// void SaveShortCuts ( MSC_MAP * ShortCuts ); +// LanguageStringID GetShortCutMenuItemName (MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, CMenuShortCutKey::ACCESS_MODE Access); }; diff --git a/Source/Project64/User Interface/Menu Class.cpp b/Source/Project64/User Interface/Menu Class.cpp index b41ce5fdf..546940017 100644 --- a/Source/Project64/User Interface/Menu Class.cpp +++ b/Source/Project64/User Interface/Menu Class.cpp @@ -64,217 +64,8 @@ bool CBaseMenu::AddMenu(MENU_HANDLE hMenu, MenuItemList Items ) { return true; } -VIRTUAL_KEY MENU_SHORT_CUT_KEY::m_VirtualKeyList[] = { - { "VK_LBUTTON", 0x01, "VK_LBUTTON" }, - { "VK_RBUTTON", 0x02, "VK_RBUTTON" }, - { "VK_CANCEL", 0x03, "VK_CANCEL" }, - { "VK_MBUTTON", 0x04, "VK_MBUTTON" }, - { "VK_XBUTTON1", 0x05, "VK_XBUTTON1" }, - { "VK_XBUTTON2", 0x06, "VK_XBUTTON2" }, - { "VK_BACK", 0x08, "VK_BACK" }, - { "VK_TAB", 0x09, "VK_TAB" }, - { "VK_CLEAR", 0x0C, "VK_CLEAR" }, - { "VK_RETURN", 0x0D, "Return" }, - { "VK_SHIFT", 0x10, "VK_SHIFT" }, - { "VK_CONTROL", 0x11, "VK_CONTROL" }, - { "VK_MENU", 0x12, "VK_MENU" }, - { "VK_PAUSE", 0x13, "Pause" }, - { "VK_CAPITAL", 0x14, "VK_CAPITAL" }, - { "VK_KANA", 0x15, "VK_KANA" }, - { "VK_HANGUL", 0x15, "VK_HANGUL" }, - { "VK_JUNJA", 0x17, "VK_JUNJA" }, - { "VK_FINAL", 0x18, "VK_FINAL" }, - { "VK_HANJA", 0x19, "VK_HANJA" }, - { "VK_KANJI", 0x19, "VK_KANJI" }, - { "VK_ESCAPE", 0x1B, "Esc" }, - { "VK_CONVERT", 0x1C, "VK_CONVERT" }, - { "VK_NONCONVERT", 0x1D, "VK_NONCONVERT" }, - { "VK_ACCEPT", 0x1E, "VK_ACCEPT" }, - { "VK_MODECHANGE", 0x1F, "VK_MODECHANGE" }, - { "VK_SPACE", 0x20, "Space" }, - { "VK_PRIOR", 0x21, "Page Up" }, - { "VK_NEXT", 0x22, "Page Down" }, - { "VK_END", 0x23, "End" }, - { "VK_HOME", 0x24, "Home" }, - { "VK_LEFT", 0x25, "Left" }, - { "VK_UP", 0x26, "Up" }, - { "VK_RIGHT", 0x27, "Right" }, - { "VK_DOWN", 0x28, "Down" }, - { "VK_SELECT", 0x29, "VK_SELECT" }, - { "VK_PRINT", 0x2A, "VK_PRINT" }, - { "VK_EXECUTE", 0x2B, "VK_EXECUTE" }, - { "VK_SNAPSHOT", 0x2C, "VK_SNAPSHOT" }, - { "VK_INSERT", 0x2D, "Insert" }, - { "VK_DELETE", 0x2E, "Delete" }, - { "VK_HELP", 0x2F, "Help" }, - { "VK_0", 0x30, "0" }, - { "VK_1", 0x31, "1" }, - { "VK_2", 0x32, "2" }, - { "VK_3", 0x33, "3" }, - { "VK_4", 0x34, "4" }, - { "VK_5", 0x35, "5" }, - { "VK_6", 0x36, "6" }, - { "VK_7", 0x37, "7" }, - { "VK_8", 0x38, "8" }, - { "VK_9", 0x39, "9" }, - { "VK_A", 0x41, "A" }, - { "VK_B", 0x42, "B" }, - { "VK_C", 0x43, "C" }, - { "VK_D", 0x44, "D" }, - { "VK_E", 0x45, "E" }, - { "VK_F", 0x46, "F" }, - { "VK_G", 0x47, "G" }, - { "VK_H", 0x48, "H" }, - { "VK_I", 0x49, "I" }, - { "VK_J", 0x4A, "J" }, - { "VK_K", 0x4B, "K" }, - { "VK_L", 0x4C, "L" }, - { "VK_M", 0x4D, "M" }, - { "VK_N", 0x4E, "N" }, - { "VK_O", 0x4F, "O" }, - { "VK_P", 0x50, "P" }, - { "VK_Q", 0x51, "Q" }, - { "VK_R", 0x52, "R" }, - { "VK_S", 0x53, "S" }, - { "VK_T", 0x54, "T" }, - { "VK_U", 0x55, "U" }, - { "VK_V", 0x56, "V" }, - { "VK_W", 0x57, "W" }, - { "VK_X", 0x58, "X" }, - { "VK_Y", 0x59, "Y" }, - { "VK_Z", 0x5A, "Z" }, - { "VK_LWIN", 0x5B, "VK_LWIN" }, - { "VK_RWIN", 0x5C, "VK_RWIN" }, - { "VK_APPS", 0x5D, "VK_APPS" }, - { "VK_SLEEP", 0x5D, "VK_SLEEP" }, - { "VK_NUMPAD0", 0x60, "Numpad0" }, - { "VK_NUMPAD1", 0x61, "Numpad1" }, - { "VK_NUMPAD2", 0x62, "Numpad2" }, - { "VK_NUMPAD3", 0x63, "Numpad3" }, - { "VK_NUMPAD4", 0x64, "Numpad4" }, - { "VK_NUMPAD5", 0x65, "Numpad5" }, - { "VK_NUMPAD6", 0x66, "Numpad6" }, - { "VK_NUMPAD7", 0x67, "Numpad7" }, - { "VK_NUMPAD8", 0x68, "Numpad8" }, - { "VK_NUMPAD9", 0x69, "Numpad9" }, - { "VK_MULTIPLY", 0x6A, "*" }, - { "VK_ADD", 0x6B, "+" }, - { "VK_SEPARATOR", 0x6C, "" }, - { "VK_SUBTRACT", 0x6D, "-" }, - { "VK_DECIMAL", 0x6E, "." }, - { "VK_DIVIDE", 0x6F, "/" }, - { "VK_F1", 0x70, "F1" }, - { "VK_F2", 0x71, "F2" }, - { "VK_F3", 0x72, "F3" }, - { "VK_F4", 0x73, "F4" }, - { "VK_F5", 0x74, "F5" }, - { "VK_F6", 0x75, "F6" }, - { "VK_F7", 0x76, "F7" }, - { "VK_F8", 0x77, "F8" }, - { "VK_F9", 0x78, "F9" }, - { "VK_F10", 0x79, "F10" }, - { "VK_F11", 0x7A, "F11" }, - { "VK_F12", 0x7B, "F12" }, - { "VK_F13", 0x7C, "F13" }, - { "VK_F14", 0x7D, "F14" }, - { "VK_F15", 0x7E, "F15" }, - { "VK_F16", 0x7F, "F16" }, - { "VK_F17", 0x80, "F17" }, - { "VK_F18", 0x81, "F18" }, - { "VK_F19", 0x82, "F19" }, - { "VK_F20", 0x83, "F20" }, - { "VK_F21", 0x84, "F21" }, - { "VK_F22", 0x85, "F22" }, - { "VK_F23", 0x86, "F23" }, - { "VK_F24", 0x87, "F24" }, - { "VK_NUMLOCK", 0x90, "Numlock" }, - { "VK_SCROLL", 0x91, "VK_SCROLL" }, - { "VK_LSHIFT", 0xA0, "VK_LSHIFT" }, - { "VK_RSHIFT", 0xA1, "VK_RSHIFT" }, - { "VK_LCONTROL", 0xA2, "VK_LCONTROL" }, - { "VK_RCONTROL", 0xA3, "VK_RCONTROL" }, - { "VK_LMENU", 0xA4, "VK_LMENU" }, - { "VK_RMENU", 0xA5, "VK_RMENU" }, - { "VK_BROWSER_BACK", 0xA6, "" }, - { "VK_BROWSER_FORWARD",0xA7, "" }, - { "VK_BROWSER_REFRESH",0xA8, "" }, - { "VK_BROWSER_STOP", 0xA9, "" }, - { "VK_BROWSER_SEARCH", 0xAA, "" }, - { "VK_BROWSER_FAVORITES",0xAB, "" }, - { "VK_BROWSER_HOME", 0xAC, "" }, - { "VK_VOLUME_MUTE", 0xAD, "" }, - { "VK_VOLUME_DOWN", 0xAE, "" }, - { "VK_VOLUME_UP", 0xAF, "" }, - { "VK_MEDIA_NEXT_TRACK",0xB0, "" }, - { "VK_MEDIA_PREV_TRACK",0xB1, "" }, - { "VK_MEDIA_STOP", 0xB2, "" }, - { "VK_MEDIA_PLAY_PAUSE",0xB3, "" }, - { "VK_LAUNCH_MAIL", 0xB4, "" }, - { "VK_LAUNCH_MEDIA_SELECT",0xB5, "" }, - { "VK_LAUNCH_APP1", 0xB6, "" }, - { "VK_LAUNCH_APP2", 0xB7, "" }, - { "VK_OEM_1 (;:)", 0xBA, "" }, - { "VK_OEM_PLUS", 0xBB, "+" }, - { "VK_OEM_COMMA", 0xBC, "" }, - { "VK_OEM_MINUS", 0xBD, "-" }, - { "VK_OEM_PERIOD", 0xBE, "." }, - { "VK_OEM_2 (/?)", 0xBF, "" }, - { "VK_OEM_3 (`~)", 0xC0, "~" }, - { "VK_ATTN", 0xF6, "" }, - { "VK_CRSEL", 0xF7, "" }, - { "VK_EXSEL", 0xF8, "" }, - { "VK_EREOF", 0xF9, "" }, - { "VK_PLAY", 0xFA, "" }, - { "VK_ZOOM", 0xFB, "" }, - { "VK_NONAME", 0xFC, "" }, - { "VK_PA1", 0xFD, "" }, - { "VK_OEM_CLEAR", 0xFE } -}; -MENU_SHORT_CUT_KEY::MENU_SHORT_CUT_KEY(void) : - m_key(0),m_bCtrl(false),m_bAlt(false),m_bShift(false),m_AccessMode(NONE) -{ -} - -MENU_SHORT_CUT_KEY::MENU_SHORT_CUT_KEY(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode ) { - m_key = key; - m_bCtrl = bCtrl; - m_bAlt = bAlt; - m_bShift = bShift; - m_AccessMode = AccessMode; - - m_ShortCutName = ""; - for (int count = 0; count < sizeof(m_VirtualKeyList)/sizeof(m_VirtualKeyList[0]);count++){ - if (key == m_VirtualKeyList[count].Key) { - m_ShortCutName = m_VirtualKeyList[count].KeyName; - break; - } - } - if (m_bShift) { m_ShortCutName.Format("Shift+%s",m_ShortCutName.c_str()); } - if (m_bCtrl) { m_ShortCutName.Format("Ctrl+%s",m_ShortCutName.c_str()); } - if (m_bAlt) { m_ShortCutName.Format("Alt+%s",m_ShortCutName.c_str()); } -} - -bool MENU_SHORT_CUT_KEY::Same(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode) const -{ - if (key != m_key) { return false; } - if (bShift != m_bShift) { return false; } - if (bCtrl != m_bCtrl) { return false; } - if (bAlt != m_bAlt) { return false; } - if ((m_AccessMode & AccessMode) != AccessMode ) { return false; } - return true; -} - -VIRTUAL_KEY * MENU_SHORT_CUT_KEY::VirtualKeyList(int &Size) { - Size = sizeof(m_VirtualKeyList) / sizeof(m_VirtualKeyList[0]); - return (VIRTUAL_KEY *)m_VirtualKeyList; -} - -void MENU_SHORT_CUT::AddShortCut(WORD key, bool bCtrl, bool bAlt, bool bShift, MENU_SHORT_CUT_KEY::ACCESS_MODE AccessMode) { - m_AccelList.push_back(MENU_SHORT_CUT_KEY(key,bCtrl,bAlt,bShift,AccessMode)); -} - -void MENU_SHORT_CUT::RemoveItem ( MENU_SHORT_CUT_KEY * ShortCut ) +/*void MENU_SHORT_CUT::RemoveItem ( MENU_SHORT_CUT_KEY * ShortCut ) { for (SHORTCUT_KEY_LIST::iterator item = m_AccelList.begin(); item != m_AccelList.end(); item++) { if (ShortCut == &*item) { @@ -283,5 +74,5 @@ void MENU_SHORT_CUT::RemoveItem ( MENU_SHORT_CUT_KEY * ShortCut ) } } -} +}*/ diff --git a/Source/Project64/User Interface/Menu Class.h b/Source/Project64/User Interface/Menu Class.h index 3bbee9653..3e65cd4d2 100644 --- a/Source/Project64/User Interface/Menu Class.h +++ b/Source/Project64/User Interface/Menu Class.h @@ -1,53 +1,9 @@ #ifndef __MENU_CLASS__H__ #define __MENU_CLASS__H__ -typedef struct { - LPCSTR Name; - int Key; - LPCSTR KeyName; -} VIRTUAL_KEY; - #include -class MENU_SHORT_CUT_KEY { -public: - enum ACCESS_MODE { - NONE = 0, - GAME_NOT_RUNNING = 1, - GAME_RUNNING_WINDOW = 2, - NOT_IN_FULLSCREEN = 3, - GAME_RUNNING_FULLSCREEN = 4, - GAME_RUNNING = 6, - ANYTIME = 7, - } ; -private: - static VIRTUAL_KEY m_VirtualKeyList[]; - - stdstr m_ShortCutName; - WORD m_key; - bool m_bCtrl; - bool m_bAlt; - bool m_bShift; - ACCESS_MODE m_AccessMode; - -public: - MENU_SHORT_CUT_KEY(void); - MENU_SHORT_CUT_KEY(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode ); - bool Same (WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode ) const; - - static VIRTUAL_KEY * VirtualKeyList(int &Size); - - inline stdstr Name ( void ) const { return m_ShortCutName; } - inline WORD Key ( void ) const { return m_key; } - inline bool Ctrl ( void ) const { return m_bCtrl; } - inline bool Alt ( void ) const { return m_bAlt; } - inline bool Shift ( void ) const { return m_bShift; } - inline ACCESS_MODE AccessMode ( void ) const { return m_AccessMode; } -}; - -typedef std::list SHORTCUT_KEY_LIST; - -class MENU_SHORT_CUT { +/*class MENU_SHORT_CUT { MENU_SHORT_CUT_KEY::ACCESS_MODE m_Access; LanguageStringID m_Section; LanguageStringID m_Title; @@ -74,7 +30,7 @@ public: }; typedef std::map MENU_SHORT_CUT_MAP; -typedef MENU_SHORT_CUT_MAP MSC_MAP; +typedef MENU_SHORT_CUT_MAP MSC_MAP;*/ enum Menu_ID { //ControlID @@ -129,9 +85,9 @@ public: virtual bool ProcessMessage(WND_HANDLE hWnd, DWORD wNotifyCode, DWORD wID) = 0; // pure virtual draw() function virtual void ResetMenu(void) = 0; // pure virtual draw() function MENU_HANDLE GetHandle (void) { return m_MenuHandle; } - virtual MSC_MAP GetShortCutInfo(bool InitialSettings) = 0; // pure virtual draw() function - virtual void SaveShortCuts ( MSC_MAP * ShortCuts ) = 0; - virtual LanguageStringID GetShortCutMenuItemName(MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, MENU_SHORT_CUT_KEY::ACCESS_MODE Access ) = 0; // pure virtual draw() function + //virtual MSC_MAP GetShortCutInfo(bool InitialSettings) = 0; // pure virtual draw() function + //virtual void SaveShortCuts ( MSC_MAP * ShortCuts ) = 0; + //virtual LanguageStringID GetShortCutMenuItemName(MSC_MAP * ShortCuts, WORD key, bool bCtrl, bool bAlt, bool bShift, CMenuShortCutKey::ACCESS_MODE Access ) = 0; // pure virtual draw() function }; #endif \ No newline at end of file diff --git a/Source/Project64/User Interface/MenuShortCuts.cpp b/Source/Project64/User Interface/MenuShortCuts.cpp new file mode 100644 index 000000000..be86b4b76 --- /dev/null +++ b/Source/Project64/User Interface/MenuShortCuts.cpp @@ -0,0 +1,486 @@ +#include "..\\User Interface.h" +#include + +VIRTUAL_KEY CMenuShortCutKey::m_VirtualKeyList[] = { + { "VK_LBUTTON", 0x01, "VK_LBUTTON" }, + { "VK_RBUTTON", 0x02, "VK_RBUTTON" }, + { "VK_CANCEL", 0x03, "VK_CANCEL" }, + { "VK_MBUTTON", 0x04, "VK_MBUTTON" }, + { "VK_XBUTTON1", 0x05, "VK_XBUTTON1" }, + { "VK_XBUTTON2", 0x06, "VK_XBUTTON2" }, + { "VK_BACK", 0x08, "VK_BACK" }, + { "VK_TAB", 0x09, "VK_TAB" }, + { "VK_CLEAR", 0x0C, "VK_CLEAR" }, + { "VK_RETURN", 0x0D, "Return" }, + { "VK_SHIFT", 0x10, "VK_SHIFT" }, + { "VK_CONTROL", 0x11, "VK_CONTROL" }, + { "VK_MENU", 0x12, "VK_MENU" }, + { "VK_PAUSE", 0x13, "Pause" }, + { "VK_CAPITAL", 0x14, "VK_CAPITAL" }, + { "VK_KANA", 0x15, "VK_KANA" }, + { "VK_HANGUL", 0x15, "VK_HANGUL" }, + { "VK_JUNJA", 0x17, "VK_JUNJA" }, + { "VK_FINAL", 0x18, "VK_FINAL" }, + { "VK_HANJA", 0x19, "VK_HANJA" }, + { "VK_KANJI", 0x19, "VK_KANJI" }, + { "VK_ESCAPE", 0x1B, "Esc" }, + { "VK_CONVERT", 0x1C, "VK_CONVERT" }, + { "VK_NONCONVERT", 0x1D, "VK_NONCONVERT" }, + { "VK_ACCEPT", 0x1E, "VK_ACCEPT" }, + { "VK_MODECHANGE", 0x1F, "VK_MODECHANGE" }, + { "VK_SPACE", 0x20, "Space" }, + { "VK_PRIOR", 0x21, "Page Up" }, + { "VK_NEXT", 0x22, "Page Down" }, + { "VK_END", 0x23, "End" }, + { "VK_HOME", 0x24, "Home" }, + { "VK_LEFT", 0x25, "Left" }, + { "VK_UP", 0x26, "Up" }, + { "VK_RIGHT", 0x27, "Right" }, + { "VK_DOWN", 0x28, "Down" }, + { "VK_SELECT", 0x29, "VK_SELECT" }, + { "VK_PRINT", 0x2A, "VK_PRINT" }, + { "VK_EXECUTE", 0x2B, "VK_EXECUTE" }, + { "VK_SNAPSHOT", 0x2C, "VK_SNAPSHOT" }, + { "VK_INSERT", 0x2D, "Insert" }, + { "VK_DELETE", 0x2E, "Delete" }, + { "VK_HELP", 0x2F, "Help" }, + { "VK_0", 0x30, "0" }, + { "VK_1", 0x31, "1" }, + { "VK_2", 0x32, "2" }, + { "VK_3", 0x33, "3" }, + { "VK_4", 0x34, "4" }, + { "VK_5", 0x35, "5" }, + { "VK_6", 0x36, "6" }, + { "VK_7", 0x37, "7" }, + { "VK_8", 0x38, "8" }, + { "VK_9", 0x39, "9" }, + { "VK_A", 0x41, "A" }, + { "VK_B", 0x42, "B" }, + { "VK_C", 0x43, "C" }, + { "VK_D", 0x44, "D" }, + { "VK_E", 0x45, "E" }, + { "VK_F", 0x46, "F" }, + { "VK_G", 0x47, "G" }, + { "VK_H", 0x48, "H" }, + { "VK_I", 0x49, "I" }, + { "VK_J", 0x4A, "J" }, + { "VK_K", 0x4B, "K" }, + { "VK_L", 0x4C, "L" }, + { "VK_M", 0x4D, "M" }, + { "VK_N", 0x4E, "N" }, + { "VK_O", 0x4F, "O" }, + { "VK_P", 0x50, "P" }, + { "VK_Q", 0x51, "Q" }, + { "VK_R", 0x52, "R" }, + { "VK_S", 0x53, "S" }, + { "VK_T", 0x54, "T" }, + { "VK_U", 0x55, "U" }, + { "VK_V", 0x56, "V" }, + { "VK_W", 0x57, "W" }, + { "VK_X", 0x58, "X" }, + { "VK_Y", 0x59, "Y" }, + { "VK_Z", 0x5A, "Z" }, + { "VK_LWIN", 0x5B, "VK_LWIN" }, + { "VK_RWIN", 0x5C, "VK_RWIN" }, + { "VK_APPS", 0x5D, "VK_APPS" }, + { "VK_SLEEP", 0x5D, "VK_SLEEP" }, + { "VK_NUMPAD0", 0x60, "Numpad0" }, + { "VK_NUMPAD1", 0x61, "Numpad1" }, + { "VK_NUMPAD2", 0x62, "Numpad2" }, + { "VK_NUMPAD3", 0x63, "Numpad3" }, + { "VK_NUMPAD4", 0x64, "Numpad4" }, + { "VK_NUMPAD5", 0x65, "Numpad5" }, + { "VK_NUMPAD6", 0x66, "Numpad6" }, + { "VK_NUMPAD7", 0x67, "Numpad7" }, + { "VK_NUMPAD8", 0x68, "Numpad8" }, + { "VK_NUMPAD9", 0x69, "Numpad9" }, + { "VK_MULTIPLY", 0x6A, "*" }, + { "VK_ADD", 0x6B, "+" }, + { "VK_SEPARATOR", 0x6C, "" }, + { "VK_SUBTRACT", 0x6D, "-" }, + { "VK_DECIMAL", 0x6E, "." }, + { "VK_DIVIDE", 0x6F, "/" }, + { "VK_F1", 0x70, "F1" }, + { "VK_F2", 0x71, "F2" }, + { "VK_F3", 0x72, "F3" }, + { "VK_F4", 0x73, "F4" }, + { "VK_F5", 0x74, "F5" }, + { "VK_F6", 0x75, "F6" }, + { "VK_F7", 0x76, "F7" }, + { "VK_F8", 0x77, "F8" }, + { "VK_F9", 0x78, "F9" }, + { "VK_F10", 0x79, "F10" }, + { "VK_F11", 0x7A, "F11" }, + { "VK_F12", 0x7B, "F12" }, + { "VK_F13", 0x7C, "F13" }, + { "VK_F14", 0x7D, "F14" }, + { "VK_F15", 0x7E, "F15" }, + { "VK_F16", 0x7F, "F16" }, + { "VK_F17", 0x80, "F17" }, + { "VK_F18", 0x81, "F18" }, + { "VK_F19", 0x82, "F19" }, + { "VK_F20", 0x83, "F20" }, + { "VK_F21", 0x84, "F21" }, + { "VK_F22", 0x85, "F22" }, + { "VK_F23", 0x86, "F23" }, + { "VK_F24", 0x87, "F24" }, + { "VK_NUMLOCK", 0x90, "Numlock" }, + { "VK_SCROLL", 0x91, "VK_SCROLL" }, + { "VK_LSHIFT", 0xA0, "VK_LSHIFT" }, + { "VK_RSHIFT", 0xA1, "VK_RSHIFT" }, + { "VK_LCONTROL", 0xA2, "VK_LCONTROL" }, + { "VK_RCONTROL", 0xA3, "VK_RCONTROL" }, + { "VK_LMENU", 0xA4, "VK_LMENU" }, + { "VK_RMENU", 0xA5, "VK_RMENU" }, + { "VK_BROWSER_BACK", 0xA6, "" }, + { "VK_BROWSER_FORWARD",0xA7, "" }, + { "VK_BROWSER_REFRESH",0xA8, "" }, + { "VK_BROWSER_STOP", 0xA9, "" }, + { "VK_BROWSER_SEARCH", 0xAA, "" }, + { "VK_BROWSER_FAVORITES",0xAB, "" }, + { "VK_BROWSER_HOME", 0xAC, "" }, + { "VK_VOLUME_MUTE", 0xAD, "" }, + { "VK_VOLUME_DOWN", 0xAE, "" }, + { "VK_VOLUME_UP", 0xAF, "" }, + { "VK_MEDIA_NEXT_TRACK",0xB0, "" }, + { "VK_MEDIA_PREV_TRACK",0xB1, "" }, + { "VK_MEDIA_STOP", 0xB2, "" }, + { "VK_MEDIA_PLAY_PAUSE",0xB3, "" }, + { "VK_LAUNCH_MAIL", 0xB4, "" }, + { "VK_LAUNCH_MEDIA_SELECT",0xB5, "" }, + { "VK_LAUNCH_APP1", 0xB6, "" }, + { "VK_LAUNCH_APP2", 0xB7, "" }, + { "VK_OEM_1 (;:)", 0xBA, "" }, + { "VK_OEM_PLUS", 0xBB, "+" }, + { "VK_OEM_COMMA", 0xBC, "" }, + { "VK_OEM_MINUS", 0xBD, "-" }, + { "VK_OEM_PERIOD", 0xBE, "." }, + { "VK_OEM_2 (/?)", 0xBF, "" }, + { "VK_OEM_3 (`~)", 0xC0, "~" }, + { "VK_ATTN", 0xF6, "" }, + { "VK_CRSEL", 0xF7, "" }, + { "VK_EXSEL", 0xF8, "" }, + { "VK_EREOF", 0xF9, "" }, + { "VK_PLAY", 0xFA, "" }, + { "VK_ZOOM", 0xFB, "" }, + { "VK_NONAME", 0xFC, "" }, + { "VK_PA1", 0xFD, "" }, + { "VK_OEM_CLEAR", 0xFE } +}; + +CMenuShortCutKey::CMenuShortCutKey (WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive ) : + m_key(key), + m_bCtrl(bCtrl), + m_bAlt(bAlt), + m_bShift(bShift), + m_AccessMode(AccessMode), + m_bUserAdded(bUserAdded), + m_bInactive(bInactive) +{ + m_ShortCutName = ""; + for (int i = 0, n = sizeof(m_VirtualKeyList)/sizeof(m_VirtualKeyList[0]); i < n;i++) + { + if (key == m_VirtualKeyList[i].Key) + { + m_ShortCutName = m_VirtualKeyList[i].KeyName; + break; + } + } + if (m_bShift) { m_ShortCutName.Format("Shift+%s",m_ShortCutName.c_str()); } + if (m_bCtrl) { m_ShortCutName.Format("Ctrl+%s",m_ShortCutName.c_str()); } + if (m_bAlt) { m_ShortCutName.Format("Alt+%s",m_ShortCutName.c_str()); } +} + +VIRTUAL_KEY * CMenuShortCutKey::VirtualKeyList(int &Size) { + Size = sizeof(m_VirtualKeyList) / sizeof(m_VirtualKeyList[0]); + return (VIRTUAL_KEY *)m_VirtualKeyList; +} + +bool CMenuShortCutKey::Same(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode) const +{ + if (key != m_key) { return false; } + if (bShift != m_bShift) { return false; } + if (bCtrl != m_bCtrl) { return false; } + if (bAlt != m_bAlt) { return false; } + if ((m_AccessMode & AccessMode) != AccessMode ) { return false; } + return true; +} + + +CShortCutItem::CShortCutItem(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access) +{ + Reset(Section, Title,Access); +} + +void CShortCutItem::Reset ( LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access) +{ + this->m_Section = Section; + this->m_Title = Title; + this->m_Access = Access; +} + +void CShortCutItem::AddShortCut (WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive) +{ + m_AccelList.push_back(CMenuShortCutKey(key,bCtrl,bAlt,bShift,AccessMode,bUserAdded,bInactive)); +} + +void CShortCutItem::RemoveItem ( CMenuShortCutKey * ShortCut ) +{ + if (ShortCut->UserAdded()) + { + for (SHORTCUT_KEY_LIST::iterator item = m_AccelList.begin(); item != m_AccelList.end(); item++) + { + if (ShortCut == &*item) + { + m_AccelList.erase(item); + break; + } + } + } else { + ShortCut->SetInactive(true); + } +} + +CShortCuts::CShortCuts () +{ + Load(); +} + +CShortCuts::~CShortCuts() +{ +} + +stdstr CShortCuts::ShortCutString( int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel ) +{ + MSC_MAP::iterator MenuItem = m_ShortCuts.find(MenuID); + if (MenuItem == m_ShortCuts.end()) { return ""; } + + const SHORTCUT_KEY_LIST & ShortCutList = MenuItem->second.GetAccelItems(); + for (SHORTCUT_KEY_LIST::const_iterator item = ShortCutList.begin(); item != ShortCutList.end(); item++) + { + ACCESS_MODE ItemMode = item->AccessMode(); + if ((ItemMode & AccessLevel) != AccessLevel ) + { + continue; + } + if (item->Inactive()) + { + continue; + } + return item->Name(); + } + return ""; +} + +LanguageStringID CShortCuts::GetMenuItemName( WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access ) +{ + for (MSC_MAP::iterator Item = m_ShortCuts.begin(); Item != m_ShortCuts.end(); Item++) + { + CShortCutItem & short_cut = Item->second; + + for (SHORTCUT_KEY_LIST::const_iterator AccelItem = short_cut.GetAccelItems().begin(); AccelItem != short_cut.GetAccelItems().end(); AccelItem++) + { + if (!AccelItem->Same(key,bCtrl,bAlt,bShift,Access)) { continue; } + return short_cut.Title(); + } + } + return EMPTY_STRING; +} + +void CShortCuts::AddShortCut( WORD ID, LanguageStringID Section, LanguageStringID LangID, CMenuShortCutKey::ACCESS_MODE AccessMode) +{ + m_ShortCuts.insert(MSC_MAP::value_type(ID,CShortCutItem(Section,LangID,AccessMode))); +} + +void CShortCuts::Load (bool InitialValues ) +{ + m_ShortCuts.clear(); + + AddShortCut(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_FILE_ROM_INFO, STR_SHORTCUT_FILEMENU, MENU_ROM_INFO, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_FILE_STARTEMULATION, STR_SHORTCUT_FILEMENU, MENU_START, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_FILE_ENDEMULATION, STR_SHORTCUT_FILEMENU, MENU_END, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_FILE_ROMDIRECTORY, STR_SHORTCUT_FILEMENU, MENU_CHOOSE_ROM, CMenuShortCutKey::GAME_NOT_RUNNING ); + AddShortCut(ID_FILE_REFRESHROMLIST, STR_SHORTCUT_FILEMENU, MENU_REFRESH, CMenuShortCutKey::GAME_NOT_RUNNING ); + AddShortCut(ID_FILE_EXIT, STR_SHORTCUT_FILEMENU, MENU_EXIT, CMenuShortCutKey::ANYTIME ); + + AddShortCut(ID_SYSTEM_RESET_SOFT, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_SOFT, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_RESET_HARD, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_HARD, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_PAUSE, STR_SHORTCUT_SYSTEMMENU, MENU_PAUSE, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_BITMAP, STR_SHORTCUT_SYSTEMMENU, MENU_BITMAP, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_LIMITFPS, STR_SHORTCUT_SYSTEMMENU, MENU_LIMIT_FPS, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_SAVE, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_SAVEAS, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE_AS, CMenuShortCutKey::GAME_RUNNING_WINDOW ); + AddShortCut(ID_SYSTEM_RESTORE, STR_SHORTCUT_SYSTEMMENU, MENU_RESTORE, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_SYSTEM_LOAD, STR_SHORTCUT_SYSTEMMENU, MENU_LOAD, CMenuShortCutKey::GAME_RUNNING_WINDOW ); + AddShortCut(ID_SYSTEM_CHEAT, STR_SHORTCUT_SYSTEMMENU, MENU_CHEAT, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_SYSTEM_GSBUTTON, STR_SHORTCUT_SYSTEMMENU, MENU_GS_BUTTON, CMenuShortCutKey::GAME_RUNNING ); + + AddShortCut(ID_OPTIONS_DISPLAY_FR, STR_SHORTCUT_OPTIONS, OPTION_DISPLAY_FR,CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_OPTIONS_CHANGE_FR, STR_SHORTCUT_OPTIONS, OPTION_CHANGE_FR, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_OPTIONS_INCREASE_SPEED,STR_SHORTCUT_OPTIONS, STR_INSREASE_SPEED, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_OPTIONS_DECREASE_SPEED,STR_SHORTCUT_OPTIONS, STR_DECREASE_SPEED, CMenuShortCutKey::GAME_RUNNING ); + + AddShortCut(ID_CURRENT_SAVE_DEFAULT,STR_SHORTCUT_SAVESLOT, SAVE_SLOT_DEFAULT,CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_1, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_1, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_2, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_2, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_3, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_3, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_4, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_4, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_5, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_5, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_6, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_6, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_7, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_7, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_8, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_8, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_9, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_9, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_CURRENT_SAVE_10, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_10, CMenuShortCutKey::GAME_RUNNING ); + + //Option Menu + AddShortCut(ID_OPTIONS_FULLSCREEN, STR_SHORTCUT_OPTIONS, MENU_FULL_SCREEN, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_OPTIONS_ALWAYSONTOP, STR_SHORTCUT_OPTIONS, MENU_ON_TOP, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_OPTIONS_CONFIG_GFX, STR_SHORTCUT_OPTIONS, MENU_CONFG_GFX, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_OPTIONS_CONFIG_AUDIO,STR_SHORTCUT_OPTIONS, MENU_CONFG_AUDIO, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_OPTIONS_CONFIG_CONT, STR_SHORTCUT_OPTIONS, MENU_CONFG_CTRL, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_OPTIONS_CONFIG_RSP, STR_SHORTCUT_OPTIONS, MENU_CONFG_RSP, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + AddShortCut(ID_OPTIONS_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, CMenuShortCutKey::GAME_RUNNING ); + AddShortCut(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, CMenuShortCutKey::NOT_IN_FULLSCREEN ); + + stdstr FileName = _Settings->LoadString(SupportFile_ShortCuts); + FILE *file = fopen(FileName.c_str(),"r"); + if (file == NULL || InitialValues) + { + m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_FILE_STARTEMULATION)->second.AddShortCut(VK_F11,false,false,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_FILE_ENDEMULATION)->second.AddShortCut(VK_F12,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_FILE_REFRESHROMLIST)->second.AddShortCut(VK_F5,false,false,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4,false,true,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4,false,true,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_DEFAULT)->second.AddShortCut(0xC0,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_1)->second.AddShortCut('1',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_2)->second.AddShortCut('2',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_3)->second.AddShortCut('3',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_4)->second.AddShortCut('4',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_5)->second.AddShortCut('5',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_6)->second.AddShortCut('6',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_7)->second.AddShortCut('7',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_8)->second.AddShortCut('8',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_9)->second.AddShortCut('9',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_CURRENT_SAVE_10)->second.AddShortCut('0',false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_RETURN,false,true,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_ESCAPE,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A',true,false,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A',true,false,false,CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T',true,false,false,CMenuShortCutKey::GAME_NOT_RUNNING); + m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T',true,false,false,CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_ShortCuts.find(ID_SYSTEM_RESET_SOFT)->second.AddShortCut(VK_F1,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_RESET_HARD)->second.AddShortCut(VK_F1,false,false,true,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_F2,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_PAUSE,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_BITMAP)->second.AddShortCut(VK_F3,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_LIMITFPS)->second.AddShortCut(VK_F4,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_SAVE)->second.AddShortCut(VK_F5,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_RESTORE)->second.AddShortCut(VK_F7,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_SYSTEM_LOAD)->second.AddShortCut('L',true,false,false,CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_ShortCuts.find(ID_SYSTEM_SAVEAS)->second.AddShortCut('S',true,false,false,CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_ShortCuts.find(ID_SYSTEM_CHEAT)->second.AddShortCut('C',true,false,false,CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_ShortCuts.find(ID_SYSTEM_GSBUTTON)->second.AddShortCut(VK_F9,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_OPTIONS_INCREASE_SPEED)->second.AddShortCut(VK_OEM_PLUS,false,false,false,CMenuShortCutKey::GAME_RUNNING); + m_ShortCuts.find(ID_OPTIONS_DECREASE_SPEED)->second.AddShortCut(VK_OEM_MINUS,false,false,false,CMenuShortCutKey::GAME_RUNNING); + } else if (file) { + CMenuShortCutKey::ACCESS_MODE AccessMode; + int ID, key, bCtrl, bAlt, bShift, bUserAdded, bInactive; + + do { + char Line[300]; + if (fgets(Line,sizeof(Line),file) != NULL) { + sscanf(Line,"%d,%d,%d,%d,%d,%d,%d,%d", &ID,&key,&bCtrl,&bAlt,&bShift,&AccessMode, + &bUserAdded,&bInactive); + + MSC_MAP::iterator item = m_ShortCuts.find(ID); + if (item == m_ShortCuts.end()) { continue; } + item->second.AddShortCut(key,bCtrl == 1,bAlt == 1,bShift == 1,AccessMode,bUserAdded == 1,bInactive == 1); + } + } while (feof(file) == 0); + + } +} + +void CShortCuts::Save( void ) +{ + stdstr FileName = _Settings->LoadString(SupportFile_ShortCuts); + FILE *file = fopen(FileName.c_str(),"w"); + if (file == NULL) + { + return; + } + + for (MSC_MAP::iterator Item = m_ShortCuts.begin(); Item != m_ShortCuts.end(); Item++) + { + for (SHORTCUT_KEY_LIST::const_iterator ShortCut = Item->second.GetAccelItems().begin(); ShortCut != Item->second.GetAccelItems().end(); ShortCut++) + { + fprintf(file,"%d,%d,%d,%d,%d,%d,%d,%d\n", + Item->first, + ShortCut->Key(), + ShortCut->Ctrl(), + ShortCut->Alt(), + ShortCut->Shift(), + ShortCut->AccessMode(), + ShortCut->UserAdded(), + ShortCut->Inactive()); + } + } + fclose(file); +} + +HACCEL CShortCuts::GetAcceleratorTable ( void ) +{ + //Generate a ACCEL list + CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING; + if (_Settings->LoadBool(GameRunning_CPU_Running)) + { + AccessLevel = _Settings->LoadBool(UserInterface_InFullScreen) ? + CMenuShortCutKey::GAME_RUNNING_FULLSCREEN : + CMenuShortCutKey::GAME_RUNNING_WINDOW; + } + + int size = 0, MaxSize = m_ShortCuts.size() * 5; + ACCEL * AccelList = new ACCEL[MaxSize]; + + for (MSC_MAP::iterator Item = m_ShortCuts.begin(); Item != m_ShortCuts.end(); Item++) + { + CShortCutItem & short_cut = Item->second; + + CMenuShortCutKey::ACCESS_MODE ItemMode = short_cut.AccessMode(); + if ((ItemMode & AccessLevel) != AccessLevel ) + { + continue; + } + + SHORTCUT_KEY_LIST ShortCutAccelList = short_cut.GetAccelItems(); + for (SHORTCUT_KEY_LIST::iterator AccelIter = ShortCutAccelList.begin(); AccelIter != ShortCutAccelList.end(); AccelIter++) + { + CMenuShortCutKey & Key = *AccelIter; + if (Key.Inactive()) + { + continue; + } + if ((Key.AccessMode() & AccessLevel) != AccessLevel ) + { + continue; + } + if (size >= MaxSize) { break; } + AccelList[size].cmd = Item->first; + AccelList[size].key = Key.Key(); + AccelList[size].fVirt = FVIRTKEY; + if (Key.Alt()) { AccelList[size].fVirt |= FALT; } + if (Key.Ctrl()) { AccelList[size].fVirt |= FCONTROL; } + if (Key.Shift()) { AccelList[size].fVirt |= FSHIFT; } + size += 1; + } + } + + WriteTrace(TraceDebug,"CMainMenu::RebuildAccelerators - CreateAcceleratorTable"); + HACCEL AccelTable = CreateAcceleratorTable(AccelList,size); + WriteTrace(TraceDebug,"CMainMenu::RebuildAccelerators - Delete accel list"); + delete [] AccelList; + return AccelTable; +} diff --git a/Source/Project64/User Interface/MenuShortCuts.h b/Source/Project64/User Interface/MenuShortCuts.h new file mode 100644 index 000000000..0ff13686e --- /dev/null +++ b/Source/Project64/User Interface/MenuShortCuts.h @@ -0,0 +1,100 @@ +#pragma once + +typedef struct { + LPCSTR Name; + int Key; + LPCSTR KeyName; +} VIRTUAL_KEY; + +class CMenuShortCutKey { +public: + enum ACCESS_MODE { + NONE = 0, + GAME_NOT_RUNNING = 1, + GAME_RUNNING_WINDOW = 2, + NOT_IN_FULLSCREEN = 3, + GAME_RUNNING_FULLSCREEN = 4, + GAME_RUNNING = 6, + ANYTIME = 7, + } ; + +private: + static VIRTUAL_KEY m_VirtualKeyList[]; + + stdstr m_ShortCutName; + WORD m_key; + bool m_bCtrl; + bool m_bAlt; + bool m_bShift; + ACCESS_MODE m_AccessMode; + bool m_bUserAdded; + bool m_bInactive; + +public: + CMenuShortCutKey(void); + CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive ); + bool Same (WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode ) const; + + static VIRTUAL_KEY * VirtualKeyList(int &Size); + + inline stdstr Name ( void ) const { return m_ShortCutName; } + inline WORD Key ( void ) const { return m_key; } + inline bool Ctrl ( void ) const { return m_bCtrl; } + inline bool Alt ( void ) const { return m_bAlt; } + inline bool Shift ( void ) const { return m_bShift; } + inline bool UserAdded ( void ) const { return m_bUserAdded; } + inline bool Inactive ( void ) const { return m_bInactive; } + inline ACCESS_MODE AccessMode ( void ) const { return m_AccessMode; } + + inline void SetInactive ( bool Inactive ) { m_bInactive = Inactive; } +}; + +class CShortCutItem +{ +public: + typedef std::list SHORTCUT_KEY_LIST; + +private: + typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE; + + ACCESS_MODE m_Access; + LanguageStringID m_Section; + LanguageStringID m_Title; + SHORTCUT_KEY_LIST m_AccelList; + +public: + CShortCutItem(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access); + void Reset ( LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access); + void AddShortCut ( WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded = false, bool bInactive = false ); + void RemoveItem ( CMenuShortCutKey * ShortCut ); + + inline const SHORTCUT_KEY_LIST & GetAccelItems ( void ) const { return m_AccelList; } + inline LanguageStringID Section ( void ) const { return m_Section; } + inline LanguageStringID Title ( void ) const { return m_Title; } + inline ACCESS_MODE AccessMode ( void ) const { return m_Access; } +}; + +typedef std::map MSC_MAP; + +class CShortCuts +{ + typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST; + typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE; + typedef LanguageStringID LangStr; + + MSC_MAP m_ShortCuts; + + void AddShortCut ( WORD ID, LangStr Section, LangStr LangID, CMenuShortCutKey::ACCESS_MODE AccessMode); + +public: + CShortCuts ( void ); + ~CShortCuts ( void ); + + stdstr ShortCutString ( int MenuID, ACCESS_MODE AccessLevel ); + LangStr GetMenuItemName ( WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access ); + HACCEL GetAcceleratorTable ( void ); + MSC_MAP &GetShortCuts ( void ) { return m_ShortCuts; } + + void Load ( bool InitialValues = false ); + void Save ( void ); +}; diff --git a/Source/Project64/User Interface/Notification Class.cpp b/Source/Project64/User Interface/Notification Class.cpp index abf12d6ea..b6445e011 100644 --- a/Source/Project64/User Interface/Notification Class.cpp +++ b/Source/Project64/User Interface/Notification Class.cpp @@ -22,6 +22,29 @@ void CNotification::SetMainWindow ( CMainGui * Gui ) { _hWnd = Gui; } +void CNotification::WindowMode ( void ) const +{ + static bool InsideFunc = false; + if (InsideFunc) + { + return; + } + InsideFunc = true; + if (InFullScreen()) + { + ChangeFullScreen(); + for (int i = 0; i < 5; i++) + { + Sleep(50); + if (ProcessGuiMessages()) + { + break; + } + } + } + InsideFunc = false; +} + void CNotification::DisplayError ( const char * Message, ... ) const { va_list ap; va_start( ap, Message ); @@ -32,6 +55,8 @@ void CNotification::DisplayError ( const char * Message, va_list ap ) const { if (this == NULL) { return; } char Msg[1000]; + WindowMode(); + _vsnprintf( Msg,sizeof(Msg) - 1,Message, ap ); va_end( ap ); HWND Parent = NULL; @@ -71,7 +96,7 @@ void CNotification::DisplayMessage ( int DisplayTime, const char * Message, va_ va_end( ap ); - if (bInFullScreen) + if (InFullScreen()) { if (_gfxPlugin && _gfxPlugin->DrawStatus) { @@ -107,7 +132,7 @@ void CNotification::SetGfxPlugin( CGfxPlugin * Plugin ) void CNotification::SetWindowCaption (const char * Caption) { char WinTitle[256]; - _snprintf( WinTitle, sizeof(WinTitle), "%s - %s", Caption, _Settings->LoadString(ApplicationName).c_str()); + _snprintf( WinTitle, sizeof(WinTitle), "%s - %s", Caption, _Settings->LoadString(Setting_ApplicationName).c_str()); WinTitle[sizeof(WinTitle) - 1] = 0; _hWnd->Caption(WinTitle); } @@ -116,6 +141,8 @@ void CNotification::FatalError ( const char * Message, ... ) const { char Msg[1000]; va_list ap; + WindowMode(); + va_start( ap, Message ); _vsnprintf( Msg,sizeof(Msg) - 1,Message, ap ); va_end( ap ); @@ -130,11 +157,12 @@ void CNotification::AddRecentDir ( const char * RomDir ) { if (HIWORD(RomDir) == NULL) { return; } //Get Information about the stored rom list + int MaxRememberedDirs = _Settings->LoadDword(Directory_RecentGameDirCount); strlist RecentDirs; int i; for (i = 0; i < MaxRememberedDirs; i ++ ) { - stdstr RecentDir = _Settings->LoadStringIndex(RecentRomDirIndex,i); + stdstr RecentDir = _Settings->LoadStringIndex(Directory_RecentGameDirIndex,i); if (RecentDir.empty()) { break; @@ -161,7 +189,7 @@ void CNotification::AddRecentDir ( const char * RomDir ) { for (i = 0, iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++, i++) { - _Settings->SaveStringIndex(RecentRomDirIndex,i,*iter); + _Settings->SaveStringIndex(Directory_RecentGameDirIndex,i,*iter); } } @@ -169,38 +197,40 @@ void CNotification::AddRecentRom ( const char * ImagePath ) { if (HIWORD(ImagePath) == NULL) { return; } //Get Information about the stored rom list -/* int count; - char RecentRoms[MaxRememberedFiles][_MAX_PATH]; - Notify().BreakPoint(__FILE__,__LINE__); - for (count = 0; count < RememberedRomFilesCount; count ++ ) { - strcpy(RecentRoms[count],""); - //_Settings->LoadString((SettingID)(FirstRecentRom + count), RecentRoms[count], sizeof(RecentRoms[count])); - Notify().BreakPoint(__FILE__,__LINE__); + int MaxRememberedFiles = _Settings->LoadDword(File_RecentGameFileCount); + strlist RecentGames; + int i; + for (i = 0; i < MaxRememberedFiles; i ++ ) + { + stdstr RecentGame = _Settings->LoadStringIndex(File_RecentGameFileIndex,i); + if (RecentGame.empty()) + { + break; + } + RecentGames.push_back(RecentGame); } - //See if the Image Path is already in the list if so then move it to the top of the list - bool bFound = false; - for (count = 0; count < MaxRememberedFiles && !bFound; count ++ ) { - if (strcmp(ImagePath, RecentRoms[count]) == 0) { - if (count != 0) { - memmove(&RecentRoms[1],&RecentRoms[0],sizeof(RecentRoms[0]) * count); - } - bFound = true; + //See if the dir is already in the list if so then move it to the top of the list + strlist::iterator iter; + for (iter = RecentGames.begin(); iter != RecentGames.end(); iter++) + { + if (_stricmp(ImagePath,iter->c_str()) != 0) + { + continue; } + RecentGames.erase(iter); + break; } - if (bFound == false) { - memmove(&RecentRoms[1],&RecentRoms[0],sizeof(RecentRoms[0]) * (MaxRememberedFiles - 1)); + RecentGames.push_front(ImagePath); + if (RecentGames.size() > MaxRememberedFiles) + { + RecentGames.pop_back(); } - //Copy the image path to the list - strncpy(RecentRoms[0],ImagePath,sizeof(RecentRoms[0])); - RecentRoms[0][_MAX_PATH - 1] = 0; //Make sure it it is null terminated - - Notify().BreakPoint(__FILE__,__LINE__); - for (count = 0; count < MaxRememberedFiles; count ++ ) { - // _Settings->SaveString((SettingID)(FirstRecentRom + count), RecentRoms[count]); - }*/ - Notify().BreakPoint(__FILE__,__LINE__); + for (i = 0, iter = RecentGames.begin(); iter != RecentGames.end(); iter++, i++) + { + _Settings->SaveStringIndex(File_RecentGameFileIndex,i,*iter); + } } void CNotification::RefreshMenu ( void ) { @@ -215,7 +245,7 @@ void CNotification::HideRomBrowser ( void ) { void CNotification::ShowRomBrowser ( void ) { if (_hWnd == NULL) { return; } - if (_Settings->LoadDword(RomBrowser)) { + if (_Settings->LoadDword(RomBrowser_Enabled)) { //Display the rom browser _hWnd->ShowRomList(); _hWnd->HighLightLastRom(); @@ -232,13 +262,14 @@ void CNotification::MakeWindowOnTop ( bool OnTop ) { _hWnd->MakeWindowOnTop(OnTop); } -void CNotification::ChangeFullScreen ( void ) +void CNotification::ChangeFullScreen ( void ) const { if (_hWnd == NULL) { return; } SendMessage((HWND)(_hWnd->GetHandle()),WM_COMMAND,MAKELPARAM(ID_OPTIONS_FULLSCREEN2,false),0); } -bool CNotification::ProcessGuiMessages ( void ) { +bool CNotification::ProcessGuiMessages ( void ) const +{ if (_hWnd == NULL) { return false; } return _hWnd->ProcessGuiMessages(); } diff --git a/Source/Project64/User Interface/Notification Class.h b/Source/Project64/User Interface/Notification Class.h index 331190315..dc62974b6 100644 --- a/Source/Project64/User Interface/Notification Class.h +++ b/Source/Project64/User Interface/Notification Class.h @@ -12,12 +12,13 @@ class CNotification : CGfxPlugin * _gfxPlugin; mutable time_t m_NextMsg; - - enum { MaxRememberedDirs = 10 }; public: CNotification ( void ); + // Make sure we are not in full screen + void WindowMode ( void ) const; + //Error Messages void DisplayError ( const char * Message, ... ) const; void DisplayError ( const char * Message, va_list ap ) const; @@ -50,8 +51,8 @@ public: void MakeWindowOnTop ( bool OnTop ); void BringToTop ( void ); void BreakPoint ( const char * File, const int LineNumber); - bool ProcessGuiMessages ( void ); - void ChangeFullScreen ( void ); + bool ProcessGuiMessages ( void ) const; + void ChangeFullScreen ( void ) const; void SetGfxPlugin ( CGfxPlugin * Plugin ); }; diff --git a/Source/Project64/User Interface/Rom Browser Class.cpp b/Source/Project64/User Interface/Rom Browser Class.cpp index 5f026fb14..f89f94f2a 100644 --- a/Source/Project64/User Interface/Rom Browser Class.cpp +++ b/Source/Project64/User Interface/Rom Browser Class.cpp @@ -24,10 +24,10 @@ CRomBrowser::CRomBrowser (WND_HANDLE & MainWindow, WND_HANDLE & StatusWindow, CN m_Plugins(NULL) { if (_Settings) { - m_RomIniFile = new CIniFile(_Settings->LoadString(RomDatabaseFile).c_str()); - m_NotesIniFile = new CIniFile(_Settings->LoadString(NotesIniName).c_str()); - m_ExtIniFile = new CIniFile(_Settings->LoadString(ExtIniName).c_str()); - m_ZipIniFile = new CIniFile(_Settings->LoadString(ZipCacheIniName).c_str()); + m_RomIniFile = new CIniFile(_Settings->LoadString(SupportFile_RomDatabase).c_str()); + m_NotesIniFile = new CIniFile(_Settings->LoadString(SupportFile_Notes).c_str()); + m_ExtIniFile = new CIniFile(_Settings->LoadString(SupportFile_ExtInfo).c_str()); + m_ZipIniFile = new CIniFile(_Settings->LoadString(SupportFile_7zipCache).c_str()); } _System = System; @@ -36,41 +36,8 @@ CRomBrowser::CRomBrowser (WND_HANDLE & MainWindow, WND_HANDLE & StatusWindow, CN m_WatchThread = NULL; m_WatchStopEvent = NULL; - -#define AddField(Name,Pos,ID,Width,LangID) m_Fields.push_back(ROMBROWSER_FIELDS(Name,Pos,ID,Width,LangID)); - - AddField("File Name", -1, RB_FileName, 218,RB_FILENAME); - AddField("Internal Name", -1, RB_InternalName, 200,RB_INTERNALNAME); - AddField("Good Name", 0, RB_GoodName, 218,RB_GOODNAME); - AddField("Status", 1, RB_Status, 92, RB_STATUS); - AddField("Rom Size", -1, RB_RomSize, 100,RB_ROMSIZE); - AddField("Notes (Core)", 2, RB_CoreNotes, 120,RB_NOTES_CORE); - AddField("Notes (default plugins)", 3, RB_PluginNotes, 188,RB_NOTES_PLUGIN); - AddField("Notes (User)", -1, RB_UserNotes, 100,RB_NOTES_USER); - AddField("Cartridge ID", -1, RB_CartridgeID, 100,RB_CART_ID); - AddField("Manufacturer", -1, RB_Manufacturer, 100,RB_MANUFACTUER,); - AddField("Country", -1, RB_Country, 100,RB_COUNTRY,); - AddField("Developer", -1, RB_Developer, 100,RB_DEVELOPER,); - AddField("CRC1", -1, RB_Crc1, 100,RB_CRC1,); - AddField("CRC2", -1, RB_Crc2, 100,RB_CRC2,); - AddField("CIC Chip", -1, RB_CICChip, 100,RB_CICCHIP,); - AddField("Release Date", -1, RB_ReleaseDate, 100,RB_RELEASE_DATE,); - AddField("Genre", -1, RB_Genre, 100,RB_GENRE,); - AddField("Players", -1, RB_Players, 100,RB_PLAYERS); - AddField("Force Feedback", -1, RB_ForceFeedback, 100,RB_FORCE_FEEDBACK); - AddField("File Format", -1, RB_FileFormat, 100,RB_FILE_FORMAT); - -#undef AddField - m_FieldType.resize(m_Fields.size()); - - if (_Settings == NULL) { return; } - - //Load the real positions from the settings - for (int Field = 0; Field < m_Fields.size(); Field++) - { - _Settings->LoadDwordIndex(RomBrowserPosIndex,Field,(DWORD &)m_Fields[Field].Pos ); - _Settings->LoadDwordIndex(RomBrowserWidthIndex,Field,(DWORD &)m_Fields[Field].ColWidth); - } + GetFieldInfo(m_Fields); + m_FieldType.resize(m_Fields.size()); } CRomBrowser::~CRomBrowser (void){ @@ -100,6 +67,37 @@ CRomBrowser::~CRomBrowser (void){ } } +void CRomBrowser::AddField (ROMBROWSER_FIELDS_LIST & Fields, LPCSTR Name, int Pos,int ID,int Width,LanguageStringID LangID, bool UseDefault) +{ + Fields.push_back(ROMBROWSER_FIELDS(Name,Pos,ID,Width,LangID,UseDefault)); +} + +void CRomBrowser::GetFieldInfo ( ROMBROWSER_FIELDS_LIST & Fields, bool UseDefault /* = false */) +{ + Fields.clear(); + + AddField(Fields,"File Name", -1, RB_FileName, 218,RB_FILENAME, UseDefault); + AddField(Fields,"Internal Name", -1, RB_InternalName, 200,RB_INTERNALNAME, UseDefault); + AddField(Fields,"Good Name", 0, RB_GoodName, 218,RB_GOODNAME, UseDefault); + AddField(Fields,"Status", 1, RB_Status, 92, RB_STATUS, UseDefault); + AddField(Fields,"Rom Size", -1, RB_RomSize, 100,RB_ROMSIZE, UseDefault); + AddField(Fields,"Notes (Core)", 2, RB_CoreNotes, 120,RB_NOTES_CORE, UseDefault); + AddField(Fields,"Notes (default plugins)", 3, RB_PluginNotes, 188,RB_NOTES_PLUGIN, UseDefault); + AddField(Fields,"Notes (User)", -1, RB_UserNotes, 100,RB_NOTES_USER, UseDefault); + AddField(Fields,"Cartridge ID", -1, RB_CartridgeID, 100,RB_CART_ID, UseDefault); + AddField(Fields,"Manufacturer", -1, RB_Manufacturer, 100,RB_MANUFACTUER, UseDefault); + AddField(Fields,"Country", -1, RB_Country, 100,RB_COUNTRY, UseDefault); + AddField(Fields,"Developer", -1, RB_Developer, 100,RB_DEVELOPER, UseDefault); + AddField(Fields,"CRC1", -1, RB_Crc1, 100,RB_CRC1, UseDefault); + AddField(Fields,"CRC2", -1, RB_Crc2, 100,RB_CRC2, UseDefault); + AddField(Fields,"CIC Chip", -1, RB_CICChip, 100,RB_CICCHIP, UseDefault); + AddField(Fields,"Release Date", -1, RB_ReleaseDate, 100,RB_RELEASE_DATE, UseDefault); + AddField(Fields,"Genre", -1, RB_Genre, 100,RB_GENRE, UseDefault); + AddField(Fields,"Players", -1, RB_Players, 100,RB_PLAYERS, UseDefault); + AddField(Fields,"Force Feedback", -1, RB_ForceFeedback, 100,RB_FORCE_FEEDBACK, UseDefault); + AddField(Fields,"File Format", -1, RB_FileFormat, 100,RB_FILE_FORMAT, UseDefault); +} + int CRomBrowser::CalcSortPosition (DWORD lParam) { int Start = 0; @@ -112,7 +110,7 @@ int CRomBrowser::CalcSortPosition (DWORD lParam) int count; for (count = NoOfSortKeys; count >= 0; count --) { - stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowserSortFieldIndex,count); + stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowser_SortFieldIndex,count); if (SortFieldName.length() == 0) { continue; @@ -124,14 +122,15 @@ int CRomBrowser::CalcSortPosition (DWORD lParam) } int index; - for (index = 0; index < m_Fields.size(); index++) { - if (_stricmp(m_Fields[index].Name,SortFieldName.c_str()) == 0) { break; } + for (index = 0; index < m_Fields.size(); index++) + { + if (_stricmp(m_Fields[index].Name(),SortFieldName.c_str()) == 0) { break; } } if (index >= m_Fields.size()) { continue; } SORT_FIELD SortFieldInfo; SortFieldInfo._this = this; SortFieldInfo.Key = index; - SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowserSortAscendingIndex,count); + SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowser_SortAscendingIndex,count); //calc new start and end int LastTestPos = -1; @@ -248,7 +247,7 @@ int CRomBrowser::CalcSortPosition (DWORD lParam) //Compare end with item to see if we should do it after or before it for (count = 0; count < NoOfSortKeys; count ++) { - stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowserSortFieldIndex,count); + stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowser_SortFieldIndex,count); if (SortFieldName.length() == 0) { continue; @@ -256,13 +255,13 @@ int CRomBrowser::CalcSortPosition (DWORD lParam) int index; for (index = 0; index < m_Fields.size(); index++) { - if (_stricmp(m_Fields[index].Name,SortFieldName.c_str()) == 0) { break; } + if (_stricmp(m_Fields[index].Name(),SortFieldName.c_str()) == 0) { break; } } if (index >= m_Fields.size()) { continue; } SORT_FIELD SortFieldInfo; SortFieldInfo._this = this; SortFieldInfo.Key = index; - SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowserSortAscendingIndex,count) != 0; + SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowser_SortAscendingIndex,count) != 0; LV_ITEM lvItem; memset(&lvItem, 0, sizeof(LV_ITEM)); @@ -409,36 +408,36 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo) { sprintf(Identifier,"%08X-%08X-C:%X",pRomInfo->CRC1,pRomInfo->CRC2,pRomInfo->Country); //Rom Notes - if (m_Fields[RB_UserNotes].Pos >= 0) { + if (m_Fields[RB_UserNotes].Pos() >= 0) { m_NotesIniFile->GetString(Identifier,"Note","",pRomInfo->UserNotes,sizeof(pRomInfo->UserNotes)); } //Rom Extension info - if (m_Fields[RB_Developer].Pos >= 0) { + if (m_Fields[RB_Developer].Pos() >= 0) { m_ExtIniFile->GetString(Identifier,"Developer","",pRomInfo->Developer,sizeof(pRomInfo->Developer)); } - if (m_Fields[RB_ReleaseDate].Pos >= 0) { + if (m_Fields[RB_ReleaseDate].Pos() >= 0) { m_ExtIniFile->GetString(Identifier,"ReleaseDate","",pRomInfo->ReleaseDate,sizeof(pRomInfo->ReleaseDate)); } - if (m_Fields[RB_Genre].Pos >= 0) { + if (m_Fields[RB_Genre].Pos() >= 0) { m_ExtIniFile->GetString(Identifier,"Genre","",pRomInfo->Genre,sizeof(pRomInfo->Genre)); } - if (m_Fields[RB_Players].Pos >= 0) { + if (m_Fields[RB_Players].Pos() >= 0) { m_ExtIniFile->GetNumber(Identifier,"Players",1,(DWORD &)pRomInfo->Players); } - if (m_Fields[RB_ForceFeedback].Pos >= 0) { + if (m_Fields[RB_ForceFeedback].Pos() >= 0) { m_ExtIniFile->GetString(Identifier,"ForceFeedback","unknown",pRomInfo->ForceFeedback,sizeof(pRomInfo->ForceFeedback)); } //Rom Settings - if (m_Fields[RB_GoodName].Pos >= 0) { + if (m_Fields[RB_GoodName].Pos() >= 0) { m_RomIniFile->GetString(Identifier,"Good Name",pRomInfo->GoodName,pRomInfo->GoodName,sizeof(pRomInfo->GoodName)); } m_RomIniFile->GetString(Identifier,"Status",pRomInfo->Status,pRomInfo->Status,sizeof(pRomInfo->Status)); - if (m_Fields[RB_CoreNotes].Pos >= 0) { + if (m_Fields[RB_CoreNotes].Pos() >= 0) { m_RomIniFile->GetString(Identifier,"Core Note","",pRomInfo->CoreNotes,sizeof(pRomInfo->CoreNotes)); } - if (m_Fields[RB_PluginNotes].Pos >= 0) { + if (m_Fields[RB_PluginNotes].Pos() >= 0) { m_RomIniFile->GetString(Identifier,"Plugin Note","",pRomInfo->PluginNotes,sizeof(pRomInfo->PluginNotes)); } @@ -486,7 +485,7 @@ bool CRomBrowser::FillRomInfo2(ROM_INFO * pRomInfo, BYTE * RomData, DWORD RomDat char drive[_MAX_DRIVE] ,dir[_MAX_DIR], ext[_MAX_EXT]; _splitpath( pRomInfo->szFullFileName, drive, dir, pRomInfo->FileName, ext ); } - if (m_Fields[RB_InternalName].Pos >= 0) { + if (m_Fields[RB_InternalName].Pos() >= 0) { memcpy(pRomInfo->InternalName,(void *)(RomData + 0x20),20); for( count = 0 ; count < 20; count += 4 ) { pRomInfo->InternalName[count] ^= pRomInfo->InternalName[count+3]; @@ -537,7 +536,7 @@ void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, st if (SearchPath.IsDirectory()) { - if (_Settings->LoadDword(RomBrowserRecursive)) + if (_Settings->LoadDword(RomBrowser_Recursive)) { stdstr CurrentDir = Directory + SearchPath.GetCurrentDirectory() + "\\"; GetRomFileNames(FileList,BaseDirectory,CurrentDir,InWatchThread); @@ -591,7 +590,7 @@ void CRomBrowser::FillRomList ( strlist & FileList, CPath & BaseDirectory, stdst if (SearchPath.IsDirectory()) { - if (_Settings->LoadDword(RomBrowserRecursive)) + if (_Settings->LoadDword(RomBrowser_Recursive)) { stdstr CurrentDir = Directory + SearchPath.GetCurrentDirectory() + "\\"; FillRomList(FileList,BaseDirectory,CurrentDir,lpLastRom); @@ -751,7 +750,7 @@ void CRomBrowser::HighLightLastRom(void) { if (!RomBrowserVisible()) { return; } //Get the string to the last rom - stdstr LastRom = _Settings->LoadStringIndex(RecentRomFileIndex,0); + stdstr LastRom = _Settings->LoadStringIndex(File_RecentGameFileIndex,0); LPCSTR lpLastRom = LastRom.c_str(); LV_ITEM lvItem; @@ -897,7 +896,7 @@ void CRomBrowser::ByteSwapRomData (BYTE * Data, int DataLen) } void CRomBrowser::LoadRomList (void) { - stdstr FileName = _Settings->LoadString(RomListCache); + stdstr FileName = _Settings->LoadString(SupportFile_RomListCache); //Open the cache file HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); @@ -988,7 +987,7 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this) if (_this->m_hRomList == NULL) { return; } //delete cache - stdstr CacheFileName = _Settings->LoadString(RomListCache); + stdstr CacheFileName = _Settings->LoadString(SupportFile_RomListCache); DeleteFile(CacheFileName.c_str()); //clear all current items @@ -1001,7 +1000,7 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this) Sleep(100); WriteTrace(TraceDebug,"CRomBrowser::RefreshRomBrowserStatic 3"); - if (_this->m_WatchRomDir != _Settings->LoadString(RomDirectory)) + if (_this->m_WatchRomDir != _Settings->LoadString(Directory_Game)) { WriteTrace(TraceDebug,"CRomBrowser::RefreshRomBrowserStatic 4"); _this->WatchThreadStop(); @@ -1011,8 +1010,8 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this) } WriteTrace(TraceDebug,"CRomBrowser::RefreshRomBrowserStatic 7"); - stdstr RomDir = _Settings->LoadString(RomDirectory); - stdstr LastRom = _Settings->LoadStringIndex(RecentRomFileIndex,0); + stdstr RomDir = _Settings->LoadString(Directory_Game); + stdstr LastRom = _Settings->LoadStringIndex(File_RecentGameFileIndex,0); WriteTrace(TraceDebug,"CRomBrowser::RefreshRomBrowserStatic 8"); strlist FileNames; @@ -1038,6 +1037,8 @@ void CRomBrowser::ResetRomBrowserColomuns (void) { LV_COLUMN lvColumn; char szString[300]; + GetFieldInfo(m_Fields); + //Remove all current coloumns memset(&lvColumn,0,sizeof(lvColumn)); lvColumn.mask = LVCF_FMT; @@ -1052,24 +1053,24 @@ void CRomBrowser::ResetRomBrowserColomuns (void) { for (Coloumn = 0; Coloumn < m_Fields.size(); Coloumn ++) { for (index = 0; index < m_Fields.size(); index ++) { - if (m_Fields[index].Pos == Coloumn) { break; } + if (m_Fields[index].Pos() == Coloumn) { break; } } - if (index == m_Fields.size() || m_Fields[index].Pos != Coloumn) { + if (index == m_Fields.size() || m_Fields[index].Pos() != Coloumn) { m_FieldType[Coloumn] = -1; break; } - m_FieldType[Coloumn] = m_Fields[index].ID; - lvColumn.cx = m_Fields[index].ColWidth; - strncpy(szString, GS(m_Fields[index].LangID), sizeof(szString)); + m_FieldType[Coloumn] = m_Fields[index].ID(); + lvColumn.cx = m_Fields[index].ColWidth(); + strncpy(szString, GS(m_Fields[index].LangID()), sizeof(szString)); ListView_InsertColumn((HWND)m_hRomList, Coloumn, &lvColumn); } } void CRomBrowser::ResizeRomList (WORD nWidth, WORD nHeight) { if (RomBrowserVisible()) { - if (_Settings->LoadDword(RomBrowserMaximized) == 0 && nHeight != 0) { - _Settings->SaveDword(RomBrowserWidth,nWidth); - _Settings->SaveDword(RomBrowserHeight,nHeight); + if (_Settings->LoadDword(RomBrowser_Maximized) == 0 && nHeight != 0) { + _Settings->SaveDword(RomBrowser_Width,nWidth); + _Settings->SaveDword(RomBrowser_Height,nHeight); } if (IsWindow((HWND)m_StatusWindow)) { RECT rc; @@ -1094,7 +1095,7 @@ void CRomBrowser::RomBrowserToTop(void) { } void CRomBrowser::RomBrowserMaximize(bool Mazimize) { - _Settings->SaveDword(RomBrowserMaximized,(DWORD)Mazimize); + _Settings->SaveDword(RomBrowser_Maximized,(DWORD)Mazimize); } bool CRomBrowser::RomListDrawItem(int idCtrl, DWORD lParam) { @@ -1187,20 +1188,20 @@ void CRomBrowser::RomList_ColoumnSortList(DWORD pnmh) { int index; for (index = 0; index < m_Fields.size(); index++) { - if (m_Fields[index].Pos == pnmv->iSubItem) { break; } + if (m_Fields[index].Pos() == pnmv->iSubItem) { break; } } if (m_Fields.size() == index) { return; } - if (_stricmp(_Settings->LoadStringIndex(RomBrowserSortFieldIndex,0).c_str(),m_Fields[index].Name) == 0) { - _Settings->SaveBoolIndex(RomBrowserSortAscendingIndex,0,!_Settings->LoadBoolIndex(RomBrowserSortAscendingIndex,0)); + if (_stricmp(_Settings->LoadStringIndex(RomBrowser_SortFieldIndex,0).c_str(),m_Fields[index].Name()) == 0) { + _Settings->SaveBoolIndex(RomBrowser_SortAscendingIndex,0,!_Settings->LoadBoolIndex(RomBrowser_SortAscendingIndex,0)); } else { int count; for (count = NoOfSortKeys; count > 0; count --) { - _Settings->SaveStringIndex(RomBrowserSortFieldIndex,count,_Settings->LoadStringIndex(RomBrowserSortFieldIndex,count - 1).c_str()); - _Settings->SaveBoolIndex(RomBrowserSortAscendingIndex,count,_Settings->LoadBoolIndex(RomBrowserSortAscendingIndex, count - 1)); + _Settings->SaveStringIndex(RomBrowser_SortFieldIndex,count,_Settings->LoadStringIndex(RomBrowser_SortFieldIndex,count - 1).c_str()); + _Settings->SaveBoolIndex(RomBrowser_SortAscendingIndex,count,_Settings->LoadBoolIndex(RomBrowser_SortAscendingIndex, count - 1)); } - _Settings->SaveStringIndex(RomBrowserSortFieldIndex,0,m_Fields[index].Name); - _Settings->SaveBoolIndex(RomBrowserSortAscendingIndex,0,true); + _Settings->SaveStringIndex(RomBrowser_SortFieldIndex,0,m_Fields[index].Name()); + _Settings->SaveBoolIndex(RomBrowser_SortAscendingIndex,0,true); } RomList_SortList(); } @@ -1390,8 +1391,8 @@ void CRomBrowser::RomList_PopupMenu(DWORD pnmh) { DeleteMenu((HMENU)hPopupMenu,1,MF_BYPOSITION); DeleteMenu((HMENU)hPopupMenu,0,MF_BYPOSITION); } else { - bool inBasicMode = _Settings->LoadDword(BasicMode) != 0; - bool CheatsRemembered = _Settings->LoadDword(RememberCheats) != 0; + bool inBasicMode = _Settings->LoadDword(UserInterface_BasicMode) != 0; + bool CheatsRemembered = _Settings->LoadDword(Setting_RememberCheats) != 0; if (!CheatsRemembered) { DeleteMenu((HMENU)hPopupMenu,9,MF_BYPOSITION); } if (inBasicMode) { DeleteMenu((HMENU)hPopupMenu,8,MF_BYPOSITION); } if (inBasicMode && !CheatsRemembered) { DeleteMenu((HMENU)hPopupMenu,7,MF_BYPOSITION); } @@ -1424,16 +1425,16 @@ void CRomBrowser::RomList_SortList(void) { SORT_FIELD SortFieldInfo; for (int count = NoOfSortKeys; count >= 0; count --) { - stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowserSortFieldIndex,count); + stdstr SortFieldName = _Settings->LoadStringIndex(RomBrowser_SortFieldIndex,count); int index; for (index = 0; index < m_Fields.size(); index++) { - if (_stricmp(m_Fields[index].Name,SortFieldName.c_str()) == 0) { break; } + if (_stricmp(m_Fields[index].Name(),SortFieldName.c_str()) == 0) { break; } } if (index >= m_Fields.size()) { continue; } SortFieldInfo._this = this; SortFieldInfo.Key = index; - SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowserSortAscendingIndex,count) != 0; + SortFieldInfo.KeyAscend = _Settings->LoadBoolIndex(RomBrowser_SortAscendingIndex,count) != 0; ListView_SortItems((HWND)m_hRomList, RomList_CompareItems, &SortFieldInfo ); } } @@ -1453,7 +1454,7 @@ void CRomBrowser::SaveRomList ( strlist & FileList ) WriteTraceF(TraceDebug,"SaveRomList: %s",FileList.c_str()); MD5 md5((const unsigned char *)FileList.c_str(), FileList.length()); */ - stdstr FileName = _Settings->LoadString(RomListCache); + stdstr FileName = _Settings->LoadString(SupportFile_RomListCache); HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); DWORD dwWritten; @@ -1489,18 +1490,14 @@ void CRomBrowser::SaveRomListColoumnInfo(void) { for (int Coloumn = 0;ListView_GetColumn((HWND)m_hRomList,Coloumn,&lvColumn); Coloumn++) { for (int index = 0; index < m_Fields.size(); index++) { - if (m_Fields[index].Pos == Coloumn) { break; } + if (m_Fields[index].Pos() == Coloumn) { break; } + } + if (m_Fields[index].ColWidth() != lvColumn.cx) + { + m_Fields[index].SetColWidth(lvColumn.cx); } - m_Fields[index].ColWidth = lvColumn.cx; } - - //Save the real positions from the settings - WriteTrace(TraceDebug,"SaveRomListColoumnInfo - Update Settings"); - for (int Field = 0; Field < m_Fields.size(); Field++) { - _Settings->SaveDwordIndex(RomBrowserPosIndex,Field,m_Fields[Field].Pos ); - _Settings->SaveDwordIndex(RomBrowserWidthIndex,Field,m_Fields[Field].ColWidth); - } - WriteTrace(TraceDebug,"SaveRomListColoumnInfo - End"); + WriteTrace(TraceDebug,"SaveRomListColoumnInfo - Done"); } int CALLBACK CRomBrowser::SelectRomDirCallBack(WND_HANDLE hwnd,DWORD uMsg,DWORD lp, DWORD lpData) { @@ -1524,7 +1521,7 @@ void CRomBrowser::SelectRomDir(CNotification * Notify) { BROWSEINFO bi; WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 1"); - stdstr RomDir = _Settings->LoadString(RomDirectory); + stdstr RomDir = _Settings->LoadString(Directory_Game); bi.hwndOwner = (HWND)m_MainWindow; bi.pidlRoot = NULL; bi.pszDisplayName = SelectedDir; @@ -1544,11 +1541,8 @@ void CRomBrowser::SelectRomDir(CNotification * Notify) { strcat(Directory,"\\"); } WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 4"); - _Settings->SaveDword(UseRomDirSelected,true); - WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 5"); - _Settings->SaveString(SelectedRomDir,Directory); WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 6"); - _Settings->SaveString(RomDirectory,Directory); + _Settings->SaveString(Directory_Game,Directory); WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 7"); Notify->AddRecentDir(Directory); WriteTrace(TraceDebug,"CRomBrowser::SelectRomDir 8"); @@ -1564,8 +1558,8 @@ void CRomBrowser::FixRomListWindow (void) { SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style); //Fix height and width - int Width = _Settings->LoadDword(RomBrowserWidth); - int Height = _Settings->LoadDword(RomBrowserHeight); + int Width = _Settings->LoadDword(RomBrowser_Width); + int Height = _Settings->LoadDword(RomBrowser_Height); if (Width < 200) { Width = 200; } if (Height < 200) { Height = 200; } @@ -1584,22 +1578,22 @@ void CRomBrowser::FixRomListWindow (void) { //Fix window location DWORD Left = (GetSystemMetrics( SM_CXSCREEN ) - rcClient.right) / 2; DWORD Top = (GetSystemMetrics( SM_CYSCREEN ) - rcClient.bottom) / 2; - _Settings->LoadDword(RomBrowserTop, Top); - _Settings->LoadDword(RomBrowserLeft,Left); + _Settings->LoadDword(RomBrowser_Top, Top); + _Settings->LoadDword(RomBrowser_Left,Left); //Change the window to the correct location and dimensions MoveWindow( (HWND)m_MainWindow, Left, Top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, TRUE ); //Make the screen maximized if it was - if (_Settings->LoadDword(RomBrowserMaximized)) { + if (_Settings->LoadDword(RomBrowser_Maximized)) { ShowWindow((HWND)m_MainWindow,SW_MAXIMIZE); } } void CRomBrowser::ShowRomList (void) { - if (_Settings->LoadBool(CPU_Running)) { return; } + if (_Settings->LoadBool(GameRunning_CPU_Running)) { return; } m_ShowingRomBrowser = true; WatchThreadStop(); FixRomListWindow(); @@ -1640,7 +1634,7 @@ void CRomBrowser::HideRomList (void) { EnableWindow((HWND)m_hRomList,FALSE); ShowWindow((HWND)m_hRomList,SW_HIDE); - if (_Settings->LoadDword(RomBrowserMaximized)) { ShowWindow((HWND)m_MainWindow,SW_RESTORE); } + if (_Settings->LoadBool(RomBrowser_Maximized)) { ShowWindow((HWND)m_MainWindow,SW_RESTORE); } //Change the window style long Style = GetWindowLong((HWND)m_MainWindow,GWL_STYLE) & ~(WS_SIZEBOX | WS_MAXIMIZEBOX); @@ -1651,8 +1645,8 @@ void CRomBrowser::HideRomList (void) { GetWindowRect((HWND)m_MainWindow,&rect); int X = (GetSystemMetrics( SM_CXSCREEN ) - (rect.right - rect.left)) / 2; int Y = (GetSystemMetrics( SM_CYSCREEN ) - (rect.bottom - rect.top)) / 2; - _Settings->LoadDword(MainWindowTop,(DWORD &)Y); - _Settings->LoadDword(MainWindowLeft,(DWORD &)X); + _Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y); + _Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X); SetWindowPos((HWND)m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE); //Mark the window as not visible @@ -1670,7 +1664,7 @@ bool CRomBrowser::RomDirNeedsRefresh ( void ) bool InWatchThread = (m_WatchThreadID == GetCurrentThreadId()); //Get Old MD5 of file names - stdstr FileName = _Settings->LoadString(RomListCache); + stdstr FileName = _Settings->LoadString(SupportFile_RomListCache); HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); if (hFile == INVALID_HANDLE_VALUE) { @@ -1685,7 +1679,7 @@ bool CRomBrowser::RomDirNeedsRefresh ( void ) //Get Current MD5 of file names strlist FileNames; - GetRomFileNames(FileNames,CPath(_Settings->LoadString(RomDirectory)),stdstr(""), InWatchThread ); + GetRomFileNames(FileNames,CPath(_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread ); FileNames.sort(); MD5 NewMd5 = RomListHash(FileNames); @@ -1714,7 +1708,7 @@ void CRomBrowser::WatchRomDirChanged ( CRomBrowser * _this ) try { WriteTrace(TraceDebug,"CRomBrowser::WatchRomDirChanged 1"); - _this->m_WatchRomDir = _Settings->LoadString(RomDirectory); + _this->m_WatchRomDir = _Settings->LoadString(Directory_Game); WriteTrace(TraceDebug,"CRomBrowser::WatchRomDirChanged 2"); if (_this->RomDirNeedsRefresh()) { @@ -1724,7 +1718,7 @@ void CRomBrowser::WatchRomDirChanged ( CRomBrowser * _this ) WriteTrace(TraceDebug,"CRomBrowser::WatchRomDirChanged 3"); HANDLE hChange[] = { _this->m_WatchStopEvent, - FindFirstChangeNotification(_this->m_WatchRomDir.c_str(),_Settings->LoadDword(RomBrowserRecursive),FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE), + FindFirstChangeNotification(_this->m_WatchRomDir.c_str(),_Settings->LoadDword(RomBrowser_Recursive),FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE), }; WriteTrace(TraceDebug,"CRomBrowser::WatchRomDirChanged 4"); for (;;) @@ -1804,8 +1798,8 @@ void CRomBrowser::WatchThreadStop( void ) void CRomBrowser::Store7ZipInfo (CSettings * Settings, C7zip & ZipFile, int FileNo ) { - // if we have infomation about this file already then leave this function - CIniFile zipInfo(Settings->LoadString(ZipCacheIniName).c_str()); + // if we have information about this file already then leave this function + CIniFile zipInfo(Settings->LoadString(SupportFile_7zipCache).c_str()); CFileItem * cf = ZipFile.FileItem(FileNo); char FileName[260]; @@ -1843,7 +1837,7 @@ void CRomBrowser::Store7ZipInfo (CSettings * Settings, C7zip & ZipFile, int File } //delete cache - stdstr CacheFileName = Settings->LoadString(RomListCache); + stdstr CacheFileName = Settings->LoadString(SupportFile_RomListCache); DeleteFile(CacheFileName.c_str()); } diff --git a/Source/Project64/User Interface/Rom Browser.h b/Source/Project64/User Interface/Rom Browser.h index 6524476e3..8d9ac3341 100644 --- a/Source/Project64/User Interface/Rom Browser.h +++ b/Source/Project64/User Interface/Rom Browser.h @@ -5,20 +5,54 @@ class CNotification; class CPlugins; class ROMBROWSER_FIELDS { + stdstr m_Name; + int m_Pos, m_DefaultPos; + int m_ID; + ULONG m_ColWidth; + LanguageStringID m_LangID; + bool m_PosChanged; + public: - ROMBROWSER_FIELDS (char * Name, int Pos, int ID, int ColWidth, LanguageStringID LangID) { - strncpy(this->Name,Name,sizeof(this->Name)); - this->Name[sizeof(this->Name) - 1] = 0; - this->Pos = Pos; - this->ID = ID; - this->ColWidth = ColWidth; - this->LangID = LangID; + ROMBROWSER_FIELDS (const char * Name, int Pos, int ID, int ColWidth, LanguageStringID LangID, bool UseDefault) : + m_Name(Name), + m_Pos(Pos), + m_DefaultPos(Pos), + m_ID(ID), + m_ColWidth(ColWidth), + m_LangID(LangID), + m_PosChanged(false) + + { + if (!UseDefault) + { + m_PosChanged = _Settings->LoadDwordIndex(RomBrowser_PosIndex,m_ID,(ULONG &)m_Pos ); + _Settings->LoadDwordIndex(RomBrowser_WidthIndex,m_ID,m_ColWidth); + } + } + inline LPCSTR Name ( void ) const { return m_Name.c_str(); } + inline int Pos ( void ) const { return m_Pos; } + inline bool PosChanged ( void ) const { return m_PosChanged; } + inline int ID ( void ) const { return m_ID; } + inline int ColWidth ( void ) const { return m_ColWidth; } + inline LanguageStringID LangID ( void ) const { return m_LangID; } + + void SetColWidth ( int ColWidth ) + { + m_ColWidth = ColWidth; + _Settings->SaveDwordIndex(RomBrowser_WidthIndex,m_ID,m_ColWidth); + } + void SetColPos ( int Pos) + { + m_Pos = Pos; + _Settings->SaveDwordIndex(RomBrowser_PosIndex,m_ID,m_Pos); + m_PosChanged = true; + } + void ResetPos ( void ) + { + m_Pos = m_DefaultPos; + _Settings->DeleteSettingIndex(RomBrowser_PosIndex,m_ID); + m_PosChanged = false; } - char Name[50]; - int Pos; - int ID; - int ColWidth; - LanguageStringID LangID; }; typedef std::vector ROMBROWSER_FIELDS_LIST; @@ -143,13 +177,12 @@ class CRomBrowser { bool RomDirNeedsRefresh ( void ); // Called from watch thread static void WatchRomDirChanged ( CRomBrowser * _this ); static void RefreshRomBrowserStatic ( CRomBrowser * _this ); + static void AddField (ROMBROWSER_FIELDS_LIST & Fields, LPCSTR Name, int Pos,int ID,int Width,LanguageStringID LangID, bool UseDefault); //Callback static int CALLBACK SelectRomDirCallBack ( WND_HANDLE hwnd,DWORD uMsg,DWORD lp, DWORD lpData ); static int CALLBACK RomList_CompareItems ( DWORD lParam1, DWORD lParam2, DWORD lParamSort ); - //needs to access internal information for configuration - friend int CALLBACK RomBrowserConfigProc ( DWORD, DWORD, DWORD, DWORD ); public: CRomBrowser ( WND_HANDLE & hMainWindow, WND_HANDLE & StatusWindow, CNotification * Notify, CN64System * System ); ~CRomBrowser ( void ); @@ -170,4 +203,6 @@ public: LPCSTR CurrentedSelectedRom ( void ) { return m_SelectedRom.c_str(); } void SetPluginList ( CPlugins * Plugins); static void Store7ZipInfo ( CSettings * Settings, C7zip & ZipFile, int FileNo ); + + static void GetFieldInfo ( ROMBROWSER_FIELDS_LIST & Fields, bool UseDefault = false ); }; \ No newline at end of file diff --git a/Source/Project64/User Interface/Settings Config.cpp b/Source/Project64/User Interface/Settings Config.cpp index e07973f5c..84bd257a2 100644 --- a/Source/Project64/User Interface/Settings Config.cpp +++ b/Source/Project64/User Interface/Settings Config.cpp @@ -4,7 +4,8 @@ CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) : - m_CurrentPage(NULL) + m_CurrentPage(NULL), + m_GameConfig(bJustGameSetting) { } @@ -24,24 +25,62 @@ void CSettingConfig::Display(void * ParentWindow) LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - stdstr_f ConfigRomTitle("Config: %s",_Settings->LoadString(ROM_GoodName).c_str()); - + stdstr ConfigRomTitle, GameIni(_Settings->LoadString(Game_IniKey)); + + if (!GameIni.empty()) + { + ConfigRomTitle.Format("Config: %s",_Settings->LoadString(Game_GoodName).c_str()); + } + RECT rcSettingInfo; ::GetWindowRect(GetDlgItem(IDC_SETTING_INFO),&rcSettingInfo); ::MapWindowPoints(NULL,m_hWnd,(LPPOINT)&rcSettingInfo,2); - + CConfigSettingSection * SettingsSection; + + if (m_GameConfig) + { + SetWindowText(ConfigRomTitle.c_str()); + } else { + SetWindowText(GS(OPTIONS_TITLE)); + + SettingsSection = new CConfigSettingSection(GS(TAB_OPTIONS)); + SettingsSection->AddPage(new CGeneralOptionsPage(this->m_hWnd,rcSettingInfo )); + SettingsSection->AddPage(new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo )); + SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd,rcSettingInfo )); + m_Sections.push_back(SettingsSection); + + SettingsSection = new CConfigSettingSection(GS(TAB_ROMSELECTION)); + SettingsSection->AddPage(new COptionsGameBrowserPage(this->m_hWnd,rcSettingInfo )); + m_Sections.push_back(SettingsSection); + + SettingsSection = new CConfigSettingSection(GS(TAB_SHORTCUTS)); + SettingsSection->AddPage(new COptionsShortCutsPage(this->m_hWnd,rcSettingInfo )); + m_Sections.push_back(SettingsSection); + + SettingsSection = new CConfigSettingSection(GS(TAB_PLUGIN)); + SettingsSection->AddPage(new COptionPluginPage(this->m_hWnd,rcSettingInfo )); + m_Sections.push_back(SettingsSection); + } + //Game Settings - CConfigSettingSection * GameSettings = new CConfigSettingSection(ConfigRomTitle.c_str()); - m_Sections.push_back(GameSettings); - GameSettings->AddPage(new CGameGeneralPage(this->m_hWnd,rcSettingInfo )); - GameSettings->AddPage(new CGameRecompilePage(this->m_hWnd,rcSettingInfo )); - GameSettings->AddPage(new CGamePluginPage(this->m_hWnd,rcSettingInfo )); - GameSettings->AddPage(new CGameStatusPage(this->m_hWnd,rcSettingInfo )); + if (!GameIni.empty()) + { + CConfigSettingSection * GameSettings = new CConfigSettingSection(ConfigRomTitle.c_str()); + GameSettings->AddPage(new CGameGeneralPage(this->m_hWnd,rcSettingInfo )); + GameSettings->AddPage(new CGameRecompilePage(this->m_hWnd,rcSettingInfo )); + GameSettings->AddPage(new CGamePluginPage(this->m_hWnd,rcSettingInfo )); + if (_Settings->LoadBool(Setting_RdbEditor)) + { + GameSettings->AddPage(new CGameStatusPage(this->m_hWnd,rcSettingInfo )); + } + m_Sections.push_back(GameSettings); + } m_PagesTreeList.Attach(GetDlgItem(IDC_PAGELIST)); + bool bFirstItem = true; for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++) { CConfigSettingSection * Section = *iter; @@ -52,7 +91,8 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* CSettingsPage * Page = Section->GetPage(i); if (i == 0) { - hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,Section->GetPageTitle(),0,0,0,0,(ULONG)Page,TVI_ROOT,TVI_LAST); + hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,Section->GetPageTitle(),0,0,0,0,(ULONG)Page,TVI_ROOT,TVI_LAST); + continue; } if (hSectionItem == NULL) { @@ -60,7 +100,15 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* } m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,GS(Page->PageTitle()),0,0,0,0,(ULONG)Page,hSectionItem,TVI_LAST); } + if (bFirstItem && hSectionItem != NULL) + { + bFirstItem = false; + m_PagesTreeList.Expand(hSectionItem); + m_PagesTreeList.SelectItem(hSectionItem); + } } + + BoldChangedPages(m_PagesTreeList.GetRootItem()); return TRUE; } @@ -68,13 +116,62 @@ LRESULT CSettingConfig::OnClicked (WORD wNotifyCode, WORD wID, HWND , BOOL& bHan { switch(wID) { + case IDAPPLY: + ApplySettings(true); + break; + case IDOK: + ApplySettings(false); + EndDialog(1); + break; case IDCANCEL: EndDialog(0); + break; + case IDC_RESET: + if (m_CurrentPage) + { + m_CurrentPage->ResetPage(); + } + break; + case IDC_RESET_ALL: + for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++) + { + CConfigSettingSection * Section = *iter; + + for (int i = 0; i < Section->GetPageCount(); i++ ) + { + CSettingsPage * Page = Section->GetPage(i); + if (Page->EnableReset()) + { + Page->ResetPage(); + } + } + } + break; } return FALSE; } +void CSettingConfig::ApplySettings( bool UpdateScreen ) +{ + for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++) + { + CConfigSettingSection * Section = *iter; + + for (int i = 0; i < Section->GetPageCount(); i++ ) + { + CSettingsPage * Page = Section->GetPage(i); + Page->ApplySettings(UpdateScreen); + } + } + + if (UpdateScreen) + { + ::EnableWindow(GetDlgItem(IDAPPLY),false); + ::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset()); + } +} + LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* phdr) { NMLISTVIEW* pnmlv = (NMLISTVIEW*) phdr; @@ -88,21 +185,49 @@ LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* phdr) m_CurrentPage->HidePage(); } m_CurrentPage = Page; - m_CurrentPage->ShowPage(); + m_CurrentPage->ShowPage(); + ::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset()); } - //hItem = TreeView_GetSelection(hCheatTree); - //if (TreeView_GetChild(hCheatTree,hItem) == NULL) { - - //int nSelItem = m_wndList.GetSelectedIndex(); - //CString sMsg; - - // If no item is selected, show "none". Otherwise, show its index. - - //if ( -1 == nSelItem ) - // sMsg = _T("(none)"); - //else - // sMsg.Format ( _T("%d"), nSelItem ); - - //SetDlgItemText ( IDC_SEL_ITEM, sMsg ); return 0; // retval ignored } + +LRESULT CSettingConfig::OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/) +{ + ::EnableWindow(GetDlgItem(IDAPPLY),true); + ::EnableWindow(GetDlgItem(IDC_RESET), m_CurrentPage->EnableReset()); + BoldChangedPages(m_PagesTreeList.GetRootItem()); + return 0; +} + +void CSettingConfig::BoldChangedPages ( HTREEITEM hItem ) +{ + if (hItem == m_PagesTreeList.GetRootItem()) + { + ::EnableWindow(GetDlgItem(IDC_RESET_ALL), false); + } + bool bEnableResetAll = false; + + while (hItem) + { + CSettingsPage * Page = (CSettingsPage * )m_PagesTreeList.GetItemData(hItem); + if (Page) + { + m_PagesTreeList.SetItemState(hItem,Page->EnableReset() ? TVIS_BOLD : 0,TVIS_BOLD); + if (Page->EnableReset()) + { + bEnableResetAll = true; + } + } + + BoldChangedPages(m_PagesTreeList.GetChildItem(hItem)); + hItem = m_PagesTreeList.GetNextSiblingItem(hItem); + } + + if (bEnableResetAll) + { + ::EnableWindow(GetDlgItem(IDC_RESET_ALL), true); + } + + +} + diff --git a/Source/Project64/User Interface/Settings Config.h b/Source/Project64/User Interface/Settings Config.h index 948debaa4..8c0b87304 100644 --- a/Source/Project64/User Interface/Settings Config.h +++ b/Source/Project64/User Interface/Settings Config.h @@ -9,8 +9,9 @@ class CSettingConfig : BEGIN_MSG_MAP_EX(CSettingConfig) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked) + COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked) NOTIFY_HANDLER_EX(IDC_PAGELIST, TVN_SELCHANGED, OnPageListItemChanged) + MESSAGE_HANDLER_EX(PSM_CHANGED,OnSettingPageChanged) REFLECT_NOTIFICATIONS() END_MSG_MAP() @@ -19,6 +20,7 @@ class CSettingConfig : LRESULT OnInitDialog ( UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); LRESULT OnPageListItemChanged(NMHDR* phdr); + LRESULT OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/); public: CSettingConfig ( bool bJustGameSetting = false ); @@ -27,9 +29,13 @@ public: void Display ( void * ParentWindow ); private: + void ApplySettings ( bool UpdateScreen ); + void BoldChangedPages ( HTREEITEM hItem ); + typedef std::list SETTING_SECTIONS; CTreeViewCtrl m_PagesTreeList; SETTING_SECTIONS m_Sections; CSettingsPage * m_CurrentPage; + bool m_GameConfig; }; \ No newline at end of file diff --git a/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.cpp b/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.cpp new file mode 100644 index 000000000..be51223a4 --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.cpp @@ -0,0 +1,52 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +CAdvancedOptionsPage::CAdvancedOptionsPage (HWND hParent, const RECT & rcDispay ) +{ + if (!Create(hParent,rcDispay)) + { + return; + } + AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN),Setting_AutoStart); + AddModCheckBox(GetDlgItem(IDC_ZIP),Setting_AutoZipInstantSave); + AddModCheckBox(GetDlgItem(IDC_DEBUGGER),Debugger_Enabled); + AddModCheckBox(GetDlgItem(IDC_REMEMBER_CHEAT),Setting_RememberCheats); + AddModCheckBox(GetDlgItem(IDC_DISPLAY_FRAMERATE),UserInterface_DisplayFrameRate); + + CModifiedComboBox * ComboBox; + ComboBox = AddModComboBox(GetDlgItem(IDC_FRAME_DISPLAY_TYPE),UserInterface_FrameDisplayType); + if (ComboBox) + { + ComboBox->AddItem(GS(STR_FR_VIS), FR_VIs ); + ComboBox->AddItem(GS(STR_FR_DLS), FR_DLs ); + ComboBox->AddItem(GS(STR_FR_PERCENT), FR_PERCENT ); + } + + UpdatePageSettings(); +} + +void CAdvancedOptionsPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void CAdvancedOptionsPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void CAdvancedOptionsPage::ApplySettings( bool UpdateScreen ) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CAdvancedOptionsPage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void CAdvancedOptionsPage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.h b/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.h new file mode 100644 index 000000000..ec86f4f5a --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Advanced Options.h @@ -0,0 +1,31 @@ +#pragma once + +class CAdvancedOptionsPage : + public CSettingsPageImpl, + public CSettingsPage +{ + + BEGIN_MSG_MAP_EX(CAdvancedOptionsPage) + COMMAND_ID_HANDLER_EX(IDC_START_ON_ROM_OPEN,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_ZIP,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_DEBUGGER,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_REMEMBER_CHEAT,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_DISPLAY_FRAMERATE,CheckBoxChanged) + COMMAND_HANDLER_EX(IDC_FRAME_DISPLAY_TYPE,LBN_SELCHANGE,ComboBoxChanged) + + END_MSG_MAP() + + enum { IDD = IDD_Settings_Advanced }; + +public: + CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_ADVANCED; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Directories.cpp b/Source/Project64/User Interface/Settings/Settings Page - Directories.cpp new file mode 100644 index 000000000..fc40415bd --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Directories.cpp @@ -0,0 +1,342 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +COptionsDirectoriesPage::COptionsDirectoriesPage (HWND hParent, const RECT & rcDispay ) : + m_InUpdateSettings(false) +{ + Create(hParent); + if (m_hWnd == NULL) + { + return; + } + SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); + + m_PluginGroup.Attach(GetDlgItem(IDC_DIR_FRAME1)); + m_AutoSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME3)); + m_InstantSaveGroup.Attach(GetDlgItem(IDC_DIR_FRAME4)); + m_ScreenShotGroup.Attach(GetDlgItem(IDC_DIR_FRAME5)); + m_TextureGroup.Attach(GetDlgItem(IDC_DIR_TEXTURE_FRAME)); + + m_PluginDir.Attach(GetDlgItem(IDC_PLUGIN_DIR)); + m_AutoSaveDir.Attach(GetDlgItem(IDC_AUTO_DIR)); + m_InstantSaveDir.Attach(GetDlgItem(IDC_INSTANT_DIR)); + m_ScreenShotDir.Attach(GetDlgItem(IDC_SNAP_DIR)); + m_TextureDir.Attach(GetDlgItem(IDC_TEXTURE_DIR)); + + m_PluginDefault.Attach(GetDlgItem(IDC_PLUGIN_DEFAULT)); + m_PluginSelected.Attach(GetDlgItem(IDC_PLUGIN_OTHER)); + m_AutoSaveDefault.Attach(GetDlgItem(IDC_AUTO_DEFAULT)); + m_AutoSaveSelected.Attach(GetDlgItem(IDC_AUTO_OTHER)); + m_InstantDefault.Attach(GetDlgItem(IDC_INSTANT_DEFAULT)); + m_InstantSelected.Attach(GetDlgItem(IDC_INSTANT_OTHER)); + m_ScreenShotDefault.Attach(GetDlgItem(IDC_SNAP_DEFAULT)); + m_ScreenShotSelected.Attach(GetDlgItem(IDC_SNAP_OTHER)); + m_TextureDefault.Attach(GetDlgItem(IDC_TEXTURE_DEFAULT)); + m_TextureSelected.Attach(GetDlgItem(IDC_TEXTURE_OTHER)); + + //Set Text language for the dialog box + m_PluginGroup.SetWindowText(GS(DIR_PLUGIN)); + m_AutoSaveGroup.SetWindowText(GS(DIR_AUTO_SAVE)); + m_InstantSaveGroup.SetWindowText(GS(DIR_INSTANT_SAVE)); + m_ScreenShotGroup.SetWindowText(GS(DIR_SCREEN_SHOT)); + m_TextureGroup.SetWindowText(GS(DIR_TEXTURE)); + + UpdatePageSettings(); +} + +int CALLBACK COptionsDirectoriesPage::SelectDirCallBack (HWND hwnd,DWORD uMsg,DWORD lp, DWORD lpData) +{ + switch(uMsg) + { + case BFFM_INITIALIZED: + // WParam is TRUE since you are passing a path. + // It would be FALSE if you were passing a pidl. + if (lpData) + { + SendMessage((HWND)hwnd,BFFM_SETSELECTION,TRUE,lpData); + } + break; + } + return 0; +} + +void COptionsDirectoriesPage::SelectDirectory( LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected ) +{ + char Buffer[MAX_PATH], Directory[MAX_PATH]; + LPITEMIDLIST pidl; + BROWSEINFO bi; + + stdstr InitialDir = EditBox.GetWindowText(); + + bi.hwndOwner = m_hWnd; + bi.pidlRoot = NULL; + bi.pszDisplayName = Buffer; + bi.lpszTitle = GS(Title); + bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; + bi.lpfn = (BFFCALLBACK)SelectDirCallBack; + bi.lParam = (DWORD)InitialDir.c_str(); + if ((pidl = SHBrowseForFolder(&bi)) != NULL) + { + if (SHGetPathFromIDList(pidl, Directory)) + { + CPath SelectedDir(Directory,""); + EditBox.SetChanged(true); + EditBox.SetWindowText(SelectedDir); + Default.SetChanged(true); + Default.SetCheck(BST_UNCHECKED); + selected.SetCheck(BM_SETCHECK); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + } + } +} + +void COptionsDirectoriesPage::PluginDirChanged ( UINT Code, int id, HWND ctl ) +{ + if (m_InUpdateSettings) { return; } + m_PluginDir.SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::AutoSaveDirChanged ( UINT Code, int id, HWND ctl ) +{ + if (m_InUpdateSettings) { return; } + m_AutoSaveDir.SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::InstantSaveDirChanged ( UINT Code, int id, HWND ctl ) +{ + if (m_InUpdateSettings) { return; } + m_InstantSaveDir.SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::SnapShotDirChanged ( UINT Code, int id, HWND ctl ) +{ + if (m_InUpdateSettings) { return; } + m_ScreenShotDir.SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::TextureDirChanged ( UINT Code, int id, HWND ctl ) +{ + if (m_InUpdateSettings) { return; } + m_TextureDir.SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::SelectPluginDir ( UINT Code, int id, HWND ctl ) +{ + SelectDirectory(DIR_SELECT_PLUGIN,m_PluginDir,m_PluginDefault, m_PluginSelected); +} + +void COptionsDirectoriesPage::SelectAutoDir ( UINT Code, int id, HWND ctl ) +{ + SelectDirectory(DIR_SELECT_AUTO,m_AutoSaveDir,m_AutoSaveDefault, m_AutoSaveSelected); +} + +void COptionsDirectoriesPage::SelectInstantDir ( UINT Code, int id, HWND ctl ) +{ + SelectDirectory(DIR_SELECT_INSTANT,m_InstantSaveDir,m_InstantDefault, m_InstantSelected); +} + +void COptionsDirectoriesPage::SelectSnapShotDir ( UINT Code, int id, HWND ctl ) +{ + SelectDirectory(DIR_SELECT_SCREEN,m_ScreenShotDir,m_ScreenShotDefault, m_ScreenShotSelected); +} + +void COptionsDirectoriesPage::SelectTextureDir ( UINT Code, int id, HWND ctl ) +{ + SelectDirectory(DIR_SELECT_TEXTURE,m_TextureDir,m_TextureDefault, m_TextureSelected); +} + +void COptionsDirectoriesPage::UpdatePageSettings() +{ + stdstr Directory; + + m_InUpdateSettings = true; + m_PluginDir.SetChanged(_Settings->LoadString(Directory_PluginSelected,Directory)); + m_PluginDir.SetWindowText(Directory.c_str()); + m_AutoSaveDir.SetChanged(_Settings->LoadString(Directory_NativeSaveSelected,Directory)); + m_AutoSaveDir.SetWindowText(Directory.c_str()); + m_InstantSaveDir.SetChanged(_Settings->LoadString(Directory_InstantSaveSelected,Directory)); + m_InstantSaveDir.SetWindowText(Directory.c_str()); + m_ScreenShotDir.SetChanged(_Settings->LoadString(Directory_SnapShotSelected,Directory)); + m_ScreenShotDir.SetWindowText(Directory.c_str()); + m_TextureDir.SetChanged(_Settings->LoadString(Directory_TextureSelected,Directory)); + m_TextureDir.SetWindowText(Directory.c_str()); + + bool UseSelected; + m_PluginDefault.SetChanged(_Settings->LoadBool(Directory_PluginUseSelected,UseSelected)); + m_PluginDefault.SetCheck(!UseSelected); + m_PluginSelected.SetCheck(UseSelected); + + m_AutoSaveDefault.SetChanged(_Settings->LoadBool(Directory_NativeSaveUseSelected,UseSelected)); + m_AutoSaveDefault.SetCheck(!UseSelected); + m_AutoSaveSelected.SetCheck(UseSelected); + + m_InstantDefault.SetChanged(_Settings->LoadBool(Directory_InstantSaveUseSelected,UseSelected)); + m_InstantDefault.SetCheck(!UseSelected); + m_InstantSelected.SetCheck(UseSelected); + + m_ScreenShotDefault.SetChanged(_Settings->LoadBool(Directory_SnapShotUseSelected,UseSelected)); + m_ScreenShotDefault.SetCheck(!UseSelected); + m_ScreenShotSelected.SetCheck(UseSelected); + + m_TextureDefault.SetChanged(_Settings->LoadBool(Directory_TextureUseSelected,UseSelected)); + m_TextureDefault.SetCheck(!UseSelected); + m_TextureSelected.SetCheck(UseSelected); + + m_InUpdateSettings = false; +} + +void COptionsDirectoriesPage::UseSelectedClicked ( UINT Code, int id, HWND ctl ) +{ + CModifiedButton * Button = NULL; + switch (id) + { + case IDC_PLUGIN_DEFAULT: Button = &m_PluginDefault; break; + case IDC_PLUGIN_OTHER: Button = &m_PluginDefault; break; + case IDC_AUTO_DEFAULT: Button = &m_AutoSaveDefault; break; + case IDC_AUTO_OTHER: Button = &m_AutoSaveDefault; break; + case IDC_INSTANT_DEFAULT: Button = &m_InstantDefault; break; + case IDC_INSTANT_OTHER: Button = &m_InstantDefault; break; + case IDC_SNAP_DEFAULT: Button = &m_ScreenShotDefault; break; + case IDC_SNAP_OTHER: Button = &m_ScreenShotDefault; break; + case IDC_TEXTURE_DEFAULT: Button = &m_TextureDefault; break; + case IDC_TEXTURE_OTHER: Button = &m_TextureDefault; break; + } + + if (Button == NULL) + { + return; + } + + if (!Button->IsChanged() || Button->IsReset()) + { + if ((int)Button->GetMenu() == id) + { + return; + } + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} + +void COptionsDirectoriesPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void COptionsDirectoriesPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void COptionsDirectoriesPage::ResetDirectory( CModifiedEditBox & EditBox, SettingID Type ) +{ + if (!EditBox.IsChanged()) + { + return; + } + stdstr dir; + _Settings->LoadDefaultString(Type,dir); + EditBox.SetWindowText(dir.c_str()); + EditBox.SetReset(true); +} + +void COptionsDirectoriesPage::ResetDefaultSelected ( CModifiedButton & ButtonDefault, CModifiedButton & ButtonSelected, SettingID Type ) +{ + if (!ButtonDefault.IsChanged()) + { + return; + } + bool UseSelected; + _Settings->LoadDefaultBool(Type,UseSelected); + ButtonDefault.SetCheck(!UseSelected); + ButtonSelected.SetCheck(UseSelected); + ButtonDefault.SetReset(true); +} + +void COptionsDirectoriesPage::UpdateDirectory( CModifiedEditBox & EditBox, SettingID Type ) +{ + if (EditBox.IsChanged()) + { + stdstr dir = EditBox.GetWindowText(); + _Settings->SaveString(Type,dir.c_str()); + } + if (EditBox.IsReset()) + { + _Settings->DeleteSetting(Type); + } +} + +void COptionsDirectoriesPage::UpdateDefaultSelected ( CModifiedButton & Button, SettingID Type ) +{ + if (Button.IsChanged()) + { + bool bUseSelected = (Button.GetCheck() & BST_CHECKED) == 0; + _Settings->SaveBool(Type,bUseSelected); + + if (Type == Directory_TextureUseSelected && !bUseSelected) + { + _Settings->DeleteSetting(Directory_TextureSelected); + } + } + if (Button.IsReset()) + { + _Settings->DeleteSetting(Type); + } +} + +void COptionsDirectoriesPage::ApplySettings( bool UpdateScreen ) +{ + UpdateDirectory(m_PluginDir,Directory_PluginSelected); + UpdateDirectory(m_AutoSaveDir,Directory_NativeSaveSelected); + UpdateDirectory(m_InstantSaveDir,Directory_InstantSaveSelected); + UpdateDirectory(m_ScreenShotDir,Directory_SnapShotSelected); + UpdateDirectory(m_TextureDir,Directory_TextureSelected); + + UpdateDefaultSelected(m_PluginDefault,Directory_PluginUseSelected); + UpdateDefaultSelected(m_AutoSaveDefault,Directory_NativeSaveUseSelected); + UpdateDefaultSelected(m_InstantDefault,Directory_InstantSaveUseSelected); + UpdateDefaultSelected(m_ScreenShotDefault,Directory_SnapShotUseSelected); + UpdateDefaultSelected(m_TextureDefault,Directory_TextureUseSelected); + + if (UpdateScreen) + { + UpdatePageSettings(); + } +} + +bool COptionsDirectoriesPage::EnableReset ( void ) +{ + if (m_PluginDir.IsChanged()) { return true; } + if (m_AutoSaveDir.IsChanged()) { return true; } + if (m_InstantSaveDir.IsChanged()) { return true; } + if (m_ScreenShotDir.IsChanged()) { return true; } + if (m_TextureDir.IsChanged()) { return true; } + if (m_PluginDefault.IsChanged()) { return true; } + if (m_AutoSaveDefault.IsChanged()) { return true; } + if (m_InstantDefault.IsChanged()) { return true; } + if (m_ScreenShotDefault.IsChanged()) { return true; } + if (m_TextureDefault.IsChanged()) { return true; } + return false; +} + +void COptionsDirectoriesPage::ResetPage() +{ + ResetDirectory(m_PluginDir,Directory_PluginSelected); + ResetDirectory(m_AutoSaveDir,Directory_NativeSaveSelected); + ResetDirectory(m_InstantSaveDir,Directory_InstantSaveSelected); + ResetDirectory(m_ScreenShotDir,Directory_SnapShotSelected); + ResetDirectory(m_TextureDir,Directory_TextureSelected); + + ResetDefaultSelected(m_PluginDefault,m_PluginSelected,Directory_PluginUseSelected); + ResetDefaultSelected(m_AutoSaveDefault,m_AutoSaveSelected,Directory_NativeSaveUseSelected); + ResetDefaultSelected(m_InstantDefault,m_InstantSelected,Directory_InstantSaveUseSelected); + ResetDefaultSelected(m_ScreenShotDefault,m_ScreenShotSelected,Directory_SnapShotUseSelected); + ResetDefaultSelected(m_TextureDefault,m_TextureSelected,Directory_TextureUseSelected); + + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Directories.h b/Source/Project64/User Interface/Settings/Settings Page - Directories.h new file mode 100644 index 000000000..663993e4c --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Directories.h @@ -0,0 +1,78 @@ +#pragma once + +class COptionsDirectoriesPage : + private CDialogImpl, + public CSettingsPage +{ + + + BEGIN_MSG_MAP_EX(COptionsDirectoriesPage) + COMMAND_ID_HANDLER_EX(IDC_SELECT_PLUGIN_DIR,SelectPluginDir); + COMMAND_ID_HANDLER_EX(IDC_SELECT_AUTO_DIR,SelectAutoDir); + COMMAND_ID_HANDLER_EX(IDC_SELECT_INSTANT_DIR,SelectInstantDir); + COMMAND_ID_HANDLER_EX(IDC_SELECT_SNAP_DIR,SelectSnapShotDir); + COMMAND_ID_HANDLER_EX(IDC_SELECT_TEXTURE_DIR,SelectTextureDir); + COMMAND_HANDLER_EX(IDC_PLUGIN_DIR,EN_UPDATE,PluginDirChanged) + COMMAND_HANDLER_EX(IDC_AUTO_DIR,EN_UPDATE,AutoSaveDirChanged) + COMMAND_HANDLER_EX(IDC_INSTANT_DIR,EN_UPDATE,InstantSaveDirChanged) + COMMAND_HANDLER_EX(IDC_SNAP_DIR,EN_UPDATE,SnapShotDirChanged) + COMMAND_HANDLER_EX(IDC_TEXTURE_DIR,EN_UPDATE,TextureDirChanged) + + COMMAND_HANDLER_EX(IDC_PLUGIN_DEFAULT,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_PLUGIN_OTHER,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_AUTO_DEFAULT,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_AUTO_OTHER,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_INSTANT_DEFAULT,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_INSTANT_OTHER,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_SNAP_DEFAULT,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_SNAP_OTHER,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_TEXTURE_DEFAULT,BN_CLICKED,UseSelectedClicked) + COMMAND_HANDLER_EX(IDC_TEXTURE_OTHER,BN_CLICKED,UseSelectedClicked) + END_MSG_MAP() + + enum { IDD = IDD_Settings_Directory }; + +public: + COptionsDirectoriesPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_DIRECTORY; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + void SelectPluginDir ( UINT Code, int id, HWND ctl ); + void SelectAutoDir ( UINT Code, int id, HWND ctl ); + void SelectInstantDir ( UINT Code, int id, HWND ctl ); + void SelectSnapShotDir ( UINT Code, int id, HWND ctl ); + void SelectTextureDir ( UINT Code, int id, HWND ctl ); + void PluginDirChanged ( UINT Code, int id, HWND ctl ); + void AutoSaveDirChanged ( UINT Code, int id, HWND ctl ); + void InstantSaveDirChanged ( UINT Code, int id, HWND ctl ); + void SnapShotDirChanged ( UINT Code, int id, HWND ctl ); + void TextureDirChanged ( UINT Code, int id, HWND ctl ); + void UseSelectedClicked ( UINT Code, int id, HWND ctl ); + void UpdatePageSettings ( void ); + void SelectDirectory ( LanguageStringID Title, CModifiedEditBox & EditBox, CModifiedButton & Default, CModifiedButton & selected ); + + void UpdateDirectory ( CModifiedEditBox & EditBox, SettingID Type ); + void UpdateDefaultSelected ( CModifiedButton & Button, SettingID Type ); + + void ResetDirectory ( CModifiedEditBox & EditBox, SettingID Type ); + void ResetDefaultSelected ( CModifiedButton & ButtonDefault, CModifiedButton & ButtonSelected, SettingID Type ); + + static int CALLBACK SelectDirCallBack (HWND hwnd,DWORD uMsg,DWORD lp, DWORD lpData); + + CPartialGroupBox m_PluginGroup, m_AutoSaveGroup, m_InstantSaveGroup, + m_ScreenShotGroup, m_TextureGroup; + CModifiedEditBox m_PluginDir, m_AutoSaveDir, m_InstantSaveDir, + m_ScreenShotDir, m_TextureDir; + + CModifiedButton m_PluginDefault, m_PluginSelected, m_AutoSaveDefault, m_AutoSaveSelected, + m_InstantDefault, m_InstantSelected, m_ScreenShotDefault, m_ScreenShotSelected, + m_TextureDefault, m_TextureSelected; + + bool m_InUpdateSettings; +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp index e5afbef6b..a460ee711 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp @@ -4,12 +4,59 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay ) { - Create(hParent); - if (m_hWnd == NULL) + if (!Create(hParent,rcDispay)) { return; } - SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); + + AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO),Game_SyncViaAudio); + AddModCheckBox(GetDlgItem(IDC_ROM_SPHACK),Game_SPHack); + AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO),Game_FixedAudio); + AddModCheckBox(GetDlgItem(IDC_USE_TLB),Game_UseTlb); + AddModCheckBox(GetDlgItem(IDC_DELAY_SI),Game_DelaySI); + AddModCheckBox(GetDlgItem(IDC_AUDIO_SIGNAL),Game_RspAudioSignal); + + CModifiedComboBox * ComboBox; + ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE),Game_RDRamSize); + if (ComboBox) + { + ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT)); + if (_Settings->LoadBool(Setting_RdbEditor)) + { + ComboBox->AddItem(GS(RDRAM_4MB), 4 ); + ComboBox->AddItem(GS(RDRAM_8MB), 8 ); + } else { + ComboBox->AddItem(GS(RDRAM_4MB), 0x400000 ); + ComboBox->AddItem(GS(RDRAM_8MB), 0x800000 ); + } + } + + ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE),Game_SaveChip); + if (ComboBox) + { + ComboBox->SetTextField(GetDlgItem(IDC_SAVE_TYPE_TEXT)); + ComboBox->AddItem(GS(SAVE_FIRST_USED), SaveChip_Auto ); + ComboBox->AddItem(GS(SAVE_4K_EEPROM), SaveChip_Eeprom_4K ); + ComboBox->AddItem(GS(SAVE_16K_EEPROM), SaveChip_Eeprom_16K ); + ComboBox->AddItem(GS(SAVE_SRAM), SaveChip_Sram ); + ComboBox->AddItem(GS(SAVE_FLASHRAM), SaveChip_FlashRam ); + } + + ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT),Game_CounterFactor); + if (ComboBox) + { + ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT)); + ComboBox->AddItem(GS(NUMBER_1), 1 ); + ComboBox->AddItem(GS(NUMBER_2), 2 ); + ComboBox->AddItem(GS(NUMBER_3), 3 ); + ComboBox->AddItem(GS(NUMBER_4), 4 ); + ComboBox->AddItem(GS(NUMBER_5), 5 ); + ComboBox->AddItem(GS(NUMBER_6), 6 ); + } + + SetDlgItemText(IDC_GOOD_NAME,_Settings->LoadString(Game_GoodName).c_str()); + + UpdatePageSettings(); } void CGameGeneralPage::ShowPage() @@ -20,4 +67,21 @@ void CGameGeneralPage::ShowPage() void CGameGeneralPage::HidePage() { ShowWindow(SW_HIDE); +} + +void CGameGeneralPage::ApplySettings( bool UpdateScreen ) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CGameGeneralPage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + + +void CGameGeneralPage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); } \ No newline at end of file diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - General.h b/Source/Project64/User Interface/Settings/Settings Page - Game - General.h index 27825f20d..fc508b980 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - General.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - General.h @@ -1,11 +1,23 @@ #pragma once +#include "../WTL Controls/ModifiedCheckBox.h" +#include + class CGameGeneralPage : - private CDialogImpl, + public CSettingsPageImpl, public CSettingsPage { BEGIN_MSG_MAP_EX(CGameGeneralPage) + COMMAND_HANDLER_EX(IDC_RDRAM_SIZE,LBN_SELCHANGE,ComboBoxChanged) + COMMAND_HANDLER_EX(IDC_SAVE_TYPE,LBN_SELCHANGE,ComboBoxChanged) + COMMAND_HANDLER_EX(IDC_COUNTFACT,LBN_SELCHANGE,ComboBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_ROM_SPHACK,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged) END_MSG_MAP() enum { IDD = IDD_Settings_GameGeneral }; @@ -13,7 +25,12 @@ class CGameGeneralPage : public: CGameGeneralPage(HWND hParent, const RECT & rcDispay ); - LanguageStringID PageTitle ( void ) { return TAB_ROMSETTINGS; } - void HidePage ( void ); - void ShowPage ( void ); + LanguageStringID PageTitle ( void ) { return TAB_ROMSETTINGS; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: }; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.cpp index 9c67072fe..c6145520c 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.cpp @@ -2,14 +2,181 @@ #include "Settings Page.h" #include "Settings Page - Game - Plugin.h" -CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay ) +CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay ) { - Create(hParent); - if (m_hWnd == NULL) + if (!Create(hParent,rcDispay)) { return; } - SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); + + //Set the text for all gui Items + SetDlgItemText(RSP_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(GFX_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(AUDIO_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(CONT_ABOUT,GS(PLUG_ABOUT)); + + SetDlgItemText(IDC_RSP_NAME,GS(PLUG_RSP)); + SetDlgItemText(IDC_GFX_NAME,GS(PLUG_GFX)); + SetDlgItemText(IDC_AUDIO_NAME,GS(PLUG_AUDIO)); + SetDlgItemText(IDC_CONT_NAME,GS(PLUG_CTRL)); + + SetDlgItemText(IDC_HLE_GFX,GS(PLUG_HLE_GFX)); + SetDlgItemText(IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO)); + + m_GfxGroup.Attach(GetDlgItem(IDC_GRAPHICS_NAME)); + m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); + m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); + m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); + + AddPlugins(GFX_LIST,Game_Plugin_Gfx,PLUGIN_TYPE_GFX); + AddPlugins(AUDIO_LIST,Game_Plugin_Audio,PLUGIN_TYPE_AUDIO); + AddPlugins(CONT_LIST,Game_Plugin_Controller,PLUGIN_TYPE_CONTROLLER); + AddPlugins(RSP_LIST,Game_Plugin_RSP,PLUGIN_TYPE_RSP); + + AddModCheckBox(GetDlgItem(IDC_HLE_GFX),Game_UseHleGfx); + AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO),Game_UseHleAudio); + + UpdatePageSettings(); +} + +void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ) +{ + stdstr Default = _Settings->LoadString(Type); + + CModifiedComboBox * ComboBox; + ComboBox = AddModComboBox(GetDlgItem(ListId),Type); + for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) + { + const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); + if (Plugin == NULL) + { + continue; + } + if (Plugin->Info.Type != PluginType) + { + continue; + } + if (_stricmp(Default.c_str(),Plugin->FileName.c_str()) == 0) + { + ComboBox->SetDefault((WPARAM)Plugin); + } + ComboBox->AddItem(Plugin->Info.Name, (WPARAM)Plugin); + } +} + +void CGamePluginPage::ShowAboutButton ( int id ) +{ + CModifiedComboBox * ComboBox = NULL; + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + if ((int)(cb_iter->second->GetMenu()) != id) + { + continue; + } + ComboBox = cb_iter->second; + break; + } + if (ComboBox == NULL) + { + return; + } + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + if (Plugin == NULL) + { + return; + } + + //Load the plugin + UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); + HMODULE hLib = LoadLibrary(Plugin->FullPath); + SetErrorMode(LastErrorMode); + if (hLib == NULL) + { + return; + } + + //Get DLL about + void (__cdecl *DllAbout) ( HWND hWnd ); + DllAbout = (void (__cdecl *)(HWND))GetProcAddress( hLib, "DllAbout" ); + + //call the function from the dll + DllAbout(m_hWnd); + + FreeLibrary(hLib); +} + +void CGamePluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged ) +{ + CModifiedComboBox * ComboBox = NULL; + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + if ((int)(cb_iter->second->GetMenu()) != id) + { + continue; + } + ComboBox = cb_iter->second; + break; + } + if (ComboBox == NULL) + { + return; + } + + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + if (Plugin) + { + ::EnableWindow(GetDlgItem(AboutID),Plugin->AboutFunction); + } + if (bSetChanged) + { + ComboBox->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + } +} + +void CGamePluginPage::UpdatePageSettings ( void ) +{ + UpdateCheckBoxes(); + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + stdstr SelectedValue; + + ComboBox->SetChanged(_Settings->LoadString(cb_iter->first,SelectedValue)); + for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) + { + const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); + if (Plugin == NULL) + { + continue; + } + if (_stricmp(SelectedValue.c_str(),Plugin->FileName.c_str()) != 0) + { + continue; + } + ComboBox->SetDefault((WPARAM)Plugin); + } + } + PluginItemChanged(GFX_LIST,GFX_ABOUT,false); + PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT,false); + PluginItemChanged(CONT_LIST,CONT_ABOUT,false); + PluginItemChanged(RSP_LIST,RSP_ABOUT,false); +} + +void CGamePluginPage::HidePage() +{ + ShowWindow(SW_HIDE); } void CGamePluginPage::ShowPage() @@ -17,7 +184,112 @@ void CGamePluginPage::ShowPage() ShowWindow(SW_SHOW); } -void CGamePluginPage::HidePage() +void CGamePluginPage::ApplySettings( bool UpdateScreen ) { - ShowWindow(SW_HIDE); + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CGamePluginPage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void CGamePluginPage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} + +void CGamePluginPage::ApplyComboBoxes ( void ) +{ + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + if (ComboBox->IsChanged()) + { + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + + _Settings->SaveString(cb_iter->first,Plugin->FileName.c_str()); + } + if (ComboBox->IsReset()) + { + _Settings->DeleteSetting(cb_iter->first); + ComboBox->SetReset(false); + } + } +} + +bool CGamePluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ) +{ + if (!ComboBox.IsChanged()) + { + return false; + } + + ComboBox.SetReset(true); + stdstr Value = _Settings->LoadDefaultString(Type); + for (int i = 0, n = ComboBox.GetCount(); i < n; i++) + { + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox.GetItemDataPtr(i); + if (Plugin->FileName != Value) + { + continue; + } + ComboBox.SetCurSel(i); + return true; + } + return false; +} + +void CGamePluginPage::HleGfxChanged ( UINT Code, int id, HWND ctl ) +{ + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if ((int)Button->GetMenu() != id) + { + continue; + } + if ((Button->GetCheck() & BST_CHECKED) == 0) + { + int res = MessageBox(GS(MSG_SET_LLE_GFX_MSG),GS(MSG_SET_LLE_GFX_TITLE),MB_YESNO|MB_ICONWARNING); + if (res != IDYES) + { + Button->SetCheck(BST_CHECKED); + return; + } + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } +} + +void CGamePluginPage::HleAudioChanged ( UINT Code, int id, HWND ctl ) +{ + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if ((int)Button->GetMenu() != id) + { + continue; + } + if ((Button->GetCheck() & BST_CHECKED) != 0) + { + int res = MessageBox(GS(MSG_SET_HLE_AUD_MSG),GS(MSG_SET_HLE_AUD_TITLE),MB_ICONWARNING|MB_YESNO); + if (res != IDYES) + { + Button->SetCheck(BST_UNCHECKED); + return; + } + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } } diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.h b/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.h index 73b1cb751..da0f7e387 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Plugin.h @@ -1,11 +1,22 @@ #pragma once +#include + class CGamePluginPage : - private CDialogImpl, + public CSettingsPageImpl, public CSettingsPage { - BEGIN_MSG_MAP_EX(CGamePluginPage) + COMMAND_HANDLER_EX(GFX_LIST,LBN_SELCHANGE,GfxPluginChanged) + COMMAND_HANDLER_EX(AUDIO_LIST,LBN_SELCHANGE,AudioPluginChanged) + COMMAND_HANDLER_EX(CONT_LIST,LBN_SELCHANGE,ControllerPluginChanged) + COMMAND_HANDLER_EX(RSP_LIST,LBN_SELCHANGE,RspPluginChanged) + COMMAND_ID_HANDLER_EX(GFX_ABOUT,GfxPluginAbout) + COMMAND_ID_HANDLER_EX(AUDIO_ABOUT,AudioPluginAbout) + COMMAND_ID_HANDLER_EX(CONT_ABOUT,ControllerPluginAbout) + COMMAND_ID_HANDLER_EX(RSP_ABOUT,RspPluginAbout) + COMMAND_ID_HANDLER_EX(IDC_HLE_GFX,HleGfxChanged) + COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO,HleAudioChanged) END_MSG_MAP() enum { IDD = IDD_Settings_GamePlugin }; @@ -13,8 +24,35 @@ class CGamePluginPage : public: CGamePluginPage(HWND hParent, const RECT & rcDispay ); - LanguageStringID PageTitle ( void ) { return TAB_PLUGIN; } - void HidePage ( void ); - void ShowPage ( void ); - + LanguageStringID PageTitle ( void ) { return TAB_PLUGIN; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + void GfxPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(GFX_LIST); } + void AudioPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(AUDIO_LIST); } + void ControllerPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(CONT_LIST); } + void RspPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(RSP_LIST); } + + void GfxPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(GFX_LIST,GFX_ABOUT); } + void AudioPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT); } + void ControllerPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(CONT_LIST,CONT_ABOUT); } + void RspPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(RSP_LIST,RSP_ABOUT); } + + void HleGfxChanged ( UINT Code, int id, HWND ctl ); + void HleAudioChanged ( UINT Code, int id, HWND ctl ); + + void ShowAboutButton ( int id ); + void PluginItemChanged ( int id, int AboutID, bool bSetChanged = true ); + + void AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ); + void UpdatePageSettings ( void ); + void ApplyComboBoxes ( void ); + bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ); + + CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup; + CPluginList m_PluginList; }; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.cpp index f835067c4..376ea9c47 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.cpp @@ -4,12 +4,41 @@ CGameRecompilePage::CGameRecompilePage (HWND hParent, const RECT & rcDispay ) { - Create(hParent); - if (m_hWnd == NULL) + if (!Create(hParent,rcDispay)) { return; } - SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); + + m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME)); + + AddModCheckBox(GetDlgItem(IDC_ROM_REGCACHE),Game_RegCache); + AddModCheckBox(GetDlgItem(IDC_BLOCK_LINKING),Game_BlockLinking); + AddModCheckBox(GetDlgItem(IDC_SMM_CACHE),Game_SMM_Cache); + AddModCheckBox(GetDlgItem(IDC_SMM_DMA),Game_SMM_PIDMA); + AddModCheckBox(GetDlgItem(IDC_SMM_VALIDATE),Game_SMM_ValidFunc); + AddModCheckBox(GetDlgItem(IDC_SMM_TLB),Game_SMM_TLB); + AddModCheckBox(GetDlgItem(IDC_SMM_PROTECT),Game_SMM_Protect); + + CModifiedComboBox * ComboBox; + ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE),Game_CpuType); + if (ComboBox) + { + ComboBox->AddItem(GS(CORE_RECOMPILER), CPU_Recompiler); + ComboBox->AddItem(GS(CORE_INTERPTER), CPU_Interpreter); + if (_Settings->LoadBool(Debugger_Enabled)) + { + ComboBox->AddItem(GS(CORE_SYNC), CPU_SyncCores); + } + } + + ComboBox = AddModComboBox(GetDlgItem(IDC_FUNCFIND),Game_FuncLookupMode); + if (ComboBox) + { + ComboBox->AddItem(GS(FLM_PLOOKUP), FuncFind_PhysicalLookup); + ComboBox->AddItem(GS(FLM_VLOOKUP), FuncFind_VirtualLookup); + //ComboBox->AddItem(GS(FLM_CHANGEMEM), FuncFind_ChangeMemory); + } + UpdatePageSettings(); } void CGameRecompilePage::ShowPage() @@ -20,4 +49,20 @@ void CGameRecompilePage::ShowPage() void CGameRecompilePage::HidePage() { ShowWindow(SW_HIDE); -} \ No newline at end of file +} + +void CGameRecompilePage::ApplySettings( bool UpdateScreen ) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CGameRecompilePage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void CGameRecompilePage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.h b/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.h index b2e29d97e..0de5b0311 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Recompiler.h @@ -1,11 +1,20 @@ #pragma once class CGameRecompilePage : - private CDialogImpl, + public CSettingsPageImpl, public CSettingsPage { BEGIN_MSG_MAP_EX(CGameRecompilePage) + COMMAND_HANDLER_EX(IDC_CPU_TYPE,LBN_SELCHANGE,ComboBoxChanged) + COMMAND_HANDLER_EX(IDC_FUNCFIND,LBN_SELCHANGE,ComboBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_ROM_REGCACHE,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_BLOCK_LINKING,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SMM_CACHE,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SMM_DMA,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SMM_VALIDATE,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SMM_TLB,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SMM_PROTECT,CheckBoxChanged) END_MSG_MAP() enum { IDD = IDD_Settings_GameRecompiler }; @@ -13,8 +22,13 @@ class CGameRecompilePage : public: CGameRecompilePage(HWND hParent, const RECT & rcDispay ); - LanguageStringID PageTitle ( void ) { return TAB_RECOMPILER; } - void HidePage ( void ); - void ShowPage ( void ); - + LanguageStringID PageTitle ( void ) { return TAB_RECOMPILER; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + CPartialGroupBox m_SelfModGroup; }; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Status.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game - Status.cpp index 0c554a524..05ecaa62e 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Status.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Status.cpp @@ -20,4 +20,18 @@ void CGameStatusPage::ShowPage() void CGameStatusPage::HidePage() { ShowWindow(SW_HIDE); +} + +void CGameStatusPage::ApplySettings( bool UpdateScreen ) +{ +} + +bool CGameStatusPage::EnableReset ( void ) +{ + return false; +} + +void CGameStatusPage::ResetPage() +{ + Notify().BreakPoint(__FILE__,__LINE__); } \ No newline at end of file diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - Status.h b/Source/Project64/User Interface/Settings/Settings Page - Game - Status.h index bad45eba9..e0aac3649 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - Status.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - Status.h @@ -13,8 +13,11 @@ class CGameStatusPage : public: CGameStatusPage(HWND hParent, const RECT & rcDispay ); - LanguageStringID PageTitle ( void ) { return TAB_ROMNOTES; } - void HidePage ( void ); - void ShowPage ( void ); + LanguageStringID PageTitle ( void ) { return TAB_ROMNOTES; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); }; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game Browser.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game Browser.cpp new file mode 100644 index 000000000..e3b305eec --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Game Browser.cpp @@ -0,0 +1,247 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +COptionsGameBrowserPage::COptionsGameBrowserPage (HWND hParent, const RECT & rcDispay ) : + m_OrderChanged(false), + m_OrderReset(false) +{ + if (!Create(hParent,rcDispay)) + { + return; + } + + SetDlgItemText(IDC_ROMSEL_TEXT1,GS(RB_MAX_ROMS)); + SetDlgItemText(IDC_ROMSEL_TEXT2,GS(RB_ROMS)); + SetDlgItemText(IDC_ROMSEL_TEXT3,GS(RB_MAX_DIRS)); + SetDlgItemText(IDC_ROMSEL_TEXT4,GS(RB_DIRS)); + SetDlgItemText(IDC_USE_ROMBROWSER,GS(RB_USE)); + SetDlgItemText(IDC_RECURSION,GS(RB_DIR_RECURSION)); + SetDlgItemText(IDC_ROMSEL_TEXT5,GS(RB_AVALIABLE_FIELDS)); + SetDlgItemText(IDC_ROMSEL_TEXT6,GS(RB_SHOW_FIELDS)); + SetDlgItemText(IDC_ADD,GS(RB_ADD)); + SetDlgItemText(IDC_REMOVE,GS(RB_REMOVE)); + SetDlgItemText(IDC_UP,GS(RB_UP)); + SetDlgItemText(IDC_DOWN,GS(RB_DOWN)); + + AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER),RomBrowser_Enabled); + AddModCheckBox(GetDlgItem(IDC_RECURSION),RomBrowser_Recursive); + + m_Avaliable.Attach(GetDlgItem(IDC_AVALIABLE)); + m_Using.Attach(GetDlgItem(IDC_USING)); + + CRomBrowser::GetFieldInfo(m_Fields); + + UpdatePageSettings(); +} + +void COptionsGameBrowserPage::UpdateFieldList ( const ROMBROWSER_FIELDS_LIST & Fields ) +{ + m_Avaliable.ResetContent(); + m_Using.ResetContent(); + + m_OrderChanged = false; + for (int i = 0, n = Fields.size(); i < n; i++) + { + if (Fields[i].PosChanged()) + { + m_OrderChanged = true; + } + int Pos = Fields[i].Pos(); + if (Pos < 0) + { + m_Avaliable.SetItemData(m_Avaliable.AddString(GS(Fields[i].LangID())),i); + continue; + } + int listCount = m_Using.GetCount(); + if (Pos > listCount) { Pos = listCount; } + m_Using.SetItemData(m_Using.InsertString(Pos,GS(Fields[i].LangID())),i); + } +} + +void COptionsGameBrowserPage::UpdatePageSettings ( void ) +{ + UpdateFieldList(m_Fields); + CSettingsPageImpl::UpdatePageSettings(); + FixCtrlState(); +} + +void COptionsGameBrowserPage::UseRomBrowserChanged ( UINT Code, int id, HWND ctl ) +{ + CheckBoxChanged(Code,id,ctl); + FixCtrlState(); +} + +void COptionsGameBrowserPage::FixCtrlState ( void ) +{ + bool bEnabled = (SendDlgItemMessage(IDC_USE_ROMBROWSER,BM_GETCHECK,0,0) == BST_CHECKED); + ::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT5),bEnabled); + ::EnableWindow(GetDlgItem(IDC_ROMSEL_TEXT6),bEnabled); + ::EnableWindow(GetDlgItem(IDC_AVALIABLE),bEnabled); + ::EnableWindow(GetDlgItem(IDC_ADD),bEnabled); + ::EnableWindow(GetDlgItem(IDC_REMOVE),bEnabled); + ::EnableWindow(GetDlgItem(IDC_USING),bEnabled); + ::EnableWindow(GetDlgItem(IDC_UP),bEnabled); + ::EnableWindow(GetDlgItem(IDC_DOWN),bEnabled); + ::EnableWindow(GetDlgItem(IDC_RECURSION),bEnabled); +} + +void COptionsGameBrowserPage::AddFieldClicked ( UINT Code, int id, HWND ctl ) +{ + int index = m_Avaliable.GetCurSel(); + if (index < 0) + { + return; + } + //remove from list + int i = m_Avaliable.GetItemData(index); + m_Avaliable.DeleteString(index); + + //select next in list + int listCount = m_Avaliable.GetCount(); + if (index >= listCount) { index -= 1;} + m_Avaliable.SetCurSel(index); + + //Add to list + index = m_Using.AddString(GS(m_Fields[i].LangID())); + m_Using.SetItemData(index,i); + m_Using.SetCurSel(index); + + m_OrderChanged = true; + m_OrderReset = false; + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsGameBrowserPage::RemoveFieldClicked ( UINT Code, int id, HWND ctl ) +{ + int index = SendMessage(GetDlgItem(IDC_USING),LB_GETCURSEL,0,0); + if (index < 0) + { + return; + } + + //remove from list + int i = SendMessage(GetDlgItem(IDC_USING),LB_GETITEMDATA,index,0); + SendDlgItemMessage(IDC_USING,LB_DELETESTRING,index,0); + + //select next in list + int listCount = SendDlgItemMessage(IDC_USING,LB_GETCOUNT,0,0); + if (index >= listCount) { index -= 1;} + SendDlgItemMessage(IDC_USING,LB_SETCURSEL,index,0); + + //Add to list + index = SendDlgItemMessage(IDC_AVALIABLE,LB_ADDSTRING,0,(LPARAM)GS(m_Fields[i].LangID())); + SendDlgItemMessage(IDC_AVALIABLE,LB_SETITEMDATA,index,i); + SendDlgItemMessage(IDC_AVALIABLE,LB_SETCURSEL,index,0); + + m_OrderChanged = true; + m_OrderReset = false; + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsGameBrowserPage::MoveFieldUpClicked ( UINT Code, int id, HWND ctl ) +{ + int index = m_Using.GetCurSel(); + if (index <= 0) + { + return; + } + int i = m_Using.GetItemData(index); + m_Using.DeleteString(index); + + index = m_Using.InsertString(index - 1,GS(m_Fields[i].LangID())); + m_Using.SetItemData(index,i); + m_Using.SetCurSel(index); + + m_OrderChanged = true; + m_OrderReset = false; + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsGameBrowserPage::MoveFieldDownClicked ( UINT Code, int id, HWND ctl ) +{ + int index = m_Using.GetCurSel(); + if (index < 0 || index >= (m_Using.GetCount() - 1)) + { + return; + } + int i = m_Using.GetItemData(index); + m_Using.DeleteString(index); + + index = m_Using.InsertString(index + 1,GS(m_Fields[i].LangID())); + m_Using.SetItemData(index,i); + m_Using.SetCurSel(index); + + m_OrderChanged = true; + m_OrderReset = false; + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsGameBrowserPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void COptionsGameBrowserPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void COptionsGameBrowserPage::ApplySettings( bool UpdateScreen ) +{ + bool bColChanged = false; + if (m_OrderReset) + { + for (int i = 0; i < m_Fields.size(); i++ ) + { + m_Fields[i].ResetPos(); + } + bColChanged = true; + } else { + int Item, listCount = m_Using.GetCount(); + for (Item = 0; Item < listCount; Item ++ ) + { + int Pos = m_Using.GetItemData(Item); + if (m_OrderReset || m_Fields[Pos].Pos() != Item) + { + m_Fields[Pos].SetColPos(Item); + bColChanged = true; + } + } + + listCount = m_Avaliable.GetCount(); + for (Item = 0; Item < listCount; Item ++ ) + { + int Pos = m_Avaliable.GetItemData(Item); + if (m_OrderReset || m_Fields[Pos].Pos() != -1) + { + m_Fields[Pos].SetColPos(-1); + bColChanged = true; + } + } + } + if (bColChanged) + { + _Settings->SaveBool(RomBrowser_ColoumnsChanged,!_Settings->LoadBool(RomBrowser_ColoumnsChanged)); + } + + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool COptionsGameBrowserPage::EnableReset ( void ) +{ + if (m_OrderChanged) { return true; } + return CSettingsPageImpl::EnableReset(); +} + +void COptionsGameBrowserPage::ResetPage() +{ + if (m_OrderChanged) + { + ROMBROWSER_FIELDS_LIST Fields; + CRomBrowser::GetFieldInfo(Fields,true); + UpdateFieldList(Fields); + m_OrderReset = true; + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + } + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game Browser.h b/Source/Project64/User Interface/Settings/Settings Page - Game Browser.h new file mode 100644 index 000000000..9903d447f --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Game Browser.h @@ -0,0 +1,41 @@ +#pragma once + +class COptionsGameBrowserPage : + public CSettingsPageImpl, + public CSettingsPage +{ + BEGIN_MSG_MAP_EX(COptionsGameBrowserPage) + COMMAND_HANDLER_EX(IDC_ADD,BN_CLICKED,AddFieldClicked) + COMMAND_HANDLER_EX(IDC_REMOVE,BN_CLICKED,RemoveFieldClicked) + COMMAND_HANDLER_EX(IDC_UP,BN_CLICKED,MoveFieldUpClicked) + COMMAND_HANDLER_EX(IDC_DOWN,BN_CLICKED,MoveFieldDownClicked) + COMMAND_ID_HANDLER_EX(IDC_USE_ROMBROWSER,UseRomBrowserChanged) + COMMAND_ID_HANDLER_EX(IDC_RECURSION,CheckBoxChanged) + END_MSG_MAP() + + enum { IDD = IDD_Settings_RomBrowser }; + +public: + COptionsGameBrowserPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_ROMSELECTION; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + void UpdatePageSettings ( void ); + void UpdateFieldList ( const ROMBROWSER_FIELDS_LIST & Fields ); + void AddFieldClicked ( UINT Code, int id, HWND ctl ); + void RemoveFieldClicked ( UINT Code, int id, HWND ctl ); + void MoveFieldUpClicked ( UINT Code, int id, HWND ctl ); + void MoveFieldDownClicked ( UINT Code, int id, HWND ctl ); + void UseRomBrowserChanged ( UINT Code, int id, HWND ctl ); + void FixCtrlState ( void ); + + ROMBROWSER_FIELDS_LIST m_Fields; + CListBox m_Avaliable, m_Using; + bool m_OrderChanged, m_OrderReset; +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.cpp b/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.cpp new file mode 100644 index 000000000..054a979c0 --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.cpp @@ -0,0 +1,363 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +COptionsShortCutsPage::COptionsShortCutsPage (HWND hParent, const RECT & rcDispay ) : + m_EnableReset(false) +{ + if (!Create(hParent,rcDispay)) + { + return; + } + + SetDlgItemText(IDC_S_CPU_STATE,GS(ACCEL_CPUSTATE_TITLE)); + SetDlgItemText(IDC_MENU_ITEM_TEXT,GS(ACCEL_MENUITEM_TITLE)); + SetDlgItemText(IDC_S_CURRENT_KEYS,GS(ACCEL_CURRENTKEYS_TITLE)); + SetDlgItemText(IDC_S_SELECT_SHORT,GS(ACCEL_SELKEY_TITLE)); + SetDlgItemText(IDC_S_CURRENT_ASSIGN,GS(ACCEL_ASSIGNEDTO_TITLE)); + SetDlgItemText(IDC_ASSIGN,GS(ACCEL_ASSIGN_BTN)); + SetDlgItemText(IDC_REMOVE,GS(ACCEL_REMOVE_BTN)); + + m_CreateNewShortCut.AttachToDlgItem(m_hWnd,IDC_S_SELECT_SHORT); + m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE)); + m_MenuItems.Attach(GetDlgItem(IDC_MENU_ITEMS)); + m_CurrentKeys.Attach(GetDlgItem(IDC_CURRENT_KEYS)); + m_VirtualKeyList.Attach(GetDlgItem(IDC_VIRTUALKEY)); + + m_MenuItems.ModifyStyle(0,TVS_SHOWSELALWAYS); + + m_CpuState.SetItemData(m_CpuState.AddString(GS(ACCEL_CPUSTATE_1)),CMenuShortCutKey::GAME_NOT_RUNNING); + m_CpuState.SetItemData(m_CpuState.AddString(GS(ACCEL_CPUSTATE_3)),CMenuShortCutKey::GAME_RUNNING_WINDOW); + m_CpuState.SetItemData(m_CpuState.AddString(GS(ACCEL_CPUSTATE_4)),CMenuShortCutKey::GAME_RUNNING_FULLSCREEN); + m_CpuState.SetCurSel(0); + + int VirtualKeyListSize; + VIRTUAL_KEY * VirtualKeyList = CMenuShortCutKey::VirtualKeyList(VirtualKeyListSize); + for (int count = 0; count < VirtualKeyListSize; count++) + { + m_VirtualKeyList.SetItemData(m_VirtualKeyList.AddString(VirtualKeyList[count].Name),VirtualKeyList[count].Key); + } + + OnCpuStateChanged(LBN_SELCHANGE,IDC_C_CPU_STATE,GetDlgItem(IDC_C_CPU_STATE)); + CheckResetEnable(); + +} + +void COptionsShortCutsPage::CheckResetEnable ( void ) +{ + MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts(); + for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) + { + const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems(); + for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) + { + if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded()) + { + continue; + } + m_EnableReset = true; + return; + } + + } + m_EnableReset = false; +} + +void COptionsShortCutsPage::OnCpuStateChanged(UINT Code, int id, HWND ctl) +{ + ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); + + MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts(); + m_MenuItems.DeleteAllItems(); + + for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++) + { + ACCESS_MODE ItemMode = Item->second.AccessMode(); + if ((ItemMode & AccessLevel) != AccessLevel ) + { + continue; + } + //find Parent + HTREEITEM hParent = m_MenuItems.GetChildItem(TVI_ROOT); + while (hParent) + { + if (m_MenuItems.GetItemData(hParent) == Item->second.Section()) + { + break; + } + hParent = m_MenuItems.GetNextSiblingItem(hParent); + } + + if (hParent == NULL) + { + hParent = m_MenuItems.InsertItem(TVIF_TEXT | TVIF_PARAM,GS(Item->second.Section()),0,0,0,0, + Item->second.Section(),TVI_ROOT,TVI_LAST); + } + + stdstr str = GS(Item->second.Title()); + str.replace("&",""); + str.replace("...",""); + + HTREEITEM hItem = m_MenuItems.InsertItem(TVIF_TEXT | TVIF_PARAM,str.c_str(),0,0,0,0, + (DWORD_PTR)&Item->second,hParent,TVI_LAST); + + const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems(); + for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) + { + if (!ShortCut_item->Inactive() && !ShortCut_item->UserAdded()) + { + continue; + } + m_MenuItems.SetItemState(hItem,TVIS_BOLD,TVIS_BOLD); + m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); + break; + } + + } +} + +void COptionsShortCutsPage::OnRemoveClicked ( UINT Code, int id, HWND ctl ) +{ + HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); + if (hSelectedItem == NULL) + { + Notify().DisplayError(GS(MSG_NO_SEL_SHORTCUT)); + return; + } + HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); + if (hParent == NULL) + { + Notify().DisplayError(GS(MSG_NO_SEL_SHORTCUT)); + return; + } + + CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem); + + ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); + + //Make sure an item is selected + int index = m_CurrentKeys.GetCurSel(); + if (index < 0) + { + Notify().DisplayError(GS(MSG_NO_SEL_SHORTCUT)); + return; + } + ShortCut->RemoveItem((CMenuShortCutKey *)m_CurrentKeys.GetItemData(index)); + m_MenuItems.SetItemState(hSelectedItem,TVIS_BOLD,TVIS_BOLD); + m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); + m_EnableReset = true; + + RefreshShortCutOptions(hSelectedItem); + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsShortCutsPage::OnDetectKeyClicked ( UINT Code, int id, HWND ctl ) +{ + CloseHandle(CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)stInputGetKeys,this,0,NULL)); +} + +void COptionsShortCutsPage::OnAssignClicked ( UINT Code, int id, HWND ctl ) +{ + //Get the virtual key info + int index = m_VirtualKeyList.GetCurSel(); + if (index < 0) + { + Notify().DisplayError(GS(MSG_NO_SHORTCUT_SEL)); + return; + } + + WORD key = SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,index,0); + bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); + bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); + bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); + + ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); + + + HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem(); + if (hSelectedItem == NULL) + { + Notify().DisplayError(GS(MSG_NO_MENUITEM_SEL)); + return; + } + HTREEITEM hParent = m_MenuItems.GetParentItem(hSelectedItem); + if (hParent == NULL) + { + Notify().DisplayError(GS(MSG_NO_MENUITEM_SEL)); + return; + } + + CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem); + + LanguageStringID strid = m_ShortCuts.GetMenuItemName(key,bCtrl,bAlt,bShift,AccessLevel); + if (strid != EMPTY_STRING) + { + Notify().DisplayError(GS(MSG_MENUITEM_ASSIGNED)); + return; + } + ShortCut->AddShortCut(key,bCtrl,bAlt,bShift,AccessLevel,true,false); + m_MenuItems.SetItemState(hSelectedItem,TVIS_BOLD,TVIS_BOLD); + m_MenuItems.SetItemState(hParent,TVIS_BOLD,TVIS_BOLD); + m_EnableReset = true; + + RefreshShortCutOptions(hSelectedItem); + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); +} + +void COptionsShortCutsPage::OnShortCutChanged ( UINT Code, int id, HWND ctl ) +{ + //Get the virtual key info + int index = m_VirtualKeyList.GetCurSel(); + if (index < 0) { return; } + WORD key = m_VirtualKeyList.GetItemData(index); + bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); + bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); + bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); + + ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); + + stdstr str = GS(m_ShortCuts.GetMenuItemName(key,bCtrl,bAlt,bShift,AccessLevel)); + if (str.length() > 0) + { + str.resize(std::remove(str.begin(), str.end(), '&') - str.begin()); + } else { + str = "None"; + } + SetDlgItemText(IDC_ASSIGNED_MENU_ITEM,str.c_str()); +} + +LRESULT COptionsShortCutsPage::OnMenuItemChanged ( LPNMHDR lpnmh ) +{ + RefreshShortCutOptions(((LPNMTREEVIEW)lpnmh)->itemNew.hItem); + return true; +} + +void COptionsShortCutsPage::RefreshShortCutOptions ( HTREEITEM hItem ) +{ + HTREEITEM hParent = m_MenuItems.GetParentItem(hItem); + if (hParent == NULL) + { + return; + } + + + ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel()); + CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hItem); + + m_CurrentKeys.ResetContent(); + + const SHORTCUT_KEY_LIST & ShortCutList = ShortCut->GetAccelItems(); + for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item ++) + { + if (ShortCut_item->Inactive()) + { + continue; + } + + ACCESS_MODE ItemMode = ShortCut_item->AccessMode(); + if ((ItemMode & AccessLevel) != AccessLevel ) + { + continue; + } + stdstr Name = ShortCut_item->Name(); + m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()),(DWORD_PTR)&*ShortCut_item); + } +} + + +BOOL CALLBACK KeyPromptDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDCANCEL: + SetForegroundWindow(GetParent(hDlg)); + DestroyWindow(hDlg); + break; + } + break; + default: + return FALSE; + } + return TRUE; +} + +void COptionsShortCutsPage::InputGetKeys (void) +{ + HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_Key_Prompt),m_hWnd,KeyPromptDlgProc,(LPARAM)GetDlgItem(IDC_VIRTUALKEY)); + ::EnableWindow(GetParent(),false); + MSG msg; + + for(bool fDone=false;!fDone;MsgWaitForMultipleObjects(0,NULL,false,45,QS_ALLINPUT)) { + while(PeekMessage(&msg,0,0,0,PM_REMOVE)) { + if(msg.message == WM_QUIT) { + fDone = true; + ::PostMessage(NULL,WM_QUIT,0,0); + break; + } + if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN ) { + int nVirtKey = (int)msg.wParam; + DWORD lKeyData = msg.lParam; + if (nVirtKey == VK_SHIFT) { continue; } + if (nVirtKey == VK_CONTROL) { continue; } + if (nVirtKey == VK_MENU) { continue; } + SendDlgItemMessage(IDC_VIRTUALKEY,CB_SETCURSEL,-1,0); + for (int count = 0; count < SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETCOUNT,0,0); count++) { + int Data = (int)SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,count,0); + if (Data != nVirtKey) { continue; } + SendDlgItemMessage(IDC_VIRTUALKEY,CB_SETCURSEL,count,0); + SendDlgItemMessage(IDC_CTL,BM_SETCHECK, (GetKeyState(VK_CONTROL) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); + SendDlgItemMessage(IDC_ALT,BM_SETCHECK, (GetKeyState(VK_MENU) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); + SendDlgItemMessage(IDC_SHIFT,BM_SETCHECK, (GetKeyState(VK_SHIFT) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); + SendMessage(WM_COMMAND,MAKELPARAM(IDC_VIRTUALKEY,LBN_SELCHANGE),(LPARAM)GetDlgItem(IDC_VIRTUALKEY)); + SetForegroundWindow(GetParent()); + ::DestroyWindow(hKeyDlg); + } + continue; + } + if(!::IsDialogMessage(hKeyDlg,&msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + if(!::IsWindow(hKeyDlg)) { fDone = true; } + + } + ::SetFocus(GetParent()); + ::EnableWindow(GetParent(),true); +} + +void COptionsShortCutsPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void COptionsShortCutsPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void COptionsShortCutsPage::ApplySettings( bool UpdateScreen ) +{ + m_ShortCuts.Save(); + _Settings->SaveBool(Info_ShortCutsChanged,true); +} + +bool COptionsShortCutsPage::EnableReset ( void ) +{ + return m_EnableReset; +} + +void COptionsShortCutsPage::ResetPage() +{ + m_EnableReset = false; + m_ShortCuts.Load(true); + OnCpuStateChanged(LBN_SELCHANGE,IDC_C_CPU_STATE,GetDlgItem(IDC_C_CPU_STATE)); + SendMessage(GetParent(),PSM_CHANGED ,(WPARAM)m_hWnd,0); + m_CurrentKeys.ResetContent(); + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.h b/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.h new file mode 100644 index 000000000..10dca9dea --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Keyboard Shortcuts.h @@ -0,0 +1,57 @@ +#pragma once + +class COptionsShortCutsPage : + public CSettingsPageImpl, + public CSettingsPage +{ + typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE; + typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST; + + BEGIN_MSG_MAP_EX(COptionsShortCutsPage) + COMMAND_HANDLER_EX(IDC_C_CPU_STATE,LBN_SELCHANGE,OnCpuStateChanged); + NOTIFY_HANDLER_EX(IDC_MENU_ITEMS,TVN_SELCHANGED,OnMenuItemChanged); + COMMAND_HANDLER_EX(IDC_REMOVE,BN_CLICKED,OnRemoveClicked) + COMMAND_HANDLER_EX(IDC_KEY_PROMPT,BN_CLICKED,OnDetectKeyClicked) + COMMAND_HANDLER_EX(IDC_ASSIGN,BN_CLICKED,OnAssignClicked) + COMMAND_HANDLER_EX(IDC_CTL,BN_CLICKED,OnShortCutChanged) + COMMAND_HANDLER_EX(IDC_ALT,BN_CLICKED,OnShortCutChanged) + COMMAND_HANDLER_EX(IDC_SHIFT,BN_CLICKED,OnShortCutChanged) + COMMAND_HANDLER_EX(IDC_VIRTUALKEY,LBN_SELCHANGE,OnShortCutChanged) + END_MSG_MAP() + + enum { IDD = IDD_Settings_Accelerator }; + +public: + COptionsShortCutsPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_SHORTCUTS; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + void OnCpuStateChanged ( UINT Code, int id, HWND ctl ); + void OnRemoveClicked ( UINT Code, int id, HWND ctl ); + void OnDetectKeyClicked ( UINT Code, int id, HWND ctl ); + void OnAssignClicked ( UINT Code, int id, HWND ctl ); + void OnShortCutChanged ( UINT Code, int id, HWND ctl ); + LRESULT OnMenuItemChanged ( LPNMHDR lpnmh ); + + void RefreshShortCutOptions ( HTREEITEM hItem ); + void InputGetKeys ( void ); + void CheckResetEnable ( void ); + + static void stInputGetKeys (COptionsShortCutsPage * _this ) + { + _this->InputGetKeys(); + } + + CPartialGroupBox m_CreateNewShortCut; + CComboBox m_CpuState, m_VirtualKeyList; + CShortCuts m_ShortCuts; + CTreeViewCtrl m_MenuItems; + CListBox m_CurrentKeys; + bool m_EnableReset; +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Options.cpp b/Source/Project64/User Interface/Settings/Settings Page - Options.cpp new file mode 100644 index 000000000..e1724529f --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Options.cpp @@ -0,0 +1,43 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +CGeneralOptionsPage::CGeneralOptionsPage (HWND hParent, const RECT & rcDispay ) +{ + if (!Create(hParent,rcDispay)) + { + return; + } + + AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP),Setting_AutoSleep); + AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN),Setting_AutoFullscreen); + AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER),Setting_DisableScrSaver); + AddModCheckBox(GetDlgItem(IDC_BASIC_MODE),UserInterface_BasicMode); + + UpdatePageSettings(); +} + +void CGeneralOptionsPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void CGeneralOptionsPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void CGeneralOptionsPage::ApplySettings( bool UpdateScreen ) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CGeneralOptionsPage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void CGeneralOptionsPage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Options.h b/Source/Project64/User Interface/Settings/Settings Page - Options.h new file mode 100644 index 000000000..0025f99ec --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Options.h @@ -0,0 +1,28 @@ +#pragma once + +class CGeneralOptionsPage : + private CSettingsPageImpl, + public CSettingsPage +{ + + BEGIN_MSG_MAP_EX(CGeneralOptionsPage) + COMMAND_ID_HANDLER_EX(IDC_AUTOSLEEP,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged) + COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,CheckBoxChanged) + END_MSG_MAP() + + enum { IDD = IDD_Settings_General }; + +public: + CGeneralOptionsPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_OPTIONS; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page - Plugin.cpp b/Source/Project64/User Interface/Settings/Settings Page - Plugin.cpp new file mode 100644 index 000000000..c4714b2a8 --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Plugin.cpp @@ -0,0 +1,294 @@ +#include "../../User Interface.h" +#include "Settings Page.h" + +COptionPluginPage::COptionPluginPage (HWND hParent, const RECT & rcDispay ) +{ + if (!Create(hParent,rcDispay)) + { + return; + } + + //Set the text for all gui Items + SetDlgItemText(RSP_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(GFX_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(AUDIO_ABOUT,GS(PLUG_ABOUT)); + SetDlgItemText(CONT_ABOUT,GS(PLUG_ABOUT)); + + SetDlgItemText(IDC_RSP_NAME,GS(PLUG_RSP)); + SetDlgItemText(IDC_GFX_NAME,GS(PLUG_GFX)); + SetDlgItemText(IDC_AUDIO_NAME,GS(PLUG_AUDIO)); + SetDlgItemText(IDC_CONT_NAME,GS(PLUG_CTRL)); + + SetDlgItemText(IDC_HLE_GFX,GS(PLUG_HLE_GFX)); + SetDlgItemText(IDC_HLE_AUDIO,GS(PLUG_HLE_AUDIO)); + + m_GfxGroup.Attach(GetDlgItem(IDC_GRAPHICS_NAME)); + m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); + m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); + m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); + + AddPlugins(GFX_LIST,Plugin_GFX_Current,PLUGIN_TYPE_GFX); + AddPlugins(AUDIO_LIST,Plugin_AUDIO_Current,PLUGIN_TYPE_AUDIO); + AddPlugins(CONT_LIST,Plugin_CONT_Current,PLUGIN_TYPE_CONTROLLER); + AddPlugins(RSP_LIST,Plugin_RSP_Current,PLUGIN_TYPE_RSP); + + AddModCheckBox(GetDlgItem(IDC_HLE_GFX),Plugin_UseHleGfx); + AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO),Plugin_UseHleAudio); + + UpdatePageSettings(); +} + +void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ) +{ + stdstr Default = _Settings->LoadString(Type); + + CModifiedComboBox * ComboBox; + ComboBox = AddModComboBox(GetDlgItem(ListId),Type); + for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) + { + const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); + if (Plugin == NULL) + { + continue; + } + if (Plugin->Info.Type != PluginType) + { + continue; + } + if (_stricmp(Default.c_str(),Plugin->FileName.c_str()) == 0) + { + ComboBox->SetDefault((WPARAM)Plugin); + } + ComboBox->AddItem(Plugin->Info.Name, (WPARAM)Plugin); + } +} + +void COptionPluginPage::ShowAboutButton ( int id ) +{ + CModifiedComboBox * ComboBox = NULL; + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + if ((int)(cb_iter->second->GetMenu()) != id) + { + continue; + } + ComboBox = cb_iter->second; + break; + } + if (ComboBox == NULL) + { + return; + } + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + if (Plugin == NULL) + { + return; + } + + //Load the plugin + UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); + HMODULE hLib = LoadLibrary(Plugin->FullPath); + SetErrorMode(LastErrorMode); + if (hLib == NULL) + { + return; + } + + //Get DLL about + void (__cdecl *DllAbout) ( HWND hWnd ); + DllAbout = (void (__cdecl *)(HWND))GetProcAddress( hLib, "DllAbout" ); + + //call the function from the dll + DllAbout(m_hWnd); + + FreeLibrary(hLib); +} + +void COptionPluginPage::PluginItemChanged ( int id, int AboutID, bool bSetChanged ) +{ + CModifiedComboBox * ComboBox = NULL; + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + if ((int)(cb_iter->second->GetMenu()) != id) + { + continue; + } + ComboBox = cb_iter->second; + break; + } + if (ComboBox == NULL) + { + return; + } + + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + if (Plugin) + { + ::EnableWindow(GetDlgItem(AboutID),Plugin->AboutFunction); + } + if (bSetChanged) + { + ComboBox->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + } +} + +void COptionPluginPage::UpdatePageSettings ( void ) +{ + UpdateCheckBoxes(); + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + stdstr SelectedValue; + + ComboBox->SetChanged(_Settings->LoadString(cb_iter->first,SelectedValue)); + for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++ ) + { + const CPluginList::PLUGIN * Plugin = m_PluginList.GetPluginInfo(i); + if (Plugin == NULL) + { + continue; + } + if (_stricmp(SelectedValue.c_str(),Plugin->FileName.c_str()) != 0) + { + continue; + } + ComboBox->SetDefault((WPARAM)Plugin); + } + } + PluginItemChanged(GFX_LIST,GFX_ABOUT,false); + PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT,false); + PluginItemChanged(CONT_LIST,CONT_ABOUT,false); + PluginItemChanged(RSP_LIST,RSP_ABOUT,false); +} + +void COptionPluginPage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void COptionPluginPage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void COptionPluginPage::ApplySettings( bool UpdateScreen ) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool COptionPluginPage::EnableReset ( void ) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void COptionPluginPage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} + +void COptionPluginPage::ApplyComboBoxes ( void ) +{ + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + if (ComboBox->IsChanged()) + { + int index = ComboBox->GetCurSel(); + if (index == CB_ERR) + { + return; + } + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index); + + _Settings->SaveString(cb_iter->first,Plugin->FileName.c_str()); + } + if (ComboBox->IsReset()) + { + _Settings->DeleteSetting(cb_iter->first); + ComboBox->SetReset(false); + } + } +} + +bool COptionPluginPage::ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ) +{ + if (!ComboBox.IsChanged()) + { + return false; + } + + ComboBox.SetReset(true); + stdstr Value = _Settings->LoadDefaultString(Type); + for (int i = 0, n = ComboBox.GetCount(); i < n; i++) + { + const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox.GetItemDataPtr(i); + if (Plugin->FileName != Value) + { + continue; + } + ComboBox.SetCurSel(i); + return true; + } + return false; +} + +void COptionPluginPage::HleGfxChanged ( UINT Code, int id, HWND ctl ) +{ + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if ((int)Button->GetMenu() != id) + { + continue; + } + if ((Button->GetCheck() & BST_CHECKED) == 0) + { + int res = MessageBox(GS(MSG_SET_LLE_GFX_MSG),GS(MSG_SET_LLE_GFX_TITLE),MB_YESNO|MB_ICONWARNING); + if (res != IDYES) + { + Button->SetCheck(BST_CHECKED); + return; + } + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } +} + +void COptionPluginPage::HleAudioChanged ( UINT Code, int id, HWND ctl ) +{ + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if ((int)Button->GetMenu() != id) + { + continue; + } + if ((Button->GetCheck() & BST_CHECKED) != 0) + { + int res = MessageBox(GS(MSG_SET_HLE_AUD_MSG),GS(MSG_SET_HLE_AUD_TITLE),MB_ICONWARNING|MB_YESNO); + if (res != IDYES) + { + Button->SetCheck(BST_UNCHECKED); + return; + } + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Plugin.h b/Source/Project64/User Interface/Settings/Settings Page - Plugin.h new file mode 100644 index 000000000..4fe38a77a --- /dev/null +++ b/Source/Project64/User Interface/Settings/Settings Page - Plugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include + +class COptionPluginPage : + public CSettingsPageImpl, + public CSettingsPage +{ + BEGIN_MSG_MAP_EX(COptionPluginPage) + COMMAND_HANDLER_EX(GFX_LIST,LBN_SELCHANGE,GfxPluginChanged) + COMMAND_HANDLER_EX(AUDIO_LIST,LBN_SELCHANGE,AudioPluginChanged) + COMMAND_HANDLER_EX(CONT_LIST,LBN_SELCHANGE,ControllerPluginChanged) + COMMAND_HANDLER_EX(RSP_LIST,LBN_SELCHANGE,RspPluginChanged) + COMMAND_ID_HANDLER_EX(GFX_ABOUT,GfxPluginAbout) + COMMAND_ID_HANDLER_EX(AUDIO_ABOUT,AudioPluginAbout) + COMMAND_ID_HANDLER_EX(CONT_ABOUT,ControllerPluginAbout) + COMMAND_ID_HANDLER_EX(RSP_ABOUT,RspPluginAbout) + COMMAND_ID_HANDLER_EX(IDC_HLE_GFX,HleGfxChanged) + COMMAND_ID_HANDLER_EX(IDC_HLE_AUDIO,HleAudioChanged) + END_MSG_MAP() + + enum { IDD = IDD_Settings_PlugSel }; + +public: + COptionPluginPage(HWND hParent, const RECT & rcDispay ); + + LanguageStringID PageTitle ( void ) { return TAB_PLUGIN; } + void HidePage ( void ); + void ShowPage ( void ); + void ApplySettings ( bool UpdateScreen ); + bool EnableReset ( void ); + void ResetPage ( void ); + +private: + void GfxPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(GFX_LIST); } + void AudioPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(AUDIO_LIST); } + void ControllerPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(CONT_LIST); } + void RspPluginAbout ( UINT Code, int id, HWND ctl ) { ShowAboutButton(RSP_LIST); } + + void GfxPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(GFX_LIST,GFX_ABOUT); } + void AudioPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(AUDIO_LIST,AUDIO_ABOUT); } + void ControllerPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(CONT_LIST,CONT_ABOUT); } + void RspPluginChanged ( UINT Code, int id, HWND ctl ) { PluginItemChanged(RSP_LIST,RSP_ABOUT); } + + void HleGfxChanged ( UINT Code, int id, HWND ctl ); + void HleAudioChanged ( UINT Code, int id, HWND ctl ); + + void ShowAboutButton ( int id ); + void PluginItemChanged ( int id, int AboutID, bool bSetChanged = true ); + + void AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType ); + void UpdatePageSettings ( void ); + void ApplyComboBoxes ( void ); + bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ); + + CPartialGroupBox m_GfxGroup, m_AudioGroup, m_ControlGroup, m_RspGroup; + CPluginList m_PluginList; +}; diff --git a/Source/Project64/User Interface/Settings/Settings Page.h b/Source/Project64/User Interface/Settings/Settings Page.h index 1300b86c3..dbc64fdce 100644 --- a/Source/Project64/User Interface/Settings/Settings Page.h +++ b/Source/Project64/User Interface/Settings/Settings Page.h @@ -5,11 +5,288 @@ class CSettingsPage public: virtual ~CSettingsPage ( void ) = 0 {}; - virtual LanguageStringID PageTitle ( void ) = 0; - virtual void HidePage ( void ) = 0; - virtual void ShowPage ( void ) = 0; + virtual LanguageStringID PageTitle ( void ) = 0; + virtual void HidePage ( void ) = 0; + virtual void ShowPage ( void ) = 0; + virtual void ApplySettings ( bool UpdateScreen ) = 0; + virtual bool EnableReset ( void ) = 0; + virtual void ResetPage ( void ) = 0; }; +template +class CSettingsPageImpl : + public CDialogImpl +{ +protected: + typedef std::map ButtonList; + typedef std::map ComboBoxList; + + virtual ~CSettingsPageImpl() + { + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + delete iter->second; + } + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + delete cb_iter->second; + } + + } + bool Create(HWND hParent, const RECT & rcDispay) + { + CDialogImpl::Create(hParent); + if (m_hWnd == NULL) + { + return false; + } + SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW); + return true; + } + + void CheckBoxChanged ( UINT Code, int id, HWND ctl ) + { + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if ((int)Button->GetMenu() != id) + { + continue; + } + Button->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } + } + + void UpdateModCheckBox ( CModifiedButton & CheckBox, SettingID Type ) + { + if (CheckBox.IsChanged()) + { + bool bValue = CheckBox.GetCheck() == BST_CHECKED; + if (bValue != _Settings->LoadBool(Type)) + { + _Settings->SaveBool(Type,bValue); + } + } + if (CheckBox.IsReset()) + { + _Settings->DeleteSetting(Type); + CheckBox.SetReset(false); + } + } + + bool ResetCheckBox ( CModifiedButton & CheckBox, SettingID Type ) + { + if (!CheckBox.IsChanged()) + { + return false; + } + + bool Value = _Settings->LoadDefaultBool(Type); + CheckBox.SetReset(true); + CheckBox.SetCheck(Value ? BST_CHECKED : BST_UNCHECKED); + return true; + } + + void AddModCheckBox ( HWND hWnd, SettingID Type ) + { + ButtonList::iterator item = m_ButtonList.find(Type); + if (item == m_ButtonList.end()) + { + CModifiedButton * Button = new CModifiedButton; + if (Button == NULL) + { + return; + } + Button->Attach(hWnd); + + m_ButtonList.insert(ButtonList::value_type(Type,Button)); + } + } + + CModifiedComboBox * AddModComboBox ( HWND hWnd, SettingID Type ) + { + ComboBoxList::iterator item = m_ComboBoxList.find(Type); + if (item != m_ComboBoxList.end()) + { + return item->second; + } + + CModifiedComboBox * ComboBox = new CModifiedComboBox; + if (ComboBox == NULL) + { + return NULL; + } + ComboBox->Attach(hWnd); + m_ComboBoxList.insert(ComboBoxList::value_type(Type,ComboBox)); + return ComboBox; + } + + void UpdateCheckBoxes ( void ) + { + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + bool SettingSelected; + + Button->SetChanged(_Settings->LoadBool(iter->first,SettingSelected)); + Button->SetCheck(SettingSelected ? BST_CHECKED : BST_UNCHECKED); + } + + } + + void UpdateComboBoxes ( void) + { + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + DWORD SelectedValue; + + ComboBox->SetChanged(_Settings->LoadDword(cb_iter->first,SelectedValue)); + ComboBox->SetDefault(SelectedValue); + } + } + + virtual void UpdatePageSettings ( void ) + { + UpdateCheckBoxes(); + UpdateComboBoxes(); + } + + void ComboBoxChanged ( UINT Code, int id, HWND ctl ) + { + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + if ((int)ComboBox->GetMenu() != id) + { + continue; + } + ComboBox->SetChanged(true); + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + break; + } + } + + virtual bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type ) + { + if (!ComboBox.IsChanged()) + { + return false; + } + + ComboBox.SetReset(true); + DWORD Value = _Settings->LoadDefaultDword(Type); + for (int i = 0, n = ComboBox.GetCount(); i < n; i++) + { + if (ComboBox.GetItemData(i) != Value) + { + continue; + } + ComboBox.SetCurSel(i); + return true; + } + return false; + } + + virtual void UpdateModComboBox ( CModifiedComboBox & ComboBox, SettingID Type ) + { + if (ComboBox.IsChanged()) + { + int index = ComboBox.GetCurSel(); + if (index == CB_ERR) + { + return; + } + _Settings->SaveDword(Type,(DWORD)ComboBox.GetItemData(index)); + } + if (ComboBox.IsReset()) + { + _Settings->DeleteSetting(Type); + ComboBox.SetReset(false); + } + } + +public: + virtual void ApplyCheckBoxes ( void ) + { + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + UpdateModCheckBox(*Button,iter->first); + } + } + virtual void ApplyComboBoxes ( void ) + { + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + UpdateModComboBox(*ComboBox,cb_iter->first); + } + } + void ApplySettings( bool UpdateScreen ) + { + ApplyCheckBoxes(); + ApplyComboBoxes(); + + if (UpdateScreen) + { + UpdatePageSettings(); + } + } + + bool EnableReset ( void ) + { + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if (Button->IsChanged()) + { + return true; + } + } + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + if (ComboBox->IsChanged()) + { + return true; + } + } + return false; + } + + void ResetPage ( void ) + { + bool Changed = false; + for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++) + { + CModifiedButton * Button = iter->second; + if (ResetCheckBox(*Button,iter->first)) + { + Changed = true; + } + } + for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) + { + CModifiedComboBox * ComboBox = cb_iter->second; + if (ResetComboBox(*ComboBox,cb_iter->first)) + { + Changed = true; + } + } + if (Changed) + { + SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0); + } + } +protected: + ButtonList m_ButtonList; + ComboBoxList m_ComboBoxList; +}; + + typedef std::vector SETTING_PAGES; class CConfigSettingSection @@ -27,7 +304,13 @@ public: CSettingsPage * GetPage ( int PageNo ); }; +#include "Settings Page - Advanced Options.h" +#include "Settings Page - Directories.h" #include "Settings Page - Game - General.h" #include "Settings Page - Game - Plugin.h" #include "Settings Page - Game - Recompiler.h" #include "Settings Page - Game - Status.h" +#include "Settings Page - Game Browser.h" +#include "Settings Page - Keyboard Shortcuts.h" +#include "Settings Page - Options.h" +#include "Settings Page - Plugin.h" diff --git a/Source/Project64/User Interface/UI Resources.aps b/Source/Project64/User Interface/UI Resources.aps index 17106e8f2..d2d5422a1 100644 Binary files a/Source/Project64/User Interface/UI Resources.aps and b/Source/Project64/User Interface/UI Resources.aps differ diff --git a/Source/Project64/User Interface/UI Resources.rc b/Source/Project64/User Interface/UI Resources.rc index 7e76bccde..1466712b1 100644 --- a/Source/Project64/User Interface/UI Resources.rc +++ b/Source/Project64/User Interface/UI Resources.rc @@ -64,124 +64,121 @@ IDI_LEFT ICON DISCARDABLE "Icons\\left.ico" // IDD_Settings_PlugSel DIALOGEX 0, 0, 231, 206 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE -EXSTYLE WS_EX_TOOLWINDOW +STYLE DS_CENTER | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg" +BEGIN + COMBOBOX GFX_LIST,7,18,155,79,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "About",GFX_ABOUT,166,18,44,13,WS_DISABLED + COMBOBOX AUDIO_LIST,7,48,155,79,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "About",AUDIO_ABOUT,166,48,44,13,WS_DISABLED + COMBOBOX CONT_LIST,7,76,155,79,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "About",CONT_ABOUT,166,76,44,13,WS_DISABLED + COMBOBOX RSP_LIST,7,105,155,79,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "About",RSP_ABOUT,166,105,44,13,WS_DISABLED + CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,127,193,8 + CONTROL "Use High Level Audio",IDC_HLE_AUDIO,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,140,188,8 + GROUPBOX "Graphics:",IDC_GRAPHICS_NAME,6,6,208,29 + GROUPBOX "Audio:",IDC_AUDIO_NAME,6,38,208,29 + GROUPBOX "Controller:",IDC_CONT_NAME,6,66,208,29 + GROUPBOX "Reality Signal Processor: ",IDC_RSP_NAME,6,96,208,29 +END + +IDD_Settings_Directory DIALOGEX 0, 0, 231, 206 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX " Graphics: ",IDC_GFX_NAME,10,19,214,29 - COMBOBOX GFX_LIST,17,30,155,79,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - GROUPBOX " Audio: ",IDC_AUDIO_NAME,10,54,214,29 - COMBOBOX AUDIO_LIST,17,64,155,79,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - GROUPBOX " Controller: ",IDC_CONT_NAME,10,93,214,29 - COMBOBOX CONT_LIST,17,103,155,79,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - GROUPBOX " Reality Signal Processor: ",IDC_RSP_NAME,10,128,214,29 - COMBOBOX RSP_LIST,17,139,155,79,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "About",GFX_ABOUT,176,30,44,13,WS_DISABLED - PUSHBUTTON "About",AUDIO_ABOUT,176,64,44,13,WS_DISABLED - PUSHBUTTON "About",CONT_ABOUT,176,103,44,13,WS_DISABLED - PUSHBUTTON "About",RSP_ABOUT,176,139,44,13,WS_DISABLED - CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,9,164,215,8 - CONTROL "Use High Level Audio",IDC_HLE_AUDIO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,9,177,215,8 -END - -IDD_Settings_Directory DIALOG DISCARDABLE 0, 0, 231, 206 -STYLE DS_MODALFRAME | WS_POPUP -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX "Plugin Directoy",IDC_DIR_FRAME1,7,3,217,38 + GROUPBOX "Plugin Directoy",IDC_DIR_FRAME1,5,4,208,34 CONTROL "$AppPath\\Plugin\\",IDC_PLUGIN_DEFAULT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,14,179,8 - CONTROL "",IDC_PLUGIN_OTHER,"Button",BS_AUTORADIOBUTTON,14,24,11, + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,13,179,8 + CONTROL "",IDC_PLUGIN_OTHER,"Button",BS_AUTORADIOBUTTON,6,22,11, 12 - EDITTEXT IDC_PLUGIN_DIR,26,24,170,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_SELECT_PLUGIN_DIR,201,24,14,12 - GROUPBOX "N64 Auto saves",IDC_DIR_FRAME3,7,43,217,38 + EDITTEXT IDC_PLUGIN_DIR,18,22,170,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_SELECT_PLUGIN_DIR,193,22,14,12 + GROUPBOX "N64 Auto saves",IDC_DIR_FRAME3,5,36,208,34 CONTROL "$AppPath\\Save\\",IDC_AUTO_DEFAULT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,53,179,8 - CONTROL "",IDC_AUTO_OTHER,"Button",BS_AUTORADIOBUTTON,14,64,11, - 12 - EDITTEXT IDC_AUTO_DIR,26,64,170,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_SELECT_AUTO_DIR,201,64,14,12 - GROUPBOX "Instant saves",IDC_DIR_FRAME4,7,81,217,38 + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,45,179,8 + CONTROL "",IDC_AUTO_OTHER,"Button",BS_AUTORADIOBUTTON,6,54,11,12 + EDITTEXT IDC_AUTO_DIR,18,54,170,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_SELECT_AUTO_DIR,193,54,14,12 + GROUPBOX "Instant saves",IDC_DIR_FRAME4,5,68,208,34 CONTROL "$AppPath\\Save\\",IDC_INSTANT_DEFAULT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,94,179,8 - CONTROL "",IDC_INSTANT_OTHER,"Button",BS_AUTORADIOBUTTON,14,105, - 11,12 - EDITTEXT IDC_INSTANT_DIR,26,104,170,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_SELECT_INSTANT_DIR,202,104,14,12 - GROUPBOX "Screenshots",IDC_DIR_FRAME5,7,122,217,38,WS_TABSTOP - CONTROL "$AppPath\\Screenshots\\",IDC_SNAP_DEFAULT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,133,179,8 - CONTROL "",IDC_SNAP_OTHER,"Button",BS_AUTORADIOBUTTON,14,143,11, + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,77,179,8 + CONTROL "",IDC_INSTANT_OTHER,"Button",BS_AUTORADIOBUTTON,6,87,11, 12 - EDITTEXT IDC_SNAP_DIR,26,143,170,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_SELECT_SNAP_DIR,203,143,14,12 - GROUPBOX "Texture Directory",IDC_DIR_TEXTURE_FRAME,7,162,217,38 + EDITTEXT IDC_INSTANT_DIR,18,86,170,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_SELECT_INSTANT_DIR,193,86,14,12 + GROUPBOX "Screenshots",IDC_DIR_FRAME5,5,99,208,34 + CONTROL "$AppPath\\Screenshots\\",IDC_SNAP_DEFAULT,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,109,179,8 + CONTROL "",IDC_SNAP_OTHER,"Button",BS_AUTORADIOBUTTON,6,118,11, + 12 + EDITTEXT IDC_SNAP_DIR,18,118,170,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_SELECT_SNAP_DIR,193,118,14,12 + GROUPBOX "Texture Directory",IDC_DIR_TEXTURE_FRAME,5,131,208,34 CONTROL "$AppPath\\textures-load\\",IDC_TEXTURE_DEFAULT,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,171,179,8 - CONTROL "",IDC_TEXTURE_OTHER,"Button",BS_AUTORADIOBUTTON,14,182, + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,140,179,8 + CONTROL "",IDC_TEXTURE_OTHER,"Button",BS_AUTORADIOBUTTON,6,150, 11,12 - EDITTEXT IDC_TEXTURE_DIR,26,181,170,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_SELECT_TEXTURE_DIR,201,181,14,12 + EDITTEXT IDC_TEXTURE_DIR,18,149,170,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_SELECT_TEXTURE_DIR,193,149,14,12 END -IDD_Settings_RomBrowser DIALOG DISCARDABLE 0, 0, 231, 206 -STYLE DS_MODALFRAME | WS_POPUP +IDD_Settings_RomBrowser DIALOGEX 0, 0, 231, 206 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "",IDC_STATIC,2,12,225,40 - LTEXT "Max # of Roms Remembered (Max 10):",IDC_ROMSEL_TEXT1,11, - 22,145,8 - EDITTEXT IDC_REMEMBER,159,20,26,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "roms",IDC_ROMSEL_TEXT2,189,22,31,8 - LTEXT "Max # of Rom Dirs Remembered (Max 10):", - IDC_ROMSEL_TEXT3,10,37,145,8 - EDITTEXT IDC_REMEMBERDIR,159,35,26,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "dirs",IDC_ROMSEL_TEXT4,189,37,31,8 - GROUPBOX "",IDC_STATIC,2,55,225,132 CONTROL "Use Rom Browser",IDC_USE_ROMBROWSER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,9,68,97,10 + BS_AUTOCHECKBOX | WS_TABSTOP,6,7,206,10 CONTROL "Use Directory recursion",IDC_RECURSION,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,121,68,96,10 - LTEXT "Available fields",IDC_ROMSEL_TEXT5,9,85,77,8 - LISTBOX IDC_AVALIABLE,9,97,80,80,LBS_SORT | LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Show fields in this order:",IDC_ROMSEL_TEXT6,142,85,81, + BS_AUTOCHECKBOX | WS_TABSTOP,7,148,202,10 + LTEXT "Available fields",IDC_ROMSEL_TEXT5,6,26,77,8 + LISTBOX IDC_AVALIABLE,6,38,76,104,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Show fields in this order:",IDC_ROMSEL_TEXT6,135,26,81, 8 - LISTBOX IDC_USING,141,97,81,66,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + LISTBOX IDC_USING,134,38,76,87,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add ->",IDC_ADD,93,97,45,12 - PUSHBUTTON "<- Remove",IDC_REMOVE,93,113,45,12 - PUSHBUTTON "Up",IDC_UP,141,166,38,11 - PUSHBUTTON "Down",IDC_DOWN,186,166,36,11 + PUSHBUTTON "Add ->",IDC_ADD,85,38,45,12 + PUSHBUTTON "<- Remove",IDC_REMOVE,85,54,45,12 + PUSHBUTTON "Up",IDC_UP,134,131,34,11 + PUSHBUTTON "Down",IDC_DOWN,175,131,34,11 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,19, + 208,1 END -IDD_Settings_General DIALOG DISCARDABLE 0, 0, 231, 210 -STYLE DS_MODALFRAME | WS_POPUP +IDD_Settings_General DIALOGEX 0, 0, 231, 210 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "",-1,10,24,209,147 CONTROL "Pause emulation when window is not active?", - IDC_AUTOSLEEP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18, - 46,198,8 + IDC_AUTOSLEEP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,9, + 198,8 CONTROL "On loading a ROM go to full screen",IDC_LOAD_FULLSCREEN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,67,198,8 - CONTROL "Remember selected cheats",IDC_REMEMBER_CHEAT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,18,88,198,8 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,25,198,8 CONTROL "Disable Screen Saver when running rom",IDC_SCREEN_SAVER, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,109,198,8 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,41,198,8 CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,18,151,198,8 - CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,18,130,86,9 - COMBOBOX IDC_FRAME_DISPLAY_TYPE,111,129,99,57,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP + BS_AUTOCHECKBOX | WS_TABSTOP,8,57,198,8 + LTEXT "Max # of Roms Remembered (Max 10):",IDC_ROMSEL_TEXT1,6, + 81,145,8 + EDITTEXT IDC_REMEMBER,154,79,26,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "roms",IDC_ROMSEL_TEXT2,184,81,31,8 + LTEXT "Max # of Rom Dirs Remembered (Max 10):", + IDC_ROMSEL_TEXT3,6,96,145,8 + EDITTEXT IDC_REMEMBERDIR,154,94,26,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "dirs",IDC_ROMSEL_TEXT4,184,99,31,8 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,73, + 208,1 END IDD_Rom_Information DIALOGEX 0, 0, 239, 207 @@ -226,9 +223,10 @@ BEGIN WS_EX_CLIENTEDGE | WS_EX_STATICEDGE END -IDD_Settings_GameGeneral DIALOG DISCARDABLE 0, 0, 218, 158 +IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158 STYLE WS_CHILD -FONT 8, "MS Shell Dlg" +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,6,8,91,10 EDITTEXT IDC_GOOD_NAME,102,7,109,12,ES_AUTOHSCROLL | ES_READONLY @@ -240,13 +238,13 @@ BEGIN LTEXT "Default Save type:",IDC_SAVE_TYPE_TEXT,6,48,91,10 COMBOBOX IDC_SAVE_TYPE,102,47,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT2,6,64,91,10 + LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,64,91,10 COMBOBOX IDC_COUNTFACT,102,61,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,86,91,11 CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,102,86,91,11 + WS_TABSTOP,6,114,91,11 CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,102,100,91,11 CONTROL "SP Hack",IDC_ROM_SPHACK,"Button",BS_AUTOCHECKBOX | @@ -254,43 +252,42 @@ BEGIN CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,102,114,91,11 CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,6,114,91,8 + BS_AUTOCHECKBOX | WS_TABSTOP,102,86,91,11 CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,80, 208,1 END -IDD_Settings_Accelerator DIALOG DISCARDABLE 0, 0, 231, 206 -STYLE DS_MODALFRAME | WS_POPUP +IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Menu Item:",IDC_MENU_ITEM_TEXT,11,31,84,10 - LTEXT "Current Keys:",IDC_S_CURRENT_KEYS,146,31,52,10 - LISTBOX IDC_CURRENT_KEYS,146,41,68,59,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Assign to Menu",IDC_ASSIGN,154,140,62,12 - PUSHBUTTON "Remove",IDC_REMOVE,146,105,68,12 - PUSHBUTTON "Reset All",IDC_RESET,168,188,53,12 - GROUPBOX "",IDC_STATIC,4,4,218,121 - COMBOBOX IDC_VIRTUALKEY,9,140,88,90,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - PUSHBUTTON "Detect Key",IDC_KEY_PROMPT,101,140,44,12 - CONTROL "&Ctrl",IDC_CTL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10, - 157,23,9 - CONTROL "A<",IDC_ALT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41, - 157,21,9 - CONTROL "&Shift",IDC_SHIFT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 71,157,26,10 - GROUPBOX "Create New Shortcut Key:",IDC_S_SELECT_SHORT,4,130,218, - 54 - LTEXT "",IDC_ASSIGNED_MENU_ITEM,93,170,118,9 - LTEXT "CPU State:",IDC_S_CPU_STATE,10,15,42,11 - COMBOBOX IDC_C_CPU_STATE,60,13,156,66,CBS_DROPDOWNLIST | + LTEXT "CPU State:",IDC_S_CPU_STATE,8,9,42,11 + COMBOBOX IDC_C_CPU_STATE,58,7,156,66,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Currently Assigned To:",IDC_S_CURRENT_ASSIGN,12,170,72, - 10 + LTEXT "Menu Item:",IDC_MENU_ITEM_TEXT,8,23,84,10 CONTROL "Tree1",IDC_MENU_ITEMS,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_NOTOOLTIPS | - TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,11,41,128,78 + TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,8,33,128,78 + LTEXT "Current Keys:",IDC_S_CURRENT_KEYS,142,23,52,10 + LISTBOX IDC_CURRENT_KEYS,144,33,68,59,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Remove",IDC_REMOVE,144,97,68,12 + GROUPBOX "Create New Shortcut Key:",IDC_S_SELECT_SHORT,8,115,207, + 57 + COMBOBOX IDC_VIRTUALKEY,8,125,91,90,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "Detect Key",IDC_KEY_PROMPT,103,125,44,12 + PUSHBUTTON "Assign to Menu",IDC_ASSIGN,152,125,62,12 + CONTROL "&Ctrl",IDC_CTL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8, + 142,23,9 + CONTROL "A<",IDC_ALT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39, + 142,21,9 + CONTROL "&Shift",IDC_SHIFT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 69,142,26,10 + LTEXT "Currently Assigned To:",IDC_S_CURRENT_ASSIGN,8,155,72, + 10 + LTEXT "",IDC_ASSIGNED_MENU_ITEM,89,155,118,9 END IDD_Key_Prompt DIALOG DISCARDABLE 0, 0, 105, 43 @@ -302,9 +299,10 @@ BEGIN 3,96,19 END -IDD_Settings_GameStatus DIALOG DISCARDABLE 0, 0, 233, 206 +IDD_Settings_GameStatus DIALOGEX 0, 0, 233, 206 STYLE WS_CHILD -FONT 8, "MS Shell Dlg" +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "",IDC_STATIC,4,20,224,138 LTEXT "Status:",IDC_STATUS_TEXT,11,33,74,10 @@ -400,51 +398,29 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,126,106,50,14 END -IDD_Settings_Advanced DIALOG DISCARDABLE 0, 0, 231, 206 -STYLE DS_MODALFRAME | WS_POPUP +IDD_Settings_Advanced DIALOGEX 0, 0, 231, 206 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Core Defaults",IDC_CORE_DEFAULTS,4,28,223,72 - LTEXT "CPU core style:",IDC_TEXT2,9,38,108,12 - COMBOBOX IDC_CPU_TYPE,118,37,105,49,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Function lookup method:",IDC_TEXT3,9,53,108,12 - COMBOBOX IDC_FUNCFIND,118,52,105,49,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Default Memory Size:",IDC_TEXT4,9,69,108,12 - COMBOBOX IDC_RDRAM_SIZE,118,67,105,49,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - LTEXT "Advanced Block Linking:",IDC_TEXT5,9,85,108,12 - COMBOBOX IDC_ABL,118,83,105,49,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_STATIC,4,134,223,58 CONTROL "Start Emulation when rom is opened?", IDC_START_ON_ROM_OPEN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,140,207,11 - CONTROL "Always overwrite default settings with ones from ini?", - IDC_USEINI,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | - WS_TABSTOP,12,153,207,11 + WS_TABSTOP,8,8,191,11 CONTROL "Automatically compress instant saves",IDC_ZIP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,166,207,11 + BS_AUTOCHECKBOX | WS_TABSTOP,8,24,191,11 CONTROL "Enable Debugger",IDC_DEBUGGER,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,179,207,8 - CTEXT "Most of these changes will not take effect till a new rom is opened or current rom is reset.", - IDC_INFO,4,10,223,19 - GROUPBOX "Default Self Mod Methods",IDC_STATIC,4,100,223,33 - CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,111,64,9 - CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,121,64,9 - CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,151,111,64,8 - CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,76,121,64,8 - CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,76,111,64,8 + WS_TABSTOP,8,41,191,8 + CONTROL "Remember selected cheats",IDC_REMEMBER_CHEAT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,57,191,8 + CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,72,86,9 + COMBOBOX IDC_FRAME_DISPLAY_TYPE,101,71,99,57,CBS_DROPDOWNLIST | + CBS_SORT | WS_VSCROLL | WS_TABSTOP END -IDD_Settings_ShellInt DIALOG DISCARDABLE 0, 0, 231, 206 -STYLE DS_MODALFRAME | WS_POPUP +IDD_Settings_ShellInt DIALOGEX 0, 0, 231, 206 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "",IDC_STATIC,5,13,218,168 @@ -732,103 +708,80 @@ BEGIN EDITTEXT IDC_INFO3,69,51,104,15,ES_AUTOHSCROLL | ES_READONLY END -IDD_Settings_Config DIALOG DISCARDABLE 0, 0, 357, 194 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_Settings_Config DIALOG DISCARDABLE 0, 0, 357, 207 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,246,175,50,14 - PUSHBUTTON "Cancel",IDCANCEL,300,175,50,14 + DEFPUSHBUTTON "OK",IDOK,194,186,50,14 + PUSHBUTTON "Cancel",IDCANCEL,248,186,50,14 CONTROL "Tree1",IDC_PAGELIST,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | - WS_BORDER | WS_TABSTOP,8,7,116,158 - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,7,169, + WS_BORDER | WS_TABSTOP,8,7,116,169 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,7,180, 343,1 - PUSHBUTTON "Reset",IDC_RESET,7,175,50,14 + PUSHBUTTON "Reset Page",IDC_RESET_PAGE,7,186,50,14,WS_DISABLED CONTROL "",IDC_SETTING_INFO,"Static",SS_ETCHEDFRAME,131,7,219, - 158 + 170 + PUSHBUTTON "Apply",IDAPPLY,301,186,50,14,WS_DISABLED + PUSHBUTTON "Reset All",IDC_RESET_ALL,63,186,50,14,WS_DISABLED END -IDD_Settings_GameRecompiler DIALOG DISCARDABLE 0, 0, 233, 206 +IDD_Settings_GameRecompiler DIALOGEX 0, 0, 230, 156 STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,11,13,91,10 - EDITTEXT IDC_GOOD_NAME,124,12,99,12,ES_AUTOHSCROLL | ES_READONLY - GROUPBOX "",IDC_STATIC,4,4,224,23 - GROUPBOX "",IDC_STATIC,4,27,224,139 - LTEXT "CPU core style:",IDC_CPU_TYPE_TEXT,11,37,111,10 - COMBOBOX IDC_CPU_TYPE,124,35,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | + LTEXT "CPU core style:",IDC_CPU_TYPE_TEXT,4,11,106,10 + COMBOBOX IDC_CPU_TYPE,113,8,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Function lookup method:",IDC_FUNCFIND_TEXT,11,51,111,10 - COMBOBOX IDC_FUNCFIND,124,50,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | + LTEXT "Function lookup method:",IDC_FUNCFIND_TEXT,4,27,106,10 + COMBOBOX IDC_FUNCFIND,113,25,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Memory Size:",IDC_MEMORY_SIZE_TEXT,11,65,111,10 - COMBOBOX IDC_RDRAM_SIZE,124,64,99,49,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "Advanced Block Linking:",IDC_BLOCK_LINKING_TEXT,11,80, - 111,10 - COMBOBOX IDC_BLOCK_LINKING,124,79,99,49,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "Default Save type:",IDC_SAVE_TYPE_TEXT,11,94,111,10 - COMBOBOX IDC_SAVE_TYPE,124,93,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT2,11,110,111,10 - COMBOBOX IDC_COUNTFACT,124,107,99,49,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,11,122,111,11 - CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,124,122,99,11 CONTROL "Register caching",IDC_ROM_REGCACHE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,11,133,111,11 - CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,124,132,99,11 - CONTROL "SP Hack",IDC_ROM_SPHACK,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,143,111,11 - CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,124,143,99,11 - CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,11,154,102,8 - GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,4,168,224,32 + BS_AUTOCHECKBOX | WS_TABSTOP,6,49,95,11 + GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,6,63,208,54 CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,177,64,9 + WS_TABSTOP,6,75,95,9 CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,12,187,64,9 + WS_TABSTOP,6,87,95,9 CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,151,177,64,8 + BS_AUTOCHECKBOX | WS_TABSTOP,6,99,95,8 CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,76,187,64,8 + BS_AUTOCHECKBOX | WS_TABSTOP,113,87,95,8 CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,76,177,64,8 - CONTROL "Custom Self Mod Method",IDC_CUSTOM_SMM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,124,154,99,8 + WS_TABSTOP,113,75,95,8 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,42, + 208,1 + CONTROL "Advanced Block Linking",IDC_BLOCK_LINKING,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,113,49,95,11 END IDD_Settings_GamePlugin DIALOGEX 0, 0, 231, 206 STYLE DS_CENTER | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_TOOLWINDOW +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg" BEGIN - COMBOBOX GFX_LIST,17,30,155,79,CBS_DROPDOWNLIST | CBS_SORT | + COMBOBOX GFX_LIST,7,18,155,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX " Audio: ",IDC_AUDIO_NAME,10,54,214,29 - COMBOBOX AUDIO_LIST,17,64,155,79,CBS_DROPDOWNLIST | CBS_SORT | + PUSHBUTTON "About",GFX_ABOUT,166,18,44,13,WS_DISABLED + COMBOBOX AUDIO_LIST,7,48,155,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX " Controller: ",IDC_CONT_NAME,10,93,214,29 - COMBOBOX CONT_LIST,17,103,155,79,CBS_DROPDOWNLIST | CBS_SORT | + PUSHBUTTON "About",AUDIO_ABOUT,166,48,44,13,WS_DISABLED + COMBOBOX CONT_LIST,7,76,155,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX " Reality Signal Processor: ",IDC_RSP_NAME,10,128,214,29 - COMBOBOX RSP_LIST,17,139,155,79,CBS_DROPDOWNLIST | CBS_SORT | + PUSHBUTTON "About",CONT_ABOUT,166,76,44,13,WS_DISABLED + COMBOBOX RSP_LIST,7,105,155,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "About",GFX_ABOUT,176,30,44,13,WS_DISABLED - PUSHBUTTON "About",AUDIO_ABOUT,176,64,44,13,WS_DISABLED - PUSHBUTTON "About",CONT_ABOUT,176,103,44,13,WS_DISABLED - PUSHBUTTON "About",RSP_ABOUT,176,139,44,13,WS_DISABLED + PUSHBUTTON "About",RSP_ABOUT,166,105,44,13,WS_DISABLED CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,9,164,215,8 + BS_AUTOCHECKBOX | WS_TABSTOP,9,127,193,8 CONTROL "Use High Level Audio",IDC_HLE_AUDIO,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,9,177,215,8 + BS_AUTOCHECKBOX | WS_TABSTOP,9,140,188,8 + GROUPBOX "Graphics:",IDC_GRAPHICS_NAME,6,6,208,29 + GROUPBOX "Audio:",IDC_AUDIO_NAME,6,38,208,29 + GROUPBOX "Controller:",IDC_CONT_NAME,6,66,208,29 + GROUPBOX "Reality Signal Processor: ",IDC_RSP_NAME,6,96,208,29 END @@ -891,7 +844,7 @@ BEGIN BEGIN LEFTMARGIN, 4 TOPMARGIN, 4 - BOTTOMMARGIN, 200 + BOTTOMMARGIN, 177 END IDD_Key_Prompt, DIALOG @@ -1046,15 +999,15 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 350 TOPMARGIN, 7 - BOTTOMMARGIN, 187 + BOTTOMMARGIN, 200 END IDD_Settings_GameRecompiler, DIALOG BEGIN LEFTMARGIN, 4 - RIGHTMARGIN, 231 + RIGHTMARGIN, 228 TOPMARGIN, 4 - BOTTOMMARGIN, 200 + BOTTOMMARGIN, 150 END IDD_Settings_GamePlugin, DIALOG @@ -1062,7 +1015,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 222 TOPMARGIN, 7 - BOTTOMMARGIN, 131 + BOTTOMMARGIN, 172 END END #endif // APSTUDIO_INVOKED diff --git a/Source/Project64/User Interface/WTL Controls/ModifiedCheckBox.h b/Source/Project64/User Interface/WTL Controls/ModifiedCheckBox.h new file mode 100644 index 000000000..fc7b16749 --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/ModifiedCheckBox.h @@ -0,0 +1,75 @@ +#pragma once + +class CModifiedButton : + public CButton +{ + bool m_Changed; + bool m_Reset; + HFONT m_BoldFont; + HFONT m_OriginalFont; + + +public: + // Constructors + CModifiedButton(HWND hWnd = NULL) : + CButton(hWnd), + m_Changed(false), + m_Reset(false), + m_BoldFont(NULL), + m_OriginalFont(NULL) + { + } + + ~CModifiedButton() + { + if (m_BoldFont) + { + DeleteObject(m_BoldFont); + } + } + + void SetReset (bool Reset) + { + m_Reset = Reset; + if (m_Reset) + { + SetChanged(false); + } + } + + void SetChanged (bool Changed) + { + m_Changed = Changed; + if (m_Changed) + { + SetReset(false); + if (m_BoldFont == NULL) + { + m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); + + LOGFONT lfSystemVariableFont; + GetObject ( m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont ); + lfSystemVariableFont.lfWeight = FW_BOLD; + + m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); + } + SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); + InvalidateRect(NULL); + } else { + if (m_OriginalFont) + { + SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); + InvalidateRect(NULL); + } + } + } + + inline bool IsChanged ( void ) const + { + return m_Changed; + } + inline bool IsReset ( void ) const + { + return m_Reset; + } +}; diff --git a/Source/Project64/User Interface/WTL Controls/ModifiedComboBox.h b/Source/Project64/User Interface/WTL Controls/ModifiedComboBox.h new file mode 100644 index 000000000..1cfea28cb --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/ModifiedComboBox.h @@ -0,0 +1,140 @@ +#pragma once + +template +class CModifiedComboBoxT : + public CComboBox +{ + bool m_Changed; + bool m_Reset; + TParam m_defaultValue; + HFONT m_BoldFont; + HFONT m_OriginalFont; + HWND m_TextField; + +public: + // Constructors + CModifiedComboBoxT(HWND hWnd = NULL) : + CComboBox(hWnd), + m_Changed(false), + m_Reset(false), + m_BoldFont(NULL), + m_OriginalFont(NULL), + m_TextField(NULL) + { + } + + CModifiedComboBoxT(TParam defaultValue, HWND hWnd = NULL ) : + CComboBox(hWnd), + m_Changed(false), + m_Reset(false), + m_BoldFont(NULL), + m_OriginalFont(NULL), + m_defaultValue(), + m_TextField(NULL) + { + } + + ~CModifiedComboBoxT() + { + if (m_BoldFont) + { + DeleteObject(m_BoldFont); + } + } + + int AddItem (LPCSTR strItem, TParam lParam) + { + int indx = AddString(strItem); + SetItemData(indx,(DWORD_PTR)lParam); + if (GetCount() == 1 || m_defaultValue == lParam) + { + SetCurSel(indx); + } + return indx; + } + + void SetReset ( bool Reset ) + { + m_Reset = Reset; + if (m_Reset) + { + SetChanged(false); + } + } + + void SetChanged (bool Changed) + { + m_Changed = Changed; + if (m_Changed) + { + SetReset(false); + if (m_BoldFont == NULL) + { + m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); + + LOGFONT lfSystemVariableFont; + GetObject ( m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont ); + lfSystemVariableFont.lfWeight = FW_BOLD; + + m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); + } + SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); + InvalidateRect(NULL); + if (m_TextField) + { + ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0); + ::InvalidateRect(m_TextField, NULL, true); + + } + } else { + if (m_OriginalFont) + { + SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); + InvalidateRect(NULL); + if (m_TextField) + { + ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0); + ::InvalidateRect(m_TextField, NULL, true); + } + } + } + } + + void SetTextField (HWND hWnd) + { + if (m_TextField && m_OriginalFont) + { + ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_OriginalFont,0); + } + m_TextField = hWnd; + if (m_Changed && m_BoldFont) + { + ::SendMessage(m_TextField,WM_SETFONT,(WPARAM)m_BoldFont,0); + } + } + + inline void SetDefault (TParam defaultValue) + { + m_defaultValue = defaultValue; + for (int i = 0, n = GetCount(); i < n; i++) + { + if (GetItemData(i) == m_defaultValue) + { + SetCurSel(i); + break; + } + } + } + + inline bool IsChanged ( void ) const + { + return m_Changed; + } + inline bool IsReset ( void ) const + { + return m_Reset; + } + +}; + +typedef CModifiedComboBoxT CModifiedComboBox; diff --git a/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.cpp b/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.cpp new file mode 100644 index 000000000..a924b2722 --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.cpp @@ -0,0 +1,69 @@ +#include + +CModifiedEditBox::CModifiedEditBox(HWND hWnd) : + CEdit(hWnd), + m_Changed(false), + m_Reset(false), + m_BoldFont(NULL), + m_OriginalFont(NULL) +{ +} + +CModifiedEditBox::~CModifiedEditBox() +{ + if (m_BoldFont) + { + DeleteObject(m_BoldFont); + } +} + +void CModifiedEditBox::SetReset ( bool Reset ) +{ + m_Reset = Reset; + if (m_Reset) + { + SetChanged(false); + } +} + +void CModifiedEditBox::SetChanged (bool Changed) +{ + m_Changed = Changed; + if (m_Changed) + { + SetReset(false); + if (m_BoldFont == NULL) + { + m_OriginalFont = (HFONT)SendMessage(WM_GETFONT); + + LOGFONT lfSystemVariableFont; + GetObject ( m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont ); + lfSystemVariableFont.lfWeight = FW_BOLD; + + m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont ); + } + SendMessage(WM_SETFONT,(WPARAM)m_BoldFont); + InvalidateRect(NULL); + } else { + if (m_OriginalFont) + { + SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont); + InvalidateRect(NULL); + } + } +} + +stdstr CModifiedEditBox::GetWindowText( void ) +{ + stdstr Result; + ATLASSERT(::IsWindow(m_hWnd)); + + int nLen = ::GetWindowTextLength(m_hWnd); + if(nLen == 0) + { + return Result; + } + Result.resize(nLen+1); + ::GetWindowText(m_hWnd,(char *)Result.c_str(),nLen+1); + return Result; +} diff --git a/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.h b/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.h new file mode 100644 index 000000000..f1b1cd43d --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/ModifiedEditBox.h @@ -0,0 +1,30 @@ +#pragma once + +class CModifiedEditBox : + public CEdit +{ + bool m_Changed; + bool m_Reset; + HFONT m_BoldFont; + HFONT m_OriginalFont; + +public: + // Constructors + CModifiedEditBox(HWND hWnd = NULL); + ~CModifiedEditBox(); + + void SetReset ( bool Reset ); + void SetChanged (bool Changed); + stdstr GetWindowText(); + + inline bool IsChanged ( void ) const + { + return m_Changed; + } + inline bool IsReset ( void ) const + { + return m_Reset; + } + +}; + diff --git a/Source/Project64/User Interface/WTL Controls/PartialGroupBox.cpp b/Source/Project64/User Interface/WTL Controls/PartialGroupBox.cpp new file mode 100644 index 000000000..ec805442b --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/PartialGroupBox.cpp @@ -0,0 +1,97 @@ +#include +//#include + +BOOL CPartialGroupBox::Attach(HWND hWndNew) +{ + return SubclassWindow(hWndNew); +} + +BOOL CPartialGroupBox::AttachToDlgItem(HWND parent, UINT dlgID) +{ + return SubclassWindow(::GetDlgItem(parent,dlgID)); +} + +void CPartialGroupBox::Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight) +{ + int x = lpRect->left; + int y = lpRect->top; + int cx = lpRect->right - lpRect->left; + int cy = lpRect->bottom - lpRect->top; + + dc.FillSolidRect(x, y, cx - 1, 1, clrTopLeft); + //dc.FillSolidRect(x, y, 1, cy - 1, clrTopLeft); + //dc.FillSolidRect(x + cx, y, -1, cy, clrBottomRight); + //dc.FillSolidRect(x, y + cy, cx, -1, clrBottomRight); +} + +void CPartialGroupBox::OnPaint(HDC hDC) +{ + CPaintDC dc(m_hWnd); + + //paint groupbox manually + CRect controlrect; + GetClientRect(controlrect); + //::MapWindowPoints(HWND_DESKTOP, GetParent(), (LPPOINT)(LPRECT)controlrect, (sizeof(RECT)/sizeof(POINT))); + + CFontHandle font = GetFont(); + + dc.SelectFont(font); + dc.SetMapMode(MM_TEXT); + dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE)); + + TCHAR grptext[MAX_PATH]; + GetWindowText(grptext,MAX_PATH); + + CRect fontsizerect(0,0,0,0); + dc.DrawText(grptext,-1,fontsizerect,DT_SINGLELINE|DT_LEFT|DT_CALCRECT); + + CRect framerect(controlrect); + framerect.top += (fontsizerect.Height())/2; + long Style = GetStyle(); + + if((Style & 0xF000) == BS_FLAT) + { + dc.Draw3dRect(framerect,RGB(0,0,0),RGB(0,0,0)); + framerect.DeflateRect(1,1); + dc.Draw3dRect(framerect,RGB(255,255,255),RGB(255,255,255)); + } + else + { + Draw3dLine(dc,framerect,GetSysColor(COLOR_3DSHADOW),GetSysColor(COLOR_3DHILIGHT)); + framerect.DeflateRect(1,1); + Draw3dLine(dc,framerect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_3DSHADOW)); + } + + if(_tcslen(grptext)) + { + CRect fontrect(controlrect); + fontrect.bottom = controlrect.top+fontsizerect.Height(); + + if((Style & 0xF00) == BS_RIGHT) + { + fontrect.right -= 6; + fontrect.left = fontrect.right - fontsizerect.Width(); + } + else if((Style & 0xF00) == BS_CENTER) + { + fontrect.left += (controlrect.Width()-fontsizerect.Width())/2; + fontrect.right = fontrect.left + fontsizerect.Width(); + } + else //BS_LEFT or default + { + fontrect.left += 6; + fontrect.right = fontrect.left + fontsizerect.Width(); + } + + fontrect.InflateRect(2,0); + dc.FillRect(fontrect,GetSysColor(COLOR_BTNFACE)); + fontrect.DeflateRect(2,0); + + //Draw Caption + dc.SetBkMode(OPAQUE); + dc.SetBkColor(GetSysColor(COLOR_BTNFACE)); + + dc.DrawText(grptext,-1,fontrect,DT_SINGLELINE|DT_LEFT); + } + +} diff --git a/Source/Project64/User Interface/WTL Controls/PartialGroupBox.h b/Source/Project64/User Interface/WTL Controls/PartialGroupBox.h new file mode 100644 index 000000000..4f2ec00ad --- /dev/null +++ b/Source/Project64/User Interface/WTL Controls/PartialGroupBox.h @@ -0,0 +1,26 @@ +#pragma once + +class CPartialGroupBox : + public CWindowImpl +{ + void Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight); + +public: + BEGIN_MSG_MAP_EX(CPartialGroupBox) + MSG_WM_PAINT(OnPaint) + END_MSG_MAP() + + // Constructors + CPartialGroupBox() + { + } + + + virtual ~CPartialGroupBox() + { + } + + BOOL Attach(HWND hWndNew); + BOOL AttachToDlgItem(HWND parent, UINT dlgID); + void OnPaint(HDC hDC); +}; diff --git a/Source/Project64/User Interface/resource.h b/Source/Project64/User Interface/resource.h index 71d723b14..2a13b5a44 100644 --- a/Source/Project64/User Interface/resource.h +++ b/Source/Project64/User Interface/resource.h @@ -2,6 +2,7 @@ // Microsoft Developer Studio generated include file. // Used by UI Resources.rc // +#define IDAPPLY 3 #define IDI_PJ64_Icon 101 #define IDD_Rom_Information 104 #define IDD_Key_Prompt 108 @@ -66,10 +67,12 @@ #define IDC_INFO_ROMNAME 1008 #define IDC_BUTTON3 1008 #define IDC_RESET 1008 +#define IDC_RESET_PAGE 1008 #define IDC_INFO_CARTID 1009 #define IDC_VIRTUALKEY 1009 #define IDC_VALUE_ALIGN 1009 #define IDC_FRAME_DISPLAY_TYPE 1009 +#define IDC_RESET_ALL 1009 #define IDC_INFO_ROMSIZE 1010 #define IDC_KEY_PROMPT 1010 #define IDC_BTN_SPMEM 1010 @@ -82,13 +85,14 @@ #define IDC_HLE_GFX 1011 #define IDC_CHK_VADDR 1011 #define IDC_SEARCH_HEX 1011 -#define IDC_DISPLAY_FRAMERATE 1011 +#define IDC_DISPLAY_FRAMERATE 1012 #define IDC_INFO_MANUFACTURER 1012 #define IDC_ALT 1012 #define IDC_LIST 1012 #define IDC_HLE_AUDIO 1012 #define IDC_SMM_CACHE 1012 #define IDC_CASE_SENSITIVE 1012 +#define IDC_DISPLAY_FRAMERATE2 1013 #define IDC_INFO_COUNTRY 1013 #define IDC_SHIFT 1013 #define IDC_TLB 1013 @@ -229,10 +233,12 @@ #define IDC_ZIP 1092 #define IDC_SETTING_INFO 1092 #define IDC_GOOD_NAME_TEXT 1093 +#define IDC_GRAPHICS_NAME 1093 #define IDC_FUNCFIND_TEXT 1094 #define IDC_REMEMBER 1095 #define IDC_AUTOSLEEP 1096 #define IDC_COUNTFACT_TEXT2 1096 +#define IDC_COUNTFACT_TEXT 1096 #define IDC_RSP_NAME 1097 #define IDC_REMEMBERDIR 1097 #define IDC_GFX_NAME 1098 @@ -352,7 +358,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 150 #define _APS_NEXT_COMMAND_VALUE 40008 -#define _APS_NEXT_CONTROL_VALUE 1093 +#define _APS_NEXT_CONTROL_VALUE 1095 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Source/Project64/ValidateBinary.cpp b/Source/Project64/ValidateBinary.cpp index f8acb7d68..89d3107df 100644 --- a/Source/Project64/ValidateBinary.cpp +++ b/Source/Project64/ValidateBinary.cpp @@ -103,7 +103,7 @@ void TestValidBinaryThread ( ) #ifdef DEBUG_VALIDATE WriteTrace(TraceError,"v3"); #endif - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); return; } @@ -121,7 +121,7 @@ void TestValidBinaryThread ( ) #ifdef DEBUG_VALIDATE WriteTrace(TraceError,"v4"); #endif - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); InternetCloseHandle (hSession); hSession = NULL; return; @@ -153,7 +153,7 @@ void TestValidBinaryThread ( ) #ifdef DEBUG_VALIDATE WriteTrace(TraceError,"v5"); #endif - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); InternetCloseHandle (hRequest); return; } @@ -162,7 +162,7 @@ void TestValidBinaryThread ( ) DWORD Length = sizeof(ComputerName); GetComputerName(ComputerName,&Length); - stdstr_f PostInfo("1,%s,%s,%s,%s,%s,%s",VALIDATE_BIN_APP,File_md5.hex_digest(),ComputerName,VersionInfo(VERSION_PRODUCT_VERSION).c_str(),_Settings->LoadString(BetaUserName).c_str(),_Settings->LoadString(BetaEmailAddress).c_str()); + stdstr_f PostInfo("1,%s,%s,%s,%s,%s,%s",VALIDATE_BIN_APP,File_md5.hex_digest(),ComputerName,VersionInfo(VERSION_PRODUCT_VERSION).c_str(),_Settings->LoadString(Beta_UserName).c_str(),_Settings->LoadString(Beta_EmailAddress).c_str()); //"Content-Type: application/x-www-form-urlencoded" char ContentType[] = { "\xE9\x2C\x01\x1A\x11\x0B\x1A\x59\x79\x2D\x09\x15\x5F\x1A\x41\x11\x00\x1C\x05\x0A\x02\x15\x1D\x06\x01\x41\x57\x55\x5A\x00\x00\x5A\x4B\x09\x1D\x1F\x40\x58\x07\x1E\x09\x0B\x0D\x0C\x0B\x01\x01" }; @@ -185,7 +185,7 @@ void TestValidBinaryThread ( ) #ifdef DEBUG_VALIDATE WriteTrace(TraceError,"v6"); #endif - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); InternetCloseHandle (hRequest); return; } @@ -198,7 +198,7 @@ void TestValidBinaryThread ( ) #ifdef DEBUG_VALIDATE WriteTrace(TraceError,"v7"); #endif - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); InternetCloseHandle (hRequest); return; } @@ -236,7 +236,8 @@ void TestValidBinaryThread ( ) bSaveRunInfo = true; } DefaultResult = true; - } else if (Result_md5.hex_digest() == "9030FF575A9B687DC868B966CB7C02D4") // Bad MD5 + } + else if (Result_md5.hex_digest() == "9030FF575A9B687DC868B966CB7C02D4") // Bad MD5 { if (LastRunItem > 0) { @@ -313,7 +314,7 @@ void TestValidBinaryThread ( ) RegCloseKey(hKeyResults); } } - _Settings->SaveDword(IsValidExe,DefaultResult); + _Settings->SaveBool(Beta_IsValidExe,DefaultResult); } void TestValidBinary ( ) diff --git a/Source/Project64/WTL App.h b/Source/Project64/WTL App.h index 8c8b2bf1a..313232b21 100644 --- a/Source/Project64/WTL App.h +++ b/Source/Project64/WTL App.h @@ -36,3 +36,7 @@ extern CPj64Module _Module; #include "User Interface/resource.h" #include "User Interface/WTL Controls/numberctrl.h" #include "User Interface/WTL Controls/ClistCtrl/ListCtrl.h" +#include "User Interface/WTL Controls/ModifiedComboBox.h" +#include "User Interface/WTL Controls/PartialGroupBox.h" +#include "User Interface/WTL Controls/ModifiedEditBox.h" +#include "User Interface/WTL Controls/ModifiedCheckBox.h" diff --git a/Source/Project64/main.cpp b/Source/Project64/main.cpp index 3cec7258b..4cd30bbe6 100644 --- a/Source/Project64/main.cpp +++ b/Source/Project64/main.cpp @@ -139,12 +139,12 @@ void FixUPXIssue ( BYTE * ProgramLocation ) void LogLevelChanged (CTraceFileLog * LogFile) { - LogFile->SetTraceLevel((TraceLevel)_Settings->LoadDword(AppLogLevel)); + LogFile->SetTraceLevel((TraceLevel)_Settings->LoadDword(Debugger_AppLogLevel)); } void LogFlushChanged (CTraceFileLog * LogFile) { - LogFile->SetFlushFile(_Settings->LoadDword(AppLogFlush) != 0); + LogFile->SetFlushFile(_Settings->LoadDword(Debugger_AppLogFlush) != 0); } @@ -153,12 +153,12 @@ void InitializeLog ( void) CPath LogFilePath(CPath::MODULE_DIRECTORY,_T("Project64.log")); - CTraceFileLog * LogFile = new CTraceFileLog(LogFilePath, _Settings->LoadDword(AppLogFlush) != 0, Log_New); - LogFile->SetTraceLevel((TraceLevel)_Settings->LoadDword(AppLogLevel)); + CTraceFileLog * LogFile = new CTraceFileLog(LogFilePath, _Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New); + LogFile->SetTraceLevel((TraceLevel)_Settings->LoadDword(Debugger_AppLogLevel)); AddTraceModule(LogFile); - _Settings->RegisterChangeCB(AppLogLevel,LogFile,(CSettings::SettingChangedFunc)LogLevelChanged); - _Settings->RegisterChangeCB(AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged); + _Settings->RegisterChangeCB(Debugger_AppLogLevel,LogFile,(CSettings::SettingChangedFunc)LogLevelChanged); + _Settings->RegisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, int nWinMode) { @@ -174,77 +174,76 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, InitializeLog(); - WriteTrace(TraceDebug,"WinMain 1"); + WriteTrace(TraceDebug,"WinMain - Application Starting"); FixUPXIssue((BYTE *)hInstance); - WriteTrace(TraceDebug,"WinMain 2"); //Create the plugin container - WriteTrace(TraceDebug,"WinMain 3"); - CPlugins Plugins ( _Settings->LoadString(PluginDirectory) ); - WriteTrace(TraceDebug,"WinMain 4"); + WriteTrace(TraceDebug,"WinMain - Create Plugins"); + CPlugins Plugins ( _Settings->LoadString(Directory_Plugin) ); + WriteTrace(TraceDebug,"WinMain - Create N64 system"); CN64System N64System ( &Notify(), &Plugins ); //Create the backend n64 system //Select the language _Lang->LoadCurrentStrings(true); //Create the main window with Menu - WriteTrace(TraceDebug,"WinMain 6"); + WriteTrace(TraceDebug,"WinMain - Create Main Window"); stdstr WinTitle(AppName); - if (_Settings->LoadBool(IsBetaVersion)) + if (_Settings->LoadBool(Beta_IsBetaVersion)) { - WinTitle.Format("Project64 %s (%s)",VersionInfo(VERSION_PRODUCT_VERSION).c_str(),_Settings->LoadString(BetaUserName).c_str()); + WinTitle.Format("Project64 %s (%s)",VersionInfo(VERSION_PRODUCT_VERSION).c_str(),_Settings->LoadString(Beta_UserName).c_str()); } - WriteTrace(TraceDebug,"WinMain 7"); CMainGui MainWindow(WinTitle.c_str(),&Notify(),&N64System), HiddenWindow; - WriteTrace(TraceDebug,"WinMain 8"); CMainMenu MainMenu(&MainWindow, &N64System); + Plugins.SetRenderWindows(&MainWindow,&HiddenWindow); + Notify().SetMainWindow(&MainWindow); { - stdstr_f User("%s",_Settings->LoadString(BetaUserName).c_str()); - stdstr_f Email("%s",_Settings->LoadString(BetaEmailAddress).c_str()); + stdstr_f User("%s",_Settings->LoadString(Beta_UserName).c_str()); + stdstr_f Email("%s",_Settings->LoadString(Beta_EmailAddress).c_str()); - if (MD5(User).hex_digest() != _Settings->LoadString(BetaUserNameMD5) || - MD5(Email).hex_digest() != _Settings->LoadString(BetaEmailAddressMD5)) + if (MD5(User).hex_digest() != _Settings->LoadString(Beta_UserNameMD5) || + MD5(Email).hex_digest() != _Settings->LoadString(Beta_EmailAddressMD5)) { return false; } } - WriteTrace(TraceDebug,"WinMain 9"); - - Plugins.SetRenderWindows(&MainWindow,&HiddenWindow); - Notify().SetMainWindow(&MainWindow); - - WriteTrace(TraceDebug,"WinMain 10"); + if (__argc > 1) { + WriteTraceF(TraceDebug,"WinMain - Cmd line found \"%s\"",__argv[1]); MainWindow.Show(true); //Show the main window N64System.RunFileImage(__argv[1]); } else { - if (_Settings->LoadDword(RomBrowser)) { + if (_Settings->LoadDword(RomBrowser_Enabled)) + { + WriteTrace(TraceDebug,"WinMain - Show Rom Browser"); //Display the rom browser MainWindow.SetPluginList(&Plugins); MainWindow.ShowRomList(); MainWindow.Show(true); //Show the main window MainWindow.HighLightLastRom(); } else { + WriteTrace(TraceDebug,"WinMain - Show Main Window"); MainWindow.Show(true); //Show the main window } } - - //stdstr File = _Settings->LoadString(FirstRecentRom); - //if (File.length() > 0) { N64System.RunFileImage(File.c_str()); } //Process Messages till program is closed - WriteTrace(TraceDebug,"WinMain 13"); + WriteTrace(TraceDebug,"WinMain - Entering Message Loop"); MainWindow.ProcessAllMessages(); - WriteTrace(TraceDebug,"WinMain 14"); + WriteTrace(TraceDebug,"WinMain - Message Loop Finished"); N64System.CloseCpu(); //terminate the cpu thread before quiting + + WriteTrace(TraceDebug,"WinMain - System Closed"); } catch(...) { + WriteTraceF(TraceError,"WinMain - Exception caught (File: \"%s\" Line: %d)",__FILE__,__LINE__); MessageBox(NULL,stdstr_f("Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__).c_str(),"Exception",MB_OK); } + WriteTrace(TraceDebug,"WinMain - cleaning up global objects"); if (_Settings) { delete _Settings; diff --git a/Source/Project64/res/vssver2.scc b/Source/Project64/res/vssver2.scc deleted file mode 100644 index f8efecc4c..000000000 Binary files a/Source/Project64/res/vssver2.scc and /dev/null differ