fix infinite recursion in loadrom for unsupported GB games
This commit is contained in:
parent
2c35a85fa4
commit
274c29ff37
|
@ -160,8 +160,15 @@ namespace BizHawk.Client.Common
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadRom(string path, CoreComm nextComm, bool forceAccurateCore = false) // forceAccurateCore is currently just for Quicknes vs Neshawk but could be used for other situations
|
public bool LoadRom(string path, CoreComm nextComm, bool forceAccurateCore = false,
|
||||||
|
int recursiveCount = 0) // forceAccurateCore is currently just for Quicknes vs Neshawk but could be used for other situations
|
||||||
{
|
{
|
||||||
|
if (recursiveCount > 1) // hack to stop recursive calls from endlessly rerunning if we can't load it
|
||||||
|
{
|
||||||
|
DoLoadErrorCallback("Failed multiple attempts to load ROM.", "");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool cancel = false;
|
bool cancel = false;
|
||||||
|
|
||||||
if (path == null)
|
if (path == null)
|
||||||
|
@ -565,7 +572,7 @@ namespace BizHawk.Client.Common
|
||||||
DoMessageCallback("Unable to use quicknes, using NESHawk instead");
|
DoMessageCallback("Unable to use quicknes, using NESHawk instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoadRom(path, nextComm, forceAccurateCore: true);
|
return LoadRom(path, nextComm, true, recursiveCount + 1);
|
||||||
}
|
}
|
||||||
else if (ex is MissingFirmwareException)
|
else if (ex is MissingFirmwareException)
|
||||||
{
|
{
|
||||||
|
@ -575,7 +582,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
// Note: GB as SGB was set to false by this point, otherwise we would want to do it here
|
// Note: GB as SGB was set to false by this point, otherwise we would want to do it here
|
||||||
DoMessageCallback("Failed to load a GB rom in SGB mode. Disabling SGB Mode.");
|
DoMessageCallback("Failed to load a GB rom in SGB mode. Disabling SGB Mode.");
|
||||||
return LoadRom(path, nextComm);
|
return LoadRom(path, nextComm, false, recursiveCount + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue