mirror of https://github.com/acidicoala/SmokeAPI
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
228 lines
7.2 KiB
C++
228 lines
7.2 KiB
C++
1 year ago
|
#include <steam_impl/steam_apps.hpp>
|
||
|
#include <steam_impl/steam_client.hpp>
|
||
|
#include <steam_impl/steam_inventory.hpp>
|
||
|
#include <steam_impl/steam_user.hpp>
|
||
1 year ago
|
#include <steam_impl/steam_impl.hpp>
|
||
1 year ago
|
#include <koalabox/logger.hpp>
|
||
2 years ago
|
|
||
|
// ISteamApps
|
||
|
|
||
1 year ago
|
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsSubscribedApp(void* self, AppId_t dlcID) {
|
||
1 year ago
|
return steam_apps::IsDlcUnlocked(
|
||
1 year ago
|
__func__, 0, dlcID, [&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsSubscribedApp)
|
||
1 year ago
|
|
||
1 year ago
|
return SteamAPI_ISteamApps_BIsSubscribedApp_o(self, dlcID);
|
||
1 year ago
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
1 year ago
|
DLL_EXPORT(bool) SteamAPI_ISteamApps_BIsDlcInstalled(void* self, AppId_t dlcID) {
|
||
1 year ago
|
return steam_apps::IsDlcUnlocked(
|
||
1 year ago
|
__func__, 0, dlcID, [&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BIsDlcInstalled)
|
||
1 year ago
|
|
||
1 year ago
|
return SteamAPI_ISteamApps_BIsDlcInstalled_o(self, dlcID);
|
||
1 year ago
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
1 year ago
|
DLL_EXPORT(int) SteamAPI_ISteamApps_GetDLCCount(void* self) {
|
||
1 year ago
|
return steam_apps::GetDLCCount(
|
||
|
__func__, 0, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_GetDLCCount)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamApps_GetDLCCount_o(self);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamApps_BGetDLCDataByIndex(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
int iDLC,
|
||
1 year ago
|
AppId_t* pDlcID,
|
||
2 years ago
|
bool* pbAvailable,
|
||
|
char* pchName,
|
||
|
int cchNameBufferSize
|
||
|
) {
|
||
1 year ago
|
return steam_apps::GetDLCDataByIndex(
|
||
1 year ago
|
__func__, 0, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize,
|
||
|
[&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamApps_BGetDLCDataByIndex)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamApps_BGetDLCDataByIndex_o(
|
||
1 year ago
|
self, iDLC, pDlcID, pbAvailable, pchName, cchNameBufferSize
|
||
1 year ago
|
);
|
||
1 year ago
|
},
|
||
|
[&](AppId_t dlc_id) {
|
||
|
return SteamAPI_ISteamApps_BIsDlcInstalled(self, dlc_id);
|
||
1 year ago
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
// ISteamClient
|
||
|
|
||
|
DLL_EXPORT(void*) SteamAPI_ISteamClient_GetISteamGenericInterface(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
HSteamUser hSteamUser,
|
||
|
HSteamPipe hSteamPipe,
|
||
|
const char* pchVersion
|
||
|
) {
|
||
1 year ago
|
return steam_client::GetGenericInterface(
|
||
|
__func__, pchVersion, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamClient_GetISteamGenericInterface)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamClient_GetISteamGenericInterface_o(self, hSteamUser, hSteamPipe, pchVersion);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
// ISteamInventory
|
||
|
|
||
|
DLL_EXPORT(EResult) SteamAPI_ISteamInventory_GetResultStatus(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t resultHandle
|
||
|
) {
|
||
1 year ago
|
return steam_inventory::GetResultStatus(
|
||
|
__func__, resultHandle, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultStatus)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamInventory_GetResultStatus_o(self, resultHandle);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
1 year ago
|
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);
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
2 years ago
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItems(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t resultHandle,
|
||
|
SteamItemDetails_t* pOutItemsArray,
|
||
|
uint32_t* punOutItemsArraySize
|
||
|
) {
|
||
|
return steam_inventory::GetResultItems(
|
||
|
__func__, resultHandle, pOutItemsArray, punOutItemsArraySize,
|
||
|
[&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultItems)
|
||
2 years ago
|
|
||
|
return SteamAPI_ISteamInventory_GetResultItems_o(self, resultHandle, pOutItemsArray, punOutItemsArraySize);
|
||
|
},
|
||
|
[&](SteamItemDef_t* pItemDefIDs, uint32_t* punItemDefIDsArraySize) {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetItemDefinitionIDs)
|
||
2 years ago
|
|
||
|
return SteamAPI_ISteamInventory_GetItemDefinitionIDs_o(self, pItemDefIDs, punItemDefIDsArraySize);
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetResultItemProperty(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t resultHandle,
|
||
|
uint32_t unItemIndex,
|
||
|
const char* pchPropertyName,
|
||
|
char* pchValueBuffer,
|
||
2 years ago
|
uint32_t* punValueBufferSizeOut
|
||
2 years ago
|
) {
|
||
|
return steam_inventory::GetResultItemProperty(
|
||
|
__func__, resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut, [&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetResultItemProperty)
|
||
2 years ago
|
|
||
|
return SteamAPI_ISteamInventory_GetResultItemProperty_o(
|
||
|
self, resultHandle, unItemIndex, pchPropertyName, pchValueBuffer, punValueBufferSizeOut
|
||
|
);
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_CheckResultSteamID(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t resultHandle,
|
||
|
CSteamID steamIDExpected
|
||
|
) {
|
||
1 year ago
|
return steam_inventory::CheckResultSteamID(
|
||
|
__func__, resultHandle, steamIDExpected, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_CheckResultSteamID)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamInventory_CheckResultSteamID_o(self, resultHandle, steamIDExpected);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetAllItems(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t* pResultHandle
|
||
|
) {
|
||
1 year ago
|
return steam_inventory::GetAllItems(
|
||
|
__func__, pResultHandle, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetAllItems)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamInventory_GetAllItems_o(self, pResultHandle);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_GetItemsByID(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t* pResultHandle,
|
||
|
const SteamItemInstanceID_t* pInstanceIDs,
|
||
|
uint32_t unCountInstanceIDs
|
||
|
) {
|
||
1 year ago
|
return steam_inventory::GetItemsByID(
|
||
|
__func__, pResultHandle, pInstanceIDs, unCountInstanceIDs, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_GetItemsByID)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamInventory_GetItemsByID_o(self, pResultHandle, pInstanceIDs, unCountInstanceIDs);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
|
DLL_EXPORT(bool) SteamAPI_ISteamInventory_SerializeResult(
|
||
1 year ago
|
void* self,
|
||
2 years ago
|
SteamInventoryResult_t resultHandle,
|
||
|
void* pOutBuffer,
|
||
|
uint32_t* punOutBufferSize
|
||
|
) {
|
||
1 year ago
|
return steam_inventory::SerializeResult(
|
||
|
__func__, resultHandle, pOutBuffer, punOutBufferSize, [&]() {
|
||
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamInventory_SerializeResult)
|
||
2 years ago
|
|
||
1 year ago
|
return SteamAPI_ISteamInventory_SerializeResult_o(self, resultHandle, pOutBuffer, punOutBufferSize);
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
|
|
||
1 year ago
|
// ISteamUser
|
||
|
|
||
|
DLL_EXPORT(EUserHasLicenseForAppResult) SteamAPI_ISteamUser_UserHasLicenseForApp(
|
||
|
void* self,
|
||
|
CSteamID steamID,
|
||
|
AppId_t dlcID
|
||
|
) {
|
||
1 year ago
|
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())
|
||
|
}
|
||
|
|
||
1 year ago
|
return steam_user::UserHasLicenseForApp(
|
||
1 year ago
|
__func__, app_id, dlcID, [&]() {
|
||
1 year ago
|
GET_ORIGINAL_FUNCTION_STEAMAPI(SteamAPI_ISteamUser_UserHasLicenseForApp)
|
||
|
|
||
|
return SteamAPI_ISteamUser_UserHasLicenseForApp_o(self, steamID, dlcID);
|
||
|
}
|
||
|
);
|
||
|
}
|