// This file is provided under The MIT License as part of Steamworks.NET. // Copyright (c) 2013-2019 Riley Labrecque // Please see the included LICENSE.txt for additional information. // This file is automatically generated. // Changes to this file will be reverted when you update Steamworks.NET #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH #define DISABLESTEAMWORKS #endif #if !DISABLESTEAMWORKS using System.Runtime.InteropServices; using IntPtr = System.IntPtr; namespace Steamworks { public static class SteamGameServerApps { public static bool BIsSubscribed() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsSubscribed(CSteamGameServerAPIContext.GetSteamApps()); } public static bool BIsLowViolence() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsLowViolence(CSteamGameServerAPIContext.GetSteamApps()); } public static bool BIsCybercafe() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsCybercafe(CSteamGameServerAPIContext.GetSteamApps()); } public static bool BIsVACBanned() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsVACBanned(CSteamGameServerAPIContext.GetSteamApps()); } public static string GetCurrentGameLanguage() { InteropHelp.TestIfAvailableGameServer(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetCurrentGameLanguage(CSteamGameServerAPIContext.GetSteamApps())); } public static string GetAvailableGameLanguages() { InteropHelp.TestIfAvailableGameServer(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetAvailableGameLanguages(CSteamGameServerAPIContext.GetSteamApps())); } /// /// only use this member if you need to check ownership of another game related to yours, a demo for example /// public static bool BIsSubscribedApp(AppId_t appID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsSubscribedApp(CSteamGameServerAPIContext.GetSteamApps(), appID); } /// /// Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed /// public static bool BIsDlcInstalled(AppId_t appID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsDlcInstalled(CSteamGameServerAPIContext.GetSteamApps(), appID); } /// /// returns the Unix time of the purchase of the app /// public static uint GetEarliestPurchaseUnixTime(AppId_t nAppID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_GetEarliestPurchaseUnixTime(CSteamGameServerAPIContext.GetSteamApps(), nAppID); } /// /// 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 /// public static bool BIsSubscribedFromFreeWeekend() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsSubscribedFromFreeWeekend(CSteamGameServerAPIContext.GetSteamApps()); } /// /// Returns the number of DLC pieces for the running app /// public static int GetDLCCount() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_GetDLCCount(CSteamGameServerAPIContext.GetSteamApps()); } /// /// Returns metadata for DLC by index, of range [0, GetDLCCount()] /// public static bool BGetDLCDataByIndex(int iDLC, out AppId_t pAppID, out bool pbAvailable, out string pchName, int cchNameBufferSize) { InteropHelp.TestIfAvailableGameServer(); IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize); bool ret = NativeMethods.ISteamApps_BGetDLCDataByIndex(CSteamGameServerAPIContext.GetSteamApps(), iDLC, out pAppID, out pbAvailable, pchName2, cchNameBufferSize); pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null; Marshal.FreeHGlobal(pchName2); return ret; } /// /// Install/Uninstall control for optional DLC /// public static void InstallDLC(AppId_t nAppID) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamApps_InstallDLC(CSteamGameServerAPIContext.GetSteamApps(), nAppID); } public static void UninstallDLC(AppId_t nAppID) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamApps_UninstallDLC(CSteamGameServerAPIContext.GetSteamApps(), nAppID); } /// /// Request legacy 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). /// public static void RequestAppProofOfPurchaseKey(AppId_t nAppID) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamApps_RequestAppProofOfPurchaseKey(CSteamGameServerAPIContext.GetSteamApps(), nAppID); } /// /// returns current beta branch name, 'public' is the default branch /// public static bool GetCurrentBetaName(out string pchName, int cchNameBufferSize) { InteropHelp.TestIfAvailableGameServer(); IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize); bool ret = NativeMethods.ISteamApps_GetCurrentBetaName(CSteamGameServerAPIContext.GetSteamApps(), pchName2, cchNameBufferSize); pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null; Marshal.FreeHGlobal(pchName2); return ret; } /// /// signal Steam that game files seems corrupt or missing /// public static bool MarkContentCorrupt(bool bMissingFilesOnly) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_MarkContentCorrupt(CSteamGameServerAPIContext.GetSteamApps(), bMissingFilesOnly); } /// /// return installed depots in mount order /// public static uint GetInstalledDepots(AppId_t appID, DepotId_t[] pvecDepots, uint cMaxDepots) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_GetInstalledDepots(CSteamGameServerAPIContext.GetSteamApps(), appID, pvecDepots, cMaxDepots); } /// /// returns current app install folder for AppID, returns folder name length /// public static uint GetAppInstallDir(AppId_t appID, out string pchFolder, uint cchFolderBufferSize) { InteropHelp.TestIfAvailableGameServer(); IntPtr pchFolder2 = Marshal.AllocHGlobal((int)cchFolderBufferSize); uint ret = NativeMethods.ISteamApps_GetAppInstallDir(CSteamGameServerAPIContext.GetSteamApps(), appID, pchFolder2, cchFolderBufferSize); pchFolder = ret != 0 ? InteropHelp.PtrToStringUTF8(pchFolder2) : null; Marshal.FreeHGlobal(pchFolder2); return ret; } /// /// returns true if that app is installed (not necessarily owned) /// public static bool BIsAppInstalled(AppId_t appID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsAppInstalled(CSteamGameServerAPIContext.GetSteamApps(), appID); } /// /// returns the SteamID of the original owner. If this CSteamID is different from ISteamUser::GetSteamID(), /// the user has a temporary license borrowed via Family Sharing /// public static CSteamID GetAppOwner() { InteropHelp.TestIfAvailableGameServer(); return (CSteamID)NativeMethods.ISteamApps_GetAppOwner(CSteamGameServerAPIContext.GetSteamApps()); } /// /// 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. /// Check for new launch parameters on callback NewUrlLaunchParameters_t /// public static string GetLaunchQueryParam(string pchKey) { InteropHelp.TestIfAvailableGameServer(); using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetLaunchQueryParam(CSteamGameServerAPIContext.GetSteamApps(), pchKey2)); } } /// /// get download progress for optional DLC /// public static bool GetDlcDownloadProgress(AppId_t nAppID, out ulong punBytesDownloaded, out ulong punBytesTotal) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_GetDlcDownloadProgress(CSteamGameServerAPIContext.GetSteamApps(), nAppID, out punBytesDownloaded, out punBytesTotal); } /// /// return the buildid of this app, may change at any time based on backend updates to the game /// public static int GetAppBuildId() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_GetAppBuildId(CSteamGameServerAPIContext.GetSteamApps()); } /// /// Request all proof of purchase keys for the calling appid and asociated DLC. /// A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with /// appropriate appid values, ending with a final callback where the m_nAppId /// member is k_uAppIdInvalid (zero). /// public static void RequestAllProofOfPurchaseKeys() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamApps_RequestAllProofOfPurchaseKeys(CSteamGameServerAPIContext.GetSteamApps()); } public static SteamAPICall_t GetFileDetails(string pszFileName) { InteropHelp.TestIfAvailableGameServer(); using (var pszFileName2 = new InteropHelp.UTF8StringHandle(pszFileName)) { return (SteamAPICall_t)NativeMethods.ISteamApps_GetFileDetails(CSteamGameServerAPIContext.GetSteamApps(), pszFileName2); } } /// /// Get command line if game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/. /// This method of passing a connect string (used when joining via rich presence, accepting an /// invite, etc) is preferable to passing the connect string on the operating system command /// line, which is a security risk. In order for rich presence joins to go through this /// path and not be placed on the OS command line, you must set a value in your app's /// configuration on Steam. Ask Valve for help with this. /// If game was already running and launched again, the NewUrlLaunchParameters_t will be fired. /// public static int GetLaunchCommandLine(out string pszCommandLine, int cubCommandLine) { InteropHelp.TestIfAvailableGameServer(); IntPtr pszCommandLine2 = Marshal.AllocHGlobal(cubCommandLine); int ret = NativeMethods.ISteamApps_GetLaunchCommandLine(CSteamGameServerAPIContext.GetSteamApps(), pszCommandLine2, cubCommandLine); pszCommandLine = ret != -1 ? InteropHelp.PtrToStringUTF8(pszCommandLine2) : null; Marshal.FreeHGlobal(pszCommandLine2); return ret; } /// /// Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID /// public static bool BIsSubscribedFromFamilySharing() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamApps_BIsSubscribedFromFamilySharing(CSteamGameServerAPIContext.GetSteamApps()); } } } #endif // !DISABLESTEAMWORKS