summaryrefslogtreecommitdiff
path: root/Assembly_Firstpass/Steamworks/SteamAPI.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-11-25 18:39:02 +0800
committerchai <215380520@qq.com>2023-11-25 18:39:02 +0800
commit0e63c4a2c6dec8dfa260501fb7d73750261ea7b7 (patch)
treef6f2291be65d195d6082b523a56183c332715240 /Assembly_Firstpass/Steamworks/SteamAPI.cs
+ init
Diffstat (limited to 'Assembly_Firstpass/Steamworks/SteamAPI.cs')
-rw-r--r--Assembly_Firstpass/Steamworks/SteamAPI.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/Assembly_Firstpass/Steamworks/SteamAPI.cs b/Assembly_Firstpass/Steamworks/SteamAPI.cs
new file mode 100644
index 0000000..73cbebd
--- /dev/null
+++ b/Assembly_Firstpass/Steamworks/SteamAPI.cs
@@ -0,0 +1,62 @@
+namespace Steamworks;
+
+public static class SteamAPI
+{
+ public static bool Init()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ bool flag = NativeMethods.SteamAPI_Init();
+ if (flag)
+ {
+ flag = CSteamAPIContext.Init();
+ }
+ if (flag)
+ {
+ CallbackDispatcher.Initialize();
+ }
+ return flag;
+ }
+
+ public static void Shutdown()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ NativeMethods.SteamAPI_Shutdown();
+ CSteamAPIContext.Clear();
+ CallbackDispatcher.Shutdown();
+ }
+
+ public static bool RestartAppIfNecessary(AppId_t unOwnAppID)
+ {
+ InteropHelp.TestIfPlatformSupported();
+ return NativeMethods.SteamAPI_RestartAppIfNecessary(unOwnAppID);
+ }
+
+ public static void ReleaseCurrentThreadMemory()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ NativeMethods.SteamAPI_ReleaseCurrentThreadMemory();
+ }
+
+ public static void RunCallbacks()
+ {
+ CallbackDispatcher.RunFrame(isGameServer: false);
+ }
+
+ public static bool IsSteamRunning()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ return NativeMethods.SteamAPI_IsSteamRunning();
+ }
+
+ public static HSteamPipe GetHSteamPipe()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ return (HSteamPipe)NativeMethods.SteamAPI_GetHSteamPipe();
+ }
+
+ public static HSteamUser GetHSteamUser()
+ {
+ InteropHelp.TestIfPlatformSupported();
+ return (HSteamUser)NativeMethods.SteamAPI_GetHSteamUser();
+ }
+}