From 782e781bab1b0689be7efe03dd5bdf241c5da739 Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 2 Feb 2021 13:22:47 +1030 Subject: [PATCH] Be able to edit/enable/disable enhancements while running --- Lang/English.pj.Lang | 6 + Source/Project64-core/Multilanguage.h | 6 + .../Multilanguage/LanguageClass.cpp | 6 + .../N64System/Enhancement/Enhancement.cpp | 4 +- .../N64System/Enhancement/Enhancements.cpp | 13 +- Source/Project64-core/Settings.cpp | 2 +- .../Project64/UserInterface/CheatClassUI.cpp | 14 +- .../Project64/UserInterface/EnhancementUI.cpp | 155 +++++++++++++++++- .../Project64/UserInterface/EnhancementUI.h | 20 ++- Source/Project64/UserInterface/MainMenu.cpp | 11 ++ Source/Project64/UserInterface/MainMenu.h | 3 +- Source/Project64/UserInterface/MainWindow.cpp | 8 +- Source/Project64/UserInterface/MainWindow.h | 1 + .../UserInterface/RomBrowserClass.cpp | 2 +- .../Settings/SettingsPage-AdvancedOptions.cpp | 2 + .../Settings/SettingsPage-Options.cpp | 2 - Source/Project64/UserInterface/UIResources.rc | 31 ++-- 17 files changed, 249 insertions(+), 37 deletions(-) diff --git a/Lang/English.pj.Lang b/Lang/English.pj.Lang index d9498a4f8..40d6898a4 100644 --- a/Lang/English.pj.Lang +++ b/Lang/English.pj.Lang @@ -53,6 +53,7 @@ #133# "&Soft Reset" #134# "&Hard Reset" #135# "Swap &Disk" +#136# "Enhancement..." //Options Menu #140# "&Options" @@ -471,6 +472,11 @@ #1213# "Code has been sent to your email" #1214# "Failed to send code, please make sure it is the email you supported with" +/********************************************************************************* +* Enhancements * +*********************************************************************************/ +#1300# "Enhancements" + /********************************************************************************* * Messages * *********************************************************************************/ diff --git a/Source/Project64-core/Multilanguage.h b/Source/Project64-core/Multilanguage.h index d26caf743..82594f913 100644 --- a/Source/Project64-core/Multilanguage.h +++ b/Source/Project64-core/Multilanguage.h @@ -83,6 +83,7 @@ enum LanguageStringID MENU_RESET_SOFT = 133, MENU_RESET_HARD = 134, MENU_SWAPDISK = 135, + MENU_ENHANCEMENT = 136, //Options Menu MENU_OPTIONS = 140, @@ -511,6 +512,11 @@ enum LanguageStringID MSG_SUPPORT_REQUESTCODE_SUCCESS = 1213, MSG_SUPPORT_REQUESTCODE_FAIL = 1214, + /********************************************************************************* + * Enhancements * + *********************************************************************************/ + ENHANCEMENT_TITLE = 1300, + /********************************************************************************* * Messages * *********************************************************************************/ diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index 44cf6cd41..190d547a2 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -90,6 +90,7 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(MENU_RESET_SOFT, "&Soft Reset"); DEF_STR(MENU_RESET_HARD, "&Hard Reset"); DEF_STR(MENU_SWAPDISK, "Swap &Disk"); + DEF_STR(MENU_ENHANCEMENT, "Enhancement..."); //Options Menu DEF_STR(MENU_OPTIONS, "&Options"); @@ -476,6 +477,11 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(MSG_SUPPORT_REQUESTCODE_SUCCESS, "Code has been sent to your email"); DEF_STR(MSG_SUPPORT_REQUESTCODE_FAIL, "Failed to send code, please make sure it is the email you supported with"); + /********************************************************************************* + * Enhancements * + *********************************************************************************/ + DEF_STR(ENHANCEMENT_TITLE, "Enhancements"); + /********************************************************************************* * Messages * *********************************************************************************/ diff --git a/Source/Project64-core/N64System/Enhancement/Enhancement.cpp b/Source/Project64-core/N64System/Enhancement/Enhancement.cpp index 4b307f95d..3cf655d55 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancement.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancement.cpp @@ -59,7 +59,7 @@ public: { return; } - Save(0, Active); + m_SettingsIniFile->SaveNumber(SectionName(), m_KeyNameIdex.c_str(), Active ? 1 : 0); Flush(); } @@ -69,7 +69,7 @@ public: { return; } - CSettingTypeGame::Delete(0); + CSettingTypeApplication::Delete(0); Flush(); } diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp index 2dffd1a76..5a36d1f0e 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp @@ -594,10 +594,14 @@ void CEnhancements::WaitScanDone() void CEnhancements::GameChanged(void) { + bool inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode); + bool CheatsRemembered = !inBasicMode && g_Settings->LoadBool(Setting_RememberCheats); + m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey); LoadCheats(nullptr); - if (!g_Settings->LoadDword(Setting_RememberCheats) && !m_ActiveCodes.empty()) + if (!CheatsRemembered && !m_ActiveCodes.empty()) { + bool reset = false; for (CEnhancementList::iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++) { if (!itr->second.Active()) @@ -605,8 +609,13 @@ void CEnhancements::GameChanged(void) continue; } itr->second.SetActive(false); + reset = true; + } + if (reset) + { + m_ActiveCodes.clear(); + LoadActive(m_Enhancements); } - m_ActiveCodes.clear(); } } diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index ed979963e..9a19ac6c9 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -127,7 +127,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0)); AddHandler(Setting_Enhancement, new CSettingTypeApplication("Settings", "Enable Enhancement", (uint32_t)true)); - AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (uint32_t)false)); + AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (bool)false)); AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("Settings", "Unique Game Dir", true)); AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("Settings", "Current Language", "")); AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false)); diff --git a/Source/Project64/UserInterface/CheatClassUI.cpp b/Source/Project64/UserInterface/CheatClassUI.cpp index 1d8ab1857..eea26d41e 100644 --- a/Source/Project64/UserInterface/CheatClassUI.cpp +++ b/Source/Project64/UserInterface/CheatClassUI.cpp @@ -101,6 +101,7 @@ LRESULT CCheatsUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara int32_t Y = (((rcParent.Height()) - DlgHeight) / 2) + rcParent.top; SetWindowPos(NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); m_SelectCheat.RefreshItems(); + ShowWindow(SW_SHOW); return 0; } @@ -1021,12 +1022,15 @@ void CEditCheat::RecordCurrentValues(void) bool CEditCheat::ValuesChanged(void) { bool Changed = false; - if (m_EditName != GetItemText(IDC_CODE_NAME) || - m_EditCode != GetItemText(IDC_CHEAT_CODES) || - m_EditOptions != GetItemText(IDC_CHEAT_OPTIONS) || - m_EditNotes != GetItemText(IDC_NOTES)) + if (m_hWnd != nullptr) { - Changed = true; + if (m_EditName != GetItemText(IDC_CODE_NAME) || + m_EditCode != GetItemText(IDC_CHEAT_CODES) || + m_EditOptions != GetItemText(IDC_CHEAT_OPTIONS) || + m_EditNotes != GetItemText(IDC_NOTES)) + { + Changed = true; + } } if (!Changed) { diff --git a/Source/Project64/UserInterface/EnhancementUI.cpp b/Source/Project64/UserInterface/EnhancementUI.cpp index 9d399c443..e18f260c2 100644 --- a/Source/Project64/UserInterface/EnhancementUI.cpp +++ b/Source/Project64/UserInterface/EnhancementUI.cpp @@ -107,7 +107,7 @@ void CEnhancementUI::Display(HWND hParent, bool BlockExecution) LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - SetWindowText(wGS(CHEAT_TITLE).c_str()); + SetWindowText(wGS(ENHANCEMENT_TITLE).c_str()); m_TreeList.Attach(GetDlgItem(IDC_ENHANCEMENTLIST)); LONG Style = m_TreeList.GetWindowLong(GWL_STYLE); @@ -120,13 +120,51 @@ LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* m_TreeList.SetImageList(hImageList, TVSIL_STATE); m_Enhancements = g_Enhancements->Enhancements(); + + CRect rcDlg, rcParent; + GetWindowRect(&rcDlg); + GetParent().GetWindowRect(&rcParent); + int32_t DlgWidth = rcDlg.Width(); + int32_t DlgHeight = rcDlg.Height(); + int32_t X = (((rcParent.Width()) - DlgWidth) / 2) + rcParent.left; + int32_t Y = (((rcParent.Height()) - DlgHeight) / 2) + rcParent.top; + SetWindowPos(NULL, X, Y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + RefreshList(); + ShowWindow(SW_SHOW); return TRUE; } -LRESULT CEnhancementUI::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +LRESULT CEnhancementUI::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/) { - EndDialog(wID); + m_TreeList.Detach(); + return 0; +} + +LRESULT CEnhancementUI::OnCloseCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +{ + if (m_bModal) + { + EndDialog(0); + } + else + { + DestroyWindow(); + } + return TRUE; +} + +LRESULT CEnhancementUI::OnEditEnhancement(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +{ + TVITEM item = { 0 }; + item.mask = TVIF_PARAM; + item.hItem = m_hSelectedItem; + if (!m_TreeList.GetItem(&item) || item.lParam == NULL) + { + return 0; + } + + CEditEnhancement(*this, (CEnhancement *)item.lParam).DoModal(m_hWnd); return TRUE; } @@ -137,6 +175,47 @@ LRESULT CEnhancementUI::OnAddEnhancement(WORD /*wNotifyCode*/, WORD /*wID*/, HWN return TRUE; } +LRESULT CEnhancementUI::OnEnhancementListClicked(NMHDR* lpnmh) +{ + uint32_t dwpos = GetMessagePos(); + TVHITTESTINFO ht = { 0 }; + ht.pt.x = GET_X_LPARAM(dwpos); + ht.pt.y = GET_Y_LPARAM(dwpos); + ::MapWindowPoints(HWND_DESKTOP, lpnmh->hwndFrom, &ht.pt, 1); + + TreeView_HitTest(lpnmh->hwndFrom, &ht); + + if (TVHT_ONITEMSTATEICON & ht.flags) + { + switch (TV_GetCheckState(ht.hItem)) + { + case TV_STATE_CLEAR: + case TV_STATE_INDETERMINATE: + TV_SetCheckState(ht.hItem, TV_STATE_CHECKED); + ChangeChildrenStatus(ht.hItem, true); + CheckParentStatus(m_TreeList.GetParentItem(ht.hItem)); + break; + case TV_STATE_CHECKED: + TV_SetCheckState(ht.hItem, TV_STATE_CLEAR); + ChangeChildrenStatus(ht.hItem, false); + CheckParentStatus(m_TreeList.GetParentItem(ht.hItem)); + break; + } + switch (TV_GetCheckState(ht.hItem)) + { + case TV_STATE_CHECKED: TV_SetCheckState(ht.hItem, TV_STATE_INDETERMINATE); break; + case TV_STATE_CLEAR: TV_SetCheckState(ht.hItem, TV_STATE_CHECKED); break; + case TV_STATE_INDETERMINATE: TV_SetCheckState(ht.hItem, TV_STATE_CLEAR); break; + } + + if (g_Enhancements != nullptr) + { + g_Enhancements->UpdateCheats(); + } + } + return 0; +} + LRESULT CEnhancementUI::OnEnhancementListRClicked(NMHDR* pNMHDR) { TVHITTESTINFO ht = { 0 }; @@ -239,6 +318,76 @@ void CEnhancementUI::AddCodeLayers(LPARAM Enhancement, const std::wstring & Name AddCodeLayers(Enhancement, Name.substr(wcslen(Text) + 1), hParent, Active); } +void CEnhancementUI::ChangeChildrenStatus(HTREEITEM hParent, bool Checked) +{ + HTREEITEM hItem = m_TreeList.GetChildItem(hParent);; + if (hItem == NULL) + { + if (hParent == TVI_ROOT) { return; } + + TVITEM item = { 0 }; + item.mask = TVIF_PARAM; + item.hItem = hParent; + m_TreeList.GetItem(&item); + if (item.lParam == NULL) + { + return; + } + CEnhancement * Enhancement = (CEnhancement *)item.lParam; + if (Checked && Enhancement->CodeOptionSize() != 0 && Enhancement->GetOptions().size() > 0 && !Enhancement->OptionSelected()) + { + return; + } + + TV_SetCheckState(hParent, Checked ? TV_STATE_CHECKED : TV_STATE_CLEAR); + Enhancement->SetActive(Checked); + return; + } + TV_CHECK_STATE state = TV_STATE_UNKNOWN; + while (hItem != NULL) + { + TV_CHECK_STATE ChildState = TV_GetCheckState(hItem); + if ((ChildState != TV_STATE_CHECKED || !Checked) && + (ChildState != TV_STATE_CLEAR || Checked)) + { + ChangeChildrenStatus(hItem, Checked); + } + ChildState = TV_GetCheckState(hItem); + if (state == TV_STATE_UNKNOWN) { state = ChildState; } + if (state != ChildState) { state = TV_STATE_INDETERMINATE; } + hItem = m_TreeList.GetNextSiblingItem(hItem); + } + if (state != TV_STATE_UNKNOWN) + { + TV_SetCheckState(hParent, state); + } +} + +void CEnhancementUI::CheckParentStatus(HTREEITEM hParent) +{ + if (hParent == NULL) + { + return; + } + HTREEITEM hItem = m_TreeList.GetChildItem(hParent); + TV_CHECK_STATE InitialState = TV_GetCheckState(hParent); + TV_CHECK_STATE CurrentState = TV_GetCheckState(hItem); + while (hItem != NULL) + { + if (TV_GetCheckState(hItem) != CurrentState) + { + CurrentState = TV_STATE_INDETERMINATE; + break; + } + hItem = m_TreeList.GetNextSiblingItem(hItem); + } + TV_SetCheckState(hParent, CurrentState); + if (InitialState != CurrentState) + { + CheckParentStatus(m_TreeList.GetParentItem(hParent)); + } +} + void CEnhancementUI::RefreshList() { m_TreeList.DeleteAllItems(); diff --git a/Source/Project64/UserInterface/EnhancementUI.h b/Source/Project64/UserInterface/EnhancementUI.h index 504b05aca..80b5b755f 100644 --- a/Source/Project64/UserInterface/EnhancementUI.h +++ b/Source/Project64/UserInterface/EnhancementUI.h @@ -27,8 +27,11 @@ class CEnhancementUI : public: BEGIN_MSG_MAP_EX(CEnhancementUI) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) + COMMAND_ID_HANDLER(ID_POPUP_EDIT, OnEditEnhancement) COMMAND_ID_HANDLER(ID_POPUP_ADDENHANCEMENT, OnAddEnhancement) + NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_CLICK, OnEnhancementListClicked) NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_RCLICK, OnEnhancementListRClicked) NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_DBLCLK, OnEnhancementListDClicked) END_MSG_MAP() @@ -45,13 +48,18 @@ private: CEnhancementUI(const CEnhancementUI&); CEnhancementUI& operator=(const CEnhancementUI&); - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); - LRESULT OnAddEnhancement(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnEnhancementListRClicked(NMHDR* pNMHDR); - LRESULT OnEnhancementListDClicked(NMHDR* pNMHDR); + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled); + LRESULT OnEditEnhancement(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled); + LRESULT OnAddEnhancement(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled ); + LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled); + LRESULT OnEnhancementListClicked(NMHDR* lpnmh); + LRESULT OnEnhancementListRClicked(NMHDR * pNMHDR); + LRESULT OnEnhancementListDClicked(NMHDR * pNMHDR); - void AddCodeLayers(LPARAM ListID, const std::wstring &Name, HTREEITEM hParent, bool Active); + void AddCodeLayers(LPARAM ListID, const std::wstring & Name, HTREEITEM hParent, bool Active); + void ChangeChildrenStatus(HTREEITEM hParent, bool Checked); + void CheckParentStatus(HTREEITEM hParent); void RefreshList(void); TV_CHECK_STATE TV_GetCheckState(HTREEITEM hItem); bool TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state); diff --git a/Source/Project64/UserInterface/MainMenu.cpp b/Source/Project64/UserInterface/MainMenu.cpp index 05b27e6f3..0cee54773 100644 --- a/Source/Project64/UserInterface/MainMenu.cpp +++ b/Source/Project64/UserInterface/MainMenu.cpp @@ -270,6 +270,11 @@ void CMainMenu::OnLodState(HWND hWnd) g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame); } +void CMainMenu::OnEnhancements(HWND /*hWnd*/) +{ + m_Gui->DisplayEnhancements(false); +} + void CMainMenu::OnCheats(HWND /*hWnd*/) { m_Gui->DisplayCheatsUI(false); @@ -357,6 +362,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break; case ID_SYSTEM_LOAD: OnLodState(hWnd); break; + case ID_SYSTEM_ENHANCEMENT: OnEnhancements(hWnd); break; case ID_SYSTEM_CHEAT: OnCheats(hWnd); break; case ID_SYSTEM_GSBUTTON: g_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed); @@ -733,6 +739,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu) bool RomLoading = g_Settings->LoadBool(GameRunning_LoadingInProgress); bool RomLoaded = g_Settings->LoadStringVal(Game_GameName).length() > 0; bool RomList = UISettingsLoadBool(RomBrowser_Enabled) && !CPURunning; + bool Enhancement = !inBasicMode && g_Settings->LoadBool(Setting_Enhancement); CMenuShortCutKey::RUNNING_STATE RunningState = CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING; if (g_Settings->LoadBool(GameRunning_CPU_Running)) @@ -940,6 +947,10 @@ void CMainMenu::FillOutMenu(HMENU hMenu) 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)); + if (Enhancement) + { + SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_ENHANCEMENT, MENU_ENHANCEMENT, m_ShortCuts.ShortCutString(ID_SYSTEM_ENHANCEMENT, RunningState))); + } SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT, RunningState))); SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON, RunningState))); diff --git a/Source/Project64/UserInterface/MainMenu.h b/Source/Project64/UserInterface/MainMenu.h index 118fc0d9c..860b925fb 100644 --- a/Source/Project64/UserInterface/MainMenu.h +++ b/Source/Project64/UserInterface/MainMenu.h @@ -19,7 +19,7 @@ enum MainMenuID //System Menu ID_SYSTEM_RESET_SOFT, ID_SYSTEM_RESET_HARD, ID_SYSTEM_PAUSE, ID_SYSTEM_BITMAP, ID_SYSTEM_LIMITFPS, ID_SYSTEM_SWAPDISK, ID_SYSTEM_RESTORE, ID_SYSTEM_LOAD, ID_SYSTEM_SAVE, - ID_SYSTEM_SAVEAS, ID_SYSTEM_CHEAT, ID_SYSTEM_GSBUTTON, + ID_SYSTEM_SAVEAS, ID_SYSTEM_ENHANCEMENT, ID_SYSTEM_CHEAT, ID_SYSTEM_GSBUTTON, //Current Save Slot ID_CURRENT_SAVE_1, ID_CURRENT_SAVE_2, ID_CURRENT_SAVE_3, ID_CURRENT_SAVE_4, ID_CURRENT_SAVE_5, @@ -81,6 +81,7 @@ private: void OnScreenShot(void); void OnSaveAs(HWND hWnd); void OnLodState(HWND hWnd); + void OnEnhancements(HWND hWnd); void OnCheats(HWND hWnd); void OnSettings(HWND hWnd); void OnSupportProject64(HWND hWnd); diff --git a/Source/Project64/UserInterface/MainWindow.cpp b/Source/Project64/UserInterface/MainWindow.cpp index 915b18f1a..bc7191395 100644 --- a/Source/Project64/UserInterface/MainWindow.cpp +++ b/Source/Project64/UserInterface/MainWindow.cpp @@ -347,6 +347,11 @@ void CMainGui::DisplayCheatsUI(bool BlockExecution) m_CheatsUI.Display(m_hMainWindow, BlockExecution); } +void CMainGui::DisplayEnhancements(bool BlockExecution) +{ + m_EnhancementUI.Display(m_hMainWindow, BlockExecution); +} + void CMainGui::BringToTop(void) { CGuard Guard(m_CS); @@ -397,7 +402,8 @@ WPARAM CMainGui::ProcessAllMessages(void) SetEvent(m_ResetInfo->hEvent); m_ResetInfo = NULL; } - if (m_CheatsUI.m_hWnd != NULL && IsDialogMessage(m_CheatsUI.m_hWnd, &msg)) + if ((m_CheatsUI.m_hWnd != NULL && IsDialogMessage(m_CheatsUI.m_hWnd, &msg)) || + (m_EnhancementUI.m_hWnd != NULL && IsDialogMessage(m_EnhancementUI.m_hWnd, &msg))) { continue; } diff --git a/Source/Project64/UserInterface/MainWindow.h b/Source/Project64/UserInterface/MainWindow.h index 6aca8a6ca..b34b81cc3 100644 --- a/Source/Project64/UserInterface/MainWindow.h +++ b/Source/Project64/UserInterface/MainWindow.h @@ -77,6 +77,7 @@ public: bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System); void DisplayCheatsUI(bool BlockExecution); + void DisplayEnhancements(bool BlockExecution); void * GetWindowHandle(void) const { return m_hMainWindow; } void * GetStatusBar(void) const { return m_hStatusWnd; } diff --git a/Source/Project64/UserInterface/RomBrowserClass.cpp b/Source/Project64/UserInterface/RomBrowserClass.cpp index dd4672d5c..1e2084631 100644 --- a/Source/Project64/UserInterface/RomBrowserClass.cpp +++ b/Source/Project64/UserInterface/RomBrowserClass.cpp @@ -865,7 +865,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/) else { bool inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode); - bool CheatsRemembered = g_Settings->LoadBool(Setting_RememberCheats); + bool CheatsRemembered = !inBasicMode && g_Settings->LoadBool(Setting_RememberCheats); bool Enhancement = !inBasicMode && g_Settings->LoadBool(Setting_Enhancement); if (!Enhancement) { DeleteMenu(hPopupMenu, 11, MF_BYPOSITION); } diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp index 8352903da..3ce4b52a8 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp @@ -26,6 +26,7 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay) SetDlgItemText(IDC_REMEMBER_CHEAT, wGS(OPTION_REMEMBER_CHEAT).c_str()); SetDlgItemText(IDC_UNIQUE_SAVE_DIR, wGS(OPTION_UNIQUE_SAVE_DIR).c_str()); SetDlgItemText(IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str()); + SetDlgItemText(IDC_ENABLE_ENHANCEMENTS, wGS(OPTION_ENABLE_ENHANCEMENTS).c_str()); SetDlgItemText(IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str()); AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart); @@ -35,6 +36,7 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay) AddModCheckBox(GetDlgItem(IDC_REMEMBER_CHEAT), Setting_RememberCheats); AddModCheckBox(GetDlgItem(IDC_UNIQUE_SAVE_DIR), Setting_UniqueSaveDir); AddModCheckBox(GetDlgItem(IDC_CHECK_RUNNING), Setting_CheckEmuRunning); + AddModCheckBox(GetDlgItem(IDC_ENABLE_ENHANCEMENTS), Setting_Enhancement); AddModCheckBox(GetDlgItem(IDC_DISPLAY_FRAMERATE), UserInterface_DisplayFrameRate); CModifiedComboBox * ComboBox; diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Options.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Options.cpp index 318167d04..8b6241617 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Options.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Options.cpp @@ -25,7 +25,6 @@ m_SettingsConfig(SettingsConfig) SetDlgItemText(IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str()); SetDlgItemText(IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str()); SetDlgItemText(IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str()); - SetDlgItemText(IDC_ENABLE_ENHANCEMENTS, wGS(OPTION_ENABLE_ENHANCEMENTS).c_str()); SetDlgItemText(IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str()); SetDlgItemText(IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str()); @@ -36,7 +35,6 @@ m_SettingsConfig(SettingsConfig) AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen); AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER), Setting_DisableScrSaver); AddModCheckBox(GetDlgItem(IDC_DISCORD_RPC), Setting_EnableDiscordRPC); - AddModCheckBox(GetDlgItem(IDC_ENABLE_ENHANCEMENTS), Setting_Enhancement); AddModCheckBox(GetDlgItem(IDC_BASIC_MODE), UserInterface_BasicMode); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER), File_RecentGameFileCount, false); diff --git a/Source/Project64/UserInterface/UIResources.rc b/Source/Project64/UserInterface/UIResources.rc index eafefe6dd..f8aa660ae 100644 --- a/Source/Project64/UserInterface/UIResources.rc +++ b/Source/Project64/UserInterface/UIResources.rc @@ -159,15 +159,14 @@ BEGIN CONTROL "Disable Screen Saver when running rom",IDC_SCREEN_SAVER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,39,206,10 CONTROL "Enable Discord Rich Presence",IDC_DISCORD_RPC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,54,206,10 - CONTROL "Enable Enhancements",IDC_ENABLE_ENHANCEMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,206,10 - CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,84,206,10 - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,99,208,1 - LTEXT "Max # of Roms Remembered (Max 10):",IDC_MAXROMS_TXT,6,107,145,10 - EDITTEXT IDC_REMEMBER,148,105,26,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "roms",IDC_ROMSEL_TEXT2,178,108,31,10 - LTEXT "Max # of Rom Dirs Remembered (Max 10):",IDC_MAXROMDIR_TXT,6,122,145,10 - EDITTEXT IDC_REMEMBERDIR,148,120,26,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "dirs",IDC_ROMSEL_TEXT4,178,124,34,10 + CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,206,10 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,84,208,1 + LTEXT "Max # of Roms Remembered (Max 10):",IDC_MAXROMS_TXT,6,92,145,10 + EDITTEXT IDC_REMEMBER,148,90,26,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "roms",IDC_ROMSEL_TEXT2,178,93,31,10 + LTEXT "Max # of Rom Dirs Remembered (Max 10):",IDC_MAXROMDIR_TXT,6,107,145,10 + EDITTEXT IDC_REMEMBERDIR,148,105,26,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "dirs",IDC_ROMSEL_TEXT4,178,109,34,10 END IDD_Rom_Information DIALOGEX 0, 0, 239, 207 @@ -341,13 +340,14 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,8,191,10 CONTROL "Automatically compress instant saves",IDC_ZIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,23,191,10 CONTROL "Enable Debugger",IDC_DEBUGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,38,191,10 + CONTROL "Always use interpreter core",IDC_INTERPRETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,53,191,10 CONTROL "Remember selected cheats",IDC_REMEMBER_CHEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,68,191,10 CONTROL "Check if project64 is already running",IDC_CHECK_RUNNING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,83,189,10 - CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,113,86,10 - COMBOBOX IDC_FRAME_DISPLAY_TYPE,101,112,99,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Unique Game Save Directory",IDC_UNIQUE_SAVE_DIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,189,10 - CONTROL "Always use interpreter core",IDC_INTERPRETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,53,191,10 + CONTROL "Enable Enhancements",IDC_ENABLE_ENHANCEMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,113,189,10 + CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,128,86,10 + COMBOBOX IDC_FRAME_DISPLAY_TYPE,102,128,99,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_Settings_ShellInt DIALOGEX 0, 0, 231, 206 @@ -1246,7 +1246,7 @@ BEGIN END IDD_Enhancement_Config DIALOGEX 0, 0, 206, 214 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enhancements" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -2221,6 +2221,11 @@ BEGIN 0 END +IDD_Settings_Advanced AFX_DIALOG_LAYOUT +BEGIN + 0 +END + ///////////////////////////////////////////////////////////////////////////// //