Reworked hooking

This commit is contained in:
acidicoala
2025-08-28 22:25:11 +05:00
parent 6432eb3ec9
commit 09e1187ab0
19 changed files with 129 additions and 120 deletions

View File

@@ -37,6 +37,7 @@ namespace smoke_api::config {
Config,
$version,
logging,
log_steam_http,
default_app_status,
override_app_status,
override_dlc_status,

View File

@@ -4,9 +4,9 @@ std::vector<DLC> DLC::get_dlcs_from_apps(const AppDlcNameMap& apps, const AppId_
std::vector<DLC> dlcs;
if(const auto app_id_str = std::to_string(app_id); apps.contains(app_id_str)) {
const auto& app = apps.at(app_id_str);
const auto& [app_dlcs] = apps.at(app_id_str);
for(auto const& [id, name] : app.dlcs) {
for(auto const& [id, name] : app_dlcs) {
dlcs.emplace_back(id, name);
}
}

View File

@@ -13,16 +13,12 @@
// These macros are meant to be used for callbacks that should return original result
#define HOOKED_CALL(FUNC, ...) \
static const auto _##FUNC = KB_HOOK_GET_HOOKED_FN(FUNC); \
#define SWAPPED_CALL(CLASS, FUNC, ...) \
const auto _##FUNC = KB_HOOK_GET_SWAPPED_FN(CLASS, FUNC); \
return _##FUNC(__VA_ARGS__)
#define HOOKED_CALL_CLOSURE(FUNC, ...) \
[&] { HOOKED_CALL(FUNC, __VA_ARGS__); }
#define HOOKED_CALL_RESULT(FUNC, ...) \
static const auto _##FUNC = KB_HOOK_GET_HOOKED_FN(FUNC); \
const auto result = _##FUNC(__VA_ARGS__)
#define SWAPPED_CALL_CLOSURE(FUNC, ...) \
[&] { SWAPPED_CALL(THIS, FUNC, __VA_ARGS__); }
/**
* By default, virtual functions are declared with __thiscall