From 6ad609a539af230efbac11ba2d497c19ac288a06 Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 17:13:37 -0600 Subject: [PATCH] Added GPIO14 button and UI config buttons --- src/citra/config.cpp | 2 +- src/citra/default_ini.h | 1 + src/citra_qt/configuration/config.cpp | 5 ++- .../configuration/configure_input.cpp | 3 +- src/citra_qt/configuration/configure_input.ui | 38 ++++++++++++++++++- src/core/hle/service/hid/hid.cpp | 1 + src/core/hle/service/hid/hid.h | 1 + src/core/settings.h | 2 + 8 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index b705f8418..45319a4e1 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -49,7 +49,7 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { static const std::array default_buttons = { SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_T, SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_M, SDL_SCANCODE_N, - SDL_SCANCODE_P, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_B, + SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_B, }; static const std::array, Settings::NativeAnalog::NumAnalogs> default_analogs{{ diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 87c763faf..f75af9cc3 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -39,6 +39,7 @@ button_r= button_start= button_select= button_debug= +button_gpio14= button_zl= button_zr= button_home= diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index fc7e8c68e..90cabf124 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -27,8 +27,9 @@ Config::~Config() { } const std::array Config::default_buttons = { - Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H, - Qt::Key_Q, Qt::Key_W, Qt::Key_M, Qt::Key_N, Qt::Key_P, Qt::Key_1, Qt::Key_2, Qt::Key_B, + Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_T, Qt::Key_G, + Qt::Key_F, Qt::Key_H, Qt::Key_Q, Qt::Key_W, Qt::Key_M, Qt::Key_N, + Qt::Key_O, Qt::Key_P, Qt::Key_1, Qt::Key_2, Qt::Key_B, }; const std::array, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{ diff --git a/src/citra_qt/configuration/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp index 86ae49930..50487d084 100644 --- a/src/citra_qt/configuration/configure_input.cpp +++ b/src/citra_qt/configuration/configure_input.cpp @@ -103,7 +103,8 @@ ConfigureInput::ConfigureInput(QWidget* parent) ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY, ui->buttonDpadUp, ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL, ui->buttonR, ui->buttonStart, ui->buttonSelect, - nullptr, ui->buttonZL, ui->buttonZR, ui->buttonHome, + ui->buttonDebug, ui->buttonGpio14, ui->buttonZL, ui->buttonZR, + ui->buttonHome, }; analog_map_buttons = {{ diff --git a/src/citra_qt/configuration/configure_input.ui b/src/citra_qt/configuration/configure_input.ui index 8421adf09..581223274 100644 --- a/src/citra_qt/configuration/configure_input.ui +++ b/src/citra_qt/configuration/configure_input.ui @@ -7,7 +7,7 @@ 0 0 370 - 534 + 595 @@ -549,6 +549,42 @@ + + + + + + GPIO14: + + + + + + + + + + + + + + + + + + Debug: + + + + + + + + + + + + diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index f1ae2f8c0..7393ad684 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -88,6 +88,7 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) { state.start.Assign(buttons[Start - BUTTON_HID_BEGIN]->GetStatus()); state.select.Assign(buttons[Select - BUTTON_HID_BEGIN]->GetStatus()); state.debug.Assign(buttons[Debug - BUTTON_HID_BEGIN]->GetStatus()); + state.gpio14.Assign(buttons[Gpio14 - BUTTON_HID_BEGIN]->GetStatus()); // Get current circle pad position and update circle pad direction float circle_pad_x_f, circle_pad_y_f; diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 9d2d8d984..2aba49b3a 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -53,6 +53,7 @@ struct PadState { BitField<10, 1, u32> x; BitField<11, 1, u32> y; BitField<12, 1, u32> debug; + BitField<13, 1, u32> gpio14; BitField<28, 1, u32> circle_right; BitField<29, 1, u32> circle_left; diff --git a/src/core/settings.h b/src/core/settings.h index 9c4ded86f..4a6d8aee7 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -39,6 +39,7 @@ enum Values { Start, Select, Debug, + Gpio14, ZL, ZR, @@ -74,6 +75,7 @@ static const std::array mapping = {{ "button_start", "button_select", "button_debug", + "button_gpio14", "button_zl", "button_zr", "button_home",