Wire up remaining OpenMSX DatItem fields

This commit is contained in:
Matt Nadareski
2020-08-21 23:48:35 -07:00
parent 1e6fe45b4d
commit 93b774b69a
15 changed files with 690 additions and 81 deletions

View File

@@ -31,6 +31,12 @@
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,

View File

@@ -26,6 +26,25 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
/// <summary>
/// Represents the OpenMSX original value
/// </summary>
public class OpenMSXOriginal
{
public string Original { get; set; }
public bool? Value { get; set; }
public OpenMSXOriginal(string original, bool? value)
{
Original = original;
Value = value;
}
}
#endregion
#region SoftwareList
/// <summary>

View File

@@ -107,6 +107,12 @@ namespace SabreTools.Library.DatItems
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,
@@ -159,7 +165,9 @@ namespace SabreTools.Library.DatItems
return false;
// Filter on description
if (filter.Description.MatchesNeutral(null, Description) == false)
if (filter.Description.MatchesPositiveSet(Description) == false)
return false;
if (filter.Description.MatchesNegativeSet(Description) == true)
return false;
// Filter on default

View File

@@ -31,6 +31,12 @@
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,

View File

@@ -69,6 +69,41 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
/// <summary>
/// OpenMSX sub item type
/// </summary>
[JsonProperty("original")]
public OpenMSXOriginal Original { get; set; }
/// <summary>
/// OpenMSX sub item type
/// </summary>
[JsonProperty("openmsx_subtype")]
public OpenMSXSubType OpenMSXSubType { get; set; }
/// <summary>
/// OpenMSX sub item type
/// </summary>
/// <remarks>Not related to the subtype above</remarks>
[JsonProperty("openmsx_type")]
public string OpenMSXType { get; set; }
/// <summary>
/// Item remark (like a comment)
/// </summary>
[JsonProperty("remark")]
public string Remark { get; set; }
/// <summary>
/// Boot state
/// </summary>
[JsonProperty("boot")]
public string Boot { get; set; }
#endregion
#region SoftwareList Fields
/// <summary>
@@ -160,6 +195,13 @@ namespace SabreTools.Library.DatItems
Field.AltName,
Field.AltTitle,
// OpenMSX
Field.Original,
Field.OpenMSXSubType,
Field.OpenMSXType,
Field.Remark,
Field.Boot,
//SoftwareList
Field.PartName,
Field.PartInterface,
@@ -286,15 +328,47 @@ namespace SabreTools.Library.DatItems
switch (field)
{
#region Common
case Field.Name:
fieldValue = Name;
break;
#endregion
#region AttractMode
case Field.AltName:
fieldValue = AltName;
break;
case Field.AltTitle:
fieldValue = AltTitle;
break;
#endregion
#region OpenMSX
case Field.Original:
fieldValue = Original.Original;
break;
case Field.OpenMSXSubType:
fieldValue = OpenMSXSubType.ToString();
break;
case Field.OpenMSXType:
fieldValue = OpenMSXType;
break;
case Field.Remark:
fieldValue = Remark;
break;
case Field.Boot:
fieldValue = Boot;
break;
#endregion
#region SoftwareList
case Field.PartName:
fieldValue = PartName;
break;
@@ -323,6 +397,8 @@ namespace SabreTools.Library.DatItems
fieldValue = LoadFlag;
break;
#endregion
case Field.NULL:
default:
return string.Empty;
@@ -361,6 +437,25 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
if (mappings.Keys.Contains(Field.Original))
Original = new OpenMSXOriginal(mappings[Field.Original], null);
if (mappings.Keys.Contains(Field.OpenMSXSubType))
OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType();
if (mappings.Keys.Contains(Field.OpenMSXType))
OpenMSXType = mappings[Field.OpenMSXType];
if (mappings.Keys.Contains(Field.Remark))
Remark = mappings[Field.Remark];
if (mappings.Keys.Contains(Field.Boot))
Boot = mappings[Field.Boot];
#endregion
#region SoftwareList
if (mappings.Keys.Contains(Field.PartName))
@@ -625,6 +720,40 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
// Filter on original
if (filter.Original.MatchesPositiveSet(Original.Original) == false)
return false;
if (filter.Original.MatchesNegativeSet(Original.Original) == true)
return false;
// Filter on OpenMSX subtype
if (filter.SubType.MatchesPositiveSet(OpenMSXSubType) == false)
return false;
if (filter.SubType.MatchesNegativeSet(OpenMSXSubType) == true)
return false;
// Filter on OpenMSX type
if (filter.OpenMSXType.MatchesPositiveSet(OpenMSXType) == false)
return false;
if (filter.OpenMSXType.MatchesNegativeSet(OpenMSXType) == true)
return false;
// Filter on remark
if (filter.Remark.MatchesPositiveSet(Remark) == false)
return false;
if (filter.Remark.MatchesNegativeSet(Remark) == true)
return false;
// Filter on boot
if (filter.Boot.MatchesPositiveSet(Boot) == false)
return false;
if (filter.Boot.MatchesNegativeSet(Boot) == true)
return false;
#endregion
#region SoftwareList
// Filter on part name
@@ -708,6 +837,25 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
if (fields.Contains(Field.Original))
Original = null;
if (fields.Contains(Field.OpenMSXSubType))
OpenMSXSubType = OpenMSXSubType.NULL;
if (fields.Contains(Field.OpenMSXType))
OpenMSXType = null;
if (fields.Contains(Field.Remark))
Remark = null;
if (fields.Contains(Field.Boot))
Boot = null;
#endregion
#region SoftwareList
if (fields.Contains(Field.PartName))
@@ -837,6 +985,25 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
if (fields.Contains(Field.Original))
Original = item.Original;
if (fields.Contains(Field.OpenMSXSubType))
OpenMSXSubType = item.OpenMSXSubType;
if (fields.Contains(Field.OpenMSXType))
OpenMSXType = item.OpenMSXType;
if (fields.Contains(Field.Remark))
Remark = item.Remark;
if (fields.Contains(Field.Boot))
Boot = item.Boot;
#endregion
#region SoftwareList
if (fields.Contains(Field.PartName))

View File

@@ -295,6 +295,12 @@ namespace SabreTools.Library.DatItems
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,
@@ -341,6 +347,12 @@ namespace SabreTools.Library.DatItems
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,

View File

@@ -121,6 +121,16 @@ namespace SabreTools.Library.DatItems
#endregion
#region OpenMSX
Original,
OpenMSXSubType,
OpenMSXType,
Remark,
Boot,
#endregion
#region SoftwareList
PartName,
@@ -202,6 +212,18 @@ namespace SabreTools.Library.DatItems
Blank = 99, // This is not a real type, only used internally
}
/// <summary>
/// Determine which OpenMSX subtype an item is
/// </summary>
[Flags]
public enum OpenMSXSubType
{
NULL = 0,
Rom = 1,
MegaRom = 2,
SCCPlusCart = 3,
}
/// <summary>
/// Determine what type of machine it is
/// </summary>

View File

@@ -135,6 +135,12 @@ namespace SabreTools.Library.DatItems
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,

View File

@@ -377,6 +377,12 @@ namespace SabreTools.Library.DatItems
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,

View File

@@ -31,6 +31,12 @@
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
PartName = this.PartName,
PartInterface = this.PartInterface,
Features = this.Features,