mirror of
https://github.com/diamante0018/MW3ServerFreezer.git
synced 2025-10-27 06:36:55 +00:00
build: add back clang
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/thread.hpp>
|
||||
#include <utils/flags.hpp>
|
||||
#include <utils/concurrency.hpp>
|
||||
|
||||
@@ -37,8 +36,7 @@ public:
|
||||
void post_start() override {
|
||||
this->terminate_runner_ = false;
|
||||
|
||||
this->console_runner_ = utils::thread::create_named_thread(
|
||||
"Console IO", [this] { this->runner(); });
|
||||
this->console_runner_ = std::thread([this] { this->runner(); });
|
||||
}
|
||||
|
||||
void post_unpack() override {
|
||||
@@ -77,31 +75,30 @@ private:
|
||||
int handles_[2]{};
|
||||
|
||||
void initialize() {
|
||||
this->console_thread_ =
|
||||
utils::thread::create_named_thread("Console", [this] {
|
||||
if (!utils::flags::has_flag("noconsole")) {
|
||||
game::Sys_ShowConsole();
|
||||
this->console_thread_ = std::thread([this] {
|
||||
if (!utils::flags::has_flag("noconsole")) {
|
||||
game::Sys_ShowConsole();
|
||||
}
|
||||
|
||||
messages.access(
|
||||
[&](message_queue&) { this->console_initialized_ = true; });
|
||||
|
||||
MSG msg;
|
||||
while (!this->terminate_runner_) {
|
||||
if (PeekMessageA(&msg, nullptr, NULL, NULL, PM_REMOVE)) {
|
||||
if (msg.message == WM_QUIT) {
|
||||
command::execute("quit", false);
|
||||
break;
|
||||
}
|
||||
|
||||
messages.access(
|
||||
[&](message_queue&) { this->console_initialized_ = true; });
|
||||
|
||||
MSG msg;
|
||||
while (!this->terminate_runner_) {
|
||||
if (PeekMessageA(&msg, nullptr, NULL, NULL, PM_REMOVE)) {
|
||||
if (msg.message == WM_QUIT) {
|
||||
command::execute("quit", false);
|
||||
break;
|
||||
}
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
} else {
|
||||
this->log_messages();
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
}
|
||||
});
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
} else {
|
||||
this->log_messages();
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void log_messages() const {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <utils/concurrency.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/thread.hpp>
|
||||
|
||||
#include "scheduler.hpp"
|
||||
|
||||
@@ -135,7 +134,7 @@ unsigned int thread_id;
|
||||
class component final : public component_interface {
|
||||
public:
|
||||
void post_unpack() override {
|
||||
thread = utils::thread::create_named_thread("Async Scheduler", [] {
|
||||
thread = std::thread([] {
|
||||
while (!kill) {
|
||||
execute(pipeline::async);
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
namespace {
|
||||
std::string get_current_date() {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto current_time = std::chrono::system_clock::to_time_t(now);
|
||||
std::tm local_time{};
|
||||
|
||||
(void)localtime_s(&local_time, ¤t_time);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::put_time(&local_time, "%Y%m%d_%H%M%S");
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
LONG WINAPI exception_handler(PEXCEPTION_POINTERS exception_info) {
|
||||
if (exception_info->ExceptionRecord->ExceptionCode == 0x406D1388) {
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
@@ -21,8 +34,8 @@ LONG WINAPI exception_handler(PEXCEPTION_POINTERS exception_info) {
|
||||
| MiniDumpWithFullMemoryInfo //
|
||||
| MiniDumpWithThreadInfo;
|
||||
|
||||
const auto file_name = std::format("minidumps\\mw3-server-freezer_{}.dmp",
|
||||
game::Sys_Milliseconds());
|
||||
const auto file_name =
|
||||
std::format("minidumps\\mw3-server-freezer_{}.dmp", get_current_date());
|
||||
const auto file_handle = CreateFileA(
|
||||
file_name.data(), GENERIC_WRITE | GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS,
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
|
||||
#include <DbgHelp.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <format>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <source_location>
|
||||
|
||||
Reference in New Issue
Block a user