From c9053b0a910ce4d6ffa5cc8a3e2226f11c9261ba Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Mon, 24 Feb 2020 16:26:23 +0000 Subject: [PATCH] In ISteamNetworking everything is deprecated apart from the p2p stuff --- .../Generated/Interfaces/ISteamNetworking.cs | 152 ------------------ .../Generated/SteamCallbacks.cs | 15 -- Facepunch.Steamworks/Generated/SteamEnums.cs | 22 --- Generator/Cleanup.cs | 14 ++ 4 files changed, 14 insertions(+), 189 deletions(-) diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamNetworking.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamNetworking.cs index f572078..baef24d 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamNetworking.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamNetworking.cs @@ -119,17 +119,6 @@ namespace Steamworks return returnValue; } - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_CreateListenSocket", CallingConvention = Platform.CC)] - private static extern SNetListenSocket_t _CreateListenSocket( IntPtr self, int nVirtualP2PPort, SteamIPAddress nIP, ushort nPort, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay ); - - #endregion - internal SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress nIP, ushort nPort, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay ) - { - var returnValue = _CreateListenSocket( Self, nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay ); - return returnValue; - } - #region FunctionMeta [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_CreateP2PConnectionSocket", CallingConvention = Platform.CC)] private static extern SNetSocket_t _CreateP2PConnectionSocket( IntPtr self, SteamId steamIDTarget, int nVirtualPort, int nTimeoutSec, [MarshalAs( UnmanagedType.U1 )] bool bAllowUseOfPacketRelay ); @@ -141,146 +130,5 @@ namespace Steamworks return returnValue; } - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_CreateConnectionSocket", CallingConvention = Platform.CC)] - private static extern SNetSocket_t _CreateConnectionSocket( IntPtr self, SteamIPAddress nIP, ushort nPort, int nTimeoutSec ); - - #endregion - internal SNetSocket_t CreateConnectionSocket( SteamIPAddress nIP, ushort nPort, int nTimeoutSec ) - { - var returnValue = _CreateConnectionSocket( Self, nIP, nPort, nTimeoutSec ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_DestroySocket", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _DestroySocket( IntPtr self, SNetSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd ); - - #endregion - internal bool DestroySocket( SNetSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd ) - { - var returnValue = _DestroySocket( Self, hSocket, bNotifyRemoteEnd ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_DestroyListenSocket", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _DestroyListenSocket( IntPtr self, SNetListenSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd ); - - #endregion - internal bool DestroyListenSocket( SNetListenSocket_t hSocket, [MarshalAs( UnmanagedType.U1 )] bool bNotifyRemoteEnd ) - { - var returnValue = _DestroyListenSocket( Self, hSocket, bNotifyRemoteEnd ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_SendDataOnSocket", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _SendDataOnSocket( IntPtr self, SNetSocket_t hSocket, [In,Out] IntPtr[] pubData, uint cubData, [MarshalAs( UnmanagedType.U1 )] bool bReliable ); - - #endregion - internal bool SendDataOnSocket( SNetSocket_t hSocket, [In,Out] IntPtr[] pubData, uint cubData, [MarshalAs( UnmanagedType.U1 )] bool bReliable ) - { - var returnValue = _SendDataOnSocket( Self, hSocket, pubData, cubData, bReliable ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_IsDataAvailableOnSocket", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _IsDataAvailableOnSocket( IntPtr self, SNetSocket_t hSocket, ref uint pcubMsgSize ); - - #endregion - internal bool IsDataAvailableOnSocket( SNetSocket_t hSocket, ref uint pcubMsgSize ) - { - var returnValue = _IsDataAvailableOnSocket( Self, hSocket, ref pcubMsgSize ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_RetrieveDataFromSocket", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _RetrieveDataFromSocket( IntPtr self, SNetSocket_t hSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize ); - - #endregion - internal bool RetrieveDataFromSocket( SNetSocket_t hSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize ) - { - var returnValue = _RetrieveDataFromSocket( Self, hSocket, pubDest, cubDest, ref pcubMsgSize ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_IsDataAvailable", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _IsDataAvailable( IntPtr self, SNetListenSocket_t hListenSocket, ref uint pcubMsgSize, ref SNetSocket_t phSocket ); - - #endregion - internal bool IsDataAvailable( SNetListenSocket_t hListenSocket, ref uint pcubMsgSize, ref SNetSocket_t phSocket ) - { - var returnValue = _IsDataAvailable( Self, hListenSocket, ref pcubMsgSize, ref phSocket ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_RetrieveData", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _RetrieveData( IntPtr self, SNetListenSocket_t hListenSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize, ref SNetSocket_t phSocket ); - - #endregion - internal bool RetrieveData( SNetListenSocket_t hListenSocket, [In,Out] IntPtr[] pubDest, uint cubDest, ref uint pcubMsgSize, ref SNetSocket_t phSocket ) - { - var returnValue = _RetrieveData( Self, hListenSocket, pubDest, cubDest, ref pcubMsgSize, ref phSocket ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_GetSocketInfo", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _GetSocketInfo( IntPtr self, SNetSocket_t hSocket, ref SteamId pSteamIDRemote, ref int peSocketStatus, ref SteamIPAddress punIPRemote, ref ushort punPortRemote ); - - #endregion - internal bool GetSocketInfo( SNetSocket_t hSocket, ref SteamId pSteamIDRemote, ref int peSocketStatus, ref SteamIPAddress punIPRemote, ref ushort punPortRemote ) - { - var returnValue = _GetSocketInfo( Self, hSocket, ref pSteamIDRemote, ref peSocketStatus, ref punIPRemote, ref punPortRemote ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_GetListenSocketInfo", CallingConvention = Platform.CC)] - [return: MarshalAs( UnmanagedType.I1 )] - private static extern bool _GetListenSocketInfo( IntPtr self, SNetListenSocket_t hListenSocket, ref SteamIPAddress pnIP, ref ushort pnPort ); - - #endregion - internal bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, ref SteamIPAddress pnIP, ref ushort pnPort ) - { - var returnValue = _GetListenSocketInfo( Self, hListenSocket, ref pnIP, ref pnPort ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_GetSocketConnectionType", CallingConvention = Platform.CC)] - private static extern SNetSocketConnectionType _GetSocketConnectionType( IntPtr self, SNetSocket_t hSocket ); - - #endregion - internal SNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) - { - var returnValue = _GetSocketConnectionType( Self, hSocket ); - return returnValue; - } - - #region FunctionMeta - [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworking_GetMaxPacketSize", CallingConvention = Platform.CC)] - private static extern int _GetMaxPacketSize( IntPtr self, SNetSocket_t hSocket ); - - #endregion - internal int GetMaxPacketSize( SNetSocket_t hSocket ) - { - var returnValue = _GetMaxPacketSize( Self, hSocket ); - return returnValue; - } - } } diff --git a/Facepunch.Steamworks/Generated/SteamCallbacks.cs b/Facepunch.Steamworks/Generated/SteamCallbacks.cs index f7e2a85..ac7b005 100644 --- a/Facepunch.Steamworks/Generated/SteamCallbacks.cs +++ b/Facepunch.Steamworks/Generated/SteamCallbacks.cs @@ -1644,21 +1644,6 @@ namespace Steamworks.Data #endregion } - [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )] - internal struct SocketStatusCallback_t : ICallbackData - { - internal uint Socket; // m_hSocket SNetSocket_t - internal uint ListenSocket; // m_hListenSocket SNetListenSocket_t - internal ulong SteamIDRemote; // m_steamIDRemote CSteamID - internal int SNetSocketState; // m_eSNetSocketState int - - #region SteamCallback - public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SocketStatusCallback_t) ); - public int DataSize => _datasize; - public CallbackType CallbackType => CallbackType.SocketStatusCallback; - #endregion - } - [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )] internal struct ScreenshotReady_t : ICallbackData { diff --git a/Facepunch.Steamworks/Generated/SteamEnums.cs b/Facepunch.Steamworks/Generated/SteamEnums.cs index 358b382..b8cca28 100644 --- a/Facepunch.Steamworks/Generated/SteamEnums.cs +++ b/Facepunch.Steamworks/Generated/SteamEnums.cs @@ -999,31 +999,9 @@ namespace Steamworks // // ESNetSocketState // - internal enum SNetSocketState : int - { - Invalid = 0, - Connected = 1, - Initiated = 10, - LocalCandidatesFound = 11, - ReceivedRemoteCandidates = 12, - ChallengeHandshake = 15, - Disconnecting = 21, - LocalDisconnect = 22, - TimeoutDuringConnect = 23, - RemoteEndDisconnected = 24, - ConnectionBroken = 25, - } - // // ESNetSocketConnectionType // - internal enum SNetSocketConnectionType : int - { - NotConnected = 0, - UDP = 1, - UDPRelay = 2, - } - // // EVRScreenshotType // diff --git a/Generator/Cleanup.cs b/Generator/Cleanup.cs index 3e71a1d..d027708 100644 --- a/Generator/Cleanup.cs +++ b/Generator/Cleanup.cs @@ -69,6 +69,7 @@ public static class Cleanup public static bool ShouldCreate( string type ) { + if ( IsDeprecated( type ) ) return false; if ( type == "SteamId" ) return false; if ( type == "LeaderboardSort" ) return false; if ( type == "LeaderboardDisplay" ) return false; @@ -142,6 +143,10 @@ public static class Cleanup internal static bool IsDeprecated( string name ) { + if ( name == "SocketStatusCallback_t" ) return true; + if ( name == "SNetSocketConnectionType" ) return true; + if ( name == "SNetSocketState" ) return true; + if ( name.StartsWith( "ISteamRemoteStorage." ) ) { if ( name.Contains( "Publish" ) ) return true; @@ -150,6 +155,15 @@ public static class Cleanup if ( name.Contains( "EnumerateUserSharedWorkshopFile" ) ) return true; } + // + // In ISteamNetworking everything is deprecated apart from the p2p stuff + // + if ( name.StartsWith( "ISteamNetworking." ) ) + { + if ( !name.Contains( "P2P" )) + return true; + } + return false; }