Updater changes
This commit is contained in:
parent
f67e177d51
commit
2878336174
@ -342,9 +342,7 @@ namespace terminal
|
||||
component()
|
||||
{
|
||||
printf_hook.create(printf, printf_stub);
|
||||
|
||||
if (!game::environment::is_dedi())
|
||||
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||
ShowWindow(GetConsoleWindow(), SW_SHOW);
|
||||
}
|
||||
|
||||
void post_unpack() override
|
||||
|
@ -36,6 +36,11 @@ namespace wincon
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
component()
|
||||
{
|
||||
ShowWindow(GetConsoleWindow(), SW_SHOW);
|
||||
}
|
||||
|
||||
void post_start() override
|
||||
{
|
||||
const auto handle = CreateThread(0, 0, wincon::console, 0, 0, 0);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/properties.hpp>
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utils/flags.hpp>
|
||||
|
||||
#define FILES_PATH "files.json"
|
||||
#define FILES_PATH_DEV "files-dev.json"
|
||||
@ -262,7 +263,9 @@ namespace updater
|
||||
{
|
||||
return std::thread([=]
|
||||
{
|
||||
console::info("[Updater] Downloading file \"%s\"\n", file.name.data());
|
||||
const auto data = download_data_file(file.name);
|
||||
|
||||
if (!data.has_value())
|
||||
{
|
||||
console::error("[Updater] File failed to download \"%s\"\n", file.name.data());
|
||||
@ -349,7 +352,6 @@ namespace updater
|
||||
});
|
||||
};
|
||||
|
||||
console::info("[Updater] Creating thread for file \"%s\"\n", file.name.data());
|
||||
download_threads.emplace_back(create_file_thread(file, cb));
|
||||
}
|
||||
|
||||
@ -385,7 +387,7 @@ namespace updater
|
||||
console::error("[Updater] Failed to write file \"%s\", aborting update\n", file.name.data());
|
||||
download_failed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_binary_name(file.name))
|
||||
{
|
||||
@ -396,8 +398,12 @@ namespace updater
|
||||
|
||||
if (!download_failed && is_binary_modified)
|
||||
{
|
||||
console::info("[Updater] Restarting\n");
|
||||
utils::nt::relaunch_self();
|
||||
if (!utils::flags::has_flag("update-only"))
|
||||
{
|
||||
console::info("[Updater] Restarting\n");
|
||||
utils::nt::relaunch_self();
|
||||
}
|
||||
|
||||
utils::nt::terminate();
|
||||
}
|
||||
}
|
||||
|
@ -269,8 +269,8 @@ namespace utils::nt
|
||||
GetCurrentDirectoryA(sizeof(current_dir), current_dir);
|
||||
auto* const command_line = GetCommandLineA();
|
||||
|
||||
CreateProcessA(self.get_path().data(), command_line, nullptr, nullptr, false, NULL, nullptr, current_dir,
|
||||
&startup_info, &process_info);
|
||||
CreateProcessA(self.get_path().data(), command_line, nullptr, nullptr, false,
|
||||
CREATE_NEW_CONSOLE, nullptr, current_dir, &startup_info, &process_info);
|
||||
|
||||
if (process_info.hThread && process_info.hThread != INVALID_HANDLE_VALUE) CloseHandle(process_info.hThread);
|
||||
if (process_info.hProcess && process_info.hProcess != INVALID_HANDLE_VALUE) CloseHandle(process_info.hProcess);
|
||||
|
Loading…
Reference in New Issue
Block a user