Skip to content

rexglue CLI Commands

Tom edited this page Apr 27, 2026 · 2 revisions

Reference for all rexglue subcommands and their flags.

rexglue <command> [flags] [args]

Global Flags

These flags apply to all commands. They are implemented as CVars and can also be set via environment variables (REXCVAR_<name>) or TOML config.

Flag Type Default Description
--log_level <level> string info Log verbosity: trace, debug, info, warning, error
--log_file <path> string (none) Write log output to a file
--log_verbose bool false Override log level to trace (shorthand for --log_level trace)
--force bool false Generate output despite validation errors; skip confirmation prompts
--enable_exception_handlers bool false Enable generation of SEH exception handler wrappers (applies to codegen)

rexglue init

Initialize a new ReXGlue recompiled project.

rexglue init --app_name <name> --app_root <path> [flags]

Required Flags

Flag Type Description
--app_name <name> string Project name. Must start with a letter; may contain alphanumerics, spaces, underscores, and dashes. Automatically normalized to snake_case, PascalCase, and UPPER_CASE variants for use in generated code.
--app_root <path> string Directory to create the project in. Created if it does not exist.

Optional Flags

Flag Type Default Description
--app_desc <text> string "" Project description
--app_author <text> string "" Author name
--force bool false Overwrite existing directory contents

Behavior

Validates the app name, creates the directory structure (src/, generated/), and writes all project files. Fails if the target directory is non-empty unless --force is set.

Generated Files

File Description
CMakeLists.txt Build configuration with SDK discovery and rexglue_setup_target()
src/main.cpp Entry point using REX_DEFINE_APP macro
src/<app_name>_app.h ReXApp subclass with virtual hook stubs
generated/rexglue.cmake SDK integration script (auto-regenerated by migrate)
CMakePresets.json Platform presets: win-amd64-debug, win-amd64-release, win-amd64-relwithdebinfo, linux-amd64-debug, linux-amd64-release, linux-amd64-relwithdebinfo
<app_name>_config.toml Codegen configuration template with required fields populated

rexglue codegen

Analyze an Xbox 360 binary and generate recompiled C++ code.

rexglue codegen <config.toml> [flags]

Arguments

Argument Description
<config.toml> Path to the TOML configuration file (positional, required)

Behavior

Loads the XEX or ELF binary specified in the config, runs the analysis pipeline to discover functions and resolve control flow, then generates PPC-to-C++ recompiled source files. See rexglue CLI Configuration File for all TOML options and Codegen Pipeline Overview for details on the analysis stages.

If --enable_exception_handlers is passed, SEH exception handler wrapper generation is enabled regardless of the TOML setting.

Returns a non-zero exit code on validation failure unless --force is used, in which case output is generated despite errors.


rexglue migrate

Upgrade an existing project to the current SDK version.

rexglue migrate --app_root <path> [flags]

Required Flags

Flag Type Description
--app_root <path> string Path to the existing project root

Optional Flags

Flag Type Default Description
--force bool false Skip confirmation prompt when migrating old-style projects

Behavior

  1. Reads the project name from the *_config.toml file in the project root.
  2. Always regenerates generated/rexglue.cmake to match the current SDK version.
  3. Detects old-style projects (those missing generated/rexglue.cmake) and offers to migrate them:
    • Creates .bak backups of src/main.cpp, CMakeLists.txt, and the app header before overwriting.
    • Writes updated versions of these files using the current templates.
    • Without --force, prompts for confirmation before modifying user-owned files.
  4. If the project already uses the current layout and all user files exist, only generated/rexglue.cmake is updated.

rexglue recompile-tests

Generate Catch2 unit tests from PPC assembly test specifications.

rexglue recompile-tests --bin_dir <path> --asm_dir <path> --output <path>

Required Flags

Flag Type Description
--bin_dir <path> string Directory containing linked .bin files and corresponding .map symbol files
--asm_dir <path> string Directory containing .s assembly source files with test specification directives
--output <path> string Output directory for generated C++ test files

Behavior

Parses PPC assembly source files for register and memory input/output directives (#_REGISTER_IN, #_REGISTER_OUT, #_MEMORY_IN, #_MEMORY_OUT), recompiles each function from the corresponding .bin files, and generates Catch2 test cases with assertions matching the expected outputs.

Generated Files

File Description
ppc_config.h Image constants for the test binaries
ppc_test_functions.cpp Recompiled test function implementations
ppc_test_decls.h Forward declarations for test functions
ppc_test_cases.cpp Catch2 test cases with register/memory assertions

Clone this wiki locally