KYRA: "Fix" bug #3166235 "KYRA: Crash on startup on OS X due to invalid PAK file".

Now we can show such errors in the debugger, since we initialize and the
screen resolution and the debugger before initializing the resource manager.
This allows our error function to open up the debugger and show the error at
least.

A better feedback to the user might be desirable, but it is not really
feasible with our current possibilites for error reporting.
This commit is contained in:
Johannes Schickel 2011-11-18 03:47:51 +01:00
parent 11a7993085
commit cfac223cee
7 changed files with 44 additions and 14 deletions

View File

@ -32,9 +32,10 @@
namespace Kyra {
Debugger::Debugger(KyraEngine_v1 *vm)
: ::GUI::Debugger() {
_vm = vm;
: ::GUI::Debugger(), _vm(vm) {
}
void Debugger::initialize() {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("screen_debug_mode", WRAP_METHOD(Debugger, cmd_setScreenDebug));
DCmd_Register("load_palette", WRAP_METHOD(Debugger, cmd_loadPalette));
@ -196,6 +197,9 @@ bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) {
Debugger_LoK::Debugger_LoK(KyraEngine_LoK *vm)
: Debugger(vm), _vm(vm) {
}
void Debugger_LoK::initialize() {
DCmd_Register("enter", WRAP_METHOD(Debugger_LoK, cmd_enterRoom));
DCmd_Register("scenes", WRAP_METHOD(Debugger_LoK, cmd_listScenes));
DCmd_Register("give", WRAP_METHOD(Debugger_LoK, cmd_giveItem));
@ -281,6 +285,9 @@ bool Debugger_LoK::cmd_listBirthstones(int argc, const char **argv) {
#pragma mark -
Debugger_v2::Debugger_v2(KyraEngine_v2 *vm) : Debugger(vm), _vm(vm) {
}
void Debugger_v2::initialize() {
DCmd_Register("character_info", WRAP_METHOD(Debugger_v2, cmd_characterInfo));
DCmd_Register("enter", WRAP_METHOD(Debugger_v2, cmd_enterScene));
DCmd_Register("scenes", WRAP_METHOD(Debugger_v2, cmd_listScenes));
@ -433,6 +440,9 @@ bool Debugger_v2::cmd_giveItem(int argc, const char **argv) {
#pragma mark -
Debugger_HoF::Debugger_HoF(KyraEngine_HoF *vm) : Debugger_v2(vm), _vm(vm) {
}
void Debugger_HoF::initialize() {
DCmd_Register("pass_codes", WRAP_METHOD(Debugger_HoF, cmd_passcodes));
}

View File

@ -37,6 +37,8 @@ public:
Debugger(KyraEngine_v1 *vm);
virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
virtual void initialize();
protected:
KyraEngine_v1 *_vm;
@ -56,6 +58,7 @@ public:
Debugger_LoK(KyraEngine_LoK *vm);
virtual ~Debugger_LoK() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
virtual void initialize();
protected:
KyraEngine_LoK *_vm;
@ -70,6 +73,7 @@ public:
Debugger_v2(KyraEngine_v2 *vm);
virtual ~Debugger_v2() {}
virtual void initialize();
protected:
KyraEngine_v2 *_vm;
@ -85,6 +89,7 @@ class Debugger_HoF : public Debugger_v2 {
public:
Debugger_HoF(KyraEngine_HoF *vm);
virtual void initialize();
protected:
KyraEngine_HoF *_vm;

View File

@ -223,11 +223,12 @@ Common::Error KyraEngine_HoF::init() {
assert(_screen);
_screen->setResolution();
_debugger = new Debugger_HoF(this);
assert(_debugger);
KyraEngine_v1::init();
initStaticResource();
_debugger = new Debugger_HoF(this);
assert(_debugger);
_text = new TextDisplayer_HoF(this, _screen);
assert(_text);
_gui = new GUI_HoF(this);
@ -455,6 +456,9 @@ void KyraEngine_HoF::startup() {
}
void KyraEngine_HoF::runLoop() {
// Initialize debugger since how it should be fully usable
_debugger->initialize();
_screen->updateScreen();
_runFlag = true;

View File

@ -174,6 +174,9 @@ Common::Error KyraEngine_LoK::init() {
assert(_screen);
_screen->setResolution();
_debugger = new Debugger_LoK(this);
assert(_debugger);
KyraEngine_v1::init();
_sprites = new Sprites(this, _system);
@ -229,8 +232,6 @@ Common::Error KyraEngine_LoK::init() {
memset(&_scriptMain, 0, sizeof(EMCState));
memset(&_scriptClick, 0, sizeof(EMCState));
_debugger = new Debugger_LoK(this);
assert(_debugger);
memset(_shapes, 0, sizeof(_shapes));
for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i)
@ -436,6 +437,9 @@ void KyraEngine_LoK::startup() {
}
void KyraEngine_LoK::mainLoop() {
// Initialize debugger since how it should be fully usable
_debugger->initialize();
_eventList.clear();
while (!shouldQuit()) {

View File

@ -205,12 +205,12 @@ Common::Error KyraEngine_MR::init() {
assert(_screen);
_screen->setResolution();
KyraEngine_v1::init();
initStaticResource();
_debugger = new Debugger_v2(this);
assert(_debugger);
KyraEngine_v1::init();
initStaticResource();
_soundDigital = new SoundDigital(this, _mixer);
assert(_soundDigital);
if (!_soundDigital->init())
@ -887,6 +887,9 @@ bool KyraEngine_MR::checkCharCollision(int x, int y) {
#pragma mark -
void KyraEngine_MR::runLoop() {
// Initialize debugger since how it should be fully usable
_debugger->initialize();
_eventList.clear();
_runFlag = true;

View File

@ -85,8 +85,9 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
void KyraEngine_v1::pauseEngineIntern(bool pause) {
Engine::pauseEngineIntern(pause);
if (_sound)
_sound->pause(pause);
_timer->pause(pause);
_sound->pause(pause);
if (_timer)
_timer->pause(pause);
}
Common::Error KyraEngine_v1::init() {

View File

@ -434,6 +434,9 @@ Common::Error LoLEngine::init() {
assert(_screen);
_screen->setResolution();
_debugger = new Debugger_LoL(this);
assert(_debugger);
KyraEngine_v1::init();
initStaticResource();
@ -547,9 +550,6 @@ Common::Error LoLEngine::init() {
_spellProcs.push_back(new SpellProc(this, 0));
_spellProcs.push_back(new SpellProc(this, &LoLEngine::castGuardian));
_debugger = new Debugger_LoL(this);
assert(_debugger);
initKeymap();
return Common::kNoError;
@ -978,6 +978,9 @@ void LoLEngine::startupNew() {
}
void LoLEngine::runLoop() {
// Initialize debugger since how it should be fully usable
_debugger->initialize();
enableSysTimer(2);
bool _runFlag = true;