diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/debugger.cpp | 16 | ||||
-rw-r--r-- | engines/wintermute/debugger/debugger_controller.cpp | 17 | ||||
-rw-r--r-- | engines/wintermute/debugger/debugger_controller.h | 4 |
3 files changed, 33 insertions, 4 deletions
diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp index 42fba60f9a..760a852c97 100644 --- a/engines/wintermute/debugger.cpp +++ b/engines/wintermute/debugger.cpp @@ -47,6 +47,7 @@ Console::Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) { registerCmd(DISABLE_BREAKPOINT_CMD, WRAP_METHOD(Console, Cmd_DisableBreakpoint)); registerCmd(ENABLE_BREAKPOINT_CMD, WRAP_METHOD(Console, Cmd_EnableBreakpoint)); registerCmd(INFO_CMD, WRAP_METHOD(Console, Cmd_Info)); + registerCmd(SET_PATH_CMD, WRAP_METHOD(Console, Cmd_SourcePath)); registerCmd(TOP_CMD, WRAP_METHOD(Console, Cmd_Top)); } @@ -241,6 +242,21 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) { return true; } + +bool Console::Cmd_SourcePath(int argc, const char **argv) { + if (argc != 2) { + debugPrintf("Usage: %s <source path>\n", argv[0]); + return true; + } else { + if (CONTROLLER->setSourcePath(Common::String(argv[1])).getErrorCode() == OK) { + debugPrintf("Source path set to '%s'\n", CONTROLLER->getSourcePath().c_str()); + } else { + debugPrintf("Error setting source path. Note that \"\" is illegal."); + } + return true; + } +} + void Console::notifyBreakpoint(const char *filename, int line) { debugPrintf("Breakpoint hit %s: %d\n", filename, line); printSource(0); diff --git a/engines/wintermute/debugger/debugger_controller.cpp b/engines/wintermute/debugger/debugger_controller.cpp index a7f7c2ea4a..c7c88be034 100644 --- a/engines/wintermute/debugger/debugger_controller.cpp +++ b/engines/wintermute/debugger/debugger_controller.cpp @@ -33,17 +33,19 @@ #include "engines/wintermute/debugger/breakpoint.h" #include "engines/wintermute/debugger/debugger_controller.h" #include "engines/wintermute/debugger/listing_providers/blank_listing_provider.h" +#include "engines/wintermute/debugger/listing_providers/cached_source_listing_provider.h" +#include "engines/wintermute/debugger/listing_providers/source_listing.h" #define SCENGINE _engine->_game->_scEngine #define DEBUGGER _engine->_debugger namespace Wintermute { DebuggerController::~DebuggerController() { - delete _listingProvider; + delete _sourceListingProvider; } DebuggerController::DebuggerController(WintermuteEngine *vm) : _engine(vm) { - _listingProvider = new BlankListingProvider(); + _sourceListingProvider = new CachedSourceListingProvider(); clear(); } @@ -162,6 +164,15 @@ uint32 DebuggerController::getLastLine() const { return _lastLine; } +Common::String DebuggerController::getSourcePath() const { + return _sourceListingProvider->getPath(); +} + +Error DebuggerController::setSourcePath(const Common::String &sourcePath) { + ErrorCode err = _sourceListingProvider->setPath(sourcePath); + return Error((err == OK ? SUCCESS : ERROR), err); +} + Listing* DebuggerController::getListing(Error* &error) { delete (error); if (_lastScript == nullptr) { @@ -169,7 +180,7 @@ Listing* DebuggerController::getListing(Error* &error) { return nullptr; } ErrorCode err; - Listing* res = _listingProvider->getListing(SCENGINE->_currentScript->_filename, err); + Listing* res = _sourceListingProvider->getListing(SCENGINE->_currentScript->_filename, err); error = new Error(err == OK ? SUCCESS : ERROR, err); return res; } diff --git a/engines/wintermute/debugger/debugger_controller.h b/engines/wintermute/debugger/debugger_controller.h index b4119b56d3..7af2a039b1 100644 --- a/engines/wintermute/debugger/debugger_controller.h +++ b/engines/wintermute/debugger/debugger_controller.h @@ -51,7 +51,7 @@ struct TopEntry { }; class DebuggerController : public ScriptMonitor { - ListingProvider *_listingProvider; + SourceListingProvider *_sourceListingProvider; const WintermuteEngine *_engine; DebuggableScript *_lastScript; uint32 _lastDepth; @@ -83,6 +83,8 @@ public: * @brief continue execution and don't step until the current activation record is popped */ Error stepFinish(); + Error setSourcePath(const Common::String &sourcePath); + Common::String getSourcePath() const; Listing *getListing(Error* &err); void showFps(bool show); /** |