public CppDeclarationGenerator(Il2CppModel model, UnityVersion version) { this.model = model; if (version == null) { UnityHeader = UnityHeader.GuessHeadersForModel(model)[0]; UnityVersion = UnityHeader.MinVersion; } else { UnityVersion = version; UnityHeader = UnityHeader.GetHeaderForVersion(version); if (UnityHeader.MetadataVersion != model.Package.BinaryImage.Version) { /* this can only happen in the CLI frontend with a manually-supplied version number */ Console.WriteLine($"Warning: selected version {UnityVersion} (metadata version {UnityHeader.MetadataVersion})" + $" does not match metadata version {model.Package.BinaryImage.Version}."); } } InitializeNaming(); InitializeConcreteImplementations(); // Configure inheritance style based on binary type; this can be overridden by setting InheritanceStyle in the object initializer InheritanceStyle = CppCompiler.GuessFromImage(model.Package.BinaryImage); }
public CppApplicationModel(Il2CppModel model, UnityVersion unityVersion = null, CppCompiler.Type compiler = CppCompiler.Type.BinaryFormat) { // Set key properties Compiler = compiler == CppCompiler.Type.BinaryFormat ? CppCompiler.GuessFromImage(model.Package.BinaryImage) : compiler; var unityHeader = unityVersion != null?UnityHeader.GetHeaderForVersion(unityVersion) : UnityHeader.GuessHeadersForModel(model)[0]; UnityVersion = unityVersion ?? unityHeader.MinVersion; ILModel = model; // Check for matching metadata and binary versions if (unityHeader.MetadataVersion != model.Package.BinaryImage.Version) { Console.WriteLine($"Warning: selected version {UnityVersion} (metadata version {unityHeader.MetadataVersion})" + $" does not match metadata version {model.Package.BinaryImage.Version}."); } // Get addresses of IL2CPP API function exports Exports = model.Package.Binary.Image.GetExports().ToList(); // Start creation of type model by parsing all of the Unity IL2CPP headers Types = CppTypes.FromUnityHeaders(unityHeader, WordSize); // TODO: Process every type in the binary //var decl = new CppDeclarationGenerator(this); }
public CppDeclarationGenerator(AppModel appModel) { this.appModel = appModel; InitializeNaming(); InitializeConcreteImplementations(); // Configure inheritance style based on binary type; this can be overridden by setting InheritanceStyle in the object initializer InheritanceStyle = CppCompiler.GuessFromImage(model.Package.BinaryImage); }