ReXGlue SDK Documentation
repository·main·Indexed 20 days ago
https://github.com/rexglue/rexglue-sdkAn SDK designed to convert Xbox 360 PowerPC (PPC) code into portable C++ source code for native execution on modern hardware via ahead-of-time static recompilation. The SDK includes a filesystem API with the Entry class, application logic bases like XamApp, XgiApp, and XmpApp, and vendored components such as AES-128 and DirectXShaderCompiler (DXC) API headers.
What's inside ReXGlue SDK
- ReXGlue is a tool that converts Xbox 360 PowerPC (PPC) code into portable C++ code. This allows the code to run natively on modern platforms. Unlike traditional emulators that use interpretation or JIT (Just-In-Time) compilation at runtime, ReXGlue uses a static recompilation approach: it generates C++ source code ahead of time. This methodology is inspired by projects like XenonRecomp and rexdex's recompiler.
AES-128 Implementation Overview
mainThis is a C implementation of the AES-128 algorithm. It provides several implementation styles within the repository:
- Reference implementation (
./aes.c): The primary implementation to read first. - Full unroll implementation (
./unroll/aes.c): An unrolled version that is easier to understand after reading the reference. - Look up table (LUT) implementation (
./lut/aes.c): A widely used software implementation style. This version requires a little-endian machine. It includes utility files for generating tables:gen_dec_key_table.c,gen_enc_table.c, andgen_dec_table.c.
- Reference implementation (
Understand ReXGlue SDK versioning and stability
mainThe ReXGlue SDK uses an automated versioning system based on CMake's
CMAKE_VERSIONconvention:MAJOR.MINOR[.PATCH[.TWEAK]][-id].Stability Rules:
- Stable: Only versions without an
-idtrailer (e.g.,0.7.5) are considered stable and covered by the public API. - Unstable: Versions containing
-devor-rctrailers are unstable pre-releases.
Version Derivation:
- Tagged commits: The version is the tag verbatim (minus the leading
v). release/*branches:MAJOR.<floor-minor>.<tag-patch>.<commit-count>-rc.g<sha>.developmentbranch:MAJOR.<floor-minor>.<tag-patch>.<commit-count>-dev.g<sha>.
Note on the 'API Floor': The
CMakeLists.txtfile defines thePROJECT VERSION MAJOR.MINOR.0. This 'floor' represents the minimum versioned API. The patch field inCMakeLists.txtis a placeholder and should not be used for routine releases.- Stable: Only versions without an
Access ReXGlue Quickstart and CLI Reference
mainFor detailed instructions on how to get started, a full reference for the Command Line Interface (CLI), and a list of configuration file options, please refer to the project's official wiki.Perform a standard release of ReXGlue SDK
mainFollow these steps to cut and publish a standard release from the
developmentbranch:1. Cut the release branch
Determine the next version (usually
MAJOR.MINOR.<last-tag-patch + 1>). If the API floor was recently bumped, the next release isMAJOR.<new-floor-minor>.0.git fetch origin git checkout -b release/X.Y.Z origin/development git push -u origin release/X.Y.Z2. Open a Pull Request
Open a PR from
release/X.Y.Zintomain.3. Merge and Tag
Once the release is ready, merge the release branch into
developmentfirst to ensure fixes flow back, then merge intomainusing a non-fast-forward merge commit.# Merge into development git checkout development git pull git merge --no-ff release/X.Y.Z -m "Merge release/X.Y.Z into development" git push origin development # Merge into main git checkout main git pull git merge --no-ff release/X.Y.Z -m "Release vX.Y.Z" git push origin main # Tag the release branch tip git tag vX.Y.Z release/X.Y.Z git push origin vX.Y.Z4. Cleanup
Delete the release branch locally and remotely.
git push origin --delete release/X.Y.Z git branch -d release/X.Y.ZHow to bump the public API floor
mainThe API floor should only be bumped when introducing a public API change. This is done via a single commit on the
developmentbranch:- Edit
CMakeLists.txt(specifically line 6) to update thePROJECT VERSIONfrom0.<old>.0to0.<new>.0. - Use the commit message:
chore: bump API floor to 0.<new>.
After a floor bump, the next release branch will be
release/0.<new>.0and the corresponding tag will bev0.<new>.0.# In CMakeLists.txt PROJECT VERSION 0.8.0- Edit
Download ReXGlue SDK builds
mainYou can download the ReXGlue SDK through the official GitHub Releases page. There are two main channels available:
- Release: The latest stable builds.
- Nightly: The latest pre-release builds (experimental).
Check the GitHub Releases page to select the appropriate version for your platform (Windows amd64, Linux amd64, or Linux arm64).
# To find the latest stable release: # Visit https://github.com/rexglue/rexglue-sdk/releases/latestCompile the AES-128 implementation
mainTo compile the AES-128 implementation, use the provided Makefile.makePerform a hotfix release
mainHotfixes are used to fix issues in the current stable version without including new features from
development.- Branch from main: Unlike a normal release, a hotfix branch starts from the last stable tag (
main) rather than thedevelopmenttip.
git fetch origin git checkout -b release/X.Y.Z origin/mainApply fix and merge: Apply the fix on the branch, open a PR into
main, and merge intodevelopmentfirst, thenmain(using--no-ff), following the standard release flow.Constraint: Only one release branch may exist at a time. If a regular release branch is currently open, you must close it without merging before cutting a hotfix. Re-cut the regular release from
developmentafter the hotfix is released.
- Branch from main: Unlike a normal release, a hotfix branch starts from the last stable tag (
Test specification syntax in assembly files
mainThe recompiler parses test specifications directly from
.sassembly files using specific comment directives. A test spec is identified by a label followed by a colon, and its inputs/outputs are defined usingREGISTER_IN,MEMORY_IN,REGISTER_OUT, andMEMORY_OUTdirectives.Directive Formats
Registers
REGISTER_IN <reg> <value>REGISTER_OUT <reg> <value>
Supported register types include:
- GPR: General Purpose Registers (e.g.,
r1 0x10) - Float: Floating point values (e.g.,
f1 1.5) - Vector: Vector registers using bracket notation (e.g.,
v1 [val0, val1, val2, val3]) - Control: Control registers (e.g.,
cr 0)
Memory
MEMORY_IN <address> <hex_bytes>MEMORY_OUT <address> <hex_bytes>
Example Assembly Test Spec
my_test_label: # REGISTER_IN r1 0x10 # REGISTER_IN v1 [1, 2, 3, 4] # MEMORY_IN 0x82010000 AA BB CC DD # # REGISTER_OUT r1 0x20 # REGISTER_OUT v1 [5, 6, 7, 8] # MEMORY_OUT 0x82010000 EE FFUse migration scanning to upgrade SDK projects
mainThe
rexglue::clinamespace provides tools for scanning project trees to identify necessary changes when migrating to a newer version of the ReXGlue SDK. These scanners detect breaking changes, stale includes, template drift, and CMake reference mismatches.Key scanning capabilities include:
- Breaking Change Detection: Identifies legacy tokens that must be replaced.
- Call Site Pattern Matching: Scans for specific code patterns that require manual attention or updates.
- Template Drift: Compares current project files against SDK templates to find discrepancies.
- CMake & Include Analysis: Scans for outdated CMake references and stale
#includedirectives.
Scan for SDK migration breaking changes
mainThe
migration_scanlogic provides tools to identify and automate the migration of projects when upgrading the ReXGlue SDK. It scans project trees for legacy identifiers, broken call sites, and stale includes, and can automatically generate rewrites for CMake files and source code headers.Key scanning capabilities include:
- Legacy Identifier Replacement: Automatically replaces old macros/identifiers (e.g.,
PPC_HOOK$\rightarrow$REX_HOOK) with their new counterparts. - Call Site Pattern Matching: Identifies problematic code patterns that require manual intervention (e.g., changes in function signatures or argument counts).
- CMake Reference Updates: Updates
CMakeLists.txtor.cmakefiles when filenames have changed. - Source Include Rewrites: Automatically updates
#includestatements when header files are renamed (e.g.,*_config.h$\rightarrow$*_init.h). - Stale Include Detection: Warns when a project includes headers that are no longer emitted by the SDK codegen.
- Legacy Identifier Replacement: Automatically replaces old macros/identifiers (e.g.,