Added Debug Button

This commit is contained in:
RicBent 2018-12-28 12:47:50 -06:00
parent 3989c17cb0
commit 403d2f0058
7 changed files with 12 additions and 4 deletions

View File

@ -49,7 +49,8 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
static const std::array<int, Settings::NativeButton::NumButtons> 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<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs{{

View File

@ -38,6 +38,7 @@ button_l=
button_r=
button_start=
button_select=
button_dbg=
button_zl=
button_zr=
button_home=

View File

@ -28,7 +28,7 @@ Config::~Config() {
const std::array<int, Settings::NativeButton::NumButtons> 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<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{

View File

@ -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++) {

View File

@ -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;

View File

@ -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;

View File

@ -38,6 +38,7 @@ enum Values {
R,
Start,
Select,
Dbg,
ZL,
ZR,
@ -72,6 +73,7 @@ static const std::array<const char*, NumButtons> mapping = {{
"button_r",
"button_start",
"button_select",
"button_dbg",
"button_zl",
"button_zr",
"button_home",