From 403d2f0058a4b6057a8f16ca3474991a16eb9a3b Mon Sep 17 00:00:00 2001 From: RicBent Date: Fri, 28 Dec 2018 12:47:50 -0600 Subject: [PATCH] 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",