Macro tool - fix NRE on File -> Load Macro, fxies #2375

This commit is contained in:
adelikat 2020-09-27 11:16:18 -05:00
parent 32a20dcb3d
commit 32b7358f07
3 changed files with 5 additions and 4 deletions

View File

@ -250,7 +250,7 @@ namespace BizHawk.Client.EmuHawk
private void DummyLoadMacro(string path) private void DummyLoadMacro(string path)
{ {
MovieZone loadZone = new MovieZone(path, Emulator, Tools); MovieZone loadZone = new MovieZone(path, Emulator, MovieSession, Tools);
_zones.Add(loadZone); _zones.Add(loadZone);
ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}"); ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
} }
@ -311,7 +311,7 @@ namespace BizHawk.Client.EmuHawk
} }
Config.RecentMacros.Add(dialog.FileName); Config.RecentMacros.Add(dialog.FileName);
return new MovieZone(dialog.FileName, emulator ?? Emulator, tools ?? Tools); return new MovieZone(dialog.FileName, emulator ?? Emulator, MovieSession, tools ?? Tools);
} }
} }
} }

View File

@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk
File.AppendAllLines(fileName, _log); File.AppendAllLines(fileName, _log);
} }
public MovieZone(string fileName, IEmulator emulator, ToolManager tools) public MovieZone(string fileName, IEmulator emulator, IMovieSession movieSession, ToolManager tools)
{ {
if (!File.Exists(fileName)) if (!File.Exists(fileName))
{ {
@ -220,6 +220,7 @@ namespace BizHawk.Client.EmuHawk
_emulator = emulator; _emulator = emulator;
_tools = tools; _tools = tools;
_movieSession = movieSession;
string[] readText = File.ReadAllLines(fileName); string[] readText = File.ReadAllLines(fileName);

View File

@ -707,7 +707,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
var loadZone = new MovieZone(path, Emulator, Tools) var loadZone = new MovieZone(path, Emulator, MovieSession, Tools)
{ {
Start = TasView.FirstSelectedIndex ?? 0 Start = TasView.FirstSelectedIndex ?? 0
}; };