2022-10-30 06:43:06 -04:00
|
|
|
#include <std_include.hpp>
|
|
|
|
#include "loader/component_loader.hpp"
|
|
|
|
#include "resource.hpp"
|
|
|
|
|
|
|
|
#include <utils/nt.hpp>
|
|
|
|
#include <utils/hook.hpp>
|
|
|
|
|
|
|
|
namespace icon
|
|
|
|
{
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
utils::hook::detour load_icon_a_hook;
|
|
|
|
|
|
|
|
HINSTANCE get_current_module()
|
|
|
|
{
|
|
|
|
return utils::nt::library::get_by_address(get_current_module);
|
|
|
|
}
|
|
|
|
|
|
|
|
HICON WINAPI load_icon_a_stub(HINSTANCE module, LPCSTR icon_name)
|
|
|
|
{
|
|
|
|
static const utils::nt::library game{};
|
|
|
|
if (game == module && icon_name == MAKEINTRESOURCEA(1))
|
|
|
|
{
|
|
|
|
module = get_current_module();
|
|
|
|
icon_name = MAKEINTRESOURCEA(ID_ICON);
|
|
|
|
}
|
|
|
|
|
|
|
|
return load_icon_a_hook.invoke<HICON>(module, icon_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-01 15:51:04 -05:00
|
|
|
struct component final : generic_component
|
2022-10-30 06:43:06 -04:00
|
|
|
{
|
2022-11-09 14:19:08 -05:00
|
|
|
void post_load() override
|
2022-10-30 06:43:06 -04:00
|
|
|
{
|
|
|
|
load_icon_a_hook.create(LoadIconA, load_icon_a_stub);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-03-18 04:14:54 -04:00
|
|
|
REGISTER_COMPONENT(icon::component)
|