mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 11:45:21 +00:00
ENGINES: Create a default debugger when needed if none is yet set
This commit is contained in:
parent
73f17c2ae0
commit
98f9c4f254
@ -112,7 +112,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
||||
_currentKeyDown.ascii = Common::KEYCODE_BACKSPACE;
|
||||
|
||||
} else if (event.kbd.keycode == Common::KEYCODE_d && (_modifierState & Common::KBD_CTRL)) {
|
||||
GUI::Debugger *debugger = g_engine->getDebugger();
|
||||
GUI::Debugger *debugger = g_engine->getOrCreateDebugger();
|
||||
if (debugger) {
|
||||
debugger->attach();
|
||||
debugger->onFrame();
|
||||
|
@ -86,7 +86,7 @@ static void defaultErrorHandler(const char *msg) {
|
||||
// Unless this error -originated- within the debugger itself, we
|
||||
// now invoke the debugger, if available / supported.
|
||||
if (g_engine) {
|
||||
GUI::Debugger *debugger = g_engine->getDebugger();
|
||||
GUI::Debugger *debugger = g_engine->getOrCreateDebugger();
|
||||
|
||||
#if defined(USE_TASKBAR)
|
||||
g_system->getTaskbarManager()->notifyError();
|
||||
@ -760,6 +760,15 @@ bool Engine::shouldQuit() {
|
||||
return (eventMan->shouldQuit() || eventMan->shouldRTL());
|
||||
}
|
||||
|
||||
GUI::Debugger *Engine::getOrCreateDebugger() {
|
||||
if (!_debugger)
|
||||
// Create a bare-bones debugger. This is useful for engines without their own
|
||||
// debugger when an error occurs
|
||||
_debugger = new GUI::Debugger();
|
||||
|
||||
return _debugger;
|
||||
}
|
||||
|
||||
/*
|
||||
EnginePlugin *Engine::getMetaEnginePlugin() const {
|
||||
return EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||
|
@ -174,8 +174,7 @@ public:
|
||||
virtual void errorString(const char *buf_input, char *buf_output, int buf_output_size);
|
||||
|
||||
/**
|
||||
* Return the engine's debugger instance, if any. Used by error() to
|
||||
* invoke the debugger when a severe error is reported.
|
||||
* Return the engine's debugger instance, if any.
|
||||
*/
|
||||
virtual GUI::Debugger *getDebugger() { return _debugger; }
|
||||
|
||||
@ -188,6 +187,12 @@ public:
|
||||
_debugger = debugger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the engine's debugger instance, or create one if none is present.
|
||||
* Used by error() to invoke the debugger when a severe error is reported.
|
||||
*/
|
||||
GUI::Debugger *getOrCreateDebugger();
|
||||
|
||||
/**
|
||||
* Determine whether the engine supports the specified feature.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user