Overview
TheFunctionConfig structure defines configuration for individual functions and code chunks in the recompiler. Related structures include MidAsmHook for injecting custom code, and SectionInfo/FunctionEntry for analysis output.
FunctionConfig
Unified configuration for both standalone functions and discontinuous chunks.Fields
Explicit function size in bytes. Mutually exclusive with
end. If both are specified, size takes precedence.End address of the function (exclusive). Mutually exclusive with
size. Used when the function boundary is known by address rather than size.Custom symbol name for the function. If empty, auto-generates a name in the format
sub_XXXXXXXX where X is the hexadecimal address.Parent function address. Set to 0 for standalone functions. Non-zero indicates this is a discontinuous chunk belonging to the parent function at the specified address.
Methods
getSize()
Get the effective size of the function.Starting address of the function.
size field if set, otherwise calculates end - address.
Example:
isChunk()
Check if this configuration represents a discontinuous chunk.true if parent != 0, indicating this is a chunk belonging to another function.
Example:
Usage in RecompilerConfig
Functions are configured via thefunctions map in RecompilerConfig:
TOML Configuration
MidAsmHook
Configuration for injecting custom C++ code at specific instruction addresses.Fields
Name of the C++ function to call at this hook point. The function signature should match the register arguments specified.
List of PowerPC registers to pass as arguments to the hook function. Valid values include
"r3", "r4", "f1", "ctx", etc.If
true, the hook function’s return value is used as the function’s return value, and execution stops.If
true, return from the current function when the hook function returns a truthy value.If
true, return from the current function when the hook function returns a falsy value.Unconditional jump target address. If non-zero, execution jumps to this address after the hook executes.
Conditional jump target when hook returns true. If non-zero, jumps to this address when the hook function returns a truthy value.
Conditional jump target when hook returns false. If non-zero, jumps to this address when the hook function returns a falsy value.
If
true, execute the hook after the current instruction. If false, execute before the instruction.Example
TOML Configuration
SectionInfo
Metadata about executable sections for analysis output.Section name (e.g.,
.text, .data, .rdata).Starting address of the section.
Size of the section in bytes.
Section flags indicating permissions:
"rx" (read+execute), "rw" (read+write), "r" (read-only), etc.FunctionEntry
Function metadata for analysis output.Starting address of the function.
Size of the function in bytes.
Function name. Defaults to
"sub_XXXXXXXX" if not specified.See Also
- RecompilerConfig - Main configuration structure
- Recompiler - Recompiler class