Reworked logging

This commit is contained in:
acidicoala
2025-08-16 19:19:03 +05:00
parent 9f8b9befc6
commit 5f1e83adad
26 changed files with 251 additions and 271 deletions

View File

@@ -9,7 +9,7 @@ AppDlcNameMap get_cached_apps() noexcept {
try {
return koalabox::cache::get(KEY_APPS).get<AppDlcNameMap>();
} catch (const Exception& e) {
LOG_WARN("Failed to get cached apps: {}", e.what())
LOG_WARN("Failed to get cached apps: {}", e.what());
return {};
}
}
@@ -18,13 +18,13 @@ namespace smoke_api::app_cache {
Vector<DLC> get_dlcs(AppId_t app_id) noexcept {
try {
LOG_DEBUG("Reading cached DLC IDs for the app: {}", app_id)
LOG_DEBUG("Reading cached DLC IDs for the app: {}", app_id);
const auto apps = get_cached_apps();
return DLC::get_dlcs_from_apps(apps, app_id);
} catch (const Exception& e) {
LOG_ERROR("Error reading DLCs from disk cache: ", e.what())
LOG_ERROR("Error reading DLCs from disk cache: ", e.what());
return {};
}
@@ -32,7 +32,7 @@ namespace smoke_api::app_cache {
bool save_dlcs(AppId_t app_id, const Vector<DLC>& dlcs) noexcept {
try {
LOG_DEBUG("Caching DLC IDs for the app: {}", app_id)
LOG_DEBUG("Caching DLC IDs for the app: {}", app_id);
auto apps = get_cached_apps();
@@ -40,7 +40,7 @@ namespace smoke_api::app_cache {
return koalabox::cache::put(KEY_APPS, Json(apps));
} catch (const Exception& e) {
LOG_ERROR("Error saving DLCs to disk cache: {}", e.what())
LOG_ERROR("Error saving DLCs to disk cache: {}", e.what());
return false;
}

View File

@@ -20,7 +20,7 @@ namespace api {
return DLC::get_dlcs_from_apps(response, app_id);
} catch (const Json::exception& e) {
LOG_ERROR("Failed to fetch dlc list from GitHub: {}", e.what())
LOG_ERROR("Failed to fetch dlc list from GitHub: {}", e.what());
return std::nullopt;
}
}
@@ -40,7 +40,7 @@ namespace api {
return response.dlcs;
} catch (const Exception& e) {
LOG_ERROR("Failed to fetch dlc list from Steam: {}", e.what())
LOG_ERROR("Failed to fetch dlc list from Steam: {}", e.what());
return std::nullopt;
}
}

View File

@@ -5,7 +5,7 @@ DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(
[[maybe_unused]] const uint32_t unOwnAppID
) {
if (smoke_api::config::instance.override_app_id != 0) {
LOG_DEBUG("{} -> Preventing app restart", __func__)
LOG_DEBUG("{} -> Preventing app restart", __func__);
return false;
}
@@ -13,7 +13,7 @@ DLL_EXPORT(bool) SteamAPI_RestartAppIfNecessary(
}
DLL_EXPORT(void) SteamAPI_Shutdown() {
LOG_INFO("{} -> Game requested shutdown", __func__)
LOG_INFO("{} -> Game requested shutdown", __func__);
ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_Shutdown)();
}

View File

@@ -18,7 +18,7 @@ DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsSubscribedApp(void* self, AppId_t dlcID)
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
}
@@ -34,7 +34,7 @@ DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsDlcInstalled(void* self, AppId_t dlcID)
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
}
@@ -50,7 +50,7 @@ DLL_EXPORT(int) SteamAPI_ISteamApps_GetDLCCount(void* self) {
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return 0;
}
}
@@ -78,7 +78,7 @@ DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
}
@@ -99,7 +99,7 @@ DLL_EXPORT(void*) SteamAPI_ISteamClient_GetISteamGenericInterface(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return nullptr;
}
}
@@ -247,7 +247,7 @@ DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamUser_UserHasLicenseForApp
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return k_EUserHasLicenseResultDoesNotHaveLicense;
}

View File

@@ -27,7 +27,7 @@ String get_versioned_interface(const String& version_prefix, const String& fallb
LOG_ERROR(
"Failed to get versioned interface: {}."
"Falling back to version {}", ex.what(), fallback
)
);
version_map[version_prefix] = version_prefix + fallback;
}

View File

@@ -13,7 +13,7 @@ VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t dlc_id)) {
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
@@ -29,7 +29,7 @@ VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t dlc_id)) {
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
@@ -45,7 +45,7 @@ VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) {
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return 0;
}
@@ -75,7 +75,7 @@ VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return false;
}
}

View File

@@ -16,7 +16,7 @@ VIRTUAL(void*) ISteamClient_GetISteamApps(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return nullptr;
}
}
@@ -37,7 +37,7 @@ VIRTUAL(void*) ISteamClient_GetISteamUser(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return nullptr;
}
}
@@ -58,7 +58,7 @@ VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return nullptr;
}
}
@@ -79,7 +79,7 @@ VIRTUAL(void*) ISteamClient_GetISteamInventory(
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return nullptr;
}
}

View File

@@ -14,7 +14,7 @@ VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(PARAMS(CSte
}
);
} catch (const Exception& e) {
LOG_ERROR("{} -> Error: {}", __func__, e.what())
LOG_ERROR("{} -> Error: {}", __func__, e.what());
return k_EUserHasLicenseResultDoesNotHaveLicense;
}
}

View File

@@ -1,9 +1,11 @@
#include <Windows.h>
#include <smoke_api/smoke_api.hpp>
// This header will be populated at build time
#include <linker_exports.h>
EXTERN_C [[maybe_unused]] BOOL WINAPI DllMain(HMODULE module_handle, DWORD reason, LPVOID) {
EXTERN_C [[maybe_unused]] BOOL WINAPI
DllMain(const HMODULE module_handle, const DWORD reason, LPVOID) {
if (reason == DLL_PROCESS_ATTACH) {
smoke_api::init(module_handle);
} else if (reason == DLL_PROCESS_DETACH) {

View File

@@ -17,7 +17,7 @@ namespace smoke_api::config {
instance = Json::parse(config_str).get<Config>();
LOG_DEBUG("Parsed config:\n{}", Json(instance).dump(2))
LOG_DEBUG("Parsed config:\n{}", Json(instance).dump(2));
} catch (const Exception& e) {
const auto message = fmt::format("Error parsing config file: {}", e.what());
koalabox::util::error_box("SmokeAPI Error", message);
@@ -59,13 +59,13 @@ namespace smoke_api::config {
LOG_TRACE(
"App ID: {}, DLC ID: {}, Status: {}, Original: {}, Unlocked: {}",
app_id_str, dlc_id_str, Json(status).dump(), original_function(), is_unlocked
)
);
return is_unlocked;
}
DLL_EXPORT(void) ReloadConfig() {
LOG_INFO("Reloading config")
LOG_INFO("Reloading config");
init_config();
}

View File

@@ -1,16 +1,19 @@
#include <smoke_api/smoke_api.hpp>
#include <build_config.h>
#include <smoke_api/config.hpp>
#include <core/globals.hpp>
#include <core/paths.hpp>
#include <common/steamclient_exports.hpp>
#include <koalabox/globals.hpp>
#include "koalabox/paths.hpp"
#include <koalabox/dll_monitor.hpp>
#include <koalabox/logger.hpp>
#include <koalabox/globals.hpp>
#include <koalabox/hook.hpp>
#include <koalabox/loader.hpp>
#include <koalabox/win_util.hpp>
#include <koalabox/logger.hpp>
#include <koalabox/util.hpp>
#include <koalabox/win_util.hpp>
#include <build_config.h>
#include <common/steamclient_exports.hpp>
#include <core/globals.hpp>
#include <core/paths.hpp>
#include <smoke_api/config.hpp>
#include <smoke_api/smoke_api.hpp>
#if COMPILE_STORE_MODE
#include <store_mode/store.hpp>
@@ -34,69 +37,62 @@
// Given that hooking steam_api has no apparent benefits, but has inherent flaws,
// the support for it has been dropped from this project.
namespace {
void override_app_id() {
const auto override_app_id = smoke_api::config::instance.override_app_id;
if (override_app_id == 0)
return;
void override_app_id() {
const auto override_app_id = smoke_api::config::instance.override_app_id;
if (override_app_id == 0)
return;
spdlog::default_logger_raw();
LOG_DEBUG("Overriding app id to {}", override_app_id);
LOG_DEBUG("Overriding app id to {}", override_app_id);
SetEnvironmentVariable(TEXT("SteamAppId"), std::to_wstring(override_app_id).c_str());
}
SetEnvironmentVariable(
TEXT("SteamAppId"),
std::to_wstring(override_app_id).c_str()
);
}
void init_proxy_mode() {
LOG_INFO("Detected proxy mode");
void init_proxy_mode() {
LOG_INFO("🔀 Detected proxy mode")
override_app_id();
override_app_id();
globals::steamapi_module =
koalabox::loader::load_original_library(paths::get_self_path(), STEAMAPI_DLL);
}
globals::steamapi_module = koalabox::loader::load_original_library(
paths::get_self_path(),
STEAMAPI_DLL
);
}
void init_hook_mode() {
LOG_INFO("🪝 Detected hook mode");
void init_hook_mode() {
LOG_INFO("🪝 Detected hook mode")
override_app_id();
override_app_id();
koalabox::dll_monitor::init_listener(
STEAMCLIENT_DLL,
[](const HMODULE &library) {
koalabox::dll_monitor::init_listener(STEAMCLIENT_DLL, [](const HMODULE& library) {
globals::steamclient_module = library;
DETOUR_STEAMCLIENT(CreateInterface)
koalabox::dll_monitor::shutdown_listener();
}
);
}
});
}
bool is_valve_steam(const String& exe_name) noexcept {
try {
if (exe_name < not_equals > "steam.exe") {
return false;
}
// Verify that it's steam from valve, and not some other executable coincidentally named
// steam
const HMODULE steam_handle = koalabox::win_util::get_module_handle_or_throw(nullptr);
const auto manifest = koalabox::win_util::get_module_manifest(steam_handle);
// Steam.exe manifest is expected to contain this string
return manifest < contains > "valvesoftware.steam.steam";
} catch (const Exception& e) {
LOG_ERROR("{} -> {}", __func__, e.what());
bool is_valve_steam(const String &exe_name) noexcept {
try {
if (exe_name < not_equals > "steam.exe") {
return false;
}
// Verify that it's steam from valve, and not some other executable coincidentally named steam
const HMODULE steam_handle = koalabox::win_util::get_module_handle_or_throw(nullptr);
const auto manifest = koalabox::win_util::get_module_manifest(
steam_handle);
// Steam.exe manifest is expected to contain this string
return manifest < contains > "valvesoftware.steam.steam";
} catch (const Exception &e) {
LOG_ERROR("{} -> {}", __func__, e.what())
return false;
}
}
namespace smoke_api {
void init(const HMODULE module_handle) {
// FIXME: IMPORTANT! Non ascii paths in directories will result in init errors
@@ -110,33 +106,27 @@ namespace smoke_api {
config::init_config();
if (config::instance.logging) {
koalabox::logger::init_file_logger();
koalabox::logger::init_file_logger(koalabox::paths::get_log_path());
}
// This kind of timestamp is reliable only for CI builds, as it will reflect the compilation
// time stamp only when this file gets recompiled.
LOG_INFO(
"🐨 {} v{} | Compiled at '{}'", PROJECT_NAME,
PROJECT_VERSION,
__TIMESTAMP__
)
// This kind of timestamp is reliable only for CI builds, as it will reflect the
// compilation time stamp only when this file gets recompiled.
LOG_INFO("{} v{} | Compiled at '{}'", PROJECT_NAME, PROJECT_VERSION, __TIMESTAMP__);
const Path exe_path = koalabox::win_util::get_module_file_name_or_throw(nullptr);
const auto exe_name = exe_path.filename().string();
LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, BITNESS)
LOG_DEBUG("Process name: '{}' [{}-bit]", exe_name, BITNESS);
const bool is_hook_mode = koalabox::hook::is_hook_mode(
globals::smokeapi_handle,
STEAMAPI_DLL
);
const bool is_hook_mode =
koalabox::hook::is_hook_mode(globals::smokeapi_handle, STEAMAPI_DLL);
if (is_hook_mode) {
koalabox::hook::init(true);
if (is_valve_steam(exe_name)) {
#if COMPILE_STORE_MODE
LOG_INFO("🛍️ Detected Store mode")
LOG_INFO("Detected Store mode");
store::init_store_mode();
#endif
} else {
@@ -146,11 +136,9 @@ namespace smoke_api {
init_proxy_mode();
}
LOG_INFO("🚀 Initialization complete")
} catch (const Exception &ex) {
koalabox::util::panic(
fmt::format("Initialization error: {}", ex.what())
);
LOG_INFO("Initialization complete");
} catch (const Exception& ex) {
koalabox::util::panic(fmt::format("Initialization error: {}", ex.what()));
}
}
@@ -160,9 +148,11 @@ namespace smoke_api {
koalabox::win_util::free_library(globals::steamapi_module);
}
LOG_INFO("💀 Shutdown complete")
} catch (const Exception &ex) {
LOG_ERROR("Shutdown error: {}", ex.what())
LOG_INFO("Shutdown complete");
} catch (const Exception& ex) {
LOG_ERROR("Shutdown error: {}", ex.what());
}
koalabox::logger::shutdown();
}
}

View File

@@ -1,5 +1,4 @@
#include <steam_impl/steam_apps.hpp>
#include <steam_impl/steam_impl.hpp>
#include <common/app_cache.hpp>
#include <smoke_api/config.hpp>
#include <koalabox/logger.hpp>
@@ -29,7 +28,7 @@ namespace steam_apps {
const MutexLockGuard guard(mutex);
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;
}
@@ -45,7 +44,7 @@ namespace steam_apps {
Vector<DLC> aggregated_dlcs;
const auto append_dlcs = [&](const Vector<DLC>& source, const String& source_name) {
LOG_DEBUG("App ID {} has {} DLCs defined in {}", app_id, source.size(), source_name)
LOG_DEBUG("App ID {} has {} DLCs defined in {}", app_id, source.size(), source_name);
aggregated_dlcs < append > source;
};
@@ -82,11 +81,11 @@ namespace steam_apps {
try {
const auto unlocked = smoke_api::config::is_dlc_unlocked(app_id, dlc_id, original_function);
LOG_INFO("{} -> {}DLC ID: {:>8}, Unlocked: {}", function_name, get_app_id_log(app_id), dlc_id, unlocked)
LOG_INFO("{} -> {}DLC ID: {:>8}, Unlocked: {}", function_name, get_app_id_log(app_id), dlc_id, unlocked);
return unlocked;
} catch (const Exception& e) {
LOG_ERROR("Uncaught exception: {}", e.what())
LOG_ERROR("Uncaught exception: {}", e.what());
return false;
}
}
@@ -94,28 +93,28 @@ namespace steam_apps {
int GetDLCCount(const String& function_name, const AppId_t app_id, const Function<int()>& original_function) {
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);
}
LOG_DEBUG("Game has {} or more DLCs. Fetching DLCs from remote sources.", original_count)
LOG_DEBUG("Game has {} or more DLCs. Fetching DLCs from remote sources.", original_count);
fetch_and_cache_dlcs(app_id);
return total_count(static_cast<int>(app_dlcs[app_id].size()));
} catch (const Exception& e) {
LOG_ERROR(" Uncaught exception: {}", function_name, e.what())
LOG_ERROR(" Uncaught exception: {}", function_name, e.what());
return 0;
}
}
@@ -132,13 +131,13 @@ namespace steam_apps {
const Function<bool(AppId_t)>& is_originally_unlocked
) {
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 String& tag) {
LOG_INFO(
R"({} -> [{:^12}] {}index: {:>3}, DLC ID: {:>8}, available: {:5}, name: "{}")",
function_name, tag, get_app_id_log(app_id), iDLC, *pDlcId, *pbAvailable, pchName
)
);
};
const auto inject_dlc = [&](const DLC& dlc) {
@@ -164,7 +163,7 @@ namespace 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;
}
@@ -176,12 +175,12 @@ namespace 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 Exception& e) {
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what())
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what());
return false;
}
}

View File

@@ -11,7 +11,7 @@ namespace steam_client {
) {
auto* const interface = original_function();
LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface)
LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface);
steam_impl::hook_virtuals(interface, interface_version);

View File

@@ -91,20 +91,20 @@ namespace steam_impl {
const int min_version,
const int max_version
) {
LOG_DEBUG("Hooking interface '{}'", version_string)
LOG_DEBUG("Hooking interface '{}'", version_string);
try {
const auto version_number = stoi(version_string.substr(prefix.length()));
if (version_number < min_version) {
LOG_WARN("Legacy version of {}: {}", version_string, version_number)
LOG_WARN("Legacy version of {}: {}", version_string, version_number);
}
if (version_number > max_version) {
LOG_WARN(
"Unsupported new version of {}: {}. Fallback version {} will be used",
version_string, version_number, max_version
)
);
}
return version_number;
@@ -157,7 +157,7 @@ namespace steam_impl {
static Set<void*> hooked_interfaces;
if (hooked_interfaces.contains(interface)) {
LOG_DEBUG("Interface {} at {} has already been hooked.", version_string, interface)
LOG_DEBUG("Interface {} at {} has already been hooked.", version_string, interface);
}
static Mutex section;
@@ -230,7 +230,7 @@ namespace steam_impl {
GetHSteamPipe_address = (void*)koalabox::win_util::get_proc_address_or_throw(
steam_api_module, "SteamAPI_GetHSteamPipe"
);
} catch (const Exception& ex) {
} catch (...) {
GetHSteamPipe_address = (void*)koalabox::win_util::get_proc_address_or_throw(
steam_api_module, "GetHSteamPipe"
);

View File

@@ -11,7 +11,7 @@ namespace steam_inventory {
) {
const auto status = original_function();
LOG_DEBUG("{} -> handle: {}, status: {}", function_name, resultHandle, (int) status)
LOG_DEBUG("{} -> handle: {}, status: {}", function_name, resultHandle, (int) status);
return status;
}
@@ -33,23 +33,23 @@ namespace steam_inventory {
LOG_DEBUG(
" [{}] definitionId: {}, itemId: {}, quantity: {}, flags: {}",
tag, item.m_iDefinition, item.m_itemId, item.m_unQuantity, item.m_unFlags
)
);
};
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: {}",
function_name, resultHandle, fmt::ptr(pOutItemsArray), *punOutItemsArraySize
)
);
static uint32_t original_count = 0;
const auto injected_count = smoke_api::config::instance.extra_inventory_items.size();
@@ -75,7 +75,7 @@ namespace steam_inventory {
LOG_DEBUG(
"{} -> Original count: {}, Total count: {}",
function_name, original_count, *punOutItemsArraySize
)
);
} else {
// Otherwise, we modify the array
for (int i = 0; i < original_count; i++) {
@@ -129,11 +129,11 @@ namespace steam_inventory {
const auto success = original_function();
if (!success) {
LOG_WARN("{}, Result is false", common_info)
LOG_WARN("{}, Result is false", common_info);
return false;
}
LOG_DEBUG("{}, Buffer: '{}'", common_info, String(pchValueBuffer, *punValueBufferSizeOut - 1))
LOG_DEBUG("{}, Buffer: '{}'", common_info, String(pchValueBuffer, *punValueBufferSizeOut - 1));
return success;
}
@@ -145,7 +145,7 @@ namespace steam_inventory {
) {
const auto success = original_function();
LOG_DEBUG("{} -> Handle: {}", function_name, fmt::ptr(pResultHandle))
LOG_DEBUG("{} -> Handle: {}", function_name, fmt::ptr(pResultHandle));
return success;
}
@@ -160,11 +160,11 @@ namespace steam_inventory {
) {
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++) {
LOG_DEBUG(" Index: {}, ItemId: {}", i, pInstanceIDs[i])
LOG_DEBUG(" Index: {}, ItemId: {}", i, pInstanceIDs[i]);
}
}
@@ -182,9 +182,9 @@ namespace steam_inventory {
if (pOutBuffer != nullptr) {
String buffer((char*) pOutBuffer, *punOutBufferSize);
LOG_DEBUG("{} -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer)
LOG_DEBUG("{} -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer);
} else {
LOG_DEBUG("{} -> Handle: {}, Size: '{}'", function_name, resultHandle, *punOutBufferSize)
LOG_DEBUG("{} -> Handle: {}, Size: '{}'", function_name, resultHandle, *punOutBufferSize);
}
return success;
@@ -199,18 +199,18 @@ namespace 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);
}
if (pItemDefIDs) { // Definitions were copied
for (int i = 0; i < *punItemDefIDsArraySize; i++) {
const auto& def = pItemDefIDs[i];
LOG_DEBUG(" Index: {}, ID: {}", i, def)
LOG_DEBUG(" Index: {}, ID: {}", i, def);
}
}
@@ -228,7 +228,7 @@ namespace steam_inventory {
LOG_DEBUG(
"{} -> handle: {}, steamID: {}, original result: {}",
function_name, resultHandle, steamIDExpected, result
)
);
return true;
}

View File

@@ -13,7 +13,7 @@ namespace 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;
}
@@ -23,7 +23,7 @@ namespace 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