mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 22:55:55 +03:00
Handle steam shutdown nicer
This commit is contained in:
parent
38b1ed5f88
commit
c6c73a36e9
@ -79,13 +79,23 @@ internal static async void RunCallbacksAsync()
|
||||
|
||||
public static void Shutdown()
|
||||
{
|
||||
Event.DisposeAllClient();
|
||||
|
||||
initialized = false;
|
||||
if ( !IsValid ) return;
|
||||
|
||||
SteamInput.Shutdown();
|
||||
|
||||
Cleanup();
|
||||
|
||||
SteamAPI.Shutdown();
|
||||
}
|
||||
|
||||
internal static void Cleanup()
|
||||
{
|
||||
initialized = false;
|
||||
|
||||
Event.DisposeAllClient();
|
||||
ShutdownInterfaces();
|
||||
|
||||
SteamInput.Shutdown();
|
||||
SteamApps.Shutdown();
|
||||
SteamUtils.Shutdown();
|
||||
SteamParental.Shutdown();
|
||||
@ -101,10 +111,7 @@ public static void Shutdown()
|
||||
SteamParties.Shutdown();
|
||||
SteamNetworkingUtils.Shutdown();
|
||||
SteamNetworkingSockets.Shutdown();
|
||||
|
||||
ServerList.Base.Shutdown();
|
||||
|
||||
SteamAPI.Shutdown();
|
||||
}
|
||||
|
||||
internal static void RegisterCallback( IntPtr intPtr, int callbackId )
|
||||
@ -114,6 +121,8 @@ internal static void RegisterCallback( IntPtr intPtr, int callbackId )
|
||||
|
||||
public static void RunCallbacks()
|
||||
{
|
||||
if ( !IsValid ) return;
|
||||
|
||||
try
|
||||
{
|
||||
SteamAPI.RunCallbacks();
|
||||
|
@ -24,7 +24,11 @@ internal static ISteamInput Internal
|
||||
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal?.DoShutdown();
|
||||
if ( _internal != null && _internal.IsValid )
|
||||
{
|
||||
_internal.DoShutdown();
|
||||
}
|
||||
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,17 @@ internal static void InstallEvents()
|
||||
{
|
||||
IPCountry_t.Install( x => OnIpCountryChanged?.Invoke() );
|
||||
LowBatteryPower_t.Install( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) );
|
||||
SteamShutdown_t.Install( x => OnSteamShutdown?.Invoke() );
|
||||
SteamShutdown_t.Install( x => SteamClosed() );
|
||||
GamepadTextInputDismissed_t.Install( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) );
|
||||
}
|
||||
|
||||
private static void SteamClosed()
|
||||
{
|
||||
SteamClient.Cleanup();
|
||||
|
||||
OnSteamShutdown?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The country of the user changed
|
||||
/// </summary>
|
||||
|
@ -34,7 +34,7 @@ internal static class Platform
|
||||
|
||||
public static int MemoryOffset( int memLocation )
|
||||
{
|
||||
#if PLATFORM_WIN64 || PLATFORM_POSIX64
|
||||
#if PLATFORM_64
|
||||
return memLocation;
|
||||
#else
|
||||
return memLocation / 2;
|
||||
|
@ -15,6 +15,7 @@ internal abstract class SteamInterface
|
||||
public IntPtr VTable;
|
||||
|
||||
public virtual string InterfaceName => null;
|
||||
public bool IsValid => Self != IntPtr.Zero && VTable != IntPtr.Zero;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user