mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2026-01-24 21:42:53 -05:00
Added ISteamHTTP
This commit is contained in:
@@ -56,6 +56,9 @@ namespace {
|
||||
} else if(kb::str::eq(library_name, STEAMAPI_DLL)) {
|
||||
KB_HOOK_DETOUR_MODULE(SteamAPI_RestartAppIfNecessary, module_handle);
|
||||
KB_HOOK_DETOUR_MODULE(SteamAPI_Shutdown, module_handle);
|
||||
|
||||
// Note: It is not necessary to hook flat functions or interface accessors
|
||||
// since the underlying interfaces will be hooked through steamclient.
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
constexpr auto STEAM_APPS = "STEAMAPPS_INTERFACE_VERSION";
|
||||
constexpr auto STEAM_CLIENT = "SteamClient";
|
||||
constexpr auto STEAM_HTTP = "STEAMHTTP_INTERFACE_VERSION";
|
||||
constexpr auto STEAM_USER = "SteamUser";
|
||||
constexpr auto STEAM_INVENTORY = "STEAMINVENTORY_INTERFACE_V";
|
||||
constexpr auto STEAM_GAME_SERVER = "SteamGameServer";
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
#include "smoke_api.hpp"
|
||||
#include "smoke_api/interfaces/steam_apps.hpp"
|
||||
#include "smoke_api/interfaces/steam_inventory.hpp"
|
||||
#include "smoke_api/interfaces/steam_user.hpp"
|
||||
#include "steam_api/steam_client.hpp"
|
||||
#include "steam_api/steam_interface.hpp"
|
||||
|
||||
// ISteamApps
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsSubscribedApp(void* self, const AppId_t dlcID) {
|
||||
try {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlcID,
|
||||
MODULE_CALL_CLOSURE(SteamAPI_ISteamApps_BIsSubscribedApp, self, dlcID)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsDlcInstalled(void* self, const AppId_t dlcID) {
|
||||
try {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlcID,
|
||||
MODULE_CALL_CLOSURE(SteamAPI_ISteamApps_BIsDlcInstalled, self, dlcID)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(int) SteamAPI_ISteamApps_GetDLCCount(void* self) {
|
||||
try {
|
||||
return smoke_api::steam_apps::GetDLCCount(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
MODULE_CALL_CLOSURE(SteamAPI_ISteamApps_GetDLCCount, self)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
|
||||
void* self,
|
||||
const int iDLC,
|
||||
AppId_t* pDlcID,
|
||||
bool* pbAvailable,
|
||||
char* pchName,
|
||||
const int cchNameBufferSize
|
||||
) {
|
||||
try {
|
||||
return smoke_api::steam_apps::GetDLCDataByIndex(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
iDLC,
|
||||
pDlcID,
|
||||
pbAvailable,
|
||||
pchName,
|
||||
cchNameBufferSize,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamApps_BGetDLCDataByIndex,
|
||||
self,
|
||||
iDLC,
|
||||
pDlcID,
|
||||
pbAvailable,
|
||||
pchName,
|
||||
cchNameBufferSize
|
||||
),
|
||||
[&](const AppId_t dlc_id) {
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled(self, dlc_id);
|
||||
}
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ISteamClient
|
||||
|
||||
DLL_EXPORT(void*) SteamAPI_ISteamClient_GetISteamGenericInterface(
|
||||
void* self,
|
||||
const HSteamUser hSteamUser,
|
||||
const HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
) {
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
pchVersion,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamClient_GetISteamGenericInterface,
|
||||
self,
|
||||
hSteamUser,
|
||||
hSteamPipe,
|
||||
pchVersion
|
||||
)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// ISteamInventory
|
||||
|
||||
DLL_EXPORT(EResult) SteamAPI_ISteamInventory_GetResultStatus(
|
||||
void* self,
|
||||
const SteamInventoryResult_t resultHandle
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetResultStatus(
|
||||
__func__,
|
||||
resultHandle,
|
||||
MODULE_CALL_CLOSURE(SteamAPI_ISteamInventory_GetResultStatus, self, resultHandle)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemDefinitionIDs(
|
||||
void* self,
|
||||
SteamItemDef_t* pItemDefIDs,
|
||||
uint32_t* punItemDefIDsArraySize
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetItemDefinitionIDs(
|
||||
__func__,
|
||||
pItemDefIDs,
|
||||
punItemDefIDsArraySize,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_GetItemDefinitionIDs,
|
||||
self,
|
||||
pItemDefIDs,
|
||||
punItemDefIDsArraySize
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItems(
|
||||
void* self,
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t* punOutItemsArraySize
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetResultItems(
|
||||
__func__,
|
||||
resultHandle,
|
||||
pOutItemsArray,
|
||||
punOutItemsArraySize,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_GetResultItems,
|
||||
self,
|
||||
resultHandle,
|
||||
pOutItemsArray,
|
||||
punOutItemsArraySize
|
||||
),
|
||||
[&](SteamItemDef_t* pItemDefIDs, uint32_t* punItemDefIDsArraySize) {
|
||||
MODULE_CALL(
|
||||
SteamAPI_ISteamInventory_GetItemDefinitionIDs,
|
||||
self,
|
||||
pItemDefIDs,
|
||||
punItemDefIDsArraySize
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItemProperty(
|
||||
void* self,
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
const uint32_t unItemIndex,
|
||||
const char* pchPropertyName,
|
||||
char* pchValueBuffer,
|
||||
uint32_t* punValueBufferSizeOut
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetResultItemProperty(
|
||||
__func__,
|
||||
resultHandle,
|
||||
unItemIndex,
|
||||
pchPropertyName,
|
||||
pchValueBuffer,
|
||||
punValueBufferSizeOut,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_GetResultItemProperty,
|
||||
self,
|
||||
resultHandle,
|
||||
unItemIndex,
|
||||
pchPropertyName,
|
||||
pchValueBuffer,
|
||||
punValueBufferSizeOut
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_CheckResultSteamID(
|
||||
void* self,
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
const CSteamID steamIDExpected
|
||||
) {
|
||||
return smoke_api::steam_inventory::CheckResultSteamID(
|
||||
__func__,
|
||||
resultHandle,
|
||||
steamIDExpected,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_CheckResultSteamID,
|
||||
self,
|
||||
resultHandle,
|
||||
steamIDExpected
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetAllItems(
|
||||
void* self,
|
||||
SteamInventoryResult_t* pResultHandle
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetAllItems(
|
||||
__func__,
|
||||
pResultHandle,
|
||||
MODULE_CALL_CLOSURE(SteamAPI_ISteamInventory_GetAllItems, self, pResultHandle)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemsByID(
|
||||
void* self,
|
||||
SteamInventoryResult_t* pResultHandle,
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
const uint32_t unCountInstanceIDs
|
||||
) {
|
||||
return smoke_api::steam_inventory::GetItemsByID(
|
||||
__func__,
|
||||
pResultHandle,
|
||||
pInstanceIDs,
|
||||
unCountInstanceIDs,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_GetItemsByID,
|
||||
self,
|
||||
pResultHandle,
|
||||
pInstanceIDs,
|
||||
unCountInstanceIDs
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_SerializeResult(
|
||||
void* self,
|
||||
const SteamInventoryResult_t resultHandle,
|
||||
void* pOutBuffer,
|
||||
uint32_t* punOutBufferSize
|
||||
) {
|
||||
return smoke_api::steam_inventory::SerializeResult(
|
||||
__func__,
|
||||
resultHandle,
|
||||
pOutBuffer,
|
||||
punOutBufferSize,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamInventory_SerializeResult,
|
||||
self,
|
||||
resultHandle,
|
||||
pOutBuffer,
|
||||
punOutBufferSize
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ISteamUser
|
||||
|
||||
DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamUser_UserHasLicenseForApp(
|
||||
void* self,
|
||||
const CSteamID steamID,
|
||||
const AppId_t dlcID
|
||||
) {
|
||||
try {
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlcID,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamUser_UserHasLicenseForApp,
|
||||
self,
|
||||
steamID,
|
||||
dlcID
|
||||
)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
}
|
||||
|
||||
// ISteamGameServer
|
||||
|
||||
DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamGameServer_UserHasLicenseForApp(
|
||||
void* self,
|
||||
const CSteamID steamID,
|
||||
const AppId_t dlcID
|
||||
) {
|
||||
try {
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlcID,
|
||||
MODULE_CALL_CLOSURE(
|
||||
SteamAPI_ISteamGameServer_UserHasLicenseForApp,
|
||||
self,
|
||||
steamID,
|
||||
dlcID
|
||||
)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "smoke_api.hpp"
|
||||
#include "smoke_api/types.hpp"
|
||||
#include "steam_api/steam_client.hpp"
|
||||
|
||||
DLL_EXPORT(void*) SteamInternal_FindOrCreateUserInterface(
|
||||
const HSteamUser hSteamUser,
|
||||
const char* version
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamInternal_FindOrCreateUserInterface, hSteamUser, version)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamInternal_CreateInterface(const char* version) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamInternal_CreateInterface, version)
|
||||
);
|
||||
}
|
||||
@@ -22,10 +22,14 @@ namespace {
|
||||
|
||||
if(not version_map.contains(version_prefix)) {
|
||||
try {
|
||||
const std::string rdata = kb::win::get_pe_section_data_or_throw(
|
||||
const auto section = kb::win::get_pe_section_or_throw(
|
||||
smoke_api::steamapi_module,
|
||||
".rdata"
|
||||
);
|
||||
const auto rdata = std::string(
|
||||
reinterpret_cast<const char*>(section.start_address),
|
||||
section.size
|
||||
);
|
||||
|
||||
const std::regex regex(version_prefix + "\\d{3}");
|
||||
if(std::smatch match; std::regex_search(rdata, match, regex)) {
|
||||
@@ -50,15 +54,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamClient() {
|
||||
static auto version = get_versioned_interface(STEAM_CLIENT, "006");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamClient)
|
||||
);
|
||||
}
|
||||
// TODO: Do we really need to proxy them?
|
||||
|
||||
DLL_EXPORT(void*) SteamApps() {
|
||||
static auto version = get_versioned_interface(STEAM_APPS, "002");
|
||||
@@ -70,13 +66,23 @@ DLL_EXPORT(void*) SteamApps() {
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamUser() {
|
||||
static auto version = get_versioned_interface(STEAM_USER, "012");
|
||||
DLL_EXPORT(void*) SteamClient() {
|
||||
static auto version = get_versioned_interface(STEAM_CLIENT, "006");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamUser)
|
||||
MODULE_CALL_CLOSURE(SteamClient)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamHTTP() {
|
||||
static auto version = get_versioned_interface(STEAM_HTTP, "003");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamHTTP)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,3 +95,13 @@ DLL_EXPORT(void*) SteamInventory() {
|
||||
MODULE_CALL_CLOSURE(SteamInventory)
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamUser() {
|
||||
static auto version = get_versioned_interface(STEAM_USER, "012");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
MODULE_CALL_CLOSURE(SteamUser)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,18 @@ namespace steam_client {
|
||||
const std::string& function_name,
|
||||
const std::string& interface_version,
|
||||
const std::function<void*()>& original_function
|
||||
) {
|
||||
auto* const interface = original_function();
|
||||
) noexcept {
|
||||
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);
|
||||
steam_interface::hook_virtuals(interface, interface_version);
|
||||
|
||||
return interface;
|
||||
return interface;
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: '{}' @ {}", function_name, interface_version, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ namespace steam_client {
|
||||
const std::string& function_name,
|
||||
const std::string& interface_version,
|
||||
const std::function<void*()>& original_function
|
||||
);
|
||||
) noexcept;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace {
|
||||
|
||||
std::map<std::string, interface_data> get_virtual_hook_map() {
|
||||
#define ENTRY(INTERFACE, FUNC) \
|
||||
{ \
|
||||
#FUNC, { \
|
||||
#INTERFACE "_" #FUNC, reinterpret_cast<uintptr_t>(INTERFACE##_##FUNC) \
|
||||
} \
|
||||
}
|
||||
{ \
|
||||
#FUNC, { \
|
||||
#INTERFACE "_" #FUNC, reinterpret_cast<uintptr_t>(INTERFACE##_##FUNC) \
|
||||
} \
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
@@ -56,6 +56,17 @@ namespace {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
STEAM_HTTP,
|
||||
interface_data{
|
||||
.fallback_version = "STEAMHTTP_INTERFACE_VERSION003",
|
||||
.entry_map = {
|
||||
ENTRY(ISteamHTTP, GetHTTPResponseBodyData),
|
||||
ENTRY(ISteamHTTP, GetHTTPStreamingResponseBodyData),
|
||||
ENTRY(ISteamHTTP, SetHTTPRequestRawPostBody),
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
STEAM_USER,
|
||||
interface_data{
|
||||
@@ -129,7 +140,11 @@ namespace steam_interface {
|
||||
static std::set<void*> processed_interfaces;
|
||||
|
||||
if(processed_interfaces.contains(interface)) {
|
||||
LOG_DEBUG("Interface {} at {} has already been processed.", version_string, interface);
|
||||
LOG_DEBUG(
|
||||
"Interface '{}' at {} has already been processed.",
|
||||
version_string,
|
||||
interface
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,45 +4,30 @@
|
||||
#include "steam_api/steam_interface.hpp"
|
||||
#include "steam_api/virtuals/steam_api_virtuals.hpp"
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(const AppId_t dlc_id)) {
|
||||
try {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_BIsSubscribedApp, ARGS(dlc_id))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(const AppId_t dlc_id)) noexcept {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_BIsSubscribedApp, ARGS(dlc_id))
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(const AppId_t dlc_id)) {
|
||||
try {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_BIsDlcInstalled, ARGS(dlc_id))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(const AppId_t dlc_id)) noexcept {
|
||||
return smoke_api::steam_apps::IsDlcUnlocked(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_BIsDlcInstalled, ARGS(dlc_id))
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) {
|
||||
try {
|
||||
return smoke_api::steam_apps::GetDLCCount(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_GetDLCCount, ARGS())
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return 0;
|
||||
}
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) noexcept {
|
||||
return smoke_api::steam_apps::GetDLCCount(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
HOOKED_CALL_CLOSURE(ISteamApps_GetDLCCount, ARGS())
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(
|
||||
@@ -53,26 +38,22 @@ VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(
|
||||
char* pchName,
|
||||
const int cchNameBufferSize
|
||||
)
|
||||
) {
|
||||
try {
|
||||
return smoke_api::steam_apps::GetDLCDataByIndex(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
iDLC,
|
||||
p_dlc_id,
|
||||
pbAvailable,
|
||||
pchName,
|
||||
cchNameBufferSize,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamApps_BGetDLCDataByIndex,
|
||||
ARGS(iDLC, p_dlc_id, pbAvailable, pchName, cchNameBufferSize)
|
||||
),
|
||||
[&](const AppId_t dlc_id) {
|
||||
return ISteamApps_BIsDlcInstalled(ARGS(dlc_id));
|
||||
}
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return false;
|
||||
}
|
||||
) noexcept {
|
||||
return smoke_api::steam_apps::GetDLCDataByIndex(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
iDLC,
|
||||
p_dlc_id,
|
||||
pbAvailable,
|
||||
pchName,
|
||||
cchNameBufferSize,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamApps_BGetDLCDataByIndex,
|
||||
ARGS(iDLC, p_dlc_id, pbAvailable, pchName, cchNameBufferSize)
|
||||
),
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamApps_BIsSubscribedApp,
|
||||
ARGS(*p_dlc_id)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,17 +9,12 @@ VIRTUAL(void*) ISteamClient_GetISteamApps(
|
||||
const HSteamPipe hSteamPipe,
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
HOOKED_CALL_CLOSURE(ISteamClient_GetISteamApps, ARGS(hSteamUser, hSteamPipe, version))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
) noexcept {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
HOOKED_CALL_CLOSURE(ISteamClient_GetISteamApps, ARGS(hSteamUser, hSteamPipe, version))
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamUser(
|
||||
@@ -28,17 +23,12 @@ VIRTUAL(void*) ISteamClient_GetISteamUser(
|
||||
const HSteamPipe hSteamPipe,
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
HOOKED_CALL_CLOSURE(ISteamClient_GetISteamUser, ARGS(hSteamUser, hSteamPipe, version))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
) noexcept {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
version,
|
||||
HOOKED_CALL_CLOSURE(ISteamClient_GetISteamUser, ARGS(hSteamUser, hSteamPipe, version))
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
@@ -47,20 +37,15 @@ VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
pchVersion,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamClient_GetISteamGenericInterface,
|
||||
ARGS(hSteamUser, hSteamPipe, pchVersion)
|
||||
)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
) noexcept {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
pchVersion,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamClient_GetISteamGenericInterface,
|
||||
ARGS(hSteamUser, hSteamPipe, pchVersion)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
@@ -69,18 +54,13 @@ VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
const HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
try {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
pchVersion,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamClient_GetISteamInventory,
|
||||
ARGS(hSteamUser, hSteamPipe, pchVersion)
|
||||
)
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
) noexcept {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__,
|
||||
pchVersion,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamClient_GetISteamInventory,
|
||||
ARGS(hSteamUser, hSteamPipe, pchVersion)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,16 +6,11 @@
|
||||
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamGameServer_UserHasLicenseForApp(
|
||||
PARAMS(const CSteamID steamID, const AppId_t dlc_id)
|
||||
) {
|
||||
try {
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamGameServer_UserHasLicenseForApp, ARGS(steamID, dlc_id))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
) noexcept {
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamGameServer_UserHasLicenseForApp, ARGS(steamID, dlc_id))
|
||||
);
|
||||
}
|
||||
|
||||
66
src/steam_api/virtuals/isteamhttp.cpp
Normal file
66
src/steam_api/virtuals/isteamhttp.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
#include "smoke_api/interfaces/steam_http.hpp"
|
||||
#include "steam_api/steam_interface.hpp"
|
||||
#include "steam_api/virtuals/steam_api_virtuals.hpp"
|
||||
|
||||
VIRTUAL(bool) ISteamHTTP_GetHTTPResponseBodyData(
|
||||
PARAMS(
|
||||
const HTTPRequestHandle hRequest,
|
||||
const uint8_t* pBodyDataBuffer,
|
||||
const uint32_t unBufferSize
|
||||
)
|
||||
) noexcept {
|
||||
return smoke_api::steam_http::GetHTTPResponseBodyData(
|
||||
__func__,
|
||||
hRequest,
|
||||
pBodyDataBuffer,
|
||||
unBufferSize,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamHTTP_GetHTTPResponseBodyData,
|
||||
ARGS(hRequest, pBodyDataBuffer, unBufferSize)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamHTTP_GetHTTPStreamingResponseBodyData(
|
||||
PARAMS(
|
||||
const HTTPRequestHandle hRequest,
|
||||
const uint32_t cOffset,
|
||||
const uint8_t* pBodyDataBuffer,
|
||||
const uint32_t unBufferSize
|
||||
)
|
||||
) noexcept {
|
||||
return smoke_api::steam_http::GetHTTPStreamingResponseBodyData(
|
||||
__func__,
|
||||
hRequest,
|
||||
cOffset,
|
||||
pBodyDataBuffer,
|
||||
unBufferSize,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamHTTP_GetHTTPStreamingResponseBodyData,
|
||||
ARGS(hRequest, cOffset, pBodyDataBuffer, unBufferSize)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamHTTP_SetHTTPRequestRawPostBody(
|
||||
PARAMS(
|
||||
const HTTPRequestHandle hRequest,
|
||||
const char* pchContentType,
|
||||
const uint8_t* pubBody,
|
||||
const uint32_t unBodyLen
|
||||
)
|
||||
) noexcept {
|
||||
return smoke_api::steam_http::SetHTTPRequestRawPostBody(
|
||||
__func__,
|
||||
hRequest,
|
||||
pchContentType,
|
||||
pubBody,
|
||||
unBodyLen,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamHTTP_SetHTTPRequestRawPostBody,
|
||||
ARGS(hRequest, pchContentType, pubBody, unBodyLen)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
VIRTUAL(EResult) ISteamInventory_GetResultStatus(
|
||||
PARAMS(const SteamInventoryResult_t resultHandle)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::GetResultStatus(
|
||||
__func__,
|
||||
resultHandle,
|
||||
@@ -17,7 +17,7 @@ VIRTUAL(bool) ISteamInventory_GetResultItems(
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t* punOutItemsArraySize
|
||||
)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::GetResultItems(
|
||||
__func__,
|
||||
resultHandle,
|
||||
@@ -44,7 +44,7 @@ VIRTUAL(bool) ISteamInventory_GetResultItemProperty(
|
||||
char* pchValueBuffer,
|
||||
uint32_t* punValueBufferSizeOut
|
||||
)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::GetResultItemProperty(
|
||||
__func__,
|
||||
resultHandle,
|
||||
@@ -65,7 +65,7 @@ VIRTUAL(bool) ISteamInventory_GetResultItemProperty(
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t* pResultHandle)) {
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t* pResultHandle)) noexcept {
|
||||
return smoke_api::steam_inventory::GetAllItems(
|
||||
__func__,
|
||||
pResultHandle,
|
||||
@@ -79,7 +79,7 @@ VIRTUAL(bool) ISteamInventory_GetItemsByID(
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
const uint32_t unCountInstanceIDs
|
||||
)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::GetItemsByID(
|
||||
__func__,
|
||||
pResultHandle,
|
||||
@@ -98,7 +98,7 @@ VIRTUAL(bool) ISteamInventory_SerializeResult(
|
||||
void* pOutBuffer,
|
||||
uint32_t* punOutBufferSize
|
||||
)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::SerializeResult(
|
||||
__func__,
|
||||
resultHandle,
|
||||
@@ -116,7 +116,7 @@ VIRTUAL(bool) ISteamInventory_GetItemDefinitionIDs(
|
||||
SteamItemDef_t*pItemDefIDs,
|
||||
uint32_t* punItemDefIDsArraySize
|
||||
)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::GetItemDefinitionIDs(
|
||||
__func__,
|
||||
pItemDefIDs,
|
||||
@@ -130,14 +130,11 @@ VIRTUAL(bool) ISteamInventory_GetItemDefinitionIDs(
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_CheckResultSteamID(
|
||||
PARAMS(const SteamInventoryResult_t resultHandle, CSteamID steamIDExpected)
|
||||
) {
|
||||
) noexcept {
|
||||
return smoke_api::steam_inventory::CheckResultSteamID(
|
||||
__func__,
|
||||
resultHandle,
|
||||
steamIDExpected,
|
||||
HOOKED_CALL_CLOSURE(
|
||||
ISteamInventory_CheckResultSteamID,
|
||||
ARGS(resultHandle, steamIDExpected)
|
||||
)
|
||||
HOOKED_CALL_CLOSURE(ISteamInventory_CheckResultSteamID, ARGS(resultHandle, steamIDExpected))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,17 +6,11 @@
|
||||
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(
|
||||
PARAMS(const CSteamID steamID, const AppId_t dlc_id)
|
||||
) {
|
||||
try {
|
||||
static const auto app_id = steam_interface::get_app_id();
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
app_id,
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamUser_UserHasLicenseForApp, ARGS(steamID, dlc_id))
|
||||
);
|
||||
} catch(const std::exception& e) {
|
||||
LOG_ERROR("{} -> Error: {}", __func__, e.what());
|
||||
return k_EUserHasLicenseResultDoesNotHaveLicense;
|
||||
}
|
||||
) noexcept {
|
||||
return smoke_api::steam_user::UserHasLicenseForApp(
|
||||
__func__,
|
||||
steam_interface::get_app_id(),
|
||||
dlc_id,
|
||||
HOOKED_CALL_CLOSURE(ISteamUser_UserHasLicenseForApp, ARGS(steamID, dlc_id))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,38 +3,60 @@
|
||||
#include "smoke_api/types.hpp"
|
||||
|
||||
// ISteamApps
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t));
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t));
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS());
|
||||
VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(PARAMS(int, AppId_t*, bool*, char*, int));
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t)) noexcept;
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t)) noexcept;
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) noexcept;
|
||||
VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(PARAMS(int, AppId_t*, bool*, char*, int)) noexcept;
|
||||
|
||||
// ISteamClient
|
||||
VIRTUAL(void*) ISteamClient_GetISteamApps(PARAMS(HSteamUser, HSteamPipe, const char*));
|
||||
VIRTUAL(void*) ISteamClient_GetISteamUser(PARAMS(HSteamUser, HSteamPipe, const char*));
|
||||
VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(PARAMS(HSteamUser, HSteamPipe, const char*));
|
||||
VIRTUAL(void*) ISteamClient_GetISteamInventory(PARAMS(HSteamUser, HSteamPipe, const char*));
|
||||
VIRTUAL(void*) ISteamClient_GetISteamApps(PARAMS(HSteamUser, HSteamPipe, const char*)) noexcept;
|
||||
VIRTUAL(void*) ISteamClient_GetISteamUser(PARAMS(HSteamUser, HSteamPipe, const char*)) noexcept;
|
||||
VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
PARAMS(HSteamUser, HSteamPipe, const char*)
|
||||
|
||||
) noexcept;
|
||||
VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
PARAMS(HSteamUser, HSteamPipe, const char*)
|
||||
|
||||
) noexcept;
|
||||
|
||||
// ISteamHTTP
|
||||
VIRTUAL(bool) ISteamHTTP_GetHTTPResponseBodyData(
|
||||
PARAMS(HTTPRequestHandle, const uint8_t*, uint32_t)
|
||||
) noexcept;
|
||||
VIRTUAL(bool) ISteamHTTP_GetHTTPStreamingResponseBodyData(
|
||||
PARAMS(HTTPRequestHandle, uint32_t, const uint8_t*, uint32_t)
|
||||
) noexcept;
|
||||
VIRTUAL(bool) ISteamHTTP_SetHTTPRequestRawPostBody(
|
||||
PARAMS(HTTPRequestHandle, const char*, const uint8_t*, uint32_t)
|
||||
) noexcept;
|
||||
|
||||
// ISteamInventory
|
||||
VIRTUAL(EResult) ISteamInventory_GetResultStatus(PARAMS(SteamInventoryResult_t));
|
||||
VIRTUAL(EResult) ISteamInventory_GetResultStatus(PARAMS(SteamInventoryResult_t)) noexcept;
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItems(
|
||||
PARAMS(SteamInventoryResult_t, SteamItemDetails_t*, uint32_t*) // @formatter:off
|
||||
); // @formatter:on
|
||||
) noexcept; // @formatter:on
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItemProperty(
|
||||
PARAMS(SteamInventoryResult_t, uint32_t, const char*, char*, uint32_t*) // @formatter:off
|
||||
); // @formatter:on
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t*));
|
||||
) noexcept; // @formatter:on
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t*)) noexcept;
|
||||
VIRTUAL(bool) ISteamInventory_GetItemsByID(
|
||||
PARAMS(SteamInventoryResult_t*, const SteamItemInstanceID_t*, uint32_t)
|
||||
);
|
||||
VIRTUAL(bool) ISteamInventory_SerializeResult(PARAMS(SteamInventoryResult_t, void*, uint32_t*));
|
||||
VIRTUAL(bool) ISteamInventory_GetItemDefinitionIDs(PARAMS(SteamItemDef_t*, uint32_t*));
|
||||
VIRTUAL(bool) ISteamInventory_CheckResultSteamID(PARAMS(SteamInventoryResult_t, CSteamID));
|
||||
) noexcept;
|
||||
VIRTUAL(bool) ISteamInventory_SerializeResult(
|
||||
PARAMS(SteamInventoryResult_t, void*, uint32_t*)
|
||||
|
||||
) noexcept;
|
||||
VIRTUAL(bool) ISteamInventory_GetItemDefinitionIDs(PARAMS(SteamItemDef_t*, uint32_t*)) noexcept;
|
||||
VIRTUAL(bool) ISteamInventory_CheckResultSteamID(PARAMS(SteamInventoryResult_t, CSteamID)) noexcept;
|
||||
|
||||
// ISteamUser
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(PARAMS(CSteamID, AppId_t));
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(
|
||||
PARAMS(CSteamID, AppId_t)
|
||||
) noexcept;
|
||||
|
||||
// ISteamGameServer
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamGameServer_UserHasLicenseForApp(
|
||||
PARAMS(CSteamID, AppId_t)
|
||||
);
|
||||
) noexcept;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "smoke_api/steamclient/steamclient.hpp"
|
||||
#include "smoke_api.hpp"
|
||||
#include "../smoke_api.hpp"
|
||||
#include "smoke_api/types.hpp"
|
||||
|
||||
#include "steam_api/steam_client.hpp"
|
||||
#include "../steam_api/steam_client.hpp"
|
||||
|
||||
/**
|
||||
* SmokeAPI implementation
|
||||
Reference in New Issue
Block a user