Skip to content

Commit e8d58a9

Browse files
committed
workaround for cores showing internal load errors with xml loader
if we pass the core's own error message over to the user without xml, the dialog they see is the regular "core accepted the rom + error message" one. but if the same happens for something loaded through xml, the dialog is instead "no core could load this + 2 copies of the same error/stack". turns out there's a special case when MissingFirmwareException is thrown to avoid that second dialog. but internal errors are not MissingFirmwareException, so I added my own and a check for it. unfortunately when running the debug build of hawk PLUS release build of dsda and causing such an internal error, there's still stack overflow after the throw...
1 parent 8f57499 commit e8d58a9

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

src/BizHawk.Client.Common/RomLoader.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,11 @@ private IEmulator MakeCoreFromCoreInventory(CoreInventoryParameters cip, string
429429
{
430430
return core.Create(cip);
431431
}
432-
catch (Exception e) when (!_config.DontTryOtherCores
433-
&& e is not (MissingFirmwareException or { InnerException: MissingFirmwareException }))
432+
catch (Exception e) when (!_config.DontTryOtherCores && e is not (
433+
MissingFirmwareException
434+
or InternalErrorException
435+
or { InnerException: MissingFirmwareException }
436+
))
434437
{
435438
exceptions.Add(e);
436439
}

src/BizHawk.Emulation.Common/EmulationExceptions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,11 @@ public SavestateSizeMismatchException(string message)
4141
{
4242
}
4343
}
44+
45+
public class InternalErrorException : Exception
46+
{
47+
public InternalErrorException(string message) : base(message)
48+
{
49+
}
50+
}
4451
}

src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public MAME(CoreLoadParameters<object, MAMESyncSettings> lp)
7777
if (_loadFailure.Length is not 0)
7878
{
7979
Dispose();
80-
throw new Exception("\n\n" + _loadFailure);
80+
throw new InternalErrorException("\n\n" + _loadFailure);
8181
}
8282

8383
// concat all SHA1 hashes together (unprefixed), then hash that

src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private static bool PlayerPresent(DoomSyncSettings syncSettings, int port) =>
379379

380380
private void ErrorCallback(string error)
381381
{
382-
throw new Exception($"\n\n{error}\n");
382+
throw new InternalErrorException($"\n\n{error}\n");
383383
}
384384

385385
/// <summary>

waterbox/dsda/core

Submodule core updated from 7ee3f0c to c5a129a

0 commit comments

Comments
 (0)