From 7b76619c434d161f525290224e481dd5735478bc Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 14 Aug 2022 00:51:02 -0700 Subject: [PATCH] UI: Fix increment check for what's new (again) Increment checks for the what's new file were not working as intended; old stored increments would unintentionally pass to newer versions if the newer versions did not explicitly start up with a whatsnew.json file that had their version. The previous attempt to fix made it so that it used a completely separate global.ini entry when a matching entry was found. However, this entry did not take into account the beta or release candidate number of the current build. This fixes it to bake in the beta/rc number into the entry. --- UI/window-basic-main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 382e27435..ea2af135c 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -2132,13 +2132,14 @@ void OBSBasic::OnFirstLoad() } #if defined(OBS_RELEASE_CANDIDATE) && OBS_RELEASE_CANDIDATE > 0 -#define CUR_VER OBS_RELEASE_CANDIDATE_VER +#define CUR_VER \ + ((uint64_t)OBS_RELEASE_CANDIDATE_VER << 16ULL | OBS_RELEASE_CANDIDATE) #define LAST_INFO_VERSION_STRING "InfoLastRCVersion" #elif OBS_BETA > 0 -#define CUR_VER OBS_BETA_VER +#define CUR_VER ((uint64_t)OBS_BETA_VER << 16ULL | OBS_BETA) #define LAST_INFO_VERSION_STRING "InfoLastBetaVersion" #else -#define CUR_VER LIBOBS_API_VER +#define CUR_VER ((uint64_t)LIBOBS_API_VER << 16ULL) #define LAST_INFO_VERSION_STRING "InfoLastVersion" #endif @@ -2191,15 +2192,15 @@ void OBSBasic::ReceivedIntroJson(const QString &text) return; } - uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", - LAST_INFO_VERSION_STRING); + uint64_t lastVersion = config_get_uint(App()->GlobalConfig(), "General", + LAST_INFO_VERSION_STRING); int current_version_increment = -1; - if ((lastVersion & ~0xFFFF) < (CUR_VER & ~0xFFFF)) { + if ((lastVersion & ~0xFFFF0000ULL) < (CUR_VER & ~0xFFFF0000ULL)) { config_set_int(App()->GlobalConfig(), "General", "InfoIncrement", -1); - config_set_int(App()->GlobalConfig(), "General", - LAST_INFO_VERSION_STRING, CUR_VER); + config_set_uint(App()->GlobalConfig(), "General", + LAST_INFO_VERSION_STRING, CUR_VER); } else { current_version_increment = config_get_int( App()->GlobalConfig(), "General", "InfoIncrement");