Skip to content

Commit

Permalink
Don't open choose file from archive dialog when trying to fallback to…
Browse files Browse the repository at this point in the history
… a different core for a MAME ROM

The fallback is intended in cases where there is a misdetection for MAME ROMs, since it just goes off the archive's filename against a db. MAME ROMs will not have any sensical ROM extensions in them, and will most likely just have multiple files in it. As such, if this is actually a MAME ROM, they're pretty much guaranteed to show the choose file in archive dialog, which would confuse users. If it's not a MAME ROM, it most likely will not show this dialog and will just be loaded by the appropriate core (of course in practice this likely doesn't occur anyways, since most users likely just have their ROMs named with dat names like No-Intro etc which never match MAME's names).
  • Loading branch information
CasualPokePlayer committed Dec 12, 2024
1 parent b8ec340 commit c5c8b6b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/BizHawk.Client.Common/RomLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private void DoLoadErrorCallback(string message, string systemId, string path, b

public IOpenAdvanced OpenAdvanced { get; set; }

private bool HandleArchiveBinding(HawkFile file)
private bool HandleArchiveBinding(HawkFile file, bool showDialog = true)
{
// try binding normal rom extensions first
if (!file.IsBound)
Expand All @@ -213,7 +213,7 @@ private bool HandleArchiveBinding(HawkFile file)
// if we have an archive and need to bind something, then pop the dialog
if (file.IsArchive && !file.IsBound)
{
int? result = HandleArchive(file);
var result = showDialog ? HandleArchive(file) : null;
if (result.HasValue)
{
file.BindArchiveMember(result.Value);
Expand Down Expand Up @@ -627,7 +627,10 @@ private void LoadMAME(
try
{
using var f = new HawkFile(path, allowArchives: true);
if (!HandleArchiveBinding(f)) throw;
// we want to avoid opening up the choose file from archive dialog
// as it is very likely in this case this is actually a MAME ROM
// which case, we do want the error to be shown immediately, other cores won't load this
if (!HandleArchiveBinding(f, showDialog: false)) throw;
LoadOther(nextComm, f, ext: ext, forcedCoreName: null, out nextEmulator, out rom, out game, out cancel);
}
catch (Exception oex)
Expand Down

0 comments on commit c5c8b6b

Please sign in to comment.