Runtime class is the core subsystem coordinator for recompiled applications. It manages memory, file system, kernel state, and hardware interfaces (graphics, audio, input). Backend systems are injected via RuntimeConfig to keep the runtime library decoupled from concrete implementations.
RuntimeConfig Structure
Defined inrex/runtime.h:53-58:
Fields
- graphics: Graphics backend instance (Vulkan, OpenGL, etc.)
- audio_factory: Factory function for audio backend (requires Processor at construction)
- input_factory: Factory function for input backend (depends on tool_mode)
- tool_mode: If true, skips GPU initialization for analysis tools
Backend Injection
Backends are configured in theOnPreSetup() hook before Runtime::Setup() is called.
Basic Configuration
rex/runtime.h:65-73 for helper macro definitions.
Helper Macros
ReXGlue provides convenience macros to reduce boilerplate:REX_GRAPHICS_BACKEND
rex/runtime.h:65
REX_AUDIO_BACKEND
rex/runtime.h:66-69
REX_INPUT_BACKEND
rex/runtime.h:70-73
Backend Interfaces
All backends implement abstract interfaces defined inrex/system/interfaces/.
IGraphicsSystem
rex/system/interfaces/graphics.h:29-35
IAudioSystem
rex/system/interfaces/audio.h:22-27
IInputSystem
rex/system/interfaces/input.h:18-23
Available Backends
ReXGlue SDK includes these backend implementations:Graphics Backends
| Backend | Class | Description |
|---|---|---|
| Vulkan | rex::graphics::vulkan::VulkanGraphicsSystem | Modern Vulkan renderer (recommended) |
| OpenGL | rex::graphics::gl::GLGraphicsSystem | Legacy OpenGL 4.5+ renderer |
Audio Backends
| Backend | Class | Description |
|---|---|---|
| SDL | rex::audio::sdl::SDLAudioSystem | Cross-platform SDL2 audio |
| Null | rex::audio::null::NullAudioSystem | Silent audio (testing) |
Input Backends
| Backend | Function | Description |
|---|---|---|
| SDL | rex::input::sdl::SetupSDLInput | Cross-platform SDL2 input |
| Null | rex::input::null::SetupNullInput | No-op input (testing) |
Tool Mode
Settingconfig.tool_mode = true disables graphics initialization for headless analysis tools:
- Static analysis tools
- Headless servers
- Automated testing
- CI/CD environments
Runtime Construction
The Runtime is constructed with filesystem paths:rex/runtime.h:85-87
Path Configuration
Paths are configured via theOnConfigurePaths() hook before Runtime construction:
PathConfig Structure
rex/rex_app.h:47-51
Runtime Setup Process
After configuration,Runtime::Setup() initializes subsystems in order:
Virtual File System
VFS mounts:
game:→ game_data_rootd:→ game_data_root (alias)update:→ update_data_root
Runtime Accessors
Access subsystems through Runtime methods:rex/runtime.h:98-113
Advanced: Custom Backends
You can implement custom backends by inheriting the interface classes:Next Steps
ReXApp Base Class
Learn about the application framework
Custom Hooks
Customize behavior with virtual hooks