mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2025-12-05 21:15:39 -05:00
Added init functions and hook fallback
This commit is contained in:
@@ -81,7 +81,7 @@ set_target_properties(SmokeAPI PROPERTIES RUNTIME_OUTPUT_NAME ${STEAMAPI_DLL})
|
||||
configure_version_resource(
|
||||
TARGET SmokeAPI
|
||||
FILE_DESC "Steamworks DLC unlocker"
|
||||
ORIG_NAME ${STEAMAPI_DLL}
|
||||
ORIG_NAME SmokeAPI
|
||||
)
|
||||
target_include_directories(SmokeAPI PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
|
||||
2
KoalaBox
2
KoalaBox
Submodule KoalaBox updated: 87973f64ed...1fd92cf817
@@ -54,6 +54,10 @@ namespace {
|
||||
if(kb::str::eq(library_name, STEAMCLIENT_DLL)) {
|
||||
KB_HOOK_DETOUR_MODULE(CreateInterface, module_handle);
|
||||
} 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_Shutdown, module_handle);
|
||||
|
||||
@@ -98,8 +102,8 @@ namespace smoke_api {
|
||||
}
|
||||
|
||||
LOG_INFO("Initialization complete");
|
||||
} catch(const std::exception& ex) {
|
||||
kb::util::panic(fmt::format("Initialization error: {}", ex.what()));
|
||||
} catch(const std::exception& e) {
|
||||
kb::util::panic(fmt::format("Initialization error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,93 @@
|
||||
#include "smoke_api/config.hpp"
|
||||
#include "smoke_api/smoke_api.hpp"
|
||||
|
||||
#define AUTO_CALL(FUNC, ...) \
|
||||
#define AUTO_CALL_RETURN(FUNC, ...) \
|
||||
static const auto _##FUNC = smoke_api::hook_mode \
|
||||
? KB_HOOK_GET_HOOKED_FN(FUNC) \
|
||||
: KB_WIN_GET_PROC(smoke_api::steamapi_module, FUNC); \
|
||||
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) {
|
||||
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
|
||||
|
||||
AUTO_CALL(SteamAPI_RestartAppIfNecessary, unOwnAppID);
|
||||
return result;
|
||||
}
|
||||
|
||||
DLL_EXPORT(void) SteamAPI_Shutdown() {
|
||||
LOG_INFO("{} -> Game requested shutdown", __func__);
|
||||
|
||||
AUTO_CALL(SteamAPI_Shutdown);
|
||||
AUTO_CALL_RETURN(SteamAPI_Shutdown);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,20 @@
|
||||
#include "smoke_api/smoke_api.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(void) SteamAPI_Shutdown();
|
||||
|
||||
@@ -12,13 +12,13 @@ namespace steam_client {
|
||||
try {
|
||||
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);
|
||||
|
||||
return interface;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace {
|
||||
void* function_address; // e.g. ISteamClient_GetISteamApps
|
||||
};
|
||||
|
||||
// TODO: Split fallback into low and high versions
|
||||
struct interface_data { // NOLINT(*-exception-escape)
|
||||
std::string fallback_version; // e.g. "SteamClient021"
|
||||
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'
|
||||
*/
|
||||
void hook_virtuals(void* interface, const std::string& version_string) {
|
||||
if(interface == nullptr) {
|
||||
void hook_virtuals(void* interface_ptr, const std::string& version_string) {
|
||||
if(interface_ptr == nullptr) {
|
||||
// Game has tried to use an interface before initializing steam api
|
||||
// This does happen in practice.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,21 +169,28 @@ namespace steam_interface {
|
||||
|
||||
static std::set<void*> processed_interfaces;
|
||||
|
||||
if(processed_interfaces.contains(interface)) {
|
||||
if(processed_interfaces.contains(interface_ptr)) {
|
||||
LOG_DEBUG(
|
||||
"Interface '{}' @ {} has already been processed.",
|
||||
version_string,
|
||||
interface
|
||||
interface_ptr
|
||||
);
|
||||
return;
|
||||
}
|
||||
processed_interfaces.insert(interface);
|
||||
processed_interfaces.insert(interface_ptr);
|
||||
|
||||
static const auto virtual_hook_map = get_virtual_hook_map();
|
||||
for(const auto& [prefix, data] : virtual_hook_map) {
|
||||
if(not version_string.starts_with(prefix)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_INFO(
|
||||
"Processing '{}' @ {} found in virtual hook map",
|
||||
version_string,
|
||||
interface_ptr
|
||||
);
|
||||
|
||||
const auto& lookup = find_lookup(version_string, data.fallback_version);
|
||||
|
||||
for(const auto& [function, entry] : data.entry_map) {
|
||||
@@ -190,7 +199,7 @@ namespace steam_interface {
|
||||
}
|
||||
|
||||
kb::hook::swap_virtual_func(
|
||||
interface,
|
||||
interface_ptr,
|
||||
entry.function_name,
|
||||
lookup.at(function),
|
||||
entry.function_address
|
||||
|
||||
@@ -6,5 +6,5 @@ namespace steam_interface {
|
||||
AppId_t get_app_id_or_throw();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -10,17 +10,13 @@ namespace smoke_api::config {
|
||||
LOCKED,
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(
|
||||
AppStatus,
|
||||
// @formatter:off
|
||||
{
|
||||
{ AppStatus::UNDEFINED, nullptr },
|
||||
{ AppStatus::ORIGINAL, "original" },
|
||||
{ AppStatus::UNLOCKED, "unlocked" },
|
||||
{ AppStatus::LOCKED, "locked" },
|
||||
}
|
||||
// @formatter:on
|
||||
)
|
||||
// @formatter:off
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(AppStatus, {
|
||||
{ AppStatus::UNDEFINED, nullptr },
|
||||
{ AppStatus::ORIGINAL, "original" },
|
||||
{ AppStatus::UNLOCKED, "unlocked" },
|
||||
{ AppStatus::LOCKED, "locked" },
|
||||
}) // @formatter:on
|
||||
|
||||
struct Config {
|
||||
uint32_t $version = 4;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace {
|
||||
const std::lock_guard lock(section);
|
||||
|
||||
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
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace smoke_api::steam_apps {
|
||||
);
|
||||
|
||||
LOG_INFO(
|
||||
"'{}' -> {}DLC ID: {:>8}, Unlocked: {}",
|
||||
"{} -> {}DLC ID: {:>8}, Unlocked: {}",
|
||||
function_name,
|
||||
get_app_id_log(app_id),
|
||||
dlc_id,
|
||||
@@ -103,7 +103,7 @@ namespace smoke_api::steam_apps {
|
||||
|
||||
return unlocked;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Uncaught exception: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -115,16 +115,16 @@ namespace smoke_api::steam_apps {
|
||||
) noexcept {
|
||||
try {
|
||||
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;
|
||||
};
|
||||
|
||||
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();
|
||||
LOG_DEBUG("'{}' -> Original DLC count: {}", function_name, original_count);
|
||||
LOG_DEBUG("{} -> Original DLC count: {}", function_name, original_count);
|
||||
|
||||
if(original_count < MAX_DLC) {
|
||||
return total_count(original_count);
|
||||
@@ -156,11 +156,11 @@ namespace smoke_api::steam_apps {
|
||||
const std::function<bool()>& is_originally_unlocked
|
||||
) noexcept {
|
||||
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) {
|
||||
LOG_INFO(
|
||||
R"('{}' -> [{:^12}] {}index: {:>3}, DLC ID: {:>8}, available: {:5}, name: "{}")",
|
||||
R"({} -> [{:^12}] {}index: {:>3}, DLC ID: {:>8}, available: {:5}, name: "{}")",
|
||||
function_name,
|
||||
tag,
|
||||
get_app_id_log(app_id),
|
||||
@@ -190,7 +190,7 @@ namespace smoke_api::steam_apps {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_WARN("'{}' -> Out of bounds DLC index: {}", function_name, iDLC);
|
||||
LOG_WARN("{} -> Out of bounds DLC index: {}", function_name, iDLC);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,12 +206,12 @@ namespace smoke_api::steam_apps {
|
||||
);
|
||||
print_dlc_info("original");
|
||||
} else {
|
||||
LOG_WARN("'{}' -> original call failed for index: {}", function_name, iDLC);
|
||||
LOG_WARN("{} -> original call failed for index: {}", function_name, iDLC);
|
||||
}
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Uncaught exception: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "smoke_api/types.hpp"
|
||||
|
||||
// TODO: Make them all noexcept
|
||||
|
||||
namespace smoke_api::steam_apps {
|
||||
bool IsDlcUnlocked(
|
||||
const std::string& function_name,
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace smoke_api::steam_http {
|
||||
: "";
|
||||
|
||||
LOG_INFO(
|
||||
"'{}' -> handle: {}, size: {}, buffer:\n{}",
|
||||
"{} -> handle: {}, size: {}, buffer:\n{}",
|
||||
function_name,
|
||||
hRequest,
|
||||
unBufferSize,
|
||||
@@ -34,7 +34,7 @@ namespace smoke_api::steam_http {
|
||||
|
||||
return result;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", __func__, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace smoke_api::steam_http {
|
||||
: "";
|
||||
|
||||
LOG_INFO(
|
||||
"'{}' -> handle: {}, offset: {}, size: {}, buffer:\n{}",
|
||||
"{} -> handle: {}, offset: {}, size: {}, buffer:\n{}",
|
||||
function_name,
|
||||
hRequest,
|
||||
cOffset,
|
||||
@@ -71,7 +71,7 @@ namespace smoke_api::steam_http {
|
||||
|
||||
return result;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", __func__, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace smoke_api::steam_http {
|
||||
: "";
|
||||
|
||||
LOG_INFO(
|
||||
"'{}' -> handle: {}, content-type: {}, size: {}, buffer:\n{}",
|
||||
"{} -> handle: {}, content-type: {}, size: {}, buffer:\n{}",
|
||||
function_name,
|
||||
hRequest,
|
||||
content_type,
|
||||
@@ -108,7 +108,7 @@ namespace smoke_api::steam_http {
|
||||
|
||||
return result;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", __func__, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace smoke_api::steam_inventory {
|
||||
const auto status = original_function();
|
||||
|
||||
LOG_DEBUG(
|
||||
"'{}' -> handle: {}, status: {}",
|
||||
"{} -> handle: {}, status: {}",
|
||||
function_name,
|
||||
resultHandle,
|
||||
static_cast<int>(status)
|
||||
@@ -21,7 +21,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return status;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return EResult::k_EResultFail;
|
||||
}
|
||||
}
|
||||
@@ -52,17 +52,17 @@ namespace smoke_api::steam_inventory {
|
||||
};
|
||||
|
||||
if(not success) {
|
||||
LOG_DEBUG("'{}' -> original result is false", function_name);
|
||||
LOG_DEBUG("{} -> original result is false", function_name);
|
||||
return success;
|
||||
}
|
||||
|
||||
if(punOutItemsArraySize == nullptr) {
|
||||
LOG_ERROR("'{}' -> arraySize pointer is null", function_name);
|
||||
LOG_ERROR("{} -> arraySize pointer is null", function_name);
|
||||
return success;
|
||||
}
|
||||
|
||||
LOG_DEBUG(
|
||||
"'{}' -> handle: {}, pOutItemsArray: {}, arraySize: {}",
|
||||
"{} -> handle: {}, pOutItemsArray: {}, arraySize: {}",
|
||||
function_name,
|
||||
resultHandle,
|
||||
reinterpret_cast<void*>(pOutItemsArray),
|
||||
@@ -95,7 +95,7 @@ namespace smoke_api::steam_inventory {
|
||||
original_count = *punOutItemsArraySize;
|
||||
*punOutItemsArraySize += auto_injected_count + injected_count;
|
||||
LOG_DEBUG(
|
||||
"'{}' -> Original count: {}, Total count: {}",
|
||||
"{} -> Original count: {}, Total count: {}",
|
||||
function_name,
|
||||
original_count,
|
||||
*punOutItemsArraySize
|
||||
@@ -136,7 +136,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace smoke_api::steam_inventory {
|
||||
) noexcept {
|
||||
try {
|
||||
LOG_DEBUG(
|
||||
"'{}' -> Handle: {}, Index: {}, Name: '{}'",
|
||||
"{} -> Handle: {}, Index: {}, Name: '{}'",
|
||||
function_name,
|
||||
resultHandle,
|
||||
unItemIndex,
|
||||
@@ -163,7 +163,7 @@ namespace smoke_api::steam_inventory {
|
||||
const auto success = original_function();
|
||||
|
||||
if(!success) {
|
||||
LOG_WARN("'{}' -> Result is false", function_name);
|
||||
LOG_WARN("{} -> Result is false", function_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -194,14 +194,14 @@ namespace smoke_api::steam_inventory {
|
||||
const auto success = original_function();
|
||||
|
||||
LOG_DEBUG(
|
||||
"'{}' -> Handle: {}",
|
||||
"{} -> Handle: {}",
|
||||
function_name,
|
||||
reinterpret_cast<const void*>(pResultHandle)
|
||||
);
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace smoke_api::steam_inventory {
|
||||
try {
|
||||
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) {
|
||||
for(int i = 0; i < unCountInstanceIDs; i++) {
|
||||
@@ -226,7 +226,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -243,10 +243,10 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
if(pOutBuffer != nullptr) {
|
||||
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 {
|
||||
LOG_DEBUG(
|
||||
"'{}' -> Handle: {}, Size: '{}'",
|
||||
"{} -> Handle: {}, Size: '{}'",
|
||||
function_name,
|
||||
resultHandle,
|
||||
*punOutBufferSize
|
||||
@@ -255,7 +255,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -270,12 +270,12 @@ namespace smoke_api::steam_inventory {
|
||||
const auto success = original_function();
|
||||
|
||||
if(!success) {
|
||||
LOG_WARN("'{}' -> Result is false", function_name);
|
||||
LOG_WARN("{} -> Result is false", function_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(punItemDefIDsArraySize) {
|
||||
LOG_DEBUG("'{}' -> Size: {}", function_name, *punItemDefIDsArraySize);
|
||||
LOG_DEBUG("{} -> Size: {}", function_name, *punItemDefIDsArraySize);
|
||||
} else {
|
||||
return success;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return success;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace smoke_api::steam_inventory {
|
||||
const auto result = original_function();
|
||||
|
||||
LOG_DEBUG(
|
||||
"'{}' -> handle: {}, steamID: {}, original result: {}",
|
||||
"{} -> handle: {}, steamID: {}, original result: {}",
|
||||
function_name,
|
||||
resultHandle,
|
||||
steamIDExpected,
|
||||
@@ -313,7 +313,7 @@ namespace smoke_api::steam_inventory {
|
||||
|
||||
return true;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace smoke_api::steam_user {
|
||||
const auto result = original_function();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
? k_EUserHasLicenseResultHasLicense
|
||||
: k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("'{}' -> Error: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Error: {}", function_name, e.what());
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,11 +44,11 @@
|
||||
* The macros below implement the above-mentioned considerations.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
#define PARAMS(...) const void *RCX, __VA_ARGS__
|
||||
#define PARAMS(...) const void* RCX, __VA_ARGS__
|
||||
#define ARGS(...) RCX, __VA_ARGS__
|
||||
#define THIS RCX
|
||||
#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 THIS ECX
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user