diff --git a/BizHawk.Client.Common/movie/import/IMovieImport.cs b/BizHawk.Client.Common/movie/import/IMovieImport.cs index d32cd5d98c..b033fe417b 100644 --- a/BizHawk.Client.Common/movie/import/IMovieImport.cs +++ b/BizHawk.Client.Common/movie/import/IMovieImport.cs @@ -7,7 +7,7 @@ namespace BizHawk.Client.Common { public interface IMovieImport { - ImportResult Import(string path); + ImportResult Import(string path, Config config); } internal abstract class MovieImporter : IMovieImport @@ -16,9 +16,10 @@ namespace BizHawk.Client.Common protected const string Md5 = "MD5"; protected const string MovieOrigin = "MovieOrigin"; - public ImportResult Import(string path) + public ImportResult Import(string path, Config config) { SourceFile = new FileInfo(path); + Config = config; if (!SourceFile.Exists) { @@ -39,6 +40,8 @@ namespace BizHawk.Client.Common return Result; } + protected Config Config { get; private set; } + protected ImportResult Result { get; } = new ImportResult(); protected FileInfo SourceFile { get; private set; } diff --git a/BizHawk.Client.Common/movie/import/LsmvImport.cs b/BizHawk.Client.Common/movie/import/LsmvImport.cs index 81c2c02227..52a3c31eb7 100644 --- a/BizHawk.Client.Common/movie/import/LsmvImport.cs +++ b/BizHawk.Client.Common/movie/import/LsmvImport.cs @@ -115,7 +115,7 @@ namespace BizHawk.Client.Common.movie.import case "sgb_ntsc": case "sgb_pal": platform = "SNES"; - Global.Config.GbAsSgb = true; + Config.GbAsSgb = true; break; } @@ -283,7 +283,7 @@ namespace BizHawk.Client.Common.movie.import Result.Movie.HeaderEntries[HeaderKeys.Platform] = platform; Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); - Global.Config.SnesInSnes9x = false; // This could be annoying to a user if they don't notice we set this preference, but the alternative is for the movie import to fail to load the movie + Config.SnesInSnes9x = false; // TODO: convert to snes9x if user has set this to true } private IController EmptyLmsvFrame() diff --git a/BizHawk.Client.Common/movie/import/MovieImport.cs b/BizHawk.Client.Common/movie/import/MovieImport.cs index 9e5a1674f5..c9696938fb 100644 --- a/BizHawk.Client.Common/movie/import/MovieImport.cs +++ b/BizHawk.Client.Common/movie/import/MovieImport.cs @@ -30,7 +30,7 @@ namespace BizHawk.Client.Common ); // Attempt to import another type of movie file into a movie object. - public static ImportResult ImportFile(string path) + public static ImportResult ImportFile(string path, Config config) { string ext = Path.GetExtension(path) ?? ""; var importerType = ImporterForExtension(ext); @@ -47,7 +47,7 @@ namespace BizHawk.Client.Common return importer == null ? ImportResult.Error($"No importer found for file type {ext}") - : importer.Import(path); + : importer.Import(path, config); } private static Type ImporterForExtension(string ext) diff --git a/BizHawk.Client.Common/movie/import/SmvImport.cs b/BizHawk.Client.Common/movie/import/SmvImport.cs index 6c0437534a..935d001e9c 100644 --- a/BizHawk.Client.Common/movie/import/SmvImport.cs +++ b/BizHawk.Client.Common/movie/import/SmvImport.cs @@ -313,7 +313,7 @@ namespace BizHawk.Client.Common.movie.import Result.Movie.AppendFrame(controllers); Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); - Global.Config.SnesInSnes9x = false; + Config.SnesInSnes9x = false; // TODO: convert to snes9x if user has set this to true } } } diff --git a/BizHawk.Client.Common/movie/import/VbmImport.cs b/BizHawk.Client.Common/movie/import/VbmImport.cs index d1eeaa2e63..405dd208da 100644 --- a/BizHawk.Client.Common/movie/import/VbmImport.cs +++ b/BizHawk.Client.Common/movie/import/VbmImport.cs @@ -274,13 +274,13 @@ namespace BizHawk.Client.Common.movie.import if (isGBA) { - Global.Config.GbaUsemGba = true; + Config.GbaUsemGba = true; var ss = new MGBAHawk.SyncSettings { SkipBios = true }; Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); } else { - if (Global.Config.GbUseGbHawk || Global.Config.UseSubGBHawk) + if (Config.GbUseGbHawk || Config.UseSubGBHawk) { var tempSync = new GBHawk.GBSyncSettings(); if (is_GBC) { tempSync.ConsoleMode = GBHawk.GBSyncSettings.ConsoleModeType.GBC; } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 21ac08b7b0..861219e4a8 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -3976,7 +3976,7 @@ namespace BizHawk.Client.EmuHawk private void ProcessMovieImport(string fn, bool start) { - var result = MovieImport.ImportFile(fn); + var result = MovieImport.ImportFile(fn, Config); if (result.Errors.Any()) {