static GameDipswitchDefinition() { XmlDocument config = new XmlDocument(); config.Load(ResourceManager.GetZippedResource("DipswitchDefinitions.xml")); foreach (XmlNode gameNode in config.SelectNodes("/DipswitchDefinitions/Game")) { var gameDipswitches = new GameDipswitchDefinition(); string crcValues = gameNode.Attributes["PrgCrc32"].Value; foreach (string crc in crcValues.Split(',')) { if (gameNode.Attributes["DefaultDip"] != null) { gameDipswitches.DefaultDipSwitches = (byte)Int32.Parse(gameNode.Attributes["DefaultDip"].Value); } gameDipswitches.DipSwitches = new List <List <string> >(); foreach (XmlNode dipSwitch in gameNode.SelectNodes("DipSwitch")) { if (dipSwitch.Attributes["Localization"] != null) { var list = new List <string>(); gameDipswitches.DipSwitches.Add(list); list.Add(dipSwitch.Attributes["Localization"].Value); foreach (XmlNode option in dipSwitch.SelectNodes("Option")) { list.Add(option.InnerText); } } else { var list = new List <string>(); gameDipswitches.DipSwitches.Add(list); list.Add("Unknown"); list.Add("Off"); list.Add("On"); } } _gameConfigs[int.Parse(crc, System.Globalization.NumberStyles.HexNumber)] = gameDipswitches; } } }
static GameDipswitchDefinition() { XmlDocument config = new XmlDocument(); config.Load(ResourceManager.GetZippedResource("VsSystem.xml")); foreach (XmlNode gameNode in config.SelectNodes("/VsSystemGames/Game")) { var gameDipswitches = new GameDipswitchDefinition(); gameDipswitches.GameID = gameNode.Attributes["ID"].Value; if (gameNode.Attributes["DefaultDip"] != null) { gameDipswitches.DefaultDipSwitches = (byte)Int32.Parse(gameNode.Attributes["DefaultDip"].Value); } gameDipswitches.DipSwitches = new List <List <string> >(); foreach (XmlNode dipSwitch in gameNode.SelectNodes("DipSwitch")) { if (dipSwitch.Attributes["Localization"] != null) { var list = new List <string>(); gameDipswitches.DipSwitches.Add(list); list.Add(dipSwitch.Attributes["Localization"].Value); foreach (XmlNode option in dipSwitch.SelectNodes("Option")) { list.Add(option.InnerText); } } else { var list = new List <string>(); gameDipswitches.DipSwitches.Add(list); list.Add("Unknown"); list.Add("Off"); list.Add("On"); } } _gameConfigs[gameNode.Attributes["ID"].Value] = gameDipswitches; } }
public static void ApplyGameSpecificConfig() { GameSpecificInfo existingConfig = GetGameSpecificInfo(); if (existingConfig != null) { InteropEmu.SetDipSwitches(existingConfig.DipSwitches); } else { GameDipswitchDefinition dipswitchDefinition = GameDipswitchDefinition.GetDipswitchDefinition(); if (dipswitchDefinition != null) { InteropEmu.SetDipSwitches(dipswitchDefinition.DefaultDipSwitches); } else { InteropEmu.SetDipSwitches(0); } } }