From 5b4fee61dd842c795eabc9b0ba10afe80cd00b6e Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 25 May 2019 11:38:18 -0230 Subject: [PATCH] Fix compilation for new keymapping stuff in Linux/libretro. --- src/common/KeyMap.hxx | 16 +++++++++------- src/libretro/Makefile.common | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx index d1f828519..548aad941 100644 --- a/src/common/KeyMap.hxx +++ b/src/common/KeyMap.hxx @@ -18,6 +18,8 @@ #ifndef KEYMAP_HXX #define KEYMAP_HXX +#include + #include "Event.hxx" #include "EventHandlerConstants.hxx" @@ -38,10 +40,10 @@ class KeyMap Mapping() : mode(EventMode(0)), key(StellaKey(0)), mod(StellaMod(0)) { } Mapping(const Mapping& k) : mode(k.mode), key(k.key), mod(k.mod) { } - explicit Mapping(EventMode mode, StellaKey key, StellaMod mod = StellaMod::KBDM_NONE) - : mode(mode), key(key), mod(mod) { } - explicit Mapping(int mode, int key, int mod = StellaMod::KBDM_NONE) - : mode(EventMode(mode)), key(StellaKey(key)), mod(StellaMod(mod)) { } + explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod = StellaMod::KBDM_NONE) + : mode(c_mode), key(c_key), mod(c_mod) { } + explicit Mapping(int c_mode, int c_key, int c_mod = StellaMod::KBDM_NONE) + : mode(EventMode(c_mode)), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { } bool operator==(const Mapping& other) const { @@ -90,9 +92,9 @@ class KeyMap struct KeyHash { size_t operator()(const Mapping& k)const { - return std::hash()(((long long)k.mode) - ^ (((long long)k.key) << 16) - ^ (((long long)k.mod) << 32)); + return std::hash()((uInt64(k.mode)) + ^ ((uInt64(k.key)) << 16) + ^ ((uInt64(k.mod)) << 32)); } }; diff --git a/src/libretro/Makefile.common b/src/libretro/Makefile.common index 189b2e82f..bad5e8682 100644 --- a/src/libretro/Makefile.common +++ b/src/libretro/Makefile.common @@ -19,6 +19,7 @@ SOURCES_CXX := \ $(CORE_DIR)/common/Base.cxx \ $(CORE_DIR)/common/FpsMeter.cxx \ $(CORE_DIR)/common/FSNodeZIP.cxx \ + $(CORE_DIR)/common/KeyMap.cxx \ $(CORE_DIR)/common/Logger.cxx \ $(CORE_DIR)/common/MouseControl.cxx \ $(CORE_DIR)/common/PhysicalJoystick.cxx \