Skip to content

Commit

Permalink
Core: Fix byref types not being handled
Browse files Browse the repository at this point in the history
  • Loading branch information
SamboyCoding committed Jan 11, 2024
1 parent 84f5a0a commit 688f307
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Cpp2IL.Core/Utils/Il2CppTypeToContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ private static TypeAnalysisContext GetPrimitive(this SystemTypesContext context,
return context.AppContext.SystemTypes.GetPrimitive(type.Type);

if (type.Type is Il2CppTypeEnum.IL2CPP_TYPE_CLASS or Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE)
return context.AppContext.ResolveContextForType(type.AsClass()) ?? throw new($"Could not resolve type context for type {type.AsClass().FullName}");
{
var typeDefContext = context.AppContext.ResolveContextForType(type.AsClass()) ?? throw new($"Could not resolve type context for type {type.AsClass().FullName}");

if (type.Byref == 1)
// Byref types need to be wrapped
return typeDefContext.MakeByReferenceType();

return typeDefContext;
}

if (type.Type is Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST)
return new GenericInstanceTypeAnalysisContext(type, context);
Expand Down

0 comments on commit 688f307

Please sign in to comment.