From 5d2b8a0adec428d2506b5bbfcc02a1b010f11cce Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Tue, 11 Feb 2020 10:16:23 +0000 Subject: [PATCH] Removing the new networking stuff (for now) --- .../NetworkingSockets.cs | 4 ++++ Facepunch.Steamworks.Test/NetworkingUtils.cs | 4 ++++ .../Classes/ConnectionInterface.cs | 6 ++++- .../Classes/SocketInterface.cs | 6 ++++- Facepunch.Steamworks/ServerList/Base.cs | 22 +------------------ Facepunch.Steamworks/SteamClient.cs | 7 +++--- .../SteamNetworkingSockets.cs | 14 +++++++----- Facepunch.Steamworks/SteamNetworkingUtils.cs | 10 ++++++--- Facepunch.Steamworks/SteamServer.cs | 4 +++- Facepunch.Steamworks/Structs/Connection.cs | 13 ++++++++++- Facepunch.Steamworks/Structs/PingLocation.cs | 6 ++++- Facepunch.Steamworks/Structs/Socket.cs | 14 ++++++++++-- Facepunch.Steamworks/Utility/GetApi.cs | 10 ++++++++- 13 files changed, 79 insertions(+), 41 deletions(-) diff --git a/Facepunch.Steamworks.Test/NetworkingSockets.cs b/Facepunch.Steamworks.Test/NetworkingSockets.cs index 9fca88b..9392ead 100644 --- a/Facepunch.Steamworks.Test/NetworkingSockets.cs +++ b/Facepunch.Steamworks.Test/NetworkingSockets.cs @@ -7,6 +7,8 @@ using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using Steamworks.Data; +#if false + namespace Steamworks { [TestClass] @@ -285,3 +287,5 @@ namespace Steamworks } } + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks.Test/NetworkingUtils.cs b/Facepunch.Steamworks.Test/NetworkingUtils.cs index 6f8d974..bf68e82 100644 --- a/Facepunch.Steamworks.Test/NetworkingUtils.cs +++ b/Facepunch.Steamworks.Test/NetworkingUtils.cs @@ -5,6 +5,8 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; +#if false + namespace Steamworks { [TestClass] @@ -60,3 +62,5 @@ namespace Steamworks } } + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Classes/ConnectionInterface.cs b/Facepunch.Steamworks/Classes/ConnectionInterface.cs index 2d116aa..76ab935 100644 --- a/Facepunch.Steamworks/Classes/ConnectionInterface.cs +++ b/Facepunch.Steamworks/Classes/ConnectionInterface.cs @@ -2,6 +2,8 @@ using System; using System.Runtime.InteropServices; +#if false + namespace Steamworks { public class ConnectionInterface @@ -117,4 +119,6 @@ namespace Steamworks } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Classes/SocketInterface.cs b/Facepunch.Steamworks/Classes/SocketInterface.cs index 813d082..e56bd82 100644 --- a/Facepunch.Steamworks/Classes/SocketInterface.cs +++ b/Facepunch.Steamworks/Classes/SocketInterface.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using Steamworks.Data; +#if false + namespace Steamworks { public class SocketInterface @@ -109,4 +111,6 @@ namespace Steamworks } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/ServerList/Base.cs b/Facepunch.Steamworks/ServerList/Base.cs index 4b66225..41f8624 100644 --- a/Facepunch.Steamworks/ServerList/Base.cs +++ b/Facepunch.Steamworks/ServerList/Base.cs @@ -11,27 +11,7 @@ namespace Steamworks.ServerList { #region ISteamMatchmakingServers - - static ISteamMatchmakingServers _internal; - internal static ISteamMatchmakingServers Internal - { - get - { - if ( _internal == null ) - { - _internal = new ISteamMatchmakingServers(); - _internal.Init(); - } - - return _internal; - } - } - - internal static void Shutdown() - { - _internal = null; - } - + internal static ISteamMatchmakingServers Internal => SteamMatchmakingServers.Internal; #endregion diff --git a/Facepunch.Steamworks/SteamClient.cs b/Facepunch.Steamworks/SteamClient.cs index f5fe724..f24e711 100644 --- a/Facepunch.Steamworks/SteamClient.cs +++ b/Facepunch.Steamworks/SteamClient.cs @@ -34,10 +34,11 @@ namespace Steamworks AddInterface(); AddInterface(); AddInterface(); + AddInterface(); AddInterface(); AddInterface(); - AddInterface(); - AddInterface(); + //AddInterface(); + //AddInterface(); AddInterface(); AddInterface(); AddInterface(); @@ -115,8 +116,6 @@ namespace Steamworks Event.DisposeAllClient(); ShutdownInterfaces(); - - ServerList.Base.Shutdown(); } internal static void RegisterCallback( IntPtr intPtr, int callbackId ) diff --git a/Facepunch.Steamworks/SteamNetworkingSockets.cs b/Facepunch.Steamworks/SteamNetworkingSockets.cs index 02ff24c..dc7a919 100644 --- a/Facepunch.Steamworks/SteamNetworkingSockets.cs +++ b/Facepunch.Steamworks/SteamNetworkingSockets.cs @@ -6,6 +6,8 @@ using System.Text; using System.Threading.Tasks; using Steamworks.Data; +#if false + namespace Steamworks { public class SteamNetworkingSockets : SteamClass @@ -23,7 +25,7 @@ namespace Steamworks InstallEvents(); } - #region SocketInterface +#region SocketInterface static Dictionary SocketInterfaces; @@ -45,9 +47,9 @@ namespace Steamworks Console.WriteLine( $"Installing Socket For {id}" ); SocketInterfaces[id] = iface; } - #endregion +#endregion - #region ConnectionInterface +#region ConnectionInterface static Dictionary ConnectionInterfaces; @@ -67,7 +69,7 @@ namespace Steamworks if ( id == 0 ) throw new System.ArgumentException( "Invalid Connection" ); ConnectionInterfaces[id] = iface; } - #endregion +#endregion internal static void InstallEvents( bool server = false ) { @@ -142,4 +144,6 @@ namespace Steamworks return t; } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/SteamNetworkingUtils.cs b/Facepunch.Steamworks/SteamNetworkingUtils.cs index 3726ffc..c2e5418 100644 --- a/Facepunch.Steamworks/SteamNetworkingUtils.cs +++ b/Facepunch.Steamworks/SteamNetworkingUtils.cs @@ -5,6 +5,8 @@ using System.Text; using System.Threading.Tasks; using Steamworks.Data; +#if false + namespace Steamworks { /// @@ -106,7 +108,7 @@ namespace Steamworks set => SetConfigFloat( NetConfig.FakePacketLag_Recv, value ); } - #region Config Internals +#region Config Internals internal unsafe static bool GetConfigInt( NetConfig type, int value ) { @@ -199,6 +201,8 @@ namespace Steamworks } }*/ - #endregion +#endregion } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/SteamServer.cs b/Facepunch.Steamworks/SteamServer.cs index 5746735..75e4c6e 100644 --- a/Facepunch.Steamworks/SteamServer.cs +++ b/Facepunch.Steamworks/SteamServer.cs @@ -29,7 +29,7 @@ namespace Steamworks internal static void InstallEvents() { SteamInventory.InstallEvents(); - SteamNetworkingSockets.InstallEvents(true); + //SteamNetworkingSockets.InstallEvents(true); ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke(), true ); @@ -85,6 +85,8 @@ namespace Steamworks throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" ); } + Install + // // Initial settings // diff --git a/Facepunch.Steamworks/Structs/Connection.cs b/Facepunch.Steamworks/Structs/Connection.cs index aa74039..e442cee 100644 --- a/Facepunch.Steamworks/Structs/Connection.cs +++ b/Facepunch.Steamworks/Structs/Connection.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +#if false + namespace Steamworks.Data { public struct Connection @@ -114,4 +116,13 @@ namespace Steamworks.Data }*/ } -} \ No newline at end of file +} +#else +namespace Steamworks.Data +{ + public struct Connection + { + public uint Id { get; } + } +} +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Structs/PingLocation.cs b/Facepunch.Steamworks/Structs/PingLocation.cs index 9eb0a95..e2085a8 100644 --- a/Facepunch.Steamworks/Structs/PingLocation.cs +++ b/Facepunch.Steamworks/Structs/PingLocation.cs @@ -1,5 +1,7 @@ using System.Runtime.InteropServices; +#if false + namespace Steamworks.Data { /// @@ -64,4 +66,6 @@ namespace Steamworks.Data return SteamNetworkingUtils.Internal.EstimatePingTimeBetweenTwoLocations( ref this, ref target ); } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Structs/Socket.cs b/Facepunch.Steamworks/Structs/Socket.cs index d589acb..c0d3ab9 100644 --- a/Facepunch.Steamworks/Structs/Socket.cs +++ b/Facepunch.Steamworks/Structs/Socket.cs @@ -1,4 +1,5 @@ -namespace Steamworks.Data +#if false +namespace Steamworks.Data { public struct Socket { @@ -20,4 +21,13 @@ set => SteamNetworkingSockets.SetSocketInterface( Id, value ); } } -} \ No newline at end of file +} +#else +namespace Steamworks.Data +{ + public struct Socket + { + public uint Id { get; } + } +} +#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Utility/GetApi.cs b/Facepunch.Steamworks/Utility/GetApi.cs index 3f9258d..adf7c1c 100644 --- a/Facepunch.Steamworks/Utility/GetApi.cs +++ b/Facepunch.Steamworks/Utility/GetApi.cs @@ -70,6 +70,14 @@ namespace Steamworks [DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer" )] internal static extern IntPtr SteamGameServer(); [DllImport( Platform.LibraryName, EntryPoint = "SteamGameServerStats" )] - internal static extern IntPtr SteamGameServerStats(); + internal static extern IntPtr SteamGameServerStats(); + + // + // NOTE: Stubs - these don't exist + // + [DllImport( Platform.LibraryName, EntryPoint = "SteamNetworkingSockets" )] + internal static extern IntPtr SteamNetworkingSockets(); + [DllImport( Platform.LibraryName, EntryPoint = "SteamNetworkingUtils" )] + internal static extern IntPtr SteamNetworkingUtils(); } } \ No newline at end of file