Fixed critical bugs

This commit is contained in:
acidicoala
2023-02-01 01:26:05 +03:00
parent 95ceac3d47
commit 73a05f1d91
10 changed files with 254 additions and 172 deletions

View File

@@ -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));
}
);
}