Merge pull request #4537 from RicBent/master

Added Debug/GPIO14 Buttons
This commit is contained in:
Weiyi Wang 2019-01-07 10:07:31 -05:00 committed by GitHub
commit 941d241e7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 11 deletions

View File

@ -47,9 +47,9 @@ 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_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_O, 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,8 @@ button_l=
button_r=
button_start=
button_select=
button_debug=
button_gpio14=
button_zl=
button_zr=
button_home=

View File

@ -27,8 +27,9 @@ 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_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<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{

View File

@ -100,9 +100,11 @@ 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, 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,
ui->buttonDebug, ui->buttonGpio14, ui->buttonZL, ui->buttonZR,
ui->buttonHome,
};
analog_map_buttons = {{
@ -273,6 +275,7 @@ void ConfigureInput::ClearAll() {
void ConfigureInput::updateButtonLabels() {
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
if (button_map[button])
button_map[button]->setText(ButtonToText(buttons_param[button]));
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>370</width>
<height>534</height>
<height>595</height>
</rect>
</property>
<property name="windowTitle">
@ -549,6 +549,42 @@
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="verticalLayout_33">
<item>
<widget class="QLabel" name="label_41">
<property name="text">
<string>GPIO14:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonGpio14">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QVBoxLayout" name="verticalLayout_32">
<item>
<widget class="QLabel" name="label_40">
<property name="text">
<string>Debug:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonDebug">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -87,6 +87,8 @@ 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.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;

View File

@ -52,6 +52,8 @@ struct PadState {
BitField<9, 1, u32> l;
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;

View File

@ -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<u16>(pad_state.l));
s.pad_and_circle.x.Assign(static_cast<u16>(pad_state.x));
s.pad_and_circle.y.Assign(static_cast<u16>(pad_state.y));
s.pad_and_circle.debug.Assign(static_cast<u16>(pad_state.debug));
s.pad_and_circle.gpio14.Assign(static_cast<u16>(pad_state.gpio14));
s.pad_and_circle.circle_pad_x = circle_pad_x;
s.pad_and_circle.circle_pad_y = circle_pad_y;

View File

@ -38,6 +38,8 @@ enum Values {
R,
Start,
Select,
Debug,
Gpio14,
ZL,
ZR,
@ -72,6 +74,8 @@ static const std::array<const char*, NumButtons> mapping = {{
"button_r",
"button_start",
"button_select",
"button_debug",
"button_gpio14",
"button_zl",
"button_zr",
"button_home",