aboutsummaryrefslogtreecommitdiff
path: root/backends/events/dinguxsdl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/events/dinguxsdl')
-rw-r--r--backends/events/dinguxsdl/dinguxsdl-events.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/backends/events/dinguxsdl/dinguxsdl-events.cpp b/backends/events/dinguxsdl/dinguxsdl-events.cpp
index 7730e8f915..7087883362 100644
--- a/backends/events/dinguxsdl/dinguxsdl-events.cpp
+++ b/backends/events/dinguxsdl/dinguxsdl-events.cpp
@@ -26,6 +26,33 @@
#include "backends/events/dinguxsdl/dinguxsdl-events.h"
+#ifdef TRIMUI
+/******
+ * Trimui keymap
+ * Dingoo button
+ * A -> Left Button BUT_Y
+ * B -> right button BUT_B
+ * X -> F5 BUT_START
+ * Y -> '.' BUT_X
+ * R -> '0' BUT_A
+ * Select -> VK BUT_SELECT
+ * Start -> ESC TRIG_R
+ * Menu -> Menu TRIG_L
+ */
+
+#define PAD_UP SDLK_UP
+#define PAD_DOWN SDLK_DOWN
+#define PAD_LEFT SDLK_LEFT
+#define PAD_RIGHT SDLK_RIGHT
+#define BUT_A SDLK_BACKSPACE
+#define BUT_B SDLK_LCTRL
+#define BUT_X SDLK_LALT
+#define BUT_Y SDLK_SPACE
+#define BUT_SELECT SDLK_RCTRL
+#define BUT_START SDLK_LSHIFT
+#define TRIG_L SDLK_ESCAPE
+#define TRIG_R SDLK_RETURN
+#else
#ifndef GCW0
#define PAD_UP SDLK_UP
#define PAD_DOWN SDLK_DOWN
@@ -68,6 +95,7 @@
#define TRIG_R SDLK_ESCAPE
#endif
+#endif
bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
if (ev.key.keysym.sym == PAD_UP) {
@@ -146,6 +174,17 @@ bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
ev.key.keysym.sym = SDLK_PERIOD;
ev.key.keysym.mod = (SDLMod)0;
ev.key.keysym.unicode = '.';
+ event.kbd.keycode = Common::KEYCODE_PERIOD;
+ event.kbd.ascii = '.';
+ event.kbd.flags = 0;
+
+ if (ev.type == SDL_KEYDOWN) {
+ event.type = Common::EVENT_KEYDOWN;
+ } else {
+ event.type = Common::EVENT_KEYUP;
+ }
+
+ return true;
} else if (ev.key.keysym.sym == TRIG_L) { // global menu
ev.key.keysym.sym = SDLK_F5;
event.kbd.keycode = Common::KEYCODE_F5;
@@ -182,9 +221,30 @@ bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
#endif
} else if (ev.key.keysym.sym == BUT_START) { // F5, menu in some games
ev.key.keysym.sym = SDLK_F5;
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = Common::ASCII_F5;
+ event.kbd.flags = 0;
+
+ if (ev.type == SDL_KEYDOWN) {
+ event.type = Common::EVENT_KEYDOWN;
+ } else {
+ event.type = Common::EVENT_KEYUP;
+ }
+ return true;
} else if (ev.key.keysym.sym == TRIG_R) { // ESC
ev.key.keysym.sym = SDLK_ESCAPE;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = Common::ASCII_ESCAPE;
+ event.kbd.flags = 0;
+
+ if (ev.type == SDL_KEYDOWN) {
+ event.type = Common::EVENT_KEYDOWN;
+ } else {
+ event.type = Common::EVENT_KEYUP;
+ }
+
+ return true;
} else {
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);