mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add a remaining ListXML-specific objects
Also fixes the usage of some other objects, adds proper objects for certain cases, and adds a bunch of TODOs around the new objects. There will be a lot of overhauls needed to properly support things like Devices and Slots
This commit is contained in:
@@ -10,41 +10,32 @@ namespace SabreTools.Library.DatItems
|
||||
#region ListXML
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML info object
|
||||
/// Represents one ListXML adjuster
|
||||
/// </summary>
|
||||
public class ListXmlInfo
|
||||
public class ListXmlAdjuster
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool? Default { get; set; }
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
|
||||
public ListXmlInfo(string name, string value)
|
||||
public ListXmlAdjuster()
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
Conditions = new List<ListXmlCondition>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
/// <summary>
|
||||
/// Represents the OpenMSX original value
|
||||
/// Represents one ListXML analog
|
||||
/// </summary>
|
||||
public class OpenMSXOriginal
|
||||
public class ListXmlAnalog
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool? Value { get; set; }
|
||||
public string Mask { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ListXML
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML chip
|
||||
/// </summary>
|
||||
public class ListXMLChip
|
||||
public class ListXmlChip
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Tag { get; set; }
|
||||
@@ -55,7 +46,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Represents one ListXML condition
|
||||
/// </summary>
|
||||
public class ListXMLCondition
|
||||
public class ListXmlCondition
|
||||
{
|
||||
public string Tag { get; set; }
|
||||
public string Mask { get; set; }
|
||||
@@ -63,10 +54,48 @@ namespace SabreTools.Library.DatItems
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML configuration
|
||||
/// </summary>
|
||||
public class ListXmlConfiguration
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string Mask { get; set; }
|
||||
public List<ListXmlConfLocation> Locations { get; set; }
|
||||
public List<ListXmlConfSetting> Settings { get; set; }
|
||||
|
||||
public ListXmlConfiguration()
|
||||
{
|
||||
Locations = new List<ListXmlConfLocation>();
|
||||
Settings = new List<ListXmlConfSetting>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation
|
||||
/// </summary>
|
||||
public class ListXmlConfLocation
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Number { get; set; }
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML confsetting
|
||||
/// </summary>
|
||||
public class ListXmlConfSetting
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool? Default { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML control
|
||||
/// </summary>
|
||||
public class ListXMLControl
|
||||
public class ListXmlControl
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Player { get; set; } // TODO: Int32?
|
||||
@@ -82,10 +111,38 @@ namespace SabreTools.Library.DatItems
|
||||
public string Ways3 { get; set; } // TODO: Int32? Float?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML device
|
||||
/// </summary>
|
||||
public class ListXmlDevice
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string FixedImage { get; set; }
|
||||
public string Mandatory { get; set; } // TODO: bool?
|
||||
public string Interface { get; set; }
|
||||
public List<ListXmlInstance> Instances { get; set; }
|
||||
public List<ListXmlExtension> Extensions { get; set; }
|
||||
|
||||
public ListXmlDevice()
|
||||
{
|
||||
Instances = new List<ListXmlInstance>();
|
||||
Extensions = new List<ListXmlExtension>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML deviceref
|
||||
/// </summary>
|
||||
public class ListXmlDeviceReference
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML display
|
||||
/// </summary>
|
||||
public class ListXMLDisplay
|
||||
public class ListXmlDisplay
|
||||
{
|
||||
public string Tag { get; set; }
|
||||
public string Type { get; set; } // TODO: (raster|vector|lcd|svg|unknown)
|
||||
@@ -107,25 +164,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML dipswitch
|
||||
/// </summary>
|
||||
/// <remarks>Also used by SoftwareList</remarks>
|
||||
public class ListXMLDipSwitch
|
||||
public class ListXmlDipSwitch
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string Mask { get; set; }
|
||||
public List<ListXMLDipLocation> Locations { get; set; }
|
||||
public List<ListXMLDipValue> Values { get; set; }
|
||||
public List<ListXmlDipLocation> Locations { get; set; }
|
||||
public List<ListXmlDipValue> Values { get; set; }
|
||||
|
||||
public ListXMLDipSwitch()
|
||||
public ListXmlDipSwitch()
|
||||
{
|
||||
Locations = new List<ListXMLDipLocation>();
|
||||
Values = new List<ListXMLDipValue>();
|
||||
Locations = new List<ListXmlDipLocation>();
|
||||
Values = new List<ListXmlDipValue>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML diplocation
|
||||
/// </summary>
|
||||
public class ListXMLDipLocation
|
||||
public class ListXmlDipLocation
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Number { get; set; }
|
||||
@@ -136,40 +193,156 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML dipvalue
|
||||
/// </summary>
|
||||
/// <remarks>Also used by SoftwareList</remarks>
|
||||
public class ListXMLDipValue
|
||||
public class ListXmlDipValue
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool? Default { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML driver
|
||||
/// </summary>
|
||||
public class ListXmlDriver
|
||||
{
|
||||
public string Status { get; set; } // TODO: (good|imperfect|preliminary)
|
||||
public string Emulation { get; set; } // TODO: (good|imperfect|preliminary)
|
||||
public string Cocktail { get; set; } // TODO: bool? (good|imperfect|preliminary)?
|
||||
public string SaveState { get; set; } // TODO: (supported|unsupported)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML extension
|
||||
/// </summary>
|
||||
public class ListXmlExtension
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML feature
|
||||
/// </summary>
|
||||
public class ListXmlFeature
|
||||
{
|
||||
public string Type { get; set; } // TODO: (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
|
||||
public string Status { get; set; } // TODO: (unemulated|imperfect)
|
||||
public string Overall { get; set; } // TODO: (unemulated|imperfect)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML info
|
||||
/// </summary>
|
||||
public class ListXmlInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML input
|
||||
/// </summary>
|
||||
public class ListXMLInput
|
||||
public class ListXmlInput
|
||||
{
|
||||
public bool? Service { get; set; }
|
||||
public bool? Tilt { get; set; }
|
||||
public string Players { get; set; } // TODO: Int32?
|
||||
public string Coins { get; set; } // TODO: Int32?
|
||||
public List<ListXMLControl> Controls { get; set; }
|
||||
public List<ListXmlControl> Controls { get; set; }
|
||||
|
||||
public ListXMLInput()
|
||||
public ListXmlInput()
|
||||
{
|
||||
Controls = new List<ListXMLControl>();
|
||||
Controls = new List<ListXmlControl>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML instance
|
||||
/// </summary>
|
||||
public class ListXmlInstance
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string BriefName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML port
|
||||
/// </summary>
|
||||
public class ListXmlPort
|
||||
{
|
||||
public string Tag { get; set; }
|
||||
public List<ListXmlAnalog> Analogs { get; set; }
|
||||
|
||||
public ListXmlPort()
|
||||
{
|
||||
Analogs = new List<ListXmlAnalog>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML ramoption
|
||||
/// </summary>
|
||||
public class ListXmlRamOption
|
||||
{
|
||||
public bool? Default { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slot
|
||||
/// </summary>
|
||||
public class ListXmlSlot
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<ListXmlSlotOption> SlotOptions { get; set; }
|
||||
|
||||
public ListXmlSlot()
|
||||
{
|
||||
SlotOptions = new List<ListXmlSlotOption>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slotoption
|
||||
/// </summary>
|
||||
public class ListXmlSlotOption
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string DeviceName { get; set; }
|
||||
public bool? Default { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML softwarelist
|
||||
/// </summary>
|
||||
public class ListXmlSoftwareList
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Status { get; set; } // TODO: (original|compatible)
|
||||
public string Filter { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML sound
|
||||
/// </summary>
|
||||
public class ListXMLSound
|
||||
public class ListXmlSound
|
||||
{
|
||||
public string Channels { get; set; } // TODO: Int32?
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
/// <summary>
|
||||
/// Represents the OpenMSX original value
|
||||
/// </summary>
|
||||
public class OpenMSXOriginal
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool? Value { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -241,6 +241,18 @@ namespace SabreTools.Library.DatItems
|
||||
Mechanical = 1 << 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine machine runnable status
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum Runnable
|
||||
{
|
||||
NULL,
|
||||
No,
|
||||
Partial,
|
||||
Yes,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine machine support status
|
||||
/// </summary>
|
||||
|
||||
@@ -145,20 +145,21 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine runnable status
|
||||
/// </summary>
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
/// <remarks>Also in Logiqx</remarks>
|
||||
[JsonProperty("runnable")]
|
||||
public bool? Runnable { get; set; } = null;
|
||||
public Runnable Runnable { get; set; } = Runnable.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated device names
|
||||
/// </summary>
|
||||
/// TODO: Use ListXmlDeviceReference for this...
|
||||
[JsonProperty("devices")]
|
||||
public List<string> Devices { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
/// TODO: Use ListXmlSlot for this...
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<string> SlotOptions { get; set; } = null;
|
||||
|
||||
@@ -285,8 +286,10 @@ namespace SabreTools.Library.DatItems
|
||||
/// List of shared feature items
|
||||
/// </summary>
|
||||
/// <remarks>Also in SoftwareList</remarks>
|
||||
/// TODO: Move to ListXML section
|
||||
/// TODO: Order ListXML and SoftwareList outputs by area names
|
||||
[JsonProperty("dipswitches")]
|
||||
public List<ListXMLDipSwitch> DipSwitches { get; set; } = null;
|
||||
public List<ListXmlDipSwitch> DipSwitches { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -376,7 +379,7 @@ namespace SabreTools.Library.DatItems
|
||||
fieldValue = SourceFile;
|
||||
break;
|
||||
case Field.Runnable:
|
||||
fieldValue = Runnable?.ToString();
|
||||
fieldValue = Runnable.ToString();
|
||||
break;
|
||||
case Field.Devices:
|
||||
fieldValue = string.Join(";", Devices ?? new List<string>());
|
||||
@@ -547,7 +550,7 @@ namespace SabreTools.Library.DatItems
|
||||
SourceFile = mappings[Field.SourceFile];
|
||||
|
||||
if (mappings.Keys.Contains(Field.Runnable))
|
||||
Runnable = mappings[Field.Runnable].AsYesNo();
|
||||
Runnable = mappings[Field.Runnable].AsRunnable();
|
||||
|
||||
if (mappings.Keys.Contains(Field.Devices))
|
||||
{
|
||||
@@ -576,7 +579,12 @@ namespace SabreTools.Library.DatItems
|
||||
foreach (string pair in pairs)
|
||||
{
|
||||
string[] split = pair.Split('=');
|
||||
Infos.Add(new ListXmlInfo(split[0], split[1]));
|
||||
|
||||
var infoObj = new ListXmlInfo();
|
||||
infoObj.Name = split[0];
|
||||
infoObj.Value = split[1];
|
||||
|
||||
Infos.Add(infoObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,7 +665,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DipSwitches))
|
||||
{
|
||||
if (DipSwitches == null)
|
||||
DipSwitches = new List<ListXMLDipSwitch>();
|
||||
DipSwitches = new List<ListXmlDipSwitch>();
|
||||
|
||||
// TODO: There's no way this will work... just create the new list for now
|
||||
}
|
||||
@@ -919,7 +927,9 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on runnable
|
||||
if (filter.Runnable.MatchesNeutral(null, Runnable) == false)
|
||||
if (filter.Runnables.MatchesPositive(Runnable.NULL, Runnable) == false)
|
||||
return false;
|
||||
if (filter.Runnables.MatchesNegative(Runnable.NULL, Runnable) == true)
|
||||
return false;
|
||||
|
||||
// Filter on devices
|
||||
@@ -1141,7 +1151,7 @@ namespace SabreTools.Library.DatItems
|
||||
SourceFile = null;
|
||||
|
||||
if (fields.Contains(Field.Runnable))
|
||||
Runnable = null;
|
||||
Runnable = Runnable.NULL;
|
||||
|
||||
if (fields.Contains(Field.Devices))
|
||||
Devices = null;
|
||||
|
||||
Reference in New Issue
Block a user