diff --git a/CMakeLists.txt b/CMakeLists.txt index f322208a13..bc1a94816f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -599,7 +599,9 @@ add_library(native STATIC native/image/zim_save.h native/input/gesture_detector.cpp native/input/gesture_detector.h + native/input/keycodes.h native/input/input_state.h + native/input/input_state.cpp native/json/json_writer.cpp native/json/json_writer.h native/math/curves.cpp diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index b91207b7e8..36d248bb1a 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -18,7 +18,6 @@ #include "input/input_state.h" #include "Core/Config.h" #include "KeyMap.h" -#include "input/keyboard_keys.h" using namespace KeyMap; diff --git a/Common/KeyMap.h b/Common/KeyMap.h index 3feb64d404..c72c2d45fa 100644 --- a/Common/KeyMap.h +++ b/Common/KeyMap.h @@ -19,7 +19,8 @@ #include #include -#include "input/keyboard_keys.h" +#include "input/keycodes.h" // keyboard keys +#include "Core/HLE/sceCtrl.h" // psp keys #define KEYMAP_ERROR_KEY_ALREADY_USED -1 #define KEYMAP_ERROR_UNKNOWN_KEY 0 @@ -45,7 +46,7 @@ namespace KeyMap { // These functions are not // fast, do not call them // a million times. - std::string GetKeyName(kb_key_t); + std::string GetKeyName(int); std::string GetPspButtonName(int); // Use if to translate @@ -58,14 +59,14 @@ namespace KeyMap { // // Returns KEYMAP_ERROR_UNKNOWN_KEY // for any unmapped key - int KeyToPspButton(kb_key_t); + int KeyToPspButton(int); - bool IsMappedKey(kb_key_t); + bool IsMappedKey(int); // Might be usful if you want // to provide hints to users // upon mapping conflicts - std::string NamePspButtonFromKey(kb_key_t); + std::string NamePspButtonFromKey(int); // Use for showing the existing // key mapping. @@ -78,7 +79,7 @@ namespace KeyMap { // // Returns KEYMAP_ERROR_KEY_ALREADY_USED // for mapping conflicts. 0 otherwise. - int SetKeyMapping(kb_key_t, int); + int SetKeyMapping(int kb_key, int psp_key); // Platform specific keymaps // override KeyMap's defaults. diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 3636cc027f..73a2e7d288 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -190,6 +190,7 @@ void EmuScreen::update(InputState &input) { } #endif + /* // Then translate pad input into PSP pad input. Also, add in tilt. static const int mapping[12][2] = { {PAD_BUTTON_A, CTRL_CROSS}, @@ -214,6 +215,15 @@ void EmuScreen::update(InputState &input) { __CtrlButtonUp(mapping[i][1]); } } + */ + + // TODO: remove the above dead code + for (int i = 0; i < MAX_KEYQUEUESIZE; i++) { + int key = input.key_queue[i]; + if (key != 0) { + // TODO: find proper Ctrl* internal function + } + } float stick_x = input.pad_lstick_x; float stick_y = input.pad_lstick_y;