summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2015-06-20 05:34:45 +0200
committerJames Rowe <jroweboy@gmail.com>2015-07-28 05:41:21 +0200
commit1bc7829ee9f8bb73c92c7be672a77308ea44fe70 (patch)
treed3b17dcb11dd8ab39c92c7bac9a9dc61c5cf44ba /src/core
parentMerge pull request #989 from lioncash/extern (diff)
downloadyuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar.gz
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar.bz2
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar.lz
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar.xz
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.tar.zst
yuzu-1bc7829ee9f8bb73c92c7be672a77308ea44fe70.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/hid/hid.cpp10
-rw-r--r--src/core/hle/service/hid/hid.h5
-rw-r--r--src/core/settings.h54
3 files changed, 45 insertions, 24 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 70caa7d80..c35b13b25 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -35,6 +35,16 @@ static Kernel::SharedPtr<Kernel::Event> event_debug_pad;
static u32 next_pad_index;
static u32 next_touch_index;
+const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping = {
+ Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y,
+ Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR,
+ Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE,
+ Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT,
+ Service::HID::PAD_CIRCLE_UP, Service::HID::PAD_CIRCLE_DOWN, Service::HID::PAD_CIRCLE_LEFT, Service::HID::PAD_CIRCLE_RIGHT,
+ Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT
+};
+
+
// TODO(peachum):
// Add a method for setting analog input from joystick device for the circle Pad.
//
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index d50d479f8..517f4f2ae 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -9,7 +9,7 @@
#ifndef _MSC_VER
#include <cstddef>
#endif
-
+#include "core/settings.h"
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -157,6 +157,9 @@ const PadState PAD_CIRCLE_LEFT = {{1u << 29}};
const PadState PAD_CIRCLE_UP = {{1u << 30}};
const PadState PAD_CIRCLE_DOWN = {{1u << 31}};
+
+extern const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping;
+
/**
* HID::GetIPCHandles service function
* Inputs:
diff --git a/src/core/settings.h b/src/core/settings.h
index 5a70d157a..2775ee257 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -5,34 +5,42 @@
#pragma once
#include <string>
+#include <array>
namespace Settings {
+namespace NativeInput {
+enum Values {
+ A, B, X, Y,
+ L, R, ZL, ZR,
+ START, SELECT, HOME,
+ DUP, DDOWN, DLEFT, DRIGHT,
+ SUP, SDOWN, SLEFT, SRIGHT,
+ CUP, CDOWN, CLEFT, CRIGHT,
+ NUM_INPUTS
+};
+static const std::array<const char*, NUM_INPUTS> Mapping = {
+ "pad_a", "pad_b", "pad_x", "pad_y",
+ "pad_l", "pad_r", "pad_zl", "pad_zr",
+ "pad_start", "pad_select", "pad_home",
+ "pad_dup", "pad_ddown", "pad_dleft", "pad_dright",
+ "pad_sup", "pad_sdown", "pad_sleft", "pad_sright",
+ "pad_cup", "pad_cdown", "pad_cleft", "pad_cright"
+};
+static const std::array<Values, NUM_INPUTS> All = {
+ A, B, X, Y,
+ L, R, ZL, ZR,
+ START, SELECT, HOME,
+ DUP, DDOWN, DLEFT, DRIGHT,
+ SUP, SDOWN, SLEFT, SRIGHT,
+ CUP, CDOWN, CLEFT, CRIGHT
+};
+}
+
+
struct Values {
// Controls
- int pad_a_key;
- int pad_b_key;
- int pad_x_key;
- 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;
- int pad_dup_key;
- int pad_ddown_key;
- int pad_dleft_key;
- int pad_dright_key;
- int pad_sup_key;
- 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;
+ std::array<int, NativeInput::NUM_INPUTS> input_mappings;
// Core
int frame_skip;