Skip to content

Commit e4ffa0b

Browse files
committed
Fix: Incorrect Il2CppTypeEnum for primitive type contexts
Closes #424 Closes #423
1 parent a067435 commit e4ffa0b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Cpp2IL.Core/Model/Contexts/TypeAnalysisContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public virtual Il2CppTypeEnum Type
9696
{
9797
get
9898
{
99-
if (Definition is { RawBaseType: not null })
100-
return Definition.RawBaseType.Type;
101-
10299
if (AppContext.SystemTypes.TryGetIl2CppTypeEnum(this, out var value))
103100
return value;
101+
102+
if (Definition is { RawType: {} rawType })
103+
return rawType.Type;
104104

105105
if (IsEnumType)
106106
return Il2CppTypeEnum.IL2CPP_TYPE_ENUM;

LibCpp2IL/Metadata/Il2CppTypeDefinition.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class Il2CppTypeDefinition : ReadableClass
7373

7474
public TypeAttributes Attributes => (TypeAttributes)Flags;
7575

76+
public Il2CppType RawType => LibCpp2IlMain.Binary!.AllTypes[ByvalTypeIndex];
77+
7678
public Il2CppTypeDefinitionSizes RawSizes
7779
{
7880
get

LibCpp2IL/Reflection/LibCpp2IlReflection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ internal static void InitCaches()
6161

6262
TypeIndices[typeDefinition] = i;
6363

64-
var type = LibCpp2IlMain.Binary!.AllTypes[typeDefinition.ByvalTypeIndex];
64+
var type = typeDefinition.RawType;
6565

6666
if (type.Type.IsIl2CppPrimitive())
6767
PrimitiveTypeDefinitions[type.Type] = typeDefinition;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy