From c9d65e5f2de213838b1bf2b495a08ac90f1ee86a Mon Sep 17 00:00:00 2001 From: Robert Xiao Date: Tue, 7 Apr 2020 03:57:02 -0700 Subject: [PATCH] Get 2019.3.7f1+ working by adding new '24.3' version In 2019.3.7f1, the following fields were added to Il2CppCodeRegistration: uint32_t interopDataCount; Il2CppInteropData* interopData; + uint32_t windowsRuntimeFactoryCount; + Il2CppWindowsRuntimeFactoryTableEntry* windowsRuntimeFactoryTable; uint32_t codeGenModulesCount; const Il2CppCodeGenModule** codeGenModules; These two fields overlap the old codeGenModules fields, causing failures. The current fix is simply to bump the version to 24.3 if these fields are detected in order to get the correct codeGenModules pointer. Long term, a better detection mechanism (probably based on examining the name string pointer in codeGenModules[0]) will be necessary. However, this is pending more samples of 2019.3.7+ for testing. --- Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs | 11 +++++++++-- .../IL2CPP/Il2CppBinaryClasses.cs | 5 +++++ Il2CppInspector.Common/IL2CPP/MetadataClasses.cs | 6 ++++-- README.md | 13 +++++++------ 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index 7fbf8c6..cee808a 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -181,6 +181,13 @@ namespace Il2CppInspector if (Image.Version >= 24.2) { Modules = new Dictionary(); + // In v24.3, windowsRuntimeFactoryTable collides with codeGenModules. So far no samples have had windowsRuntimeFactoryCount > 0; + // if this changes we'll have to get smarter about disambiguating these two. + if (CodeRegistration.codeGenModulesCount == 0) { + Image.Version = 24.3; + CodeRegistration = image.ReadMappedObject(codeRegistration); + } + // Array of pointers to Il2CppCodeGenModule var codeGenModulePointers = image.ReadMappedArray(CodeRegistration.pcodeGenModules, (int) CodeRegistration.codeGenModulesCount); var modules = image.ReadMappedObjectPointerArray(CodeRegistration.pcodeGenModules, (int) CodeRegistration.codeGenModulesCount); @@ -233,8 +240,8 @@ namespace Il2CppInspector // TODO: Function pointers as shown below // reversePInvokeWrappers - // <=22: delegateWrappersFromManagedToNative, marshalingFunctions; - // >=21 <=22: ccwMarhsalingFunctions + // <=22: delegateWrappersFromManagedToNative, marshalingFunctions + // >=21 <=22: ccwMarshalingFunctions // >=22: unresolvedVirtualCallPointers // >=23: interopData diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs index 6c8fea3..3b58efe 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs @@ -60,6 +60,11 @@ namespace Il2CppInspector [Version(Min = 23)] public ulong interopData; + [Version(Min = 24.3)] + public ulong windowsRuntimeFactoryCount; + [Version(Min = 24.3)] + public ulong windowsRuntimeFactoryTable; + // Added in metadata v24.2 to replace methodPointers and methodPointersCount [Version(Min = 24.2)] public ulong codeGenModulesCount; diff --git a/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs b/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs index ea3f98c..d6a89c9 100644 --- a/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs +++ b/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs @@ -19,12 +19,14 @@ namespace Il2CppInspector // Unity 5.3.5f1 -> v21 // Unity 5.4.0f3 -> v21 // Unity 5.5.0f3 -> v22 - // Unity 5.6.2p3 -> v23 + // Unity 5.6.0f3 -> v23 // Unity 5.6.4f1 -> v23 - // Unity 2017.2f3 -> v24 + // Unity 2019.1.0f3 -> v24 // Unity 2018.2.0f2 -> v24 // Unity 2018.3.0f2 -> v24.1 + // Unity 2019.1.0f2 -> v24.2 // Unity 2019.2.8f1 -> v24.2 + // Unity 2019.3.7f1 -> v24.3 // https://unity3d.com/get-unity/download/archive // Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll) diff --git a/README.md b/README.md index e621ad7..5910472 100644 --- a/README.md +++ b/README.md @@ -168,15 +168,16 @@ Unity version | IL2CPP version | Support 4.6.1+ | First release | Unsupported 5.2.x | 15 | Unsupported 5.3.0-5.3.1 | 16 | Working -5.3.2 | 19 | Untested -5.3.3-5.3.4 | 20 | Untested +5.3.2 | 19 | Working +5.3.3-5.3.4 | 20 | Working 5.3.5-5.4.x | 21 | Working 5.5.x | 22 | Working 5.6.x | 23 | Working -2017.x-2018.2 | 24.0 | Working -2018.3-2019.1 | 24.1 | Working -2019.2-2019.3 | 24.2 | Working -2020.1 | 24.3 | Awaiting stable release +2017.1.x-2018.2.x | 24.0 | Working +2018.3.x-2018.4.x | 24.1 | Working +2019.1.x-2019.3.6 | 24.2 | Working +2019.3.7-2019.3.x | 24.3 | Untested +2020.1 | 24.? | Awaiting stable release ### Problems