Singleplayer is now supported
Logo now appear on top of console
App about fix
This commit is contained in:
Skull
2022-02-04 12:57:15 +02:00
parent 14b02cc400
commit 44a94ccd57
5 changed files with 119 additions and 50 deletions

View File

@ -204,20 +204,20 @@ namespace auth
// Patch steam id bit check
if (game::environment::is_sp())
{
utils::hook::jump(0x1404267F0, 0x140426846); // S1SP
utils::hook::jump(0x14042760F, 0x140427650); // S1SP
utils::hook::jump(0x140427AB4, 0x140427B02); // S1SP
utils::hook::jump(0x140475C17, 0x140475C6A); // H1(1.4)
utils::hook::jump(0x140476AFF, 0x140476B40); // H1(1.4)
utils::hook::jump(0x140476FA4, 0x140476FF2); // H1(1.4)
}
else
{
utils::hook::jump(0x140571E07, 0x140571E5A); // H1MP64[1.4]
utils::hook::jump(0x14004B223, 0x14004B4F2); // H1MP64[1.4]
utils::hook::jump(0x14004B4AD, 0x140009B48); // H1MP64[1.4]
utils::hook::jump(0x140572F6F, 0x140572FB0); // H1MP64[1.4]
utils::hook::jump(0x140573470, 0x1405734B6); // H1MP64[1.4]
utils::hook::jump(0x140571E07, 0x140571E5A); // H1(1.4)
utils::hook::jump(0x14004B223, 0x14004B4F2); // H1(1.4)
utils::hook::jump(0x14004B4AD, 0x140009B48); // H1(1.4)
utils::hook::jump(0x140572F6F, 0x140572FB0); // H1(1.4)
utils::hook::jump(0x140573470, 0x1405734B6); // H1(1.4)
utils::hook::jump(0x140488BC1, get_direct_connect_stub(), true); // H1MP64[1.4]
utils::hook::call(0x140250ED2, send_connect_data_stub); // H1MP64[1.4]
utils::hook::jump(0x140488BC1, get_direct_connect_stub(), true); // H1(1.4)
utils::hook::call(0x140250ED2, send_connect_data_stub); // H1(1.4)
}
command::add("guid", []()

View File

@ -113,7 +113,7 @@ namespace console
void post_unpack() override
{
// Redirect input (]command)
utils::hook::jump(SELECT_VALUE(0x000000000, 0x1405141E0), append_text); // H1MP1.4
utils::hook::jump(SELECT_VALUE(0x1403E34C0, 0x1405141E0), append_text); // H1(1.4)
this->initialize();
}
@ -202,7 +202,7 @@ namespace console
static void log_message(const std::string& message)
{
OutputDebugStringA(message.data());
game::Conbuf_AppendText(message.data()); //0x140513FF0
game::Conbuf_AppendText(message.data());
FILE* pFile = fopen("debug.log", "a");
fprintf(pFile, "%s\n", message.data());
fclose(pFile);
@ -232,7 +232,7 @@ namespace console
HWND get_window()
{
return *reinterpret_cast<HWND*>((SELECT_VALUE(0x000000000, 0x14DDFC2D0))); // H1MP1.4
return *reinterpret_cast<HWND*>((SELECT_VALUE(0x14CF56C00, 0x14DDFC2D0))); // H1(1.4)
}
void set_title(std::string title)
@ -247,7 +247,7 @@ namespace console
SetWindowPos(get_window(), nullptr, rect.left, rect.top, width, height, 0);
auto* const logo_window = *reinterpret_cast<HWND*>(SELECT_VALUE(0x000000000, 0x14DDFC2E0)); // H1MP64(1.4)
auto* const logo_window = *reinterpret_cast<HWND*>(SELECT_VALUE(0x14CF56C10, 0x14DDFC2E0)); // H1(1.4)
SetWindowPos(logo_window, nullptr, 5, 5, width - 25, 60, 0);
}

View File

@ -0,0 +1,70 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include <utils/nt.hpp>
namespace resources
{
namespace
{
HICON icon;
HANDLE splash, logo;
HANDLE WINAPI load_image_a(const HINSTANCE handle, LPCSTR name, const UINT type, const int c_x, const int c_y,
const UINT load)
{
const utils::nt::library self;
if (!IS_INTRESOURCE(name) && name == "logo.bmp"s) return logo;
if (self.get_handle() == handle && name == LPCSTR(0x64)) return splash;
return LoadImageA(handle, name, type, c_x, c_y, load);
}
HICON WINAPI load_icon_a(const HINSTANCE handle, const LPCSTR name)
{
const utils::nt::library self;
if (self.get_handle() == handle && name == LPCSTR(2)) return icon;
return LoadIconA(handle, name);
}
}
class component final : public component_interface
{
public:
~component() override
{
if (icon) DestroyIcon(icon);
if (logo) DeleteObject(logo);
if (splash) DeleteObject(splash);
}
void post_start() override
{
const utils::nt::library self;
icon = LoadIconA(self.get_handle(), MAKEINTRESOURCEA(ID_ICON));
logo = LoadImageA(self.get_handle(), MAKEINTRESOURCEA(IMAGE_LOGO), 0, 0, 0, LR_COPYFROMRESOURCE);
splash = LoadImageA(self.get_handle(), MAKEINTRESOURCEA(IMAGE_SPLASH), 0, 0, 0, LR_COPYFROMRESOURCE);
}
void* load_import(const std::string& library, const std::string& function) override
{
if (library == "USER32.dll")
{
if (function == "LoadIconA")
{
return load_icon_a;
}
if (function == "LoadImageA")
{
return load_image_a;
}
}
return nullptr;
}
};
}
REGISTER_COMPONENT(resources::component)