From 6ccb8f6c0b77d1d5517ebda1f6744051b7b4eacb Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Fri, 31 Jan 2020 14:32:28 -0500 Subject: [PATCH] ISteamApps 002-007 implemented. --- dll/steam_apps.cpp | 4 ++ dll/steam_apps.h | 10 ++++- dll/steam_client.cpp | 24 +++++++++++- sdk_includes/isteamapps001.h | 28 ++++++++++++++ sdk_includes/isteamapps002.h | 22 +++++++++++ sdk_includes/isteamapps003.h | 25 +++++++++++++ sdk_includes/isteamapps004.h | 48 ++++++++++++++++++++++++ sdk_includes/isteamapps005.h | 63 +++++++++++++++++++++++++++++++ sdk_includes/isteamapps006.h | 71 +++++++++++++++++++++++++++++++++++ sdk_includes/isteamapps007.h | 72 ++++++++++++++++++++++++++++++++++++ sdk_includes/steam_api.h | 7 ++++ 11 files changed, 372 insertions(+), 2 deletions(-) create mode 100644 sdk_includes/isteamapps001.h create mode 100644 sdk_includes/isteamapps002.h create mode 100644 sdk_includes/isteamapps003.h create mode 100644 sdk_includes/isteamapps004.h create mode 100644 sdk_includes/isteamapps005.h create mode 100644 sdk_includes/isteamapps006.h create mode 100644 sdk_includes/isteamapps007.h diff --git a/dll/steam_apps.cpp b/dll/steam_apps.cpp index 7f7dbd5..86271c9 100644 --- a/dll/steam_apps.cpp +++ b/dll/steam_apps.cpp @@ -191,6 +191,10 @@ uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uin return count; } +uint32 Steam_Apps::GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ) +{ + PRINT_DEBUG("GetInstalledDepots old %u\n", appID); + return GetInstalledDepots( settings->get_local_game_id().AppID(), pvecDepots, cMaxDepots ); } // returns current app install folder for AppID, returns folder name length diff --git a/dll/steam_apps.h b/dll/steam_apps.h index a7ae666..a5ff248 100644 --- a/dll/steam_apps.h +++ b/dll/steam_apps.h @@ -1,6 +1,13 @@ #include "base.h" -class Steam_Apps : public ISteamApps +class Steam_Apps : +public ISteamApps002, +public ISteamApps003, +public ISteamApps004, +public ISteamApps005, +public ISteamApps006, +public ISteamApps007, +public ISteamApps { Settings *settings; class SteamCallResults *callback_results; @@ -49,6 +56,7 @@ public: bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ); // returns current beta branch name, 'public' is the default branch bool MarkContentCorrupt( bool bMissingFilesOnly ); // signal Steam that game files seems corrupt or missing uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ); // return installed depots in mount order + uint32 GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ); // returns current app install folder for AppID, returns folder name length uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ); diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index d80e348..12b57e8 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -617,8 +617,30 @@ ISteamApps *Steam_Client::GetISteamApps( HSteamUser hSteamUser, HSteamPipe hStea { PRINT_DEBUG("GetISteamApps %s\n", pchVersion); if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL; + + Steam_Apps *steam_apps_temp; + if (hSteamUser == SERVER_HSTEAMUSER) { - return steam_gameserver_apps; + steam_apps_temp = steam_gameserver_apps; + } else { + steam_apps_temp = steam_apps; + } + if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION002") == 0) { + return (ISteamApps *)(void *)(ISteamApps002 *)steam_apps_temp; + } else if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION003") == 0) { + return (ISteamApps *)(void *)(ISteamApps003 *)steam_apps_temp; + } else if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION004") == 0) { + return (ISteamApps *)(void *)(ISteamApps004 *)steam_apps_temp; + } else if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION005") == 0) { + return (ISteamApps *)(void *)(ISteamApps005 *)steam_apps_temp; + } else if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION006") == 0) { + return (ISteamApps *)(void *)(ISteamApps006 *)steam_apps_temp; + } else if (strcmp(pchVersion, "STEAMAPPS_INTERFACE_VERSION007") == 0) { + return (ISteamApps *)(void *)(ISteamApps007 *)steam_apps_temp; + } else if (strcmp(pchVersion, STEAMAPPS_INTERFACE_VERSION) == 0) { + return (ISteamApps *)(void *)(ISteamApps *)steam_apps_temp; + } else { + return (ISteamApps *)(void *)(ISteamApps *)steam_apps_temp; } return steam_apps; diff --git a/sdk_includes/isteamapps001.h b/sdk_includes/isteamapps001.h new file mode 100644 index 0000000..dbe64cc --- /dev/null +++ b/sdk_includes/isteamapps001.h @@ -0,0 +1,28 @@ + +#ifndef ISTEAMAPPS001_H +#define ISTEAMAPPS001_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps001 +{ +public: + // returns 0 if the key does not exist + // this may be true on first call, since the app data may not be cached locally yet + // If you expect it to exists wait for the AppDataChanged_t after the first failure and ask again + virtual int GetAppData( AppId_t nAppID, const char *pchKey, char *pchValue, int cchValueMax ) = 0; +}; + +//----------------------------------------------------------------------------- +// Purpose: called when new information about an app has arrived +//----------------------------------------------------------------------------- +struct AppDataChanged_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 1 }; + uint32 m_nAppID; // appid that changed + bool m_bBySteamUI; // change came from SteamUI + bool m_bCDDBUpdate; // the cddb entry for this app changed +}; + +#endif //ISTEAMAPPS001_H diff --git a/sdk_includes/isteamapps002.h b/sdk_includes/isteamapps002.h new file mode 100644 index 0000000..40084a5 --- /dev/null +++ b/sdk_includes/isteamapps002.h @@ -0,0 +1,22 @@ + +#ifndef ISTEAMAPPS002_H +#define ISTEAMAPPS002_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps002 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; +}; + +#endif //ISTEAMAPPS002_H diff --git a/sdk_includes/isteamapps003.h b/sdk_includes/isteamapps003.h new file mode 100644 index 0000000..d6cf6c4 --- /dev/null +++ b/sdk_includes/isteamapps003.h @@ -0,0 +1,25 @@ + +#ifndef ISTEAMAPPS003_H +#define ISTEAMAPPS003_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps003 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; +}; + +#endif //ISTEAMAPPS003_H diff --git a/sdk_includes/isteamapps004.h b/sdk_includes/isteamapps004.h new file mode 100644 index 0000000..6e55002 --- /dev/null +++ b/sdk_includes/isteamapps004.h @@ -0,0 +1,48 @@ + +#ifndef ISTEAMAPPS004_H +#define ISTEAMAPPS004_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps004 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; + + // returns the Unix time of the purchase of the app + virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; + + // Checks if the user is subscribed to the current app through a free weekend + // This function will return false for users who have a retail or other type of license + // Before using, please ask your Valve technical contact how to package and secure your free weekened + virtual bool BIsSubscribedFromFreeWeekend() = 0; + + // Returns the number of DLC pieces for the running app + virtual int GetDLCCount() = 0; + + // Returns metadata for DLC by index, of range [0, GetDLCCount()] + virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; + + // Install/Uninstall control for optional DLC + virtual void InstallDLC( AppId_t nAppID ) = 0; + virtual void UninstallDLC( AppId_t nAppID ) = 0; + +#ifdef _PS3 + // Result returned in a RegisterActivationCodeResponse_t callresult + virtual SteamAPICall_t RegisterActivationCode( const char *pchActivationCode ) = 0; +#endif +}; + +#endif //ISTEAMAPPS004_H diff --git a/sdk_includes/isteamapps005.h b/sdk_includes/isteamapps005.h new file mode 100644 index 0000000..6b318b2 --- /dev/null +++ b/sdk_includes/isteamapps005.h @@ -0,0 +1,63 @@ + +#ifndef ISTEAMAPPS005_H +#define ISTEAMAPPS005_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps005 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; + + // returns the Unix time of the purchase of the app + virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; + + // Checks if the user is subscribed to the current app through a free weekend + // This function will return false for users who have a retail or other type of license + // Before using, please ask your Valve technical contact how to package and secure your free weekened + virtual bool BIsSubscribedFromFreeWeekend() = 0; + + // Returns the number of DLC pieces for the running app + virtual int GetDLCCount() = 0; + + // Returns metadata for DLC by index, of range [0, GetDLCCount()] + virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; + + // Install/Uninstall control for optional DLC + virtual void InstallDLC( AppId_t nAppID ) = 0; + virtual void UninstallDLC( AppId_t nAppID ) = 0; + + // Request cd-key for yourself or owned DLC. If you are interested in this + // data then make sure you provide us with a list of valid keys to be distributed + // to users when they purchase the game, before the game ships. + // You'll receive an AppProofOfPurchaseKeyResponse_t callback when + // the key is available (which may be immediately). + virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0; + + virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch + virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing + virtual uint32 GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + + // returns current app install folder for AppID, returns folder name length + virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; + +#ifdef _PS3 + // Result returned in a RegisterActivationCodeResponse_t callresult + virtual SteamAPICall_t RegisterActivationCode( const char *pchActivationCode ) = 0; +#endif +}; + +#endif //ISTEAMAPPS005_H diff --git a/sdk_includes/isteamapps006.h b/sdk_includes/isteamapps006.h new file mode 100644 index 0000000..1e2d273 --- /dev/null +++ b/sdk_includes/isteamapps006.h @@ -0,0 +1,71 @@ + +#ifndef ISTEAMAPPS006_H +#define ISTEAMAPPS006_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps006 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; + + // returns the Unix time of the purchase of the app + virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; + + // Checks if the user is subscribed to the current app through a free weekend + // This function will return false for users who have a retail or other type of license + // Before using, please ask your Valve technical contact how to package and secure your free weekened + virtual bool BIsSubscribedFromFreeWeekend() = 0; + + // Returns the number of DLC pieces for the running app + virtual int GetDLCCount() = 0; + + // Returns metadata for DLC by index, of range [0, GetDLCCount()] + virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; + + // Install/Uninstall control for optional DLC + virtual void InstallDLC( AppId_t nAppID ) = 0; + virtual void UninstallDLC( AppId_t nAppID ) = 0; + + // Request cd-key for yourself or owned DLC. If you are interested in this + // data then make sure you provide us with a list of valid keys to be distributed + // to users when they purchase the game, before the game ships. + // You'll receive an AppProofOfPurchaseKeyResponse_t callback when + // the key is available (which may be immediately). + virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0; + + virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch + virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing + virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + + // returns current app install folder for AppID, returns folder name length + virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned) + + virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed + + // Returns the associated launch param if the game is run via steam://run///?param1=value1;param2=value2;param3=value3 etc. + // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string. + // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, + // but it is advised that you not param names beginning with an underscore for your own features. + virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0; + +#ifdef _PS3 + // Result returned in a RegisterActivationCodeResponse_t callresult + virtual SteamAPICall_t RegisterActivationCode( const char *pchActivationCode ) = 0; +#endif +}; + +#endif //ISTEAMAPPS006_H diff --git a/sdk_includes/isteamapps007.h b/sdk_includes/isteamapps007.h new file mode 100644 index 0000000..6028e1f --- /dev/null +++ b/sdk_includes/isteamapps007.h @@ -0,0 +1,72 @@ + +#ifndef ISTEAMAPPS007_H +#define ISTEAMAPPS007_H +#ifdef STEAM_WIN32 +#pragma once +#endif + +class ISteamApps007 +{ +public: + virtual bool BIsSubscribed() = 0; + virtual bool BIsLowViolence() = 0; + virtual bool BIsCybercafe() = 0; + virtual bool BIsVACBanned() = 0; + virtual const char *GetCurrentGameLanguage() = 0; + virtual const char *GetAvailableGameLanguages() = 0; + + // only use this member if you need to check ownership of another game related to yours, a demo for example + virtual bool BIsSubscribedApp( AppId_t appID ) = 0; + + // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed + virtual bool BIsDlcInstalled( AppId_t appID ) = 0; + + // returns the Unix time of the purchase of the app + virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; + + // Checks if the user is subscribed to the current app through a free weekend + // This function will return false for users who have a retail or other type of license + // Before using, please ask your Valve technical contact how to package and secure your free weekened + virtual bool BIsSubscribedFromFreeWeekend() = 0; + + // Returns the number of DLC pieces for the running app + virtual int GetDLCCount() = 0; + + // Returns metadata for DLC by index, of range [0, GetDLCCount()] + virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; + + // Install/Uninstall control for optional DLC + virtual void InstallDLC( AppId_t nAppID ) = 0; + virtual void UninstallDLC( AppId_t nAppID ) = 0; + + // Request cd-key for yourself or owned DLC. If you are interested in this + // data then make sure you provide us with a list of valid keys to be distributed + // to users when they purchase the game, before the game ships. + // You'll receive an AppProofOfPurchaseKeyResponse_t callback when + // the key is available (which may be immediately). + virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0; + + virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch + virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing + virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + + // returns current app install folder for AppID, returns folder name length + virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned) + + virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed + + // Returns the associated launch param if the game is run via steam://run///?param1=value1;param2=value2;param3=value3 etc. + // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string. + // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, + // but it is advised that you not param names beginning with an underscore for your own features. + virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0; + + // get download progress for optional DLC + virtual bool GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0; + + // return the buildid of this app, may change at any time based on backend updates to the game + virtual int GetAppBuildId() = 0; +}; + +#endif //ISTEAMAPPS007_H diff --git a/sdk_includes/steam_api.h b/sdk_includes/steam_api.h index 5e195d7..cb8cf38 100644 --- a/sdk_includes/steam_api.h +++ b/sdk_includes/steam_api.h @@ -83,6 +83,13 @@ #include "isteamuserstats004.h" #include "isteamuserstats003.h" #include "isteamapps.h" +#include "isteamapps007.h" +#include "isteamapps006.h" +#include "isteamapps005.h" +#include "isteamapps004.h" +#include "isteamapps003.h" +#include "isteamapps002.h" +#include "isteamapps001.h" #include "isteamnetworking.h" #include "isteamnetworking005.h" #include "isteamnetworking004.h"