Small fixes

This commit is contained in:
momo5502 2022-09-17 08:00:43 +02:00
parent a7d3df22e8
commit a47a309ad7
3 changed files with 15 additions and 13 deletions

View File

@ -426,7 +426,6 @@ namespace arxan
uint32_t adjust_integrity_checksum(const uint64_t return_address, uint8_t* stack_frame, uint32_t adjust_integrity_checksum(const uint64_t return_address, uint8_t* stack_frame,
const uint32_t current_checksum) const uint32_t current_checksum)
{ {
//const auto handler_address = return_address - 5;
const auto* context = search_handler_context(stack_frame, current_checksum); const auto* context = search_handler_context(stack_frame, current_checksum);
if (!context) if (!context)
@ -438,11 +437,14 @@ namespace arxan
const auto correct_checksum = *context->original_checksum; const auto correct_checksum = *context->original_checksum;
*context->computed_checksum = correct_checksum; *context->computed_checksum = correct_checksum;
/*if (current_checksum != correct_checksum) if (current_checksum != correct_checksum)
{ {
OutputDebugStringA(utils::string::va("Adjusting checksum (%llX): %X -> %X", handler_address, #ifndef NDEBUG
current_checksum, correct_checksum)); const auto handler_address = return_address - 5;
}*/ printf("Adjusting checksum (%llX): %X -> %X\n", handler_address,
current_checksum, correct_checksum);
#endif
}
return correct_checksum; return correct_checksum;
} }

View File

@ -13,7 +13,7 @@ namespace branding
void draw_branding() void draw_branding()
{ {
constexpr auto x = 4; constexpr auto x = 4;
constexpr auto y = -6; constexpr auto y = -5;
constexpr auto scale = 1.0f; constexpr auto scale = 1.0f;
//float color[4] = {0.666f, 0.666f, 0.666f, 0.666f}; //float color[4] = {0.666f, 0.666f, 0.666f, 0.666f};
float color[4] = {236 / 255.0f, 113 / 255.0f, 10 / 255.0f, 1.0f}; float color[4] = {236 / 255.0f, 113 / 255.0f, 10 / 255.0f, 1.0f};

View File

@ -14,12 +14,13 @@ namespace console
{ {
namespace namespace
{ {
volatile bool g_started = false;
HANDLE logo; HANDLE logo;
std::atomic_bool started{false};
std::atomic_bool terminate_runner{false};
void print_message(const char* message) void print_message(const char* message)
{ {
if (g_started) if (started && !terminate_runner)
{ {
game::Com_Printf(0, 0, "%s", message); game::Com_Printf(0, 0, "%s", message);
} }
@ -159,7 +160,7 @@ namespace console
utils::hook::jump(printf, print_stub); utils::hook::jump(printf, print_stub);
this->terminate_runner_ = false; terminate_runner = false;
this->console_runner_ = utils::thread::create_named_thread("Console IO", [this] this->console_runner_ = utils::thread::create_named_thread("Console IO", [this]
{ {
@ -168,11 +169,11 @@ namespace console
sys_create_console_hook.create(0x1423339C0_g, sys_create_console_stub); sys_create_console_hook.create(0x1423339C0_g, sys_create_console_stub);
game::Sys_ShowConsole(); game::Sys_ShowConsole();
g_started = true; started = true;
} }
MSG msg{}; MSG msg{};
while (!this->terminate_runner_) while (!terminate_runner)
{ {
if (PeekMessageW(&msg, nullptr, NULL, NULL, PM_REMOVE)) if (PeekMessageW(&msg, nullptr, NULL, NULL, PM_REMOVE))
{ {
@ -189,7 +190,7 @@ namespace console
void pre_destroy() override void pre_destroy() override
{ {
this->terminate_runner_ = true; terminate_runner = true;
if (this->console_runner_.joinable()) if (this->console_runner_.joinable())
{ {
@ -198,7 +199,6 @@ namespace console
} }
private: private:
std::atomic_bool terminate_runner_{false};
std::thread console_runner_; std::thread console_runner_;
}; };
} }