/// <summary> /// Initializes a new instance of the CrcData class. /// </summary> /// <param name="crc">CRC of the ROM file.</param> /// <param name="description">A brief description of the ROM variant.</param> /// <param name="incompatibilities">Describes known hardware incompatibilities associated with the ROM.</param> /// <param name="binConfigTemplate">The configuration template to use if a .cfg file for a .bin cannot be found.</param> public CrcData(uint crc, string description, IncompatibilityFlags incompatibilities, int binConfigTemplate) { Crc = crc; Description = description; Incompatibilities = incompatibilities; BinConfigTemplate = binConfigTemplate; }
public TestProgramInformation(uint crc, string description = null, IncompatibilityFlags incompatibilityFlags = IncompatibilityFlags.None) { if (crc != 0) { AddCrc(crc, description, incompatibilityFlags); } }
/// <inheritdoc /> public override bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities) { var added = !_crcs.ContainsKey(newCrc); if (added) { _crcs[newCrc] = new CrcData(newCrc, crcDescription, incompatibilities); } return(added); }
public bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities, uint cfgCrc) { var added = !_crcs.ContainsKey(newCrc); if (added) { _crcs[newCrc] = new CrcDataAdvanced(newCrc, crcDescription, incompatibilities, 0, cfgCrc); } return(added); }
public bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilityFlags) { var existingCrc = _crcs.FirstOrDefault(c => c.Crc == newCrc); var added = existingCrc == null; if (added) { var crcData = new CrcData(newCrc, crcDescription, incompatibilityFlags); _crcs.Add(crcData); } return(added); }
/// <inheritdoc /> public override bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities) { if (newCrc == 0) { throw new ArgumentOutOfRangeException(Resources.Strings.UserSpecifiedProgramInformation_AddInvalidCRCMessage); } KeyValuePair <string, IncompatibilityFlags> crcInfo; bool replacedEntry = _crcs.TryGetValue(newCrc, out crcInfo); _crcs[newCrc] = new KeyValuePair <string, IncompatibilityFlags>(crcDescription, incompatibilities); return(replacedEntry); }
/// <inheritdoc /> public virtual bool ModifyCrc(uint crc, string newCrcDescription, IncompatibilityFlags newIncompatibilityFlags) { return(IProgramInformationHelpers.ModifyCrc(this, crc, newCrcDescription, newIncompatibilityFlags)); }
/// <inheritdoc /> public abstract bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities);
/// <summary> /// Modify an existing CRC value in the program information. /// </summary> /// <param name="programInformation">The program information whose CRC data is to be modified.</param> /// <param name="crc">The CRC whose description is to be modified.</param> /// <param name="newCrcDescription">The new description of the CRC. If <c>null</c> the description is left unchanged.</param> /// <param name="newIncompatibilityFlags">The new incompatibility flags to assign.</param> /// <returns><c>true</c> if the new settings were applied, <c>false</c> if the CRC was not found.</returns> public static bool ModifyCrc(this IProgramInformation programInformation, uint crc, string newCrcDescription, IncompatibilityFlags newIncompatibilityFlags) { CrcData crcData = programInformation.Crcs.FirstOrDefault(x => x.Crc == crc); bool modifiedCrc = crcData != null; if (modifiedCrc) { if (newCrcDescription != null) { crcData.Description = newCrcDescription; } crcData.Incompatibilities = newIncompatibilityFlags; } return(modifiedCrc); }
/// <summary> /// Updates a set of ProgramFeatures to include an incompatibilities set in the given flags. /// </summary> /// <param name="incompatibilityFlags">Condensed incompatibility information.</param> /// <param name="programFeatures">The program features to update.</param> /// <returns>The updated program features.</returns> public static ProgramFeatures ApplyFlagsToProgramFeatures(this IncompatibilityFlags incompatibilityFlags, ProgramFeatures programFeatures) { if ((incompatibilityFlags & IncompatibilityFlags.Ntsc) == IncompatibilityFlags.Ntsc) { programFeatures.Ntsc = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Pal) == IncompatibilityFlags.Pal) { programFeatures.Pal = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.KeyboardComponent) == IncompatibilityFlags.KeyboardComponent) { programFeatures.KeyboardComponent = KeyboardComponentFeatures.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.SuperVideoArcade) == IncompatibilityFlags.SuperVideoArcade) { programFeatures.SuperVideoArcade = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.SuperVideoArcadeAltered) == IncompatibilityFlags.SuperVideoArcadeAltered) { programFeatures.SuperVideoArcade = FeatureCompatibility.Enhances; } if ((incompatibilityFlags & IncompatibilityFlags.Intellivoice) == IncompatibilityFlags.Intellivoice) { programFeatures.Intellivoice = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.IntellivisionII) == IncompatibilityFlags.IntellivisionII) { programFeatures.IntellivisionII = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.IntellivisionIIAltered) == IncompatibilityFlags.IntellivisionIIAltered) { programFeatures.IntellivisionII = FeatureCompatibility.Enhances; } if ((incompatibilityFlags & IncompatibilityFlags.Ecs) == IncompatibilityFlags.Ecs) { programFeatures.Ecs = EcsFeatures.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Tutorvision) == IncompatibilityFlags.Tutorvision) { programFeatures.Tutorvision = FeatureCompatibility.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Intellicart) == IncompatibilityFlags.Intellicart) { programFeatures.Intellicart = IntellicartCC3Features.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.CuttleCart3) == IncompatibilityFlags.CuttleCart3) { programFeatures.CuttleCart3 = CuttleCart3Features.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Jlp) == IncompatibilityFlags.Jlp) { programFeatures.Jlp = JlpFeatures.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.LtoFlash) == IncompatibilityFlags.LtoFlash) { programFeatures.LtoFlash = LtoFlashFeatures.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Bee3) == IncompatibilityFlags.Bee3) { programFeatures.Bee3 = Bee3Features.Incompatible; } if ((incompatibilityFlags & IncompatibilityFlags.Hive) == IncompatibilityFlags.Hive) { programFeatures.Hive = HiveFeatures.Incompatible; } return(programFeatures); }
/// <summary> /// Expands a set of condensed incompatibility flags to a full-fledged ProgramFeatures set. /// </summary> /// <param name="incompatibilityFlags">The flags to convert.</param> /// <returns>A ProgramFeatures object that includes all incompatibilities.</returns> /// <remarks>The default features are contained in the returned features for any incompatibility flag that is not set.</remarks> public static IProgramFeatures ToProgramFeatures(this IncompatibilityFlags incompatibilityFlags) { var programFeatures = new ProgramFeatures(); return(incompatibilityFlags.ApplyFlagsToProgramFeatures(programFeatures)); }
public CrcDataAdvanced(uint crc, string description, IncompatibilityFlags incompatibilities, int binConfigTemplate, uint cfgCrc) : base(crc, description, incompatibilities, binConfigTemplate) { CfgCrc = cfgCrc; }
public void IntvFunhouseXmlProgramInformation_GetCrcsWithAllCrcIncompatibilities_HasAllKnownIncompatibilities(IncompatibilityFlags expectedIncompatibilityFlag) { var info = new IntvFunhouseXmlProgramInformation() { CrcString = "0x22446688", CrcNotesString = string.Empty, CrcIncompatibilitiesString = "ffffffff", CfgFiles = "0" }; Assert.False(string.IsNullOrEmpty(info.CrcIncompatibilitiesString)); Assert.False(string.IsNullOrEmpty(info.CrcString)); Assert.False(string.IsNullOrEmpty(info.CfgFiles)); Assert.True(info.Crcs.First().Incompatibilities.HasFlag(expectedIncompatibilityFlag)); }
public bool ModifyCrc(uint crc, string newCrcDescription, IncompatibilityFlags newIncompatibilityFlags) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the CrcData class. /// </summary> /// <param name="crc">CRC of the ROM file.</param> /// <param name="description">A brief description of the ROM variant.</param> /// <param name="incompatibilities">Describes known hardware incompatibilities associated with the ROM.</param> /// <exception cref="System.ArgumentException">Thrown if crc is zero.</exception> public CrcData(uint crc, string description, IncompatibilityFlags incompatibilities) : this(crc, description, incompatibilities, 0) { }
public bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilityFlags) { throw new NotImplementedException(); }
/// <summary> /// Creates a new instance of the UserSpecifiedProgramInformation class. /// </summary> /// <param name="crc">The CRC of the program's ROM file.</param> /// <param name="title">The title of the program.</param> /// <param name="year">Copyright date of the program.</param> /// <param name="features">The features of the program.</param> /// <param name="crcDescription">Description of the variant of the program identified by its CRC.</param> /// <param name="incompatibilities">Describes known hardware incompatibilities associated with the ROM.</param> /// <exception cref="ArgumentException">Thrown if crc is zero.</exception> /// <exception cref="ArgumentNullException">Thrown if any metadata values are <c>null</c>.</exception> public UserSpecifiedProgramInformation(uint crc, string title, string year, ProgramFeatures features, string crcDescription, IncompatibilityFlags incompatibilities) { if (crc == 0) { throw new ArgumentException(Resources.Strings.UserSpecifiedProgramInformation_CreatedWithInvalidCRCMessage); } _title = string.IsNullOrEmpty(title) ? UnknownProgramTitle : title; _year = year; _features = features; _crcs[crc] = new KeyValuePair <string, IncompatibilityFlags>(crcDescription, incompatibilities); _origin = ProgramInformationOrigin.UserDefined; FinishInitialization(); }
public bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilityFlags) { _crcs.Add(new CrcData(newCrc, crcDescription, incompatibilityFlags)); return(true); }
/// <inheritdoc /> public override bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities) { return(AddCrc(newCrc, crcDescription, incompatibilities, 0u)); }
/// <inheritdoc /> public override bool AddCrc(uint newCrc, string crcDescription, IncompatibilityFlags incompatibilities) { throw new InvalidOperationException(); }
public void IncompatibilityFlags_ToProgramFeatures_ProducesExpectedProgramFeatures(IncompatibilityFlags incompatibilityFlags, IProgramFeatures expectedFeatures) { var featuresWithIncompatibility = incompatibilityFlags.ToProgramFeatures(); Assert.Equal(expectedFeatures, featuresWithIncompatibility); }