mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-25 20:01:58 +00:00
Respect update check timeout without the same session too
This commit is contained in:
parent
5e8695a157
commit
460bc583a5
3 changed files with 9 additions and 4 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// 6 hour long timeout between checks.
|
||||||
|
static constexpr double g_timeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
||||||
|
|
||||||
struct UpdateChecker
|
struct UpdateChecker
|
||||||
{
|
{
|
||||||
enum class Result
|
enum class Result
|
||||||
|
|
|
||||||
|
|
@ -307,11 +307,11 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check the time since the last time an update was checked. Store the new time if the difference is more than six hours.
|
// Check the time since the last time an update was checked.
|
||||||
constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
// Store the new time if the difference is more than g_timeBetweenUpdateChecksInSeconds hours.
|
||||||
time_t timeNow = std::time(nullptr);
|
time_t timeNow = std::time(nullptr);
|
||||||
double timeDifferenceSeconds = difftime(timeNow, Config::LastChecked);
|
double timeDifferenceSeconds = difftime(timeNow, Config::LastChecked);
|
||||||
if (timeDifferenceSeconds > TimeBetweenUpdateChecksInSeconds)
|
if (timeDifferenceSeconds > g_timeBetweenUpdateChecksInSeconds)
|
||||||
{
|
{
|
||||||
UpdateChecker::initialize();
|
UpdateChecker::initialize();
|
||||||
UpdateChecker::start();
|
UpdateChecker::start();
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,9 @@ PPC_FUNC(sub_822C55B0)
|
||||||
|
|
||||||
void PressStartSaveLoadThreadMidAsmHook()
|
void PressStartSaveLoadThreadMidAsmHook()
|
||||||
{
|
{
|
||||||
if (UpdateChecker::check() == UpdateChecker::Result::UpdateAvailable)
|
time_t timeNow = std::time(nullptr);
|
||||||
|
double timeDifferenceSeconds = difftime(timeNow, Config::LastChecked);
|
||||||
|
if (UpdateChecker::check() == UpdateChecker::Result::UpdateAvailable && timeDifferenceSeconds > g_timeBetweenUpdateChecksInSeconds)
|
||||||
{
|
{
|
||||||
g_updateAvailableMessageOpen = true;
|
g_updateAvailableMessageOpen = true;
|
||||||
g_updateAvailableMessageOpen.wait(true);
|
g_updateAvailableMessageOpen.wait(true);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue