Skip to content

Commit

Permalink
WiiU: Map the buttons according to an Xbox-Controller and then swap t…
Browse files Browse the repository at this point in the history
…hem with the swap abxy setting
  • Loading branch information
Ghabry committed Aug 27, 2024
1 parent c04b8b5 commit 673d2e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/game_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,16 @@ void Game_ConfigInput::Hide() {
Game_Config Game_Config::Create(CmdlineParser& cp) {
Game_Config cfg;

// Set platform specific defaults
#if USE_SDL >= 2
cfg.video.scaling_mode.Set(ConfigEnum::ScalingMode::Bilinear);
#endif

#if defined(__WIIU__)
cfg.input.gamepad_swap_ab_and_xy.Set(true);
#endif


cp.Rewind();

config_path = GetConfigPath(cp);
Expand Down
2 changes: 2 additions & 0 deletions src/platform/sdl/sdl2_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,8 @@ void Sdl2Ui::vGetConfig(Game_ConfigVideo& cfg) const {
#elif defined(__WIIU__)
// Only makes the screen flicker
cfg.fullscreen.SetOptionVisible(false);
// WiiU always pauses apps in the background
cfg.pause_when_focus_lost.SetOptionVisible(false);
#endif
}

Expand Down
25 changes: 13 additions & 12 deletions src/platform/wiiu/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{DOWN, Keys::JOY_DPAD_DOWN},
{LEFT, Keys::JOY_DPAD_LEFT},
{RIGHT, Keys::JOY_DPAD_RIGHT},
{DECISION, Keys::JOY_A},
{CANCEL, Keys::JOY_B},
{CANCEL, Keys::JOY_X},
{SHIFT, Keys::JOY_Y},
{DECISION, Keys::JOY_B},
{CANCEL, Keys::JOY_A},
{CANCEL, Keys::JOY_Y},
{SHIFT, Keys::JOY_X},
{N0, Keys::JOY_LSTICK},
{N5, Keys::JOY_RSTICK},
{DEBUG_ABORT_EVENT, Keys::JOY_SHOULDER_LEFT},
Expand Down Expand Up @@ -65,17 +65,18 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
}

Input::KeyNamesArray Input::GetInputKeyNames() {
// FIXME: Wiimote mapping is broken, consider removing
// FIXME: The mapping is named in terms of WiiU Gamepad / Controller
// For Wiimote the reported buttons change depending whether a Nunchuck is connected
return {
{Keys::JOY_A, "A"}, // 2 (Wiimote)
{Keys::JOY_B, "B"}, // 1 (Wiimote)
{Keys::JOY_X, "X"}, // (Pad/CC/Pro) / B (Wiimote) / Z (Wiimote+Nunchuck)
{Keys::JOY_Y, "Y"}, // (Pad/CC/Pro) / A (Wiimote) / C (Wiimote+Nunchuck)
{Keys::JOY_B, "A"}, // 2 (Wiimote) / A (Wiimote+Nunchuck)
{Keys::JOY_A, "B"}, // 1 (Wiimote) / B (Wiimote+Nunchuck)
{Keys::JOY_Y, "X"}, // (Pad/CC/Pro) / B (Wiimote) / Z (Wiimote+Nunchuck)
{Keys::JOY_X, "Y"}, // (Pad/CC/Pro) / A (Wiimote) / C (Wiimote+Nunchuck)
{Keys::JOY_BACK, "-"},
{Keys::JOY_START, "+"},
{Keys::JOY_GUIDE, "Home"}, // FIXME: not mapped at all, maybe use custom trigger
{Keys::JOY_SHOULDER_LEFT, "L"},
{Keys::JOY_SHOULDER_RIGHT, "R"},
{Keys::JOY_GUIDE, "Home"}, // The Home Key is not notified
{Keys::JOY_SHOULDER_LEFT, "L"}, // 1 (Wiimote+Nunchuck)
{Keys::JOY_SHOULDER_RIGHT, "R"}, // 2 (Wiimote+Nunchuck)
{Keys::JOY_LTRIGGER_FULL, "ZL"},
{Keys::JOY_RTRIGGER_FULL, "ZR"},

Expand Down

0 comments on commit 673d2e7

Please sign in to comment.