Movies: Added option dialog when starting a recording

This commit is contained in:
Sour 2017-12-22 15:08:58 -05:00
parent 6b3e0ab611
commit 1825943a7f
26 changed files with 657 additions and 96 deletions

View file

@ -10,10 +10,10 @@
shared_ptr<IMovie> MovieManager::_player;
shared_ptr<MovieRecorder> MovieManager::_recorder;
void MovieManager::Record(string filename, bool reset)
void MovieManager::Record(RecordMovieOptions options)
{
shared_ptr<MovieRecorder> recorder(new MovieRecorder());
if(recorder->Record(filename, reset)) {
if(recorder->Record(options)) {
_recorder = recorder;
}
}

View file

@ -3,6 +3,7 @@
#include "MessageManager.h"
#include "EmulationSettings.h"
#include "IInputProvider.h"
#include "Types.h"
class MovieRecorder;
class VirtualFile;
@ -31,7 +32,7 @@ private:
static shared_ptr<MovieRecorder> _recorder;
public:
static void Record(string filename, bool reset);
static void Record(RecordMovieOptions options);
static void Play(VirtualFile file);
static void Stop();
static bool Playing();

View file

@ -18,9 +18,11 @@ MovieRecorder::~MovieRecorder()
{
}
bool MovieRecorder::Record(string filename, bool reset)
bool MovieRecorder::Record(RecordMovieOptions options)
{
_filename = filename;
_filename = options.Filename;
_author = options.Author;
_description = options.Description;
_writer.reset(new ZipWriter());
_inputData = stringstream();
_saveStateData = stringstream();
@ -31,18 +33,21 @@ bool MovieRecorder::Record(string filename, bool reset)
return false;
} else {
Console::Pause();
//TODO: Prevent game from loading battery from disk when not recording battery files
BatteryManager::SetBatteryProvider(shared_from_this());
if(options.RecordFrom == RecordMovieFrom::StartWithoutSaveData) {
BatteryManager::SetBatteryProvider(shared_from_this());
}
//Save existing battery files
BatteryManager::SetBatteryRecorder(shared_from_this());
if(options.RecordFrom == RecordMovieFrom::StartWithSaveData) {
BatteryManager::SetBatteryRecorder(shared_from_this());
}
ControlManager::RegisterInputRecorder(this);
if(reset) {
Console::GetInstance()->PowerCycle();
} else {
if(options.RecordFrom == RecordMovieFrom::CurrentState) {
SaveStateManager::SaveState(_saveStateData);
_hasSaveState = true;
} else {
Console::GetInstance()->PowerCycle();
}
BatteryManager::SetBatteryRecorder(nullptr);
Console::Resume();
@ -159,6 +164,13 @@ bool MovieRecorder::Stop()
GetGameSettings(out);
_writer->AddFile(out, "GameSettings.txt");
if(!_author.empty() || !_description.empty()) {
stringstream movieInfo;
WriteString(movieInfo, "Author", _author);
movieInfo << "Description\n" << _description;
_writer->AddFile(movieInfo, "MovieInfo.txt");
}
VirtualFile patchFile = Console::GetPatchFile();
vector<uint8_t> patchData;
if(patchFile.IsValid() && patchFile.ReadFile(patchData)) {

View file

@ -4,6 +4,7 @@
#include "IInputRecorder.h"
#include "CheatManager.h"
#include "BatteryManager.h"
#include "Types.h"
class ZipWriter;
@ -12,6 +13,8 @@ class MovieRecorder : public IInputRecorder, public IBatteryRecorder, public IBa
private:
static const uint32_t MovieFormatVersion = 1;
string _filename;
string _author;
string _description;
unique_ptr<ZipWriter> _writer;
std::unordered_map<string, vector<uint8_t>> _batteryData;
stringstream _inputData;
@ -28,7 +31,7 @@ public:
MovieRecorder();
~MovieRecorder();
bool Record(string filename, bool reset);
bool Record(RecordMovieOptions options);
bool Stop();
void RecordInput(vector<shared_ptr<BaseControlDevice>> devices) override;

View file

@ -124,7 +124,11 @@ void RecordedRomTest::Record(string filename, bool reset)
_recording = true;
//Start recording movie alongside with screenshots
MovieManager::Record(FolderUtilities::CombinePath(FolderUtilities::GetFolderName(filename), FolderUtilities::GetFilename(filename, false) + ".mmo"), reset);
RecordMovieOptions options;
string movieFilename = FolderUtilities::CombinePath(FolderUtilities::GetFolderName(filename), FolderUtilities::GetFilename(filename, false) + ".mmo");
memcpy(options.Filename, movieFilename.c_str(), std::max(1000, (int)movieFilename.size()));
options.RecordFrom = reset ? RecordMovieFrom::StartWithSaveData : RecordMovieFrom::CurrentState;
MovieManager::Record(options);
Console::Resume();
}

View file

@ -252,3 +252,20 @@ enum class ConsoleFeatures
BarcodeReader = 8,
TapeRecorder = 16,
};
enum class RecordMovieFrom
{
StartWithoutSaveData = 0,
StartWithSaveData,
CurrentState
};
struct RecordMovieOptions
{
public:
char Filename[2000] = {};
char Author[250] = {};
char Description[10000] = {};
RecordMovieFrom RecordFrom = RecordMovieFrom::StartWithoutSaveData;
};

View file

@ -31,6 +31,7 @@ namespace Mesen.GUI.Config
public PlayerProfile Profile;
public DebugInfo DebugInfo;
public AviRecordInfo AviRecordInfo;
public MovieRecordInfo MovieRecordInfo;
public Point? WindowLocation;
public Size? WindowSize;
@ -49,6 +50,7 @@ namespace Mesen.GUI.Config
VsConfig = new List<VsConfigInfo>();
DebugInfo = new DebugInfo();
AviRecordInfo = new AviRecordInfo();
MovieRecordInfo = new MovieRecordInfo();
}
~Configuration()

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.GUI.Config
{
public class MovieRecordInfo
{
public RecordMovieFrom RecordFrom;
public string Author;
public string Description;
}
}

View file

@ -71,9 +71,7 @@
<Control ID="mnuProfile">Configura el teu perfil</Control>
<Control ID="mnuMovies">Pel·lícules</Control>
<Control ID="mnuPlayMovie">Reprodueix...</Control>
<Control ID="mnuRecordFrom">Enregistra des...</Control>
<Control ID="mnuRecordFromStart">Del principi</Control>
<Control ID="mnuRecordFromNow">D'ara</Control>
<Control ID="mnuRecordMovie">Enregistra...</Control>
<Control ID="mnuStopMovie">Atura</Control>
<Control ID="mnuSoundRecorder">Enregistrador de so</Control>
<Control ID="mnuWaveRecord">Enregistra...</Control>
@ -568,6 +566,16 @@
<Control ID="lblExplanation">Això iniciarà Mesen en mode de pantalla completa i amb la rom "MyGame.nes" carregada. A més, farà servir el filtre NTSC ajustat a una escala de 2x i configurarà les opcions de sobreescaneig. El paràmetre "DoNotSaveSettings" s'utilitza per evitar que els canvis efectuats des de la línia d'ordres es desin permanentment a la configuració de Mesen.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Inicia Mesen en pantalla completa&#13;&#10;/DoNotSaveSettings - Evita que els canvis es desin (útil per a evitar que les opcions de la línia d'ordres es converteixin en la configuració per defecte)</Control>
</Form>
<Form ID="frmRecordMovie" Title="Movie Recording Options">
<Control ID="lblSaveTo">Save to:</Control>
<Control ID="lblRecordFrom">Record from:</Control>
<Control ID="lblMovieInformation">Movie Information (optional)</Control>
<Control ID="lblAuthor">Author:</Control>
<Control ID="lblDescription">Description:</Control>
<Control ID="btnBrowse">Navega...</Control>
<Control ID="btnOK">D'acord</Control>
<Control ID="btnCancel">Cancel·la</Control>
</Form>
<Form ID="frmInputBarCode" Title="Introducció d'un codi de barres...">
<Control ID="lblBarcode">Codi de barres:</Control>
<Control ID="btnOK">D'acord</Control>
@ -932,5 +940,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
</Enums>
</Resources>

View file

@ -285,7 +285,12 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
<!-- Resources below are used by the debugger only - no translation is needed -->
<Enum ID="StatusFlagFormat">
<Value ID="Hexadecimal">Hexadecimal</Value>

View file

@ -70,9 +70,7 @@
<Control ID="mnuProfile">Configurar tu perfil</Control>
<Control ID="mnuMovies">Videos</Control>
<Control ID="mnuPlayMovie">Reproducir...</Control>
<Control ID="mnuRecordFrom">Grabar a partir...</Control>
<Control ID="mnuRecordFromStart">Del inicio del juego</Control>
<Control ID="mnuRecordFromNow">Del estado actual</Control>
<Control ID="mnuRecordMovie">Grabar...</Control>
<Control ID="mnuStopMovie">Detener</Control>
<Control ID="mnuSoundRecorder">Grabar sonido</Control>
<Control ID="mnuWaveRecord">Grabar...</Control>
@ -586,6 +584,16 @@
<Control ID="btnOk">CONFIRMAR</Control>
<Control ID="lblCancel">Cancelar</Control>
</Form>
<Form ID="frmRecordMovie" Title="Movie Recording Options">
<Control ID="lblSaveTo">Save to:</Control>
<Control ID="lblRecordFrom">Record from:</Control>
<Control ID="lblMovieInformation">Movie Information (optional)</Control>
<Control ID="lblAuthor">Author:</Control>
<Control ID="lblDescription">Description:</Control>
<Control ID="btnBrowse">Buscar...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Cancelar</Control>
</Form>
<Form ID="frmInputBarCode" Title="Input Barcode...">
<Control ID="lblBarcode">Barcode:</Control>
<Control ID="btnOK">OK</Control>
@ -950,5 +958,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
</Enums>
</Resources>

View file

@ -71,9 +71,7 @@
<Control ID="mnuProfile">Configurer votre profil</Control>
<Control ID="mnuMovies">Films</Control>
<Control ID="mnuPlayMovie">Jouer...</Control>
<Control ID="mnuRecordFrom">Enregistrer à partir...</Control>
<Control ID="mnuRecordFromStart">Du début du jeu</Control>
<Control ID="mnuRecordFromNow">De maintenant</Control>
<Control ID="mnuRecordMovie">Enregistrer...</Control>
<Control ID="mnuStopMovie">Arrêter</Control>
<Control ID="mnuSoundRecorder">Enregistreur audio</Control>
<Control ID="mnuWaveRecord">Enregistrer...</Control>
@ -597,12 +595,21 @@
<Control ID="btnOk">CONFIRMER</Control>
<Control ID="lblCancel">Annuler</Control>
</Form>
<Form ID="frmRecordMovie" Title="Options d'enregistrement du film">
<Control ID="lblSaveTo">Sauvegarder sous :</Control>
<Control ID="lblRecordFrom">Enregistrer à partir:</Control>
<Control ID="lblMovieInformation">Information sur le film (optionel)</Control>
<Control ID="lblAuthor">Auteur :</Control>
<Control ID="lblDescription">Description :</Control>
<Control ID="btnBrowse">Parcourir...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Annuler</Control>
</Form>
<Form ID="frmInputBarCode" Title="Entrer un code-barres">
<Control ID="lblBarcode">Code-barres :</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Annuler</Control>
</Form>
<Form ID="BaseInputConfigForm">
<Control ID="lblHint">Les tabs sans icône sont vides.&#13;&#10;Chaque bouton peut être mappé à 4 boutons différents sur votre clavier et/ou votre manette.</Control>
<Control ID="tpgSet1">Mappage #1</Control>
@ -964,5 +971,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Du début</Value>
<Value ID="StartWithSaveData">Du début (en incluant les sauvegardes)</Value>
<Value ID="CurrentState">De maintenant</Value>
</Enum>
</Enums>
</Resources>

View file

@ -72,9 +72,7 @@
<Control ID="mnuProfile">プロファイル設定</Control>
<Control ID="mnuMovies">動画</Control>
<Control ID="mnuPlayMovie">再生</Control>
<Control ID="mnuRecordFrom">録画</Control>
<Control ID="mnuRecordFromStart">最初から</Control>
<Control ID="mnuRecordFromNow">この時点から</Control>
<Control ID="mnuRecordMovie">録画</Control>
<Control ID="mnuStopMovie">停止</Control>
<Control ID="mnuSoundRecorder">サウンドレコーダー</Control>
<Control ID="mnuWaveRecord">録音</Control>
@ -581,6 +579,16 @@
<Control ID="btnOk">確認</Control>
<Control ID="lblCancel">キャンセル</Control>
</Form>
<Form ID="frmRecordMovie" Title="録画設定">
<Control ID="lblSaveTo">保存先:</Control>
<Control ID="lblRecordFrom">録画開始時点:</Control>
<Control ID="lblMovieInformation">映画情報 (任意)</Control>
<Control ID="lblAuthor">作者:</Control>
<Control ID="lblDescription">説明:</Control>
<Control ID="btnBrowse">参照...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">キャンセル</Control>
</Form>
<Form ID="frmInputBarCode" Title="バーコードを入力">
<Control ID="lblBarcode">バーコード:</Control>
<Control ID="btnOK">入力</Control>
@ -947,5 +955,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">パワーオンから</Value>
<Value ID="StartWithSaveData">パワーオンから (セーブデータ付き)</Value>
<Value ID="CurrentState">今から</Value>
</Enum>
</Enums>
</Resources>

View file

@ -70,9 +70,7 @@
<Control ID="mnuProfile">Configurar perfil</Control>
<Control ID="mnuMovies">Vídeos</Control>
<Control ID="mnuPlayMovie">Reproduzir...</Control>
<Control ID="mnuRecordFrom">Gravar a partir de...</Control>
<Control ID="mnuRecordFromStart">Do início do jogo</Control>
<Control ID="mnuRecordFromNow">Do estado atual</Control>
<Control ID="mnuRecordMovie">Gravar...</Control>
<Control ID="mnuStopMovie">Parar</Control>
<Control ID="mnuVideoRecorder">Gravador de vídeo</Control>
<Control ID="mnuAviRecord">Gravar...</Control>
@ -584,6 +582,16 @@
<Control ID="btnOk">CONFIRMAR</Control>
<Control ID="lblCancel">Cancelar</Control>
</Form>
<Form ID="frmRecordMovie" Title="Movie Recording Options">
<Control ID="lblSaveTo">Save to:</Control>
<Control ID="lblRecordFrom">Record from:</Control>
<Control ID="lblMovieInformation">Movie Information (optional)</Control>
<Control ID="lblAuthor">Author:</Control>
<Control ID="lblDescription">Description:</Control>
<Control ID="btnBrowse">Procurar...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Cancelar</Control>
</Form>
<Form ID="frmInputBarCode" Title="Input Barcode...">
<Control ID="lblBarcode">Barcode:</Control>
<Control ID="btnOK">OK</Control>
@ -948,5 +956,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
</Enums>
</Resources>

View file

@ -70,9 +70,7 @@
<Control ID="mnuProfile">Настроить профиль</Control>
<Control ID="mnuMovies">Записи</Control>
<Control ID="mnuPlayMovie">Проиграть</Control>
<Control ID="mnuRecordFrom">Записать</Control>
<Control ID="mnuRecordFromStart">Сначала</Control>
<Control ID="mnuRecordFromNow">Немедленно</Control>
<Control ID="mnuRecordMovie">Записать</Control>
<Control ID="mnuStopMovie">Остановить запись</Control>
<Control ID="mnuSoundRecorder">Запись звука</Control>
<Control ID="mnuWaveRecord">Начать</Control>
@ -586,6 +584,16 @@
<Control ID="btnOk">CONFIRM</Control>
<Control ID="lblCancel">Cancel</Control>
</Form>
<Form ID="frmRecordMovie" Title="Movie Recording Options">
<Control ID="lblSaveTo">Save to:</Control>
<Control ID="lblRecordFrom">Record from:</Control>
<Control ID="lblMovieInformation">Movie Information (optional)</Control>
<Control ID="lblAuthor">Author:</Control>
<Control ID="lblDescription">Description:</Control>
<Control ID="btnBrowse">Browse...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Отмена</Control>
</Form>
<Form ID="frmInputBarCode" Title="Input Barcode...">
<Control ID="lblBarcode">Barcode:</Control>
<Control ID="btnOK">OK</Control>
@ -952,5 +960,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
</Enums>
</Resources>

View file

@ -70,9 +70,7 @@
<Control ID="mnuProfile">Налаштувати профіль</Control>
<Control ID="mnuMovies">Записи</Control>
<Control ID="mnuPlayMovie">Програти</Control>
<Control ID="mnuRecordFrom">Записати</Control>
<Control ID="mnuRecordFromStart">Спочатку</Control>
<Control ID="mnuRecordFromNow">Негайно</Control>
<Control ID="mnuRecordMovie">Записати</Control>
<Control ID="mnuStopMovie">Зупинити запис</Control>
<Control ID="mnuSoundRecorder">Запис звуку</Control>
<Control ID="mnuWaveRecord">Почати</Control>
@ -586,6 +584,16 @@
<Control ID="btnOk">ПIДТВЕРДИТИ</Control>
<Control ID="lblCancel">Скасувати</Control>
</Form>
<Form ID="frmRecordMovie" Title="Movie Recording Options">
<Control ID="lblSaveTo">Save to:</Control>
<Control ID="lblRecordFrom">Record from:</Control>
<Control ID="lblMovieInformation">Movie Information (optional)</Control>
<Control ID="lblAuthor">Author:</Control>
<Control ID="lblDescription">Description:</Control>
<Control ID="btnBrowse">Огляд...</Control>
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Вiдмiна</Control>
</Form>
<Form ID="frmInputBarCode" Title="Input Barcode...">
<Control ID="lblBarcode">Barcode:</Control>
<Control ID="btnOK">OK</Control>
@ -952,5 +960,10 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
</Enums>
</Resources>

View file

@ -68,7 +68,7 @@ namespace Mesen.GUI.Forms
if(value is IFormattable) {
kvp.Value.Text = ((IFormattable)value).ToString(format == eNumberFormat.Decimal ? "" : "X", System.Globalization.CultureInfo.InvariantCulture);
} else {
kvp.Value.Text = (string)value;
kvp.Value.Text = ((string)value).Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine);
}
} else if(kvp.Value is ctrlPathSelection) {
kvp.Value.Text = (string)value;

View file

@ -156,9 +156,7 @@ namespace Mesen.GUI.Forms
this.mnuProfile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMovies = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPlayMovie = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRecordFrom = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRecordFromStart = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRecordFromNow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRecordMovie = new System.Windows.Forms.ToolStripMenuItem();
this.mnuStopMovie = new System.Windows.Forms.ToolStripMenuItem();
this.mnuCheats = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripSeparator();
@ -1215,7 +1213,7 @@ namespace Mesen.GUI.Forms
//
this.mnuMovies.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuPlayMovie,
this.mnuRecordFrom,
this.mnuRecordMovie,
this.mnuStopMovie});
this.mnuMovies.Image = global::Mesen.GUI.Properties.Resources.Movie;
this.mnuMovies.Name = "mnuMovies";
@ -1226,39 +1224,23 @@ namespace Mesen.GUI.Forms
//
this.mnuPlayMovie.Image = global::Mesen.GUI.Properties.Resources.Play;
this.mnuPlayMovie.Name = "mnuPlayMovie";
this.mnuPlayMovie.Size = new System.Drawing.Size(149, 22);
this.mnuPlayMovie.Size = new System.Drawing.Size(152, 22);
this.mnuPlayMovie.Text = "Play...";
this.mnuPlayMovie.Click += new System.EventHandler(this.mnuPlayMovie_Click);
//
// mnuRecordFrom
// mnuRecordMovie
//
this.mnuRecordFrom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuRecordFromStart,
this.mnuRecordFromNow});
this.mnuRecordFrom.Image = global::Mesen.GUI.Properties.Resources.Record;
this.mnuRecordFrom.Name = "mnuRecordFrom";
this.mnuRecordFrom.Size = new System.Drawing.Size(149, 22);
this.mnuRecordFrom.Text = "Record from...";
//
// mnuRecordFromStart
//
this.mnuRecordFromStart.Name = "mnuRecordFromStart";
this.mnuRecordFromStart.Size = new System.Drawing.Size(99, 22);
this.mnuRecordFromStart.Text = "Start";
this.mnuRecordFromStart.Click += new System.EventHandler(this.mnuRecordFromStart_Click);
//
// mnuRecordFromNow
//
this.mnuRecordFromNow.Name = "mnuRecordFromNow";
this.mnuRecordFromNow.Size = new System.Drawing.Size(99, 22);
this.mnuRecordFromNow.Text = "Now";
this.mnuRecordFromNow.Click += new System.EventHandler(this.mnuRecordFromNow_Click);
this.mnuRecordMovie.Image = global::Mesen.GUI.Properties.Resources.Record;
this.mnuRecordMovie.Name = "mnuRecordMovie";
this.mnuRecordMovie.Size = new System.Drawing.Size(152, 22);
this.mnuRecordMovie.Text = "Record...";
this.mnuRecordMovie.Click += new System.EventHandler(this.mnuRecordMovie_Click);
//
// mnuStopMovie
//
this.mnuStopMovie.Image = global::Mesen.GUI.Properties.Resources.Stop;
this.mnuStopMovie.Name = "mnuStopMovie";
this.mnuStopMovie.Size = new System.Drawing.Size(149, 22);
this.mnuStopMovie.Size = new System.Drawing.Size(152, 22);
this.mnuStopMovie.Text = "Stop";
this.mnuStopMovie.Click += new System.EventHandler(this.mnuStopMovie_Click);
//
@ -1654,9 +1636,7 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripMenuItem mnuPlayMovie;
private System.Windows.Forms.ToolStripMenuItem mnuDebugger;
private System.Windows.Forms.ToolStripMenuItem mnuTakeScreenshot;
private System.Windows.Forms.ToolStripMenuItem mnuRecordFrom;
private System.Windows.Forms.ToolStripMenuItem mnuRecordFromStart;
private System.Windows.Forms.ToolStripMenuItem mnuRecordFromNow;
private System.Windows.Forms.ToolStripMenuItem mnuRecordMovie;
private System.Windows.Forms.ToolStripMenuItem mnuStopMovie;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem mnuExit;

View file

@ -27,18 +27,6 @@ namespace Mesen.GUI.Forms
}
}
private void RecordMovie(bool resetEmu)
{
using(SaveFileDialog sfd = new SaveFileDialog()) {
sfd.SetFilter(ResourceHelper.GetMessage("FilterMovie"));
sfd.InitialDirectory = ConfigManager.MovieFolder;
sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + ".mmo";
if(sfd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
InteropEmu.MovieRecord(sfd.FileName, resetEmu);
}
}
}
private void mnuPlayMovie_Click(object sender, EventArgs e)
{
using(OpenFileDialog ofd = new OpenFileDialog()) {
@ -54,15 +42,12 @@ namespace Mesen.GUI.Forms
{
InteropEmu.MovieStop();
}
private void mnuRecordFromStart_Click(object sender, EventArgs e)
private void mnuRecordMovie_Click(object sender, EventArgs e)
{
RecordMovie(true);
}
private void mnuRecordFromNow_Click(object sender, EventArgs e)
{
RecordMovie(false);
using(frmRecordMovie frm = new frmRecordMovie()) {
frm.ShowDialog(mnuMovies, this);
}
}
private void mnuWaveRecord_Click(object sender, EventArgs e)

View file

@ -880,10 +880,8 @@ namespace Mesen.GUI.Forms
bool movieRecording = InteropEmu.MovieRecording();
mnuPlayMovie.Enabled = !netPlay && !moviePlaying && !movieRecording;
mnuStopMovie.Enabled = running && !netPlay && (moviePlaying || movieRecording);
mnuRecordFrom.Enabled = running && !moviePlaying && !movieRecording;
mnuRecordFromStart.Enabled = running && !isNetPlayClient && !moviePlaying && !movieRecording;
mnuRecordFromNow.Enabled = running && !moviePlaying && !movieRecording;
mnuRecordMovie.Enabled = running && !moviePlaying && !movieRecording && !isNetPlayClient;
bool waveRecording = InteropEmu.WaveIsRecording();
mnuWaveRecord.Enabled = running && !waveRecording;
mnuWaveStop.Enabled = running && waveRecording;
@ -914,7 +912,7 @@ namespace Mesen.GUI.Forms
mnuNetPlay.Enabled = !InteropEmu.IsNsf();
if(running && InteropEmu.IsNsf()) {
mnuPowerCycle.Enabled = false;
mnuMovies.Enabled = mnuPlayMovie.Enabled = mnuStopMovie.Enabled = mnuRecordFrom.Enabled = mnuRecordFromStart.Enabled = mnuRecordFromNow.Enabled = false;
mnuMovies.Enabled = mnuPlayMovie.Enabled = mnuStopMovie.Enabled = mnuRecordMovie.Enabled = false;
}
mnuRegionAuto.Checked = ConfigManager.Config.Region == NesModel.Auto;

219
GUI.NET/Forms/frmRecordMovie.Designer.cs generated Normal file
View file

@ -0,0 +1,219 @@
namespace Mesen.GUI.Forms
{
partial class frmRecordMovie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblSaveTo = new System.Windows.Forms.Label();
this.txtFilename = new System.Windows.Forms.TextBox();
this.btnBrowse = new System.Windows.Forms.Button();
this.txtAuthor = new System.Windows.Forms.TextBox();
this.lblRecordFrom = new System.Windows.Forms.Label();
this.lblAuthor = new System.Windows.Forms.Label();
this.lblDescription = new System.Windows.Forms.Label();
this.cboRecordFrom = new System.Windows.Forms.ComboBox();
this.txtDescription = new System.Windows.Forms.TextBox();
this.lblMovieInformation = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Location = new System.Drawing.Point(0, 202);
this.baseConfigPanel.Size = new System.Drawing.Size(397, 29);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.lblSaveTo, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtFilename, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnBrowse, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.txtAuthor, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.lblRecordFrom, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.lblAuthor, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblDescription, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.cboRecordFrom, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.txtDescription, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.lblMovieInformation, 0, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 6;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(397, 231);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblSaveTo
//
this.lblSaveTo.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblSaveTo.AutoSize = true;
this.lblSaveTo.Location = new System.Drawing.Point(3, 8);
this.lblSaveTo.Name = "lblSaveTo";
this.lblSaveTo.Size = new System.Drawing.Size(47, 13);
this.lblSaveTo.TabIndex = 0;
this.lblSaveTo.Text = "Save to:";
//
// txtFilename
//
this.txtFilename.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtFilename.Location = new System.Drawing.Point(82, 3);
this.txtFilename.MaxLength = 1999;
this.txtFilename.Name = "txtFilename";
this.txtFilename.ReadOnly = true;
this.txtFilename.Size = new System.Drawing.Size(231, 20);
this.txtFilename.TabIndex = 1;
//
// btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(319, 3);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 2;
this.btnBrowse.Text = "Browse...";
this.btnBrowse.UseVisualStyleBackColor = true;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// txtAuthor
//
this.tableLayoutPanel1.SetColumnSpan(this.txtAuthor, 2);
this.txtAuthor.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtAuthor.Location = new System.Drawing.Point(82, 84);
this.txtAuthor.MaxLength = 249;
this.txtAuthor.Name = "txtAuthor";
this.txtAuthor.Size = new System.Drawing.Size(312, 20);
this.txtAuthor.TabIndex = 12;
//
// lblRecordFrom
//
this.lblRecordFrom.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRecordFrom.AutoSize = true;
this.lblRecordFrom.Location = new System.Drawing.Point(3, 36);
this.lblRecordFrom.Name = "lblRecordFrom";
this.lblRecordFrom.Size = new System.Drawing.Size(68, 13);
this.lblRecordFrom.TabIndex = 6;
this.lblRecordFrom.Text = "Record from:";
//
// lblAuthor
//
this.lblAuthor.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblAuthor.AutoSize = true;
this.lblAuthor.Location = new System.Drawing.Point(13, 87);
this.lblAuthor.Margin = new System.Windows.Forms.Padding(13, 0, 3, 0);
this.lblAuthor.Name = "lblAuthor";
this.lblAuthor.Size = new System.Drawing.Size(41, 13);
this.lblAuthor.TabIndex = 5;
this.lblAuthor.Text = "Author:";
//
// lblDescription
//
this.lblDescription.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblDescription.AutoSize = true;
this.lblDescription.Location = new System.Drawing.Point(13, 146);
this.lblDescription.Margin = new System.Windows.Forms.Padding(13, 0, 3, 0);
this.lblDescription.Name = "lblDescription";
this.lblDescription.Size = new System.Drawing.Size(63, 13);
this.lblDescription.TabIndex = 11;
this.lblDescription.Text = "Description:";
//
// cboRecordFrom
//
this.cboRecordFrom.Dock = System.Windows.Forms.DockStyle.Fill;
this.cboRecordFrom.FormattingEnabled = true;
this.cboRecordFrom.Location = new System.Drawing.Point(82, 32);
this.cboRecordFrom.Name = "cboRecordFrom";
this.cboRecordFrom.Size = new System.Drawing.Size(231, 21);
this.cboRecordFrom.TabIndex = 13;
//
// txtDescription
//
this.txtDescription.AcceptsReturn = true;
this.tableLayoutPanel1.SetColumnSpan(this.txtDescription, 2);
this.txtDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtDescription.Location = new System.Drawing.Point(82, 110);
this.txtDescription.MaxLength = 9999;
this.txtDescription.Multiline = true;
this.txtDescription.Name = "txtDescription";
this.txtDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtDescription.Size = new System.Drawing.Size(312, 86);
this.txtDescription.TabIndex = 10;
//
// lblMovieInformation
//
this.lblMovieInformation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblMovieInformation.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.lblMovieInformation, 2);
this.lblMovieInformation.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblMovieInformation.Location = new System.Drawing.Point(3, 65);
this.lblMovieInformation.Name = "lblMovieInformation";
this.lblMovieInformation.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3);
this.lblMovieInformation.Size = new System.Drawing.Size(139, 16);
this.lblMovieInformation.TabIndex = 24;
this.lblMovieInformation.Text = "Movie Information (Optional)";
//
// frmRecordMovie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(397, 231);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmRecordMovie";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Movie Recording Options";
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblSaveTo;
private System.Windows.Forms.TextBox txtFilename;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.Label lblAuthor;
private System.Windows.Forms.Label lblRecordFrom;
private System.Windows.Forms.TextBox txtDescription;
private System.Windows.Forms.Label lblDescription;
private System.Windows.Forms.TextBox txtAuthor;
private System.Windows.Forms.ComboBox cboRecordFrom;
private System.Windows.Forms.Label lblMovieInformation;
}
}

View file

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
namespace Mesen.GUI.Forms
{
public partial class frmRecordMovie : BaseConfigForm
{
public frmRecordMovie()
{
InitializeComponent();
Entity = ConfigManager.Config.MovieRecordInfo;
AddBinding("Author", txtAuthor);
AddBinding("Description", txtDescription);
AddBinding("RecordFrom", cboRecordFrom);
}
protected override bool ValidateInput()
{
return !string.IsNullOrWhiteSpace(txtFilename.Text);
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
if(this.DialogResult == DialogResult.OK) {
InteropEmu.MovieRecord(new RecordMovieOptions(
this.txtFilename.Text,
this.txtAuthor.Text,
this.txtDescription.Text,
this.cboRecordFrom.GetEnumValue<RecordMovieFrom>()
));
}
}
private void btnBrowse_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.SetFilter(ResourceHelper.GetMessage("FilterMovie"));
sfd.InitialDirectory = ConfigManager.MovieFolder;
sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + ".mmo";
if(sfd.ShowDialog() == DialogResult.OK) {
txtFilename.Text = sfd.FileName;
}
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -211,6 +211,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config\MovieRecordInfo.cs" />
<Compile Include="Config\ConfigAttributes.cs" />
<Compile Include="Config\AviRecordInfo.cs" />
<Compile Include="Config\DebugInfo.cs" />
@ -898,6 +899,12 @@
<DependentUpon>frmMain.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmRecordMovie.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmRecordMovie.Designer.cs">
<DependentUpon>frmRecordMovie.cs</DependentUpon>
</Compile>
<Compile Include="Forms\frmRecordAvi.cs">
<SubType>Form</SubType>
</Compile>
@ -1277,6 +1284,9 @@
<EmbeddedResource Include="Forms\frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmRecordMovie.resx">
<DependentUpon>frmRecordMovie.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmRecordAvi.resx">
<DependentUpon>frmRecordAvi.cs</DependentUpon>
</EmbeddedResource>

View file

@ -98,7 +98,7 @@ namespace Mesen.GUI
[DllImport(DLLPath, EntryPoint = "GetLog")] private static extern IntPtr GetLogWrapper();
[DllImport(DLLPath)] public static extern void MoviePlay([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename);
[DllImport(DLLPath)] public static extern void MovieRecord([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename, [MarshalAs(UnmanagedType.I1)]bool reset);
[DllImport(DLLPath)] public static extern void MovieRecord(RecordMovieOptions options);
[DllImport(DLLPath)] public static extern void MovieStop();
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool MoviePlaying();
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool MovieRecording();
@ -1720,6 +1720,48 @@ namespace Mesen.GUI
}
}
public enum RecordMovieFrom
{
StartWithoutSaveData,
StartWithSaveData,
CurrentState
}
public struct RecordMovieOptions
{
private const int AuthorMaxSize = 250;
private const int DescriptionMaxSize = 10000;
private const int FilenameMaxSize = 2000;
public RecordMovieOptions(string filename, string author, string description, RecordMovieFrom recordFrom)
{
Author = Encoding.UTF8.GetBytes(author);
Array.Resize(ref Author, AuthorMaxSize);
Author[AuthorMaxSize-1] = 0;
Description = Encoding.UTF8.GetBytes(description.Replace("\r", ""));
Array.Resize(ref Description, DescriptionMaxSize);
Description[DescriptionMaxSize-1] = 0;
Filename = Encoding.UTF8.GetBytes(filename);
Array.Resize(ref Filename, FilenameMaxSize);
Filename[FilenameMaxSize-1] = 0;
RecordFrom = recordFrom;
}
[MarshalAs(UnmanagedType.ByValArray, SizeConst = FilenameMaxSize)]
public byte[] Filename;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = AuthorMaxSize)]
public byte[] Author;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DescriptionMaxSize)]
public byte[] Description;
public RecordMovieFrom RecordFrom;
}
[Flags]
public enum BreakpointType
{

View file

@ -356,7 +356,7 @@ namespace InteropEmu {
DllExport int64_t __stdcall GetStateInfo(uint32_t stateIndex) { return SaveStateManager::GetStateInfo(stateIndex); }
DllExport void __stdcall MoviePlay(char* filename) { MovieManager::Play(string(filename)); }
DllExport void __stdcall MovieRecord(char* filename, bool reset) { MovieManager::Record(filename, reset); }
DllExport void __stdcall MovieRecord(RecordMovieOptions options) { MovieManager::Record(options); }
DllExport void __stdcall MovieStop() { MovieManager::Stop(); }
DllExport bool __stdcall MoviePlaying() { return MovieManager::Playing(); }
DllExport bool __stdcall MovieRecording() { return MovieManager::Recording(); }