Added init functions and hook fallback

This commit is contained in:
acidicoala
2025-08-31 03:56:27 +05:00
parent eac7e87880
commit c376b793c1
15 changed files with 168 additions and 76 deletions

View File

@@ -81,7 +81,7 @@ set_target_properties(SmokeAPI PROPERTIES RUNTIME_OUTPUT_NAME ${STEAMAPI_DLL})
configure_version_resource( configure_version_resource(
TARGET SmokeAPI TARGET SmokeAPI
FILE_DESC "Steamworks DLC unlocker" FILE_DESC "Steamworks DLC unlocker"
ORIG_NAME ${STEAMAPI_DLL} ORIG_NAME SmokeAPI
) )
target_include_directories(SmokeAPI PRIVATE target_include_directories(SmokeAPI PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/src"

View File

@@ -54,6 +54,10 @@ namespace {
if(kb::str::eq(library_name, STEAMCLIENT_DLL)) { if(kb::str::eq(library_name, STEAMCLIENT_DLL)) {
KB_HOOK_DETOUR_MODULE(CreateInterface, module_handle); KB_HOOK_DETOUR_MODULE(CreateInterface, module_handle);
} else if(kb::str::eq(library_name, STEAMAPI_DLL)) { } else if(kb::str::eq(library_name, STEAMAPI_DLL)) {
KB_HOOK_DETOUR_MODULE(SteamAPI_Init, module_handle);
KB_HOOK_DETOUR_MODULE(SteamAPI_InitSafe, module_handle);
KB_HOOK_DETOUR_MODULE(SteamAPI_InitFlat, module_handle);
KB_HOOK_DETOUR_MODULE(SteamInternal_SteamAPI_Init, module_handle);
KB_HOOK_DETOUR_MODULE(SteamAPI_RestartAppIfNecessary, module_handle); KB_HOOK_DETOUR_MODULE(SteamAPI_RestartAppIfNecessary, module_handle);
KB_HOOK_DETOUR_MODULE(SteamAPI_Shutdown, module_handle); KB_HOOK_DETOUR_MODULE(SteamAPI_Shutdown, module_handle);
@@ -98,8 +102,8 @@ namespace smoke_api {
} }
LOG_INFO("Initialization complete"); LOG_INFO("Initialization complete");
} catch(const std::exception& ex) { } catch(const std::exception& e) {
kb::util::panic(fmt::format("Initialization error: {}", ex.what())); kb::util::panic(fmt::format("Initialization error: {}", e.what()));
} }
} }

View File

@@ -4,22 +4,93 @@
#include "smoke_api/config.hpp" #include "smoke_api/config.hpp"
#include "smoke_api/smoke_api.hpp" #include "smoke_api/smoke_api.hpp"
#define AUTO_CALL(FUNC, ...) \ #define AUTO_CALL_RETURN(FUNC, ...) \
static const auto _##FUNC = smoke_api::hook_mode \ static const auto _##FUNC = smoke_api::hook_mode \
? KB_HOOK_GET_HOOKED_FN(FUNC) \ ? KB_HOOK_GET_HOOKED_FN(FUNC) \
: KB_WIN_GET_PROC(smoke_api::steamapi_module, FUNC); \ : KB_WIN_GET_PROC(smoke_api::steamapi_module, FUNC); \
return _##FUNC(__VA_ARGS__) return _##FUNC(__VA_ARGS__)
#define AUTO_CALL_RESULT(FUNC, ...) \
static const auto _##FUNC = smoke_api::hook_mode \
? KB_HOOK_GET_HOOKED_FN(FUNC) \
: KB_WIN_GET_PROC(smoke_api::steamapi_module, FUNC); \
const auto result = _##FUNC(__VA_ARGS__)
DLL_EXPORT(bool) SteamAPI_Init() {
LOG_INFO(__func__);
AUTO_CALL_RESULT(SteamAPI_Init);
LOG_INFO("{} -> result: {}", __func__, result);
return result;
}
DLL_EXPORT(bool) SteamAPI_InitSafe() {
LOG_INFO(__func__);
AUTO_CALL_RESULT(SteamAPI_InitSafe);
LOG_INFO("{} -> result: {}", __func__, result);
return result;
}
DLL_EXPORT(ESteamAPIInitResult) SteamAPI_InitFlat(const SteamErrMsg* pOutErrMsg) {
LOG_INFO(__func__);
AUTO_CALL_RESULT(SteamAPI_InitFlat, pOutErrMsg);
const auto error_message = pOutErrMsg && *pOutErrMsg
? std::string_view(*pOutErrMsg)
: "";
LOG_INFO(
"{} -> result: {}, error_message: {}",
__func__,
result,
error_message
);
return result;
}
DLL_EXPORT(ESteamAPIInitResult) SteamInternal_SteamAPI_Init(
const char* pszInternalCheckInterfaceVersions,
const SteamErrMsg* pOutErrMsg
) {
LOG_INFO(__func__);
AUTO_CALL_RESULT(SteamInternal_SteamAPI_Init, pszInternalCheckInterfaceVersions, pOutErrMsg);
const auto error_message = pOutErrMsg && *pOutErrMsg
? std::string_view(*pOutErrMsg)
: "";
LOG_INFO(
"{} -> pszInternalCheckInterfaceVersions: {}, result: {}, error_message: {}",
__func__,
pszInternalCheckInterfaceVersions,
result,
error_message
);
return result;
}
DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(const AppId_t unOwnAppID) { DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(const AppId_t unOwnAppID) {
LOG_INFO("{} -> unOwnAppID: {}", __func__, unOwnAppID); LOG_INFO(__func__);
AUTO_CALL_RESULT(SteamAPI_RestartAppIfNecessary, unOwnAppID);
LOG_INFO("{} -> unOwnAppID: {}, result: {}", __func__, unOwnAppID, result);
// Restart can be suppressed if needed // Restart can be suppressed if needed
return result;
AUTO_CALL(SteamAPI_RestartAppIfNecessary, unOwnAppID);
} }
DLL_EXPORT(void) SteamAPI_Shutdown() { DLL_EXPORT(void) SteamAPI_Shutdown() {
LOG_INFO("{} -> Game requested shutdown", __func__); LOG_INFO("{} -> Game requested shutdown", __func__);
AUTO_CALL(SteamAPI_Shutdown); AUTO_CALL_RETURN(SteamAPI_Shutdown);
} }

View File

@@ -3,6 +3,20 @@
#include "smoke_api/smoke_api.hpp" #include "smoke_api/smoke_api.hpp"
#include "smoke_api/types.hpp" #include "smoke_api/types.hpp"
using ESteamAPIInitResult = uint32_t;
using SteamErrMsg = char[1024];
DLL_EXPORT(bool) SteamAPI_Init();
DLL_EXPORT(bool) SteamAPI_InitSafe();
DLL_EXPORT(ESteamAPIInitResult) SteamAPI_InitFlat(const SteamErrMsg* pOutErrMsg);
DLL_EXPORT(ESteamAPIInitResult) SteamInternal_SteamAPI_Init(
const char* pszInternalCheckInterfaceVersions,
const SteamErrMsg* pOutErrMsg
);
DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID); DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID);
DLL_EXPORT(void) SteamAPI_Shutdown(); DLL_EXPORT(void) SteamAPI_Shutdown();

View File

@@ -12,13 +12,13 @@ namespace steam_client {
try { try {
auto* const interface = original_function(); auto* const interface = original_function();
LOG_DEBUG("'{}' -> '{}' @ {}", function_name, interface_version, interface); LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface);
steam_interface::hook_virtuals(interface, interface_version); steam_interface::hook_virtuals(interface, interface_version);
return interface; return interface;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: '{}' @ {}", function_name, interface_version, e.what()); LOG_ERROR("{} -> Error: '{}' @ {}", function_name, interface_version, e.what());
return nullptr; return nullptr;
} }
} }

View File

@@ -18,6 +18,7 @@ namespace {
void* function_address; // e.g. ISteamClient_GetISteamApps void* function_address; // e.g. ISteamClient_GetISteamApps
}; };
// TODO: Split fallback into low and high versions
struct interface_data { // NOLINT(*-exception-escape) struct interface_data { // NOLINT(*-exception-escape)
std::string fallback_version; // e.g. "SteamClient021" std::string fallback_version; // e.g. "SteamClient021"
std::map<std::string, interface_entry> entry_map; std::map<std::string, interface_entry> entry_map;
@@ -153,12 +154,13 @@ namespace steam_interface {
} }
/** /**
* @param interface Pointer to the interface * @param interface_ptr Pointer to the interface
* @param version_string Example: 'SteamClient020' * @param version_string Example: 'SteamClient020'
*/ */
void hook_virtuals(void* interface, const std::string& version_string) { void hook_virtuals(void* interface_ptr, const std::string& version_string) {
if(interface == nullptr) { if(interface_ptr == nullptr) {
// Game has tried to use an interface before initializing steam api // Game has tried to use an interface before initializing steam api
// This does happen in practice.
return; return;
} }
@@ -167,21 +169,28 @@ namespace steam_interface {
static std::set<void*> processed_interfaces; static std::set<void*> processed_interfaces;
if(processed_interfaces.contains(interface)) { if(processed_interfaces.contains(interface_ptr)) {
LOG_DEBUG( LOG_DEBUG(
"Interface '{}' @ {} has already been processed.", "Interface '{}' @ {} has already been processed.",
version_string, version_string,
interface interface_ptr
); );
return; return;
} }
processed_interfaces.insert(interface); processed_interfaces.insert(interface_ptr);
static const auto virtual_hook_map = get_virtual_hook_map(); static const auto virtual_hook_map = get_virtual_hook_map();
for(const auto& [prefix, data] : virtual_hook_map) { for(const auto& [prefix, data] : virtual_hook_map) {
if(not version_string.starts_with(prefix)) { if(not version_string.starts_with(prefix)) {
continue; continue;
} }
LOG_INFO(
"Processing '{}' @ {} found in virtual hook map",
version_string,
interface_ptr
);
const auto& lookup = find_lookup(version_string, data.fallback_version); const auto& lookup = find_lookup(version_string, data.fallback_version);
for(const auto& [function, entry] : data.entry_map) { for(const auto& [function, entry] : data.entry_map) {
@@ -190,7 +199,7 @@ namespace steam_interface {
} }
kb::hook::swap_virtual_func( kb::hook::swap_virtual_func(
interface, interface_ptr,
entry.function_name, entry.function_name,
lookup.at(function), lookup.at(function),
entry.function_address entry.function_address

View File

@@ -6,5 +6,5 @@ namespace steam_interface {
AppId_t get_app_id_or_throw(); AppId_t get_app_id_or_throw();
AppId_t get_app_id(); AppId_t get_app_id();
void hook_virtuals(void* interface, const std::string& version_string); void hook_virtuals(void* interface_ptr, const std::string& version_string);
} }

View File

@@ -10,17 +10,13 @@ namespace smoke_api::config {
LOCKED, LOCKED,
}; };
NLOHMANN_JSON_SERIALIZE_ENUM( // @formatter:off
AppStatus, NLOHMANN_JSON_SERIALIZE_ENUM(AppStatus, {
// @formatter:off { AppStatus::UNDEFINED, nullptr },
{ { AppStatus::ORIGINAL, "original" },
{ AppStatus::UNDEFINED, nullptr }, { AppStatus::UNLOCKED, "unlocked" },
{ AppStatus::ORIGINAL, "original" }, { AppStatus::LOCKED, "locked" },
{ AppStatus::UNLOCKED, "unlocked" }, }) // @formatter:on
{ AppStatus::LOCKED, "locked" },
}
// @formatter:on
)
struct Config { struct Config {
uint32_t $version = 4; uint32_t $version = 4;

View File

@@ -30,7 +30,7 @@ namespace {
const std::lock_guard lock(section); const std::lock_guard lock(section);
if(app_id == 0) { if(app_id == 0) {
LOG_ERROR("'{}' -> App ID is 0", __func__); LOG_ERROR("{} -> App ID is 0", __func__);
app_dlcs[app_id] = {}; // Dummy value to avoid checking for presence on each access app_dlcs[app_id] = {}; // Dummy value to avoid checking for presence on each access
return; return;
} }
@@ -94,7 +94,7 @@ namespace smoke_api::steam_apps {
); );
LOG_INFO( LOG_INFO(
"'{}' -> {}DLC ID: {:>8}, Unlocked: {}", "{} -> {}DLC ID: {:>8}, Unlocked: {}",
function_name, function_name,
get_app_id_log(app_id), get_app_id_log(app_id),
dlc_id, dlc_id,
@@ -103,7 +103,7 @@ namespace smoke_api::steam_apps {
return unlocked; return unlocked;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Uncaught exception: {}", function_name, e.what()); LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -115,16 +115,16 @@ namespace smoke_api::steam_apps {
) noexcept { ) noexcept {
try { try {
const auto total_count = [&](int count) { const auto total_count = [&](int count) {
LOG_INFO("'{}' -> Responding with DLC count: {}", function_name, count); LOG_INFO("{} -> Responding with DLC count: {}", function_name, count);
return count; return count;
}; };
if(app_id != 0) { if(app_id != 0) {
LOG_DEBUG("'{}' -> App ID: {}", function_name, app_id); LOG_DEBUG("{} -> App ID: {}", function_name, app_id);
} }
const auto original_count = original_function(); const auto original_count = original_function();
LOG_DEBUG("'{}' -> Original DLC count: {}", function_name, original_count); LOG_DEBUG("{} -> Original DLC count: {}", function_name, original_count);
if(original_count < MAX_DLC) { if(original_count < MAX_DLC) {
return total_count(original_count); return total_count(original_count);
@@ -156,11 +156,11 @@ namespace smoke_api::steam_apps {
const std::function<bool()>& is_originally_unlocked const std::function<bool()>& is_originally_unlocked
) noexcept { ) noexcept {
try { try {
LOG_DEBUG("'{}' -> {}index: {:>3}", function_name, get_app_id_log(app_id), iDLC); LOG_DEBUG("{} -> {}index: {:>3}", function_name, get_app_id_log(app_id), iDLC);
const auto print_dlc_info = [&](const std::string& tag) { const auto print_dlc_info = [&](const std::string& tag) {
LOG_INFO( LOG_INFO(
R"('{}' -> [{:^12}] {}index: {:>3}, DLC ID: {:>8}, available: {:5}, name: "{}")", R"({} -> [{:^12}] {}index: {:>3}, DLC ID: {:>8}, available: {:5}, name: "{}")",
function_name, function_name,
tag, tag,
get_app_id_log(app_id), get_app_id_log(app_id),
@@ -190,7 +190,7 @@ namespace smoke_api::steam_apps {
return true; return true;
} }
LOG_WARN("'{}' -> Out of bounds DLC index: {}", function_name, iDLC); LOG_WARN("{} -> Out of bounds DLC index: {}", function_name, iDLC);
return false; return false;
} }
@@ -206,12 +206,12 @@ namespace smoke_api::steam_apps {
); );
print_dlc_info("original"); print_dlc_info("original");
} else { } else {
LOG_WARN("'{}' -> original call failed for index: {}", function_name, iDLC); LOG_WARN("{} -> original call failed for index: {}", function_name, iDLC);
} }
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Uncaught exception: {}", function_name, e.what()); LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what());
return false; return false;
} }
} }

View File

@@ -2,8 +2,6 @@
#include "smoke_api/types.hpp" #include "smoke_api/types.hpp"
// TODO: Make them all noexcept
namespace smoke_api::steam_apps { namespace smoke_api::steam_apps {
bool IsDlcUnlocked( bool IsDlcUnlocked(
const std::string& function_name, const std::string& function_name,

View File

@@ -24,7 +24,7 @@ namespace smoke_api::steam_http {
: ""; : "";
LOG_INFO( LOG_INFO(
"'{}' -> handle: {}, size: {}, buffer:\n{}", "{} -> handle: {}, size: {}, buffer:\n{}",
function_name, function_name,
hRequest, hRequest,
unBufferSize, unBufferSize,
@@ -34,7 +34,7 @@ namespace smoke_api::steam_http {
return result; return result;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", __func__, e.what()); LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false; return false;
} }
} }
@@ -60,7 +60,7 @@ namespace smoke_api::steam_http {
: ""; : "";
LOG_INFO( LOG_INFO(
"'{}' -> handle: {}, offset: {}, size: {}, buffer:\n{}", "{} -> handle: {}, offset: {}, size: {}, buffer:\n{}",
function_name, function_name,
hRequest, hRequest,
cOffset, cOffset,
@@ -71,7 +71,7 @@ namespace smoke_api::steam_http {
return result; return result;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", __func__, e.what()); LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false; return false;
} }
} }
@@ -97,7 +97,7 @@ namespace smoke_api::steam_http {
: ""; : "";
LOG_INFO( LOG_INFO(
"'{}' -> handle: {}, content-type: {}, size: {}, buffer:\n{}", "{} -> handle: {}, content-type: {}, size: {}, buffer:\n{}",
function_name, function_name,
hRequest, hRequest,
content_type, content_type,
@@ -108,7 +108,7 @@ namespace smoke_api::steam_http {
return result; return result;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", __func__, e.what()); LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false; return false;
} }
} }

View File

@@ -13,7 +13,7 @@ namespace smoke_api::steam_inventory {
const auto status = original_function(); const auto status = original_function();
LOG_DEBUG( LOG_DEBUG(
"'{}' -> handle: {}, status: {}", "{} -> handle: {}, status: {}",
function_name, function_name,
resultHandle, resultHandle,
static_cast<int>(status) static_cast<int>(status)
@@ -21,7 +21,7 @@ namespace smoke_api::steam_inventory {
return status; return status;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return EResult::k_EResultFail; return EResult::k_EResultFail;
} }
} }
@@ -52,17 +52,17 @@ namespace smoke_api::steam_inventory {
}; };
if(not success) { if(not success) {
LOG_DEBUG("'{}' -> original result is false", function_name); LOG_DEBUG("{} -> original result is false", function_name);
return success; return success;
} }
if(punOutItemsArraySize == nullptr) { if(punOutItemsArraySize == nullptr) {
LOG_ERROR("'{}' -> arraySize pointer is null", function_name); LOG_ERROR("{} -> arraySize pointer is null", function_name);
return success; return success;
} }
LOG_DEBUG( LOG_DEBUG(
"'{}' -> handle: {}, pOutItemsArray: {}, arraySize: {}", "{} -> handle: {}, pOutItemsArray: {}, arraySize: {}",
function_name, function_name,
resultHandle, resultHandle,
reinterpret_cast<void*>(pOutItemsArray), reinterpret_cast<void*>(pOutItemsArray),
@@ -95,7 +95,7 @@ namespace smoke_api::steam_inventory {
original_count = *punOutItemsArraySize; original_count = *punOutItemsArraySize;
*punOutItemsArraySize += auto_injected_count + injected_count; *punOutItemsArraySize += auto_injected_count + injected_count;
LOG_DEBUG( LOG_DEBUG(
"'{}' -> Original count: {}, Total count: {}", "{} -> Original count: {}, Total count: {}",
function_name, function_name,
original_count, original_count,
*punOutItemsArraySize *punOutItemsArraySize
@@ -136,7 +136,7 @@ namespace smoke_api::steam_inventory {
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -152,7 +152,7 @@ namespace smoke_api::steam_inventory {
) noexcept { ) noexcept {
try { try {
LOG_DEBUG( LOG_DEBUG(
"'{}' -> Handle: {}, Index: {}, Name: '{}'", "{} -> Handle: {}, Index: {}, Name: '{}'",
function_name, function_name,
resultHandle, resultHandle,
unItemIndex, unItemIndex,
@@ -163,7 +163,7 @@ namespace smoke_api::steam_inventory {
const auto success = original_function(); const auto success = original_function();
if(!success) { if(!success) {
LOG_WARN("'{}' -> Result is false", function_name); LOG_WARN("{} -> Result is false", function_name);
return false; return false;
} }
@@ -180,7 +180,7 @@ namespace smoke_api::steam_inventory {
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -194,14 +194,14 @@ namespace smoke_api::steam_inventory {
const auto success = original_function(); const auto success = original_function();
LOG_DEBUG( LOG_DEBUG(
"'{}' -> Handle: {}", "{} -> Handle: {}",
function_name, function_name,
reinterpret_cast<const void*>(pResultHandle) reinterpret_cast<const void*>(pResultHandle)
); );
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -216,7 +216,7 @@ namespace smoke_api::steam_inventory {
try { try {
const auto success = original_function(); const auto success = original_function();
LOG_DEBUG("'{}' -> Handle: {}", function_name, fmt::ptr(pResultHandle)); LOG_DEBUG("{} -> Handle: {}", function_name, fmt::ptr(pResultHandle));
if(success && pInstanceIDs != nullptr) { if(success && pInstanceIDs != nullptr) {
for(int i = 0; i < unCountInstanceIDs; i++) { for(int i = 0; i < unCountInstanceIDs; i++) {
@@ -226,7 +226,7 @@ namespace smoke_api::steam_inventory {
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -243,10 +243,10 @@ namespace smoke_api::steam_inventory {
if(pOutBuffer != nullptr) { if(pOutBuffer != nullptr) {
std::string buffer(static_cast<char*>(pOutBuffer), *punOutBufferSize); std::string buffer(static_cast<char*>(pOutBuffer), *punOutBufferSize);
LOG_DEBUG("'{}' -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer); LOG_DEBUG("{} -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer);
} else { } else {
LOG_DEBUG( LOG_DEBUG(
"'{}' -> Handle: {}, Size: '{}'", "{} -> Handle: {}, Size: '{}'",
function_name, function_name,
resultHandle, resultHandle,
*punOutBufferSize *punOutBufferSize
@@ -255,7 +255,7 @@ namespace smoke_api::steam_inventory {
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -270,12 +270,12 @@ namespace smoke_api::steam_inventory {
const auto success = original_function(); const auto success = original_function();
if(!success) { if(!success) {
LOG_WARN("'{}' -> Result is false", function_name); LOG_WARN("{} -> Result is false", function_name);
return false; return false;
} }
if(punItemDefIDsArraySize) { if(punItemDefIDsArraySize) {
LOG_DEBUG("'{}' -> Size: {}", function_name, *punItemDefIDsArraySize); LOG_DEBUG("{} -> Size: {}", function_name, *punItemDefIDsArraySize);
} else { } else {
return success; return success;
} }
@@ -289,7 +289,7 @@ namespace smoke_api::steam_inventory {
return success; return success;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }
@@ -304,7 +304,7 @@ namespace smoke_api::steam_inventory {
const auto result = original_function(); const auto result = original_function();
LOG_DEBUG( LOG_DEBUG(
"'{}' -> handle: {}, steamID: {}, original result: {}", "{} -> handle: {}, steamID: {}, original result: {}",
function_name, function_name,
resultHandle, resultHandle,
steamIDExpected, steamIDExpected,
@@ -313,7 +313,7 @@ namespace smoke_api::steam_inventory {
return true; return true;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return false; return false;
} }
} }

View File

@@ -14,7 +14,7 @@ namespace smoke_api::steam_user {
const auto result = original_function(); const auto result = original_function();
if(result == k_EUserHasLicenseResultNoAuth) { if(result == k_EUserHasLicenseResultNoAuth) {
LOG_WARN("'{}' -> App ID: {:>8}, Result: NoAuth", function_name, dlcId); LOG_WARN("{} -> App ID: {:>8}, Result: NoAuth", function_name, dlcId);
return result; return result;
} }
@@ -26,13 +26,13 @@ namespace smoke_api::steam_user {
} }
); );
LOG_INFO("'{}' -> App ID: {:>8}, HasLicense: {}", function_name, dlcId, has_license); LOG_INFO("{} -> App ID: {:>8}, HasLicense: {}", function_name, dlcId, has_license);
return has_license return has_license
? k_EUserHasLicenseResultHasLicense ? k_EUserHasLicenseResultHasLicense
: k_EUserHasLicenseResultDoesNotHaveLicense; : k_EUserHasLicenseResultDoesNotHaveLicense;
} catch(const std::exception& e) { } catch(const std::exception& e) {
LOG_ERROR("'{}' -> Error: {}", function_name, e.what()); LOG_ERROR("{} -> Error: {}", function_name, e.what());
return k_EUserHasLicenseResultDoesNotHaveLicense; return k_EUserHasLicenseResultDoesNotHaveLicense;
} }
} }

View File

@@ -44,11 +44,11 @@
* The macros below implement the above-mentioned considerations. * The macros below implement the above-mentioned considerations.
*/ */
#ifdef _WIN64 #ifdef _WIN64
#define PARAMS(...) const void *RCX, __VA_ARGS__ #define PARAMS(...) const void* RCX, __VA_ARGS__
#define ARGS(...) RCX, __VA_ARGS__ #define ARGS(...) RCX, __VA_ARGS__
#define THIS RCX #define THIS RCX
#else #else
#define PARAMS(...) const void *ECX, const void *EDX, __VA_ARGS__ #define PARAMS(...) const void* ECX, const void* EDX, __VA_ARGS__
#define ARGS(...) ECX, EDX, __VA_ARGS__ #define ARGS(...) ECX, EDX, __VA_ARGS__
#define THIS ECX #define THIS ECX
#endif #endif