From 403d2f0058a4b6057a8f16ca3474991a16eb9a3b Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 12:47:50 -0600 Subject: [PATCH 1/5] Added Debug Button --- src/citra/config.cpp | 3 ++- src/citra/default_ini.h | 1 + src/citra_qt/configuration/config.cpp | 2 +- src/citra_qt/configuration/configure_input.cpp | 6 ++++-- src/core/hle/service/hid/hid.cpp | 1 + src/core/hle/service/hid/hid.h | 1 + src/core/settings.h | 2 ++ 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 3cd7bec88..e216f233a 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -49,7 +49,8 @@ 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_1, SDL_SCANCODE_2, SDL_SCANCODE_B, + SDL_SCANCODE_M, SDL_SCANCODE_N, 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 730809413..ad5eab433 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -38,6 +38,7 @@ button_l= button_r= button_start= button_select= +button_dbg= button_zl= button_zr= button_home= diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index dcbe18122..fc7e8c68e 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -28,7 +28,7 @@ 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_1, Qt::Key_2, Qt::Key_B, + Qt::Key_Q, Qt::Key_W, Qt::Key_M, Qt::Key_N, 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 b0cc53395..d1bb29f17 100644 --- a/src/citra_qt/configuration/configure_input.cpp +++ b/src/citra_qt/configuration/configure_input.cpp @@ -102,7 +102,8 @@ ConfigureInput::ConfigureInput(QWidget* parent) button_map = { ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY, ui->buttonDpadUp, ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL, ui->buttonR, - ui->buttonStart, ui->buttonSelect, ui->buttonZL, ui->buttonZR, ui->buttonHome, + ui->buttonStart, ui->buttonSelect, nullptr, ui->buttonZL, ui->buttonZR, + ui->buttonHome, }; analog_map_buttons = {{ @@ -273,7 +274,8 @@ void ConfigureInput::ClearAll() { void ConfigureInput::updateButtonLabels() { for (int button = 0; button < Settings::NativeButton::NumButtons; button++) { - button_map[button]->setText(ButtonToText(buttons_param[button])); + if (button_map[button]) + button_map[button]->setText(ButtonToText(buttons_param[button])); } for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 417f3b4d2..b481d3bd6 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -87,6 +87,7 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) { state.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); state.start.Assign(buttons[Start - BUTTON_HID_BEGIN]->GetStatus()); state.select.Assign(buttons[Select - BUTTON_HID_BEGIN]->GetStatus()); + state.dbg.Assign(buttons[Dbg - 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 07bd18230..e240ecea1 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -52,6 +52,7 @@ struct PadState { BitField<9, 1, u32> l; BitField<10, 1, u32> x; BitField<11, 1, u32> y; + BitField<12, 1, u32> dbg; 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 929db156c..8b7d821ea 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -38,6 +38,7 @@ enum Values { R, Start, Select, + Dbg, ZL, ZR, @@ -72,6 +73,7 @@ static const std::array mapping = {{ "button_r", "button_start", "button_select", + "button_dbg", "button_zl", "button_zr", "button_home", From 446b6144090ba8241ce1e1853b406c2067f53c22 Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 13:33:54 -0600 Subject: [PATCH 2/5] Removed unnecessary debug key abbreviations --- src/citra/default_ini.h | 2 +- src/core/hle/service/hid/hid.cpp | 2 +- src/core/hle/service/hid/hid.h | 2 +- src/core/settings.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index ad5eab433..87c763faf 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -38,7 +38,7 @@ button_l= button_r= button_start= button_select= -button_dbg= +button_debug= button_zl= button_zr= button_home= diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index b481d3bd6..f1ae2f8c0 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -87,7 +87,7 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) { state.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); state.start.Assign(buttons[Start - BUTTON_HID_BEGIN]->GetStatus()); state.select.Assign(buttons[Select - BUTTON_HID_BEGIN]->GetStatus()); - state.dbg.Assign(buttons[Dbg - BUTTON_HID_BEGIN]->GetStatus()); + state.debug.Assign(buttons[Debug - 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 e240ecea1..9d2d8d984 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -52,7 +52,7 @@ struct PadState { BitField<9, 1, u32> l; BitField<10, 1, u32> x; BitField<11, 1, u32> y; - BitField<12, 1, u32> dbg; + BitField<12, 1, u32> debug; 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 8b7d821ea..9c4ded86f 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -38,7 +38,7 @@ enum Values { R, Start, Select, - Dbg, + Debug, ZL, ZR, @@ -73,7 +73,7 @@ static const std::array mapping = {{ "button_r", "button_start", "button_select", - "button_dbg", + "button_debug", "button_zl", "button_zr", "button_home", From 7c007eac24075de94b5699bd32cb874efb06e213 Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 15:13:16 -0600 Subject: [PATCH 3/5] Fixed coding style --- src/citra/config.cpp | 7 +++---- src/citra_qt/configuration/configure_input.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index e216f233a..b705f8418 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -47,10 +47,9 @@ 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_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, }; static const std::array, Settings::NativeAnalog::NumAnalogs> default_analogs{{ diff --git a/src/citra_qt/configuration/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp index d1bb29f17..86ae49930 100644 --- a/src/citra_qt/configuration/configure_input.cpp +++ b/src/citra_qt/configuration/configure_input.cpp @@ -100,10 +100,10 @@ ConfigureInput::ConfigureInput(QWidget* parent) setFocusPolicy(Qt::ClickFocus); button_map = { - 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->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, }; analog_map_buttons = {{ From 6ad609a539af230efbac11ba2d497c19ac288a06 Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 17:13:37 -0600 Subject: [PATCH 4/5] 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", From 707bc48440c1a8c503cd4f64f270c204ba5bf012 Mon Sep 17 00:00:00 2001 From: RicBent Date: Sat, 29 Dec 2018 08:19:59 -0600 Subject: [PATCH 5/5] Added new buttons to movie system --- src/core/movie.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/movie.cpp b/src/core/movie.cpp index e103108f7..5f2835821 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -57,7 +57,9 @@ struct ControllerState { BitField<9, 1, u16_le> l; BitField<10, 1, u16_le> x; BitField<11, 1, u16_le> y; - // Bits 12-15 are currently unused + BitField<12, 1, u16_le> debug; + BitField<13, 1, u16_le> gpio14; + // Bits 14-15 are currently unused }; s16_le circle_pad_x; s16_le circle_pad_y; @@ -161,6 +163,8 @@ void Movie::Play(Service::HID::PadState& pad_state, s16& circle_pad_x, s16& circ pad_state.l.Assign(s.pad_and_circle.l); pad_state.x.Assign(s.pad_and_circle.x); pad_state.y.Assign(s.pad_and_circle.y); + pad_state.debug.Assign(s.pad_and_circle.debug); + pad_state.gpio14.Assign(s.pad_and_circle.gpio14); circle_pad_x = s.pad_and_circle.circle_pad_x; circle_pad_y = s.pad_and_circle.circle_pad_y; @@ -281,6 +285,8 @@ void Movie::Record(const Service::HID::PadState& pad_state, const s16& circle_pa s.pad_and_circle.l.Assign(static_cast(pad_state.l)); s.pad_and_circle.x.Assign(static_cast(pad_state.x)); s.pad_and_circle.y.Assign(static_cast(pad_state.y)); + s.pad_and_circle.debug.Assign(static_cast(pad_state.debug)); + s.pad_and_circle.gpio14.Assign(static_cast(pad_state.gpio14)); s.pad_and_circle.circle_pad_x = circle_pad_x; s.pad_and_circle.circle_pad_y = circle_pad_y;