SteamNetworkingConfigValue_t => NetKeyValue

This commit is contained in:
Garry Newman 2020-02-19 10:27:04 +00:00
parent 1a082ff244
commit 798bfa991e
7 changed files with 59 additions and 38 deletions

View File

@ -19,45 +19,45 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP")]
private static extern Socket _CreateListenSocketIP( IntPtr self, ref NetAddress localAddress, int nOptions, ref NetConfig_t pOptions ); private static extern Socket _CreateListenSocketIP( IntPtr self, ref NetAddress localAddress, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Socket CreateListenSocketIP( ref NetAddress localAddress, int nOptions, ref NetConfig_t pOptions ) internal Socket CreateListenSocketIP( ref NetAddress localAddress, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _CreateListenSocketIP( Self, ref localAddress, nOptions, ref pOptions ); var returnValue = _CreateListenSocketIP( Self, ref localAddress, nOptions, pOptions );
return returnValue; return returnValue;
} }
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress")]
private static extern Connection _ConnectByIPAddress( IntPtr self, ref NetAddress address, int nOptions, ref NetConfig_t pOptions ); private static extern Connection _ConnectByIPAddress( IntPtr self, ref NetAddress address, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Connection ConnectByIPAddress( ref NetAddress address, int nOptions, ref NetConfig_t pOptions ) internal Connection ConnectByIPAddress( ref NetAddress address, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _ConnectByIPAddress( Self, ref address, nOptions, ref pOptions ); var returnValue = _ConnectByIPAddress( Self, ref address, nOptions, pOptions );
return returnValue; return returnValue;
} }
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P")]
private static extern Socket _CreateListenSocketP2P( IntPtr self, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ); private static extern Socket _CreateListenSocketP2P( IntPtr self, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Socket CreateListenSocketP2P( int nVirtualPort, int nOptions, ref NetConfig_t pOptions ) internal Socket CreateListenSocketP2P( int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _CreateListenSocketP2P( Self, nVirtualPort, nOptions, ref pOptions ); var returnValue = _CreateListenSocketP2P( Self, nVirtualPort, nOptions, pOptions );
return returnValue; return returnValue;
} }
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2P")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2P")]
private static extern Connection _ConnectP2P( IntPtr self, ref NetIdentity identityRemote, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ); private static extern Connection _ConnectP2P( IntPtr self, ref NetIdentity identityRemote, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Connection ConnectP2P( ref NetIdentity identityRemote, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ) internal Connection ConnectP2P( ref NetIdentity identityRemote, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _ConnectP2P( Self, ref identityRemote, nVirtualPort, nOptions, ref pOptions ); var returnValue = _ConnectP2P( Self, ref identityRemote, nVirtualPort, nOptions, pOptions );
return returnValue; return returnValue;
} }
@ -352,12 +352,12 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer")]
private static extern Connection _ConnectToHostedDedicatedServer( IntPtr self, ref NetIdentity identityTarget, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ); private static extern Connection _ConnectToHostedDedicatedServer( IntPtr self, ref NetIdentity identityTarget, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Connection ConnectToHostedDedicatedServer( ref NetIdentity identityTarget, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ) internal Connection ConnectToHostedDedicatedServer( ref NetIdentity identityTarget, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _ConnectToHostedDedicatedServer( Self, ref identityTarget, nVirtualPort, nOptions, ref pOptions ); var returnValue = _ConnectToHostedDedicatedServer( Self, ref identityTarget, nVirtualPort, nOptions, pOptions );
return returnValue; return returnValue;
} }
@ -396,12 +396,12 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket")]
private static extern Socket _CreateHostedDedicatedServerListenSocket( IntPtr self, int nVirtualPort, int nOptions, ref NetConfig_t pOptions ); private static extern Socket _CreateHostedDedicatedServerListenSocket( IntPtr self, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Socket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, ref NetConfig_t pOptions ) internal Socket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _CreateHostedDedicatedServerListenSocket( Self, nVirtualPort, nOptions, ref pOptions ); var returnValue = _CreateHostedDedicatedServerListenSocket( Self, nVirtualPort, nOptions, pOptions );
return returnValue; return returnValue;
} }
@ -418,12 +418,12 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2PCustomSignaling")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2PCustomSignaling")]
private static extern Connection _ConnectP2PCustomSignaling( IntPtr self, IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, ref NetConfig_t pOptions ); private static extern Connection _ConnectP2PCustomSignaling( IntPtr self, IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion #endregion
internal Connection ConnectP2PCustomSignaling( IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, ref NetConfig_t pOptions ) internal Connection ConnectP2PCustomSignaling( IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, [In,Out] NetKeyValue[] pOptions )
{ {
var returnValue = _ConnectP2PCustomSignaling( Self, pSignaling, ref pPeerIdentity, nOptions, ref pOptions ); var returnValue = _ConnectP2PCustomSignaling( Self, pSignaling, ref pPeerIdentity, nOptions, pOptions );
return returnValue; return returnValue;
} }

View File

@ -270,10 +270,10 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct")]
[return: MarshalAs( UnmanagedType.I1 )] [return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetConfigValueStruct( IntPtr self, ref NetConfig_t opt, NetConfigScope eScopeType, long scopeObj ); private static extern bool _SetConfigValueStruct( IntPtr self, ref NetKeyValue opt, NetConfigScope eScopeType, long scopeObj );
#endregion #endregion
internal bool SetConfigValueStruct( ref NetConfig_t opt, NetConfigScope eScopeType, long scopeObj ) internal bool SetConfigValueStruct( ref NetKeyValue opt, NetConfigScope eScopeType, long scopeObj )
{ {
var returnValue = _SetConfigValueStruct( Self, ref opt, eScopeType, scopeObj ); var returnValue = _SetConfigValueStruct( Self, ref opt, eScopeType, scopeObj );
return returnValue; return returnValue;

View File

@ -2037,7 +2037,7 @@ namespace Steamworks
// //
// ESteamNetworkingConfigScope // ESteamNetworkingConfigScope
// //
internal enum SteamNetworkingConfigScope : int internal enum NetConfigScope : int
{ {
Global = 1, Global = 1,
SocketsInterface = 2, SocketsInterface = 2,

View File

@ -195,20 +195,6 @@ namespace Steamworks.Data
} }
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct NetConfig_t
{
internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue
internal NetConfigType DataType; // m_eDataType ESteamNetworkingConfigDataType
internal long Nt64; // m_int64 int64_t
internal int Val_int32; // m_val_int32 int32_t
internal long Val_int64; // m_val_int64 int64_t
internal float Val_float; // m_val_float float
internal string Val_string; // m_val_string const char *
internal IntPtr Val_functionPtr; // m_val_functionPtr void *
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )] [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamDatagramHostedAddress internal struct SteamDatagramHostedAddress
{ {

View File

@ -0,0 +1,31 @@
using Steamworks.Data;
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )]
internal struct NetKeyValue
{
[FieldOffset(0)]
internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue
[FieldOffset( 4 )]
internal NetConfigType DataType; // m_eDataType ESteamNetworkingConfigDataType
[FieldOffset( 8 )]
internal long Int64Value; // m_int64 int64_t
[FieldOffset( 8 )]
internal int Int32Value; // m_val_int32 int32_t
[FieldOffset( 8 )]
internal float FloatValue; // m_val_float float
[FieldOffset( 8 )]
internal IntPtr PointerValue; // m_val_functionPtr void *
// TODO - support strings, maybe
}
}

View File

@ -34,6 +34,7 @@ public static class Cleanup
type = type.Replace( "SteamItemDef_t", "InventoryDefId" ); type = type.Replace( "SteamItemDef_t", "InventoryDefId" );
type = type.Replace( "ChatRoomEnterResponse", "RoomEnter" ); type = type.Replace( "ChatRoomEnterResponse", "RoomEnter" );
type = type.Replace( "SteamNetworkPingLocation_t", "PingLocation" ); type = type.Replace( "SteamNetworkPingLocation_t", "PingLocation" );
type = type.Replace( "SteamNetworkingConfigValue_t", "NetKeyValue" );
type = type.Replace( "SteamNetworkingConfigValue", "NetConfig" ); type = type.Replace( "SteamNetworkingConfigValue", "NetConfig" );
type = type.Replace( "SteamNetworkingConfigScope", "NetConfigScope" ); type = type.Replace( "SteamNetworkingConfigScope", "NetConfigScope" );
type = type.Replace( "SteamNetworkingConfigDataType", "NetConfigType" ); type = type.Replace( "SteamNetworkingConfigDataType", "NetConfigType" );
@ -81,6 +82,7 @@ public static class Cleanup
if ( type == "NetIdentity" ) return false; if ( type == "NetIdentity" ) return false;
if ( type == "SteamNetworkingQuickConnectionStatus" ) return false; if ( type == "SteamNetworkingQuickConnectionStatus" ) return false;
if ( type == "SteamNetworkingErrMsg" ) return false; if ( type == "SteamNetworkingErrMsg" ) return false;
if ( type == "NetKeyValue" ) return false;
return true; return true;
} }

View File

@ -62,6 +62,7 @@ internal class BaseType
if ( basicType == "AnalogState" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType }; if ( basicType == "AnalogState" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
if ( basicType == "MotionState" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType }; if ( basicType == "MotionState" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
if ( basicType == "NetMsg" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType }; if ( basicType == "NetMsg" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
if ( basicType == "NetKeyValue" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
if ( basicType.StartsWith( "E" ) && char.IsUpper( basicType[1] ) ) return new EnumType { NativeType = type.Substring( 1 ), VarName = varname }; if ( basicType.StartsWith( "E" ) && char.IsUpper( basicType[1] ) ) return new EnumType { NativeType = type.Substring( 1 ), VarName = varname };
if ( basicType.EndsWith( "_t" ) ) return new StructType { NativeType = type, VarName = varname, StructName = basicType }; if ( basicType.EndsWith( "_t" ) ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
@ -87,6 +88,7 @@ internal class BaseType
if ( Func == "ReadP2PPacket" ) return false; if ( Func == "ReadP2PPacket" ) return false;
if ( Func == "SendP2PPacket" ) return false; if ( Func == "SendP2PPacket" ) return false;
if ( VarName == "pOutMessageNumber" ) return false; if ( VarName == "pOutMessageNumber" ) return false;
if ( VarName == "pOptions" ) return true;
if ( VarName == "pOut" ) return false; if ( VarName == "pOut" ) return false;
if ( VarName == "pOutBuffer" ) return false; if ( VarName == "pOutBuffer" ) return false;