mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2025-12-05 21:15:39 -05:00
Fixed critical bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
project(SmokeAPI VERSION 2.0.0)
|
||||
project(SmokeAPI VERSION 2.0.2)
|
||||
|
||||
include(KoalaBox/cmake/KoalaBox.cmake)
|
||||
|
||||
|
||||
@@ -8,33 +8,51 @@
|
||||
// ISteamApps
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsSubscribedApp(void* self, AppId_t dlcID) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsSubscribedApp)
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsSubscribedApp)
|
||||
|
||||
return SteamAPI_ISteamApps_BIsSubscribedApp_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
return SteamAPI_ISteamApps_BIsSubscribedApp_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsDlcInstalled(void* self, AppId_t dlcID) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsDlcInstalled)
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsDlcInstalled)
|
||||
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(int) SteamAPI_ISteamApps_GetDLCCount(void* self) {
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, 0, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_GetDLCCount)
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, app_id, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_GetDLCCount)
|
||||
|
||||
return SteamAPI_ISteamApps_GetDLCCount_o(self);
|
||||
}
|
||||
);
|
||||
return SteamAPI_ISteamApps_GetDLCCount_o(self);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
|
||||
@@ -45,19 +63,24 @@ DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
|
||||
char* pchName,
|
||||
int cchNameBufferSize
|
||||
) {
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, 0, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BGetDLCDataByIndex)
|
||||
|
||||
return SteamAPI_ISteamApps_BGetDLCDataByIndex_o(
|
||||
self, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled(self, dlc_id);
|
||||
}
|
||||
);
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, app_id, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BGetDLCDataByIndex)
|
||||
return SteamAPI_ISteamApps_BGetDLCDataByIndex_o(
|
||||
self, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled(self, dlc_id);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ISteamClient
|
||||
@@ -68,13 +91,17 @@ DLL_EXPORT(void*) SteamAPI_ISteamClient_GetISteamGenericInterface(
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamClient_GetISteamGenericInterface)
|
||||
|
||||
return SteamAPI_ISteamClient_GetISteamGenericInterface_o(self, hSteamUser, hSteamPipe, pchVersion);
|
||||
}
|
||||
);
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamClient_GetISteamGenericInterface)
|
||||
return SteamAPI_ISteamClient_GetISteamGenericInterface_o(self, hSteamUser, hSteamPipe, pchVersion);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// ISteamInventory
|
||||
@@ -210,18 +237,18 @@ DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamUser_UserHasLicenseForApp
|
||||
CSteamID steamID,
|
||||
AppId_t dlcID
|
||||
) {
|
||||
AppId_t app_id;
|
||||
try {
|
||||
app_id = steam_impl::get_app_id_or_throw();
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return SteamAPI_ISteamUser_UserHasLicenseForApp_o(self, steamID, dlcID);
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error getting app id: {}", __func__, e.what())
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return SteamAPI_ISteamUser_UserHasLicenseForApp_o(self, steamID, dlcID);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,56 +1,81 @@
|
||||
#include <game_mode/virtuals/steam_api_virtuals.hpp>
|
||||
#include <koalabox/util.hpp>
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
#include <steam_impl/steam_impl.hpp>
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t appID)) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, appID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(ISteamApps_BIsSubscribedApp)
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t dlc_id)) {
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_BIsSubscribedApp)
|
||||
return ISteamApps_BIsSubscribedApp_o(ARGS(dlc_id));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
|
||||
return ISteamApps_BIsSubscribedApp_o(ARGS(appID));
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t appID)) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, appID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(ISteamApps_BIsDlcInstalled)
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t dlc_id)) {
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_BIsDlcInstalled)
|
||||
return ISteamApps_BIsDlcInstalled_o(ARGS(dlc_id));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
|
||||
return ISteamApps_BIsDlcInstalled_o(ARGS(appID));
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_GetDLCCount)
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, app_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_GetDLCCount)
|
||||
return ISteamApps_GetDLCCount_o(ARGS());
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, 0, [&]() {
|
||||
return ISteamApps_GetDLCCount_o(ARGS());
|
||||
}
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(
|
||||
PARAMS(
|
||||
int iDLC,
|
||||
AppId_t* pAppID,
|
||||
AppId_t* p_dlc_id,
|
||||
bool* pbAvailable,
|
||||
char* pchName,
|
||||
int cchNameBufferSize
|
||||
)
|
||||
) {
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, 0, iDLC, pAppID, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_BGetDLCDataByIndex)
|
||||
|
||||
return ISteamApps_BGetDLCDataByIndex_o(
|
||||
ARGS(iDLC, pAppID, pbAvailable, pchName, cchNameBufferSize)
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
return ISteamApps_BIsDlcInstalled(ARGS(dlc_id));
|
||||
}
|
||||
);
|
||||
try {
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, app_id, iDLC, p_dlc_id, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_BGetDLCDataByIndex)
|
||||
return ISteamApps_BGetDLCDataByIndex_o(
|
||||
ARGS(iDLC, p_dlc_id, pbAvailable, pchName, cchNameBufferSize)
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
return ISteamApps_BIsDlcInstalled(ARGS(dlc_id));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,17 @@ VIRTUAL(void*) ISteamClient_GetISteamApps(
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamApps)
|
||||
|
||||
return ISteamClient_GetISteamApps_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamApps)
|
||||
return ISteamClient_GetISteamApps_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamUser(
|
||||
@@ -24,13 +28,18 @@ VIRTUAL(void*) ISteamClient_GetISteamUser(
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamUser)
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamUser)
|
||||
|
||||
return ISteamClient_GetISteamUser_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
return ISteamClient_GetISteamUser_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
@@ -40,13 +49,18 @@ VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamGenericInterface)
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamGenericInterface)
|
||||
|
||||
return ISteamClient_GetISteamGenericInterface_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
return ISteamClient_GetISteamGenericInterface_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
@@ -56,11 +70,16 @@ VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamInventory)
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamInventory)
|
||||
|
||||
return ISteamClient_GetISteamInventory_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
return ISteamClient_GetISteamInventory_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,18 @@
|
||||
#include <steam_impl/steam_impl.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(PARAMS(CSteamID steamID, AppId_t dlcID)) {
|
||||
AppId_t app_id = 0;
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(PARAMS(CSteamID steamID, AppId_t dlc_id)) {
|
||||
try {
|
||||
app_id = steam_impl::get_app_id_or_throw();
|
||||
static const auto app_id = steam_impl::get_app_id_or_throw();
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return ISteamUser_UserHasLicenseForApp_o(ARGS(steamID, dlc_id));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error getting app id: {}", __func__, e.what())
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return ISteamUser_UserHasLicenseForApp_o(ARGS(steamID, dlcID));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,20 +25,13 @@ namespace steam_apps {
|
||||
* @return boolean indicating if the function was able to successfully fetch DLC IDs from all sources.
|
||||
*/
|
||||
void fetch_and_cache_dlcs(AppId_t app_id) {
|
||||
static std::mutex mutex;
|
||||
const std::lock_guard<std::mutex> guard(mutex);
|
||||
static Mutex mutex;
|
||||
const MutexLockGuard guard(mutex);
|
||||
|
||||
if (not app_id) {
|
||||
// No app id means we are operating in game mode.
|
||||
// Hence, we need to use utility functions to get app id.
|
||||
try {
|
||||
app_id = steam_impl::get_app_id_or_throw();
|
||||
LOG_INFO("Detected App ID: {}", app_id)
|
||||
} catch (const Exception& ex) {
|
||||
LOG_ERROR("Failed to get app ID: {}", ex.what())
|
||||
app_dlcs[app_id] = {}; // Dummy value to avoid checking for presence on each access
|
||||
return;
|
||||
}
|
||||
if (app_id == 0) {
|
||||
LOG_ERROR("{} -> App ID is 0", __func__)
|
||||
app_dlcs[app_id] = {}; // Dummy value to avoid checking for presence on each access
|
||||
return;
|
||||
}
|
||||
|
||||
// We want to fetch data only once. However, if any of the remote sources have failed
|
||||
@@ -75,7 +68,6 @@ namespace steam_apps {
|
||||
}
|
||||
|
||||
// Cache DLCs in memory and cache for future use
|
||||
|
||||
app_dlcs[app_id] = aggregated_dlcs;
|
||||
|
||||
smoke_api::app_cache::save_dlcs(app_id, aggregated_dlcs);
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace steam_apps {
|
||||
);
|
||||
|
||||
bool GetDLCDataByIndex(
|
||||
const String& dlc_id,
|
||||
AppId_t dlc_ids,
|
||||
const String& function_name,
|
||||
AppId_t app_id,
|
||||
int iDLC,
|
||||
AppId_t* pDlcId,
|
||||
bool* pbAvailable,
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
|
||||
VIRTUAL(bool) IClientAppManager_IsAppDlcInstalled(PARAMS(AppId_t app_id, AppId_t dlc_id)) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientAppManager_IsAppDlcInstalled)
|
||||
try {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientAppManager_IsAppDlcInstalled)
|
||||
|
||||
return IClientAppManager_IsAppDlcInstalled_o(ARGS(app_id, dlc_id));
|
||||
}
|
||||
);
|
||||
return IClientAppManager_IsAppDlcInstalled_o(ARGS(app_id, dlc_id));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
|
||||
VIRTUAL(int) IClientApps_GetDLCCount(PARAMS(AppId_t appId)) {
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, appId, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientApps_GetDLCCount)
|
||||
try {
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, appId, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientApps_GetDLCCount)
|
||||
|
||||
return IClientApps_GetDLCCount_o(ARGS(appId));
|
||||
}
|
||||
);
|
||||
return IClientApps_GetDLCCount_o(ARGS(appId));
|
||||
}
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
VIRTUAL(bool) IClientApps_BGetDLCDataByIndex(
|
||||
@@ -21,24 +26,29 @@ VIRTUAL(bool) IClientApps_BGetDLCDataByIndex(
|
||||
int cchNameBufferSize
|
||||
)
|
||||
) {
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, appID, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientApps_BGetDLCDataByIndex)
|
||||
try {
|
||||
return steam_apps::GetDLCDataByIndex(
|
||||
__func__, appID, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientApps_BGetDLCDataByIndex)
|
||||
|
||||
return IClientApps_BGetDLCDataByIndex_o(
|
||||
ARGS(appID, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize)
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
const auto* app_manager_interface = store::steamclient::interface_name_to_address_map["IClientAppManager"];
|
||||
if (app_manager_interface) {
|
||||
IClientAppManager_IsAppDlcInstalled(app_manager_interface, EDX, appID, dlc_id);
|
||||
return true;
|
||||
return IClientApps_BGetDLCDataByIndex_o(
|
||||
ARGS(appID, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize)
|
||||
);
|
||||
},
|
||||
[&](AppId_t dlc_id) {
|
||||
const auto* app_manager_interface = store::steamclient::interface_name_to_address_map["IClientAppManager"];
|
||||
if (app_manager_interface) {
|
||||
IClientAppManager_IsAppDlcInstalled(app_manager_interface, EDX, appID, dlc_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Would never happen in practice, as the interfaces would be instantiated almost simultaneously
|
||||
return false;
|
||||
}
|
||||
|
||||
// Would never happen in practice, as the interfaces would be instantiated almost simultaneously
|
||||
return false;
|
||||
}
|
||||
);
|
||||
);
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
|
||||
VIRTUAL(bool) IClientUser_BIsSubscribedApp(PARAMS(AppId_t dlc_id)) {
|
||||
const auto* utils_interface = store::steamclient::interface_name_to_address_map["IClientUtils"];
|
||||
try {
|
||||
const auto* utils_interface = store::steamclient::interface_name_to_address_map["IClientUtils"];
|
||||
|
||||
const auto app_id = utils_interface ? IClientUtils_GetAppID(utils_interface, EDX) : 0;
|
||||
const auto app_id = utils_interface ? IClientUtils_GetAppID(utils_interface, EDX) : 0;
|
||||
|
||||
return steam_apps::IsDlcUnlocked(__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientUser_BIsSubscribedApp)
|
||||
return steam_apps::IsDlcUnlocked(__func__, app_id, dlc_id, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(IClientUser_BIsSubscribedApp)
|
||||
|
||||
return IClientUser_BIsSubscribedApp_o(ARGS(dlc_id));
|
||||
});
|
||||
return IClientUser_BIsSubscribedApp_o(ARGS(dlc_id));
|
||||
});
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user