mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Handle Steam not running better
This commit is contained in:
parent
1bae585602
commit
7a04765805
@ -15,9 +15,12 @@ public class SteamApps : SteamSharedClass<SteamApps>
|
|||||||
{
|
{
|
||||||
internal static ISteamApps Internal => Interface as ISteamApps;
|
internal static ISteamApps Internal => Interface as ISteamApps;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamApps( server ) );
|
SetInterface( server, new ISteamApps( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
|
@ -73,8 +73,15 @@ public static void Init( uint appid, bool asyncCallbacks = true )
|
|||||||
internal static void AddInterface<T>() where T : SteamClass, new()
|
internal static void AddInterface<T>() where T : SteamClass, new()
|
||||||
{
|
{
|
||||||
var t = new T();
|
var t = new T();
|
||||||
t.InitializeInterface( false );
|
bool valid = t.InitializeInterface( false );
|
||||||
openInterfaces.Add( t );
|
if ( valid )
|
||||||
|
{
|
||||||
|
openInterfaces.Add( t );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t.DestroyInterface( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly List<SteamClass> openInterfaces = new List<SteamClass>();
|
static readonly List<SteamClass> openInterfaces = new List<SteamClass>();
|
||||||
|
@ -14,13 +14,16 @@ public class SteamFriends : SteamClientClass<SteamFriends>
|
|||||||
{
|
{
|
||||||
internal static ISteamFriends Internal => Interface as ISteamFriends;
|
internal static ISteamFriends Internal => Interface as ISteamFriends;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamFriends( server ) );
|
SetInterface( server, new ISteamFriends( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
richPresence = new Dictionary<string, string>();
|
richPresence = new Dictionary<string, string>();
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<string, string> richPresence;
|
static Dictionary<string, string> richPresence;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Steamworks.Data;
|
using System;
|
||||||
|
using Steamworks.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
@ -7,9 +8,12 @@ public class SteamInput : SteamClientClass<SteamInput>
|
|||||||
{
|
{
|
||||||
internal static ISteamInput Internal => Interface as ISteamInput;
|
internal static ISteamInput Internal => Interface as ISteamInput;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamInput( server ) );
|
SetInterface( server, new ISteamInput( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
|
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
|
||||||
|
@ -16,11 +16,14 @@ public class SteamInventory : SteamSharedClass<SteamInventory>
|
|||||||
{
|
{
|
||||||
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamInventory( server ) );
|
SetInterface( server, new ISteamInventory( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal static void InstallEvents( bool server )
|
||||||
|
@ -14,11 +14,14 @@ public class SteamMatchmaking : SteamClientClass<SteamMatchmaking>
|
|||||||
{
|
{
|
||||||
internal static ISteamMatchmaking Internal => Interface as ISteamMatchmaking;
|
internal static ISteamMatchmaking Internal => Interface as ISteamMatchmaking;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamMatchmaking( server ) );
|
SetInterface( server, new ISteamMatchmaking( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14,9 +14,12 @@ internal class SteamMatchmakingServers : SteamClientClass<SteamMatchmakingServer
|
|||||||
{
|
{
|
||||||
internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers;
|
internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamMatchmakingServers( server ) );
|
SetInterface( server, new ISteamMatchmakingServers( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,11 +17,13 @@ public class SteamMusic : SteamClientClass<SteamMusic>
|
|||||||
{
|
{
|
||||||
internal static ISteamMusic Internal => Interface as ISteamMusic;
|
internal static ISteamMusic Internal => Interface as ISteamMusic;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamMusic( server ) );
|
SetInterface( server, new ISteamMusic( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
|
@ -12,11 +12,14 @@ public class SteamNetworking : SteamSharedClass<SteamNetworking>
|
|||||||
{
|
{
|
||||||
internal static ISteamNetworking Internal => Interface as ISteamNetworking;
|
internal static ISteamNetworking Internal => Interface as ISteamNetworking;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamNetworking( server ) );
|
SetInterface( server, new ISteamNetworking( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal static void InstallEvents( bool server )
|
||||||
|
@ -31,10 +31,13 @@ public static NetIdentity Identity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamNetworkingSockets( server ) );
|
SetInterface( server, new ISteamNetworkingSockets( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SocketInterface
|
#region SocketInterface
|
||||||
|
@ -14,10 +14,14 @@ public class SteamNetworkingUtils : SteamSharedClass<SteamNetworkingUtils>
|
|||||||
{
|
{
|
||||||
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamNetworkingUtils( server ) );
|
SetInterface( server, new ISteamNetworkingUtils( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallCallbacks( server );
|
InstallCallbacks( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InstallCallbacks( bool server )
|
static void InstallCallbacks( bool server )
|
||||||
|
@ -14,10 +14,14 @@ public class SteamParental : SteamSharedClass<SteamParental>
|
|||||||
{
|
{
|
||||||
internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings;
|
internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamParentalSettings( server ) );
|
SetInterface( server, new ISteamParentalSettings( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal static void InstallEvents( bool server )
|
||||||
|
@ -17,10 +17,14 @@ public class SteamParties : SteamClientClass<SteamParties>
|
|||||||
{
|
{
|
||||||
internal static ISteamParties Internal => Interface as ISteamParties;
|
internal static ISteamParties Internal => Interface as ISteamParties;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamParties( server ) );
|
SetInterface( server, new ISteamParties( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InstallEvents( bool server )
|
internal void InstallEvents( bool server )
|
||||||
|
@ -14,11 +14,14 @@ public class SteamRemotePlay : SteamClientClass<SteamRemotePlay>
|
|||||||
{
|
{
|
||||||
internal static ISteamRemotePlay Internal => Interface as ISteamRemotePlay;
|
internal static ISteamRemotePlay Internal => Interface as ISteamRemotePlay;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamRemotePlay( server ) );
|
SetInterface( server, new ISteamRemotePlay( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InstallEvents( bool server )
|
internal void InstallEvents( bool server )
|
||||||
|
@ -14,9 +14,12 @@ public class SteamRemoteStorage : SteamClientClass<SteamRemoteStorage>
|
|||||||
{
|
{
|
||||||
internal static ISteamRemoteStorage Internal => Interface as ISteamRemoteStorage;
|
internal static ISteamRemoteStorage Internal => Interface as ISteamRemoteStorage;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamRemoteStorage( server ) );
|
SetInterface( server, new ISteamRemoteStorage( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,10 +14,14 @@ public class SteamScreenshots : SteamClientClass<SteamScreenshots>
|
|||||||
{
|
{
|
||||||
internal static ISteamScreenshots Internal => Interface as ISteamScreenshots;
|
internal static ISteamScreenshots Internal => Interface as ISteamScreenshots;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamScreenshots( server ) );
|
SetInterface( server, new ISteamScreenshots( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
|
@ -14,10 +14,14 @@ public partial class SteamServer : SteamServerClass<SteamServer>
|
|||||||
{
|
{
|
||||||
internal static ISteamGameServer Internal => Interface as ISteamGameServer;
|
internal static ISteamGameServer Internal => Interface as ISteamGameServer;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamGameServer( server ) );
|
SetInterface( server, new ISteamGameServer( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsValid => Internal != null && Internal.IsValid;
|
public static bool IsValid => Internal != null && Internal.IsValid;
|
||||||
|
@ -11,9 +11,12 @@ public class SteamServerStats : SteamServerClass<SteamServerStats>
|
|||||||
{
|
{
|
||||||
internal static ISteamGameServerStats Internal => Interface as ISteamGameServerStats;
|
internal static ISteamGameServerStats Internal => Interface as ISteamGameServerStats;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamGameServerStats( server ) );
|
SetInterface( server, new ISteamGameServerStats( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,10 +17,14 @@ public class SteamUGC : SteamSharedClass<SteamUGC>
|
|||||||
{
|
{
|
||||||
internal static ISteamUGC Internal => Interface as ISteamUGC;
|
internal static ISteamUGC Internal => Interface as ISteamUGC;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamUGC( server ) );
|
SetInterface( server, new ISteamUGC( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal static void InstallEvents( bool server )
|
||||||
|
@ -17,13 +17,17 @@ public class SteamUser : SteamClientClass<SteamUser>
|
|||||||
{
|
{
|
||||||
internal static ISteamUser Internal => Interface as ISteamUser;
|
internal static ISteamUser Internal => Interface as ISteamUser;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamUser( server ) );
|
SetInterface( server, new ISteamUser( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
richPresence = new Dictionary<string, string>();
|
richPresence = new Dictionary<string, string>();
|
||||||
SampleRate = OptimalSampleRate;
|
SampleRate = OptimalSampleRate;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<string, string> richPresence;
|
static Dictionary<string, string> richPresence;
|
||||||
|
@ -11,11 +11,15 @@ public class SteamUserStats : SteamClientClass<SteamUserStats>
|
|||||||
{
|
{
|
||||||
internal static ISteamUserStats Internal => Interface as ISteamUserStats;
|
internal static ISteamUserStats Internal => Interface as ISteamUserStats;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamUserStats( server ) );
|
SetInterface( server, new ISteamUserStats( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
RequestCurrentStats();
|
RequestCurrentStats();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool StatsRecieved { get; internal set; }
|
public static bool StatsRecieved { get; internal set; }
|
||||||
|
@ -14,10 +14,14 @@ public class SteamUtils : SteamSharedClass<SteamUtils>
|
|||||||
{
|
{
|
||||||
internal static ISteamUtils Internal => Interface as ISteamUtils;
|
internal static ISteamUtils Internal => Interface as ISteamUtils;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamUtils( server ) );
|
SetInterface( server, new ISteamUtils( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal static void InstallEvents( bool server )
|
||||||
|
@ -14,10 +14,14 @@ public class SteamVideo : SteamClientClass<SteamVideo>
|
|||||||
{
|
{
|
||||||
internal static ISteamVideo Internal => Interface as ISteamVideo;
|
internal static ISteamVideo Internal => Interface as ISteamVideo;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
SetInterface( server, new ISteamVideo( server ) );
|
SetInterface( server, new ISteamVideo( server ) );
|
||||||
|
if ( Interface.Self == IntPtr.Zero ) return false;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
|
@ -55,7 +55,7 @@ internal void ShutdownInterface()
|
|||||||
|
|
||||||
public abstract class SteamClass
|
public abstract class SteamClass
|
||||||
{
|
{
|
||||||
internal abstract void InitializeInterface( bool server );
|
internal abstract bool InitializeInterface( bool server );
|
||||||
internal abstract void DestroyInterface( bool server );
|
internal abstract void DestroyInterface( bool server );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ public class SteamSharedClass<T> : SteamClass
|
|||||||
internal static SteamInterface InterfaceClient;
|
internal static SteamInterface InterfaceClient;
|
||||||
internal static SteamInterface InterfaceServer;
|
internal static SteamInterface InterfaceServer;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void SetInterface( bool server, SteamInterface iface )
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
@ -101,9 +101,9 @@ public class SteamClientClass<T> : SteamClass
|
|||||||
{
|
{
|
||||||
internal static SteamInterface Interface;
|
internal static SteamInterface Interface;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void SetInterface( bool server, SteamInterface iface )
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
@ -124,9 +124,9 @@ public class SteamServerClass<T> : SteamClass
|
|||||||
{
|
{
|
||||||
internal static SteamInterface Interface;
|
internal static SteamInterface Interface;
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override bool InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void SetInterface( bool server, SteamInterface iface )
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
|
Loading…
Reference in New Issue
Block a user