#include #include "loader/component_loader.hpp" #include "plugin.hpp" #include "game/game.hpp" #include #include #include namespace { utils::hook::detour load_library_hook; HMODULE __stdcall load_library_stub(LPCSTR lib_name, HANDLE file, DWORD flags) { if (lib_name == "libmysql.dll"s) { static auto dll = utils::binary_resource{LIBMYSQL_DLL, lib_name}; const auto path = dll.get_extracted_file(); const auto handle = load_library_hook.invoke_pascal(path.data(), file, flags); if (handle != nullptr) { return handle; } } return load_library_hook.invoke_pascal(lib_name, file, flags); } } PLUTONIUM_API plutonium::sdk::plugin* PLUTONIUM_CALLBACK on_initialize() { return plugin::get(); } BOOL APIENTRY DllMain(HMODULE module, DWORD ul_reason_for_call, LPVOID /*reserved*/) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { utils::nt::library::set_current_handle(module); load_library_hook.create(LoadLibraryExA, load_library_stub); } if (ul_reason_for_call == DLL_PROCESS_DETACH) { component_loader::on_shutdown(); } return TRUE; }