private void tmrUpdatePosition_Tick(object sender, EventArgs e) { ScreenSize size = EmuApi.GetScreenSize(false, EmuApi.ConsoleId.HistoryViewer); if (size.Width != ctrlRenderer.ClientSize.Width || size.Height != ctrlRenderer.ClientSize.Height) { ctrlRenderer.ClientSize = new Size(size.Width, size.Height); } _paused = EmuApi.IsPaused(EmuApi.ConsoleId.HistoryViewer); if (_paused) { btnPausePlay.Image = Properties.Resources.MediaPlay; } else { btnPausePlay.Image = Properties.Resources.MediaPause; } UInt32 positionInSeconds = HistoryViewerApi.HistoryViewerGetPosition(); UpdatePositionLabel(positionInSeconds); if (positionInSeconds <= trkPosition.Maximum) { trkPosition.ValueChanged -= trkPosition_ValueChanged; trkPosition.Value = (int)positionInSeconds; trkPosition.ValueChanged += trkPosition_ValueChanged; } }
private void TogglePause() { if (trkPosition.Value == trkPosition.Maximum) { HistoryViewerApi.HistoryViewerSetPosition(0); } if (_paused) { EmuApi.Resume(EmuApi.ConsoleId.HistoryViewer); } else { EmuApi.Pause(EmuApi.ConsoleId.HistoryViewer); } }
private void mnuCreateSaveState_Click(object sender, EventArgs e) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.SetFilter(ResourceHelper.GetMessage("FilterSavestate")); sfd.InitialDirectory = ConfigManager.SaveStateFolder; sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mst"; if (sfd.ShowDialog() == DialogResult.OK) { if (!HistoryViewerApi.HistoryViewerCreateSaveState(sfd.FileName, HistoryViewerApi.HistoryViewerGetPosition())) { MesenMsgBox.Show("FileSaveError", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void ExportMovie(UInt32 segStart, UInt32 segEnd) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.SetFilter(ResourceHelper.GetMessage("FilterMovie")); sfd.InitialDirectory = ConfigManager.MovieFolder; sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mmo"; if (sfd.ShowDialog() == DialogResult.OK) { if (!HistoryViewerApi.HistoryViewerSaveMovie(sfd.FileName, segStart, segEnd)) { MesenMsgBox.Show("MovieSaveError", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void mnuFile_DropDownOpening(object sender, EventArgs e) { mnuExportMovie.DropDownItems.Clear(); List <UInt32> segments = new List <UInt32>(HistoryViewerApi.HistoryViewerGetSegments()); UInt32 segmentStart = 0; segments.Add(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60); for (int i = 0; i < segments.Count; i++) { 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)); 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()); ToolStripMenuItem exportFull = new ToolStripMenuItem(ResourceHelper.GetMessage("MovieExportEntireSegment")); exportFull.Click += (s, evt) => { ExportMovie(segStart, segEnd); }; ToolStripMenuItem exportCustomRange = new ToolStripMenuItem(ResourceHelper.GetMessage("MovieExportSpecificRange")); exportCustomRange.Click += (s, evt) => { using (frmSelectExportRange frm = new frmSelectExportRange(segStart, segEnd)) { if (frm.ShowDialog(this) == DialogResult.OK) { ExportMovie(frm.ExportStart, frm.ExportEnd); } } }; segmentItem.DropDown.Items.Add(exportFull); segmentItem.DropDown.Items.Add(exportCustomRange); mnuExportMovie.DropDownItems.Add(segmentItem); } segmentStart = segments[i] + 1; } mnuImportMovie.Visible = false; mnuExportMovie.Enabled = mnuExportMovie.HasDropDownItems; }
protected override void OnShown(EventArgs e) { base.OnShown(e); HistoryViewerApi.HistoryViewerInitialize(this.Handle, ctrlRenderer.Handle); trkPosition.Maximum = (int)(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60); UpdatePositionLabel(0); EmuApi.Resume(EmuApi.ConsoleId.HistoryViewer); tmrUpdatePosition.Start(); trkVolume.Value = ConfigManager.Config.HistoryViewer.Volume; btnPausePlay.Focus(); UpdateScale(); this.Resize += (s, evt) => { UpdateScale(); }; }
private void trkPosition_ValueChanged(object sender, EventArgs e) { HistoryViewerApi.HistoryViewerSetPosition((UInt32)trkPosition.Value); }
protected override void OnClosing(CancelEventArgs e) { tmrUpdatePosition.Stop(); HistoryViewerApi.HistoryViewerRelease(); base.OnClosing(e); }
private void mnuResumeGameplay_Click(object sender, EventArgs e) { HistoryViewerApi.HistoryViewerResumeGameplay(HistoryViewerApi.HistoryViewerGetPosition()); }