Fix movie exporting?
This commit is contained in:
parent
92005f89c0
commit
781a70208c
3 changed files with 14 additions and 12 deletions
|
@ -182,6 +182,7 @@ bool MovieRecorder::CreateMovie(string movieFile, std::deque<RewindData>& data,
|
|||
{
|
||||
_filename = movieFile;
|
||||
_writer.reset(new ZipWriter());
|
||||
|
||||
if (startPosition < data.size() && endPosition <= data.size() && _writer->Initialize(_filename)) {
|
||||
vector<shared_ptr<BaseControlDevice>> devices = _console->GetControlManager()->GetControlDevices();
|
||||
|
||||
|
@ -197,7 +198,7 @@ bool MovieRecorder::CreateMovie(string movieFile, std::deque<RewindData>& data,
|
|||
|
||||
for (uint32_t i = startPosition; i < endPosition; i++) {
|
||||
RewindData rewindData = data[i];
|
||||
for (uint32_t i = 0; i < 30; i++) {
|
||||
for (uint32_t i = 0; i < 60; i++) {
|
||||
for (shared_ptr<BaseControlDevice>& device : devices) {
|
||||
uint8_t port = device->GetPort();
|
||||
if (i < rewindData.InputLogs[port].size()) {
|
||||
|
@ -212,6 +213,7 @@ bool MovieRecorder::CreateMovie(string movieFile, std::deque<RewindData>& data,
|
|||
//Write the movie file
|
||||
return Stop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Mesen.GUI.Forms
|
|||
base.OnShown(e);
|
||||
|
||||
HistoryViewerApi.HistoryViewerInitialize(this.Handle, ctrlRenderer.Handle);
|
||||
trkPosition.Maximum = (int)(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60 / 2);
|
||||
trkPosition.Maximum = (int)(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60);
|
||||
UpdatePositionLabel(0);
|
||||
EmuApi.Resume(EmuApi.ConsoleId.HistoryViewer);
|
||||
tmrUpdatePosition.Start();
|
||||
|
@ -80,7 +80,7 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
private void trkPosition_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
HistoryViewerApi.HistoryViewerSetPosition((UInt32)trkPosition.Value * 2);
|
||||
HistoryViewerApi.HistoryViewerSetPosition((UInt32)trkPosition.Value);
|
||||
}
|
||||
|
||||
private void SetScale(int scale)
|
||||
|
@ -119,7 +119,7 @@ namespace Mesen.GUI.Forms
|
|||
btnPausePlay.Image = Properties.Resources.MediaPause;
|
||||
}
|
||||
|
||||
UInt32 positionInSeconds = HistoryViewerApi.HistoryViewerGetPosition() / 2;
|
||||
UInt32 positionInSeconds = HistoryViewerApi.HistoryViewerGetPosition();
|
||||
UpdatePositionLabel(positionInSeconds);
|
||||
|
||||
if(positionInSeconds <= trkPosition.Maximum) {
|
||||
|
@ -156,15 +156,15 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
List<UInt32> segments = new List<UInt32>(HistoryViewerApi.HistoryViewerGetSegments());
|
||||
UInt32 segmentStart = 0;
|
||||
segments.Add(HistoryViewerApi.HistoryViewerGetHistoryLength() / 30);
|
||||
segments.Add(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60);
|
||||
|
||||
for(int i = 0; i < segments.Count; i++) {
|
||||
if(segments[i] - segmentStart > 4) {
|
||||
if(segments[i] - segmentStart > 2) {
|
||||
//Only list segments that are at least 2 seconds long
|
||||
UInt32 segStart = segmentStart;
|
||||
UInt32 segEnd = segments[i];
|
||||
TimeSpan start = new TimeSpan(0, 0, (int)(segmentStart) / 2);
|
||||
TimeSpan end = new TimeSpan(0, 0, (int)(segEnd / 2));
|
||||
TimeSpan start = new TimeSpan(0, 0, (int)(segmentStart));
|
||||
TimeSpan end = new TimeSpan(0, 0, (int)(segEnd));
|
||||
|
||||
string segmentName = ResourceHelper.GetMessage("MovieSegment", (mnuExportMovie.DropDownItems.Count + 1).ToString());
|
||||
ToolStripMenuItem segmentItem = new ToolStripMenuItem(segmentName + ", " + start.ToString() + " - " + end.ToString());
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace Mesen.GUI.Forms
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
dtpStart.Value = new DateTime(2000, 1, 1, 0, 0, 0).AddSeconds((int)(Math.Ceiling((decimal)segStart / 2)));
|
||||
dtpEnd.Value = new DateTime(2000, 1, 1, 0, 0, 0).AddSeconds(segEnd / 2);
|
||||
dtpStart.Value = new DateTime(2000, 1, 1, 0, 0, 0).AddSeconds((int)(Math.Ceiling((decimal)segStart)));
|
||||
dtpEnd.Value = new DateTime(2000, 1, 1, 0, 0, 0).AddSeconds(segEnd);
|
||||
|
||||
dtpStart.MinDate = dtpStart.Value;
|
||||
dtpStart.MaxDate = dtpEnd.Value;
|
||||
|
@ -36,8 +36,8 @@ namespace Mesen.GUI.Forms
|
|||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
base.OnFormClosing(e);
|
||||
ExportStart = (UInt32)(dtpStart.Value.TimeOfDay.TotalSeconds * 2);
|
||||
ExportEnd = (UInt32)(dtpEnd.Value.TimeOfDay.TotalSeconds * 2);
|
||||
ExportStart = (UInt32)(dtpStart.Value.TimeOfDay.TotalSeconds);
|
||||
ExportEnd = (UInt32)(dtpEnd.Value.TimeOfDay.TotalSeconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue