Overview
HayBox’s communication backend selection allows your controller to work with different consoles and PC setups. The backend is selected through auto-detection and button holds on plugin, and you can customize this behavior in your device’sconfig.cpp file.
Backend Selection Logic
Backend selection happens in thesetup() function of your config file (e.g., config/pico/config.cpp or config/arduino/config.cpp).
Pico/RP2040 Devices
On Pico-based controllers, USB vs GameCube vs Nintendo 64 is detected automatically using thedetect_console() function.
Pico devices don’t require polling rate configuration because they have enough processing power to read inputs after receiving the console poll.
Arduino/AVR Devices
On Arduino-based controllers, the backend selection is more explicit:Polling Rate Configuration
GameCube Polling Rates
For Arduino/AVR controllers, you can configure the polling rate to match your setup. This is especially important for overclocked adapters.Understand Polling Rates
The polling rate tells the firmware when to expect the next poll from the console or adapter. Common rates:
- 125Hz: Native GameCube console
- 1000Hz: Overclocked GameCube adapters
- 0: Disables the polling fix (for official adapters)
Locate Backend Initialization
Find where
GamecubeBackend is created in your backend initialization code. The polling rate is passed as a parameter to the constructor.N64 Polling Rates
Nintendo 64 backend works similarly:Understanding the Initialization Process
Theinitialize_backends() function handles:
- Console Detection: Checks if plugged into GameCube/N64
- Button Hold Detection: Reads which buttons are held on plugin
- Backend Selection: Chooses appropriate backend based on detection
- Secondary Backends: Initializes additional backends (e.g., B0XX input viewer)
Backend Configuration Structure
Backends are configured inconfig_defaults.hpp:
Custom Backend Selection
You can implement custom backend selection logic by providing a custom function toinitialize_backends():
Available Backends
XInput mode for PC gaming. Default for Pico on USB. Works plug-and-play with most PC games.
DirectInput mode for PC. Default for Arduino on USB. Supports keyboard modes.
Nintendo Switch USB mode. Automatically sets Ultimate mode as default.
GameCube console communication. Auto-detected when plugged into GameCube.
Nintendo 64 console communication. Auto-detected or selected via button hold.
Troubleshooting
Controller Not Working with Console
Official Adapter with Arduino
Official Adapter with Arduino
Hold A (RT1) on plugin to disable the polling fix by passing
0 as the polling rate.Arduino Without Boost Circuit
Arduino Without Boost Circuit
Requires 5V power:
- Mayflash adapter: Both USB cables plugged in
- Console: Rumble line must be intact
High Latency on Console
High Latency on Console
Make sure you’re using the correct polling rate (125Hz for native console). Using 1000Hz on console causes increased input lag.
See Also
- Mode Selection - Configure game mode bindings
- Input Sources - Add Nunchuk or other input sources
- Creating Custom Modes - Build your own controller modes
