From 28766081b57b066956407a372915eab5c4a24963 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 6 Jul 2017 10:33:28 +0100 Subject: [PATCH] Added Client.RestartIfNecessary --- Facepunch.Steamworks/Client.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index d151789..ecf1bfa 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -247,5 +247,24 @@ public Leaderboard GetLeaderboard( string name, LeaderboardSortMethod sortMethod /// True if we're in low violence mode (germans are only allowed to see the insides of bodies in porn) /// public bool IsLowViolence => native.apps.BIsLowViolence(); + + /// + /// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't. + /// If this returns true then it starts the Steam client if required and launches your game again through it, + /// and you should quit your process as soon as possible. This effectively runs steam://run/AppId so it may + /// not relaunch the exact executable that called it, as it will always relaunch from the version installed + /// in your Steam library folder. + /// If it returns false, then your game was launched by the Steam client and no action needs to be taken. + /// One exception is if a steam_appid.txt file is present then this will return false regardless. This allows + /// you to develop and test without launching your game through the Steam client. Make sure to remove the + /// steam_appid.txt file when uploading the game to your Steam depot! + /// + public static bool RestartIfNecessary( uint appid ) + { + using ( var api = new SteamNative.SteamApi() ) + { + return api.SteamAPI_RestartAppIfNecessary( appid ); + } + } } }