aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2007-09-23 23:37:01 +0000
committerJohannes Schickel2007-09-23 23:37:01 +0000
commit41e4a7b1564183c0e93cc4087ee24301b2015891 (patch)
tree1802e5b2f2b0c3916f60bd3f0d5d71302424a909 /engines
parent3c5d8c40314f34f870384e3d72108a8ac2061d10 (diff)
downloadscummvm-rg350-41e4a7b1564183c0e93cc4087ee24301b2015891.tar.gz
scummvm-rg350-41e4a7b1564183c0e93cc4087ee24301b2015891.tar.bz2
scummvm-rg350-41e4a7b1564183c0e93cc4087ee24301b2015891.zip
Added command to enable screen debug functionallity. (instead of the old compile time enabling)
svn-id: r29078
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/debugger.cpp24
-rw-r--r--engines/kyra/debugger.h7
-rw-r--r--engines/kyra/screen.cpp105
-rw-r--r--engines/kyra/screen.h10
4 files changed, 112 insertions, 34 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 86be2eba9d..62b845011c 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -33,6 +33,30 @@
namespace Kyra {
+Debugger::Debugger(KyraEngine *vm)
+ : GUI::Debugger() {
+ _vm = vm;
+
+ DCmd_Register("screen_debug_mode", WRAP_METHOD(Debugger, cmd_setScreenDebug));
+}
+
+bool Debugger::cmd_setScreenDebug(int argc, const char **argv) {
+ if (argc > 1) {
+ if (scumm_stricmp(argv[1], "enable") == 0)
+ _vm->screen()->enableScreenDebug(true);
+ else if (scumm_stricmp(argv[1], "disable") == 0)
+ _vm->screen()->enableScreenDebug(false);
+ else
+ DebugPrintf("Use screen_debug_mode <enable/disable> to enable or disable it.\n");
+ } else {
+ DebugPrintf("Screen debug mode is %s.\n", (_vm->screen()->queryScreenDebug() ? "enabled" : "disabled"));
+ DebugPrintf("Use screen_debug_mode <enable/disable> to enable or disable it.\n");
+ }
+ return true;
+}
+
+#pragma mark -
+
Debugger_v1::Debugger_v1(KyraEngine_v1 *vm)
: Debugger(vm) {
_vm = vm;
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 41e3ba2c32..3744979566 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -35,8 +35,13 @@ class KyraEngine_v1;
class Debugger : public GUI::Debugger {
public:
- Debugger(KyraEngine *vm) {}
+ Debugger(KyraEngine *vm);
virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
+
+protected:
+ KyraEngine *_vm;
+
+ bool cmd_setScreenDebug(int argc, const char **argv);
};
class Debugger_v1 : public Debugger {
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index b6003ff388..924eacd9bc 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -86,6 +86,7 @@ Screen::~Screen() {
bool Screen::init() {
debugC(9, kDebugLevelScreen, "Screen::init()");
_disableScreen = false;
+ _debugEnabled = false;
_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, false);
@@ -94,37 +95,7 @@ bool Screen::init() {
_useSJIS = false;
_sjisTempPage = _sjisFontData = 0;
- if (_vm->gameFlags().useHiResOverlay) {
- _system->beginGFXTransaction();
- _vm->initCommonGFX(true);
- _system->initSize(640, 400);
- _system->endGFXTransaction();
-
- for (int i = 0; i < SCREEN_OVLS_NUM; ++i) {
- _sjisOverlayPtrs[i] = new uint8[SCREEN_OVL_SJIS_SIZE];
- assert(_sjisOverlayPtrs[i]);
- memset(_sjisOverlayPtrs[i], 0x80, SCREEN_OVL_SJIS_SIZE);
- }
- _useOverlays = true;
- _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
-
- if (_useSJIS) {
- _sjisFontData = _vm->resource()->fileData("FMT_FNT.ROM", 0);
- if (!_sjisFontData)
- error("missing font rom ('FMT_FNT.ROM') required for this version");
- _sjisTempPage = new uint8[420];
- assert(_sjisTempPage);
- _sjisTempPage2 = _sjisTempPage + 60;
- _sjisSourceChar = _sjisTempPage + 384;
- }
- } else {
- _system->beginGFXTransaction();
- _vm->initCommonGFX(false);
- //for debug reasons (see Screen::updateScreen)
- //_system->initSize(640, 200);
- _system->initSize(320, 200);
- _system->endGFXTransaction();
- }
+ setResolution();
_curPage = 0;
for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2) {
@@ -194,6 +165,69 @@ bool Screen::init() {
return true;
}
+bool Screen::enableScreenDebug(bool enable) {
+ bool temp = _debugEnabled;
+
+ if (_debugEnabled != enable) {
+ _debugEnabled = enable;
+ setResolution();
+ _forceFullUpdate = true;
+ updateScreen();
+ }
+
+ return temp;
+}
+
+void Screen::setResolution() {
+ byte palette[4*256];
+ _system->grabPalette(palette, 0, 256);
+
+ if (_vm->gameFlags().useHiResOverlay) {
+ _system->beginGFXTransaction();
+ _vm->initCommonGFX(true);
+ if (_debugEnabled)
+ _system->initSize(960, 400);
+ else
+ _system->initSize(640, 400);
+ _system->endGFXTransaction();
+
+ for (int i = 0; i < SCREEN_OVLS_NUM; ++i) {
+ if (!_sjisOverlayPtrs[i]) {
+ _sjisOverlayPtrs[i] = new uint8[SCREEN_OVL_SJIS_SIZE];
+ assert(_sjisOverlayPtrs[i]);
+ memset(_sjisOverlayPtrs[i], 0x80, SCREEN_OVL_SJIS_SIZE);
+ }
+ }
+ _useOverlays = true;
+ _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
+
+ if (_useSJIS) {
+ if (!_sjisFontData) {
+ _sjisFontData = _vm->resource()->fileData("FMT_FNT.ROM", 0);
+ if (!_sjisFontData)
+ error("missing font rom ('FMT_FNT.ROM') required for this version");
+ }
+
+ if (!_sjisTempPage) {
+ _sjisTempPage = new uint8[420];
+ assert(_sjisTempPage);
+ _sjisTempPage2 = _sjisTempPage + 60;
+ _sjisSourceChar = _sjisTempPage + 384;
+ }
+ }
+ } else {
+ _system->beginGFXTransaction();
+ _vm->initCommonGFX(false);
+ if (_debugEnabled)
+ _system->initSize(640, 200);
+ else
+ _system->initSize(320, 200);
+ _system->endGFXTransaction();
+ }
+
+ _system->setPalette(palette, 0, 256);
+}
+
void Screen::updateScreen() {
debugC(9, kDebugLevelScreen, "Screen::updateScreen()");
if (_disableScreen)
@@ -204,8 +238,13 @@ void Screen::updateScreen() {
else
updateDirtyRects();
- //for debug reasons (needs 640x200 screen)
- //_system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H);
+ if (_debugEnabled) {
+ if (!_useOverlays)
+ _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H);
+ else
+ _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 640, 0, SCREEN_W, SCREEN_H);
+ }
+
_system->updateScreen();
}
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index b1a1eb7b1a..0765008d13 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -99,6 +99,10 @@ public:
void updateScreen();
+ // debug functions
+ bool queryScreenDebug() const { return _debugEnabled; }
+ bool enableScreenDebug(bool enable);
+
// page cur. functions
int setCurPage(int pageNum);
@@ -307,6 +311,12 @@ protected:
OSystem *_system;
KyraEngine *_vm;
+
+ // init
+ virtual void setResolution();
+
+ // debug
+ bool _debugEnabled;
};
} // End of namespace Kyra