Pass global MovieSession from MainForm ctor to Program with an out param
This commit is contained in:
parent
3a7ca89311
commit
6d22cdc15f
|
@ -13,7 +13,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static Sound Sound;
|
||||
|
||||
public static Config Config { get; set; }
|
||||
|
||||
public static IMovieSession MovieSession => _mainForm.MovieSession;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
CloseRomContextMenuItem.Image = Properties.Resources.Close;
|
||||
}
|
||||
|
||||
public MainForm(Config config, IGL gl, string[] args)
|
||||
public MainForm(Config config, IGL gl, string[] args, out IMovieSession movieSession)
|
||||
{
|
||||
//do this threaded stuff early so it has plenty of time to run in background
|
||||
Database.InitializeDatabase(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb.txt"));
|
||||
|
@ -286,7 +286,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
InputManager = new InputManager { ControllerInputCoalescer = new ControllerInputCoalescer() };
|
||||
FirmwareManager = new FirmwareManager();
|
||||
MovieSession = new MovieSession(
|
||||
movieSession = MovieSession = new MovieSession(
|
||||
Config.Movies,
|
||||
Config.PathEntries.MovieBackupsAbsolutePath(),
|
||||
AddOnScreenMessage,
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
var mf = new MainForm(GlobalWin.Config, workingGL, args);
|
||||
var mf = new MainForm(GlobalWin.Config, workingGL, args, out var movieSession);
|
||||
// var title = mf.Text;
|
||||
mf.Show();
|
||||
// mf.Text = title;
|
||||
|
@ -230,7 +230,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (!mf.IsDisposed)
|
||||
mf.Dispose();
|
||||
}
|
||||
catch (Exception e) when (GlobalWin.MovieSession.Movie.IsActive() && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
|
||||
catch (Exception e) when (movieSession.Movie.IsActive() && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
|
||||
|
@ -240,7 +240,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
GlobalWin.MovieSession.Movie.Save();
|
||||
movieSession.Movie.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected override void OnCreateMainForm()
|
||||
{
|
||||
MainForm = new MainForm(_config, _gl, cmdArgs);
|
||||
MainForm = new MainForm(_config, _gl, cmdArgs, out _);
|
||||
var title = MainForm.Text;
|
||||
MainForm.Show();
|
||||
MainForm.Text = title;
|
||||
|
|
Loading…
Reference in New Issue