Unity/C++: Significant re-factoring of Unity header management (see description)

Extract resource handling to UnityResource
Add API header resource helpers
Fix UnityVersion ToString() when Min == Max
Replace fixed list of Il2Cpp header reserved names with parsed names from actual selected headers (solves TypeInfo/MemberInfo problems in 5.3.0-5.3.4 (metadata v16-20))
Use CppDeclarationGenerator when initializing CppTypeCollection to ensure all Il2Cpp header symbols are reserved
Process API headers in CppTypeCollection.FromUnityHeaders
Move #define IS_32BIT handling to UnityHeaders
Update tests
This commit is contained in:
Katy Coe
2020-07-22 19:01:33 +02:00
parent 53909c539c
commit deeb8daa97
12 changed files with 216 additions and 142 deletions

View File

@@ -22,15 +22,17 @@ namespace Il2CppInspector
public void TestCppTypeDeclarations() {
// NOTE: This test doesn't check for correct results, only that parsing doesn't fail!
var unityAllHeaders = UnityHeader.GetAllHeaders();
var unityTypeHeaders = UnityHeaders.GetAllTypeHeaders();
// Ensure we have read the embedded assembly resources
Assert.IsTrue(unityAllHeaders.Any());
Assert.IsTrue(unityTypeHeaders.Any());
// Ensure we can interpret every header from every version of Unity without errors
// This will throw InvalidOperationException if there is a problem
foreach (var unityHeader in unityAllHeaders) {
var cppTypes = CppTypeCollection.FromUnityHeaders(unityHeader);
foreach (var unityTypeHeader in unityTypeHeaders) {
var cppTypes = new CppTypeCollection(64);
cppTypes.AddFromDeclarationText(unityTypeHeader.GetText());
foreach (var cppType in cppTypes.Types)
Debug.WriteLine("// " + cppType.Key + "\n" + cppType.Value.ToString("o"));
}
@@ -38,7 +40,7 @@ namespace Il2CppInspector
// Do a few sanity checks taken from real applications
// NOTE: Does not provide full code coverage!
var cppTypes2 = CppTypeCollection.FromUnityVersion(new UnityVersion("2019.3.1f1"), 64);
var cppTypes2 = CppTypeCollection.FromUnityVersion(new UnityVersion("2019.3.1f1"));
CppComplexType ct;
CppField field;