Create and use helper for changing core pref. when importing movies

This commit is contained in:
YoshiRulz 2021-03-25 15:10:38 +10:00
parent 3249ae202e
commit 3b8f08b1b0
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 14 additions and 3 deletions

View File

@ -25,6 +25,17 @@ namespace BizHawk.Client.Common
protected IDialogParent _dialogParent; protected IDialogParent _dialogParent;
protected void MaybeSetCorePreference(string sysID, string coreName, string fileExt)
{
if (Config.PreferredCores[sysID] != coreName
&& _dialogParent.ModalMessageBox2(
$"{fileExt} movies will have a better chance of syncing using the {coreName} core. Change your core preference for {sysID} roms to {coreName} now?",
icon: EMsgBoxIcon.Question))
{
Config.PreferredCores[sysID] = coreName;
}
}
public ImportResult Import( public ImportResult Import(
IDialogParent dialogParent, IDialogParent dialogParent,
IMovieSession session, IMovieSession session,

View File

@ -259,7 +259,7 @@ namespace BizHawk.Client.Common.movie.import
Result.Movie.HeaderEntries[HeaderKeys.Platform] = platform; Result.Movie.HeaderEntries[HeaderKeys.Platform] = platform;
Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss);
Config.PreferredCores["SNES"] = CoreNames.Bsnes; // TODO: convert to snes9x if it is the user's preference MaybeSetCorePreference(sysID: "SNES", CoreNames.Bsnes, fileExt: ".lsmv");
} }
private IController EmptyLmsvFrame() private IController EmptyLmsvFrame()

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.Common.movie.import
protected override void RunImport() protected override void RunImport()
{ {
Result.Movie.HeaderEntries[HeaderKeys.Core] = CoreNames.Bsnes; Result.Movie.HeaderEntries[HeaderKeys.Core] = CoreNames.Bsnes; //TODO set to Snes9x instead? or give the user the choice?
using var fs = SourceFile.Open(FileMode.Open, FileAccess.Read); using var fs = SourceFile.Open(FileMode.Open, FileAccess.Read);
using var r = new BinaryReader(fs); using var r = new BinaryReader(fs);
@ -311,7 +311,7 @@ namespace BizHawk.Client.Common.movie.import
Result.Movie.AppendFrame(controllers); Result.Movie.AppendFrame(controllers);
Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss); Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(ss);
Config.PreferredCores["SNES"] = CoreNames.Bsnes; // TODO: convert to snes9x if it is the user's preference MaybeSetCorePreference(sysID: "SNES", CoreNames.Bsnes, fileExt: ".smv");
} }
} }
} }