diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
index 2efed5bb4f..30245df15f 100644
--- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj
+++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
@@ -517,6 +517,7 @@
Component
+
FFmpegWriterForm.cs
diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs
index e4f947c406..7ef477eeb5 100644
--- a/BizHawk.MultiClient/MainForm.cs
+++ b/BizHawk.MultiClient/MainForm.cs
@@ -1922,15 +1922,48 @@ namespace BizHawk.MultiClient
}
}
}
- else
+ else if (file.Extension.ToLower() == ".xml")
+ {
+ var XMLG = XmlGame.Create(file);
+
+ if (XMLG != null)
+ {
+ game = XMLG.GI;
+
+ switch (game.System)
+ {
+ case "DGB":
+
+ var L = Database.GetGameInfo(XMLG.Assets["LeftRom"], "left.gb");
+ var R = Database.GetGameInfo(XMLG.Assets["RightRom"], "right.gb");
+
+ if (Global.Config.GB_ForceDMG) L.AddOption("ForceDMG");
+ if (Global.Config.GB_GBACGB) L.AddOption("GBACGB");
+ if (Global.Config.GB_MulticartCompat) L.AddOption("MulitcartCompat");
+ if (Global.Config.GB_ForceDMG) R.AddOption("ForceDMG");
+ if (Global.Config.GB_GBACGB) R.AddOption("GBACGB");
+ if (Global.Config.GB_MulticartCompat) R.AddOption("MulitcartCompat");
+
+ GambatteLink gbl = new GambatteLink(nextComm, L, XMLG.Assets["LeftRom"], R, XMLG.Assets["RightRom"]);
+ nextEmulator = gbl;
+ // other stuff todo
+ break;
+
+ default:
+ return false;
+ }
+
+ }
+ // if load fails, second chance to identify as a bsnes XML
+ }
+ else // most extensions
{
rom = new RomGame(file);
game = rom.GameInfo;
bool isXml = false;
- //right now, xml is always snes.
- //later, we may need to inspect the XML ourselves to dispatch it to the correct system (if any other systems ever use xml...)
+ // other xml has already been handled
if (file.Extension.ToLower() == ".xml")
{
game.System = "SNES";
@@ -2031,20 +2064,6 @@ namespace BizHawk.MultiClient
break;
case "GB":
case "GBC":
- //if (false) // this code will load up a dual game boy
- //{
- // // this is horrible. we MUST decide when we should be using Game.System and when we should be using Emulator.SystemID
- // game.System = "DGB"; // HACK
-
- // if (Global.Config.GB_ForceDMG) game.AddOption("ForceDMG");
- // if (Global.Config.GB_GBACGB) game.AddOption("GBACGB");
- // if (Global.Config.GB_MulticartCompat) game.AddOption("MulitcartCompat");
- // GambatteLink gbl = new GambatteLink(nextComm, game, rom.FileData, game, rom.FileData);
- // nextEmulator = gbl;
- // // other stuff todo
- //}
- //else
- //{
if (!Global.Config.GB_AsSGB)
{
if (Global.Config.GB_ForceDMG) game.AddOption("ForceDMG");
diff --git a/BizHawk.MultiClient/XmlGame.cs b/BizHawk.MultiClient/XmlGame.cs
new file mode 100644
index 0000000000..bcf6f7cad1
--- /dev/null
+++ b/BizHawk.MultiClient/XmlGame.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Xml;
+
+namespace BizHawk.MultiClient
+{
+ public class XmlGame
+ {
+ public XmlDocument Xml;
+ public GameInfo GI = new GameInfo();
+ public Dictionary Assets = new Dictionary();
+
+ public static XmlGame Create(HawkFile f)
+ {
+ try
+ {
+ var x = new XmlDocument();
+ x.Load(f.GetStream());
+ var y = x.SelectSingleNode("./BizHawk-XMLGame");
+ if (y == null)
+ return null;
+
+ var ret = new XmlGame();
+ ret.GI.System = y.Attributes["System"].Value;
+ ret.GI.Name = y.Attributes["Name"].Value;
+ ret.GI.Status = RomStatus.Unknown;
+ ret.Xml = x;
+
+ var n = y.SelectSingleNode("./LoadAssets");
+ if (n != null)
+ {
+ foreach (XmlNode a in n.ChildNodes)
+ {
+ string name = a.Name;
+ string filename = a.Attributes["FileName"].Value;
+ if (filename[0] == '|')
+ {
+ // in same archive
+ var ai = f.FindArchiveMember(filename.Substring(1));
+ if (ai != null)
+ {
+ f.BindArchiveMember(ai);
+ byte[] data = Util.ReadAllBytes(f.GetStream());
+ ret.Assets[name] = data;
+ }
+ else
+ {
+ throw new Exception("Couldn't load XMLGame LoadAsset \"" + name + "\"");
+ }
+ }
+ else
+ {
+ // relative path
+ string fullpath = Path.GetDirectoryName(f.CanonicalFullPath.Split('|')[0]);
+ fullpath = Path.Combine(fullpath, filename);
+ try
+ {
+ byte[] data = File.ReadAllBytes(fullpath);
+ ret.Assets[name] = data;
+ }
+ catch
+ {
+ throw new Exception("Couldn't load XMLGame LoadAsset \"" + name + "\"");
+ }
+ }
+ }
+ }
+ return ret;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ }
+}