move core preference setting shenangians from MainForm.StartNewMovie() to MovieSession
This commit is contained in:
parent
2a9710b63c
commit
3ec6662dc9
|
@ -16,6 +16,10 @@ namespace BizHawk.Client.Common
|
|||
private readonly Action<string> _messageCallback;
|
||||
private readonly Action<string> _popupCallback;
|
||||
|
||||
// Previous saved core preferences. Stored here so that when a movie
|
||||
// overrides the values, they can be restored to user preferences
|
||||
private readonly IDictionary<string, string> _preferredCores = new Dictionary<string, string>();
|
||||
|
||||
public MovieSession(
|
||||
Action<string> messageCallback,
|
||||
Action<string> popupCallback,
|
||||
|
@ -68,8 +72,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public IDictionary<string, string> PreferredCores { get; } = new Dictionary<string, string>();
|
||||
|
||||
public void RecreateMovieController(ControllerDefinition definition)
|
||||
{
|
||||
MovieController = new Bk2Controller(definition);
|
||||
|
@ -258,7 +260,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (Global.Config.PreferredCores.ContainsKey(preference))
|
||||
{
|
||||
PreferredCores[preference] = Global.Config.PreferredCores[preference];
|
||||
_preferredCores[preference] = Global.Config.PreferredCores[preference];
|
||||
Global.Config.PreferredCores[preference] = movie.Core;
|
||||
}
|
||||
}
|
||||
|
@ -277,6 +279,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void RunQueuedMovie(bool recordMode)
|
||||
{
|
||||
foreach (var previousPref in _preferredCores)
|
||||
{
|
||||
Global.Config.PreferredCores[previousPref.Key] = previousPref.Value;
|
||||
}
|
||||
|
||||
Movie = QueuedMovie;
|
||||
QueuedMovie = null;
|
||||
MultiTrack.Restart(Global.Emulator.ControllerDefinition.PlayerCount);
|
||||
|
|
|
@ -29,11 +29,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
IController PreviousFrame { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Previous saved core preferences. Stored so that they can be stored after a movie overrides the value
|
||||
/// </summary>
|
||||
IDictionary<string, string> PreferredCores { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Recreates MovieController with the given controller definition
|
||||
/// with an empty controller state
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
@ -24,11 +23,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
RebootCore();
|
||||
|
||||
foreach (var previousPref in MovieSession.PreferredCores)
|
||||
{
|
||||
Config.PreferredCores[previousPref.Key] = previousPref.Value;
|
||||
}
|
||||
|
||||
Config.RecentMovies.Add(movie.Filename);
|
||||
|
||||
if (Emulator.HasSavestates() && movie.StartsFromSavestate)
|
||||
|
|
Loading…
Reference in New Issue