Fix MatchMakingKeyValuePair issues

This commit is contained in:
Garry Newman 2019-07-02 12:08:02 +01:00
parent 968e658913
commit 7a4f0c029a
5 changed files with 31 additions and 28 deletions

View File

@ -56,11 +56,11 @@ namespace Steamworks
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate HServerListRequest FRequestInternetServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private delegate HServerListRequest FRequestInternetServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private FRequestInternetServerList _RequestInternetServerList;
#endregion
internal HServerListRequest RequestInternetServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
internal HServerListRequest RequestInternetServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
{
return _RequestInternetServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
}
@ -78,44 +78,44 @@ namespace Steamworks
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate HServerListRequest FRequestFriendsServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private delegate HServerListRequest FRequestFriendsServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private FRequestFriendsServerList _RequestFriendsServerList;
#endregion
internal HServerListRequest RequestFriendsServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
internal HServerListRequest RequestFriendsServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
{
return _RequestFriendsServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate HServerListRequest FRequestFavoritesServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private delegate HServerListRequest FRequestFavoritesServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private FRequestFavoritesServerList _RequestFavoritesServerList;
#endregion
internal HServerListRequest RequestFavoritesServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
internal HServerListRequest RequestFavoritesServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
{
return _RequestFavoritesServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate HServerListRequest FRequestHistoryServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private delegate HServerListRequest FRequestHistoryServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private FRequestHistoryServerList _RequestHistoryServerList;
#endregion
internal HServerListRequest RequestHistoryServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
internal HServerListRequest RequestHistoryServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
{
return _RequestHistoryServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate HServerListRequest FRequestSpectatorServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private delegate HServerListRequest FRequestSpectatorServerList( IntPtr self, AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse );
private FRequestSpectatorServerList _RequestSpectatorServerList;
#endregion
internal HServerListRequest RequestSpectatorServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair_t[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
internal HServerListRequest RequestSpectatorServerList( AppId iApp, [In,Out] ref MatchMakingKeyValuePair[] ppchFilters, uint nFilters, IntPtr pRequestServersResponse )
{
return _RequestSpectatorServerList( Self, iApp, ref ppchFilters, nFilters, pRequestServersResponse );
}

View File

@ -1836,21 +1836,6 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal struct MatchMakingKeyValuePair_t
{
internal string KeyUTF8() => System.Text.Encoding.UTF8.GetString( Key, 0, System.Array.IndexOf<byte>( Key, 0 ) );
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] // byte[] m_szKey
internal byte[] Key; // m_szKey char [256]
internal string ValueUTF8() => System.Text.Encoding.UTF8.GetString( Value, 0, System.Array.IndexOf<byte>( Value, 0 ) );
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] // byte[] m_szValue
internal byte[] Value; // m_szValue char [256]
#region Marshalling
internal static MatchMakingKeyValuePair_t Fill( IntPtr p ) => ((MatchMakingKeyValuePair_t)(MatchMakingKeyValuePair_t) Marshal.PtrToStructure( p, typeof(MatchMakingKeyValuePair_t) ) );
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct servernetadr_t
{

View File

@ -122,12 +122,12 @@ namespace Steamworks.ServerList
#region Filters
internal List<MatchMakingKeyValuePair_t> filters = new List<MatchMakingKeyValuePair_t>();
internal virtual MatchMakingKeyValuePair_t[] GetFilters() => filters.ToArray();
internal List<MatchMakingKeyValuePair> filters = new List<MatchMakingKeyValuePair>();
internal virtual MatchMakingKeyValuePair[] GetFilters() => filters.ToArray();
public void AddFilter( string key, string value )
{
filters.Add( new MatchMakingKeyValuePair_t { Key = System.Text.Encoding.UTF8.GetBytes( key ), Value = System.Text.Encoding.UTF8.GetBytes( key ) } );
filters.Add( new MatchMakingKeyValuePair { Key = key, Value = value } );
}
#endregion

View File

@ -0,0 +1,16 @@
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal struct MatchMakingKeyValuePair
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
internal string Key;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
internal string Value;
}
}

View File

@ -43,6 +43,7 @@ public static class Cleanup
type = type.Replace( "InputDigitalActionData_t", "DigitalState" );
type = type.Replace( "InputAnalogActionData_t", "AnalogState" );
type = type.Replace( "InputMotionData_t", "MotionState" );
type = type.Replace( "MatchMakingKeyValuePair_t", "MatchMakingKeyValuePair" );
return type;
}
@ -56,6 +57,7 @@ public static class Cleanup
if ( type == "AnalogState" ) return false;
if ( type == "DigitalState" ) return false;
if ( type == "MotionState" ) return false;
if ( type == "MatchMakingKeyValuePair" ) return false;
return true;
}