add a IMovieSession property to ToolFormBase and use it

This commit is contained in:
adelikat 2020-04-16 10:11:55 -05:00
parent fa1c494ad8
commit 3f1ef8dd4d
11 changed files with 66 additions and 62 deletions

View File

@ -221,7 +221,7 @@ namespace BizHawk.Client.EmuHawk
_throttle = new Throttle(); _throttle = new Throttle();
Emulator = new NullEmulator(); Emulator = new NullEmulator();
GlobalWin.Tools = new ToolManager(this, Config, Emulator); GlobalWin.Tools = new ToolManager(this, Config, Emulator, MovieSession);
CheatList.Changed += Tools.UpdateCheatRelatedTools; CheatList.Changed += Tools.UpdateCheatRelatedTools;
UpdateStatusSlots(); UpdateStatusSlots();

View File

@ -779,7 +779,7 @@ namespace BizHawk.Client.EmuHawk
if (index < _bestBotAttempt.Log.Count) if (index < _bestBotAttempt.Log.Count)
{ {
var logEntry = _bestBotAttempt.Log[index]; var logEntry = _bestBotAttempt.Log[index];
var controller = Global.MovieSession.GenerateMovieController(); var controller = MovieSession.GenerateMovieController();
controller.SetFromMnemonic(logEntry); controller.SetFromMnemonic(logEntry);
foreach (var button in controller.Definition.BoolButtons) foreach (var button in controller.Definition.BoolButtons)
@ -946,10 +946,10 @@ namespace BizHawk.Client.EmuHawk
GoalGroupBox.Enabled = false; GoalGroupBox.Enabled = false;
_currentBotAttempt = new BotAttempt { Attempt = Attempts }; _currentBotAttempt = new BotAttempt { Attempt = Attempts };
if (Global.MovieSession.Movie.IsRecording()) if (MovieSession.Movie.IsRecording())
{ {
_oldCountingSetting = Global.MovieSession.Movie.IsCountingRerecords; _oldCountingSetting = MovieSession.Movie.IsCountingRerecords;
Global.MovieSession.Movie.IsCountingRerecords = false; MovieSession.Movie.IsCountingRerecords = false;
} }
_doNotUpdateValues = true; _doNotUpdateValues = true;
@ -976,7 +976,7 @@ namespace BizHawk.Client.EmuHawk
UpdateBotStatusIcon(); UpdateBotStatusIcon();
MessageLabel.Text = "Running..."; MessageLabel.Text = "Running...";
_cachedControlProbabilities = ControlProbabilities; _cachedControlProbabilities = ControlProbabilities;
_logGenerator = Global.MovieSession.Movie.LogGeneratorInstance(Global.InputManager.ClickyVirtualPadController); _logGenerator = MovieSession.Movie.LogGeneratorInstance(Global.InputManager.ClickyVirtualPadController);
} }
private string CanStart() private string CanStart()
@ -1011,9 +1011,9 @@ namespace BizHawk.Client.EmuHawk
_currentBotAttempt = null; _currentBotAttempt = null;
GoalGroupBox.Enabled = true; GoalGroupBox.Enabled = true;
if (Global.MovieSession.Movie.IsRecording()) if (MovieSession.Movie.IsRecording())
{ {
Global.MovieSession.Movie.IsCountingRerecords = _oldCountingSetting; MovieSession.Movie.IsCountingRerecords = _oldCountingSetting;
} }
Config.DisplayMessages = _previousDisplayMessage; Config.DisplayMessages = _previousDisplayMessage;

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -48,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
s.Refresh(); s.Refresh();
// Update the selected zone's key // Update the selected zone's key
var lg = Global.MovieSession.Movie.LogGeneratorInstance(Global.MovieSession.MovieController); var lg = MovieSession.Movie.LogGeneratorInstance(MovieSession.MovieController);
string key = lg.GenerateLogKey(); string key = lg.GenerateLogKey();
key = key.Replace("LogKey:", "").Replace("#", ""); key = key.Replace("LogKey:", "").Replace("#", "");

View File

@ -6,7 +6,6 @@ using System.IO;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions; using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common.PathExtensions;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -22,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
private readonly List<int> _unsavedZones = new List<int>(); private readonly List<int> _unsavedZones = new List<int>();
private bool _selecting; private bool _selecting;
private IMovie CurrentMovie => Global.MovieSession.Movie; private IMovie CurrentMovie => MovieSession.Movie;
// Still need to make sure the user can't load and use macros that // Still need to make sure the user can't load and use macros that
// have options only available for TasMovie // have options only available for TasMovie
@ -50,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
OverlayBox.Enabled = CurrentMovie is TasMovie; OverlayBox.Enabled = CurrentMovie is TasMovie;
PlaceNum.Enabled = CurrentMovie is TasMovie; PlaceNum.Enabled = CurrentMovie is TasMovie;
var main = new MovieZone(CurrentMovie, Emulator, Tools, 0, CurrentMovie.InputLogLength) var main = new MovieZone(CurrentMovie, Emulator, Tools, MovieSession, 0, CurrentMovie.InputLogLength)
{ {
Name = "Entire Movie" Name = "Entire Movie"
}; };
@ -144,7 +143,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
var newZone = new MovieZone(CurrentMovie, Emulator, Tools, (int) StartNum.Value, (int) (EndNum.Value - StartNum.Value + 1)) var newZone = new MovieZone(CurrentMovie, Emulator, Tools, MovieSession, (int) StartNum.Value, (int) (EndNum.Value - StartNum.Value + 1))
{ {
Name = $"Zone {_zones.Count}" Name = $"Zone {_zones.Count}"
}; };

View File

@ -11,17 +11,19 @@ namespace BizHawk.Client.EmuHawk
{ {
private readonly IEmulator _emulator; private readonly IEmulator _emulator;
private readonly ToolManager _tools; private readonly ToolManager _tools;
private readonly IMovieSession _movieSession;
private readonly string[] _log; private readonly string[] _log;
private readonly IMovieController _targetController; private readonly IMovieController _targetController;
private string _inputKey; private string _inputKey;
private IMovieController _controller; private IMovieController _controller;
public MovieZone(IMovie movie, IEmulator emulator, ToolManager tools, int start, int length, string key = "") public MovieZone(IMovie movie, IEmulator emulator, ToolManager tools, IMovieSession movieSession, int start, int length, string key = "")
{ {
_emulator = emulator; _emulator = emulator;
_tools = tools; _tools = tools;
var lg = movie.LogGeneratorInstance(Global.MovieSession.MovieController); _movieSession = movieSession;
_targetController = Global.MovieSession.GenerateMovieController(); var lg = movie.LogGeneratorInstance(movieSession.MovieController);
_targetController = movieSession.GenerateMovieController();
_targetController.SetFrom(_targetController); // Reference and create all buttons _targetController.SetFrom(_targetController); // Reference and create all buttons
if (key == "") if (key == "")
@ -53,8 +55,8 @@ namespace BizHawk.Client.EmuHawk
} }
} }
_controller = Global.MovieSession.GenerateMovieController(d); _controller = movieSession.GenerateMovieController(d);
var logGenerator = Global.MovieSession.Movie.LogGeneratorInstance(_controller); var logGenerator = movieSession.Movie.LogGeneratorInstance(_controller);
logGenerator.GenerateLogEntry(); // Reference and create all buttons. logGenerator.GenerateLogEntry(); // Reference and create all buttons.
string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", ""); string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", "");
@ -106,12 +108,12 @@ namespace BizHawk.Client.EmuHawk
} }
} }
var newController = Global.MovieSession.GenerateMovieController(d); var newController = _movieSession.GenerateMovieController(d);
var logGenerator = Global.MovieSession.Movie.LogGeneratorInstance(newController); var logGenerator = _movieSession.Movie.LogGeneratorInstance(newController);
logGenerator.GenerateLogEntry(); // Reference and create all buttons. logGenerator.GenerateLogEntry(); // Reference and create all buttons.
// Reset all buttons in targetController (it may still have buttons that aren't being set here set true) // Reset all buttons in targetController (it may still have buttons that aren't being set here set true)
var tC = Global.MovieSession.Movie.LogGeneratorInstance(_targetController); var tC = _movieSession.Movie.LogGeneratorInstance(_targetController);
_targetController.SetFromMnemonic(tC.EmptyEntry); _targetController.SetFromMnemonic(tC.EmptyEntry);
for (int i = 0; i < Length; i++) for (int i = 0; i < Length; i++)
{ {
@ -224,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
// If the LogKey contains buttons/controls not accepted by the emulator, // If the LogKey contains buttons/controls not accepted by the emulator,
// tell the user and display the macro's controller name and player count // tell the user and display the macro's controller name and player count
_inputKey = readText[0]; _inputKey = readText[0];
var lg = Global.MovieSession.Movie.LogGeneratorInstance(Global.MovieSession.MovieController); var lg = _movieSession.Movie.LogGeneratorInstance(_movieSession.MovieController);
string key = lg.GenerateLogKey(); string key = lg.GenerateLogKey();
key = key.Replace("LogKey:", "").Replace("#", ""); key = key.Replace("LogKey:", "").Replace("#", "");
key = key.Substring(0, key.Length - 1); key = key.Substring(0, key.Length - 1);
@ -252,7 +254,7 @@ namespace BizHawk.Client.EmuHawk
Name = Path.GetFileNameWithoutExtension(fileName); Name = Path.GetFileNameWithoutExtension(fileName);
// Adapters // Adapters
_targetController = Global.MovieSession.GenerateMovieController(); _targetController = _movieSession.GenerateMovieController();
_targetController.SetFrom(_targetController); // Reference and create all buttons _targetController.SetFrom(_targetController); // Reference and create all buttons
string[] keys = _inputKey.Split('|'); string[] keys = _inputKey.Split('|');
var d = new ControllerDefinition(_emulator.ControllerDefinition); var d = new ControllerDefinition(_emulator.ControllerDefinition);
@ -268,7 +270,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
_controller = Global.MovieSession.GenerateMovieController(d); _controller = _movieSession.GenerateMovieController(d);
} }
#region Custom Latch #region Custom Latch

View File

@ -17,19 +17,20 @@ namespace BizHawk.Client.EmuHawk
private string SelectedButton => ButtonBox.Text; private string SelectedButton => ButtonBox.Text;
private bool IsBool => SelectedButton == "Default bool Auto-Fire" || Global.MovieSession.MovieController.Definition.BoolButtons.Contains(SelectedButton); private bool IsBool => SelectedButton == "Default bool Auto-Fire" || _tastudio.MovieSession.MovieController.Definition.BoolButtons.Contains(SelectedButton);
public PatternsForm(TAStudio owner) public PatternsForm(TAStudio owner)
{ {
InitializeComponent(); InitializeComponent();
_tastudio = owner; _tastudio = owner;
foreach (var button in Global.MovieSession.MovieController.Definition.BoolButtons)
foreach (var button in _tastudio.MovieSession.MovieController.Definition.BoolButtons)
{ {
ButtonBox.Items.Add(button); ButtonBox.Items.Add(button);
} }
foreach (var button in Global.MovieSession.MovieController.Definition.AxisControls) foreach (var button in _tastudio.MovieSession.MovieController.Definition.AxisControls)
{ {
ButtonBox.Items.Add(button); ButtonBox.Items.Add(button);
} }
@ -182,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
if (PatternList.SelectedIndex != -1 && PatternList.SelectedIndex < _values.Count) if (PatternList.SelectedIndex != -1 && PatternList.SelectedIndex < _values.Count)
{ {
index = Global.MovieSession.MovieController.Definition.BoolButtons.IndexOf(SelectedButton); index = _tastudio.MovieSession.MovieController.Definition.BoolButtons.IndexOf(SelectedButton);
if (SelectedButton == "Default bool Auto-Fire") if (SelectedButton == "Default bool Auto-Fire")
{ {
index = _tastudio.BoolPatterns.Length - 1; index = _tastudio.BoolPatterns.Length - 1;
@ -202,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
index = Global.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton); index = _tastudio.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton);
} }
LagBox.Checked = _tastudio.FloatPatterns[index].SkipsLag; LagBox.Checked = _tastudio.FloatPatterns[index].SkipsLag;
@ -221,7 +222,7 @@ namespace BizHawk.Client.EmuHawk
private void UpdatePattern() private void UpdatePattern()
{ {
int index = Global.MovieSession.MovieController.Definition.BoolButtons.IndexOf(SelectedButton); int index = _tastudio.MovieSession.MovieController.Definition.BoolButtons.IndexOf(SelectedButton);
if (SelectedButton == "Default bool Auto-Fire") if (SelectedButton == "Default bool Auto-Fire")
{ {
index = _tastudio.BoolPatterns.Length - 1; index = _tastudio.BoolPatterns.Length - 1;
@ -229,7 +230,7 @@ namespace BizHawk.Client.EmuHawk
if (index != -1) if (index != -1)
{ {
List<bool> p = new List<bool>(); var p = new List<bool>();
for (int i = 0; i < _counts.Count; i++) for (int i = 0; i < _counts.Count; i++)
{ {
for (int c = 0; c < _counts[i]; c++) for (int c = 0; c < _counts[i]; c++)
@ -248,7 +249,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
index = Global.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton); index = _tastudio.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton);
} }
List<float> p = new List<float>(); List<float> p = new List<float>();
@ -310,7 +311,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
index = Global.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton); index = _tastudio.MovieSession.MovieController.Definition.AxisControls.IndexOf(SelectedButton);
} }
float[] p = _tastudio.FloatPatterns[index].Pattern; float[] p = _tastudio.FloatPatterns[index].Pattern;

View File

@ -60,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
private int? _seekStartFrame; private int? _seekStartFrame;
private bool _unpauseAfterSeeking; private bool _unpauseAfterSeeking;
private ControllerDefinition ControllerType => Global.MovieSession.MovieController.Definition; private ControllerDefinition ControllerType => MovieSession.MovieController.Definition;
public bool WasRecording { get; set; } public bool WasRecording { get; set; }
public AutoPatternBool[] BoolPatterns; public AutoPatternBool[] BoolPatterns;

View File

@ -216,6 +216,7 @@ namespace BizHawk.Client.EmuHawk
CurrentTasMovie, CurrentTasMovie,
Emulator, Emulator,
Tools, Tools,
MovieSession,
TasView.FirstSelectedIndex ?? 0, TasView.FirstSelectedIndex ?? 0,
TasView.LastSelectedIndex ?? 0 - TasView.FirstSelectedIndex ?? 0 + 1); TasView.LastSelectedIndex ?? 0 - TasView.FirstSelectedIndex ?? 0 + 1);

View File

@ -5,12 +5,10 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using System.ComponentModel; using System.ComponentModel;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Client.Common.MovieConversionExtensions; using BizHawk.Client.Common.MovieConversionExtensions;
using BizHawk.Client.EmuHawk.ToolExtensions; using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Emulation.Cores.Nintendo.N64;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -18,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
public partial class TAStudio : ToolFormBase, IToolFormAutoConfig, IControlMainform public partial class TAStudio : ToolFormBase, IToolFormAutoConfig, IControlMainform
{ {
// TODO: UI flow that conveniently allows to start from savestate // TODO: UI flow that conveniently allows to start from savestate
public TasMovie CurrentTasMovie => Global.MovieSession.Movie as TasMovie; public TasMovie CurrentTasMovie => MovieSession.Movie as TasMovie;
public bool IsInMenuLoop { get; private set; } public bool IsInMenuLoop { get; private set; }
public string StatesPath => Config.PathEntries.TastudioStatesAbsolutePath(); public string StatesPath => Config.PathEntries.TastudioStatesAbsolutePath();
@ -325,7 +323,7 @@ namespace BizHawk.Client.EmuHawk
} }
// Start Scenario 1: A regular movie is active // Start Scenario 1: A regular movie is active
if (Global.MovieSession.Movie.IsActive() && !(Global.MovieSession.Movie is TasMovie)) if (MovieSession.Movie.IsActive() && !(MovieSession.Movie is TasMovie))
{ {
var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK) if (result == DialogResult.OK)
@ -341,7 +339,7 @@ namespace BizHawk.Client.EmuHawk
} }
// Start Scenario 2: A tasproj is already active // Start Scenario 2: A tasproj is already active
else if (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie is TasMovie) else if (MovieSession.Movie.IsActive() && MovieSession.Movie is TasMovie)
{ {
bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame); bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame);
if (!result) if (!result)
@ -380,11 +378,7 @@ namespace BizHawk.Client.EmuHawk
private void SetTasMovieCallbacks(TasMovie movie = null) private void SetTasMovieCallbacks(TasMovie movie = null)
{ {
if (movie == null) movie ??= CurrentTasMovie;
{
movie = CurrentTasMovie;
}
movie.ClientSettingsForSave = ClientSettingsForSave; movie.ClientSettingsForSave = ClientSettingsForSave;
movie.GetClientSettingsOnLoad = GetClientSettingsOnLoad; movie.GetClientSettingsOnLoad = GetClientSettingsOnLoad;
} }
@ -413,8 +407,8 @@ namespace BizHawk.Client.EmuHawk
Rotatable = true Rotatable = true
}); });
var columnNames = Global.MovieSession.Movie var columnNames = MovieSession.Movie
.LogGeneratorInstance(Global.MovieSession.MovieController) .LogGeneratorInstance(MovieSession.MovieController)
.Map(); .Map();
foreach (var kvp in columnNames) foreach (var kvp in columnNames)
@ -580,7 +574,7 @@ namespace BizHawk.Client.EmuHawk
{ {
get get
{ {
var lg = CurrentTasMovie.LogGeneratorInstance(Global.MovieSession.MovieController); var lg = CurrentTasMovie.LogGeneratorInstance(MovieSession.MovieController);
var empty = lg.EmptyEntry; var empty = lg.EmptyEntry;
foreach (var row in TasView.SelectedRows) foreach (var row in TasView.SelectedRows)
{ {
@ -612,7 +606,7 @@ namespace BizHawk.Client.EmuHawk
MainForm.ClearRewindData(); MainForm.ClearRewindData();
Config.MovieEndAction = MovieEndAction.Record; Config.MovieEndAction = MovieEndAction.Record;
MainForm.SetMainformMovieInfo(); MainForm.SetMainformMovieInfo();
Global.MovieSession.ReadOnly = true; MovieSession.ReadOnly = true;
SetSplicer(); SetSplicer();
SetupBoolPatterns(); SetupBoolPatterns();
} }
@ -623,11 +617,11 @@ namespace BizHawk.Client.EmuHawk
private void ConvertCurrentMovieToTasproj() private void ConvertCurrentMovieToTasproj()
{ {
Global.MovieSession.Movie.Save(); MovieSession.Movie.Save();
Global.MovieSession.Movie = Global.MovieSession.Movie.ToTasMovie(); MovieSession.Movie = MovieSession.Movie.ToTasMovie();
Global.MovieSession.Movie.Save(); MovieSession.Movie.Save();
Global.MovieSession.Movie.SwitchToPlay(); MovieSession.Movie.SwitchToPlay();
Settings.RecentTas.Add(Global.MovieSession.Movie.Filename); Settings.RecentTas.Add(MovieSession.Movie.Filename);
} }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0) private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0)
@ -693,10 +687,10 @@ namespace BizHawk.Client.EmuHawk
{ {
if (AskSaveChanges()) if (AskSaveChanges())
{ {
Global.MovieSession.Movie = new TasMovie(); MovieSession.Movie = new TasMovie();
CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput; CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput;
var stateManager = ((TasMovie)Global.MovieSession.Movie).TasStateManager; var stateManager = ((TasMovie)MovieSession.Movie).TasStateManager;
stateManager.InvalidateCallback = GreenzoneInvalidated; stateManager.InvalidateCallback = GreenzoneInvalidated;
BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.LoadedCallback = BranchLoaded;
@ -831,7 +825,7 @@ namespace BizHawk.Client.EmuHawk
private void TastudioStopMovie() private void TastudioStopMovie()
{ {
Global.MovieSession.StopMovie(false); MovieSession.StopMovie(false);
MainForm.SetMainformMovieInfo(); MainForm.SetMainformMovieInfo();
} }
@ -839,7 +833,7 @@ namespace BizHawk.Client.EmuHawk
{ {
MainForm.PauseOnFrame = null; MainForm.PauseOnFrame = null;
MainForm.AddOnScreenMessage("TAStudio disengaged"); MainForm.AddOnScreenMessage("TAStudio disengaged");
Global.MovieSession.Movie = MovieService.DefaultInstance; MovieSession.Movie = MovieService.DefaultInstance;
MainForm.TakeBackControl(); MainForm.TakeBackControl();
Config.MovieEndAction = _originalEndAction; Config.MovieEndAction = _originalEndAction;
MainForm.SetMainformMovieInfo(); MainForm.SetMainformMovieInfo();

View File

@ -14,6 +14,8 @@ namespace BizHawk.Client.EmuHawk
public Config Config { get; set; } public Config Config { get; set; }
public MainForm MainForm { get; set; } public MainForm MainForm { get; set; }
public IMovieSession MovieSession { get; set; }
public static FileInfo OpenFileDialog(string currentFile, string path, string fileType, string fileExt) public static FileInfo OpenFileDialog(string currentFile, string path, string fileType, string fileExt)
{ {
if (!Directory.Exists(path)) if (!Directory.Exists(path))

View File

@ -11,7 +11,6 @@ using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.CoreExtensions; using BizHawk.Client.EmuHawk.CoreExtensions;
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Common.PathExtensions;
using BizHawk.Common.ReflectionExtensions; using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -23,6 +22,7 @@ namespace BizHawk.Client.EmuHawk
private readonly Config _config; private readonly Config _config;
private IExternalApiProvider _apiProvider; private IExternalApiProvider _apiProvider;
private IEmulator _emulator; private IEmulator _emulator;
private IMovieSession _movieSession;
// TODO: merge ToolHelper code where logical // TODO: merge ToolHelper code where logical
// For instance, add an IToolForm property called UsesCheats, so that a UpdateCheatRelatedTools() method can update all tools of this type // For instance, add an IToolForm property called UsesCheats, so that a UpdateCheatRelatedTools() method can update all tools of this type
@ -32,11 +32,16 @@ namespace BizHawk.Client.EmuHawk
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ToolManager"/> class. /// Initializes a new instance of the <see cref="ToolManager"/> class.
/// </summary> /// </summary>
public ToolManager(MainForm owner, Config config, IEmulator emulator) public ToolManager(
MainForm owner,
Config config,
IEmulator emulator,
IMovieSession movieSession)
{ {
_owner = owner; _owner = owner;
_config = config; _config = config;
_emulator = emulator; _emulator = emulator;
_movieSession = movieSession;
_apiProvider = ApiManager.Restart(_emulator.ServiceProvider); _apiProvider = ApiManager.Restart(_emulator.ServiceProvider);
} }
@ -68,6 +73,7 @@ namespace BizHawk.Client.EmuHawk
tool.Tools = this; tool.Tools = this;
tool.Config = _config; tool.Config = _config;
tool.MainForm = _owner; tool.MainForm = _owner;
tool.MovieSession = _movieSession;
} }
} }