Available Hooks
All hooks are defined inrex/rex_app.h:88-103.
OnPreSetup
Runtime::Setup(). This is your opportunity to configure backend injection.
Typical uses:
- Set graphics backend (Vulkan, OpenGL)
- Set audio backend (SDL, custom)
- Set input backend (SDL, custom)
- Enable tool mode
rex/rex_app.h:90
OnPostSetup
- Query subsystem state
- Configure kernel objects
- Set up custom memory regions
- Initialize game-specific systems
rex/rex_app.h:93
OnConfigurePaths
- Override default paths programmatically
- Apply platform-specific path logic
- Validate or create directories
rex/rex_app.h:102-103
OnCreateDialogs
- Register custom debug overlays
- Add game-specific UI panels
- Create settings dialogs
rex/rex_app.h:96
OnShutdown
- Save user data or settings
- Release custom subsystems
- Flush logs
- Clean up background threads
rex/rex_app.h:99
Hook Execution Order
Hooks are called in this sequence during application startup:
During shutdown:
Complete Example
Here’s a full example using all hooks:Best Practices
Do
- Override only the hooks you need
- Call base class implementation if you override and want default behavior
- Use REXLOG macros for debugging hook execution
- Keep hooks focused and minimal
- Use
OnPreSetupfor all backend configuration - Use
OnPostSetupto validate runtime state - Use
OnShutdownto save user data
Don’t
- Don’t perform long-running operations in hooks (blocks startup)
- Don’t access runtime() before OnPostSetup
- Don’t access window() or imgui_drawer() before OnCreateDialogs
- Don’t spawn threads in OnPreSetup (runtime not ready)
- Don’t forget to clean up resources created in hooks
Thread Safety
Hooks are called on the main thread during initialization. The PPC module thread starts after all hooks complete. If you spawn additional threads in hooks, ensure proper synchronization:Next Steps
ReXApp Base Class
Learn about the application framework
Runtime Setup
Configure backend systems
UI Integration
Add custom ImGui dialogs