isteamgameserverapps.cs (12454B)
1 // This file is provided under The MIT License as part of Steamworks.NET. 2 // Copyright (c) 2013-2019 Riley Labrecque 3 // Please see the included LICENSE.txt for additional information. 4 5 // This file is automatically generated. 6 // Changes to this file will be reverted when you update Steamworks.NET 7 8 #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH 9 #define DISABLESTEAMWORKS 10 #endif 11 12 #if !DISABLESTEAMWORKS 13 14 using System.Runtime.InteropServices; 15 using IntPtr = System.IntPtr; 16 17 namespace Steamworks { 18 public static class SteamGameServerApps { 19 public static bool BIsSubscribed() { 20 InteropHelp.TestIfAvailableGameServer(); 21 return NativeMethods.ISteamApps_BIsSubscribed(CSteamGameServerAPIContext.GetSteamApps()); 22 } 23 24 public static bool BIsLowViolence() { 25 InteropHelp.TestIfAvailableGameServer(); 26 return NativeMethods.ISteamApps_BIsLowViolence(CSteamGameServerAPIContext.GetSteamApps()); 27 } 28 29 public static bool BIsCybercafe() { 30 InteropHelp.TestIfAvailableGameServer(); 31 return NativeMethods.ISteamApps_BIsCybercafe(CSteamGameServerAPIContext.GetSteamApps()); 32 } 33 34 public static bool BIsVACBanned() { 35 InteropHelp.TestIfAvailableGameServer(); 36 return NativeMethods.ISteamApps_BIsVACBanned(CSteamGameServerAPIContext.GetSteamApps()); 37 } 38 39 public static string GetCurrentGameLanguage() { 40 InteropHelp.TestIfAvailableGameServer(); 41 return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetCurrentGameLanguage(CSteamGameServerAPIContext.GetSteamApps())); 42 } 43 44 public static string GetAvailableGameLanguages() { 45 InteropHelp.TestIfAvailableGameServer(); 46 return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetAvailableGameLanguages(CSteamGameServerAPIContext.GetSteamApps())); 47 } 48 49 /// <summary> 50 /// <para> only use this member if you need to check ownership of another game related to yours, a demo for example</para> 51 /// </summary> 52 public static bool BIsSubscribedApp(AppId_t appID) { 53 InteropHelp.TestIfAvailableGameServer(); 54 return NativeMethods.ISteamApps_BIsSubscribedApp(CSteamGameServerAPIContext.GetSteamApps(), appID); 55 } 56 57 /// <summary> 58 /// <para> Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed</para> 59 /// </summary> 60 public static bool BIsDlcInstalled(AppId_t appID) { 61 InteropHelp.TestIfAvailableGameServer(); 62 return NativeMethods.ISteamApps_BIsDlcInstalled(CSteamGameServerAPIContext.GetSteamApps(), appID); 63 } 64 65 /// <summary> 66 /// <para> returns the Unix time of the purchase of the app</para> 67 /// </summary> 68 public static uint GetEarliestPurchaseUnixTime(AppId_t nAppID) { 69 InteropHelp.TestIfAvailableGameServer(); 70 return NativeMethods.ISteamApps_GetEarliestPurchaseUnixTime(CSteamGameServerAPIContext.GetSteamApps(), nAppID); 71 } 72 73 /// <summary> 74 /// <para> Checks if the user is subscribed to the current app through a free weekend</para> 75 /// <para> This function will return false for users who have a retail or other type of license</para> 76 /// <para> Before using, please ask your Valve technical contact how to package and secure your free weekened</para> 77 /// </summary> 78 public static bool BIsSubscribedFromFreeWeekend() { 79 InteropHelp.TestIfAvailableGameServer(); 80 return NativeMethods.ISteamApps_BIsSubscribedFromFreeWeekend(CSteamGameServerAPIContext.GetSteamApps()); 81 } 82 83 /// <summary> 84 /// <para> Returns the number of DLC pieces for the running app</para> 85 /// </summary> 86 public static int GetDLCCount() { 87 InteropHelp.TestIfAvailableGameServer(); 88 return NativeMethods.ISteamApps_GetDLCCount(CSteamGameServerAPIContext.GetSteamApps()); 89 } 90 91 /// <summary> 92 /// <para> Returns metadata for DLC by index, of range [0, GetDLCCount()]</para> 93 /// </summary> 94 public static bool BGetDLCDataByIndex(int iDLC, out AppId_t pAppID, out bool pbAvailable, out string pchName, int cchNameBufferSize) { 95 InteropHelp.TestIfAvailableGameServer(); 96 IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize); 97 bool ret = NativeMethods.ISteamApps_BGetDLCDataByIndex(CSteamGameServerAPIContext.GetSteamApps(), iDLC, out pAppID, out pbAvailable, pchName2, cchNameBufferSize); 98 pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null; 99 Marshal.FreeHGlobal(pchName2); 100 return ret; 101 } 102 103 /// <summary> 104 /// <para> Install/Uninstall control for optional DLC</para> 105 /// </summary> 106 public static void InstallDLC(AppId_t nAppID) { 107 InteropHelp.TestIfAvailableGameServer(); 108 NativeMethods.ISteamApps_InstallDLC(CSteamGameServerAPIContext.GetSteamApps(), nAppID); 109 } 110 111 public static void UninstallDLC(AppId_t nAppID) { 112 InteropHelp.TestIfAvailableGameServer(); 113 NativeMethods.ISteamApps_UninstallDLC(CSteamGameServerAPIContext.GetSteamApps(), nAppID); 114 } 115 116 /// <summary> 117 /// <para> Request legacy cd-key for yourself or owned DLC. If you are interested in this</para> 118 /// <para> data then make sure you provide us with a list of valid keys to be distributed</para> 119 /// <para> to users when they purchase the game, before the game ships.</para> 120 /// <para> You'll receive an AppProofOfPurchaseKeyResponse_t callback when</para> 121 /// <para> the key is available (which may be immediately).</para> 122 /// </summary> 123 public static void RequestAppProofOfPurchaseKey(AppId_t nAppID) { 124 InteropHelp.TestIfAvailableGameServer(); 125 NativeMethods.ISteamApps_RequestAppProofOfPurchaseKey(CSteamGameServerAPIContext.GetSteamApps(), nAppID); 126 } 127 128 /// <summary> 129 /// <para> returns current beta branch name, 'public' is the default branch</para> 130 /// </summary> 131 public static bool GetCurrentBetaName(out string pchName, int cchNameBufferSize) { 132 InteropHelp.TestIfAvailableGameServer(); 133 IntPtr pchName2 = Marshal.AllocHGlobal(cchNameBufferSize); 134 bool ret = NativeMethods.ISteamApps_GetCurrentBetaName(CSteamGameServerAPIContext.GetSteamApps(), pchName2, cchNameBufferSize); 135 pchName = ret ? InteropHelp.PtrToStringUTF8(pchName2) : null; 136 Marshal.FreeHGlobal(pchName2); 137 return ret; 138 } 139 140 /// <summary> 141 /// <para> signal Steam that game files seems corrupt or missing</para> 142 /// </summary> 143 public static bool MarkContentCorrupt(bool bMissingFilesOnly) { 144 InteropHelp.TestIfAvailableGameServer(); 145 return NativeMethods.ISteamApps_MarkContentCorrupt(CSteamGameServerAPIContext.GetSteamApps(), bMissingFilesOnly); 146 } 147 148 /// <summary> 149 /// <para> return installed depots in mount order</para> 150 /// </summary> 151 public static uint GetInstalledDepots(AppId_t appID, DepotId_t[] pvecDepots, uint cMaxDepots) { 152 InteropHelp.TestIfAvailableGameServer(); 153 return NativeMethods.ISteamApps_GetInstalledDepots(CSteamGameServerAPIContext.GetSteamApps(), appID, pvecDepots, cMaxDepots); 154 } 155 156 /// <summary> 157 /// <para> returns current app install folder for AppID, returns folder name length</para> 158 /// </summary> 159 public static uint GetAppInstallDir(AppId_t appID, out string pchFolder, uint cchFolderBufferSize) { 160 InteropHelp.TestIfAvailableGameServer(); 161 IntPtr pchFolder2 = Marshal.AllocHGlobal((int)cchFolderBufferSize); 162 uint ret = NativeMethods.ISteamApps_GetAppInstallDir(CSteamGameServerAPIContext.GetSteamApps(), appID, pchFolder2, cchFolderBufferSize); 163 pchFolder = ret != 0 ? InteropHelp.PtrToStringUTF8(pchFolder2) : null; 164 Marshal.FreeHGlobal(pchFolder2); 165 return ret; 166 } 167 168 /// <summary> 169 /// <para> returns true if that app is installed (not necessarily owned)</para> 170 /// </summary> 171 public static bool BIsAppInstalled(AppId_t appID) { 172 InteropHelp.TestIfAvailableGameServer(); 173 return NativeMethods.ISteamApps_BIsAppInstalled(CSteamGameServerAPIContext.GetSteamApps(), appID); 174 } 175 176 /// <summary> 177 /// <para> returns the SteamID of the original owner. If this CSteamID is different from ISteamUser::GetSteamID(),</para> 178 /// <para> the user has a temporary license borrowed via Family Sharing</para> 179 /// </summary> 180 public static CSteamID GetAppOwner() { 181 InteropHelp.TestIfAvailableGameServer(); 182 return (CSteamID)NativeMethods.ISteamApps_GetAppOwner(CSteamGameServerAPIContext.GetSteamApps()); 183 } 184 185 /// <summary> 186 /// <para> Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1&param2=value2&param3=value3 etc.</para> 187 /// <para> Parameter names starting with the character '@' are reserved for internal use and will always return and empty string.</para> 188 /// <para> Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,</para> 189 /// <para> but it is advised that you not param names beginning with an underscore for your own features.</para> 190 /// <para> Check for new launch parameters on callback NewUrlLaunchParameters_t</para> 191 /// </summary> 192 public static string GetLaunchQueryParam(string pchKey) { 193 InteropHelp.TestIfAvailableGameServer(); 194 using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { 195 return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetLaunchQueryParam(CSteamGameServerAPIContext.GetSteamApps(), pchKey2)); 196 } 197 } 198 199 /// <summary> 200 /// <para> get download progress for optional DLC</para> 201 /// </summary> 202 public static bool GetDlcDownloadProgress(AppId_t nAppID, out ulong punBytesDownloaded, out ulong punBytesTotal) { 203 InteropHelp.TestIfAvailableGameServer(); 204 return NativeMethods.ISteamApps_GetDlcDownloadProgress(CSteamGameServerAPIContext.GetSteamApps(), nAppID, out punBytesDownloaded, out punBytesTotal); 205 } 206 207 /// <summary> 208 /// <para> return the buildid of this app, may change at any time based on backend updates to the game</para> 209 /// </summary> 210 public static int GetAppBuildId() { 211 InteropHelp.TestIfAvailableGameServer(); 212 return NativeMethods.ISteamApps_GetAppBuildId(CSteamGameServerAPIContext.GetSteamApps()); 213 } 214 215 /// <summary> 216 /// <para> Request all proof of purchase keys for the calling appid and asociated DLC.</para> 217 /// <para> A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with</para> 218 /// <para> appropriate appid values, ending with a final callback where the m_nAppId</para> 219 /// <para> member is k_uAppIdInvalid (zero).</para> 220 /// </summary> 221 public static void RequestAllProofOfPurchaseKeys() { 222 InteropHelp.TestIfAvailableGameServer(); 223 NativeMethods.ISteamApps_RequestAllProofOfPurchaseKeys(CSteamGameServerAPIContext.GetSteamApps()); 224 } 225 226 public static SteamAPICall_t GetFileDetails(string pszFileName) { 227 InteropHelp.TestIfAvailableGameServer(); 228 using (var pszFileName2 = new InteropHelp.UTF8StringHandle(pszFileName)) { 229 return (SteamAPICall_t)NativeMethods.ISteamApps_GetFileDetails(CSteamGameServerAPIContext.GetSteamApps(), pszFileName2); 230 } 231 } 232 233 /// <summary> 234 /// <para> Get command line if game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/.</para> 235 /// <para> This method of passing a connect string (used when joining via rich presence, accepting an</para> 236 /// <para> invite, etc) is preferable to passing the connect string on the operating system command</para> 237 /// <para> line, which is a security risk. In order for rich presence joins to go through this</para> 238 /// <para> path and not be placed on the OS command line, you must set a value in your app's</para> 239 /// <para> configuration on Steam. Ask Valve for help with this.</para> 240 /// <para> If game was already running and launched again, the NewUrlLaunchParameters_t will be fired.</para> 241 /// </summary> 242 public static int GetLaunchCommandLine(out string pszCommandLine, int cubCommandLine) { 243 InteropHelp.TestIfAvailableGameServer(); 244 IntPtr pszCommandLine2 = Marshal.AllocHGlobal(cubCommandLine); 245 int ret = NativeMethods.ISteamApps_GetLaunchCommandLine(CSteamGameServerAPIContext.GetSteamApps(), pszCommandLine2, cubCommandLine); 246 pszCommandLine = ret != -1 ? InteropHelp.PtrToStringUTF8(pszCommandLine2) : null; 247 Marshal.FreeHGlobal(pszCommandLine2); 248 return ret; 249 } 250 251 /// <summary> 252 /// <para> Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID</para> 253 /// </summary> 254 public static bool BIsSubscribedFromFamilySharing() { 255 InteropHelp.TestIfAvailableGameServer(); 256 return NativeMethods.ISteamApps_BIsSubscribedFromFamilySharing(CSteamGameServerAPIContext.GetSteamApps()); 257 } 258 } 259 } 260 261 #endif // !DISABLESTEAMWORKS