Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Model/Contexts/ApplicationAnalysisContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ private void PopulateMethodsByAddressTable()
{
return methodReference?.Type switch
{
null => null,
MetadataUsageType.MethodDef => ResolveContextForMethod(methodReference.AsMethod()),
MetadataUsageType.MethodRef => ResolveContextForMethod(methodReference.AsGenericMethodRef()),
_ => null,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private GenericInstanceTypeAnalysisContext(Il2CppType rawType, AssemblyAnalysisC
var gClass = rawType.GetGenericClass();
GenericType = AppContext.ResolveContextForType(gClass.TypeDefinition) ?? throw new($"Could not resolve type {gClass.TypeDefinition.FullName} for generic instance base type");

GenericArguments.AddRange(gClass.Context.ClassInst.Types.Select(referencedFrom.ResolveIl2CppType)!);
GenericArguments.AddRange(gClass.Context.ClassInst!.Types.Select(referencedFrom.ResolveIl2CppType)!);

SetDeclaringType();
}
Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Model/Contexts/TypeAnalysisContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static ITypeInfoProvider GetSndnProviderForType(ApplicationAnalysisContex
var genericClass = type.GetGenericClass();
var elementType = appContext.ResolveContextForType(genericClass.TypeDefinition)!;

var genericParamTypes = genericClass.Context.ClassInst.Types;
var genericParamTypes = genericClass.Context.ClassInst!.Types;

if (genericParamTypes.Any(t => t.Type is Il2CppTypeEnum.IL2CPP_TYPE_VAR or Il2CppTypeEnum.IL2CPP_TYPE_MVAR))
//Discard non-fixed generic instances
Expand Down
1 change: 0 additions & 1 deletion Cpp2IL.Plugin.BuildReport/Cpp2IL.Plugin.BuildReport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="10.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.200" PrivateAssets="All" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Cpp2IL.Plugin.Mfuscator/MfuscatorSupportPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Runtime.InteropServices;
using AssetRipper.Primitives;
using Cpp2IL.Core.Api;
Expand Down Expand Up @@ -463,7 +463,7 @@ private Dictionary<int, byte[]> DecryptEncryptedSections(byte[] encryptedMetadat

return decryptedSectionBytes;
}
catch (Exception ex)
catch (Exception)
{
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ public class Il2CppGlobalMetadataHeader : ReadableClass
public uint magicNumber;
public int version;

#nullable disable

public Il2CppGlobalMetadataSectionHeader stringLiteral; // string data for managed code
public Il2CppGlobalMetadataSectionHeader stringLiteralData;
public Il2CppGlobalMetadataSectionHeader @string; // string data for metadata
Expand Down Expand Up @@ -56,6 +58,8 @@ public class Il2CppGlobalMetadataHeader : ReadableClass

[Version(Min = 24)] public Il2CppGlobalMetadataSectionHeader exportedTypeDefinitions; // TypeDefinitionIndex

#nullable restore

public override void Read(ClassReadingBinaryReader reader)
{
magicNumber = reader.ReadUInt32();
Expand Down
8 changes: 5 additions & 3 deletions LibCpp2IL/Metadata/Il2CppMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Il2CppMetadata : ClassReadingBinaryReader
public int[]? attributeTypes; //Removed in v29
public List<Il2CppCustomAttributeDataRange>? AttributeDataRanges; //Added in v29

public Il2CppInlineArrayLength[] TypeInlineArrays; //v104+. TODO: These theoretically map to [InlineArray] attributes in dummy dlls, but that's a recent language version feature, does unity actually support them yet?
public Il2CppInlineArrayLength[]? TypeInlineArrays; //v104+. TODO: These theoretically map to [InlineArray] attributes in dummy dlls, but that's a recent language version feature, does unity actually support them yet?

public Il2CppVariableWidthIndex<Il2CppType>[] interfaceIndices;

Expand All @@ -52,14 +52,16 @@ public class Il2CppMetadata : ClassReadingBinaryReader
public Il2CppFieldRef[] fieldRefs;
private Il2CppGenericParameter[] genericParameters;
public Il2CppVariableWidthIndex<Il2CppType>[] constraintIndices;
public int[] exportedTypes;
public int[]? exportedTypes; //Added in v24

public int[] referencedAssemblies;

#nullable disable
/// <summary>
/// Set by <see cref="LibCpp2IlContextBuilder"/> after construction.
/// </summary>
public LibCpp2IlContext OwningContext { get; internal set; }
#nullable restore

private readonly Dictionary<Il2CppVariableWidthIndex<Il2CppFieldDefinition>, Il2CppFieldDefaultValue> _fieldDefaultValueLookup = new();
private readonly Dictionary<Il2CppFieldDefinition, Il2CppFieldDefaultValue> _fieldDefaultLookupNew = new();
Expand Down Expand Up @@ -697,7 +699,7 @@ internal string ReadStringFromIndexNoReadLock(int index)

public Il2CppTypeDefinition GetTypeDefinitionFromIndex(Il2CppVariableWidthIndex<Il2CppTypeDefinition> index) => typeDefs[index.Value];

public Il2CppTypeDefinition GetExportedTypeDefintionFromIndex(int index) => typeDefs[exportedTypes[index]];
public Il2CppTypeDefinition GetExportedTypeDefintionFromIndex(int index) => typeDefs[exportedTypes![index]];

public Il2CppGenericContainer GetGenericContainerFromIndex(Il2CppVariableWidthIndex<Il2CppGenericContainer> index) => genericContainers[index.Value];

Expand Down
4 changes: 2 additions & 2 deletions StableNameDotNet/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;

Expand All @@ -24,7 +24,7 @@ public static bool ContainsAnyInvalidSourceCodeChars(this string s, bool allowCo
return false;
}

public static TValue GetOrCreate<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultGetter)
public static TValue GetOrCreate<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultGetter) where TKey : notnull
{
if (dict.TryGetValue(key, out var value))
return value;
Expand Down
Loading