- Add some basic debugger for Lands of Lore.

- Allow the "flags" command in all Kyra games to be working properly with 320x200 GUI.

svn-id: r41113
This commit is contained in:
Johannes Schickel 2009-06-01 22:03:27 +00:00
parent bdea557d7f
commit f57be08d6d
4 changed files with 80 additions and 6 deletions

View file

@ -33,6 +33,7 @@
#include "kyra/screen.h"
#include "kyra/timer.h"
#include "kyra/resource.h"
#include "kyra/lol.h"
namespace Kyra {
@ -132,10 +133,12 @@ bool Debugger::cmd_gameSpeed(int argc, const char **argv) {
}
bool Debugger::cmd_listFlags(int argc, const char **argv) {
for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) {
DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i));
if (!(i % 10))
for (int i = 0, p = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++, ++p) {
DebugPrintf("(%-3i): %-2i", i, _vm->queryGameFlag(i));
if (p == 5) {
DebugPrintf("\n");
p -= 6;
}
}
DebugPrintf("\n");
return true;
@ -457,5 +460,57 @@ bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) {
return true;
}
#pragma mark -
Debugger_LoL::Debugger_LoL(LoLEngine *vm) : Debugger(vm), _vm(vm) {
}
bool Debugger_LoL::cmd_listFlags(int argc, const char **argv) {
for (int i = 0, p = 0; i < (int)sizeof(_vm->_gameFlags)*8; ++i, ++p) {
const uint8 index = (i >> 4);
const uint8 offset = i & 0xF;
DebugPrintf("(%-3i): %-2i", i, (_vm->_gameFlags[index] >> offset) & 1);
if (p == 5) {
DebugPrintf("\n");
p -= 6;
}
}
DebugPrintf("\n");
return true;
}
bool Debugger_LoL::cmd_toggleFlag(int argc, const char **argv) {
if (argc > 1) {
uint flag = atoi(argv[1]);
const uint8 index = (flag >> 4);
const uint8 offset = flag & 0xF;
_vm->_gameFlags[index] ^= _vm->_gameFlags[index] & (1 << offset);
DebugPrintf("Flag %i is now %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
} else {
DebugPrintf("Syntax: toggleflag <flag>\n");
}
return true;
}
bool Debugger_LoL::cmd_queryFlag(int argc, const char **argv) {
if (argc > 1) {
uint flag = atoi(argv[1]);
const uint8 index = (flag >> 4);
const uint8 offset = flag & 0xF;
DebugPrintf("Flag %i is %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
} else {
DebugPrintf("Syntax: queryflag <flag>\n");
}
return true;
}
} // End of namespace Kyra