From 527ad040b03d30a369d293371fb465ccd6b653b2 Mon Sep 17 00:00:00 2001 From: zilmar Date: Sun, 30 May 2021 20:41:45 +0930 Subject: [PATCH] Disable menu if showing nag window --- Source/Project64/Settings/UISettings.cpp | 1 + Source/Project64/Settings/UISettings.h | 1 + Source/Project64/UserInterface/MainMenu.cpp | 8 ++++++++ Source/Project64/UserInterface/RomBrowser.cpp | 10 +++++++++- Source/Project64/UserInterface/SupportWindow.cpp | 4 ++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Source/Project64/Settings/UISettings.cpp b/Source/Project64/Settings/UISettings.cpp index d3fbc7dd4..3fe5a9a70 100644 --- a/Source/Project64/Settings/UISettings.cpp +++ b/Source/Project64/Settings/UISettings.cpp @@ -41,6 +41,7 @@ void RegisterUISettings (void) AddUISetting(UserInterface_AlwaysOnTop, new CSettingTypeApplication("Settings", "Always on top", (uint32_t)false)); AddUISetting(UserInterface_ShowStatusBar, new CSettingTypeApplication("Settings", "Show Status Bar", true)); AddUISetting(UserInterface_ExitFullscreenOnLoseFocus, new CSettingTypeApplication("Settings", "Exit Full Screen On Lose Focus", false)); + AddUISetting(UserInterface_ShowingNagWindow, new CSettingTypeApplication("Settings", "Showing Nag Window", false)); AddUISetting(RomBrowser_Enabled, new CSettingTypeApplication("Rom Browser", "Rom Browser", true)); AddUISetting(RomBrowser_ColoumnsChanged, new CSettingTypeTempBool(false)); diff --git a/Source/Project64/Settings/UISettings.h b/Source/Project64/Settings/UISettings.h index fcc6052bd..97f66e276 100644 --- a/Source/Project64/Settings/UISettings.h +++ b/Source/Project64/Settings/UISettings.h @@ -32,6 +32,7 @@ enum UISettingID UserInterface_AlwaysOnTop, UserInterface_ShowStatusBar, UserInterface_ExitFullscreenOnLoseFocus, + UserInterface_ShowingNagWindow, RomBrowser_Enabled, RomBrowser_ColoumnsChanged, diff --git a/Source/Project64/UserInterface/MainMenu.cpp b/Source/Project64/UserInterface/MainMenu.cpp index 79366a97d..858fe151a 100644 --- a/Source/Project64/UserInterface/MainMenu.cpp +++ b/Source/Project64/UserInterface/MainMenu.cpp @@ -20,6 +20,7 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) : m_ChangeSettingList.push_back(GameRunning_LimitFPS); m_ChangeUISettingList.push_back(UserInterface_InFullScreen); m_ChangeUISettingList.push_back(UserInterface_AlwaysOnTop); + m_ChangeUISettingList.push_back(UserInterface_ShowingNagWindow); m_ChangeSettingList.push_back(UserInterface_ShowCPUPer); m_ChangeSettingList.push_back(Logging_GenerateLog); m_ChangeSettingList.push_back(Debugger_RecordExecutionTimes); @@ -1317,6 +1318,13 @@ void CMainMenu::FillOutMenu(HMENU hMenu) if (RomLoading) { Item.SetItemEnabled(false); } MainTitleMenu.push_back(Item); + if (UISettingsLoadBool(UserInterface_ShowingNagWindow)) + { + for (MenuItemList::iterator MenuItem = MainTitleMenu.begin(); MenuItem != MainTitleMenu.end(); MenuItem++) + { + MenuItem->SetItemEnabled(false); + } + } AddMenu(hMenu, MainTitleMenu); } diff --git a/Source/Project64/UserInterface/RomBrowser.cpp b/Source/Project64/UserInterface/RomBrowser.cpp index 3133b954e..109249334 100644 --- a/Source/Project64/UserInterface/RomBrowser.cpp +++ b/Source/Project64/UserInterface/RomBrowser.cpp @@ -794,9 +794,17 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/) } pRomInfo = &m_RomInfo[lvItem.lParam]; - if (!pRomInfo) { return; } + if (!pRomInfo) + { + return; + } m_StopRefresh = true; + if (UISettingsLoadBool(UserInterface_ShowingNagWindow)) + { + return; + } + if ((CPath(pRomInfo->szFullFileName).GetExtension() != "ndd") && (CPath(pRomInfo->szFullFileName).GetExtension() != "d64")) CN64System::RunFileImage(pRomInfo->szFullFileName); else diff --git a/Source/Project64/UserInterface/SupportWindow.cpp b/Source/Project64/UserInterface/SupportWindow.cpp index 67c3794c9..6cedf4dff 100644 --- a/Source/Project64/UserInterface/SupportWindow.cpp +++ b/Source/Project64/UserInterface/SupportWindow.cpp @@ -39,10 +39,12 @@ void CSupportWindow::Show(HWND hParent, bool Delay) } m_hParent = hParent; m_this = this; + UISettingsSaveBool(UserInterface_ShowingNagWindow, true); ::SetTimer(nullptr, 0, 2500, TimerProc); } else { + UISettingsSaveBool(UserInterface_ShowingNagWindow, true); DoModal(hParent); } } @@ -169,6 +171,7 @@ LRESULT CSupportWindow::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, LRESULT CSupportWindow::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + UISettingsSaveBool(UserInterface_ShowingNagWindow, false); EndDialog(wID); return TRUE; } @@ -186,6 +189,7 @@ LRESULT CSupportWindow::OnEnterCode(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndC EnterCodeWindow.DoModal(m_hWnd); if (m_Support.Validated()) { + UISettingsSaveBool(UserInterface_ShowingNagWindow, false); EndDialog(wID); } return TRUE;