2017-04-18 22:39:45 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "MovieManager.h"
|
2017-11-19 23:08:23 -05:00
|
|
|
#include "VirtualFile.h"
|
2018-07-01 15:21:05 -04:00
|
|
|
#include "BatteryManager.h"
|
2018-07-02 14:49:19 -04:00
|
|
|
#include "INotificationListener.h"
|
2017-04-18 22:39:45 -04:00
|
|
|
|
2017-11-19 23:08:23 -05:00
|
|
|
class ZipReader;
|
2018-07-01 15:21:05 -04:00
|
|
|
class Console;
|
|
|
|
struct CodeInfo;
|
2017-04-18 22:39:45 -04:00
|
|
|
|
2018-07-02 14:49:19 -04:00
|
|
|
class MesenMovie : public IMovie, public INotificationListener, public IBatteryProvider, public std::enable_shared_from_this<MesenMovie>
|
2017-04-18 22:39:45 -04:00
|
|
|
{
|
|
|
|
private:
|
2018-07-01 15:21:05 -04:00
|
|
|
shared_ptr<Console> _console;
|
|
|
|
|
2017-11-19 23:08:23 -05:00
|
|
|
VirtualFile _movieFile;
|
|
|
|
shared_ptr<ZipReader> _reader;
|
2017-04-18 22:39:45 -04:00
|
|
|
bool _playing = false;
|
2017-11-19 23:08:23 -05:00
|
|
|
size_t _deviceIndex = 0;
|
|
|
|
vector<vector<string>> _inputData;
|
|
|
|
vector<string> _cheats;
|
|
|
|
std::unordered_map<string, string> _settings;
|
2017-04-18 22:39:45 -04:00
|
|
|
string _filename;
|
|
|
|
|
|
|
|
private:
|
2017-11-19 23:08:23 -05:00
|
|
|
void ParseSettings(stringstream &data);
|
|
|
|
void ApplySettings();
|
|
|
|
bool LoadGame();
|
2017-04-18 22:39:45 -04:00
|
|
|
void Stop();
|
|
|
|
|
2018-01-11 17:54:31 -05:00
|
|
|
uint32_t LoadInt(std::unordered_map<string, string> &settings, string name, uint32_t defaultValue = 0);
|
2017-11-19 23:08:23 -05:00
|
|
|
bool LoadBool(std::unordered_map<string, string> &settings, string name);
|
|
|
|
string LoadString(std::unordered_map<string, string> &settings, string name);
|
|
|
|
void LoadCheats();
|
|
|
|
bool LoadCheat(string cheatData, CodeInfo &code);
|
2017-04-18 22:39:45 -04:00
|
|
|
|
|
|
|
public:
|
2018-07-01 15:21:05 -04:00
|
|
|
MesenMovie(shared_ptr<Console> console);
|
2018-06-11 19:07:05 -04:00
|
|
|
virtual ~MesenMovie();
|
2017-04-18 22:39:45 -04:00
|
|
|
|
2017-11-19 23:08:23 -05:00
|
|
|
bool Play(VirtualFile &file) override;
|
|
|
|
bool SetInput(BaseControlDevice* device) override;
|
2017-11-20 19:15:17 -05:00
|
|
|
bool IsPlaying() override;
|
2017-11-19 23:08:23 -05:00
|
|
|
|
|
|
|
// Inherited via IBatteryProvider
|
|
|
|
virtual vector<uint8_t> LoadBattery(string extension) override;
|
2018-07-02 14:49:19 -04:00
|
|
|
|
|
|
|
// Inherited via INotificationListener
|
|
|
|
virtual void ProcessNotification(ConsoleNotificationType type, void * parameter) override;
|
2017-04-18 22:39:45 -04:00
|
|
|
};
|