Extract updater
This commit is contained in:
parent
3177b74a37
commit
b82d2d9438
@ -1,6 +1,7 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "splash.hpp"
|
#include "splash.hpp"
|
||||||
|
#include "updater.hpp"
|
||||||
|
|
||||||
#include <version.hpp>
|
#include <version.hpp>
|
||||||
|
|
||||||
@ -127,6 +128,25 @@ namespace updater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update()
|
||||||
|
{
|
||||||
|
#if defined(NDEBUG) && defined(CI)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (requires_update())
|
||||||
|
{
|
||||||
|
perform_update(splash::get_window());
|
||||||
|
activate_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
requires_update();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
class component final : public generic_component
|
class component final : public generic_component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -136,7 +156,7 @@ namespace updater
|
|||||||
|
|
||||||
this->update_thread_ = std::thread([this]
|
this->update_thread_ = std::thread([this]
|
||||||
{
|
{
|
||||||
this->update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,21 +185,6 @@ namespace updater
|
|||||||
this->update_thread_.join();
|
this->update_thread_.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (requires_update())
|
|
||||||
{
|
|
||||||
perform_update(splash::get_window());
|
|
||||||
activate_update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
src/client/component/updater.hpp
Normal file
6
src/client/component/updater.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace updater
|
||||||
|
{
|
||||||
|
void update();
|
||||||
|
}
|
@ -5,11 +5,14 @@
|
|||||||
#include "html/html_window.hpp"
|
#include "html/html_window.hpp"
|
||||||
|
|
||||||
#include "resource.hpp"
|
#include "resource.hpp"
|
||||||
|
#include "component/updater.hpp"
|
||||||
|
|
||||||
namespace launcher
|
namespace launcher
|
||||||
{
|
{
|
||||||
bool run()
|
bool run()
|
||||||
{
|
{
|
||||||
|
updater::update();
|
||||||
|
|
||||||
bool run_game = false;
|
bool run_game = false;
|
||||||
html_window window("BOIII", 750, 430);
|
html_window window("BOIII", 750, 430);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user