ANDROID: Basic support for some TV remotes

And some fixes for DPAD handling

More fixes for DPAD will be coming. We currently don't handle DPAD Center, and also do not handle the case where DPAD is HATs (motion events)
This commit is contained in:
antoniou79 2023-03-25 00:01:37 +02:00
parent bea5300cf9
commit 057709fffb
3 changed files with 117 additions and 6 deletions

View file

@ -623,6 +623,28 @@ Common::KeymapperDefaultBindings *OSystem_Android::getKeymapperDefaultBindings()
// See: backends/keymapper/remap-widget.cpp: kCloseCmd = 'CLOS'
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, "CLOS", "AC_BACK");
// By default DPAD directions will be used for virtual mouse in GUI context
// If the user wants to remap them, they will be able to navigate to Global Options -> Keymaps and do so.
// In some devices (eg. Android TV) with only the remote control as input, it is impossible to navigate the launcher GUI,
// if the DPAD actions are mapped to "up", "down", "left", "right" directions.
// TODO If/when full key-based (ie. non-mouse) navigation of the ScummVM GUI is implemented,
// we can revert back to the core behavior of DPAD being mapped to "up", "down", "left", "right" directions.
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSEUP", "JOY_LEFT_STICK_Y-");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSEUP", "JOY_UP");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSEDOWN", "JOY_LEFT_STICK_Y+");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSEDOWN", "JOY_DOWN");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSELEFT", "JOY_LEFT_STICK_X-");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSELEFT", "JOY_LEFT");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSERIGHT", "JOY_LEFT_STICK_X+");
keymapperDefaultBindings->addDefaultBinding(Common::kGlobalKeymapName, "VMOUSERIGHT", "JOY_RIGHT");
keymapperDefaultBindings->addDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionInteract, "JOY_A");
// TODO Needs JOY_CENTER to be defined
//keymapperDefaultBindings->addDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionInteract, "JOY_CENTER");
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionMoveUp, nullptr);
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionMoveDown, nullptr);
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionMoveLeft, nullptr);
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, Common::kStandardActionMoveRight, nullptr);
return keymapperDefaultBindings;
}