From ab751e182de5b8ed24b5131732f50d219b21783a Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Wed, 18 Mar 2026 13:10:26 +0100 Subject: [PATCH 1/3] ghidra: Move idarename to PyGhidra with toAddr int / long hackfix --- ida/ffxiv_idarename.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ida/ffxiv_idarename.py b/ida/ffxiv_idarename.py index ed897d881..b918e49bf 100644 --- a/ida/ffxiv_idarename.py +++ b/ida/ffxiv_idarename.py @@ -1,7 +1,7 @@ # current exe version: 2020.12.29.0000.0000 # @category __UserScripts # @menupath Tools.Scripts.ffxiv_idarename -# @runtime Jython +# @runtime PyGhidra from __future__ import print_function import os @@ -330,6 +330,17 @@ def format_func_name(self, ea, current_func_name, proposed_func_name, class_name except ImportError: print("Warning: Unable to load Ghidra") else: + + # Selftest and hackfix for int / long overload conflicts in current year. + try: + toAddr(0x140000000) + except OverflowError: + import jpype.types + + toAddrOrig = toAddr + def toAddr(ea): + return toAddrOrig(jpype.types.JLong(ea)) + # noinspection PyUnresolvedReferences class GhidraApi(BaseApi): @property From db256f17c176164b4c225f564b857f59cfdd54ce Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Wed, 18 Mar 2026 13:37:57 +0100 Subject: [PATCH 2/3] ghidra: Move structimporter to PyGhidra using explicit ArrayList --- ida/ffxiv_structimporter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ida/ffxiv_structimporter.py b/ida/ffxiv_structimporter.py index e6317d53e..19ec351ff 100644 --- a/ida/ffxiv_structimporter.py +++ b/ida/ffxiv_structimporter.py @@ -1,6 +1,6 @@ # @category __UserScripts # @menupath Tools.Scripts.ffxiv_structimport -# @runtime Jython +# @runtime PyGhidra from yaml import load @@ -707,6 +707,7 @@ def should_update_virt_func(self): from ghidra.program.model.listing import * from ghidra.program.model.symbol import SourceType from ghidra.app.util import SymbolPathParser + from java.util import ArrayList except ImportError: print("Warning: Unable to load Ghidra") @@ -816,13 +817,13 @@ def get_func_by_name(self, name): return funcs.first if not funcs.size() == 0 else None def create_memberfunc_args(self, member_func): - # type: (DefinedStructMemFunc) -> list[ParameterImpl] - arg_vars = [] + # type: (DefinedStructMemFunc) -> ArrayList + arg_vars = ArrayList() for param in member_func.parameters: dt = self.get_datatype(param.type) if not dt: - return [] - arg_vars.append(ParameterImpl(param.name, dt, currentProgram)) + return ArrayList() + arg_vars.add(ParameterImpl(param.name, dt, currentProgram)) return arg_vars @property From 2263b75d0b214407bccf0834013ec4584fc587f2 Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Wed, 18 Mar 2026 13:49:39 +0100 Subject: [PATCH 3/3] ghidra: Update getting started steps for PyGhidra --- Ghidra/Getting Started.md | 19 +++++++++++-------- ida/README.md | 5 +---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Ghidra/Getting Started.md b/Ghidra/Getting Started.md index d44a9db76..79c54c805 100644 --- a/Ghidra/Getting Started.md +++ b/Ghidra/Getting Started.md @@ -1,7 +1,9 @@ # Pre-requisites -Download and install [Ghidra](https://ghidra-sre.org/) +Download and install [Ghidra](https://ghidra-sre.org/). They have an installation guide and some additional depdendencies themselves (Java runtime). +Afterwards, ensure that you can **launch PyGhidra.** + # Getting started with a new project `File -> New Project` or press `Ctrl+N`
`Non-Shared Project` is fine, then click `Next >>`
@@ -38,15 +40,16 @@ Note that after each patch, you'll have to re-import, re-analyze, and re-run any

# Script dependency installation: -We use [..\ida\ffxiv_idarename.py](../ida/ffxiv_idarename.py) to apply data.yml. The same script works for both IDA and Ghidra, howver it's slightly more complicated in Ghidra as it uses an embedded version of jython. +We use [..\ida\ffxiv_idarename.py](../ida/ffxiv_idarename.py) to apply data.yml. The same script works for both IDA and Ghidra, howver it's slightly more complicated in Ghidra as we need to add dependencies to the PyGhidra environment manually. + +- Install a copy of [Python 3](https://www.python.org/downloads/).
+Note: it has to be major version 3, so something like [Python 3.14.3](https://www.python.org/downloads/release/python-3143/) works.
-- Install a copy of [Python 2](https://www.python.org/downloads/).
-Note: it has to be major version 2, so something like [Python 2.7.18](https://www.python.org/downloads/release/python-2718/) works.
+- Check your PyGhidra log for "virtual environment" and copy the path. It should be something similar to this:
+`/home/user/.config/ghidra/ghidra_VERSION/venv` -- Execute the following:
-`python.exe -m pip install -t \Ghidra\Features\Jython\lib\Lib\site-packages pyyaml==5.4.1 anytree==2.8.0`
-Note: this must be run from Python 2. If you have multiple versions installed, you may need to qualify the path like:
-`c:\Python27\python.exe -m pip install -t \Ghidra\Features\Jython\lib\Lib\site-packages pyyaml==5.4.1 anytree==2.8.0` +- Execute the following, using the venv path from the log:
+`.../venv/bin/python -m pip install pyyaml==6.0.3 anytree==2.13.0` - Open the Script Manager

diff --git a/ida/README.md b/ida/README.md index b18142b0b..176730e65 100644 --- a/ida/README.md +++ b/ida/README.md @@ -10,10 +10,7 @@ This could be either Python2 or Python3. Additionally, you will need to place "idauser.cfg" from this repository in "%AppData%\Hex-Rays\IDA Pro\". IDA doesn't allow you to use certain characters in names and this config changes that. #### Ghidra dependency installation: -This is slightly more complicated as Ghidra uses an embedded version of Jython. -- Install a copy of Python2 from https://www.python.org/downloads/ -- Execute the following `python.exe -m pip install -t \\Ghidra\Features\Jython\lib\Lib\site-packages pyyaml==5.4.1 anytree==2.8.0` -- Add `FFXIVClientStructs\ida` as a script directory. +See [Getting Started](../Ghidra/Getting%20Started.md) for information on how to set up PyGhidra. ## ffxiv_sigmaker.py > [!WARNING]