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:
Darío
2025-01-31 10:47:15 -03:00
committed by GitHub
parent 54d5588d79
commit cd38776576
11 changed files with 282 additions and 15 deletions
+17
View File
@@ -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();