Switched callbacks to dispatch system

This commit is contained in:
Garry Newman 2020-02-19 14:25:12 +00:00
parent f35a376cfc
commit f06e5a7960
39 changed files with 238 additions and 4305 deletions

View File

@ -1,43 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Steamworks.Data;
namespace Steamworks
{
[StructLayout( LayoutKind.Sequential )]
internal partial class Callback
{
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void Run( IntPtr thisptr, IntPtr pvParam );
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void RunCall( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate int GetCallbackSizeBytes( IntPtr thisptr );
internal enum Flags : byte
{
Registered = 0x01,
GameServer = 0x02
}
public IntPtr vTablePtr;
public byte CallbackFlags;
public int CallbackId;
//
// These are functions that are on CCallback but are never called
// We could just send a IntPtr.Zero but it's probably safer to throw a
// big apeshit message if steam changes its behaviour at some point
//
[MonoPInvokeCallback]
internal static void RunStub( IntPtr self, IntPtr param, bool failure, SteamAPICall_t call ) =>
throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the CallResult function [Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall )]" );
[MonoPInvokeCallback]
internal static int SizeStub( IntPtr self ) =>
throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the GetSize function [GetCallbackSizeBytes()]" );
};
}

View File

@ -8,11 +8,11 @@ using System.Threading.Tasks;
namespace Steamworks
{
internal struct CallbackResult<T> : INotifyCompletion where T : struct, ICallbackData
internal struct CallResult<T> : INotifyCompletion where T : struct, ICallbackData
{
SteamAPICall_t call;
public CallbackResult( SteamAPICall_t call )
public CallResult( SteamAPICall_t call )
{
this.call = call;
Console.WriteLine( $"{this.GetType().ToString()} == {call.Value}" );
@ -56,7 +56,7 @@ namespace Steamworks
}
}
internal CallbackResult<T> GetAwaiter()
internal CallResult<T> GetAwaiter()
{
return this;
}

View File

@ -1,135 +0,0 @@
using Steamworks.Data;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Steamworks
{
//
// Created on registration of a callback
//
internal class Event : IDisposable
{
internal static List<IDisposable> AllClient = new List<IDisposable>();
internal static List<IDisposable> AllServer = new List<IDisposable>();
internal static void DisposeAllClient()
{
foreach ( var a in AllClient.ToArray() )
{
a.Dispose();
}
AllClient.Clear();
}
internal static void DisposeAllServer()
{
foreach ( var a in AllServer.ToArray() )
{
a.Dispose();
}
AllServer.Clear();
}
internal static void Register( Callback.Run func, int size, int callbackId, bool gameserver )
{
var r = new Event();
r.vTablePtr = BuildVTable( func, r.Allocations );
//
// Create the callback object
//
var cb = new Callback();
cb.vTablePtr = r.vTablePtr;
cb.CallbackFlags = gameserver ? (byte)0x02 : (byte)0;
cb.CallbackId = callbackId;
//
// Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native
//
r.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned );
//
// Register the callback with Steam
//
SteamClient.RegisterCallback( r.PinnedCallback.AddrOfPinnedObject(), cb.CallbackId );
r.IsAllocated = true;
if ( gameserver )
Event.AllServer.Add( r );
else
Event.AllClient.Add( r );
}
static IntPtr BuildVTable( Callback.Run run, List<GCHandle> allocations )
{
var RunStub = (Callback.RunCall)Callback.RunStub;
var SizeStub = (Callback.GetCallbackSizeBytes)Callback.SizeStub;
allocations.Add( GCHandle.Alloc( run ) );
allocations.Add( GCHandle.Alloc( RunStub ) );
allocations.Add( GCHandle.Alloc( SizeStub ) );
var a = Marshal.GetFunctionPointerForDelegate<Callback.Run>( run );
var b = Marshal.GetFunctionPointerForDelegate<Callback.RunCall>( RunStub );
var c = Marshal.GetFunctionPointerForDelegate<Callback.GetCallbackSizeBytes>( SizeStub );
var vt = Marshal.AllocHGlobal( IntPtr.Size * 3 );
// Windows switches the function positions
#if PLATFORM_WIN
Marshal.WriteIntPtr( vt, IntPtr.Size * 0, b );
Marshal.WriteIntPtr( vt, IntPtr.Size * 1, a );
Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c );
#else
Marshal.WriteIntPtr( vt, IntPtr.Size * 0, a );
Marshal.WriteIntPtr( vt, IntPtr.Size * 1, b );
Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c );
#endif
return vt;
}
bool IsAllocated;
List<GCHandle> Allocations = new List<GCHandle>();
internal IntPtr vTablePtr;
internal GCHandle PinnedCallback;
public void Dispose()
{
if ( !IsAllocated ) return;
IsAllocated = false;
if ( !PinnedCallback.IsAllocated )
throw new System.Exception( "Callback isn't allocated!?" );
SteamClient.UnregisterCallback( PinnedCallback.AddrOfPinnedObject() );
foreach ( var a in Allocations )
{
if ( a.IsAllocated )
a.Free();
}
Allocations = null;
PinnedCallback.Free();
if ( vTablePtr != IntPtr.Zero )
{
Marshal.FreeHGlobal( vTablePtr );
vTablePtr = IntPtr.Zero;
}
}
~Event()
{
Dispose();
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Steamworks.Data;
using Steamworks;
namespace Steamworks
{
@ -17,8 +18,8 @@ namespace Steamworks
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_GetNextCallback", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
internal static extern bool SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe pipe, [In, Out] ref CallbackMsg_t msg );
internal static extern bool SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe pipe, [In, Out] ref CallbackMsg_t msg );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_FreeLastCallback", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
internal static extern bool SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe pipe );
@ -83,20 +84,20 @@ namespace Steamworks
private static void ProcessResult( CallbackMsg_t msg )
{
var result = SteamAPICallCompleted_t.Fill( msg.m_pubParam );
var result = msg.m_pubParam.ToType<SteamAPICallCompleted_t>();
Console.WriteLine( $"Result: {result.AsyncCall} / {result.Callback}" );
//
// Do we have an entry added via OnCallComplete
//
if ( !Callbacks.TryGetValue( result.AsyncCall, out var callbackInfo ) )
if ( !ResultCallbacks.TryGetValue( result.AsyncCall, out var callbackInfo ) )
{
// Do we care? Should we throw errors?
return;
}
Callbacks.Remove( result.AsyncCall );
ResultCallbacks.Remove( result.AsyncCall );
// At this point whatever async routine called this
// continues running.
@ -125,22 +126,55 @@ namespace Steamworks
Console.WriteLine( $"Exiting ServerPipe: {ServerPipe}" );
}
struct CallbackInfo
struct ResultCallback
{
public Action continuation;
}
static Dictionary<ulong, CallbackInfo> Callbacks = new Dictionary<ulong, CallbackInfo>();
static Dictionary<ulong, ResultCallback> ResultCallbacks = new Dictionary<ulong, ResultCallback>();
/// <summary>
/// Watch for a steam api call
/// </summary>
internal static void OnCallComplete( SteamAPICall_t call, Action continuation )
{
Callbacks[call.Value] = new CallbackInfo
ResultCallbacks[call.Value] = new ResultCallback
{
continuation = continuation
};
}
struct Callback
{
public Action<IntPtr> action;
public bool server;
}
static Dictionary<int, List<Callback>> Callbacks = new Dictionary<int, List<Callback>>();
internal static void Install<T>( Action<T> p, bool server = false ) where T : ICallbackData
{
var t = default( T );
if ( !Callbacks.TryGetValue( t.CallbackId, out var list ) )
{
list = new List<Callback>();
Callbacks[t.CallbackId] = list;
}
list.Add( new Callback
{
action = x => p( x.ToType<T>() ),
server = server
} );
}
internal static void Wipe()
{
Callbacks = new Dictionary<int, List<Callback>>();
ResultCallbacks = new Dictionary<ulong, ResultCallback>();
ClientPipe = 0;
ServerPipe = 0;
}
}
}

View File

@ -317,10 +317,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetFileDetails( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName );
#endregion
internal CallbackResult<FileDetailsResult_t> GetFileDetails( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName )
internal CallResult<FileDetailsResult_t> GetFileDetails( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName )
{
var returnValue = _GetFileDetails( Self, pszFileName );
return new CallbackResult<FileDetailsResult_t>( returnValue );
return new CallResult<FileDetailsResult_t>( returnValue );
}
#region FunctionMeta

View File

@ -36,10 +36,10 @@ namespace Steamworks
private static extern SteamAPICall_t _SetPersonaName( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPersonaName );
#endregion
internal CallbackResult<SetPersonaNameResponse_t> SetPersonaName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPersonaName )
internal CallResult<SetPersonaNameResponse_t> SetPersonaName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPersonaName )
{
var returnValue = _SetPersonaName( Self, pchPersonaName );
return new CallbackResult<SetPersonaNameResponse_t>( returnValue );
return new CallResult<SetPersonaNameResponse_t>( returnValue );
}
#region FunctionMeta
@ -280,10 +280,10 @@ namespace Steamworks
private static extern SteamAPICall_t _DownloadClanActivityCounts( IntPtr self, [In,Out] SteamId[] psteamIDClans, int cClansToRequest );
#endregion
internal CallbackResult<DownloadClanActivityCountsResult_t> DownloadClanActivityCounts( [In,Out] SteamId[] psteamIDClans, int cClansToRequest )
internal CallResult<DownloadClanActivityCountsResult_t> DownloadClanActivityCounts( [In,Out] SteamId[] psteamIDClans, int cClansToRequest )
{
var returnValue = _DownloadClanActivityCounts( Self, psteamIDClans, cClansToRequest );
return new CallbackResult<DownloadClanActivityCountsResult_t>( returnValue );
return new CallResult<DownloadClanActivityCountsResult_t>( returnValue );
}
#region FunctionMeta
@ -440,10 +440,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestClanOfficerList( IntPtr self, SteamId steamIDClan );
#endregion
internal CallbackResult<ClanOfficerListResponse_t> RequestClanOfficerList( SteamId steamIDClan )
internal CallResult<ClanOfficerListResponse_t> RequestClanOfficerList( SteamId steamIDClan )
{
var returnValue = _RequestClanOfficerList( Self, steamIDClan );
return new CallbackResult<ClanOfficerListResponse_t>( returnValue );
return new CallResult<ClanOfficerListResponse_t>( returnValue );
}
#region FunctionMeta
@ -616,10 +616,10 @@ namespace Steamworks
private static extern SteamAPICall_t _JoinClanChatRoom( IntPtr self, SteamId steamIDClan );
#endregion
internal CallbackResult<JoinClanChatRoomCompletionResult_t> JoinClanChatRoom( SteamId steamIDClan )
internal CallResult<JoinClanChatRoomCompletionResult_t> JoinClanChatRoom( SteamId steamIDClan )
{
var returnValue = _JoinClanChatRoom( Self, steamIDClan );
return new CallbackResult<JoinClanChatRoomCompletionResult_t>( returnValue );
return new CallResult<JoinClanChatRoomCompletionResult_t>( returnValue );
}
#region FunctionMeta
@ -767,10 +767,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetFollowerCount( IntPtr self, SteamId steamID );
#endregion
internal CallbackResult<FriendsGetFollowerCount_t> GetFollowerCount( SteamId steamID )
internal CallResult<FriendsGetFollowerCount_t> GetFollowerCount( SteamId steamID )
{
var returnValue = _GetFollowerCount( Self, steamID );
return new CallbackResult<FriendsGetFollowerCount_t>( returnValue );
return new CallResult<FriendsGetFollowerCount_t>( returnValue );
}
#region FunctionMeta
@ -778,10 +778,10 @@ namespace Steamworks
private static extern SteamAPICall_t _IsFollowing( IntPtr self, SteamId steamID );
#endregion
internal CallbackResult<FriendsIsFollowing_t> IsFollowing( SteamId steamID )
internal CallResult<FriendsIsFollowing_t> IsFollowing( SteamId steamID )
{
var returnValue = _IsFollowing( Self, steamID );
return new CallbackResult<FriendsIsFollowing_t>( returnValue );
return new CallResult<FriendsIsFollowing_t>( returnValue );
}
#region FunctionMeta
@ -789,10 +789,10 @@ namespace Steamworks
private static extern SteamAPICall_t _EnumerateFollowingList( IntPtr self, uint unStartIndex );
#endregion
internal CallbackResult<FriendsEnumerateFollowingList_t> EnumerateFollowingList( uint unStartIndex )
internal CallResult<FriendsEnumerateFollowingList_t> EnumerateFollowingList( uint unStartIndex )
{
var returnValue = _EnumerateFollowingList( Self, unStartIndex );
return new CallbackResult<FriendsEnumerateFollowingList_t>( returnValue );
return new CallResult<FriendsEnumerateFollowingList_t>( returnValue );
}
#region FunctionMeta

View File

@ -382,10 +382,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetServerReputation( IntPtr self );
#endregion
internal CallbackResult<GSReputation_t> GetServerReputation()
internal CallResult<GSReputation_t> GetServerReputation()
{
var returnValue = _GetServerReputation( Self );
return new CallbackResult<GSReputation_t>( returnValue );
return new CallResult<GSReputation_t>( returnValue );
}
#region FunctionMeta
@ -457,10 +457,10 @@ namespace Steamworks
private static extern SteamAPICall_t _AssociateWithClan( IntPtr self, SteamId steamIDClan );
#endregion
internal CallbackResult<AssociateWithClanResult_t> AssociateWithClan( SteamId steamIDClan )
internal CallResult<AssociateWithClanResult_t> AssociateWithClan( SteamId steamIDClan )
{
var returnValue = _AssociateWithClan( Self, steamIDClan );
return new CallbackResult<AssociateWithClanResult_t>( returnValue );
return new CallResult<AssociateWithClanResult_t>( returnValue );
}
#region FunctionMeta
@ -468,10 +468,10 @@ namespace Steamworks
private static extern SteamAPICall_t _ComputeNewPlayerCompatibility( IntPtr self, SteamId steamIDNewPlayer );
#endregion
internal CallbackResult<ComputeNewPlayerCompatibilityResult_t> ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer )
internal CallResult<ComputeNewPlayerCompatibilityResult_t> ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer )
{
var returnValue = _ComputeNewPlayerCompatibility( Self, steamIDNewPlayer );
return new CallbackResult<ComputeNewPlayerCompatibilityResult_t>( returnValue );
return new CallResult<ComputeNewPlayerCompatibilityResult_t>( returnValue );
}
}

View File

@ -25,10 +25,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestUserStats( IntPtr self, SteamId steamIDUser );
#endregion
internal CallbackResult<GSStatsReceived_t> RequestUserStats( SteamId steamIDUser )
internal CallResult<GSStatsReceived_t> RequestUserStats( SteamId steamIDUser )
{
var returnValue = _RequestUserStats( Self, steamIDUser );
return new CallbackResult<GSStatsReceived_t>( returnValue );
return new CallResult<GSStatsReceived_t>( returnValue );
}
#region FunctionMeta
@ -132,10 +132,10 @@ namespace Steamworks
private static extern SteamAPICall_t _StoreUserStats( IntPtr self, SteamId steamIDUser );
#endregion
internal CallbackResult<GSStatsStored_t> StoreUserStats( SteamId steamIDUser )
internal CallResult<GSStatsStored_t> StoreUserStats( SteamId steamIDUser )
{
var returnValue = _StoreUserStats( Self, steamIDUser );
return new CallbackResult<GSStatsStored_t>( returnValue );
return new CallResult<GSStatsStored_t>( returnValue );
}
}

View File

@ -49,10 +49,10 @@ namespace Steamworks
private static extern SteamAPICall_t _CreateBrowser( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserAgent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserCSS );
#endregion
internal CallbackResult<HTML_BrowserReady_t> CreateBrowser( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserAgent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserCSS )
internal CallResult<HTML_BrowserReady_t> CreateBrowser( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserAgent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserCSS )
{
var returnValue = _CreateBrowser( Self, pchUserAgent, pchUserCSS );
return new CallbackResult<HTML_BrowserReady_t>( returnValue );
return new CallResult<HTML_BrowserReady_t>( returnValue );
}
#region FunctionMeta

View File

@ -338,10 +338,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestEligiblePromoItemDefinitionsIDs( IntPtr self, SteamId steamID );
#endregion
internal CallbackResult<SteamInventoryEligiblePromoItemDefIDs_t> RequestEligiblePromoItemDefinitionsIDs( SteamId steamID )
internal CallResult<SteamInventoryEligiblePromoItemDefIDs_t> RequestEligiblePromoItemDefinitionsIDs( SteamId steamID )
{
var returnValue = _RequestEligiblePromoItemDefinitionsIDs( Self, steamID );
return new CallbackResult<SteamInventoryEligiblePromoItemDefIDs_t>( returnValue );
return new CallResult<SteamInventoryEligiblePromoItemDefIDs_t>( returnValue );
}
#region FunctionMeta
@ -361,10 +361,10 @@ namespace Steamworks
private static extern SteamAPICall_t _StartPurchase( IntPtr self, [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength );
#endregion
internal CallbackResult<SteamInventoryStartPurchaseResult_t> StartPurchase( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength )
internal CallResult<SteamInventoryStartPurchaseResult_t> StartPurchase( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength )
{
var returnValue = _StartPurchase( Self, pArrayItemDefs, punArrayQuantity, unArrayLength );
return new CallbackResult<SteamInventoryStartPurchaseResult_t>( returnValue );
return new CallResult<SteamInventoryStartPurchaseResult_t>( returnValue );
}
#region FunctionMeta
@ -372,10 +372,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestPrices( IntPtr self );
#endregion
internal CallbackResult<SteamInventoryRequestPricesResult_t> RequestPrices()
internal CallResult<SteamInventoryRequestPricesResult_t> RequestPrices()
{
var returnValue = _RequestPrices( Self );
return new CallbackResult<SteamInventoryRequestPricesResult_t>( returnValue );
return new CallResult<SteamInventoryRequestPricesResult_t>( returnValue );
}
#region FunctionMeta

View File

@ -71,10 +71,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestLobbyList( IntPtr self );
#endregion
internal CallbackResult<LobbyMatchList_t> RequestLobbyList()
internal CallResult<LobbyMatchList_t> RequestLobbyList()
{
var returnValue = _RequestLobbyList( Self );
return new CallbackResult<LobbyMatchList_t>( returnValue );
return new CallResult<LobbyMatchList_t>( returnValue );
}
#region FunctionMeta
@ -163,10 +163,10 @@ namespace Steamworks
private static extern SteamAPICall_t _CreateLobby( IntPtr self, LobbyType eLobbyType, int cMaxMembers );
#endregion
internal CallbackResult<LobbyCreated_t> CreateLobby( LobbyType eLobbyType, int cMaxMembers )
internal CallResult<LobbyCreated_t> CreateLobby( LobbyType eLobbyType, int cMaxMembers )
{
var returnValue = _CreateLobby( Self, eLobbyType, cMaxMembers );
return new CallbackResult<LobbyCreated_t>( returnValue );
return new CallResult<LobbyCreated_t>( returnValue );
}
#region FunctionMeta
@ -174,10 +174,10 @@ namespace Steamworks
private static extern SteamAPICall_t _JoinLobby( IntPtr self, SteamId steamIDLobby );
#endregion
internal CallbackResult<LobbyEnter_t> JoinLobby( SteamId steamIDLobby )
internal CallResult<LobbyEnter_t> JoinLobby( SteamId steamIDLobby )
{
var returnValue = _JoinLobby( Self, steamIDLobby );
return new CallbackResult<LobbyEnter_t>( returnValue );
return new CallResult<LobbyEnter_t>( returnValue );
}
#region FunctionMeta

View File

@ -61,10 +61,10 @@ namespace Steamworks
private static extern SteamAPICall_t _JoinParty( IntPtr self, PartyBeaconID_t ulBeaconID );
#endregion
internal CallbackResult<JoinPartyCallback_t> JoinParty( PartyBeaconID_t ulBeaconID )
internal CallResult<JoinPartyCallback_t> JoinParty( PartyBeaconID_t ulBeaconID )
{
var returnValue = _JoinParty( Self, ulBeaconID );
return new CallbackResult<JoinPartyCallback_t>( returnValue );
return new CallResult<JoinPartyCallback_t>( returnValue );
}
#region FunctionMeta
@ -96,10 +96,10 @@ namespace Steamworks
private static extern SteamAPICall_t _CreateBeacon( IntPtr self, uint unOpenSlots, ref SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata );
#endregion
internal CallbackResult<CreateBeaconCallback_t> CreateBeacon( uint unOpenSlots, /* ref */ SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata )
internal CallResult<CreateBeaconCallback_t> CreateBeacon( uint unOpenSlots, /* ref */ SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata )
{
var returnValue = _CreateBeacon( Self, unOpenSlots, ref pBeaconLocation, pchConnectString, pchMetadata );
return new CallbackResult<CreateBeaconCallback_t>( returnValue );
return new CallResult<CreateBeaconCallback_t>( returnValue );
}
#region FunctionMeta
@ -127,10 +127,10 @@ namespace Steamworks
private static extern SteamAPICall_t _ChangeNumOpenSlots( IntPtr self, PartyBeaconID_t ulBeacon, uint unOpenSlots );
#endregion
internal CallbackResult<ChangeNumOpenSlotsCallback_t> ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint unOpenSlots )
internal CallResult<ChangeNumOpenSlotsCallback_t> ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint unOpenSlots )
{
var returnValue = _ChangeNumOpenSlots( Self, ulBeacon, unOpenSlots );
return new CallbackResult<ChangeNumOpenSlotsCallback_t>( returnValue );
return new CallResult<ChangeNumOpenSlotsCallback_t>( returnValue );
}
#region FunctionMeta

View File

@ -48,10 +48,10 @@ namespace Steamworks
private static extern SteamAPICall_t _FileWriteAsync( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData );
#endregion
internal CallbackResult<RemoteStorageFileWriteAsyncComplete_t> FileWriteAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData )
internal CallResult<RemoteStorageFileWriteAsyncComplete_t> FileWriteAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData )
{
var returnValue = _FileWriteAsync( Self, pchFile, pvData, cubData );
return new CallbackResult<RemoteStorageFileWriteAsyncComplete_t>( returnValue );
return new CallResult<RemoteStorageFileWriteAsyncComplete_t>( returnValue );
}
#region FunctionMeta
@ -59,10 +59,10 @@ namespace Steamworks
private static extern SteamAPICall_t _FileReadAsync( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead );
#endregion
internal CallbackResult<RemoteStorageFileReadAsyncComplete_t> FileReadAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead )
internal CallResult<RemoteStorageFileReadAsyncComplete_t> FileReadAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead )
{
var returnValue = _FileReadAsync( Self, pchFile, nOffset, cubToRead );
return new CallbackResult<RemoteStorageFileReadAsyncComplete_t>( returnValue );
return new CallResult<RemoteStorageFileReadAsyncComplete_t>( returnValue );
}
#region FunctionMeta
@ -106,10 +106,10 @@ namespace Steamworks
private static extern SteamAPICall_t _FileShare( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile );
#endregion
internal CallbackResult<RemoteStorageFileShareResult_t> FileShare( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
internal CallResult<RemoteStorageFileShareResult_t> FileShare( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile )
{
var returnValue = _FileShare( Self, pchFile );
return new CallbackResult<RemoteStorageFileShareResult_t>( returnValue );
return new CallResult<RemoteStorageFileShareResult_t>( returnValue );
}
#region FunctionMeta
@ -301,10 +301,10 @@ namespace Steamworks
private static extern SteamAPICall_t _UGCDownload( IntPtr self, UGCHandle_t hContent, uint unPriority );
#endregion
internal CallbackResult<RemoteStorageDownloadUGCResult_t> UGCDownload( UGCHandle_t hContent, uint unPriority )
internal CallResult<RemoteStorageDownloadUGCResult_t> UGCDownload( UGCHandle_t hContent, uint unPriority )
{
var returnValue = _UGCDownload( Self, hContent, unPriority );
return new CallbackResult<RemoteStorageDownloadUGCResult_t>( returnValue );
return new CallResult<RemoteStorageDownloadUGCResult_t>( returnValue );
}
#region FunctionMeta
@ -369,10 +369,10 @@ namespace Steamworks
private static extern SteamAPICall_t _UGCDownloadToLocation( IntPtr self, UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority );
#endregion
internal CallbackResult<RemoteStorageDownloadUGCResult_t> UGCDownloadToLocation( UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority )
internal CallResult<RemoteStorageDownloadUGCResult_t> UGCDownloadToLocation( UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority )
{
var returnValue = _UGCDownloadToLocation( Self, hContent, pchLocation, unPriority );
return new CallbackResult<RemoteStorageDownloadUGCResult_t>( returnValue );
return new CallResult<RemoteStorageDownloadUGCResult_t>( returnValue );
}
}

View File

@ -72,10 +72,10 @@ namespace Steamworks
private static extern SteamAPICall_t _SendQueryUGCRequest( IntPtr self, UGCQueryHandle_t handle );
#endregion
internal CallbackResult<SteamUGCQueryCompleted_t> SendQueryUGCRequest( UGCQueryHandle_t handle )
internal CallResult<SteamUGCQueryCompleted_t> SendQueryUGCRequest( UGCQueryHandle_t handle )
{
var returnValue = _SendQueryUGCRequest( Self, handle );
return new CallbackResult<SteamUGCQueryCompleted_t>( returnValue );
return new CallResult<SteamUGCQueryCompleted_t>( returnValue );
}
#region FunctionMeta
@ -443,10 +443,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestUGCDetails( IntPtr self, PublishedFileId nPublishedFileID, uint unMaxAgeSeconds );
#endregion
internal CallbackResult<SteamUGCRequestUGCDetailsResult_t> RequestUGCDetails( PublishedFileId nPublishedFileID, uint unMaxAgeSeconds )
internal CallResult<SteamUGCRequestUGCDetailsResult_t> RequestUGCDetails( PublishedFileId nPublishedFileID, uint unMaxAgeSeconds )
{
var returnValue = _RequestUGCDetails( Self, nPublishedFileID, unMaxAgeSeconds );
return new CallbackResult<SteamUGCRequestUGCDetailsResult_t>( returnValue );
return new CallResult<SteamUGCRequestUGCDetailsResult_t>( returnValue );
}
#region FunctionMeta
@ -454,10 +454,10 @@ namespace Steamworks
private static extern SteamAPICall_t _CreateItem( IntPtr self, AppId nConsumerAppId, WorkshopFileType eFileType );
#endregion
internal CallbackResult<CreateItemResult_t> CreateItem( AppId nConsumerAppId, WorkshopFileType eFileType )
internal CallResult<CreateItemResult_t> CreateItem( AppId nConsumerAppId, WorkshopFileType eFileType )
{
var returnValue = _CreateItem( Self, nConsumerAppId, eFileType );
return new CallbackResult<CreateItemResult_t>( returnValue );
return new CallResult<CreateItemResult_t>( returnValue );
}
#region FunctionMeta
@ -680,10 +680,10 @@ namespace Steamworks
private static extern SteamAPICall_t _SubmitItemUpdate( IntPtr self, UGCUpdateHandle_t handle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchChangeNote );
#endregion
internal CallbackResult<SubmitItemUpdateResult_t> SubmitItemUpdate( UGCUpdateHandle_t handle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchChangeNote )
internal CallResult<SubmitItemUpdateResult_t> SubmitItemUpdate( UGCUpdateHandle_t handle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchChangeNote )
{
var returnValue = _SubmitItemUpdate( Self, handle, pchChangeNote );
return new CallbackResult<SubmitItemUpdateResult_t>( returnValue );
return new CallResult<SubmitItemUpdateResult_t>( returnValue );
}
#region FunctionMeta
@ -702,10 +702,10 @@ namespace Steamworks
private static extern SteamAPICall_t _SetUserItemVote( IntPtr self, PublishedFileId nPublishedFileID, [MarshalAs( UnmanagedType.U1 )] bool bVoteUp );
#endregion
internal CallbackResult<SetUserItemVoteResult_t> SetUserItemVote( PublishedFileId nPublishedFileID, [MarshalAs( UnmanagedType.U1 )] bool bVoteUp )
internal CallResult<SetUserItemVoteResult_t> SetUserItemVote( PublishedFileId nPublishedFileID, [MarshalAs( UnmanagedType.U1 )] bool bVoteUp )
{
var returnValue = _SetUserItemVote( Self, nPublishedFileID, bVoteUp );
return new CallbackResult<SetUserItemVoteResult_t>( returnValue );
return new CallResult<SetUserItemVoteResult_t>( returnValue );
}
#region FunctionMeta
@ -713,10 +713,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetUserItemVote( IntPtr self, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<GetUserItemVoteResult_t> GetUserItemVote( PublishedFileId nPublishedFileID )
internal CallResult<GetUserItemVoteResult_t> GetUserItemVote( PublishedFileId nPublishedFileID )
{
var returnValue = _GetUserItemVote( Self, nPublishedFileID );
return new CallbackResult<GetUserItemVoteResult_t>( returnValue );
return new CallResult<GetUserItemVoteResult_t>( returnValue );
}
#region FunctionMeta
@ -724,10 +724,10 @@ namespace Steamworks
private static extern SteamAPICall_t _AddItemToFavorites( IntPtr self, AppId nAppId, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<UserFavoriteItemsListChanged_t> AddItemToFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
internal CallResult<UserFavoriteItemsListChanged_t> AddItemToFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
{
var returnValue = _AddItemToFavorites( Self, nAppId, nPublishedFileID );
return new CallbackResult<UserFavoriteItemsListChanged_t>( returnValue );
return new CallResult<UserFavoriteItemsListChanged_t>( returnValue );
}
#region FunctionMeta
@ -735,10 +735,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RemoveItemFromFavorites( IntPtr self, AppId nAppId, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<UserFavoriteItemsListChanged_t> RemoveItemFromFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
internal CallResult<UserFavoriteItemsListChanged_t> RemoveItemFromFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
{
var returnValue = _RemoveItemFromFavorites( Self, nAppId, nPublishedFileID );
return new CallbackResult<UserFavoriteItemsListChanged_t>( returnValue );
return new CallResult<UserFavoriteItemsListChanged_t>( returnValue );
}
#region FunctionMeta
@ -746,10 +746,10 @@ namespace Steamworks
private static extern SteamAPICall_t _SubscribeItem( IntPtr self, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<RemoteStorageSubscribePublishedFileResult_t> SubscribeItem( PublishedFileId nPublishedFileID )
internal CallResult<RemoteStorageSubscribePublishedFileResult_t> SubscribeItem( PublishedFileId nPublishedFileID )
{
var returnValue = _SubscribeItem( Self, nPublishedFileID );
return new CallbackResult<RemoteStorageSubscribePublishedFileResult_t>( returnValue );
return new CallResult<RemoteStorageSubscribePublishedFileResult_t>( returnValue );
}
#region FunctionMeta
@ -757,10 +757,10 @@ namespace Steamworks
private static extern SteamAPICall_t _UnsubscribeItem( IntPtr self, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<RemoteStorageUnsubscribePublishedFileResult_t> UnsubscribeItem( PublishedFileId nPublishedFileID )
internal CallResult<RemoteStorageUnsubscribePublishedFileResult_t> UnsubscribeItem( PublishedFileId nPublishedFileID )
{
var returnValue = _UnsubscribeItem( Self, nPublishedFileID );
return new CallbackResult<RemoteStorageUnsubscribePublishedFileResult_t>( returnValue );
return new CallResult<RemoteStorageUnsubscribePublishedFileResult_t>( returnValue );
}
#region FunctionMeta
@ -861,10 +861,10 @@ namespace Steamworks
private static extern SteamAPICall_t _StartPlaytimeTracking( IntPtr self, [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs );
#endregion
internal CallbackResult<StartPlaytimeTrackingResult_t> StartPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
internal CallResult<StartPlaytimeTrackingResult_t> StartPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
{
var returnValue = _StartPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs );
return new CallbackResult<StartPlaytimeTrackingResult_t>( returnValue );
return new CallResult<StartPlaytimeTrackingResult_t>( returnValue );
}
#region FunctionMeta
@ -872,10 +872,10 @@ namespace Steamworks
private static extern SteamAPICall_t _StopPlaytimeTracking( IntPtr self, [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs );
#endregion
internal CallbackResult<StopPlaytimeTrackingResult_t> StopPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
internal CallResult<StopPlaytimeTrackingResult_t> StopPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
{
var returnValue = _StopPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs );
return new CallbackResult<StopPlaytimeTrackingResult_t>( returnValue );
return new CallResult<StopPlaytimeTrackingResult_t>( returnValue );
}
#region FunctionMeta
@ -883,10 +883,10 @@ namespace Steamworks
private static extern SteamAPICall_t _StopPlaytimeTrackingForAllItems( IntPtr self );
#endregion
internal CallbackResult<StopPlaytimeTrackingResult_t> StopPlaytimeTrackingForAllItems()
internal CallResult<StopPlaytimeTrackingResult_t> StopPlaytimeTrackingForAllItems()
{
var returnValue = _StopPlaytimeTrackingForAllItems( Self );
return new CallbackResult<StopPlaytimeTrackingResult_t>( returnValue );
return new CallResult<StopPlaytimeTrackingResult_t>( returnValue );
}
#region FunctionMeta
@ -894,10 +894,10 @@ namespace Steamworks
private static extern SteamAPICall_t _AddDependency( IntPtr self, PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID );
#endregion
internal CallbackResult<AddUGCDependencyResult_t> AddDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
internal CallResult<AddUGCDependencyResult_t> AddDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
{
var returnValue = _AddDependency( Self, nParentPublishedFileID, nChildPublishedFileID );
return new CallbackResult<AddUGCDependencyResult_t>( returnValue );
return new CallResult<AddUGCDependencyResult_t>( returnValue );
}
#region FunctionMeta
@ -905,10 +905,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RemoveDependency( IntPtr self, PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID );
#endregion
internal CallbackResult<RemoveUGCDependencyResult_t> RemoveDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
internal CallResult<RemoveUGCDependencyResult_t> RemoveDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
{
var returnValue = _RemoveDependency( Self, nParentPublishedFileID, nChildPublishedFileID );
return new CallbackResult<RemoveUGCDependencyResult_t>( returnValue );
return new CallResult<RemoveUGCDependencyResult_t>( returnValue );
}
#region FunctionMeta
@ -916,10 +916,10 @@ namespace Steamworks
private static extern SteamAPICall_t _AddAppDependency( IntPtr self, PublishedFileId nPublishedFileID, AppId nAppID );
#endregion
internal CallbackResult<AddAppDependencyResult_t> AddAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
internal CallResult<AddAppDependencyResult_t> AddAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
{
var returnValue = _AddAppDependency( Self, nPublishedFileID, nAppID );
return new CallbackResult<AddAppDependencyResult_t>( returnValue );
return new CallResult<AddAppDependencyResult_t>( returnValue );
}
#region FunctionMeta
@ -927,10 +927,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RemoveAppDependency( IntPtr self, PublishedFileId nPublishedFileID, AppId nAppID );
#endregion
internal CallbackResult<RemoveAppDependencyResult_t> RemoveAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
internal CallResult<RemoveAppDependencyResult_t> RemoveAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
{
var returnValue = _RemoveAppDependency( Self, nPublishedFileID, nAppID );
return new CallbackResult<RemoveAppDependencyResult_t>( returnValue );
return new CallResult<RemoveAppDependencyResult_t>( returnValue );
}
#region FunctionMeta
@ -938,10 +938,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetAppDependencies( IntPtr self, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<GetAppDependenciesResult_t> GetAppDependencies( PublishedFileId nPublishedFileID )
internal CallResult<GetAppDependenciesResult_t> GetAppDependencies( PublishedFileId nPublishedFileID )
{
var returnValue = _GetAppDependencies( Self, nPublishedFileID );
return new CallbackResult<GetAppDependenciesResult_t>( returnValue );
return new CallResult<GetAppDependenciesResult_t>( returnValue );
}
#region FunctionMeta
@ -949,10 +949,10 @@ namespace Steamworks
private static extern SteamAPICall_t _DeleteItem( IntPtr self, PublishedFileId nPublishedFileID );
#endregion
internal CallbackResult<DeleteItemResult_t> DeleteItem( PublishedFileId nPublishedFileID )
internal CallResult<DeleteItemResult_t> DeleteItem( PublishedFileId nPublishedFileID )
{
var returnValue = _DeleteItem( Self, nPublishedFileID );
return new CallbackResult<DeleteItemResult_t>( returnValue );
return new CallResult<DeleteItemResult_t>( returnValue );
}
}

View File

@ -243,10 +243,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestEncryptedAppTicket( IntPtr self, IntPtr pDataToInclude, int cbDataToInclude );
#endregion
internal CallbackResult<EncryptedAppTicketResponse_t> RequestEncryptedAppTicket( IntPtr pDataToInclude, int cbDataToInclude )
internal CallResult<EncryptedAppTicketResponse_t> RequestEncryptedAppTicket( IntPtr pDataToInclude, int cbDataToInclude )
{
var returnValue = _RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude );
return new CallbackResult<EncryptedAppTicketResponse_t>( returnValue );
return new CallResult<EncryptedAppTicketResponse_t>( returnValue );
}
#region FunctionMeta
@ -288,10 +288,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestStoreAuthURL( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL );
#endregion
internal CallbackResult<StoreAuthURLResponse_t> RequestStoreAuthURL( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL )
internal CallResult<StoreAuthURLResponse_t> RequestStoreAuthURL( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL )
{
var returnValue = _RequestStoreAuthURL( Self, pchRedirectURL );
return new CallbackResult<StoreAuthURLResponse_t>( returnValue );
return new CallResult<StoreAuthURLResponse_t>( returnValue );
}
#region FunctionMeta
@ -347,10 +347,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetMarketEligibility( IntPtr self );
#endregion
internal CallbackResult<MarketEligibilityResponse_t> GetMarketEligibility()
internal CallResult<MarketEligibilityResponse_t> GetMarketEligibility()
{
var returnValue = _GetMarketEligibility( Self );
return new CallbackResult<MarketEligibilityResponse_t>( returnValue );
return new CallResult<MarketEligibilityResponse_t>( returnValue );
}
#region FunctionMeta
@ -358,10 +358,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetDurationControl( IntPtr self );
#endregion
internal CallbackResult<DurationControl_t> GetDurationControl()
internal CallResult<DurationControl_t> GetDurationControl()
{
var returnValue = _GetDurationControl( Self );
return new CallbackResult<DurationControl_t>( returnValue );
return new CallResult<DurationControl_t>( returnValue );
}
#region FunctionMeta

View File

@ -213,10 +213,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestUserStats( IntPtr self, SteamId steamIDUser );
#endregion
internal CallbackResult<UserStatsReceived_t> RequestUserStats( SteamId steamIDUser )
internal CallResult<UserStatsReceived_t> RequestUserStats( SteamId steamIDUser )
{
var returnValue = _RequestUserStats( Self, steamIDUser );
return new CallbackResult<UserStatsReceived_t>( returnValue );
return new CallResult<UserStatsReceived_t>( returnValue );
}
#region FunctionMeta
@ -284,10 +284,10 @@ namespace Steamworks
private static extern SteamAPICall_t _FindOrCreateLeaderboard( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType );
#endregion
internal CallbackResult<LeaderboardFindResult_t> FindOrCreateLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType )
internal CallResult<LeaderboardFindResult_t> FindOrCreateLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType )
{
var returnValue = _FindOrCreateLeaderboard( Self, pchLeaderboardName, eLeaderboardSortMethod, eLeaderboardDisplayType );
return new CallbackResult<LeaderboardFindResult_t>( returnValue );
return new CallResult<LeaderboardFindResult_t>( returnValue );
}
#region FunctionMeta
@ -295,10 +295,10 @@ namespace Steamworks
private static extern SteamAPICall_t _FindLeaderboard( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName );
#endregion
internal CallbackResult<LeaderboardFindResult_t> FindLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName )
internal CallResult<LeaderboardFindResult_t> FindLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName )
{
var returnValue = _FindLeaderboard( Self, pchLeaderboardName );
return new CallbackResult<LeaderboardFindResult_t>( returnValue );
return new CallResult<LeaderboardFindResult_t>( returnValue );
}
#region FunctionMeta
@ -350,10 +350,10 @@ namespace Steamworks
private static extern SteamAPICall_t _DownloadLeaderboardEntries( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd );
#endregion
internal CallbackResult<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
internal CallResult<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
{
var returnValue = _DownloadLeaderboardEntries( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd );
return new CallbackResult<LeaderboardScoresDownloaded_t>( returnValue );
return new CallResult<LeaderboardScoresDownloaded_t>( returnValue );
}
#region FunctionMeta
@ -364,10 +364,10 @@ namespace Steamworks
/// <summary>
/// Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
/// </summary>
internal CallbackResult<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
internal CallResult<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
{
var returnValue = _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers );
return new CallbackResult<LeaderboardScoresDownloaded_t>( returnValue );
return new CallResult<LeaderboardScoresDownloaded_t>( returnValue );
}
#region FunctionMeta
@ -387,10 +387,10 @@ namespace Steamworks
private static extern SteamAPICall_t _UploadLeaderboardScore( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount );
#endregion
internal CallbackResult<LeaderboardScoreUploaded_t> UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount )
internal CallResult<LeaderboardScoreUploaded_t> UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount )
{
var returnValue = _UploadLeaderboardScore( Self, hSteamLeaderboard, eLeaderboardUploadScoreMethod, nScore, pScoreDetails, cScoreDetailsCount );
return new CallbackResult<LeaderboardScoreUploaded_t>( returnValue );
return new CallResult<LeaderboardScoreUploaded_t>( returnValue );
}
#region FunctionMeta
@ -398,10 +398,10 @@ namespace Steamworks
private static extern SteamAPICall_t _AttachLeaderboardUGC( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC );
#endregion
internal CallbackResult<LeaderboardUGCSet_t> AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
internal CallResult<LeaderboardUGCSet_t> AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
{
var returnValue = _AttachLeaderboardUGC( Self, hSteamLeaderboard, hUGC );
return new CallbackResult<LeaderboardUGCSet_t>( returnValue );
return new CallResult<LeaderboardUGCSet_t>( returnValue );
}
#region FunctionMeta
@ -409,10 +409,10 @@ namespace Steamworks
private static extern SteamAPICall_t _GetNumberOfCurrentPlayers( IntPtr self );
#endregion
internal CallbackResult<NumberOfCurrentPlayers_t> GetNumberOfCurrentPlayers()
internal CallResult<NumberOfCurrentPlayers_t> GetNumberOfCurrentPlayers()
{
var returnValue = _GetNumberOfCurrentPlayers( Self );
return new CallbackResult<NumberOfCurrentPlayers_t>( returnValue );
return new CallResult<NumberOfCurrentPlayers_t>( returnValue );
}
#region FunctionMeta
@ -420,10 +420,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestGlobalAchievementPercentages( IntPtr self );
#endregion
internal CallbackResult<GlobalAchievementPercentagesReady_t> RequestGlobalAchievementPercentages()
internal CallResult<GlobalAchievementPercentagesReady_t> RequestGlobalAchievementPercentages()
{
var returnValue = _RequestGlobalAchievementPercentages( Self );
return new CallbackResult<GlobalAchievementPercentagesReady_t>( returnValue );
return new CallResult<GlobalAchievementPercentagesReady_t>( returnValue );
}
#region FunctionMeta
@ -469,10 +469,10 @@ namespace Steamworks
private static extern SteamAPICall_t _RequestGlobalStats( IntPtr self, int nHistoryDays );
#endregion
internal CallbackResult<GlobalStatsReceived_t> RequestGlobalStats( int nHistoryDays )
internal CallResult<GlobalStatsReceived_t> RequestGlobalStats( int nHistoryDays )
{
var returnValue = _RequestGlobalStats( Self, nHistoryDays );
return new CallbackResult<GlobalStatsReceived_t>( returnValue );
return new CallResult<GlobalStatsReceived_t>( returnValue );
}
#region FunctionMeta

View File

@ -231,10 +231,10 @@ namespace Steamworks
private static extern SteamAPICall_t _CheckFileSignature( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName );
#endregion
internal CallbackResult<CheckFileSignature_t> CheckFileSignature( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName )
internal CallResult<CheckFileSignature_t> CheckFileSignature( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName )
{
var returnValue = _CheckFileSignature( Self, szFileName );
return new CallbackResult<CheckFileSignature_t>( returnValue );
return new CallResult<CheckFileSignature_t>( returnValue );
}
#region FunctionMeta

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,8 @@ namespace Steamworks
internal static void InstallEvents()
{
DlcInstalled_t.Install( x => OnDlcInstalled?.Invoke( x.AppID ) );
NewUrlLaunchParameters_t.Install( x => OnNewLaunchParameters?.Invoke() );
Dispatch.Install<DlcInstalled_t>( x => OnDlcInstalled?.Invoke( x.AppID ) );
Dispatch.Install<NewUrlLaunchParameters_t>( x => OnNewLaunchParameters?.Invoke() );
}
/// <summary>

View File

@ -102,11 +102,10 @@ namespace Steamworks
internal static void Cleanup()
{
Dispatch.ClientPipe = 0;
Dispatch.Wipe();
initialized = false;
Event.DisposeAllClient();
ShutdownInterfaces();
}

View File

@ -26,13 +26,13 @@ namespace Steamworks
internal static void InstallEvents()
{
FriendStateChange_t.Install( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) );
GameRichPresenceJoinRequested_t.Install( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.ConnectUTF8() ) );
GameConnectedFriendChatMsg_t.Install( OnFriendChatMessage );
GameOverlayActivated_t.Install( x => OnGameOverlayActivated?.Invoke() );
GameServerChangeRequested_t.Install( x => OnGameServerChangeRequested?.Invoke( x.ServerUTF8(), x.PasswordUTF8() ) );
GameLobbyJoinRequested_t.Install( x => OnGameLobbyJoinRequested?.Invoke( new Lobby( x.SteamIDLobby ), x.SteamIDFriend ) );
FriendRichPresenceUpdate_t.Install( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) );
Dispatch.Install<FriendStateChange_t>( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) );
Dispatch.Install<GameRichPresenceJoinRequested_t>( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.ConnectUTF8() ) );
Dispatch.Install<GameConnectedFriendChatMsg_t>( OnFriendChatMessage );
Dispatch.Install<GameOverlayActivated_t>( x => OnGameOverlayActivated?.Invoke() );
Dispatch.Install<GameServerChangeRequested_t>( x => OnGameServerChangeRequested?.Invoke( x.ServerUTF8(), x.PasswordUTF8() ) );
Dispatch.Install<GameLobbyJoinRequested_t>( x => OnGameLobbyJoinRequested?.Invoke( new Lobby( x.SteamIDLobby ), x.SteamIDFriend ) );
Dispatch.Install<FriendRichPresenceUpdate_t>( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) );
}
/// <summary>

View File

@ -26,9 +26,9 @@ namespace Steamworks
internal static void InstallEvents()
{
SteamInventoryFullUpdate_t.Install( x => InventoryUpdated( x ) );
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions() );
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions(), true );
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions() );
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), true );
}
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )

View File

@ -31,15 +31,15 @@ namespace Steamworks
internal static void InstallEvents()
{
LobbyInvite_t.Install( x => OnLobbyInvite?.Invoke( new Friend( x.SteamIDUser ), new Lobby( x.SteamIDLobby ) ) );
Dispatch.Install<LobbyInvite_t>( x => OnLobbyInvite?.Invoke( new Friend( x.SteamIDUser ), new Lobby( x.SteamIDLobby ) ) );
LobbyEnter_t.Install( x => OnLobbyEntered?.Invoke( new Lobby( x.SteamIDLobby ) ) );
Dispatch.Install<LobbyEnter_t>( x => OnLobbyEntered?.Invoke( new Lobby( x.SteamIDLobby ) ) );
LobbyCreated_t.Install( x => OnLobbyCreated?.Invoke( x.Result, new Lobby( x.SteamIDLobby ) ) );
Dispatch.Install<LobbyCreated_t>( x => OnLobbyCreated?.Invoke( x.Result, new Lobby( x.SteamIDLobby ) ) );
LobbyGameCreated_t.Install( x => OnLobbyGameCreated?.Invoke( new Lobby( x.SteamIDLobby ), x.IP, x.Port, x.SteamIDGameServer ) );
Dispatch.Install<LobbyGameCreated_t>( x => OnLobbyGameCreated?.Invoke( new Lobby( x.SteamIDLobby ), x.IP, x.Port, x.SteamIDGameServer ) );
LobbyDataUpdate_t.Install( x =>
Dispatch.Install<LobbyDataUpdate_t>( x =>
{
if ( x.Success == 0 ) return;
@ -49,7 +49,7 @@ namespace Steamworks
OnLobbyMemberDataChanged?.Invoke( new Lobby( x.SteamIDLobby ), new Friend( x.SteamIDMember ) );
} );
LobbyChatUpdate_t.Install( x =>
Dispatch.Install<LobbyChatUpdate_t>( x =>
{
if ( (x.GfChatMemberStateChange & (int)ChatMemberStateChange.Entered) != 0 )
OnLobbyMemberJoined?.Invoke( new Lobby( x.SteamIDLobby ), new Friend( x.SteamIDUserChanged ) );
@ -67,7 +67,7 @@ namespace Steamworks
OnLobbyMemberBanned?.Invoke( new Lobby( x.SteamIDLobby ), new Friend( x.SteamIDUserChanged ), new Friend( x.SteamIDMakingChange ) );
} );
LobbyChatMsg_t.Install( OnLobbyChatMessageRecievedAPI );
Dispatch.Install<LobbyChatMsg_t>( OnLobbyChatMessageRecievedAPI );
}
static private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callback )

View File

@ -27,8 +27,8 @@ namespace Steamworks
internal static void InstallEvents()
{
PlaybackStatusHasChanged_t.Install( x => OnPlaybackChanged?.Invoke() );
VolumeHasChanged_t.Install( x => OnVolumeChanged?.Invoke( x.NewVolume ) );
Dispatch.Install<PlaybackStatusHasChanged_t>( x => OnPlaybackChanged?.Invoke() );
Dispatch.Install<VolumeHasChanged_t>( x => OnVolumeChanged?.Invoke( x.NewVolume ) );
}
/// <summary>

View File

@ -22,8 +22,8 @@ namespace Steamworks
internal static void InstallEvents()
{
P2PSessionRequest_t.Install( x => OnP2PSessionRequest?.Invoke( x.SteamIDRemote ) );
P2PSessionConnectFail_t.Install( x => OnP2PConnectionFailed?.Invoke( x.SteamIDRemote, (P2PSessionError) x.P2PSessionError ) );
Dispatch.Install<P2PSessionRequest_t>( x => OnP2PSessionRequest?.Invoke( x.SteamIDRemote ) );
Dispatch.Install<P2PSessionConnectFail_t>( x => OnP2PConnectionFailed?.Invoke( x.SteamIDRemote, (P2PSessionError) x.P2PSessionError ) );
}
/// <summary>

View File

@ -71,7 +71,7 @@ namespace Steamworks
internal static void InstallEvents( bool server = false )
{
SteamNetConnectionStatusChangedCallback_t.Install( x => ConnectionStatusChanged( x ), server );
Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( x => ConnectionStatusChanged( x ), server );
}
private static void ConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t data )

View File

@ -24,7 +24,7 @@ namespace Steamworks
internal static void InstallEvents()
{
SteamParentalSettingsChanged_t.Install( x => OnSettingsChanged?.Invoke() );
Dispatch.Install<SteamParentalSettingsChanged_t>( x => OnSettingsChanged?.Invoke() );
}
/// <summary>

View File

@ -20,8 +20,8 @@ namespace Steamworks
internal static void InstallEvents()
{
AvailableBeaconLocationsUpdated_t.Install( x => OnBeaconLocationsUpdated?.Invoke() );
ActiveBeaconsUpdated_t.Install( x => OnActiveBeaconsUpdated?.Invoke() );
Dispatch.Install<AvailableBeaconLocationsUpdated_t>( x => OnBeaconLocationsUpdated?.Invoke() );
Dispatch.Install<ActiveBeaconsUpdated_t>( x => OnActiveBeaconsUpdated?.Invoke() );
}
/// <summary>

View File

@ -23,8 +23,8 @@ namespace Steamworks
internal static void InstallEvents()
{
ScreenshotRequested_t.Install( x => OnScreenshotRequested?.Invoke() );
ScreenshotReady_t.Install( x =>
Dispatch.Install<ScreenshotRequested_t>( x => OnScreenshotRequested?.Invoke() );
Dispatch.Install<ScreenshotReady_t>( x =>
{
if ( x.Result != Result.OK )
OnScreenshotFailed?.Invoke( x.Result );

View File

@ -31,10 +31,10 @@ namespace Steamworks
SteamInventory.InstallEvents();
//SteamNetworkingSockets.InstallEvents(true);
ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke(), true );
SteamServerConnectFailure_t.Install( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true );
SteamServersDisconnected_t.Install( x => OnSteamServersDisconnected?.Invoke( x.Result ), true );
Dispatch.Install<ValidateAuthTicketResponse_t>( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
Dispatch.Install<SteamServersConnected_t>( x => OnSteamServersConnected?.Invoke(), true );
Dispatch.Install<SteamServerConnectFailure_t>( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true );
Dispatch.Install<SteamServersDisconnected_t>( x => OnSteamServersDisconnected?.Invoke( x.Result ), true );
}
/// <summary>
@ -140,8 +140,6 @@ namespace Steamworks
public static void Shutdown()
{
Event.DisposeAllServer();
Internal = null;
ShutdownInterfaces();

View File

@ -25,7 +25,7 @@ namespace Steamworks
internal static void InstallEvents()
{
DownloadItemResult_t.Install( x => OnDownloadItemResult?.Invoke( x.Result ) );
Dispatch.Install<DownloadItemResult_t>( x => OnDownloadItemResult?.Invoke( x.Result ) );
}
/// <summary>

View File

@ -31,15 +31,15 @@ namespace Steamworks
internal static void InstallEvents()
{
SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke() );
SteamServerConnectFailure_t.Install( x => OnSteamServerConnectFailure?.Invoke() );
SteamServersDisconnected_t.Install( x => OnSteamServersDisconnected?.Invoke() );
ClientGameServerDeny_t.Install( x => OnClientGameServerDeny?.Invoke() );
LicensesUpdated_t.Install( x => OnLicensesUpdated?.Invoke() );
ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ) );
MicroTxnAuthorizationResponse_t.Install( x => OnMicroTxnAuthorizationResponse?.Invoke( x.AppID, x.OrderID, x.Authorized != 0 ) );
GameWebCallback_t.Install( x => OnGameWebCallback?.Invoke( x.URLUTF8() ) );
GetAuthSessionTicketResponse_t.Install( x => OnGetAuthSessionTicketResponse?.Invoke( x ) );
Dispatch.Install<SteamServersConnected_t>( x => OnSteamServersConnected?.Invoke() );
Dispatch.Install<SteamServerConnectFailure_t>( x => OnSteamServerConnectFailure?.Invoke() );
Dispatch.Install<SteamServersDisconnected_t>( x => OnSteamServersDisconnected?.Invoke() );
Dispatch.Install<ClientGameServerDeny_t>( x => OnClientGameServerDeny?.Invoke() );
Dispatch.Install<LicensesUpdated_t>( x => OnLicensesUpdated?.Invoke() );
Dispatch.Install<ValidateAuthTicketResponse_t>( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ) );
Dispatch.Install<MicroTxnAuthorizationResponse_t>( x => OnMicroTxnAuthorizationResponse?.Invoke( x.AppID, x.OrderID, x.Authorized != 0 ) );
Dispatch.Install<GameWebCallback_t>( x => OnGameWebCallback?.Invoke( x.URLUTF8() ) );
Dispatch.Install<GetAuthSessionTicketResponse_t>( x => OnGetAuthSessionTicketResponse?.Invoke( x ) );
}
/// <summary>

View File

@ -24,7 +24,7 @@ namespace Steamworks
internal static void InstallEvents()
{
UserStatsReceived_t.Install( x =>
Dispatch.Install<UserStatsReceived_t>( x =>
{
if ( x.SteamIDUser == SteamClient.SteamId )
StatsRecieved = true;
@ -32,10 +32,10 @@ namespace Steamworks
OnUserStatsReceived?.Invoke( x.SteamIDUser, x.Result );
} );
UserStatsStored_t.Install( x => OnUserStatsStored?.Invoke( x.Result ) );
UserAchievementStored_t.Install( x => OnAchievementProgress?.Invoke( new Achievement( x.AchievementNameUTF8() ), (int) x.CurProgress, (int)x.MaxProgress ) );
UserStatsUnloaded_t.Install( x => OnUserStatsUnloaded?.Invoke( x.SteamIDUser ) );
UserAchievementIconFetched_t.Install( x => OnAchievementIconFetched?.Invoke( x.AchievementNameUTF8(), x.IconHandle ) );
Dispatch.Install<UserStatsStored_t>( x => OnUserStatsStored?.Invoke( x.Result ) );
Dispatch.Install<UserAchievementStored_t>( x => OnAchievementProgress?.Invoke( new Achievement( x.AchievementNameUTF8() ), (int) x.CurProgress, (int)x.MaxProgress ) );
Dispatch.Install<UserStatsUnloaded_t>( x => OnUserStatsUnloaded?.Invoke( x.SteamIDUser ) );
Dispatch.Install<UserAchievementIconFetched_t>( x => OnAchievementIconFetched?.Invoke( x.AchievementNameUTF8(), x.IconHandle ) );
}

View File

@ -24,10 +24,10 @@ namespace Steamworks
internal static void InstallEvents()
{
IPCountry_t.Install( x => OnIpCountryChanged?.Invoke() );
LowBatteryPower_t.Install( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) );
SteamShutdown_t.Install( x => SteamClosed() );
GamepadTextInputDismissed_t.Install( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) );
Dispatch.Install<IPCountry_t>( x => OnIpCountryChanged?.Invoke() );
Dispatch.Install<LowBatteryPower_t>( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) );
Dispatch.Install<SteamShutdown_t>( x => SteamClosed() );
Dispatch.Install<GamepadTextInputDismissed_t>( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) );
}
private static void SteamClosed()

View File

@ -24,8 +24,8 @@ namespace Steamworks
internal static void InstallEvents()
{
BroadcastUploadStart_t.Install( x => OnBroadcastStarted?.Invoke() );
BroadcastUploadStop_t.Install( x => OnBroadcastStopped?.Invoke( x.Result ) );
Dispatch.Install<BroadcastUploadStart_t>( x => OnBroadcastStarted?.Invoke() );
Dispatch.Install<BroadcastUploadStop_t>( x => OnBroadcastStopped?.Invoke( x.Result ) );
}
public static event Action OnBroadcastStarted;

View File

@ -83,7 +83,7 @@ namespace Steamworks
return string.Empty;
return UTF8Encoding.UTF8.GetString( (byte*)ptr, len );
}
}
}
internal class MonoPInvokeCallbackAttribute : Attribute

View File

@ -3,12 +3,21 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
namespace Steamworks
{
public static partial class Utility
{
static internal T ToType<T>( this IntPtr ptr )
{
if ( ptr == IntPtr.Zero )
return default;
return (T)Marshal.PtrToStructure( ptr, typeof( T ) );
}
static internal uint Swap( uint x )
{
return ((x & 0x000000ff) << 24) +

View File

@ -52,39 +52,6 @@ namespace Generator
WriteLine( $"public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof({name}) );" );
WriteLine( $"public int DataSize => _datasize;" );
WriteLine( $"public int CallbackId => {c.CallbackId};" );
WriteLine( $"internal static {name} Fill( IntPtr p ) => (({name})Marshal.PtrToStructure( p, typeof({name}) ) );" );
WriteLine();
WriteLine( $"static Action<{name}> actionClient;" );
WriteLine( $"[MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );" );
WriteLine( $"static Action<{name}> actionServer;" );
WriteLine( $"[MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );" );
StartBlock( $"public static void Install( Action<{name}> action, bool server = false )" );
{
StartBlock( "if ( server )" );
{
WriteLine( $"Event.Register( OnServer, _datasize, {c.CallbackId}, true );" );
WriteLine( $"actionServer = action;" );
}
Else();
{
WriteLine( $"Event.Register( OnClient, _datasize, {c.CallbackId}, false );" );
WriteLine( $"actionClient = action;" );
}
EndBlock();
}
EndBlock();
}
WriteLine( "#endregion" );
}
else
{
WriteLine( "#region Marshalling" );
{
WriteLine( $"internal static {name} Fill( IntPtr p ) => (({name})({name}) Marshal.PtrToStructure( p, typeof({name}) ) );" );
}
WriteLine( "#endregion" );
}

View File

@ -182,10 +182,9 @@ internal class SteamApiCallType : BaseType
public override string Return( string varname )
{
if ( !string.IsNullOrEmpty( CallResult ) )
return $"return new CallbackResult<{CallResult}>( {varname} );";
return $"return new CallResult<{CallResult}>( {varname} );";
return $"return new CallbackResult( {varname} );";
return $"return new CallResult( {varname} );";
}
public override string ReturnType
@ -193,9 +192,9 @@ internal class SteamApiCallType : BaseType
get
{
if ( !string.IsNullOrEmpty( CallResult ) )
return $"CallbackResult<{CallResult}>";
return $"CallResult<{CallResult}>";
return $"CallbackResult";
return $"CallResult";
}
}
}