Skip to content

ACCESS: Add keymapper support#6797

Merged
sev- merged 1 commit intoscummvm:masterfrom
aunnoman1:access-keymapper
Jul 21, 2025
Merged

ACCESS: Add keymapper support#6797
sev- merged 1 commit intoscummvm:masterfrom
aunnoman1:access-keymapper

Conversation

@aunnoman1
Copy link
Contributor

No description provided.

@sev- sev- added the GSoC Part of a Google Summer of Code project label Jul 6, 2025
@i30817
Copy link
Contributor

i30817 commented Jul 7, 2025

I keep wondering if we are going to see keymapper support for individual Ags games that use custom keyboard keys to control, or worse, a combined keyboard and mouse setup.

examples are gemini rue (keyboard only shooting segments), qfg2 remake (keyboard optional combat segments, admittedly not as important) graceward and stormwater (combined keyboard for movement and mouse for aiming setup - this has no good solution in android scummvm besides using keyboard+mouse even if the right keycodes were supported because the virtual gamepad touch zones occupy all the screen so you can use both at once, and very few physical gamepads have a touch zone), all of stranga games games (only keyboard, would make sense mapping to virtual gamepad, but you can't because the keycodes on the 'right side'' are marked as generic scummvm action and don't match), probably a lot I'm forgetting.

I kind of wish for a 'advanced' escape hatch to map any keyboard keycode to any virtual controller key, that is, select both sides, not just map them to 'actions' (that are actually keycodes) that can often be wrong for engines with so many games. I shudder to think what would happen if a RPG maker engine reimplementation was added.

@bluegr
Copy link
Member

bluegr commented Jul 7, 2025

I keep wondering if we are going to see keymapper support for individual Ags games that use custom keyboard keys to control, or worse, a combined keyboard and mouse setup.

examples are gemini rue (keyboard only shooting segments), qfg2 remake (keyboard optional combat segments, admittedly not as important) graceward and stormwater (combined keyboard for movement and mouse for aiming setup - this has no good solution in android scummvm besides using keyboard+mouse even if the right keycodes were supported because the virtual gamepad touch zones occupy all the screen so you can use both at once, and very few physical gamepads have a touch zone), all of stranga games games (only keyboard, would make sense mapping to virtual gamepad, but you can't because the keycodes on the 'right side'' are marked as generic scummvm action and don't match), probably a lot I'm forgetting.

I kind of wish for a 'advanced' escape hatch to map any keyboard keycode to any virtual controller key, that is, select both sides, not just map them to 'actions' (that are actually keycodes) that can often be wrong for engines with so many games. I shudder to think what would happen if a RPG maker engine reimplementation was added.

What does that AGS request have to do with this pull request on the ACCESS engine?

@i30817
Copy link
Contributor

i30817 commented Jul 7, 2025

Well, I've seen key remapping being done for multiple engines this last few months but I didn't see it for individual games in a engine that have different keycodes used. I was wondering if that is at all going to be a concern in this multi engine effort, because if hypothetically a Ags PR (or really, any widely used engine) is being worked on, I don't want anyone involved being unware about this issue where the games that most need usable remaps (because they're fully keyboard controlled for example)... don't get them. Or get them with names like 'skip' (for opening options, esc keycode) because well, it's skip in scumm.

I also don't think this is only a issue for AGS, it's simply the game library I know more of so I could give examples. I would expect it to happen regularly in game engines with a lot of games of PC origin. I think director probably has some, and maybe wintermute.

@tag2015
Copy link
Contributor

tag2015 commented Jul 7, 2025

Please. don't hijack PRs for feature requests for other engines, especially considering this is a GSoC PR.
There's already a feature request for keymapper support in AGS https://bugs.scummvm.org/ticket/15356

Copy link
Member

@sev- sev- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added couple of notes

_keyCode = keycode;
}

void EventsManager::ActionControl(Common::CustomEventType action, bool isKeyDown) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be renamed to conform to our naming conventions

handleCommand(keyState.keycode - Common::KEYCODE_F1);
} else if (_vm->_events->getAction(action)) {
if (action >= kActionLook && action <= kActionPause)
handleCommand(action - kActionLook + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very dangerous. Why not create a mapping table or a hashmap instead?

@aunnoman1 aunnoman1 requested a review from sev- July 8, 2025 22:18
act = new Action("PAUSE", _("General Main Menu"));
act->setCustomEngineActionEvent(kActionPause);
act->addDefaultInputMapping("F10");
act->addDefaultInputMapping("JOY_START");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clashes with the Global Main Menu action.

Copy link
Member

@sev- sev- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added my notes

@@ -1 +1,2 @@
engines/access/resources.cpp
engines/access/metaengine.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort this alphabetically

act->addDefaultInputMapping("JOY_START");
engineKeyMap->addAction(act);

act = new Action("SKIP", _("Skip Movie"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an impression that we already fixed all to the Sentence Case, no? Why are you reintroducing Title Case over all of these actions...


struct AccessActionCode {
ACCESSActions _action;
int _code;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be int8 - which would reduce the size on some systems.

int checkMouseBox1(Common::Array<Common::Rect> &rects);

bool isKeyMousePressed();
bool isKeyActionMousePressed();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few of these changed methods could be const

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a look and didn't notice any which could be const. could you please specifiy which ones? Thank you

@OMGPizzaGuy
Copy link
Member

This looks pretty good to me at this point.

@aunnoman1 aunnoman1 requested review from mgerhardy and sev- July 14, 2025 14:26
@sev-
Copy link
Member

sev- commented Jul 21, 2025

Thank you!

@sev- sev- merged commit 436d947 into scummvm:master Jul 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Part of a Google Summer of Code project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants