mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Put callback functions in the right order on non windows
This commit is contained in:
parent
c9443b75f2
commit
39c5860041
File diff suppressed because it is too large
Load Diff
@ -230,12 +230,22 @@ private void Callback( SteamApiDefinition.StructDef c )
|
|||||||
WriteLine( "handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );" );
|
WriteLine( "handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );" );
|
||||||
StartBlock( "var vTable = new Callback.VTable()" );
|
StartBlock( "var vTable = new Callback.VTable()" );
|
||||||
{
|
{
|
||||||
WriteLine( "ResultA = Marshal.GetFunctionPointerForDelegate( funcB ), // The order of these functions is a point of contention" );
|
WriteLine( "ResultA = Marshal.GetFunctionPointerForDelegate( funcA )," );
|
||||||
WriteLine( "ResultB = Marshal.GetFunctionPointerForDelegate( funcA ), // Doesn't seem to matter win64, but win32 crashes if WithInfo not first" );
|
WriteLine( "ResultB = Marshal.GetFunctionPointerForDelegate( funcB )," );
|
||||||
WriteLine( "GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), // Which is the opposite of how they are in code, but whatever works" );
|
WriteLine( "GetSize = Marshal.GetFunctionPointerForDelegate( funcC )," );
|
||||||
}
|
}
|
||||||
EndBlock( ";" );
|
EndBlock( ";" );
|
||||||
|
|
||||||
|
WriteLine( "//" );
|
||||||
|
WriteLine( "// The order of these functions are swapped on Windows" );
|
||||||
|
WriteLine( "//" );
|
||||||
|
StartBlock( "if ( Platform.Os == OperatingSystem.Windows )" );
|
||||||
|
{
|
||||||
|
WriteLine( "vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB );" );
|
||||||
|
WriteLine( "vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA );" );
|
||||||
|
}
|
||||||
|
EndBlock();
|
||||||
|
|
||||||
WriteLine( "Marshal.StructureToPtr( vTable, handle.vTablePtr, false );" );
|
WriteLine( "Marshal.StructureToPtr( vTable, handle.vTablePtr, false );" );
|
||||||
|
|
||||||
WriteLine( "" );
|
WriteLine( "" );
|
||||||
|
@ -43,6 +43,17 @@ private void StartBlock( string v )
|
|||||||
indent++;
|
indent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Else( string v = "" )
|
||||||
|
{
|
||||||
|
indent--;
|
||||||
|
|
||||||
|
WriteLine( "}" );
|
||||||
|
WriteLine( "else"+ v );
|
||||||
|
WriteLine( "{" );
|
||||||
|
|
||||||
|
indent++;
|
||||||
|
}
|
||||||
|
|
||||||
private void WriteLines( List<string> beforeLines )
|
private void WriteLines( List<string> beforeLines )
|
||||||
{
|
{
|
||||||
foreach ( var line in beforeLines )
|
foreach ( var line in beforeLines )
|
||||||
|
Loading…
Reference in New Issue
Block a user