mirror of
https://github.com/acidicoala/SmokeAPI.git
synced 2026-01-27 15:02:51 -05:00
Renamed koalageddon mode to store mode
This commit is contained in:
227
src/game_mode/exports/steam_api_flat.cpp
Normal file
227
src/game_mode/exports/steam_api_flat.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
#include <steam_impl/steam_client.hpp>
|
||||
#include <steam_impl/steam_inventory.hpp>
|
||||
#include <steam_impl/steam_user.hpp>
|
||||
#include <steam_impl/steam_impl.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
|
||||
// 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)
|
||||
|
||||
return SteamAPI_ISteamApps_BIsSubscribedApp_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
return SteamAPI_ISteamApps_BIsDlcInstalled_o(self, dlcID);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(int) SteamAPI_ISteamApps_GetDLCCount(void* self) {
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, 0, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_GetDLCCount)
|
||||
|
||||
return SteamAPI_ISteamApps_GetDLCCount_o(self);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
|
||||
void* self,
|
||||
int iDLC,
|
||||
AppId_t* pDlcID,
|
||||
bool* pbAvailable,
|
||||
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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ISteamClient
|
||||
|
||||
DLL_EXPORT(void*) SteamAPI_ISteamClient_GetISteamGenericInterface(
|
||||
void* self,
|
||||
HSteamUser hSteamUser,
|
||||
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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ISteamInventory
|
||||
|
||||
DLL_EXPORT(EResult) SteamAPI_ISteamInventory_GetResultStatus(
|
||||
void* self,
|
||||
SteamInventoryResult_t resultHandle
|
||||
) {
|
||||
return steam_inventory::GetResultStatus(
|
||||
__func__, resultHandle, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultStatus)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetResultStatus_o(self, resultHandle);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemDefinitionIDs(
|
||||
void* self,
|
||||
SteamItemDef_t* pItemDefIDs,
|
||||
uint32_t* punItemDefIDsArraySize
|
||||
) {
|
||||
return steam_inventory::GetItemDefinitionIDs(
|
||||
__func__, pItemDefIDs, punItemDefIDsArraySize, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetItemDefinitionIDs)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetItemDefinitionIDs_o(self, pItemDefIDs, punItemDefIDsArraySize);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItems(
|
||||
void* self,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t* punOutItemsArraySize
|
||||
) {
|
||||
return steam_inventory::GetResultItems(
|
||||
__func__, resultHandle, pOutItemsArray, punOutItemsArraySize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultItems)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetResultItems_o(self, resultHandle, pOutItemsArray, punOutItemsArraySize);
|
||||
},
|
||||
[&](SteamItemDef_t* pItemDefIDs, uint32_t* punItemDefIDsArraySize) {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetItemDefinitionIDs)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetItemDefinitionIDs_o(self, pItemDefIDs, punItemDefIDsArraySize);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItemProperty(
|
||||
void* self,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
uint32_t unItemIndex,
|
||||
const char* pchPropertyName,
|
||||
char* pchValueBuffer,
|
||||
uint32_t* punValueBufferSizeOut
|
||||
) {
|
||||
return steam_inventory::GetResultItemProperty(
|
||||
__func__, resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultItemProperty)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetResultItemProperty_o(
|
||||
self, resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_CheckResultSteamID(
|
||||
void* self,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
CSteamID steamIDExpected
|
||||
) {
|
||||
return steam_inventory::CheckResultSteamID(
|
||||
__func__, resultHandle, steamIDExpected, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_CheckResultSteamID)
|
||||
|
||||
return SteamAPI_ISteamInventory_CheckResultSteamID_o(self, resultHandle, steamIDExpected);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetAllItems(
|
||||
void* self,
|
||||
SteamInventoryResult_t* pResultHandle
|
||||
) {
|
||||
return steam_inventory::GetAllItems(
|
||||
__func__, pResultHandle, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetAllItems)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetAllItems_o(self, pResultHandle);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemsByID(
|
||||
void* self,
|
||||
SteamInventoryResult_t* pResultHandle,
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
uint32_t unCountInstanceIDs
|
||||
) {
|
||||
return steam_inventory::GetItemsByID(
|
||||
__func__, pResultHandle, pInstanceIDs, unCountInstanceIDs, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetItemsByID)
|
||||
|
||||
return SteamAPI_ISteamInventory_GetItemsByID_o(self, pResultHandle, pInstanceIDs, unCountInstanceIDs);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(bool) SteamAPI_ISteamInventory_SerializeResult(
|
||||
void* self,
|
||||
SteamInventoryResult_t resultHandle,
|
||||
void* pOutBuffer,
|
||||
uint32_t* punOutBufferSize
|
||||
) {
|
||||
return steam_inventory::SerializeResult(
|
||||
__func__, resultHandle, pOutBuffer, punOutBufferSize, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_SerializeResult)
|
||||
|
||||
return SteamAPI_ISteamInventory_SerializeResult_o(self, resultHandle, pOutBuffer, punOutBufferSize);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ISteamUser
|
||||
|
||||
DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamUser_UserHasLicenseForApp(
|
||||
void* self,
|
||||
CSteamID steamID,
|
||||
AppId_t dlcID
|
||||
) {
|
||||
AppId_t app_id;
|
||||
try {
|
||||
app_id = steam_impl::get_app_id_or_throw();
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error getting app id: {}", __func__, e.what())
|
||||
}
|
||||
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return SteamAPI_ISteamUser_UserHasLicenseForApp_o(self, steamID, dlcID);
|
||||
}
|
||||
);
|
||||
}
|
||||
21
src/game_mode/exports/steam_api_internal.cpp
Normal file
21
src/game_mode/exports/steam_api_internal.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <steam_impl/steam_client.hpp>
|
||||
|
||||
DLL_EXPORT(void*) SteamInternal_FindOrCreateUserInterface(HSteamUser hSteamUser, const char* version) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamInternal_FindOrCreateUserInterface)
|
||||
|
||||
return SteamInternal_FindOrCreateUserInterface_o(hSteamUser, version);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamInternal_CreateInterface(const char* version) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamInternal_CreateInterface)
|
||||
|
||||
return SteamInternal_CreateInterface_o(version);
|
||||
}
|
||||
);
|
||||
}
|
||||
85
src/game_mode/exports/steam_api_unversioned.cpp
Normal file
85
src/game_mode/exports/steam_api_unversioned.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <steam_impl/steam_client.hpp>
|
||||
#include <koalabox/logger.hpp>
|
||||
#include <koalabox/win_util.hpp>
|
||||
#include <koalabox/util.hpp>
|
||||
#include <regex>
|
||||
|
||||
/**
|
||||
* Searches the `.rdata` section of the original dll for the full interface version string
|
||||
* Results are cached for performance.
|
||||
*/
|
||||
String get_versioned_interface(const String& version_prefix, const String& fallback) {
|
||||
static Map<String, String> version_map;
|
||||
|
||||
if (not version_map.contains(version_prefix)) {
|
||||
try {
|
||||
const String rdata = koalabox::win_util::get_pe_section_data_or_throw(globals::steamapi_module, ".rdata");
|
||||
|
||||
const std::regex regex(version_prefix + "\\d{3}");
|
||||
std::smatch match;
|
||||
if (std::regex_search(rdata, match, regex)) {
|
||||
version_map[version_prefix] = match[0];
|
||||
return version_map[version_prefix];
|
||||
}
|
||||
|
||||
throw koalabox::util::exception("No match found for '{}'", version_prefix);
|
||||
} catch (const Exception& ex) {
|
||||
LOG_ERROR(
|
||||
"Failed to get versioned interface: {}."
|
||||
"Falling back to version {}", ex.what(), fallback
|
||||
)
|
||||
|
||||
version_map[version_prefix] = version_prefix + fallback;
|
||||
}
|
||||
}
|
||||
|
||||
return version_map[version_prefix];
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamClient() {
|
||||
static auto version = get_versioned_interface(STEAM_CLIENT, "006");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamClient)
|
||||
|
||||
return SteamClient_o();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamApps() {
|
||||
static auto version = get_versioned_interface(STEAM_APPS, "002");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamApps)
|
||||
|
||||
return SteamApps_o();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamUser() {
|
||||
static auto version = get_versioned_interface(STEAM_USER, "012");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamUser)
|
||||
|
||||
return SteamUser_o();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
DLL_EXPORT(void*) SteamInventory() {
|
||||
static auto version = get_versioned_interface(STEAM_INVENTORY, "001");
|
||||
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamInventory)
|
||||
|
||||
return SteamInventory_o();
|
||||
}
|
||||
);
|
||||
}
|
||||
56
src/game_mode/virtuals/isteamapps.cpp
Normal file
56
src/game_mode/virtuals/isteamapps.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <game_mode/virtuals/steam_api_virtuals.hpp>
|
||||
#include <steam_impl/steam_apps.hpp>
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsSubscribedApp(PARAMS(AppId_t appID)) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, appID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(ISteamApps_BIsSubscribedApp)
|
||||
|
||||
return ISteamApps_BIsSubscribedApp_o(ARGS(appID));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BIsDlcInstalled(PARAMS(AppId_t appID)) {
|
||||
return steam_apps::IsDlcUnlocked(
|
||||
__func__, 0, appID, [&]() {
|
||||
GET_ORIGINAL_FUNCTION_STEAMAPI(ISteamApps_BIsDlcInstalled)
|
||||
|
||||
return ISteamApps_BIsDlcInstalled_o(ARGS(appID));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(int) ISteamApps_GetDLCCount(PARAMS()) {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamApps_GetDLCCount)
|
||||
|
||||
return steam_apps::GetDLCCount(
|
||||
__func__, 0, [&]() {
|
||||
return ISteamApps_GetDLCCount_o(ARGS());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamApps_BGetDLCDataByIndex(
|
||||
PARAMS(
|
||||
int iDLC,
|
||||
AppId_t* pAppID,
|
||||
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));
|
||||
}
|
||||
);
|
||||
}
|
||||
66
src/game_mode/virtuals/isteamclient.cpp
Normal file
66
src/game_mode/virtuals/isteamclient.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include <game_mode/virtuals/steam_api_virtuals.hpp>
|
||||
#include <steam_impl/steam_client.hpp>
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamApps(
|
||||
PARAMS(
|
||||
HSteamUser hSteamUser,
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamApps)
|
||||
|
||||
return ISteamClient_GetISteamApps_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamUser(
|
||||
PARAMS(
|
||||
HSteamUser hSteamUser,
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* version
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, version, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamUser)
|
||||
|
||||
return ISteamClient_GetISteamUser_o(ARGS(hSteamUser, hSteamPipe, version));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamGenericInterface(
|
||||
PARAMS(
|
||||
HSteamUser hSteamUser,
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamGenericInterface)
|
||||
|
||||
return ISteamClient_GetISteamGenericInterface_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(void*) ISteamClient_GetISteamInventory(
|
||||
PARAMS(
|
||||
HSteamUser hSteamUser,
|
||||
HSteamPipe hSteamPipe,
|
||||
const char* pchVersion
|
||||
)
|
||||
) {
|
||||
return steam_client::GetGenericInterface(
|
||||
__func__, pchVersion, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamClient_GetISteamInventory)
|
||||
|
||||
return ISteamClient_GetISteamInventory_o(ARGS(hSteamUser, hSteamPipe, pchVersion));
|
||||
}
|
||||
);
|
||||
}
|
||||
126
src/game_mode/virtuals/isteaminventory.cpp
Normal file
126
src/game_mode/virtuals/isteaminventory.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
#include <game_mode/virtuals/steam_api_virtuals.hpp>
|
||||
#include <steam_impl/steam_inventory.hpp>
|
||||
|
||||
VIRTUAL(EResult) ISteamInventory_GetResultStatus(PARAMS(SteamInventoryResult_t resultHandle)) {
|
||||
return steam_inventory::GetResultStatus(
|
||||
__func__, resultHandle, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetResultStatus)
|
||||
|
||||
return ISteamInventory_GetResultStatus_o(ARGS(resultHandle));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItems(
|
||||
PARAMS(
|
||||
SteamInventoryResult_t resultHandle,
|
||||
SteamItemDetails_t* pOutItemsArray,
|
||||
uint32_t * punOutItemsArraySize
|
||||
)
|
||||
) {
|
||||
return steam_inventory::GetResultItems(
|
||||
__func__, resultHandle, pOutItemsArray, punOutItemsArraySize,
|
||||
[&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetResultItems)
|
||||
|
||||
return ISteamInventory_GetResultItems_o(ARGS(resultHandle, pOutItemsArray, punOutItemsArraySize));
|
||||
},
|
||||
[&](SteamItemDef_t* pItemDefIDs, uint32_t* punItemDefIDsArraySize) {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetItemDefinitionIDs)
|
||||
|
||||
return ISteamInventory_GetItemDefinitionIDs_o(ARGS(pItemDefIDs, punItemDefIDsArraySize));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItemProperty(
|
||||
PARAMS(
|
||||
SteamInventoryResult_t resultHandle,
|
||||
uint32_t unItemIndex,
|
||||
const char* pchPropertyName,
|
||||
char* pchValueBuffer,
|
||||
uint32_t * punValueBufferSizeOut
|
||||
)
|
||||
) {
|
||||
return steam_inventory::GetResultItemProperty(
|
||||
__func__, resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetResultItemProperty)
|
||||
|
||||
return ISteamInventory_GetResultItemProperty_o(
|
||||
ARGS(resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_CheckResultSteamID(
|
||||
PARAMS(
|
||||
SteamInventoryResult_t resultHandle,
|
||||
CSteamID steamIDExpected
|
||||
)
|
||||
) {
|
||||
return steam_inventory::CheckResultSteamID(
|
||||
__func__, resultHandle, steamIDExpected, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_CheckResultSteamID)
|
||||
|
||||
return ISteamInventory_CheckResultSteamID_o(ARGS(resultHandle, steamIDExpected));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t* pResultHandle)) {
|
||||
return steam_inventory::GetAllItems(
|
||||
__func__, pResultHandle, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetAllItems)
|
||||
|
||||
return ISteamInventory_GetAllItems_o(ARGS(pResultHandle));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetItemsByID(
|
||||
PARAMS(
|
||||
SteamInventoryResult_t* pResultHandle,
|
||||
const SteamItemInstanceID_t* pInstanceIDs,
|
||||
uint32_t unCountInstanceIDs
|
||||
)
|
||||
) {
|
||||
return steam_inventory::GetItemsByID(
|
||||
__func__, pResultHandle, pInstanceIDs, unCountInstanceIDs, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetItemsByID)
|
||||
|
||||
return ISteamInventory_GetItemsByID_o(ARGS(pResultHandle, pInstanceIDs, unCountInstanceIDs));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_SerializeResult(
|
||||
PARAMS(
|
||||
SteamInventoryResult_t resultHandle,
|
||||
void* pOutBuffer,
|
||||
uint32_t * punOutBufferSize
|
||||
)
|
||||
) {
|
||||
return steam_inventory::SerializeResult(
|
||||
__func__, resultHandle, pOutBuffer, punOutBufferSize, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_SerializeResult)
|
||||
|
||||
return ISteamInventory_SerializeResult_o(ARGS(resultHandle, pOutBuffer, punOutBufferSize));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
VIRTUAL(bool) ISteamInventory_GetItemDefinitionIDs(
|
||||
PARAMS(
|
||||
SteamItemDef_t* pItemDefIDs,
|
||||
uint32_t * punItemDefIDsArraySize
|
||||
)
|
||||
) {
|
||||
return steam_inventory::GetItemDefinitionIDs(
|
||||
__func__, pItemDefIDs, punItemDefIDsArraySize, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamInventory_GetItemDefinitionIDs)
|
||||
|
||||
return ISteamInventory_GetItemDefinitionIDs_o(ARGS(pItemDefIDs, punItemDefIDsArraySize));
|
||||
}
|
||||
);
|
||||
}
|
||||
21
src/game_mode/virtuals/isteamuser.cpp
Normal file
21
src/game_mode/virtuals/isteamuser.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <game_mode/virtuals/steam_api_virtuals.hpp>
|
||||
#include <steam_impl/steam_user.hpp>
|
||||
#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;
|
||||
try {
|
||||
app_id = steam_impl::get_app_id_or_throw();
|
||||
} catch (const Exception& e) {
|
||||
LOG_ERROR("{} -> Error getting app id: {}", __func__, e.what())
|
||||
}
|
||||
|
||||
return steam_user::UserHasLicenseForApp(
|
||||
__func__, app_id, dlcID, [&]() {
|
||||
GET_ORIGINAL_HOOKED_FUNCTION(ISteamUser_UserHasLicenseForApp)
|
||||
|
||||
return ISteamUser_UserHasLicenseForApp_o(ARGS(steamID, dlcID));
|
||||
}
|
||||
);
|
||||
}
|
||||
31
src/game_mode/virtuals/steam_api_virtuals.hpp
Normal file
31
src/game_mode/virtuals/steam_api_virtuals.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/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));
|
||||
|
||||
// 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*));
|
||||
|
||||
|
||||
// ISteamInventory
|
||||
VIRTUAL(EResult) ISteamInventory_GetResultStatus(PARAMS(SteamInventoryResult_t));
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItems(PARAMS(SteamInventoryResult_t, SteamItemDetails_t*, uint32_t*));
|
||||
VIRTUAL(bool) ISteamInventory_GetResultItemProperty(
|
||||
PARAMS(SteamInventoryResult_t, uint32_t, const char*, char*, uint32_t*)
|
||||
);
|
||||
VIRTUAL(bool) ISteamInventory_GetAllItems(PARAMS(SteamInventoryResult_t*));
|
||||
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));
|
||||
|
||||
// ISteamUser
|
||||
VIRTUAL(EUserHasLicenseForAppResult) ISteamUser_UserHasLicenseForApp(PARAMS(CSteamID, AppId_t));
|
||||
Reference in New Issue
Block a user