aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorEugene Sandulenko2013-05-17 00:18:09 +0300
committerEugene Sandulenko2013-05-17 00:18:09 +0300
commitf59512c47ea21c851535eeabf822aabdfde9167f (patch)
tree19c58c54c897dde0188e28951f0827a20ef3c4a0 /base
parent4a62d6c25a4994a72c59ca3b8f2913ead565a173 (diff)
downloadscummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.tar.gz
scummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.tar.bz2
scummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.zip
RECORDER: Implement Events Recorder
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp33
-rw-r--r--base/main.cpp33
2 files changed, 48 insertions, 18 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 42a3a64d34..6f173a594d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -118,6 +118,13 @@ static const char HELP_STRING[] =
" --aspect-ratio Enable aspect ratio correction\n"
" --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n"
" hercAmber, amiga)\n"
+#ifdef ENABLE_EVENTRECORDER
+ " --record-mode=MODE Specify record mode for event recorder (record, playback,\n"
+ " passthrough [default])\n"
+ " --record-file=FILE Specify record file name\n"
+ " --disable-display Disable any gfx output. Used for headless events\n"
+ " playback by Event Recorder\n"
+#endif
"\n"
#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
" --alt-intro Use alternative intro for CD versions of Beneath a\n"
@@ -232,10 +239,9 @@ void registerDefaults() {
ConfMan.registerDefault("confirm_exit", false);
ConfMan.registerDefault("disable_sdl_parachute", false);
+ ConfMan.registerDefault("disable_display", false);
ConfMan.registerDefault("record_mode", "none");
ConfMan.registerDefault("record_file_name", "record.bin");
- ConfMan.registerDefault("record_temp_file_name", "record.tmp");
- ConfMan.registerDefault("record_time_file_name", "record.time");
ConfMan.registerDefault("gui_saveload_chooser", "grid");
ConfMan.registerDefault("gui_saveload_last_pos", "0");
@@ -424,6 +430,17 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
DO_OPTION_BOOL('f', "fullscreen")
END_OPTION
+#ifdef ENABLE_EVENTRECORDER
+ DO_LONG_OPTION_INT("disable-display")
+ END_OPTION
+
+ DO_LONG_OPTION("record-mode")
+ END_OPTION
+
+ DO_LONG_OPTION("record-file-name")
+ END_OPTION
+#endif
+
DO_LONG_OPTION("opl-driver")
END_OPTION
@@ -569,18 +586,6 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
END_OPTION
#endif
- DO_LONG_OPTION("record-mode")
- END_OPTION
-
- DO_LONG_OPTION("record-file-name")
- END_OPTION
-
- DO_LONG_OPTION("record-temp-file-name")
- END_OPTION
-
- DO_LONG_OPTION("record-time-file-name")
- END_OPTION
-
#ifdef IPHONE
// This is automatically set when launched from the Springboard.
DO_LONG_OPTION_OPT("launchedFromSB", 0)
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();