[Scummvm-git-logs] scummvm master -> 6a4b08ef6f383c34d79f5da544bf9de953471e7f

bluegr noreply at scummvm.org
Tue Aug 27 21:45:11 UTC 2024


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

Summary:
6a4b08ef6f ULTIMA6: inject iOS gamepad d-pad key bindings


Commit: 6a4b08ef6f383c34d79f5da544bf9de953471e7f
    https://github.com/scummvm/scummvm/commit/6a4b08ef6f383c34d79f5da544bf9de953471e7f
Author: yudhiwidyatama (yudhi.widyatama at gmail.com)
Date: 2024-08-28T00:45:08+03:00

Commit Message:
ULTIMA6: inject iOS gamepad d-pad key bindings

Changed paths:
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/keybinding/keys.h


diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 500ee2621f8..9a8001d27f5 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -152,6 +152,19 @@ struct KeycodeString {
 	Common::KeyCode k;
 };
 
+// for additional key mappings outside txt file
+struct KeycodeToAction {
+    Common::KeyCode keyCode;
+    const char *actionTitle;
+};
+
+const KeycodeToAction iosKeycodes[] = {
+    { JOY12, "WALK_NORTH" },
+    { JOY13, "WALK_SOUTH" },
+    { JOY14, "WALK_WEST" },
+    { JOY15, "WALK_EAST"}
+};
+
 //
 // These don't match the strings in backends/keymapper/hardware-input.cpp
 // but are from Nuvie before ScummVM integration.  Leave them here for
@@ -338,6 +351,19 @@ KeyBinder::KeyBinder(const Configuration *config) : enable_joystick(false) {
 
 	next_axes_pair_update = next_axes_pair2_update = next_axes_pair3_update = 0;
 	next_axes_pair4_update = next_joy_repeat_time = 0;
+    
+    AddIosBindings();
+}
+
+void KeyBinder::AddIosBindings()
+{
+    unsigned long i;
+    for (i=0; i < sizeof(iosKeycodes) / sizeof(KeycodeToAction); i++)
+    {
+        KeycodeToAction ka = iosKeycodes[i];
+        if (!_bindings.contains(ka.keyCode))
+            AddKeyBinding(ka.keyCode, 0, _actions.getVal(ka.actionTitle), 0, 0);
+    }
 }
 
 KeyBinder::~KeyBinder() {
diff --git a/engines/ultima/nuvie/keybinding/keys.h b/engines/ultima/nuvie/keybinding/keys.h
index f2160606310..2ff8675d58d 100644
--- a/engines/ultima/nuvie/keybinding/keys.h
+++ b/engines/ultima/nuvie/keybinding/keys.h
@@ -102,6 +102,7 @@ public:
 	bool handle_always_available_keys(ActionType a);
 
 	void ShowKeys() const;
+    void AddIosBindings();
 
 	uint8 get_axis(uint8 index) const;
 	void set_axis(uint8 index, uint8 value);




More information about the Scummvm-git-logs mailing list