Merge pull request #595 from linkmauve/new-3ds-input

Frontends, HID: Add New 3DS specific pad buttons, and stub the touch one.
This commit is contained in:
bunnei 2015-02-23 21:13:29 -05:00
commit 3700263f71
7 changed files with 82 additions and 13 deletions

View File

@ -44,6 +44,8 @@ void Config::ReadValues() {
Settings::values.pad_y_key = glfw_config->GetInteger("Controls", "pad_y", GLFW_KEY_X);
Settings::values.pad_l_key = glfw_config->GetInteger("Controls", "pad_l", GLFW_KEY_Q);
Settings::values.pad_r_key = glfw_config->GetInteger("Controls", "pad_r", GLFW_KEY_W);
Settings::values.pad_zl_key = glfw_config->GetInteger("Controls", "pad_zl", GLFW_KEY_1);
Settings::values.pad_zr_key = glfw_config->GetInteger("Controls", "pad_zr", GLFW_KEY_2);
Settings::values.pad_start_key = glfw_config->GetInteger("Controls", "pad_start", GLFW_KEY_M);
Settings::values.pad_select_key = glfw_config->GetInteger("Controls", "pad_select", GLFW_KEY_N);
Settings::values.pad_home_key = glfw_config->GetInteger("Controls", "pad_home", GLFW_KEY_B);
@ -55,6 +57,10 @@ void Config::ReadValues() {
Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
Settings::values.pad_cup_key = glfw_config->GetInteger("Controls", "pad_cup", GLFW_KEY_I);
Settings::values.pad_cdown_key = glfw_config->GetInteger("Controls", "pad_cdown", GLFW_KEY_K);
Settings::values.pad_cleft_key = glfw_config->GetInteger("Controls", "pad_cleft", GLFW_KEY_J);
Settings::values.pad_cright_key = glfw_config->GetInteger("Controls", "pad_cright", GLFW_KEY_L);
// Core
Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30);

View File

@ -19,12 +19,18 @@ pad_a =
pad_b =
pad_x =
pad_y =
pad_r =
pad_l =
pad_r =
pad_zl =
pad_zr =
pad_sup =
pad_sdown =
pad_sleft =
pad_sright =
pad_cup =
pad_cdown =
pad_cleft =
pad_cright =
[Core]
gpu_refresh_rate = ## 30 (default)

View File

@ -139,6 +139,16 @@ void EmuWindow_GLFW::ReloadSetKeymaps() {
KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, Service::HID::PAD_L);
KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, Service::HID::PAD_X);
KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, Service::HID::PAD_Y);
KeyMap::SetKeyMapping({Settings::values.pad_zl_key, keyboard_id}, Service::HID::PAD_ZL);
KeyMap::SetKeyMapping({Settings::values.pad_zr_key, keyboard_id}, Service::HID::PAD_ZR);
// KeyMap::SetKeyMapping({Settings::values.pad_touch_key, keyboard_id}, Service::HID::PAD_TOUCH);
KeyMap::SetKeyMapping({Settings::values.pad_cright_key, keyboard_id}, Service::HID::PAD_C_RIGHT);
KeyMap::SetKeyMapping({Settings::values.pad_cleft_key, keyboard_id}, Service::HID::PAD_C_LEFT);
KeyMap::SetKeyMapping({Settings::values.pad_cup_key, keyboard_id}, Service::HID::PAD_C_UP);
KeyMap::SetKeyMapping({Settings::values.pad_cdown_key, keyboard_id}, Service::HID::PAD_C_DOWN);
KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, Service::HID::PAD_CIRCLE_RIGHT);
KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, Service::HID::PAD_CIRCLE_LEFT);
KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, Service::HID::PAD_CIRCLE_UP);

View File

@ -291,6 +291,16 @@ void GRenderWindow::ReloadSetKeymaps()
KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, Service::HID::PAD_L);
KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, Service::HID::PAD_X);
KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, Service::HID::PAD_Y);
KeyMap::SetKeyMapping({Settings::values.pad_zl_key, keyboard_id}, Service::HID::PAD_ZL);
KeyMap::SetKeyMapping({Settings::values.pad_zr_key, keyboard_id}, Service::HID::PAD_ZR);
// KeyMap::SetKeyMapping({Settings::values.pad_touch_key, keyboard_id}, Service::HID::PAD_TOUCH);
KeyMap::SetKeyMapping({Settings::values.pad_cright_key, keyboard_id}, Service::HID::PAD_C_RIGHT);
KeyMap::SetKeyMapping({Settings::values.pad_cleft_key, keyboard_id}, Service::HID::PAD_C_LEFT);
KeyMap::SetKeyMapping({Settings::values.pad_cup_key, keyboard_id}, Service::HID::PAD_C_UP);
KeyMap::SetKeyMapping({Settings::values.pad_cdown_key, keyboard_id}, Service::HID::PAD_C_DOWN);
KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, Service::HID::PAD_CIRCLE_RIGHT);
KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, Service::HID::PAD_CIRCLE_LEFT);
KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, Service::HID::PAD_CIRCLE_UP);

View File

@ -23,12 +23,14 @@ Config::Config() {
void Config::ReadValues() {
qt_config->beginGroup("Controls");
Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt();
Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt();
Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt();
Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt();
Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt();
Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt();
Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt();
Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt();
Settings::values.pad_zl_key = qt_config->value("pad_zl", Qt::Key_1).toInt();
Settings::values.pad_zr_key = qt_config->value("pad_zr", Qt::Key_2).toInt();
Settings::values.pad_start_key = qt_config->value("pad_start", Qt::Key_M).toInt();
Settings::values.pad_select_key = qt_config->value("pad_select", Qt::Key_N).toInt();
Settings::values.pad_home_key = qt_config->value("pad_home", Qt::Key_B).toInt();
@ -40,6 +42,10 @@ void Config::ReadValues() {
Settings::values.pad_sdown_key = qt_config->value("pad_sdown", Qt::Key_Down).toInt();
Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
Settings::values.pad_cup_key = qt_config->value("pad_cup", Qt::Key_I).toInt();
Settings::values.pad_cdown_key = qt_config->value("pad_cdown", Qt::Key_K).toInt();
Settings::values.pad_cleft_key = qt_config->value("pad_cleft", Qt::Key_J).toInt();
Settings::values.pad_cright_key = qt_config->value("pad_cright", Qt::Key_L).toInt();
qt_config->endGroup();
qt_config->beginGroup("Core");
@ -62,12 +68,14 @@ void Config::ReadValues() {
void Config::SaveValues() {
qt_config->beginGroup("Controls");
qt_config->setValue("pad_a", Settings::values.pad_a_key);
qt_config->setValue("pad_b", Settings::values.pad_b_key);
qt_config->setValue("pad_x", Settings::values.pad_x_key);
qt_config->setValue("pad_y", Settings::values.pad_y_key);
qt_config->setValue("pad_l", Settings::values.pad_l_key);
qt_config->setValue("pad_r", Settings::values.pad_r_key);
qt_config->setValue("pad_a", Settings::values.pad_a_key);
qt_config->setValue("pad_b", Settings::values.pad_b_key);
qt_config->setValue("pad_x", Settings::values.pad_x_key);
qt_config->setValue("pad_y", Settings::values.pad_y_key);
qt_config->setValue("pad_l", Settings::values.pad_l_key);
qt_config->setValue("pad_r", Settings::values.pad_r_key);
qt_config->setValue("pad_zl", Settings::values.pad_zl_key);
qt_config->setValue("pad_zr", Settings::values.pad_zr_key);
qt_config->setValue("pad_start", Settings::values.pad_start_key);
qt_config->setValue("pad_select", Settings::values.pad_select_key);
qt_config->setValue("pad_home", Settings::values.pad_home_key);
@ -79,6 +87,10 @@ void Config::SaveValues() {
qt_config->setValue("pad_sdown", Settings::values.pad_sdown_key);
qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
qt_config->setValue("pad_cup", Settings::values.pad_cup_key);
qt_config->setValue("pad_cdown", Settings::values.pad_cdown_key);
qt_config->setValue("pad_cleft", Settings::values.pad_cleft_key);
qt_config->setValue("pad_cright", Settings::values.pad_cright_key);
qt_config->endGroup();
qt_config->beginGroup("Core");

View File

@ -47,6 +47,15 @@ struct PadState {
BitField<10, 1, u32> x;
BitField<11, 1, u32> y;
BitField<14, 1, u32> zl;
BitField<15, 1, u32> zr;
BitField<20, 1, u32> touch;
BitField<24, 1, u32> c_right;
BitField<25, 1, u32> c_left;
BitField<26, 1, u32> c_up;
BitField<27, 1, u32> c_down;
BitField<28, 1, u32> circle_right;
BitField<29, 1, u32> circle_left;
BitField<30, 1, u32> circle_up;
@ -99,6 +108,16 @@ const PadState PAD_R = {{1u << 8}};
const PadState PAD_L = {{1u << 9}};
const PadState PAD_X = {{1u << 10}};
const PadState PAD_Y = {{1u << 11}};
const PadState PAD_ZL = {{1u << 14}};
const PadState PAD_ZR = {{1u << 15}};
const PadState PAD_TOUCH = {{1u << 20}};
const PadState PAD_C_RIGHT = {{1u << 24}};
const PadState PAD_C_LEFT = {{1u << 25}};
const PadState PAD_C_UP = {{1u << 26}};
const PadState PAD_C_DOWN = {{1u << 27}};
const PadState PAD_CIRCLE_RIGHT = {{1u << 28}};
const PadState PAD_CIRCLE_LEFT = {{1u << 29}};
const PadState PAD_CIRCLE_UP = {{1u << 30}};

View File

@ -16,6 +16,8 @@ struct Values {
int pad_y_key;
int pad_l_key;
int pad_r_key;
int pad_zl_key;
int pad_zr_key;
int pad_start_key;
int pad_select_key;
int pad_home_key;
@ -27,6 +29,10 @@ struct Values {
int pad_sdown_key;
int pad_sleft_key;
int pad_sright_key;
int pad_cup_key;
int pad_cdown_key;
int pad_cleft_key;
int pad_cright_key;
// Core
int gpu_refresh_rate;