Overview
HayBox allows you to switch between different controller modes on the fly without unplugging your controller. Mode selection is configured through button combinations that you can customize in your config files.How Mode Selection Works
Mode selection happens in two places:- Default mode on plugin: Configured in
config_defaults.hpp - Mode switching: Handled by
select_mode()function during runtime
Default Mode Configuration
Default modes and their activation bindings are defined inconfig_defaults.hpp:
HAL/pico/include/config_defaults.hpp
Default Mode Activation Bindings
The standard button combinations for switching modes are:Melee Mode
Start + Mod X + L
BTN_MB1 + BTN_LT1 + BTN_LF4Default mode with 2IP No Reactivation SOCDProject M Mode
Start + Mod X + Left
BTN_MB1 + BTN_LT1 + BTN_LF3Optimized for Project M/Project+Ultimate Mode
Start + Mod X + Down
BTN_MB1 + BTN_LT1 + BTN_LF2Uses 2IP with reactivationFGC Mode
Start + Mod X + B
BTN_MB1 + BTN_LT1 + BTN_RF1Hitbox-style fighting game layoutRivals of Aether
Start + Mod X + B
BTN_MB1 + BTN_LT1 + BTN_RF1Configured for Rivals of AetherKeyboard Mode
Start + Mod Y + L
BTN_MB1 + BTN_LT2 + BTN_LF4Only available with DInput backendThe select_mode() Function
The mode selection logic runs continuously in the main loop:src/core/mode_selection.cpp
Adding Custom Mode Bindings
You can add new modes or modify existing bindings by editing thedefault_config in your platform’s config_defaults.hpp:
Open config_defaults.hpp
Navigate to your platform’s config defaults file:
- Pico:
HAL/pico/include/config_defaults.hpp - Arduino USB:
HAL/avr/avr_usb/include/config_defaults.hpp - Arduino No USB:
HAL/avr/avr_nousb/include/config_defaults.hpp
Available Button Identifiers
When creating activation bindings, use these button identifiers:Setting Modes Programmatically
You can also set modes programmatically using theset_mode() functions:
Mode-Specific Options
Some modes support additional configuration options:Melee Mode Options
Project M Mode Options
Understanding Mode Activation Masks
The firmware uses bitmasks for efficient button combination checking:SOCD Configuration in Modes
Each mode can specify its own SOCD (Simultaneous Opposite Cardinal Direction) resolution. The SOCD type is passed when creating the mode config:See the SOCD documentation for detailed information about SOCD types and configuration.
Best Practices
Avoid Conflicting Bindings
Make sure your activation bindings don’t overlap. For example, if one mode uses
Start + Mod X + L and another uses Start + Mod X, the latter will always activate first.Test on Plugin
Remember that modes can also be selected on plugin by holding the activation binding. Test this to ensure your bindings work correctly.
Use Consistent SOCD
Keep SOCD settings consistent across similar modes to avoid confusion when switching.
See Also
- SOCD Configuration - Configure SOCD resolution
- Console Selection - Backend selection setup
- Creating Custom Modes - Build custom controller modes
