clean project

This commit is contained in:
quaK 2022-06-01 16:55:00 +03:00
parent 12526fa754
commit f78bb85033
17 changed files with 117 additions and 97 deletions

View File

@ -1,8 +1,10 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "scheduler.hpp"
#include "game/game.hpp" #include "game/game.hpp"
#include "scheduler.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
namespace arxan namespace arxan

View File

@ -1,9 +1,9 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "auth.hpp" #include "auth.hpp"
//#include "command.hpp"
//#include "network.hpp" #include "game/game.hpp"
#include "steam/steam.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
#include <utils/string.hpp> #include <utils/string.hpp>
@ -11,9 +11,6 @@
#include <utils/info_string.hpp> #include <utils/info_string.hpp>
#include <utils/cryptography.hpp> #include <utils/cryptography.hpp>
#include "game/game.hpp"
#include "steam/steam.hpp"
namespace auth namespace auth
{ {
namespace namespace
@ -37,7 +34,7 @@ namespace auth
return {}; return {};
} }
return std::string{info.szHwProfileGuid, sizeof(info.szHwProfileGuid)}; return std::string{ info.szHwProfileGuid, sizeof(info.szHwProfileGuid) };
} }
std::string get_protected_data() std::string get_protected_data()
@ -53,7 +50,7 @@ namespace auth
} }
const auto size = std::min(data_out.cbData, 52ul); const auto size = std::min(data_out.cbData, 52ul);
std::string result{reinterpret_cast<char*>(data_out.pbData), size}; std::string result{ reinterpret_cast<char*>(data_out.pbData), size };
LocalFree(data_out.pbData); LocalFree(data_out.pbData);
return result; return result;

View File

@ -25,12 +25,21 @@ namespace branding
public: public:
void post_unpack() override void post_unpack() override
{ {
if (game::environment::is_dedi())
{
return;
}
localized_strings::override("LUA_MENU_LEGAL_COPYRIGHT", "IW7-MOD"); localized_strings::override("LUA_MENU_LEGAL_COPYRIGHT", "IW7-MOD");
localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "IW7-MOD: MULTIPLAYER"); //localized_strings::override("MENU_SP_CAMPAIGN", "IW7-MOD: CAMPAIGN");
localized_strings::override("LUA_MENU_ALIENS_CAPS", "IW7-MOD: ZOMBIES"); //localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "IW7-MOD: MULTIPLAYER");
//localized_strings::override("LUA_MENU_ALIENS_CAPS", "IW7-MOD: ZOMBIES");
scheduler::once([]()
{
branding = game::Dvar_RegisterBool("branding", true, game::DvarFlags::DVAR_FLAG_SAVED, "Show branding in the top left corner"); branding = game::Dvar_RegisterBool("branding", true, game::DvarFlags::DVAR_FLAG_SAVED, "Show branding in the top left corner");
}, scheduler::pipeline::renderer);
scheduler::loop([]() scheduler::loop([]()
{ {

View File

@ -1,15 +1,14 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "command.hpp" #include "command.hpp"
#include "console.hpp"
#include "game_console.hpp"
//#include "fastfiles.hpp"
#include "scheduler.hpp"
#include "game/game.hpp" #include "game/game.hpp"
#include "game/dvars.hpp" #include "game/dvars.hpp"
#include "console.hpp"
#include "game_console.hpp"
#include "scheduler.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
#include <utils/string.hpp> #include <utils/string.hpp>
#include <utils/memory.hpp> #include <utils/memory.hpp>

View File

@ -19,14 +19,16 @@ namespace console
{ {
bool is_enabled() bool is_enabled()
{ {
return game::environment::is_dedi() || !utils::flags::has_flag("noconsole"); static const auto noconsole = utils::flags::has_flag("noconsole");
return game::environment::is_dedi() || !noconsole;
} }
namespace native namespace native
{ {
bool is_enabled() bool is_enabled()
{ {
return utils::flags::has_flag("nativeconsole"); static const auto nativeconsole = utils::flags::has_flag("nativeconsole");
return nativeconsole;
} }
static bool ingame = false; static bool ingame = false;
@ -55,7 +57,7 @@ namespace console
namespace sys namespace sys
{ {
//#define COMMAND_HISTORY 64 //#define COMMAND_HISTORY 64
struct WinConData struct WinConData
{ {

View File

@ -1,6 +0,0 @@
#pragma once
namespace demonware
{
}

View File

@ -91,7 +91,7 @@ namespace game_module
utils::nt::library get_game_module() utils::nt::library get_game_module()
{ {
static utils::nt::library game{HMODULE(game::base_address)}; static utils::nt::library game{ HMODULE(game::base_address) };
return game; return game;
} }

View File

@ -1,10 +1,12 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "localized_strings.hpp" #include "localized_strings.hpp"
#include "game/game.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
#include <utils/string.hpp> #include <utils/string.hpp>
#include <utils/concurrency.hpp> #include <utils/concurrency.hpp>
#include "game/game.hpp"
namespace localized_strings namespace localized_strings
{ {

View File

@ -16,6 +16,20 @@ namespace logger
console::info(msg); console::info(msg);
} }
void print(const char* msg, ...)
{
char buffer[2048]{ 0 };
va_list ap;
va_start(ap, msg);
vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, msg, ap);
va_end(ap);
console::info(buffer);
}
void sys_print_stubs() void sys_print_stubs()
{ {
utils::hook::call(0xC6E57A_b, sys_print_stub); // SV_SpawnServer: completed\n utils::hook::call(0xC6E57A_b, sys_print_stub); // SV_SpawnServer: completed\n
@ -24,7 +38,7 @@ namespace logger
utils::hook::call(0xB712BA_b, sys_print_stub); // G_SaveError utils::hook::call(0xB712BA_b, sys_print_stub); // G_SaveError
} }
void R_WarnOncePerFrame_print_stub(char* buffer, size_t buffer_length, char* msg, va_list va) void r_warn_once_per_frame_print_stub(char* buffer, size_t buffer_length, char* msg, va_list va)
{ {
vsnprintf(buffer, buffer_length, msg, va); vsnprintf(buffer, buffer_length, msg, va);
console::warn(buffer); console::warn(buffer);
@ -38,9 +52,12 @@ namespace logger
{ {
sys_print_stubs(); sys_print_stubs();
// com_printf
utils::hook::jump(0x343080_b, print);
if (!game::environment::is_dedi()) if (!game::environment::is_dedi())
{ {
utils::hook::call(0xE4B121_b, R_WarnOncePerFrame_print_stub); utils::hook::call(0xE4B121_b, r_warn_once_per_frame_print_stub);
} }
} }
}; };

View File

@ -1,7 +1,7 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "scheduler.hpp" #include "scheduler.hpp"
#include "game/game.hpp" #include "game/game.hpp"
#include <utils/hook.hpp> #include <utils/hook.hpp>
@ -186,8 +186,8 @@ namespace scheduler
void post_unpack() override void post_unpack() override
{ {
r_end_frame_hook.create(0xE267B0_b, scheduler::r_end_frame_stub); r_end_frame_hook.create(0xE267B0_b, scheduler::r_end_frame_stub);
g_run_frame_hook.create(0xB8E2D0_b, scheduler::server_frame_stub); g_run_frame_hook.create(0xB15E20_b, scheduler::server_frame_stub);
main_frame_hook.create(0xB15E20_b, scheduler::main_frame_stub); main_frame_hook.create(0xB8E2D0_b, scheduler::main_frame_stub);
} }
void pre_destroy() override void pre_destroy() override

View File

@ -16,9 +16,6 @@ namespace scheduler
// The game's main thread // The game's main thread
main, main,
// LUI context
lui,
count, count,
}; };

View File

@ -1,6 +1,9 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "loader/component_loader.hpp" #include "loader/component_loader.hpp"
#include "steam_proxy.hpp" #include "steam_proxy.hpp"
#include "game/game.hpp"
#include "scheduler.hpp" #include "scheduler.hpp"
#include <utils/nt.hpp> #include <utils/nt.hpp>
@ -8,8 +11,6 @@
#include <utils/string.hpp> #include <utils/string.hpp>
#include <utils/binary_resource.hpp> #include <utils/binary_resource.hpp>
#include "game/game.hpp"
#include "steam/interface.hpp" #include "steam/interface.hpp"
#include "steam/steam.hpp" #include "steam/steam.hpp"
@ -132,7 +133,7 @@ namespace steam_proxy
this->client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false); this->client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false);
char our_directory[MAX_PATH] = {0}; char our_directory[MAX_PATH] = { 0 };
GetCurrentDirectoryA(sizeof(our_directory), our_directory); GetCurrentDirectoryA(sizeof(our_directory), our_directory);
const auto path = runner_file.get_extracted_file(); const auto path = runner_file.get_extracted_file();
@ -171,7 +172,7 @@ namespace steam_proxy
this->steam_pipe_ = nullptr; this->steam_pipe_ = nullptr;
this->global_user_ = nullptr; this->global_user_ = nullptr;
this->steam_client_module_ = utils::nt::library{nullptr}; this->steam_client_module_ = utils::nt::library{ nullptr };
return scheduler::cond_end; return scheduler::cond_end;
}); });

View File

@ -56,7 +56,7 @@ FARPROC load_binary(uint64_t* base_address)
return loader.load_library(binary, base_address); return loader.load_library(binary, base_address);
#else #else
*base_address = 0x140000000; *base_address = 0x140000000;
return loader.load(self, data); // this gives memory errors return loader.load(self, data); // not working
#endif #endif
} }
@ -67,7 +67,7 @@ void remove_crash_file()
void enable_dpi_awareness() void enable_dpi_awareness()
{ {
const utils::nt::library user32{"user32.dll"}; const utils::nt::library user32{ "user32.dll" };
const auto set_dpi = user32 const auto set_dpi = user32
? user32.get_proc<BOOL(WINAPI*)(DPI_AWARENESS_CONTEXT)>("SetProcessDpiAwarenessContext") ? user32.get_proc<BOOL(WINAPI*)(DPI_AWARENESS_CONTEXT)>("SetProcessDpiAwarenessContext")
: nullptr; : nullptr;