More marhsalling

This commit is contained in:
Garry Newman 2016-10-26 10:32:00 +01:00
parent 69b342c504
commit 43705fed86
7 changed files with 6454 additions and 3223 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

View File

@ -151,7 +151,7 @@ internal string InteropVariable()
return $"{Name}";
}
internal string InteropParameter( bool LargePack )
internal string InteropParameter( bool LargePack, bool includeMarshalling = false )
{
var ps = LargePack ? "" : ".PackSmall";
@ -161,6 +161,12 @@ internal string InteropParameter( bool LargePack )
if ( TypeDef != null )
ps = string.Empty;
if ( includeMarshalling )
{
}
if ( ShouldBeIntPtr )
return $"IntPtr /*{NativeType}*/ {Name}";
@ -187,6 +193,7 @@ internal string InteropParameter( bool LargePack )
}
}
if ( NativeType.EndsWith( "*" ) && ManagedType.Contains( "_t" ) )
{
return $"IntPtr /*{NativeType}*/ {Name} ";

View File

@ -162,7 +162,7 @@ private void InteropClassMethod( string library, string classname, SteamApiDefin
flatName = methodName;
var argstring = string.Join( ", ", arguments.Select( x => x.InteropParameter( LargePack ) ) );
var argstring = string.Join( ", ", arguments.Select( x => x.InteropParameter( LargePack, true ) ) );
if ( methodDef.NeedsSelfPointer )
{
@ -171,7 +171,11 @@ private void InteropClassMethod( string library, string classname, SteamApiDefin
if ( argstring != "" ) argstring = $" {argstring} ";
WriteLine( $"[DllImportAttribute( \"{library}\", EntryPoint = \"{flatName}\" )] internal static extern {ret.Return()} {methodName}({argstring});" );
WriteLine( $"[DllImportAttribute( \"{library}\", EntryPoint = \"{flatName}\" )]" );
if ( ret.Return() == "bool" )WriteLine( "[return: MarshalAs(UnmanagedType.Bool)]" );
WriteLine( $"internal static extern {ret.Return()} {methodName}({argstring});" );
LastMethodName = methodDef.Name;
}