Improve UX when movie `Core` header can't be honoured (see #3582)

This commit is contained in:
YoshiRulz 2025-05-27 07:57:52 +10:00
parent a21b9e049f
commit cc59818d6d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 33 additions and 3 deletions

View File

@ -55,6 +55,9 @@ namespace BizHawk.Client.Common
public string QueuedCoreName => _queuedMovie?.Core;
public string/*?*/ QueuedSysID
=> _queuedMovie?.SystemID;
public IDictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
public IController MovieIn { get; set; }

View File

@ -23,6 +23,9 @@ namespace BizHawk.Client.Common
/// <value>The Core header of the queued movie iff one is queued, else <see langword="null"/></value>
string QueuedCoreName { get; }
/// <value>The <see cref="IBasicMovieInfo.SystemID"/> header of the queued movie iff one is queued, else <see langword="null"/></value>
string/*?*/ QueuedSysID { get; }
IDictionary<string, object> UserBag { get; set; }
IMovieController MovieController { get; }

View File

@ -3821,11 +3821,35 @@ namespace BizHawk.Client.EmuHawk
//path = ioa_openrom.Path;
}
var forcedCoreName = MovieSession.QueuedCoreName ?? string.Empty;
if (!CoreInventory.Instance.SystemsFlat.Any(core => core.Name == forcedCoreName))
{
const string FMT_STR_NO_SUCH_CORE = "This movie is for the \"{0}\" core,"
+ " but that's not a valid {1} core. (Was the movie made in this version of EmuHawk?)"
+ "\nContinue with your preferred core instead?";
#if false //TODO let the user pick?
var availCores = CoreInventory.Instance.AllCores.GetValueOrDefault(MovieSession.QueuedSysID, [ ]);
#endif
if (!this.ModalMessageBox2(
caption: "No such core",
icon: EMsgBoxIcon.Error,
text: string.Format(
FMT_STR_NO_SUCH_CORE,
forcedCoreName,
EmulatorExtensions.SystemIDToDisplayName(MovieSession.QueuedSysID))))
{
return false;
}
forcedCoreName = null;
}
DisplayManager.ActivateOpenGLContext(); // required in case the core wants to create a shared OpenGL context
bool result = string.IsNullOrEmpty(MovieSession.QueuedCoreName)
? loader.LoadRom(path, nextComm, ioaRetro?.CorePath)
: loader.LoadRom(path, nextComm, ioaRetro?.CorePath, forcedCoreName: MovieSession.QueuedCoreName);
var result = loader.LoadRom(
path: path,
nextComm,
launchLibretroCore: ioaRetro?.CorePath,
forcedCoreName: forcedCoreName);
// we need to replace the path in the OpenAdvanced with the canonical one the user chose.
// It can't be done until loader.LoadRom happens (for CanonicalFullPath)