Added IsPack4OnWindows to codegen struct

This commit is contained in:
Garry Newman 2019-05-08 09:49:32 +01:00
parent c625bbaef9
commit ad21e90e90
3 changed files with 18 additions and 19 deletions

View File

@ -5620,21 +5620,7 @@ namespace Steamworks.Data
internal ulong UGC; // m_hUGC UGCHandle_t
#region Marshalling
internal static LeaderboardEntry_t Fill( IntPtr p ) => Config.PackSmall ? ((LeaderboardEntry_t)(LeaderboardEntry_t) Marshal.PtrToStructure( p, typeof(LeaderboardEntry_t) )) : ((LeaderboardEntry_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
public struct Pack8
{
internal ulong SteamIDUser; // m_steamIDUser class CSteamID
internal int GlobalRank; // m_nGlobalRank int32
internal int Score; // m_nScore int32
internal int CDetails; // m_cDetails int32
internal ulong UGC; // m_hUGC UGCHandle_t
public static implicit operator LeaderboardEntry_t ( LeaderboardEntry_t.Pack8 d ) => new LeaderboardEntry_t{ SteamIDUser = d.SteamIDUser,GlobalRank = d.GlobalRank,Score = d.Score,CDetails = d.CDetails,UGC = d.UGC, };
}
internal static LeaderboardEntry_t Fill( IntPtr p ) => ((LeaderboardEntry_t)(LeaderboardEntry_t) Marshal.PtrToStructure( p, typeof(LeaderboardEntry_t) ) );
#endregion
}

View File

@ -53,10 +53,7 @@ namespace Generator
if ( name.Contains( "::" ) )
continue;
int defaultPack = 8;
if ( c.Fields.Any( x => x.Type.Contains( "CSteamID" ) ) && !ForceLargePackStructs.Contains( c.Name ) )
defaultPack = 4;
int defaultPack = c.IsPack4OnWindows ? 4 : 8;
var isCallback = !string.IsNullOrEmpty( c.CallbackId );

View File

@ -54,6 +54,22 @@ namespace Generator
public string CallbackId { get; set; }
public bool IsCallResult { get; set; }
public bool IsPack4OnWindows
{
get
{
// if ( Name.Contains( "LeaderboardEntry_t" ) )
// return false;
if ( Fields.Any( x => x.Type.Contains( "CSteamID" ) ) )
return true;
return false;
}
}
}
public List<StructDef> structs { get; set; }