Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/common/EventRecorder.h b/common/EventRecorder.h
- index 43a08b0..51ac5e9 100644
- --- a/common/EventRecorder.h
- +++ b/common/EventRecorder.h
- @@ -28,81 +28,163 @@
- #include "common/singleton.h"
- #include "common/mutex.h"
- #include "common/array.h"
- +#include "common/queue.h"
- +#include "common/memstream.h"
- +#include "common/savefile.h"
- +#include "backends/keymapper/keymapper.h"
- +#include "backends/mixer/sdl/sdl-mixer.h"
- +#include "backends/mixer/nullmixer/nullsdl-mixer.h"
- +#include "backends/timer/sdl/sdl-timer.h"
- +#include "backends/timer/default/default-timer.h"
- +#include "engines/advancedDetector.h"
- +#include "common/config-manager.h"
- +#include "common/recorderfile.h"
- +#include "backends/saves/default/default-saves.h"
- +#include "backends/saves/recorder/recorder-saves.h"
- +
- #define g_eventRec (Common::EventRecorder::instance())
- -namespace Common {
- +namespace GUI {
- + class OnScreenDialog;
- +}
- +namespace Common {
- class RandomSource;
- class SeekableReadStream;
- class WriteStream;
- +
- +
- +
- /**
- * Our generic event recorder.
- *
- * TODO: Add more documentation.
- */
- -class EventRecorder : private EventSource, private EventObserver, public Singleton<EventRecorder> {
- +class EventRecorder : private EventSource, public Singleton<EventRecorder>, private DefaultEventMapper {
- friend class Singleton<SingletonBaseType>;
- EventRecorder();
- ~EventRecorder();
- public:
- + enum RecordMode {
- + kPassthrough = 0,
- + kRecorderRecord = 1,
- + kRecorderPlayback = 2,
- + kRecorderPlaybackPause = 3
- + };
- void init();
- + void init(Common::String recordFileName, RecordMode mode);
- + void init(const ADGameDescription *desc, RecordMode mode);
- void deinit();
- -
- - /** Register random source so it can be serialized in game test purposes */
- - void registerRandomSource(RandomSource &rnd, const String &name);
- + bool delayMillis(uint &msecs, bool logged = false);
- + void takeScreenshot();
- + void preDrawOverlayGui();
- + void postDrawOverlayGui();
- /** TODO: Add documentation, this is only used by the backend */
- void processMillis(uint32 &millis);
- - /** TODO: Add documentation, this is only used by the backend */
- - bool processDelayMillis(uint &msecs);
- -
- + GUI::OnScreenDialog *controlPanel;
- + bool processAudio(uint32 &samples, bool paused);
- + SdlMixerManager *getMixerManager();
- + DefaultTimerManager *getTimerManager();
- + void setAuthor(const Common::String &author);
- + void setNotes(const Common::String &desc);
- + void setName(const Common::String &name);
- + const Common::String getAuthor() {
- + return _author;
- + }
- + const Common::String getNotes() {
- + return _desc;
- + }
- + const Common::String getName() {
- + return _name;
- + }
- + /** Register random source so it can be serialized in game test purposes */
- + uint32 getRandomSeed(const String &name);
- + void processGameDescription(const ADGameDescription *desc);
- + void registerMixerManager(SdlMixerManager *mixerManager);
- + void registerTimerManager(DefaultTimerManager *timerManager);
- + uint32 getTimer() {return _fakeTimer;}
- + void deleteRecord(const String& fileName);
- + bool isRecording() {
- + return _initialized;
- + }
- + bool _savedState;
- + void suspendRecording() {
- + _savedState = _initialized;
- + _initialized = false;
- + }
- + void resumeRecording() {
- + _initialized = _savedState;
- + }
- + Common::StringArray listSaveFiles(const Common::String &pattern);
- + void saveStream(Common::OutSaveFile *saveStream);
- + Common::SeekableReadStream *processSaveStream(const Common::String & fileName);
- + void RegisterEventSource();
- + Common::String generateRecordFileName(const String &target);
- + SaveFileManager *getSaveManager(SaveFileManager *realSaveManager);
- + void togglePause();
- + bool grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5[16]);
- + SDL_Surface *getSurface(int width, int height);
- + bool checkForContinueGame();
- + void deleteTemporarySave();
- + bool switchMode();
- + void updateSubsystems();
- + void setRedraw(bool redraw) {
- + _needRedraw = redraw;
- + }
- + void switchFastMode();
- private:
- - bool notifyEvent(const Event &ev);
- + bool _needRedraw;
- + bool _fastPlayback;
- + Common::String _author;
- + Common::String _desc;
- + Common::String _name;
- + void setFileHeader();
- + bool _enableDrag;
- + int _temporarySlot;
- + bool _needcontinueGame;
- + Common::Point dragPoint;
- + SaveFileManager *_realSaveManager;
- + RecorderSaveFileManager _fakeSaveManager;
- + virtual List<Event> mapEvent(const Event &ev, EventSource *source);
- + bool _initialized;
- + void setGameMd5(const ADGameDescription *gameDesc);
- + void getConfig();
- + void applyPlaybackSettings();
- + void removeDifferentEntriesInDomain(ConfigManager::Domain *domain);
- + void getConfigFromDomain(ConfigManager::Domain *domain);
- + MutexRef _recorderMutex;
- + SdlMixerManager *_realMixerManager;
- + NullSdlMixerManager *_fakeMixerManager;
- + DefaultTimerManager *_timerManager;
- + void switchMixer();
- + void switchTimerManagers();
- + bool openRecordFile(const String &fileName);
- + bool checkGameHash(const ADGameDescription *desc);
- + String findMD5ByFileName(const ADGameDescription *gameDesc, const String &fileName);
- bool notifyPoll();
- bool pollEvent(Event &ev);
- bool allowMapping() const { return false; }
- -
- - class RandomSourceRecord {
- - public:
- - String name;
- - uint32 seed;
- - };
- - Array<RandomSourceRecord> _randomSourceRecords;
- -
- - bool _recordSubtitles;
- - volatile uint32 _recordCount;
- - volatile uint32 _lastRecordEvent;
- - volatile uint32 _recordTimeCount;
- - volatile uint32 _lastEventMillis;
- - WriteStream *_recordFile;
- - WriteStream *_recordTimeFile;
- + void checkForKeyCode(const Event &event);
- + void writeAudioEvent(uint32 samplesCount);
- + void writeGameSettings();
- + void readAudioEvent();
- + void increaseEngineSpeed();
- + void decreaseEngineSpeed();
- + RecorderEvent _nextEvent;
- + uint8 _engineSpeedMultiplier;
- MutexRef _timeMutex;
- - MutexRef _recorderMutex;
- volatile uint32 _lastMillis;
- -
- - volatile uint32 _playbackCount;
- - volatile uint32 _playbackDiff;
- - volatile bool _hasPlaybackEvent;
- - volatile uint32 _playbackTimeCount;
- - Event _playbackEvent;
- - SeekableReadStream *_playbackFile;
- - SeekableReadStream *_playbackTimeFile;
- -
- - volatile uint32 _eventCount;
- - volatile uint32 _lastEventCount;
- -
- - enum RecordMode {
- - kPassthrough = 0,
- - kRecorderRecord = 1,
- - kRecorderPlayback = 2
- - };
- + volatile uint32 _fakeTimer;
- + uint32 _lastScreenshotTime;
- + uint32 _screenshotPeriod;
- + PlaybackFile *_playbackFile;
- + void saveScreenShot();
- + void checkRecordedMD5();
- volatile RecordMode _recordMode;
- - String _recordFileName;
- - String _recordTempFileName;
- - String _recordTimeFileName;
- };
- } // End of namespace Common
Add Comment
Please, Sign In to add comment