diff --git a/Il2CppInspector/IL2CPP/Il2CppInspector.cs b/Il2CppInspector/IL2CPP/Il2CppInspector.cs index cbb2bb4..3f6235e 100644 --- a/Il2CppInspector/IL2CPP/Il2CppInspector.cs +++ b/Il2CppInspector/IL2CPP/Il2CppInspector.cs @@ -29,6 +29,7 @@ namespace Il2CppInspector public double Version => Metadata.Version; public Dictionary Strings => Metadata.Strings; + public string[] StringLiterals => Metadata.StringLiterals; public Il2CppTypeDefinition[] TypeDefinitions => Metadata.Types; public Il2CppAssemblyDefinition[] Assemblies => Metadata.Assemblies; public Il2CppImageDefinition[] Images => Metadata.Images; diff --git a/Il2CppInspector/IL2CPP/Metadata.cs b/Il2CppInspector/IL2CPP/Metadata.cs index 514a6f0..da598c7 100644 --- a/Il2CppInspector/IL2CPP/Metadata.cs +++ b/Il2CppInspector/IL2CPP/Metadata.cs @@ -1,15 +1,17 @@ /* Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper - Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com + Copyright 2017-2020 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com All rights reserved. */ using System; using System.Collections.Generic; +using System.Dynamic; using System.IO; using System.Linq; using System.Reflection; +using System.Text; using NoisyCowStudios.Bin2Object; namespace Il2CppInspector @@ -40,6 +42,7 @@ namespace Il2CppInspector public int[] AttributeTypeIndices { get; } public int[] GenericConstraintIndices { get; } public uint[] VTableMethodIndices { get; } + public string[] StringLiterals { get; } public Dictionary Strings { get; } = new Dictionary(); public List MetadataUsages { get; } = new List(); @@ -131,10 +134,17 @@ namespace Il2CppInspector AttributeTypeRanges = ReadArray(Header.attributesInfoOffset, Header.attributesInfoCount / Sizeof(typeof(Il2CppCustomAttributeTypeRange))); } - // Get all string literals + // Get all metadata string literals Position = Header.stringOffset; while (Position < Header.stringOffset + Header.stringCount) Strings.Add((int)Position - Header.stringOffset, ReadNullTerminatedString()); + + // Get all managed code string literals + var stringLiteralList = ReadArray(Header.stringLiteralOffset, Header.stringLiteralCount / Sizeof(typeof(Il2CppStringLiteral))); + + StringLiterals = new string[stringLiteralList.Length]; + for (var i = 0; i < stringLiteralList.Length; i++) + StringLiterals[i] = ReadFixedLengthString(Header.stringLiteralDataOffset + stringLiteralList[i].dataIndex, stringLiteralList[i].length); } private List buildMetadataUsages() diff --git a/Il2CppInspector/IL2CPP/MetadataClasses.cs b/Il2CppInspector/IL2CPP/MetadataClasses.cs index c73fe8b..8f946f0 100644 --- a/Il2CppInspector/IL2CPP/MetadataClasses.cs +++ b/Il2CppInspector/IL2CPP/MetadataClasses.cs @@ -1,6 +1,6 @@ /* Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper - Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com + Copyright 2017-2020 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com All rights reserved. */ @@ -433,4 +433,10 @@ namespace Il2CppInspector public uint destinationindex; public uint encodedSourceIndex; } + + public class Il2CppStringLiteral + { + public int length; + public int dataIndex; + } }