mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-05-24 15:21:16 -04:00
Update checker. (#251)
* Update checker. * Fix build and enum class. * Get rid of submodule for httplib. * Get rid of submodule for curl. * Minor style changes and fix video.cpp Linux build error. * CTitleStateIntro_patches: implemented update message * Update update_checker.cpp * CTitleStateIntro_patches: fix fade out accepting input --------- Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <user/registry.h>
|
||||
#include <kernel/xdbf.h>
|
||||
#include <install/installer.h>
|
||||
#include <install/update_checker.h>
|
||||
#include <os/logger.h>
|
||||
#include <os/process.h>
|
||||
#include <os/registry.h>
|
||||
@@ -22,6 +23,10 @@
|
||||
#include <ui/installer_wizard.h>
|
||||
#include <mod/mod_loader.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <timeapi.h>
|
||||
#endif
|
||||
|
||||
const size_t XMAIOBegin = 0x7FEA0000;
|
||||
const size_t XMAIOEnd = XMAIOBegin + 0x0000FFFF;
|
||||
|
||||
@@ -173,6 +178,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
Config::Load();
|
||||
|
||||
// Check the time since the last time an update was checked. Store the new time if the difference is more than six hours.
|
||||
constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
||||
time_t timeNow = std::time(nullptr);
|
||||
double timeDifferenceSeconds = difftime(timeNow, Config::LastChecked);
|
||||
if (timeDifferenceSeconds > TimeBetweenUpdateChecksInSeconds)
|
||||
{
|
||||
UpdateChecker::initialize();
|
||||
UpdateChecker::start();
|
||||
Config::LastChecked = timeNow;
|
||||
Config::Save();
|
||||
}
|
||||
|
||||
if (Config::ShowConsole)
|
||||
os::process::ShowConsole();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user