KEYMAPPER: Allow engines to return multiple keymaps

The idea is that keymaps may be situational. A keymap may be always
enabled, while another one may be enabled only during combat..
This commit is contained in:
Bastien Bouclet 2020-01-28 18:44:08 +01:00
parent 426867f4bc
commit 519b4a57e2
19 changed files with 49 additions and 54 deletions

View file

@ -282,10 +282,10 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
#endif // USE_TRANSLATION
// Initialize any game-specific keymaps
Common::Keymap *gameKeymap = metaEngine.initKeymap(target.c_str());
Common::KeymapArray gameKeymaps = metaEngine.initKeymaps(target.c_str());
Common::Keymapper *keymapper = system.getEventManager()->getKeymapper();
if (gameKeymap) {
keymapper->addGameKeymap(gameKeymap);
for (uint i = 0; i < gameKeymaps.size(); i++) {
keymapper->addGameKeymap(gameKeymaps[i]);
}
// Inform backend that the engine is about to be run