mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Input
This commit is contained in:
@@ -161,6 +161,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long FeatureCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Input items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long InputCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Media items
|
||||
/// </summary>
|
||||
@@ -593,6 +599,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Feature:
|
||||
FeatureCount++;
|
||||
break;
|
||||
case ItemType.Input:
|
||||
InputCount++;
|
||||
break;
|
||||
case ItemType.Media:
|
||||
MediaCount++;
|
||||
MD5Count += (string.IsNullOrWhiteSpace((item as Media).MD5) ? 0 : 1);
|
||||
@@ -767,6 +776,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Feature:
|
||||
FeatureCount--;
|
||||
break;
|
||||
case ItemType.Input:
|
||||
InputCount--;
|
||||
break;
|
||||
case ItemType.Media:
|
||||
MediaCount--;
|
||||
MD5Count -= (string.IsNullOrWhiteSpace((item as Media).MD5) ? 0 : 1);
|
||||
|
||||
@@ -256,6 +256,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Feature:
|
||||
datItem = datItemObj.ToObject<Feature>();
|
||||
break;
|
||||
case ItemType.Input:
|
||||
datItem = datItemObj.ToObject<Input>();
|
||||
break;
|
||||
case ItemType.Instance:
|
||||
datItem = datItemObj.ToObject<Instance>();
|
||||
break;
|
||||
|
||||
@@ -419,6 +419,30 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "input":
|
||||
var input = new Input
|
||||
{
|
||||
Service = reader.GetAttribute("service").AsYesNo(),
|
||||
Tilt = reader.GetAttribute("tilt").AsYesNo(),
|
||||
Players = reader.GetAttribute("players"),
|
||||
Coins = reader.GetAttribute("coins"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
ReadInput(reader.ReadSubtree(), input);
|
||||
|
||||
datItems.Add(input);
|
||||
|
||||
// Skip the input now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "port":
|
||||
var port = new Port
|
||||
{
|
||||
@@ -549,26 +573,6 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "input":
|
||||
var input = new Input();
|
||||
input.Service = reader.GetAttribute("service").AsYesNo();
|
||||
input.Tilt = reader.GetAttribute("tilt").AsYesNo();
|
||||
input.Players = reader.GetAttribute("players");
|
||||
input.Coins = reader.GetAttribute("coins");
|
||||
|
||||
// Now read the internal tags
|
||||
ReadInput(reader.ReadSubtree(), input);
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Inputs == null)
|
||||
machine.Inputs = new List<Input>();
|
||||
|
||||
machine.Inputs.Add(input);
|
||||
|
||||
// Skip the input now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
default:
|
||||
reader.Read();
|
||||
break;
|
||||
@@ -1254,40 +1258,6 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalElementString("year", datItem.Machine.Year);
|
||||
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
||||
|
||||
// TODO: These are all going away due to promotions
|
||||
if (datItem.Machine.Inputs != null)
|
||||
{
|
||||
foreach (var input in datItem.Machine.Inputs)
|
||||
{
|
||||
xtw.WriteStartElement("input");
|
||||
xtw.WriteOptionalAttributeString("service", input.Service.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("players", input.Players);
|
||||
xtw.WriteOptionalAttributeString("coins", input.Coins);
|
||||
if (input.Controls != null)
|
||||
{
|
||||
foreach (var control in input.Controls)
|
||||
{
|
||||
xtw.WriteStartElement("control");
|
||||
xtw.WriteOptionalAttributeString("type", control.Type);
|
||||
xtw.WriteOptionalAttributeString("player", control.Player);
|
||||
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
|
||||
xtw.WriteOptionalAttributeString("regbuttons", control.RegButtons);
|
||||
xtw.WriteOptionalAttributeString("minimum", control.Minimum);
|
||||
xtw.WriteOptionalAttributeString("maximum", control.Maximum);
|
||||
xtw.WriteOptionalAttributeString("sensitivity", control.Sensitivity);
|
||||
xtw.WriteOptionalAttributeString("keydelta", control.KeyDelta);
|
||||
xtw.WriteOptionalAttributeString("reverse", control.Reverse.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("ways", control.Ways);
|
||||
xtw.WriteOptionalAttributeString("ways2", control.Ways2);
|
||||
xtw.WriteOptionalAttributeString("ways3", control.Ways3);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
xtw.Flush();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1576,6 +1546,36 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Input:
|
||||
var input = datItem as Input;
|
||||
xtw.WriteStartElement("input");
|
||||
xtw.WriteOptionalAttributeString("service", input.Service.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("players", input.Players);
|
||||
xtw.WriteOptionalAttributeString("coins", input.Coins);
|
||||
if (input.Controls != null)
|
||||
{
|
||||
foreach (var control in input.Controls)
|
||||
{
|
||||
xtw.WriteStartElement("control");
|
||||
xtw.WriteOptionalAttributeString("type", control.Type);
|
||||
xtw.WriteOptionalAttributeString("player", control.Player);
|
||||
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
|
||||
xtw.WriteOptionalAttributeString("regbuttons", control.RegButtons);
|
||||
xtw.WriteOptionalAttributeString("minimum", control.Minimum);
|
||||
xtw.WriteOptionalAttributeString("maximum", control.Maximum);
|
||||
xtw.WriteOptionalAttributeString("sensitivity", control.Sensitivity);
|
||||
xtw.WriteOptionalAttributeString("keydelta", control.KeyDelta);
|
||||
xtw.WriteOptionalAttributeString("reverse", control.Reverse.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("ways", control.Ways);
|
||||
xtw.WriteOptionalAttributeString("ways2", control.Ways2);
|
||||
xtw.WriteOptionalAttributeString("ways3", control.Ways3);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Port:
|
||||
var port = datItem as Port;
|
||||
xtw.WriteStartElement("port");
|
||||
|
||||
@@ -1473,6 +1473,37 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Input:
|
||||
var input = datItem as Input;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "input");
|
||||
xtw.WriteOptionalAttributeString("service", input.Service.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("players", input.Players);
|
||||
xtw.WriteOptionalAttributeString("coins", input.Coins);
|
||||
if (input.Controls != null)
|
||||
{
|
||||
foreach (var control in input.Controls)
|
||||
{
|
||||
xtw.WriteStartElement("control");
|
||||
xtw.WriteOptionalAttributeString("type", control.Type);
|
||||
xtw.WriteOptionalAttributeString("player", control.Player);
|
||||
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
|
||||
xtw.WriteOptionalAttributeString("regbuttons", control.RegButtons);
|
||||
xtw.WriteOptionalAttributeString("minimum", control.Minimum);
|
||||
xtw.WriteOptionalAttributeString("maximum", control.Maximum);
|
||||
xtw.WriteOptionalAttributeString("sensitivity", control.Sensitivity);
|
||||
xtw.WriteOptionalAttributeString("keydelta", control.KeyDelta);
|
||||
xtw.WriteOptionalAttributeString("reverse", control.Reverse.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("ways", control.Ways);
|
||||
xtw.WriteOptionalAttributeString("ways2", control.Ways2);
|
||||
xtw.WriteOptionalAttributeString("ways3", control.Ways3);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Media:
|
||||
var media = datItem as Media;
|
||||
xtw.WriteStartElement("file");
|
||||
|
||||
@@ -99,48 +99,6 @@ namespace SabreTools.Library.DatItems
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML input
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (contains list)
|
||||
[JsonObject("input")]
|
||||
public class Input
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Input service ID
|
||||
/// </summary>
|
||||
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Service { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determins if this has a tilt sensor
|
||||
/// </summary>
|
||||
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Tilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of players on the input
|
||||
/// </summary>
|
||||
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Players { get; set; } // TODO: Int32?
|
||||
|
||||
/// <summary>
|
||||
/// Number of coins required
|
||||
/// </summary>
|
||||
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Coins { get; set; } // TODO: Int32?
|
||||
|
||||
/// <summary>
|
||||
/// Set of controls for the input
|
||||
/// </summary>
|
||||
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Control> Controls { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation or diplocation
|
||||
/// </summary>
|
||||
|
||||
@@ -503,6 +503,9 @@ namespace SabreTools.Library.DatItems
|
||||
case ItemType.Feature:
|
||||
return new Feature();
|
||||
|
||||
case ItemType.Input:
|
||||
return new Input();
|
||||
|
||||
case ItemType.Instance:
|
||||
return new Instance();
|
||||
|
||||
|
||||
@@ -186,28 +186,6 @@ namespace SabreTools.Library.DatItems
|
||||
Machine_SourceFile,
|
||||
Machine_Runnable,
|
||||
|
||||
// Inputs
|
||||
Machine_Inputs,
|
||||
Machine_Input_Service,
|
||||
Machine_Input_Tilt,
|
||||
Machine_Input_Players,
|
||||
Machine_Input_Coins,
|
||||
|
||||
// Inputs.Controls
|
||||
Machine_Input_Controls,
|
||||
Machine_Input_Control_Type,
|
||||
Machine_Input_Control_Player,
|
||||
Machine_Input_Control_Buttons,
|
||||
Machine_Input_Control_RegButtons,
|
||||
Machine_Input_Control_Minimum,
|
||||
Machine_Input_Control_Maximum,
|
||||
Machine_Input_Control_Sensitivity,
|
||||
Machine_Input_Control_KeyDelta,
|
||||
Machine_Input_Control_Reverse,
|
||||
Machine_Input_Control_Ways,
|
||||
Machine_Input_Control_Ways2,
|
||||
Machine_Input_Control_Ways3,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -418,6 +396,27 @@ namespace SabreTools.Library.DatItems
|
||||
DatItem_FeatureStatus,
|
||||
DatItem_FeatureOverall,
|
||||
|
||||
// Inputs
|
||||
DatItem_Service,
|
||||
DatItem_Tilt,
|
||||
DatItem_Players,
|
||||
DatItem_Coins,
|
||||
|
||||
// Inputs.Controls
|
||||
DatItem_Controls,
|
||||
DatItem_Control_Type,
|
||||
DatItem_Control_Player,
|
||||
DatItem_Control_Buttons,
|
||||
DatItem_Control_RegButtons,
|
||||
DatItem_Control_Minimum,
|
||||
DatItem_Control_Maximum,
|
||||
DatItem_Control_Sensitivity,
|
||||
DatItem_Control_KeyDelta,
|
||||
DatItem_Control_Reverse,
|
||||
DatItem_Control_Ways,
|
||||
DatItem_Control_Ways2,
|
||||
DatItem_Control_Ways3,
|
||||
|
||||
// Port.Analogs
|
||||
DatItem_Analogs,
|
||||
DatItem_Analog_Mask,
|
||||
@@ -491,6 +490,7 @@ namespace SabreTools.Library.DatItems
|
||||
Driver,
|
||||
Extension,
|
||||
Feature,
|
||||
Input,
|
||||
Instance,
|
||||
Port,
|
||||
RamOption,
|
||||
|
||||
264
SabreTools.Library/DatItems/Input.cs
Normal file
264
SabreTools.Library/DatItems/Input.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.Library.Filtering;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Library.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// This holds all of the auxiliary types needed for proper parsing
|
||||
/// </summary>
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents one ListXML input
|
||||
/// </summary>
|
||||
[JsonObject("input")]
|
||||
public class Input : DatItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Input service ID
|
||||
/// </summary>
|
||||
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Service { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determins if this has a tilt sensor
|
||||
/// </summary>
|
||||
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Tilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of players on the input
|
||||
/// </summary>
|
||||
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Players { get; set; } // TODO: Int32?
|
||||
|
||||
/// <summary>
|
||||
/// Number of coins required
|
||||
/// </summary>
|
||||
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Coins { get; set; } // TODO: Int32?
|
||||
|
||||
/// <summary>
|
||||
/// Set of controls for the input
|
||||
/// </summary>
|
||||
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Control> Controls { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public override void SetFields(Dictionary<Field, string> mappings)
|
||||
{
|
||||
// Set base fields
|
||||
base.SetFields(mappings);
|
||||
|
||||
// Handle Input-specific fields
|
||||
if (mappings.Keys.Contains(Field.DatItem_Service))
|
||||
Service = mappings[Field.DatItem_Service].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Tilt))
|
||||
Tilt = mappings[Field.DatItem_Tilt].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Players))
|
||||
Players = mappings[Field.DatItem_Players];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Coins))
|
||||
Coins = mappings[Field.DatItem_Coins];
|
||||
|
||||
// TODO: Handle DatItem_Control*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a default, empty Input object
|
||||
/// </summary>
|
||||
public Input()
|
||||
{
|
||||
ItemType = ItemType.Input;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
return new Input()
|
||||
{
|
||||
ItemType = this.ItemType,
|
||||
DupeType = this.DupeType,
|
||||
|
||||
AltName = this.AltName,
|
||||
AltTitle = this.AltTitle,
|
||||
|
||||
Original = this.Original,
|
||||
OpenMSXSubType = this.OpenMSXSubType,
|
||||
OpenMSXType = this.OpenMSXType,
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
Machine = this.Machine.Clone() as Machine,
|
||||
Source = this.Source.Clone() as Source,
|
||||
Remove = this.Remove,
|
||||
|
||||
Service = this.Service,
|
||||
Tilt = this.Tilt,
|
||||
Players = this.Players,
|
||||
Coins = this.Coins,
|
||||
Controls = this.Controls,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public override bool Equals(DatItem other)
|
||||
{
|
||||
// If we don't have a Input, return false
|
||||
if (ItemType != other.ItemType)
|
||||
return false;
|
||||
|
||||
// Otherwise, treat it as a Input
|
||||
Input newOther = other as Input;
|
||||
|
||||
// If the Input information matches
|
||||
return (Service == newOther.Service
|
||||
&& Tilt == newOther.Tilt
|
||||
&& Players == newOther.Players
|
||||
&& Coins == newOther.Coins);
|
||||
|
||||
// TODO: Handle DatItem_Control*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public override bool PassesFilter(Filter filter)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// Filter on service
|
||||
if (filter.DatItem_Service.MatchesNeutral(null, Service) == false)
|
||||
return false;
|
||||
|
||||
// Filter on tilt
|
||||
if (filter.DatItem_Tilt.MatchesNeutral(null, Tilt) == false)
|
||||
return false;
|
||||
|
||||
// Filter on players
|
||||
if (filter.DatItem_Players.MatchesPositiveSet(Players) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Players.MatchesNegativeSet(Players) == true)
|
||||
return false;
|
||||
|
||||
// Filter on coins
|
||||
if (filter.DatItem_Coins.MatchesPositiveSet(Coins) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Coins.MatchesNegativeSet(Coins) == true)
|
||||
return false;
|
||||
|
||||
// TODO: Handle DatItem_Control*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="fields">List of Fields to remove</param>
|
||||
public override void RemoveFields(List<Field> fields)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_Service))
|
||||
Service = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Tilt))
|
||||
Tilt = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Players))
|
||||
Players = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Coins))
|
||||
Coins = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Controls))
|
||||
Controls = null;
|
||||
|
||||
// TODO: Handle DatItem_Control*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, fields);
|
||||
|
||||
// If we don't have a Input to replace from, ignore specific fields
|
||||
if (item.ItemType != ItemType.Input)
|
||||
return;
|
||||
|
||||
// Cast for easier access
|
||||
Input newItem = item as Input;
|
||||
|
||||
// Replace the fields
|
||||
if (fields.Contains(Field.DatItem_Service))
|
||||
Service = newItem.Service;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Tilt))
|
||||
Tilt = newItem.Tilt;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Players))
|
||||
Players = newItem.Players;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Coins))
|
||||
Coins = newItem.Coins;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Controls))
|
||||
Controls = newItem.Controls;
|
||||
|
||||
// TODO: Handle DatItem_Control*
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -152,12 +152,6 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("runnable", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Runnable Runnable { get; set; } = Runnable.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Input> Inputs { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx Fields
|
||||
@@ -493,7 +487,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
SourceFile = this.SourceFile,
|
||||
Runnable = this.Runnable,
|
||||
Inputs = this.Inputs,
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -51,28 +51,6 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<string> Machine_SourceFile { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<Runnable> Machine_Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Runnable.NULL, Negative = Runnable.NULL };
|
||||
|
||||
// Inputs
|
||||
public FilterItem<bool?> Machine_Inputs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<bool?> Machine_Input_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<bool?> Machine_Input_Tilt { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Input_Players { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Coins { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Inputs.Controls
|
||||
public FilterItem<bool?> Machine_Input_Controls { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Input_Control_Type { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Player { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Buttons { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_RegButtons { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Minimum { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Maximum { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Sensitivity { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_KeyDelta { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> Machine_Input_Control_Reverse { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Input_Control_Ways { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Ways2 { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Input_Control_Ways3 { get; private set; } = new FilterItem<string>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -283,6 +261,27 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<FeatureStatus> DatItem_FeatureStatus { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
||||
public FilterItem<FeatureStatus> DatItem_FeatureOverall { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
||||
|
||||
// Input
|
||||
public FilterItem<bool?> DatItem_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<bool?> DatItem_Tilt { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_Players { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Coins { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Input.Controls
|
||||
public FilterItem<bool?> DatItem_Controls { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_Control_Type { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Player { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Buttons { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_RegButtons { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Minimum { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Maximum { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Sensitivity { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_KeyDelta { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> DatItem_Control_Reverse { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_Control_Ways { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Ways2 { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_Control_Ways3 { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Port.Analogs
|
||||
public FilterItem<bool?> DatItem_Analogs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_Analog_Mask { get; private set; } = new FilterItem<string>();
|
||||
@@ -533,150 +532,6 @@ namespace SabreTools.Library.Filtering
|
||||
Machine_Runnable.Positive |= value.AsRunnable();
|
||||
break;
|
||||
|
||||
// Inputs
|
||||
case Field.Machine_Inputs:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Inputs.Neutral = false;
|
||||
else
|
||||
Machine_Inputs.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Service:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Input_Service.Neutral = false;
|
||||
else
|
||||
Machine_Input_Service.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Tilt:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Input_Tilt.Neutral = false;
|
||||
else
|
||||
Machine_Input_Tilt.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Players:
|
||||
if (negate)
|
||||
Machine_Input_Players.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Players.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Coins:
|
||||
if (negate)
|
||||
Machine_Input_Coins.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Coins.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Inputs.Controls
|
||||
case Field.Machine_Input_Controls:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Input_Controls.Neutral = false;
|
||||
else
|
||||
Machine_Input_Controls.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Type:
|
||||
if (negate)
|
||||
Machine_Input_Control_Type.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Type.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Player:
|
||||
if (negate)
|
||||
Machine_Input_Control_Player.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Player.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Buttons:
|
||||
if (negate)
|
||||
Machine_Input_Control_Buttons.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Buttons.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_RegButtons:
|
||||
if (negate)
|
||||
Machine_Input_Control_RegButtons.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_RegButtons.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Minimum:
|
||||
if (negate)
|
||||
Machine_Input_Control_Minimum.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Minimum.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Maximum:
|
||||
if (negate)
|
||||
Machine_Input_Control_Maximum.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Maximum.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Sensitivity:
|
||||
if (negate)
|
||||
Machine_Input_Control_Sensitivity.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Sensitivity.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_KeyDelta:
|
||||
if (negate)
|
||||
Machine_Input_Control_KeyDelta.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_KeyDelta.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Reverse:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Input_Control_Reverse.Neutral = false;
|
||||
else
|
||||
Machine_Input_Control_Reverse.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Ways:
|
||||
if (negate)
|
||||
Machine_Input_Control_Ways.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Ways.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Ways2:
|
||||
if (negate)
|
||||
Machine_Input_Control_Ways2.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Ways2.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Input_Control_Ways3:
|
||||
if (negate)
|
||||
Machine_Input_Control_Ways3.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Input_Control_Ways3.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
|
||||
// Ports.Analogs
|
||||
case Field.DatItem_Analogs:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Analogs.Neutral = false;
|
||||
else
|
||||
DatItem_Analogs.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Analog_Mask:
|
||||
if (negate)
|
||||
DatItem_Analog_Mask.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Analog_Mask.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1636,6 +1491,142 @@ namespace SabreTools.Library.Filtering
|
||||
DatItem_FeatureOverall.Positive |= value.AsFeatureStatus();
|
||||
break;
|
||||
|
||||
// Input
|
||||
case Field.DatItem_Service:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Service.Neutral = false;
|
||||
else
|
||||
DatItem_Service.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Tilt:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Tilt.Neutral = false;
|
||||
else
|
||||
DatItem_Tilt.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Players:
|
||||
if (negate)
|
||||
DatItem_Players.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Players.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Coins:
|
||||
if (negate)
|
||||
DatItem_Coins.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Coins.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Input.Controls
|
||||
case Field.DatItem_Controls:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Controls.Neutral = false;
|
||||
else
|
||||
DatItem_Controls.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Type:
|
||||
if (negate)
|
||||
DatItem_Control_Type.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Type.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Player:
|
||||
if (negate)
|
||||
DatItem_Control_Player.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Player.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Buttons:
|
||||
if (negate)
|
||||
DatItem_Control_Buttons.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Buttons.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_RegButtons:
|
||||
if (negate)
|
||||
DatItem_Control_RegButtons.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_RegButtons.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Minimum:
|
||||
if (negate)
|
||||
DatItem_Control_Minimum.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Minimum.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Maximum:
|
||||
if (negate)
|
||||
DatItem_Control_Maximum.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Maximum.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Sensitivity:
|
||||
if (negate)
|
||||
DatItem_Control_Sensitivity.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Sensitivity.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_KeyDelta:
|
||||
if (negate)
|
||||
DatItem_Control_KeyDelta.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_KeyDelta.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Reverse:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Control_Reverse.Neutral = false;
|
||||
else
|
||||
DatItem_Control_Reverse.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Ways:
|
||||
if (negate)
|
||||
DatItem_Control_Ways.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Ways.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Ways2:
|
||||
if (negate)
|
||||
DatItem_Control_Ways2.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Ways2.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_Control_Ways3:
|
||||
if (negate)
|
||||
DatItem_Control_Ways3.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Control_Ways3.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Port.Analogs
|
||||
case Field.DatItem_Analogs:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_Analogs.Neutral = false;
|
||||
else
|
||||
DatItem_Analogs.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_Analog_Mask:
|
||||
if (negate)
|
||||
DatItem_Analog_Mask.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_Analog_Mask.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Ram Option
|
||||
case Field.DatItem_Content:
|
||||
if (negate)
|
||||
|
||||
@@ -572,60 +572,6 @@ namespace SabreTools.Library.Tools
|
||||
case "runnable":
|
||||
return Field.Machine_Runnable;
|
||||
|
||||
case "inputs":
|
||||
return Field.Machine_Inputs;
|
||||
|
||||
case "input_service":
|
||||
return Field.Machine_Input_Service;
|
||||
|
||||
case "input_tilt":
|
||||
return Field.Machine_Input_Tilt;
|
||||
|
||||
case "input_players":
|
||||
return Field.Machine_Input_Players;
|
||||
|
||||
case "input_coins":
|
||||
return Field.Machine_Input_Coins;
|
||||
|
||||
case "input_controls":
|
||||
return Field.Machine_Input_Controls;
|
||||
|
||||
case "input_control_type":
|
||||
return Field.Machine_Input_Control_Type;
|
||||
|
||||
case "input_control_player":
|
||||
return Field.Machine_Input_Control_Player;
|
||||
|
||||
case "input_control_buttons":
|
||||
return Field.Machine_Input_Control_Buttons;
|
||||
|
||||
case "input_control_regbuttons":
|
||||
return Field.Machine_Input_Control_RegButtons;
|
||||
|
||||
case "input_control_minimum":
|
||||
return Field.Machine_Input_Control_Minimum;
|
||||
|
||||
case "input_control_maximum":
|
||||
return Field.Machine_Input_Control_Maximum;
|
||||
|
||||
case "input_control_sensitivity":
|
||||
return Field.Machine_Input_Control_Sensitivity;
|
||||
|
||||
case "input_control_keydelta":
|
||||
return Field.Machine_Input_Control_KeyDelta;
|
||||
|
||||
case "input_control_reverse":
|
||||
return Field.Machine_Input_Control_Reverse;
|
||||
|
||||
case "input_control_ways":
|
||||
return Field.Machine_Input_Control_Ways;
|
||||
|
||||
case "input_control_ways2":
|
||||
return Field.Machine_Input_Control_Ways2;
|
||||
|
||||
case "input_control_ways3":
|
||||
return Field.Machine_Input_Control_Ways3;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1098,6 +1044,58 @@ namespace SabreTools.Library.Tools
|
||||
case "featureoverall":
|
||||
return Field.DatItem_FeatureOverall;
|
||||
|
||||
// Input
|
||||
case "service":
|
||||
return Field.DatItem_Service;
|
||||
|
||||
case "tilt":
|
||||
return Field.DatItem_Tilt;
|
||||
|
||||
case "players":
|
||||
return Field.DatItem_Players;
|
||||
|
||||
case "coins":
|
||||
return Field.DatItem_Coins;
|
||||
|
||||
case "controls":
|
||||
return Field.DatItem_Controls;
|
||||
|
||||
case "control_type":
|
||||
return Field.DatItem_Control_Type;
|
||||
|
||||
case "control_player":
|
||||
return Field.DatItem_Control_Player;
|
||||
|
||||
case "control_buttons":
|
||||
return Field.DatItem_Control_Buttons;
|
||||
|
||||
case "control_regbuttons":
|
||||
return Field.DatItem_Control_RegButtons;
|
||||
|
||||
case "control_minimum":
|
||||
return Field.DatItem_Control_Minimum;
|
||||
|
||||
case "control_maximum":
|
||||
return Field.DatItem_Control_Maximum;
|
||||
|
||||
case "control_sensitivity":
|
||||
return Field.DatItem_Control_Sensitivity;
|
||||
|
||||
case "control_keydelta":
|
||||
return Field.DatItem_Control_KeyDelta;
|
||||
|
||||
case "control_reverse":
|
||||
return Field.DatItem_Control_Reverse;
|
||||
|
||||
case "control_ways":
|
||||
return Field.DatItem_Control_Ways;
|
||||
|
||||
case "control_ways2":
|
||||
return Field.DatItem_Control_Ways2;
|
||||
|
||||
case "control_ways3":
|
||||
return Field.DatItem_Control_Ways3;
|
||||
|
||||
// Port
|
||||
case "analogs":
|
||||
return Field.DatItem_Analogs;
|
||||
@@ -1673,6 +1671,8 @@ namespace SabreTools.Library.Tools
|
||||
return ItemType.Extension;
|
||||
case "feature":
|
||||
return ItemType.Feature;
|
||||
case "input":
|
||||
return ItemType.Input;
|
||||
case "instance":
|
||||
return ItemType.Instance;
|
||||
case "media":
|
||||
@@ -1715,6 +1715,7 @@ namespace SabreTools.Library.Tools
|
||||
"driver" => ItemType.Driver,
|
||||
"extension" => ItemType.Extension,
|
||||
"feature" => ItemType.Feature,
|
||||
"input" => ItemType.Input,
|
||||
"instance" => ItemType.Instance,
|
||||
"media" => ItemType.Media,
|
||||
"port" => ItemType.Port,
|
||||
@@ -2299,6 +2300,8 @@ namespace SabreTools.Library.Tools
|
||||
return "extension";
|
||||
case ItemType.Feature:
|
||||
return "feature";
|
||||
case ItemType.Input:
|
||||
return "input";
|
||||
case ItemType.Instance:
|
||||
return "instance";
|
||||
case ItemType.Media:
|
||||
@@ -2341,6 +2344,7 @@ namespace SabreTools.Library.Tools
|
||||
ItemType.Driver => "driver",
|
||||
ItemType.Extension => "extension",
|
||||
ItemType.Feature => "feature",
|
||||
ItemType.Input => "input",
|
||||
ItemType.Instance => "instance",
|
||||
ItemType.Media => "media",
|
||||
ItemType.Port => "port",
|
||||
|
||||
Reference in New Issue
Block a user