1. Access RetroArch Settings:

   - In Emulation Station, navigate to the RetroArch settings.

2. Input Settings:

   - Within the RetroArch settings menu, select `Settings` -> `Input`.

3. Configure Port 1 Controls:

   - Go to `Port 1 Controls`.

4. Adjust Mouse Index:

   - Inside Port 1 Controls, locate `Mouse Index`.

5. Select Device:

   - Choose `HID 1241:1111` for the Mouse Index. If using the Tankstick Max, select the `HID 1241:1111` option corresponding to the trackball linked to the Red LED button. This is essential for proper functionality.

6. Save Configuration:

   - Return to the main menu where `Input` is visible.

   - Select `Configuration`.

   - Ensure `Save Configuration on Quit` is enabled.

7. Set Up Hotkeys:

   - Go back, then access `Input` and navigate to `Hotkeys`.

   - Within Hotkeys, select `Quit`.

8. Map the Red LED Button:

   - Press the Red LED button to assign it as the quit hotkey. If it doesn’t respond, revisit step 5 and try a different `HID 1241:1111` index.

9. Enable Hotkey Button:

   - Choose `Hotkey Enable` and press the Red LED button again to finalize its mapping.

10. Exit Games Using the Red LED Button:

    - With these settings, you can now exit games using the Red LED button. For convenience, it's advised to enable the `Confirm Quit` option in the Hotkeys settings to avoid unintended game exits.


If this is not working for you, please try below method.


Custom Script Method (Special thanks to Gary from ArcadeWorkshop for creating this script)


This script will allow the red LED button to exit games. After installation, it creates a new menu item called "Red Exit Button" to enable or disable the feature.


Follow these steps:
  1. Connect your RetroPie to Wi-Fi, then press F4 to open the terminal.
  2. Download the script:
    wget https://downloads.sourceforge.net/project/xgaming/exit_btn_setup.sh
    
  3. Make it executable:
    chmod +x exit_btn_setup.sh
    
  4. Run the script:
    ./exit_btn_setup.sh
    
Also, ensure that port 1 control's mouse index is set to 'HID 1241:1111 for proper functionality.