mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2026-01-24 21:42:53 -05:00
Switch to DLL_MAIN helper
This commit is contained in:
2
KoalaBox
2
KoalaBox
Submodule KoalaBox updated: a658f5b179...83fb5af5e2
@@ -1,13 +1,14 @@
|
|||||||
|
#include <koalabox/win.hpp>
|
||||||
|
|
||||||
#include "smoke_api/smoke_api.hpp"
|
#include "smoke_api/smoke_api.hpp"
|
||||||
|
|
||||||
// This header will be populated at build time
|
// This header will be populated at build time
|
||||||
#include "linker_exports_for_steam_api.h"
|
#include "linker_exports_for_steam_api.h"
|
||||||
#include "linker_exports_for_version.h"
|
#include "linker_exports_for_version.h"
|
||||||
|
|
||||||
EXTERN_C [[maybe_unused]] BOOL WINAPI
|
DLL_MAIN(void* handle, const uint32_t reason, void*) {
|
||||||
DllMain(const HMODULE module_handle, const DWORD reason, LPVOID) {
|
|
||||||
if(reason == DLL_PROCESS_ATTACH) {
|
if(reason == DLL_PROCESS_ATTACH) {
|
||||||
smoke_api::init(module_handle);
|
smoke_api::init(handle);
|
||||||
} else if(reason == DLL_PROCESS_DETACH) {
|
} else if(reason == DLL_PROCESS_DETACH) {
|
||||||
smoke_api::shutdown();
|
smoke_api::shutdown();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace smoke_api {
|
namespace smoke_api {
|
||||||
void init(const HMODULE module_handle) {
|
void init(void* module_handle) {
|
||||||
try {
|
try {
|
||||||
kb::globals::init_globals(module_handle, PROJECT_NAME);
|
kb::globals::init_globals(module_handle, PROJECT_NAME);
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ namespace smoke_api {
|
|||||||
const auto exe_name = kb::path::to_str(exe_path.filename());
|
const auto exe_name = kb::path::to_str(exe_path.filename());
|
||||||
|
|
||||||
LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, kb::util::BITNESS);
|
LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, kb::util::BITNESS);
|
||||||
LOG_DEBUG("Self handle: {}", reinterpret_cast<void*>(module_handle));
|
LOG_DEBUG("Self handle: {}", module_handle);
|
||||||
|
|
||||||
// We need to hook functions in either mode
|
// We need to hook functions in either mode
|
||||||
kb::hook::init(true);
|
kb::hook::init(true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ constexpr auto STEAM_GAME_SERVER = "SteamGameServer";
|
|||||||
|
|
||||||
namespace smoke_api {
|
namespace smoke_api {
|
||||||
|
|
||||||
void init(HMODULE module_handle);
|
void init(void* module_handle);
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
AppId_t get_app_id();
|
AppId_t get_app_id();
|
||||||
|
|||||||
Reference in New Issue
Block a user