[Scummvm-git-logs] scummvm master -> 29926757046b68d112ccc1ca2812ff77b7020d05
bluegr
bluegr at gmail.com
Sat Aug 7 14:11:05 UTC 2021
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:
2992675704 ADL: Add keymapper support
Commit: 29926757046b68d112ccc1ca2812ff77b7020d05
https://github.com/scummvm/scummvm/commit/29926757046b68d112ccc1ca2812ff77b7020d05
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-08-07T17:11:02+03:00
Commit Message:
ADL: Add keymapper support
Changed paths:
engines/adl/POTFILES
engines/adl/adl.cpp
engines/adl/adl.h
engines/adl/metaengine.cpp
diff --git a/engines/adl/POTFILES b/engines/adl/POTFILES
index ca485932f7..5db3e19a4f 100644
--- a/engines/adl/POTFILES
+++ b/engines/adl/POTFILES
@@ -1 +1,2 @@
engines/adl/detection.cpp
+engines/adl/metaengine.cpp
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index dfea3eac52..d1b40b4287 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -108,17 +108,15 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) :
bool AdlEngine::pollEvent(Common::Event &event) const {
if (g_system->getEventManager()->pollEvent(event)) {
- if (event.type != Common::EVENT_KEYDOWN)
- return false;
-
- if (event.kbd.flags & Common::KBD_CTRL) {
- if (event.kbd.keycode == Common::KEYCODE_q) {
+ if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START) {
+ if (event.customType == kADLActionQuit) {
quitGame();
- return false;
}
+ return false;
}
- return true;
+ if (event.type == Common::EVENT_KEYDOWN)
+ return true;
}
return false;
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index af6871ce72..7f97adf8e7 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -69,6 +69,13 @@ enum kDebugChannels {
kDebugChannelScript = 1 << 0
};
+enum ADLAction {
+ kADLActionNone,
+ kADLActionQuit,
+
+ kADLActionCount
+};
+
// Save and restore opcodes
#define IDO_ACT_SAVE 0x0f
#define IDO_ACT_LOAD 0x10
diff --git a/engines/adl/metaengine.cpp b/engines/adl/metaengine.cpp
index 73740de6da..df799100a5 100644
--- a/engines/adl/metaengine.cpp
+++ b/engines/adl/metaengine.cpp
@@ -25,9 +25,14 @@
#include "common/system.h"
#include "common/savefile.h"
#include "common/file.h"
+#include "common/translation.h"
#include "graphics/thumbnail.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+
+#include "adl/adl.h"
#include "adl/detection.h"
#include "adl/disk_image_helpers.h"
@@ -85,6 +90,7 @@ public:
void removeSaveState(const char *target, int slot) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const override;
+ Common::KeymapArray initKeymaps(const char *target) const override;
};
bool AdlMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -246,6 +252,21 @@ Common::Error AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, cons
return Common::kNoError;
}
+Common::KeymapArray AdlMetaEngine::initKeymaps(const char *target) const {
+ using namespace Common;
+
+ Keymap *engineKeymap = new Keymap(Keymap::kKeymapTypeGame, "adl", "ADL");
+
+ Action *act;
+
+ act = new Action("QUIT", _("Quit"));
+ act->setCustomEngineActionEvent(kADLActionQuit);
+ act->addDefaultInputMapping("C+q");
+ engineKeymap->addAction(act);
+
+ return Keymap::arrayOf(engineKeymap);
+}
+
} // End of namespace Adl
#if PLUGIN_ENABLED_DYNAMIC(ADL)
More information about the Scummvm-git-logs
mailing list