diff options
Diffstat (limited to 'Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs')
-rw-r--r-- | Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs b/Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs new file mode 100644 index 0000000..a9d225c --- /dev/null +++ b/Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs @@ -0,0 +1,211 @@ +using System; +using System.Runtime.InteropServices; + +namespace Steamworks; + +public static class SteamGameServerUtils +{ + public static uint GetSecondsSinceAppActive() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetSecondsSinceAppActive(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static uint GetSecondsSinceComputerActive() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetSecondsSinceComputerActive(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static EUniverse GetConnectedUniverse() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetConnectedUniverse(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static uint GetServerRealTime() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetServerRealTime(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static string GetIPCountry() + { + InteropHelp.TestIfAvailableGameServer(); + return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamUtils_GetIPCountry(CSteamGameServerAPIContext.GetSteamUtils())); + } + + public static bool GetImageSize(int iImage, out uint pnWidth, out uint pnHeight) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetImageSize(CSteamGameServerAPIContext.GetSteamUtils(), iImage, out pnWidth, out pnHeight); + } + + public static bool GetImageRGBA(int iImage, byte[] pubDest, int nDestBufferSize) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetImageRGBA(CSteamGameServerAPIContext.GetSteamUtils(), iImage, pubDest, nDestBufferSize); + } + + public static byte GetCurrentBatteryPower() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetCurrentBatteryPower(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static AppId_t GetAppID() + { + InteropHelp.TestIfAvailableGameServer(); + return (AppId_t)NativeMethods.ISteamUtils_GetAppID(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static void SetOverlayNotificationPosition(ENotificationPosition eNotificationPosition) + { + InteropHelp.TestIfAvailableGameServer(); + NativeMethods.ISteamUtils_SetOverlayNotificationPosition(CSteamGameServerAPIContext.GetSteamUtils(), eNotificationPosition); + } + + public static bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, out bool pbFailed) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsAPICallCompleted(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall, out pbFailed); + } + + public static ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetAPICallFailureReason(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall); + } + + public static bool GetAPICallResult(SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, out bool pbFailed) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetAPICallResult(CSteamGameServerAPIContext.GetSteamUtils(), hSteamAPICall, pCallback, cubCallback, iCallbackExpected, out pbFailed); + } + + public static uint GetIPCCallCount() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetIPCCallCount(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) + { + InteropHelp.TestIfAvailableGameServer(); + NativeMethods.ISteamUtils_SetWarningMessageHook(CSteamGameServerAPIContext.GetSteamUtils(), pFunction); + } + + public static bool IsOverlayEnabled() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsOverlayEnabled(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static bool BOverlayNeedsPresent() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_BOverlayNeedsPresent(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static SteamAPICall_t CheckFileSignature(string szFileName) + { + InteropHelp.TestIfAvailableGameServer(); + using InteropHelp.UTF8StringHandle szFileName2 = new InteropHelp.UTF8StringHandle(szFileName); + return (SteamAPICall_t)NativeMethods.ISteamUtils_CheckFileSignature(CSteamGameServerAPIContext.GetSteamUtils(), szFileName2); + } + + public static bool ShowGamepadTextInput(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText) + { + InteropHelp.TestIfAvailableGameServer(); + using InteropHelp.UTF8StringHandle pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription); + using InteropHelp.UTF8StringHandle pchExistingText2 = new InteropHelp.UTF8StringHandle(pchExistingText); + return NativeMethods.ISteamUtils_ShowGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils(), eInputMode, eLineInputMode, pchDescription2, unCharMax, pchExistingText2); + } + + public static uint GetEnteredGamepadTextLength() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetEnteredGamepadTextLength(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static bool GetEnteredGamepadTextInput(out string pchText, uint cchText) + { + InteropHelp.TestIfAvailableGameServer(); + IntPtr intPtr = Marshal.AllocHGlobal((int)cchText); + bool flag = NativeMethods.ISteamUtils_GetEnteredGamepadTextInput(CSteamGameServerAPIContext.GetSteamUtils(), intPtr, cchText); + pchText = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); + Marshal.FreeHGlobal(intPtr); + return flag; + } + + public static string GetSteamUILanguage() + { + InteropHelp.TestIfAvailableGameServer(); + return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamUtils_GetSteamUILanguage(CSteamGameServerAPIContext.GetSteamUtils())); + } + + public static bool IsSteamRunningInVR() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsSteamRunningInVR(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static void SetOverlayNotificationInset(int nHorizontalInset, int nVerticalInset) + { + InteropHelp.TestIfAvailableGameServer(); + NativeMethods.ISteamUtils_SetOverlayNotificationInset(CSteamGameServerAPIContext.GetSteamUtils(), nHorizontalInset, nVerticalInset); + } + + public static bool IsSteamInBigPictureMode() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsSteamInBigPictureMode(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static void StartVRDashboard() + { + InteropHelp.TestIfAvailableGameServer(); + NativeMethods.ISteamUtils_StartVRDashboard(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static bool IsVRHeadsetStreamingEnabled() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsVRHeadsetStreamingEnabled(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static void SetVRHeadsetStreamingEnabled(bool bEnabled) + { + InteropHelp.TestIfAvailableGameServer(); + NativeMethods.ISteamUtils_SetVRHeadsetStreamingEnabled(CSteamGameServerAPIContext.GetSteamUtils(), bEnabled); + } + + public static bool IsSteamChinaLauncher() + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_IsSteamChinaLauncher(CSteamGameServerAPIContext.GetSteamUtils()); + } + + public static bool InitFilterText(uint unFilterOptions = 0u) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_InitFilterText(CSteamGameServerAPIContext.GetSteamUtils(), unFilterOptions); + } + + public static int FilterText(ETextFilteringContext eContext, CSteamID sourceSteamID, string pchInputMessage, out string pchOutFilteredText, uint nByteSizeOutFilteredText) + { + InteropHelp.TestIfAvailableGameServer(); + IntPtr intPtr = Marshal.AllocHGlobal((int)nByteSizeOutFilteredText); + using InteropHelp.UTF8StringHandle pchInputMessage2 = new InteropHelp.UTF8StringHandle(pchInputMessage); + int num = NativeMethods.ISteamUtils_FilterText(CSteamGameServerAPIContext.GetSteamUtils(), eContext, sourceSteamID, pchInputMessage2, intPtr, nByteSizeOutFilteredText); + pchOutFilteredText = ((num != -1) ? InteropHelp.PtrToStringUTF8(intPtr) : null); + Marshal.FreeHGlobal(intPtr); + return num; + } + + public static ESteamIPv6ConnectivityState GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol eProtocol) + { + InteropHelp.TestIfAvailableGameServer(); + return NativeMethods.ISteamUtils_GetIPv6ConnectivityState(CSteamGameServerAPIContext.GetSteamUtils(), eProtocol); + } +} |