2
0
mirror of https://github.com/Facepunch/Facepunch.Steamworks.git synced 2025-07-14 09:16:27 +03:00

Marshal bool properly

This commit is contained in:
Garry Newman 2019-04-11 21:49:46 +01:00
parent b6266a7386
commit 7e09c9d56f
4 changed files with 5537 additions and 2324 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -9,12 +9,10 @@ namespace Generator
public partial class CodeWriter
{
bool LargePack;
bool X86;
private void PlatformClass( string type, string libraryName, bool LargePack )
{
this.LargePack = LargePack;
X86 = type.EndsWith( "32" );
StartBlock( $"internal static partial class Platform" );
{
@ -189,12 +187,8 @@ namespace Generator
if ( argstring != "" ) argstring = $" {argstring} ";
if ( X86 )
Write( $"[DllImport( \"{library}\", CallingConvention = CallingConvention.Cdecl )] " );
else
Write( $"[DllImport( \"{library}\" )] " );
if ( ret.Return() == "bool" ) WriteLine( "[return: MarshalAs(UnmanagedType.U1)]" );
if ( ret.Return().StartsWith( "bool " ) ) WriteLine( "[return: MarshalAs(UnmanagedType.U1)]" );
WriteLine( $"[DllImport( \"{library}\" )]" );
WriteLine( $"internal static extern {ret.Return()} {flatName}({argstring});" );
LastMethodName = methodDef.Name;