Overview
TheRecompilerConfig structure defines all configuration options for the PowerPC to C++ recompiler, including input/output paths, code generation flags, analysis tuning parameters, and manual overrides.
Structure Definition
Required Fields
Project name used for output file naming. Generated files will be named
{projectName}_generated_{index}.cpp.Path to the input XEX or ELF binary file to recompile.
Output directory where generated C++ source files will be written.
Patch Files
Path to binary patch file (feature not yet implemented).
Path to write patched binary (feature not yet implemented).
Code Generation Options
Skip generating link register (LR) operations.
Allocate the count register (CTR) as a C++ local variable instead of using
ctx.ctr.Allocate the fixed-point exception register (XER) as a C++ local variable.
Allocate the reserved register (r13) as a C++ local variable.
Skip generating machine state register (MSR) operations.
Allocate condition register fields as C++ local variables.
Allocate non-argument general-purpose registers as C++ local variables. Excludes r3-r10 which are used for arguments.
Allocate non-volatile general-purpose registers (r14-r31) as C++ local variables.
Generate SEH (Structured Exception Handling) exception handler wrapper functions.
Analysis Tuning
Maximum number of bytes to extend a function boundary when resolving jump table targets. Prevents runaway function detection.
Number of consecutive invalid instructions required to mark a region as data (not code). Helps distinguish embedded data from code.
Size threshold in bytes (default 1MB). Functions exceeding this size trigger a warning as they may indicate detection errors.
Manual Overrides
Map of address to function configuration. Allows manual specification of function boundaries, names, and chunk relationships. See FunctionConfig.
Map of address to jump table definitions for switch statement reconstruction.
Map of address to mid-assembly hook configurations. Allows injecting custom C++ code at specific instruction addresses. See FunctionConfig.
Address of custom
longjmp implementation (0 = use standard library).Address of custom
setjmp implementation (0 = use standard library).User Hints
Map of address to size (in bytes) marking known invalid instruction regions. Merged with analysis results to improve disassembly accuracy.
Set of addresses where
bctr instructions are known to be indirect calls (vtable dispatch, computed calls) rather than tail calls.Additional exception handler function addresses not detected by automatic analysis.
Methods
Load()
Load configuration from a TOML file.Path to the TOML configuration file.
Validate()
Validate the loaded configuration.ValidationResult containing warnings and errors
Checks performed:
- Address alignment (4-byte boundaries)
- Required fields are non-empty
- Function size/end constraints
- Path validity
- Sanity checks (e.g.,
maxJumpExtensionnot excessive)
ValidationResult
Nested structure returned byValidate().
true if no errors occurred (warnings are allowed). false if fatal errors exist.Non-fatal issues that don’t prevent code generation but should be reviewed.
Fatal issues that block code generation unless
force is used.See Also
- Recompiler - Main recompiler class
- FunctionConfig - Per-function configuration
- FunctionConfig - Per-function and hook configuration