diff --git a/Il2CppInspector.Common/Outputs/PythonScript.cs b/Il2CppInspector.Common/Outputs/PythonScript.cs index e27ba9b..550de3d 100644 --- a/Il2CppInspector.Common/Outputs/PythonScript.cs +++ b/Il2CppInspector.Common/Outputs/PythonScript.cs @@ -61,7 +61,8 @@ namespace Il2CppInspector.Outputs .Replace("%SCRIPTFILENAME%", Path.GetFileName(outputFile)) .Replace("%TYPE_HEADER_RELATIVE_PATH%", typeHeaderRelativePath.ToEscapedString()) .Replace("%JSON_METADATA_RELATIVE_PATH%", jsonMetadataRelativePath.ToEscapedString()) - .Replace("%TARGET_UNITY_VERSION%", model.UnityHeaders.ToString()); + .Replace("%TARGET_UNITY_VERSION%", model.UnityHeaders.ToString()) + .Replace("%IMAGE_BASE%", model.Package.BinaryImage.ImageBase.ToAddressString()); File.WriteAllText(outputFile, script); } diff --git a/Il2CppInspector.Common/Outputs/ScriptResources/Targets/Ghidra.py b/Il2CppInspector.Common/Outputs/ScriptResources/Targets/Ghidra.py index bc7a370..54b61be 100644 --- a/Il2CppInspector.Common/Outputs/ScriptResources/Targets/Ghidra.py +++ b/Il2CppInspector.Common/Outputs/ScriptResources/Targets/Ghidra.py @@ -68,7 +68,7 @@ def CustomInitializer(): # Ghidra sets the image base for ELF to 0x100000 for some reason # https://github.com/NationalSecurityAgency/ghidra/issues/1020 if currentProgram.getExecutableFormat().endswith('(ELF)'): - currentProgram.setImageBase(toAddr(0), True) + currentProgram.setImageBase(toAddr(%IMAGE_BASE%), True) def GetScriptDirectory(): return getSourceFile().getParentFile().toString()