Compare commits

..

3 Commits

Author SHA1 Message Date
Mr_Goldberg 05e6c103f8
Fix compile error. 2020-01-31 15:47:56 -05:00
Mr_Goldberg 6ccb8f6c0b
ISteamApps 002-007 implemented. 2020-01-31 14:32:28 -05:00
Mr_Goldberg 9deef8c6f3
Add a depots.txt to configure values returned by the getinstalleddepots function. 2020-01-31 14:31:29 -05:00
15 changed files with 412 additions and 25 deletions

View File

@ -41,6 +41,10 @@ If the DLC file is present, the emulator will only unlock the DLCs in that file.
The contents of this file are: appid=DLC name
See the steam_settings.EXAMPLE folder for an example.
Depots:
This is pretty rare but some games might use depot ids to see if dlcs are installed. You can provide a list of installed depots to the game with a steam_settings\depots.txt file.
See the steam_settings.EXAMPLE folder for an example.
App paths:
Some rare games might need to be provided one or more paths to app ids. For example the path to where a dlc is installed. This sets the paths returned by the Steam_Apps::GetAppInstallDir function.
See steam_settings.EXAMPLE\app_paths.EXAMPLE.txt for an example.

View File

@ -106,6 +106,9 @@ public:
bool hasDLC(AppId_t appID);
bool getDLC(unsigned int index, AppId_t &appID, bool &available, std::string &name);
//Depots
std::vector<DepotId_t> depots;
//App Install paths
void setAppInstallPath(AppId_t appID, std::string path);
std::string getAppInstallPath(AppId_t appID);

View File

@ -458,6 +458,27 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
}
}
{
std::string depots_config_path = Local_Storage::get_game_settings_path() + "depots.txt";
std::ifstream input( depots_config_path );
if (input.is_open()) {
for( std::string line; getline( input, line ); ) {
if (!line.empty() && line[line.length()-1] == '\n') {
line.pop_back();
}
if (!line.empty() && line[line.length()-1] == '\r') {
line.pop_back();
}
DepotId_t depot_id = stoul(line);
settings_client->depots.push_back(depot_id);
settings_server->depots.push_back(depot_id);
PRINT_DEBUG("Added depot %u\n", depot_id);
}
}
}
{
std::string mod_path = Local_Storage::get_game_settings_path() + "mods";
std::vector<std::string> paths = Local_Storage::get_filenames_path(mod_path);

View File

@ -181,33 +181,20 @@ bool Steam_Apps::MarkContentCorrupt( bool bMissingFilesOnly )
// return installed depots in mount order
uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots )
{
PRINT_DEBUG("GetInstalledDepots %u\n", appID);
PRINT_DEBUG("GetInstalledDepots %u, %u\n", appID, cMaxDepots);
//TODO not sure about the behavior of this function, I didn't actually test this.
if (!pvecDepots) return 0;
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (appID == settings->get_local_game_id().AppID()) {
unsigned int count = settings->DLCCount();
unsigned int count = settings->depots.size();
if (cMaxDepots < count) count = cMaxDepots;
for (int i = 0; i < count; ++i) {
AppId_t appid;
bool available;
std::string name;
if (settings->getDLC(i, appid, available, name)) {
pvecDepots[i] = appid;
}
}
std::copy(settings->depots.begin(), settings->depots.begin() + count, pvecDepots);
return count;
} else {
if (cMaxDepots) {
*pvecDepots = appID;
return 1;
}
}
return 0;
uint32 Steam_Apps::GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots )
{
PRINT_DEBUG("GetInstalledDepots old\n");
return GetInstalledDepots( settings->get_local_game_id().AppID(), pvecDepots, cMaxDepots );
}
// returns current app install folder for AppID, returns folder name length

View File

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

View File

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

View File

@ -0,0 +1,6 @@
228986
228990
814381
814382
814383
1039230

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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/<appid>//?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

View File

@ -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/<appid>//?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

View File

@ -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"