diff --git a/src/client/component/console/terminal.cpp b/src/client/component/console/terminal.cpp index ea0e8616..414b2c1d 100644 --- a/src/client/component/console/terminal.cpp +++ b/src/client/component/console/terminal.cpp @@ -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 diff --git a/src/client/component/console/wincon.cpp b/src/client/component/console/wincon.cpp index ab6ec589..33347bf9 100644 --- a/src/client/component/console/wincon.cpp +++ b/src/client/component/console/wincon.cpp @@ -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); diff --git a/src/client/component/updater.cpp b/src/client/component/updater.cpp index 91bfee37..7eb1748f 100644 --- a/src/client/component/updater.cpp +++ b/src/client/component/updater.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #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(); } } diff --git a/src/common/utils/nt.cpp b/src/common/utils/nt.cpp index 93993c2a..fdb643d9 100644 --- a/src/common/utils/nt.cpp +++ b/src/common/utils/nt.cpp @@ -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);