mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-14 01:55:55 +00:00
SCI: Refactor to use Engine debugger
This commit is contained in:
parent
818d9bab27
commit
ba147f5ad5
@ -261,6 +261,15 @@ Console::Console(SciEngine *engine) : GUI::Debugger(),
|
|||||||
Console::~Console() {
|
Console::~Console() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Console::attach(const char *entry) {
|
||||||
|
if (entry) {
|
||||||
|
// Attaching to display a severe error, let the engine know
|
||||||
|
_engine->severeError();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI::Debugger::attach(entry);
|
||||||
|
}
|
||||||
|
|
||||||
void Console::preEnter() {
|
void Console::preEnter() {
|
||||||
_engine->pauseEngine(true);
|
_engine->pauseEngine(true);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,12 @@ public:
|
|||||||
Console(SciEngine *engine);
|
Console(SciEngine *engine);
|
||||||
~Console() override;
|
~Console() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'Attach' the debugger. This ensures that the next time onFrame()
|
||||||
|
* is invoked, the debugger will activate and accept user input.
|
||||||
|
*/
|
||||||
|
void attach(const char *entry = nullptr) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void preEnter() override;
|
void preEnter() override;
|
||||||
void postEnter() override;
|
void postEnter() override;
|
||||||
|
@ -303,14 +303,6 @@ SciEvent EventManager::getScummVMEvent() {
|
|||||||
return noEvent;
|
return noEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Control-Shift-D (debug console)
|
|
||||||
if (ev.type == Common::EVENT_KEYDOWN && ev.kbd.hasFlags(Common::KBD_CTRL | Common::KBD_SHIFT) && ev.kbd.keycode == Common::KEYCODE_d) {
|
|
||||||
// Open debug console
|
|
||||||
Console *con = g_sci->getSciDebugger();
|
|
||||||
con->attach();
|
|
||||||
return noEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The IBM keyboard driver prior to SCI1.1 only sent keydown events to the
|
// The IBM keyboard driver prior to SCI1.1 only sent keydown events to the
|
||||||
// interpreter
|
// interpreter
|
||||||
if (ev.type != Common::EVENT_KEYDOWN && getSciVersion() < SCI_VERSION_1_1) {
|
if (ev.type != Common::EVENT_KEYDOWN && getSciVersion() < SCI_VERSION_1_1) {
|
||||||
|
@ -240,7 +240,7 @@ SciEngine::~SciEngine() {
|
|||||||
delete _soundCmd;
|
delete _soundCmd;
|
||||||
delete _kernel;
|
delete _kernel;
|
||||||
delete _vocabulary;
|
delete _vocabulary;
|
||||||
delete _console;
|
//_console deleted by Engine
|
||||||
delete _guestAdditions;
|
delete _guestAdditions;
|
||||||
delete _features;
|
delete _features;
|
||||||
delete _gfxMacIconBar;
|
delete _gfxMacIconBar;
|
||||||
@ -331,6 +331,7 @@ Common::Error SciEngine::run() {
|
|||||||
|
|
||||||
// Create debugger console. It requires GFX and _gamestate to be initialized
|
// Create debugger console. It requires GFX and _gamestate to be initialized
|
||||||
_console = new Console(this);
|
_console = new Console(this);
|
||||||
|
setDebugger(_console);
|
||||||
|
|
||||||
// The game needs to be initialized before the graphics system is initialized, as
|
// The game needs to be initialized before the graphics system is initialized, as
|
||||||
// the graphics code checks parts of the seg manager upon initialization (e.g. for
|
// the graphics code checks parts of the seg manager upon initialization (e.g. for
|
||||||
@ -757,8 +758,8 @@ void SciEngine::exitGame() {
|
|||||||
_gamestate->_fileHandles.resize(5);
|
_gamestate->_fileHandles.resize(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked by error() when a severe error occurs
|
// Invoked by debugger when a severe error occurs
|
||||||
GUI::Debugger *SciEngine::getDebugger() {
|
void SciEngine::severeError() {
|
||||||
if (_gamestate) {
|
if (_gamestate) {
|
||||||
ExecStack *xs = &(_gamestate->_executionStack.back());
|
ExecStack *xs = &(_gamestate->_executionStack.back());
|
||||||
if (xs) {
|
if (xs) {
|
||||||
@ -769,11 +770,8 @@ GUI::Debugger *SciEngine::getDebugger() {
|
|||||||
|
|
||||||
_debugState.runningStep = 0; // Stop multiple execution
|
_debugState.runningStep = 0; // Stop multiple execution
|
||||||
_debugState.seeking = kDebugSeekNothing; // Stop special seeks
|
_debugState.seeking = kDebugSeekNothing; // Stop special seeks
|
||||||
|
|
||||||
return _console;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to obtain the engine's console in order to print messages to it
|
|
||||||
Console *SciEngine::getSciDebugger() {
|
Console *SciEngine::getSciDebugger() {
|
||||||
return _console;
|
return _console;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ public:
|
|||||||
Common::Error run() override;
|
Common::Error run() override;
|
||||||
bool hasFeature(EngineFeature f) const override;
|
bool hasFeature(EngineFeature f) const override;
|
||||||
void pauseEngineIntern(bool pause) override;
|
void pauseEngineIntern(bool pause) override;
|
||||||
GUI::Debugger *getDebugger() override;
|
void severeError();
|
||||||
Console *getSciDebugger();
|
Console *getSciDebugger();
|
||||||
Common::Error loadGameState(int slot) override;
|
Common::Error loadGameState(int slot) override;
|
||||||
Common::Error saveGameState(int slot, const Common::String &desc) override;
|
Common::Error saveGameState(int slot, const Common::String &desc) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user