diff --git a/Client/core/CMainMenu.cpp b/Client/core/CMainMenu.cpp index 21c3e8cfd15..6515abbfb2c 100644 --- a/Client/core/CMainMenu.cpp +++ b/Client/core/CMainMenu.cpp @@ -450,6 +450,13 @@ void CMainMenu::Update() if (m_bIsFullyVisible) { + static bool versionUpdaterChecked = false; + if (!versionUpdaterChecked) + { + versionUpdaterChecked = true; + GetVersionUpdater()->OnMainMenuFullyVisible(); + } + // Grab our cursor position tagPOINT cursor; GetCursorPos(&cursor); diff --git a/Client/core/CVersionUpdater.cpp b/Client/core/CVersionUpdater.cpp index a37b20b7d59..fdd7894c3c2 100644 --- a/Client/core/CVersionUpdater.cpp +++ b/Client/core/CVersionUpdater.cpp @@ -130,6 +130,7 @@ class CVersionUpdater : public CVersionUpdaterInterface int DoPollDownload(); int DoSendPostToNextServer(); int DoPollPost(); + void OnMainMenuFullyVisible(); static void* StaticThreadProc(void* pContext); void* ThreadProc(); @@ -3377,3 +3378,25 @@ int CVersionUpdater::DoPollPost() } return RES_OK; } + +// Issue: #1708 +// Set the update settings to stable build if the user is on 1.5.8. +// We do this only once, this is why we need to write to registry. +void CVersionUpdater::OnMainMenuFullyVisible() +{ + if (MTASA_VERSION_BUILD != 20670) // 20670 is the build number with PR #1712 merged. + return; + const std::string requiredValue = "discord-rich-presence"; + const std::string lastSubKey = "version-revert-reason"; + if (GetApplicationSetting(lastSubKey) != requiredValue) + { + SetApplicationSetting(lastSubKey, requiredValue); + // check if the MTA client version is 1.5.8 + if (MTASA_VERSION_MAJOR == 1 && MTASA_VERSION_MINOR == 5 && MTASA_VERSION_MAINTENANCE == 8) + { + CVARS_SET("update_build_type", 0); + std::string message = _("We've reset your update preferences back to Default, please go change your settings again if you want Nightly updates.\n"); + g_pCore->ShowMessageBox(_("VERSION UPDATE INFORMATION"), message.c_str(), MB_BUTTON_OK | MB_ICON_INFO); + } + } +} diff --git a/Client/core/CVersionUpdater.h b/Client/core/CVersionUpdater.h index 94f466bb3a4..09565405dea 100644 --- a/Client/core/CVersionUpdater.h +++ b/Client/core/CVersionUpdater.h @@ -28,6 +28,7 @@ class CVersionUpdaterInterface virtual void GetBrowseVersionMaps(std::map& outBlockedVersionMap, std::map& outAllowedVersionMap) = 0; virtual void GetNewsSettings(SString& strOutOldestPost, uint& uiOutMaxHistoryLength) = 0; virtual const SString& GetDebugFilterString() = 0; + virtual void OnMainMenuFullyVisible() = 0; }; CVersionUpdaterInterface* GetVersionUpdater();