mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2026-01-25 05:52:51 -05:00
28 lines
839 B
C++
28 lines
839 B
C++
#include <koalabox/logger.hpp>
|
|
|
|
#include "steam_client.hpp"
|
|
#include "steam_api/steam_interfaces.hpp"
|
|
|
|
namespace steam_client {
|
|
void* GetGenericInterface(
|
|
const std::string& function_name,
|
|
const char* interface_version, // This can be null
|
|
const std::function<void*()>& original_function
|
|
) noexcept {
|
|
try {
|
|
auto* const interface = original_function();
|
|
|
|
if(interface_version) {
|
|
LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface);
|
|
|
|
steam_interfaces::hook_virtuals(interface, interface_version);
|
|
}
|
|
|
|
return interface;
|
|
} catch(const std::exception& e) {
|
|
LOG_ERROR("{} -> Error: '{}' @ {}", function_name, interface_version, e.what());
|
|
return nullptr;
|
|
}
|
|
}
|
|
}
|