Added GPIO14 button and UI config buttons

This commit is contained in:
RicBent 2018-12-28 17:13:37 -06:00
parent 7c007eac24
commit 6ad609a539
8 changed files with 48 additions and 5 deletions

View file

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

View file

@ -39,6 +39,7 @@ button_r=
button_start= button_start=
button_select= button_select=
button_debug= button_debug=
button_gpio14=
button_zl= button_zl=
button_zr= button_zr=
button_home= button_home=

View file

@ -27,8 +27,9 @@ Config::~Config() {
} }
const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { 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_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_T, Qt::Key_G,
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_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{{ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{

View file

@ -103,7 +103,8 @@ ConfigureInput::ConfigureInput(QWidget* parent)
ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY, ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY,
ui->buttonDpadUp, ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonDpadUp, ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight,
ui->buttonL, ui->buttonR, ui->buttonStart, ui->buttonSelect, 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 = {{ analog_map_buttons = {{

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>370</width> <width>370</width>
<height>534</height> <height>595</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -549,6 +549,42 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </item>

View file

@ -88,6 +88,7 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
state.start.Assign(buttons[Start - BUTTON_HID_BEGIN]->GetStatus()); state.start.Assign(buttons[Start - BUTTON_HID_BEGIN]->GetStatus());
state.select.Assign(buttons[Select - BUTTON_HID_BEGIN]->GetStatus()); state.select.Assign(buttons[Select - BUTTON_HID_BEGIN]->GetStatus());
state.debug.Assign(buttons[Debug - 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 // Get current circle pad position and update circle pad direction
float circle_pad_x_f, circle_pad_y_f; float circle_pad_x_f, circle_pad_y_f;

View file

@ -53,6 +53,7 @@ struct PadState {
BitField<10, 1, u32> x; BitField<10, 1, u32> x;
BitField<11, 1, u32> y; BitField<11, 1, u32> y;
BitField<12, 1, u32> debug; BitField<12, 1, u32> debug;
BitField<13, 1, u32> gpio14;
BitField<28, 1, u32> circle_right; BitField<28, 1, u32> circle_right;
BitField<29, 1, u32> circle_left; BitField<29, 1, u32> circle_left;

View file

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