Avoid parsing `.xml` bundles twice (resolves #4277)
This commit is contained in:
parent
bba93b33d6
commit
4025d36b18
|
@ -120,6 +120,7 @@ namespace BizHawk.Client.Common
|
||||||
public GameInfo Game { get; private set; }
|
public GameInfo Game { get; private set; }
|
||||||
public RomGame Rom { get; private set; }
|
public RomGame Rom { get; private set; }
|
||||||
public string CanonicalFullPath { get; private set; }
|
public string CanonicalFullPath { get; private set; }
|
||||||
|
public XmlGame XMLGameInfo = null;
|
||||||
|
|
||||||
public bool Deterministic { get; set; }
|
public bool Deterministic { get; set; }
|
||||||
|
|
||||||
|
@ -682,14 +683,22 @@ namespace BizHawk.Client.Common
|
||||||
return Disc.IsValidExtension(ext);
|
return Disc.IsValidExtension(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadXML(string path, CoreComm nextComm, HawkFile file, string forcedCoreName, out IEmulator nextEmulator, out RomGame rom, out GameInfo game)
|
private bool LoadXML(
|
||||||
|
string path,
|
||||||
|
CoreComm nextComm,
|
||||||
|
HawkFile file,
|
||||||
|
string forcedCoreName,
|
||||||
|
out IEmulator nextEmulator,
|
||||||
|
out RomGame rom,
|
||||||
|
out GameInfo game,
|
||||||
|
out XmlGame xmlGame)
|
||||||
{
|
{
|
||||||
nextEmulator = null;
|
nextEmulator = null;
|
||||||
rom = null;
|
rom = null;
|
||||||
game = null;
|
game = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var xmlGame = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
|
xmlGame = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
|
||||||
game = xmlGame.GI;
|
game = xmlGame.GI;
|
||||||
|
|
||||||
var system = game.System;
|
var system = game.System;
|
||||||
|
@ -725,6 +734,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
xmlGame = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// need to get rid of this hack at some point
|
// need to get rid of this hack at some point
|
||||||
|
@ -886,8 +896,18 @@ namespace BizHawk.Client.Common
|
||||||
LoadM3U(path, nextComm, file, forcedCoreName, out nextEmulator, out game);
|
LoadM3U(path, nextComm, file, forcedCoreName, out nextEmulator, out game);
|
||||||
break;
|
break;
|
||||||
case ".xml":
|
case ".xml":
|
||||||
if (!LoadXML(path, nextComm, file, forcedCoreName, out nextEmulator, out rom, out game))
|
if (!LoadXML(
|
||||||
|
path,
|
||||||
|
nextComm,
|
||||||
|
file,
|
||||||
|
forcedCoreName,
|
||||||
|
out nextEmulator,
|
||||||
|
out rom,
|
||||||
|
out game,
|
||||||
|
out XMLGameInfo))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ".psf":
|
case ".psf":
|
||||||
case ".minipsf":
|
case ".minipsf":
|
||||||
|
|
|
@ -3856,13 +3856,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InputManager.SyncControls(Emulator, MovieSession, Config);
|
InputManager.SyncControls(Emulator, MovieSession, Config);
|
||||||
_multiDiskMode = false;
|
_multiDiskMode = false;
|
||||||
|
|
||||||
if (oaOpenrom is not null && ".xml".EqualsIgnoreCase(Path.GetExtension(oaOpenrom.Path.Replace("|", "")))
|
if (loader.XMLGameInfo is XmlGame xmlGame && Emulator is not LibsnesCore)
|
||||||
&& Emulator is not LibsnesCore)
|
|
||||||
{
|
{
|
||||||
// this is a multi-disk bundler file
|
// this is a multi-disk bundler file
|
||||||
// determine the xml assets and create RomStatusDetails for all of them
|
// determine the xml assets and create RomStatusDetails for all of them
|
||||||
var xmlGame = XmlGame.Create(new HawkFile(oaOpenrom.Path));
|
|
||||||
|
|
||||||
using var xSw = new StringWriter();
|
using var xSw = new StringWriter();
|
||||||
|
|
||||||
for (int xg = 0; xg < xmlGame.Assets.Count; xg++)
|
for (int xg = 0; xg < xmlGame.Assets.Count; xg++)
|
||||||
|
|
Loading…
Reference in New Issue