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.
master
Jim 2022-08-14 00:51:02 -07:00
parent c63d2f9852
commit 7b76619c43
1 changed files with 9 additions and 8 deletions

View File

@ -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");