Updater changes

This commit is contained in:
alice 2024-07-12 15:19:40 +02:00
parent f67e177d51
commit 2878336174
4 changed files with 18 additions and 9 deletions

View File

@ -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

View File

@ -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);

View File

@ -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));
} }
@ -395,9 +397,13 @@ namespace updater
}); });
if (!download_failed && is_binary_modified) if (!download_failed && is_binary_modified)
{
if (!utils::flags::has_flag("update-only"))
{ {
console::info("[Updater] Restarting\n"); console::info("[Updater] Restarting\n");
utils::nt::relaunch_self(); utils::nt::relaunch_self();
}
utils::nt::terminate(); utils::nt::terminate();
} }
} }

View File

@ -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);