mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2026-05-04 19:42:15 -04:00
Refactored for latest Koalabox
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
#include <cpr/cpr.h>
|
||||
#include <koalabox/io.hpp>
|
||||
#include <koalabox/http_client.hpp>
|
||||
#include <core/cache.hpp>
|
||||
#include <core/config.hpp>
|
||||
#include <smoke_api/smoke_api.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
#include <koalabox/util.hpp>
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
#include <core/steam_types.hpp>
|
||||
|
||||
namespace steam_apps {
|
||||
using namespace smoke_api;
|
||||
using namespace koalabox;
|
||||
|
||||
/// Steamworks may max GetDLCCount value at 64, depending on how much unowned DLCs the user has.
|
||||
/// Despite this limit, some games with more than 64 DLCs still keep using this method.
|
||||
@@ -27,9 +29,9 @@ namespace steam_apps {
|
||||
try {
|
||||
app_id = steam_functions::get_app_id_or_throw();
|
||||
// TODO: Check what it returns in koalageddon mode
|
||||
logger->info("Detected App ID: {}", app_id);
|
||||
LOG_INFO("Detected App ID: {}", app_id)
|
||||
} catch (const Exception& ex) {
|
||||
logger->error("Failed to get app ID: {}", ex.what());
|
||||
LOG_ERROR("Failed to get app ID: {}", ex.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +56,7 @@ namespace steam_apps {
|
||||
dlcs.emplace_back(std::stoi(app_id));
|
||||
}
|
||||
} catch (const Exception& e) {
|
||||
logger->error("Failed to fetch dlc list from steam api: {}", e.what());
|
||||
LOG_ERROR("Failed to fetch dlc list from steam api: {}", e.what())
|
||||
total_success = false;
|
||||
}
|
||||
|
||||
@@ -72,7 +74,7 @@ namespace steam_apps {
|
||||
dlcs = json[app_id_str].get<decltype(dlcs)>();
|
||||
}
|
||||
} catch (const Exception& e) {
|
||||
logger->error("Failed to fetch extra dlc list from github api: {}", e.what());
|
||||
LOG_ERROR("Failed to fetch extra dlc list from github api: {}", e.what())
|
||||
total_success = false;
|
||||
}
|
||||
|
||||
@@ -110,34 +112,34 @@ namespace steam_apps {
|
||||
const String& function_name,
|
||||
AppId_t app_id,
|
||||
AppId_t dlc_id,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
try {
|
||||
const auto unlocked = config::is_dlc_unlocked(app_id, dlc_id, original_function);
|
||||
|
||||
logger->info("{} -> {}DLC ID: {}, Unlocked: {}", function_name, get_app_id_log(app_id), dlc_id, unlocked);
|
||||
LOG_INFO("{} -> {}DLC ID: {}, Unlocked: {}", function_name, get_app_id_log(app_id), dlc_id, unlocked)
|
||||
|
||||
return unlocked;
|
||||
} catch (const Exception& e) {
|
||||
logger->error("{} -> Uncaught exception: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int GetDLCCount(const String& function_name, const AppId_t app_id, const std::function<int()>& original_function) {
|
||||
int GetDLCCount(const String& function_name, const AppId_t app_id, const Function<int()>& original_function) {
|
||||
try {
|
||||
const auto total_count = [&](int count) {
|
||||
logger->info("{} -> Responding with DLC count: {}", function_name, count);
|
||||
LOG_INFO("{} -> Responding with DLC count: {}", function_name, count)
|
||||
return count;
|
||||
};
|
||||
|
||||
if (app_id != 0) {
|
||||
logger->debug("{} -> App ID: {}", function_name, app_id);
|
||||
LOG_DEBUG("{} -> App ID: {}", function_name, app_id)
|
||||
}
|
||||
|
||||
const auto original_count = original_function();
|
||||
original_dlc_count_map[app_id] = original_count;
|
||||
logger->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);
|
||||
@@ -146,7 +148,7 @@ namespace steam_apps {
|
||||
// We need to fetch DLC IDs from all possible sources at this point
|
||||
|
||||
const auto injected_count = static_cast<int>(config::instance.extra_dlc_ids.size());
|
||||
logger->debug("{} -> Injected DLC count: {}", function_name, injected_count);
|
||||
LOG_DEBUG("{} -> Injected DLC count: {}", function_name, injected_count)
|
||||
|
||||
// Maintain a list of app_ids for which we have already fetched and cached DLC IDs
|
||||
static Set<AppId_t> cached_apps;
|
||||
@@ -154,7 +156,7 @@ namespace steam_apps {
|
||||
static std::mutex mutex;
|
||||
const std::lock_guard<std::mutex> guard(mutex);
|
||||
|
||||
logger->debug("Game has {} or more DLCs. Fetching DLCs from remote sources.", MAX_DLC);
|
||||
LOG_DEBUG("Game has {} or more DLCs. Fetching DLCs from remote sources.", MAX_DLC)
|
||||
|
||||
if (fetch_and_cache_dlcs(app_id)) {
|
||||
cached_apps.insert(app_id);
|
||||
@@ -162,11 +164,11 @@ namespace steam_apps {
|
||||
}
|
||||
|
||||
const auto cached_count = static_cast<int>(cached_dlcs.size());
|
||||
logger->debug("{} -> Cached DLC count: {}", function_name, cached_count);
|
||||
LOG_DEBUG("{} -> Cached DLC count: {}", function_name, cached_count)
|
||||
|
||||
return total_count(injected_count + cached_count);
|
||||
} catch (const Exception& e) {
|
||||
logger->error("{} -> Uncaught exception: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -179,14 +181,14 @@ namespace steam_apps {
|
||||
bool* pbAvailable,
|
||||
char* pchName,
|
||||
int cchNameBufferSize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
try {
|
||||
const auto print_dlc_info = [&](const String& tag) {
|
||||
logger->info(
|
||||
LOG_INFO(
|
||||
"{} -> [{}] {}index: {}, DLC ID: {}, available: {}, name: '{}'",
|
||||
function_name, tag, get_app_id_log(app_id), iDLC, *pDlcId, *pbAvailable, pchName
|
||||
);
|
||||
)
|
||||
};
|
||||
|
||||
const auto inject_dlc = [&](const String& tag, const Vector<AppId_t>& dlc_ids, const int index) {
|
||||
@@ -224,7 +226,7 @@ namespace steam_apps {
|
||||
*pbAvailable = config::is_dlc_unlocked(app_id, *pDlcId, [&]() { return *pbAvailable; });
|
||||
print_dlc_info("original");
|
||||
} else {
|
||||
logger->warn("{} -> original call failed for index: {}", function_name, iDLC);
|
||||
LOG_WARN("{} -> original call failed for index: {}", function_name, iDLC)
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@@ -236,7 +238,7 @@ namespace steam_apps {
|
||||
// [injected-dlc-0, injected-dlc-1, ..., cached-dlc-0, cached-dlc-1, ...]
|
||||
|
||||
if (iDLC < 0) {
|
||||
logger->warn("{} -> Out of bounds DLC index: {}", function_name, iDLC);
|
||||
LOG_WARN("{} -> Out of bounds DLC index: {}", function_name, iDLC)
|
||||
}
|
||||
|
||||
const int local_dlc_count = static_cast<int>(config::instance.extra_dlc_ids.size());
|
||||
@@ -250,14 +252,14 @@ namespace steam_apps {
|
||||
return inject_dlc("memory cache", cached_dlcs, adjusted_index);
|
||||
}
|
||||
|
||||
logger->error(
|
||||
LOG_ERROR(
|
||||
"{} -> Out of bounds DLC index: {}, local dlc count: {}, cached dlc count: {}",
|
||||
function_name, iDLC, local_dlc_count, cached_dlc_count
|
||||
);
|
||||
)
|
||||
|
||||
return false;
|
||||
} catch (const Exception& e) {
|
||||
logger->error("{} -> Uncaught exception: {}", function_name, e.what());
|
||||
LOG_ERROR("{} -> Uncaught exception: {}", function_name, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
#include <core/steam_types.hpp>
|
||||
#include <koalabox/types.hpp>
|
||||
|
||||
namespace steam_apps {
|
||||
using namespace koalabox;
|
||||
|
||||
bool IsDlcUnlocked(
|
||||
const String& function_name,
|
||||
AppId_t app_id,
|
||||
AppId_t dlc_id,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
int GetDLCCount(
|
||||
const String& function_name,
|
||||
AppId_t app_id,
|
||||
const std::function<int()>& original_function
|
||||
const Function<int()>& original_function
|
||||
);
|
||||
|
||||
bool GetDLCDataByIndex(
|
||||
@@ -24,7 +24,7 @@ namespace steam_apps {
|
||||
bool* pbAvailable,
|
||||
char* pchName,
|
||||
int cchNameBufferSize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#include <steam_impl/steam_client.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
|
||||
namespace steam_client {
|
||||
|
||||
void* GetGenericInterface(
|
||||
const String& function_name,
|
||||
const String& interface_version,
|
||||
const std::function<void*()>& original_function
|
||||
const Function<void*()>& original_function
|
||||
) {
|
||||
logger->debug("{} -> Version: '{}'", function_name, interface_version);
|
||||
|
||||
auto* const interface = original_function();
|
||||
|
||||
logger->debug("{} -> Result: {}", function_name, fmt::ptr(interface));
|
||||
LOG_DEBUG("{} -> '{}' @ {}", function_name, interface_version, interface)
|
||||
|
||||
steam_functions::hook_virtuals(interface, interface_version);
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#include <koalabox/koalabox.hpp>
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
#include <koalabox/types.hpp>
|
||||
|
||||
namespace steam_client {
|
||||
using namespace koalabox;
|
||||
|
||||
void* GetGenericInterface(
|
||||
const String& function_name,
|
||||
const String& interface_version,
|
||||
const std::function<void*()>& original_function
|
||||
const Function<void*()>& original_function
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#include <steam_impl/steam_inventory.hpp>
|
||||
#include <core/config.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
namespace steam_inventory {
|
||||
|
||||
EResult GetResultStatus(
|
||||
const String& function_name,
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
const std::function<EResult()>& original_function
|
||||
const Function<EResult()>& original_function
|
||||
) {
|
||||
const auto status = original_function();
|
||||
|
||||
logger->debug("{} -> handle: {}, status: {}", function_name, resultHandle, (int) status);
|
||||
LOG_DEBUG("{} -> handle: {}, status: {}", function_name, resultHandle, (int) status)
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -20,8 +21,8 @@ namespace steam_inventory {
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t* punOutItemsArraySize,
|
||||
const std::function<bool()>& original_function,
|
||||
const std::function<bool(SteamItemDef_t*, uint32_t*)>& get_item_definition_ids
|
||||
const Function<bool()>& original_function,
|
||||
const Function<bool(SteamItemDef_t*, uint32_t*)>& get_item_definition_ids
|
||||
) {
|
||||
static std::mutex section;
|
||||
const std::lock_guard<std::mutex> guard(section);
|
||||
@@ -29,26 +30,26 @@ namespace steam_inventory {
|
||||
const auto success = original_function();
|
||||
|
||||
auto print_item = [](const String& tag, const SteamItemDetails_t& item) {
|
||||
logger->debug(
|
||||
LOG_DEBUG(
|
||||
" [{}] definitionId: {}, itemId: {}, quantity: {}, flags: {}",
|
||||
tag, item.m_iDefinition, item.m_itemId, item.m_unQuantity, item.m_unFlags
|
||||
);
|
||||
)
|
||||
};
|
||||
|
||||
if (not success) {
|
||||
logger->debug("{} -> original result is false", function_name);
|
||||
LOG_DEBUG("{} -> original result is false", function_name)
|
||||
return success;
|
||||
}
|
||||
|
||||
if (punOutItemsArraySize == nullptr) {
|
||||
logger->error("{} -> arraySize pointer is null", function_name);
|
||||
LOG_ERROR("{} -> arraySize pointer is null", function_name)
|
||||
return success;
|
||||
}
|
||||
|
||||
logger->debug(
|
||||
LOG_DEBUG(
|
||||
"{} -> handle: {}, pOutItemsArray: {}, arraySize: {}",
|
||||
function_name, resultHandle, fmt::ptr(pOutItemsArray), *punOutItemsArraySize
|
||||
);
|
||||
)
|
||||
|
||||
static uint32_t original_count = 0;
|
||||
const auto injected_count = config::instance.extra_inventory_items.size();
|
||||
@@ -56,14 +57,13 @@ namespace steam_inventory {
|
||||
// Automatically get inventory items from steam
|
||||
static Vector<SteamItemDef_t> auto_inventory_items;
|
||||
if (config::instance.auto_inject_inventory) {
|
||||
static std::once_flag flag;
|
||||
std::call_once(flag, [&]() {
|
||||
CALL_ONCE({
|
||||
uint32_t count = 0;
|
||||
if (get_item_definition_ids(nullptr, &count)) {
|
||||
auto_inventory_items.resize(count);
|
||||
get_item_definition_ids(auto_inventory_items.data(), &count);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
const auto auto_injected_count = auto_inventory_items.size();
|
||||
@@ -72,10 +72,10 @@ namespace steam_inventory {
|
||||
// If pOutItemsArray is NULL then we must set the array size.
|
||||
original_count = *punOutItemsArraySize;
|
||||
*punOutItemsArraySize += auto_injected_count + injected_count;
|
||||
logger->debug(
|
||||
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++) {
|
||||
@@ -120,7 +120,7 @@ namespace steam_inventory {
|
||||
const char* pchPropertyName,
|
||||
char* pchValueBuffer,
|
||||
const uint32_t* punValueBufferSizeOut,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto common_info = fmt::format(
|
||||
"{} -> Handle: {}, Index: {}, Name: '{}'", function_name, resultHandle, unItemIndex, pchPropertyName
|
||||
@@ -129,11 +129,11 @@ namespace steam_inventory {
|
||||
const auto success = original_function();
|
||||
|
||||
if (!success) {
|
||||
logger->warn("{}, Result is false", common_info);
|
||||
LOG_WARN("{}, Result is false", common_info)
|
||||
return false;
|
||||
}
|
||||
|
||||
logger->debug("{}, Buffer: '{}'", common_info, String(pchValueBuffer, *punValueBufferSizeOut - 1));
|
||||
LOG_DEBUG("{}, Buffer: '{}'", common_info, String(pchValueBuffer, *punValueBufferSizeOut - 1))
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -141,11 +141,11 @@ namespace steam_inventory {
|
||||
bool GetAllItems(
|
||||
const String& function_name,
|
||||
const SteamInventoryResult_t* pResultHandle,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto success = original_function();
|
||||
|
||||
logger->debug("{} -> Handle: {}", function_name, fmt::ptr(pResultHandle));
|
||||
LOG_DEBUG("{} -> Handle: {}", function_name, fmt::ptr(pResultHandle))
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -156,15 +156,15 @@ namespace steam_inventory {
|
||||
SteamInventoryResult_t* pResultHandle,
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
const uint32_t unCountInstanceIDs,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto success = original_function();
|
||||
|
||||
logger->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++) {
|
||||
logger->debug(" Index: {}, ItemId: {}", i, pInstanceIDs[i]);
|
||||
LOG_DEBUG(" Index: {}, ItemId: {}", i, pInstanceIDs[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,15 +176,15 @@ namespace steam_inventory {
|
||||
SteamInventoryResult_t resultHandle,
|
||||
void* pOutBuffer,
|
||||
uint32_t* punOutBufferSize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto success = original_function();
|
||||
|
||||
if (pOutBuffer != nullptr) {
|
||||
String buffer((char*) pOutBuffer, *punOutBufferSize);
|
||||
logger->debug("{} -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer);
|
||||
LOG_DEBUG("{} -> Handle: {}, Buffer: '{}'", function_name, resultHandle, buffer)
|
||||
} else {
|
||||
logger->debug("{} -> Handle: {}, Size: '{}'", function_name, resultHandle, *punOutBufferSize);
|
||||
LOG_DEBUG("{} -> Handle: {}, Size: '{}'", function_name, resultHandle, *punOutBufferSize)
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -194,23 +194,23 @@ namespace steam_inventory {
|
||||
const String& function_name,
|
||||
const SteamItemDef_t* pItemDefIDs,
|
||||
uint32_t* punItemDefIDsArraySize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto success = original_function();
|
||||
|
||||
if (!success) {
|
||||
logger->warn("{} -> Result is false", function_name);
|
||||
LOG_WARN("{} -> Result is false", function_name)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (punItemDefIDsArraySize) {
|
||||
logger->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];
|
||||
logger->debug(" Index: {}, ID: {}", i, def);
|
||||
LOG_DEBUG(" Index: {}, ID: {}", i, def)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,14 +221,14 @@ namespace steam_inventory {
|
||||
const String& function_name,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
CSteamID steamIDExpected,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
) {
|
||||
const auto result = original_function();
|
||||
|
||||
logger->debug(
|
||||
LOG_DEBUG(
|
||||
"{} -> handle: {}, steamID: {}, original result: {}",
|
||||
function_name, resultHandle, steamIDExpected, result
|
||||
);
|
||||
)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include <koalabox/koalabox.hpp>
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
#include <core/steam_types.hpp>
|
||||
#include <koalabox/types.hpp>
|
||||
|
||||
namespace steam_inventory {
|
||||
using namespace koalabox;
|
||||
|
||||
EResult GetResultStatus(
|
||||
const String& function_name,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
const std::function<EResult()>& original_function
|
||||
const Function<EResult()>& original_function
|
||||
);
|
||||
|
||||
bool GetResultItems(
|
||||
@@ -15,8 +14,8 @@ namespace steam_inventory {
|
||||
SteamInventoryResult_t resultHandle,
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t* punOutItemsArraySize,
|
||||
const std::function<bool()>& original_function,
|
||||
const std::function<bool(SteamItemDef_t*, uint32_t*)>& get_item_definition_ids
|
||||
const Function<bool()>& original_function,
|
||||
const Function<bool(SteamItemDef_t*, uint32_t*)>& get_item_definition_ids
|
||||
);
|
||||
|
||||
bool GetResultItemProperty(
|
||||
@@ -26,13 +25,13 @@ namespace steam_inventory {
|
||||
const char* pchPropertyName,
|
||||
char* pchValueBuffer,
|
||||
const uint32_t* punValueBufferSizeOut,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
bool GetAllItems(
|
||||
const String& function_name,
|
||||
const SteamInventoryResult_t* pResultHandle,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
bool GetItemsByID(
|
||||
@@ -40,7 +39,7 @@ namespace steam_inventory {
|
||||
SteamInventoryResult_t* pResultHandle,
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
uint32_t unCountInstanceIDs,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
bool SerializeResult(
|
||||
@@ -48,14 +47,14 @@ namespace steam_inventory {
|
||||
SteamInventoryResult_t resultHandle,
|
||||
void* pOutBuffer,
|
||||
uint32_t* punOutBufferSize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
bool GetItemDefinitionIDs(
|
||||
const String& function_name,
|
||||
const SteamItemDef_t* pItemDefIDs,
|
||||
uint32_t* punItemDefIDsArraySize,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
|
||||
|
||||
@@ -63,6 +62,6 @@ namespace steam_inventory {
|
||||
const String& function_name,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
CSteamID steamIDExpected,
|
||||
const std::function<bool()>& original_function
|
||||
const Function<bool()>& original_function
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
#include <steam_impl/steam_user.hpp>
|
||||
#include <core/config.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
namespace steam_user {
|
||||
|
||||
EUserHasLicenseForAppResult UserHasLicenseForApp(
|
||||
const String& function_name,
|
||||
AppId_t appID,
|
||||
const std::function<EUserHasLicenseForAppResult()>& original_function
|
||||
const Function<EUserHasLicenseForAppResult()>& original_function
|
||||
) {
|
||||
const auto result = original_function();
|
||||
|
||||
if (result == k_EUserHasLicenseResultNoAuth) {
|
||||
logger->warn("{} -> App ID: {}, Result: NoAuth", function_name, appID);
|
||||
LOG_WARN("{} -> App ID: {}, Result: NoAuth", function_name, appID)
|
||||
return result;
|
||||
}
|
||||
|
||||
const auto has_license = config::is_dlc_unlocked(0, appID, [&]() {
|
||||
return result == k_EUserHasLicenseResultHasLicense;
|
||||
});
|
||||
const auto has_license = config::is_dlc_unlocked(
|
||||
0, appID, [&]() {
|
||||
return result == k_EUserHasLicenseResultHasLicense;
|
||||
}
|
||||
);
|
||||
|
||||
logger->info("{} -> App ID: {}, HasLicense: {}", function_name, appID, has_license);
|
||||
LOG_INFO("{} -> App ID: {}, HasLicense: {}", function_name, appID, has_license)
|
||||
|
||||
return has_license
|
||||
? k_EUserHasLicenseResultHasLicense
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include <koalabox/koalabox.hpp>
|
||||
#include <steam_functions/steam_functions.hpp>
|
||||
#include <core/steam_types.hpp>
|
||||
#include <koalabox/types.hpp>
|
||||
|
||||
namespace steam_user {
|
||||
using namespace koalabox;
|
||||
|
||||
EUserHasLicenseForAppResult UserHasLicenseForApp(
|
||||
const String& function_name,
|
||||
AppId_t appID,
|
||||
const std::function<EUserHasLicenseForAppResult()>& original_function
|
||||
const Function<EUserHasLicenseForAppResult()>& original_function
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user