TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ThalissonTMora/shaiya-chat-native-re/llms.txt
Use this file to discover all available pages before exploring further.
.c files committed to this repository are generated by a set of Ghidra headless-analysis scripts that export decompiled C from specific virtual addresses in the Shaiya Core V9 binaries. This page walks through installing the required tools, setting environment variables, and running or customising the export scripts. All scripts must be run from the repository root and all binaries must be verified before use (see the Binaries page).
Prerequisites
The scripts require a specific JDK version and a matching Ghidra release. Both are expected to live under~/tools/ so the scripts can locate them via environment variables.
| Tool | Version | Expected path |
|---|---|---|
| JDK | 21 (21.0.6+7) | ~/tools/jdk-21.0.6+7 |
| Ghidra | 11.2.1 PUBLIC | ~/tools/ghidra_11.2.1_PUBLIC |
Download and unpack JDK 21
Obtain the
jdk-21.0.6+7 build (Eclipse Temurin or equivalent) and unpack it to ~/tools/:Download and unpack Ghidra 11.2.1
Download
ghidra_11.2.1_PUBLIC from the Ghidra releases page and unpack it:Set environment variables
Export Verify the paths resolve correctly:
JAVA_HOME and GHIDRA_HOME before running any script. Add these lines to your shell profile (.bashrc, .zshrc, etc.) for persistence:Verify binaries
Before running any export script, confirm that the binaries in
bin/ match their expected MD5 hashes:Run an export script
All scripts live under Generated
tools/ghidra/ and must be invoked from the repository root:.c files are written into the appropriate output folder (game-chat-native/, psgame-chat-native/, or pslogin-chat-native/). A copy of the manifest used for that run is also written to the output folder when the script finishes.Decompile Scripts Reference
Each script targets one binary (or a subset of two) and writes output to a specific folder. Never run a script and redirect its output to a different folder than listed here.| Script | Binary | Output folder | Purpose |
|---|---|---|---|
decompile-game-chat.sh | Game.exe | game-chat-native/ | Full client chat export driven by game-chat-functions.manifest |
decompile-psgame-chat.sh | ps_game.exe | psgame-chat-native/ | Full world-server chat export driven by psgame-chat-functions.manifest |
decompile-pslogin-crypto.sh | ps_login.exe | pslogin-chat-native/ | Login-server key-blob path driven by pslogin-crypto-functions.manifest |
decompile-crypto.sh | Game.exe + ps_game.exe | */crypto/ subset | AES-CTR cipher functions from both client and server |
decompile-mini.sh | Any target + custom manifest | Same as target | Fast subset export for a single custom manifest file |
Subset Export with decompile-mini.sh
When you only need to regenerate a small slice of functions — for example, the balloon-UI writer group — usedecompile-mini.sh with a custom manifest file. This avoids a full re-analysis of the entire binary and is significantly faster.
game, psgame, or pslogin). The second argument is the path to any manifest file in the format described below. Output is written to the same folder as the corresponding full export script (i.e., game → game-chat-native/).
Manifest File Format
Every export script is driven by a manifest: a tab-separated text file that lists the functions to decompile. The header comment on line 1 identifies the binary, MD5, ImageBase, and the regeneration script.| Field | Description | Example |
|---|---|---|
category | Logical grouping used in the top-category table | handlers |
SymbolName | The name Ghidra assigns to the exported function | Chat_ProcessIncoming |
0xVA | Absolute virtual address (relative to ImageBase 0x00400000) | 0x0047F400 |
Adding Functions to a Manifest
To add a new function to an existing export:- Find the function’s virtual address in Ghidra (right-click → Copy Address).
- Decide on a category and a descriptive symbol name.
- Append a row to the appropriate manifest file:
- Re-run the corresponding export script to regenerate the output folder:
.c file will appear alongside the existing exports in game-chat-native/.
The ExportDecompileByAddress.java Script
The Ghidra headless scripts call a custom Java script located at:analyzeHeadless for each address in the manifest. It decompiles the function at the given VA and writes a .c file with a standardised header comment that includes the binary name, MD5, ImageBase, and the manifest row that triggered the export. You do not need to edit this file directly — all customisation is done through the manifest files and the shell wrapper scripts.
Rules
- Do not hand-edit generated
.cfiles. They are outputs, not sources. Any manual change will be overwritten the next time the export script runs. If the decompilation is wrong, fix the analysis in Ghidra, update the manifest if needed, and regenerate. - Headers in
.cfiles identify binary + MD5. Use these headers to verify provenance when reviewing pull requests or merging contributions. - All VAs are relative to ImageBase
0x00400000. There is no ASLR. Load each binary in Ghidra with ImageBase set to0x00400000or the addresses in the manifests will not match.