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