CRAB: Add Debug Output for Keymaps

Now keymap being used can known by typing "what keymap" in the debugger
console.
This commit is contained in:
Aditya 2023-11-13 15:24:15 +05:30 committed by Kartik
parent e2618f71cb
commit 0a7ba01e8e
2 changed files with 33 additions and 0 deletions

View File

@ -21,11 +21,15 @@
#include "crab/crab.h"
#include "crab/console.h"
#include "crab/input/input.h"
namespace Crab {
using namespace pyrodactyl::input;
Console::Console() : GUI::Debugger() {
registerCmd("draw", WRAP_METHOD(Console, cmdDraw));
registerCmd("what", WRAP_METHOD(Console, cmdWhat));
}
Console::~Console() {
@ -53,4 +57,32 @@ bool Console::cmdDraw(int argc, const char **argv) {
return true;
}
bool Console::cmdWhat(int argc, const char **argv) {
if (argc > 1) {
for (int i = 1; i < argc; i++) {
if (!scumm_stricmp(argv[i], "keymap")) {
switch (g_engine->_inputManager->getKeyBindingMode()) {
case KBM_NONE:
debugPrintf("KBM_NONE\n");
break;
case KBM_GAME:
debugPrintf("KBM_GAME\n");
break;
case KBM_UI:
debugPrintf("KBM_UI\n");
break;
default:
debugPrintf("Unknown KBM\n");
break;
}
} else
debugPrintf("Valid parameters are 'keymap'\n");
}
}
return true;
}
} // End of namespace Crab

View File

@ -29,6 +29,7 @@ namespace Crab {
class Console : public GUI::Debugger {
private:
bool cmdDraw(int argc, const char **argv);
bool cmdWhat(int argc, const char **argv);
public:
Console();