summaryrefslogtreecommitdiff
path: root/Assembly_Firstpass/Steamworks/SteamGameServerUtils.cs
blob: a9d225c204cbe6b3fc37a500d64046b5269af424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
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);
	}
}