[Scummvm-git-logs] scummvm master -> 81aedefad01b2d45e5ae1eba720d4d399a5e3ec5

bgK bastien.bouclet at gmail.com
Sat Feb 1 08:50:10 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4ad06f476b KEYMAPPER: Do a better job at keeping track of the mouse position
a13ce39538 3DS: Fix keymap defaults to match documentation
81aedefad0 3DS: Fix libcurl detection


Commit: 4ad06f476b2a993af6a48466f54ccaa9a81e8893
    https://github.com/scummvm/scummvm/commit/4ad06f476b2a993af6a48466f54ccaa9a81e8893
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-01T09:36:09+01:00

Commit Message:
KEYMAPPER: Do a better job at keeping track of the mouse position

Changed paths:
    backends/keymapper/keymapper.cpp
    backends/keymapper/keymapper.h


diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index d2be0d2..0ed57f2 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -152,8 +152,6 @@ List<Event> Keymapper::mapEvent(const Event &ev) {
 
 	hardcodedEventMapping(ev);
 
-	IncomingEventType incomingEventType = convertToIncomingEventType(ev);
-
 	List<Event> mappedEvents;
 	for (int i = _keymaps.size() - 1; i >= 0; --i) {
 		if (!_keymaps[i]->isEnabled()) {
@@ -169,7 +167,21 @@ List<Event> Keymapper::mapEvent(const Event &ev) {
 
 		const Keymap::ActionArray &actions = _keymaps[i]->getMappedActions(ev);
 		for (Keymap::ActionArray::const_iterator it = actions.begin(); it != actions.end(); it++) {
-			mappedEvents.push_back(executeAction(*it, incomingEventType));
+			Event mappedEvent = executeAction(*it, ev);
+
+			// In case we mapped a mouse event to something else, we need to generate an artificial
+			// mouse move event so event observers can keep track of the mouse position.
+			// Makes it possible to reliably use the mouse position from EventManager when consuming
+			// custom action events.
+			if (isMouseEvent(ev) && !isMouseEvent(mappedEvent)) {
+				Event fakeMouseEvent;
+				fakeMouseEvent.type  = EVENT_MOUSEMOVE;
+				fakeMouseEvent.mouse = ev.mouse;
+
+				mappedEvents.push_back(fakeMouseEvent);
+			}
+
+			mappedEvents.push_back(mappedEvent);
 		}
 		if (!actions.empty()) {
 			// If we found actions matching this input in a keymap, no need to look at the other keymaps.
@@ -207,33 +219,50 @@ Keymapper::IncomingEventType Keymapper::convertToIncomingEventType(const Event &
 	}
 }
 
-Event Keymapper::executeAction(const Action *action, IncomingEventType incomingType) {
-	Event evt = Event(action->event);
-	EventType convertedType = convertStartToEnd(evt.type);
+bool Keymapper::isMouseEvent(const Event &event) {
+	return event.type == EVENT_LBUTTONDOWN
+	        || event.type == EVENT_LBUTTONUP
+	        || event.type == EVENT_RBUTTONDOWN
+	        || event.type == EVENT_RBUTTONUP
+	        || event.type == EVENT_MBUTTONDOWN
+	        || event.type == EVENT_MBUTTONUP
+	        || event.type == EVENT_MOUSEMOVE;
+}
+
+Event Keymapper::executeAction(const Action *action, const Event &incomingEvent) {
+	IncomingEventType incomingType = convertToIncomingEventType(incomingEvent);
+	Event outgoingEvent = Event(action->event);
+	EventType convertedType = convertStartToEnd(outgoingEvent.type);
 
 	// hardware keys need to send up instead when they are up
 	if (incomingType == kIncomingEventEnd) {
-		evt.type = convertedType;
+		outgoingEvent.type = convertedType;
 	}
 
-	evt.mouse = _eventMan->getMousePos();
+	if (isMouseEvent(outgoingEvent)) {
+		if (isMouseEvent(incomingEvent)) {
+			outgoingEvent.mouse = incomingEvent.mouse;
+		} else {
+			outgoingEvent.mouse = _eventMan->getMousePos();
+		}
+	}
 
 	// Check if the event is coming from a non-key hardware event
 	// that is mapped to a key event
 	if (incomingType == kIncomingEventInstant && convertedType != EVENT_INVALID) {
 		// WORKAROUND: Delay the down events coming from non-key hardware events
 		// with a zero delay. This is to prevent DOWN1 DOWN2 UP1 UP2.
-		_delayedEventSource->scheduleEvent(evt, 0);
+		_delayedEventSource->scheduleEvent(outgoingEvent, 0);
 
 		// non-keys need to send up as well
 		// WORKAROUND: Delay the up events coming from non-key hardware events
 		// This is for engines that run scripts that check on key being down
-		evt.type = convertedType;
+		outgoingEvent.type = convertedType;
 		const uint32 delay = (convertedType == EVENT_KEYUP ? kDelayKeyboardEventMillis : kDelayMouseEventMillis);
-		_delayedEventSource->scheduleEvent(evt, delay);
+		_delayedEventSource->scheduleEvent(outgoingEvent, delay);
 	}
 
-	return evt;
+	return outgoingEvent;
 }
 
 EventType Keymapper::convertStartToEnd(EventType type) {
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index c5d08cb..e778ecc 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -144,9 +144,10 @@ private:
 
 	KeymapArray _keymaps;
 
-	Event executeAction(const Action *act, IncomingEventType incomingType);
+	Event executeAction(const Action *act, const Event &incomingEvent);
 	EventType convertStartToEnd(EventType eventType);
 	IncomingEventType convertToIncomingEventType(const Event &ev) const;
+	static bool isMouseEvent(const Event &event);
 
 	void hardcodedEventMapping(Event ev);
 };


Commit: a13ce39538c3c17316fe57145bbc79c7bdb5a8b2
    https://github.com/scummvm/scummvm/commit/a13ce39538c3c17316fe57145bbc79c7bdb5a8b2
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-01T09:36:10+01:00

Commit Message:
3DS: Fix keymap defaults to match documentation

Changed paths:
    backends/platform/3ds/osystem-events.cpp


diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index 2285933..0eb31df 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -301,17 +301,17 @@ Common::KeymapArray OSystem_3DS::getGlobalKeymaps() {
 
 	act = new Action("DRAGM", _("Toggle Drag Mode"));
 	act->setCustomBackendActionEvent(k3DSEventToggleDragMode);
-	act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
+	act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
 	keymap->addAction(act);
 
 	act = new Action("MAGM", _("Toggle Magnify Mode"));
 	act->setCustomBackendActionEvent(k3DSEventToggleMagnifyMode);
-	act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
+	act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
 	keymap->addAction(act);
 
 	act = new Action("OPTS", _("Open 3DS Settings"));
 	act->setCustomBackendActionEvent(k3DSEventOpenSettings);
-	act->addDefaultInputMapping("JOY_SELECT");
+	act->addDefaultInputMapping("JOY_BACK");
 	keymap->addAction(act);
 
 	return Keymap::arrayOf(keymap);


Commit: 81aedefad01b2d45e5ae1eba720d4d399a5e3ec5
    https://github.com/scummvm/scummvm/commit/81aedefad01b2d45e5ae1eba720d4d399a5e3ec5
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-01T09:36:10+01:00

Commit Message:
3DS: Fix libcurl detection

Changed paths:
    backends/platform/3ds/3ds.mk
    configure


diff --git a/backends/platform/3ds/3ds.mk b/backends/platform/3ds/3ds.mk
index 923699c..0876552 100644
--- a/backends/platform/3ds/3ds.mk
+++ b/backends/platform/3ds/3ds.mk
@@ -9,11 +9,6 @@ APP_RSF         := $(srcdir)/backends/platform/3ds/app/scummvm.rsf
 APP_BANNER_IMAGE:= $(srcdir)/backends/platform/3ds/app/banner.png
 APP_BANNER_AUDIO:= $(srcdir)/backends/platform/3ds/app/banner.wav
 
-ARCH     := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
-CXXFLAGS += -std=gnu++11
-ASFLAGS  += -mfloat-abi=hard
-LDFLAGS  += -specs=3dsx.specs $(ARCH) -L$(DEVKITPRO)/libctru/lib -L$(DEVKITPRO)/portlibs/3ds/lib
-
 .PHONY: clean_3ds dist_3ds
 
 clean: clean_3ds
diff --git a/configure b/configure
index b286469..aa2e278 100755
--- a/configure
+++ b/configure
@@ -2544,17 +2544,17 @@ case $_host_os in
 		append_var DEFINES "-D__3DS__"
 		append_var DEFINES "-DARM"
 		append_var DEFINES "-DARM11"
-		append_var CXXFLAGS "-march=armv6k"
-		append_var CXXFLAGS "-mtune=mpcore"
+		append_var CXXFLAGS "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft"
 		append_var CXXFLAGS "-mword-relocations"
-		append_var CXXFLAGS "-mfloat-abi=hard"
 		append_var CXXFLAGS "-ffunction-sections"
 		append_var CXXFLAGS "-fomit-frame-pointer"
 		append_var CXXFLAGS "-I$DEVKITPRO/libctru/include"
 		append_var CXXFLAGS "-I$DEVKITPRO/portlibs/3ds/include"
+		append_var LDFLAGS "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft"
 		append_var LDFLAGS "-L$DEVKITPRO/libctru/lib"
 		append_var LDFLAGS "-L$DEVKITPRO/portlibs/3ds/lib"
-		append_var LIBS "-lcitro3d -lctru"
+		append_var LDFLAGS "-specs=3dsx.specs -lctru"
+		append_var LIBS "-lcitro3d"
 		;;
 	amigaos*)
 		append_var LDFLAGS "-Wl,--export-dynamic"




More information about the Scummvm-git-logs mailing list