aboutsummaryrefslogtreecommitdiff
path: root/base/main.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2013-07-04 04:58:54 -0700
committerEugene Sandulenko2013-07-04 04:58:54 -0700
commit49210a803a53b84bcabe42fd339a1b205236c34d (patch)
treed5916067b55404324fb70a3d3ee0a8f672f92679 /base/main.cpp
parent2b980e86e3db2ebc2279761ba29c0be4f24e03dc (diff)
parentb286a6d033287dce11dfa4216ad11728b892667d (diff)
downloadscummvm-rg350-49210a803a53b84bcabe42fd339a1b205236c34d.tar.gz
scummvm-rg350-49210a803a53b84bcabe42fd339a1b205236c34d.tar.bz2
scummvm-rg350-49210a803a53b84bcabe42fd339a1b205236c34d.zip
Merge pull request #331 from sev-/gsoc2012-eventsrecorder
GSoC2012: Event Recorder (reworked)
Diffstat (limited to 'base/main.cpp')
-rw-r--r--base/main.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 355a65f883..3f51c97949 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -42,8 +42,11 @@
#include "common/debug.h"
#include "common/debug-channels.h" /* for debug manager */
#include "common/events.h"
-#include "common/EventRecorder.h"
+#include "gui/EventRecorder.h"
#include "common/fs.h"
+#ifdef ENABLE_EVENTRECORDER
+#include "common/recorderfile.h"
+#endif
#include "common/system.h"
#include "common/textconsole.h"
#include "common/tokenizer.h"
@@ -409,7 +412,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
settings["gfx-mode"] = "default";
}
}
-
+ if (settings.contains("disable-display")) {
+ ConfMan.setInt("disable-display", 1, Common::ConfigManager::kTransientDomain);
+ }
setupGraphics(system);
// Init the different managers that are used by the engines.
@@ -428,7 +433,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// TODO: This is just to match the current behavior, when we further extend
// our event recorder, we might do this at another place. Or even change
// the whole API for that ;-).
- g_eventRec.init();
+ g_eventRec.RegisterEventSource();
// Now as the event manager is created, setup the keymapper
setupKeymapper(system);
@@ -448,6 +453,21 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// to save memory
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, plugin);
+#ifdef ENABLE_EVENTRECORDER
+ Common::String recordMode = ConfMan.get("record_mode");
+ Common::String recordFileName = ConfMan.get("record_file_name");
+
+ if (recordMode == "record") {
+ g_eventRec.init(g_eventRec.generateRecordFileName(ConfMan.getActiveDomainName()), GUI::EventRecorder::kRecorderRecord);
+ } else if (recordMode == "playback") {
+ g_eventRec.init(recordFileName, GUI::EventRecorder::kRecorderPlayback);
+ } else if ((recordMode == "info") && (!recordFileName.empty())) {
+ Common::PlaybackFile record;
+ record.openRead(recordFileName);
+ debug("info:author=%s name=%s description=%s", record.getHeader().author.c_str(), record.getHeader().name.c_str(), record.getHeader().description.c_str());
+ break;
+ }
+#endif
// Try to run the game
Common::Error result = runGame(plugin, system, specialDebug);
@@ -478,6 +498,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
#ifdef FORCE_RTL
g_system->getEventManager()->resetQuit();
#endif
+ #ifdef ENABLE_EVENTRECORDER
+ if (g_eventRec.checkForContinueGame()) {
+ continue;
+ }
+ #endif
// Discard any command line options. It's unlikely that the user
// wanted to apply them to *all* games ever launched.
@@ -501,7 +526,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
GUI::GuiManager::destroy();
Common::ConfigManager::destroy();
Common::DebugManager::destroy();
- Common::EventRecorder::destroy();
+ GUI::EventRecorder::destroy();
Common::SearchManager::destroy();
#ifdef USE_TRANSLATION
Common::TranslationManager::destroy();