@@ -18,7 +18,7 @@ public sealed class Metadata : BinaryStream
1818 public Il2CppParameterDefinition [ ] parameterDefs ;
1919 public Il2CppFieldDefinition [ ] fieldDefs ;
2020 private readonly Dictionary < int , Il2CppFieldDefaultValue > fieldDefaultValuesDic ;
21- private readonly Dictionary < int , Il2CppParameterDefaultValue > parameterDefaultValuesDic ;
21+ private readonly Dictionary < ParameterIndex , Il2CppParameterDefaultValue > parameterDefaultValuesDic ;
2222 public Il2CppPropertyDefinition [ ] propertyDefs ;
2323 public Il2CppCustomAttributeTypeRange [ ] attributeTypeRanges ;
2424 public Il2CppCustomAttributeDataRange [ ] attributeDataRanges ;
@@ -46,6 +46,7 @@ public sealed class Metadata : BinaryStream
4646 public static int typeIndexSize ;
4747 public static int typeDefinitionIndexSize ;
4848 public static int genericContainerIndexSize ;
49+ public static int parameterIndexSize ;
4950
5051 public Metadata ( Stream stream ) : base ( stream )
5152 {
@@ -59,7 +60,7 @@ public Metadata(Stream stream) : base(stream)
5960 {
6061 throw new InvalidDataException ( "ERROR: Metadata file supplied is not valid metadata file." ) ;
6162 }
62- if ( version < 16 || version > 38 )
63+ if ( version < 16 || version > 39 )
6364 {
6465 throw new NotSupportedException ( $ "ERROR: Metadata file supplied is not a supported version[{ version } ].") ;
6566 }
@@ -102,13 +103,15 @@ public Metadata(Stream stream) : base(stream)
102103 typeIndexSize = sizeOfIl2CppParameterDefinition - 8 ;
103104 typeDefinitionIndexSize = GetIndexSize ( ( int ) header . typeDefinitions . count ) ;
104105 genericContainerIndexSize = GetIndexSize ( ( int ) header . genericContainers . count ) ;
106+ parameterIndexSize = GetIndexSize ( ( int ) header . parameters . count ) ;
105107 }
106108 else
107109 {
108110 // Before version 38, these were always ints
109111 typeIndexSize = 4 ;
110112 typeDefinitionIndexSize = 4 ;
111113 genericContainerIndexSize = 4 ;
114+ parameterIndexSize = 4 ;
112115 }
113116
114117 imageDefs = Version < 38
@@ -251,7 +254,7 @@ public bool GetFieldDefaultValueFromIndex(int index, out Il2CppFieldDefaultValue
251254
252255 public bool GetParameterDefaultValueFromIndex ( int index , out Il2CppParameterDefaultValue value )
253256 {
254- return parameterDefaultValuesDic . TryGetValue ( index , out value ) ;
257+ return parameterDefaultValuesDic . TryGetValue ( new ParameterIndex ( index ) , out value ) ;
255258 }
256259
257260 public uint GetDefaultValueFromIndex ( int index )
@@ -385,6 +388,10 @@ public int SizeOf(Type type)
385388 {
386389 size += genericContainerIndexSize ;
387390 }
391+ else if ( fieldType == typeof ( ParameterIndex ) )
392+ {
393+ size += parameterIndexSize ;
394+ }
388395 else
389396 {
390397 size += SizeOf ( fieldType ) ;
0 commit comments