Simplify some movie related client code

This commit is contained in:
adelikat 2014-06-29 02:12:23 +00:00
parent 6fce0bcad6
commit dbf89440f6
3 changed files with 53 additions and 66 deletions

View File

@ -14,6 +14,7 @@ using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Emulation.Cores.Sega.MasterSystem; using BizHawk.Emulation.Cores.Sega.MasterSystem;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES; using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
using BizHawk.Client.EmuHawk.config.NES; using BizHawk.Client.EmuHawk.config.NES;
using BizHawk.Emulation.Common.IEmulatorExtensions;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -374,12 +375,56 @@ namespace BizHawk.Client.EmuHawk
private void RecordMovieMenuItem_Click(object sender, EventArgs e) private void RecordMovieMenuItem_Click(object sender, EventArgs e)
{ {
LoadRecordMovieDialog(); if (!Global.Emulator.Attributes().Released)
{
var result = MessageBox.Show
(this, "Thanks for using Bizhawk! The emulation core you have selected " +
"is currently BETA-status. We appreciate your help in testing Bizhawk. " +
"You can record a movie on this core if you'd like to, but expect to " +
"encounter bugs and sync problems. Continue?", "BizHawk", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
{
return;
}
}
else if (Global.Emulator is LibsnesCore)
{
var ss = (LibsnesCore.SnesSyncSettings)Global.Emulator.GetSyncSettings();
if (ss.Profile == "Performance" && !Global.Config.DontAskPerformanceCoreRecordingNag)
{
var box = new MsgBox(
"While the performance core is faster, it is recommended that you use the Compatibility profile when recording movies for better accuracy and stability\n\nSwitch to Compatibility?",
"Stability Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new[] { "Switch", "Continue", "Cancel" },
new[] { DialogResult.Yes, DialogResult.No, DialogResult.Cancel });
box.SetCheckbox("Don't ask me again");
box.MaximumSize = new Size(450, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
Global.Config.DontAskPerformanceCoreRecordingNag = box.CheckboxChecked;
if (result == DialogResult.Yes)
{
ss.Profile = "Compatibility";
Global.Emulator.PutSyncSettings(ss);
}
else if (result == DialogResult.Cancel)
{
return;
}
}
}
new RecordMovie().ShowDialog();
} }
private void PlayMovieMenuItem_Click(object sender, EventArgs e) private void PlayMovieMenuItem_Click(object sender, EventArgs e)
{ {
LoadPlayMovieDialog(); new PlayMovie().ShowDialog();
} }
private void StopMovieMenuItem_Click(object sender, EventArgs e) private void StopMovieMenuItem_Click(object sender, EventArgs e)
@ -1061,7 +1106,7 @@ namespace BizHawk.Client.EmuHawk
using (var dlg = new DualGBXMLCreator()) using (var dlg = new DualGBXMLCreator())
{ {
var result = dlg.ShowDialog(this); var result = dlg.ShowDialog(this);
if (result == System.Windows.Forms.DialogResult.OK) if (result == DialogResult.OK)
{ {
GlobalWin.OSD.AddMessage("XML File saved"); GlobalWin.OSD.AddMessage("XML File saved");
} }

View File

@ -243,11 +243,11 @@ namespace BizHawk.Client.EmuHawk
case "Toggle read-only": case "Toggle read-only":
ToggleReadOnly(); ToggleReadOnly();
break; break;
case "Play Movie": case "Play Movie":
LoadPlayMovieDialog(); PlayMovieMenuItem_Click(null, null);
break; break;
case "Record Movie": case "Record Movie":
LoadRecordMovieDialog(); RecordMovieMenuItem_Click(null, null);
break; break;
case "Stop Movie": case "Stop Movie":
StopMovie(); StopMovie();

View File

@ -1,14 +1,10 @@
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES; using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Cores.Nintendo.SNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -54,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
string s = Global.MovieSession.Movie.SyncSettingsJson; var s = Global.MovieSession.Movie.SyncSettingsJson;
if (!string.IsNullOrWhiteSpace(s)) if (!string.IsNullOrWhiteSpace(s))
{ {
_syncSettingsHack = ConfigService.LoadWithType(s); _syncSettingsHack = ConfigService.LoadWithType(s);
@ -135,60 +131,6 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public void LoadPlayMovieDialog()
{
new PlayMovie().ShowDialog();
}
public void LoadRecordMovieDialog()
{
if (!Global.Emulator.Attributes().Released)
{
var result = MessageBox.Show
(this, "Thanks for using Bizhawk! The emulation core you have selected " +
"is currently BETA-status. We appreciate your help in testing Bizhawk. " +
"You can record a movie on this core if you'd like to, but expect to " +
"encounter bugs and sync problems. Continue?", "BizHawk", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
{
return;
}
}
else if (Global.Emulator is LibsnesCore)
{
var ss = (LibsnesCore.SnesSyncSettings)Global.Emulator.GetSyncSettings();
if (ss.Profile == "Performance" && !Global.Config.DontAskPerformanceCoreRecordingNag)
{
var box = new MsgBox(
"While the performance core is faster, it is recommended that you use the Compatibility profile when recording movies for better accuracy and stability\n\nSwitch to Compatibility?",
"Stability Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new [] {"Switch", "Continue", "Cancel" },
new DialogResult[] { DialogResult.Yes, DialogResult.No, DialogResult.Cancel });
box.SetCheckbox("Don't ask me again");
box.MaximumSize = new Size(450, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
Global.Config.DontAskPerformanceCoreRecordingNag = box.CheckboxChecked;
if (result == DialogResult.Yes)
{
ss.Profile = "Compatibility";
Global.Emulator.PutSyncSettings(ss);
}
else if (result == DialogResult.Cancel)
{
return;
}
}
}
new RecordMovie().ShowDialog();
}
public void RestartMovie() public void RestartMovie()
{ {
if (Global.MovieSession.Movie.IsActive) if (Global.MovieSession.Movie.IsActive)