/// <summary> /// Convert LuigiFeatureFlags2 into a ProgramFeatures object. /// </summary> /// <param name="featureFlags2">The flags to convert,</param> /// <returns>ProgramFeatures representing the compatibility modes described by the feature flags.</returns> public static ProgramFeatures ToProgramFeatures(this LuigiFeatureFlags2 featureFlags2) { // No relevant features are currently defined in LuigiFeatureFlags2. var programFeatures = ProgramFeatures.GetUnrecognizedRomFeatures(); return(programFeatures); }
/// <summary> /// Set the features that indicate a ROM should be treated as 'unrecognized'. /// </summary> /// <param name="programFeatures">The <see cref="ProgramFeatures"/> whose features should be marked to indicate is not recognized.</param> public static void SetUnrecongizedRomFeatures(this ProgramFeatures programFeatures) { var unrecognizedFeatures = ProgramFeatures.GetUnrecognizedRomFeatures(); programFeatures.GeneralFeatures |= GeneralFeatures.UnrecognizedRom; programFeatures.Ntsc = unrecognizedFeatures.Ntsc; programFeatures.Pal = unrecognizedFeatures.Pal; }
public void ProgramFeatures_ClearUnrecongizedRomFeatures_ClearsFeaturesForUnrecognizedRom() { var features = ProgramFeatures.GetUnrecognizedRomFeatures(); features.ClearUnrecongizedRomFeatures(); Assert.False(features.GeneralFeatures.HasFlag(GeneralFeatures.UnrecognizedRom)); Assert.Equal(FeatureCompatibility.Tolerates, features.Ntsc); Assert.Equal(FeatureCompatibility.Tolerates, features.Pal); }
public void UserProgramInformation_SetFeaturesToUnrecognizedFeatures_DoesNotModifyInformation() { var information = new UserSpecifiedProgramInformation(8); Assert.False(information.IsModified); information.Features = ProgramFeatures.GetUnrecognizedRomFeatures(); Assert.Equal(ProgramFeatures.GetUnrecognizedRomFeatures(), information.Features); Assert.False(information.IsModified); }
public void IntvFunhouseXmlProgramInformation_SetFeatures_UpdatesFeatures() { var info = new IntvFunhouseXmlProgramInformation(); var originalFeatures = info.Features; info.Features = ProgramFeatures.GetUnrecognizedRomFeatures(); var newFeatures = info.Features; Assert.NotNull(originalFeatures); Assert.NotNull(newFeatures); Assert.NotEqual(newFeatures, originalFeatures); }
/// <summary> /// Get additional ROM features directly from the ROM if possible. /// </summary> /// <param name="rom">The ROM whose features are desired.</param> /// <returns>The ROM features.</returns> /// <remarks>At this time, the implementation only extracts additional features from LUIGI-format ROMs. Future updates /// may support parsing .cfg files associated with BIN format ROMs.</remarks> public static ProgramFeatures GetProgramFeatures(this IRom rom) { var features = ProgramFeatures.GetUnrecognizedRomFeatures(); // TODO: Add support for CFGVAR and ROM metadata features! if (rom.Format == RomFormat.Luigi) { var header = rom.GetLuigiHeader(); features = ProgramFeatures.Combine(features, header.Features.ToProgramFeatures()); features = ProgramFeatures.Combine(features, header.Features2.ToProgramFeatures()); } return(features); }
public void IProgramInformation_GetDatabaseCodeOnUnmergedProgramInformation_ReturnsExpectedCode() { var information = new UnmergedProgramInformation( "dude", "The Big Lebowski", "Coen Brothers", "1998", new[] { 1234u }, new[] { "Duuude!" }, new[] { 0 }, ProgramFeatures.GetUnrecognizedRomFeatures()); Assert.Equal("dude", information.GetDatabaseCode()); }
public void MergedProgramInformationTable_MergedWithNonEmptyTable_HasPrograms() { var mergedInformationTable = new MergedProgramInformationTable(); var testProgramInformation = new TestProgramInformation() { Title = "Marty McTesterson", Features = ProgramFeatures.GetUnrecognizedRomFeatures() }; testProgramInformation.AddCrcs(1); var table = new TestProgramInformationTable(); table.AddEntries(testProgramInformation); mergedInformationTable.MergeTable(table); Assert.True(mergedInformationTable.Programs.Any()); }
public void MergedProgramInformationTable_FindRomWithProgramIdentifier_FindsInformationAsExpected() { var mergedInformationTable = new MergedProgramInformationTable(); var testProgramIdentifier = new ProgramIdentifier(0x123u, 0x456u); var testProgramInformation = new TestProgramInformation() { Title = "Buffy Buckingham", Features = ProgramFeatures.GetUnrecognizedRomFeatures() }; testProgramInformation.AddCrcs(3); testProgramInformation.AddCrc(testProgramIdentifier.DataCrc, "Version 0", IncompatibilityFlags.Tutorvision, testProgramIdentifier.OtherData); var table = new TestProgramInformationTable(); table.AddEntries(testProgramInformation); mergedInformationTable.MergeTable(table); var foundInformation = mergedInformationTable.FindProgram(testProgramIdentifier); Assert.NotNull(foundInformation); }
public void IProgramInformation_MergeAllFieldsFromMultipleSources_CorrectlyMerges() { var emptyInformation = new TestProgramInformation(); var titleSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation() { Title = "Hey der" }, ProgramInformationMergeFieldsFlags.All); var vendorSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation() { Title = " Buddy, ", Vendor = "howya doin" }, ProgramInformationMergeFieldsFlags.All); var yearSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation() { Vendor = "ya hoser", Year = "1984" }, ProgramInformationMergeFieldsFlags.All); var features = (ProgramFeatures) new ProgramFeaturesBuilder().WithInitialFeatures(ProgramFeatures.GetUnrecognizedRomFeatures()).WithSuperVideoArcadeCompatibility(FeatureCompatibility.Enhances).Build(); var featuresSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation() { Features = features, Year = "1988" }, ProgramInformationMergeFieldsFlags.All); var shortNameSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation() { ShortName = "ShortRound" }, ProgramInformationMergeFieldsFlags.All); var crcsSource = new Tuple <IProgramInformation, ProgramInformationMergeFieldsFlags>(new TestProgramInformation(), ProgramInformationMergeFieldsFlags.All); Assert.True(crcsSource.Item1.AddCrc(0x246801u, "uffdah", IncompatibilityFlags.KeyboardComponent)); var mergedInformation = emptyInformation.Merge(ProgramInformationMergeFieldsFlags.All, titleSource, vendorSource, yearSource, featuresSource, shortNameSource, crcsSource); Assert.Equal(titleSource.Item1.Title, mergedInformation.Title); Assert.Equal(vendorSource.Item1.Vendor, mergedInformation.Vendor); Assert.Equal(yearSource.Item1.Year, mergedInformation.Year); Assert.Equal(featuresSource.Item1.Features, mergedInformation.Features); Assert.Equal(shortNameSource.Item1.ShortName, mergedInformation.ShortName); Assert.Equal(crcsSource.Item1.Crcs, mergedInformation.Crcs); }
public void LuigiFeatureFlags2_ToProgramFeatures_ProducesCorrectFeatures(LuigiFeatureFlags2 featureBits) { Assert.Equal(ProgramFeatures.GetUnrecognizedRomFeatures(), featureBits.ToProgramFeatures()); }
/// <summary> /// Convert LuigiFeatureFlags into a ProgramFeatures object. /// </summary> /// <param name="featureFlags">The flags to convert,</param> /// <returns>ProgramFeatures representing the compatibility modes described by the feature flags.</returns> public static ProgramFeatures ToProgramFeatures(this LuigiFeatureFlags featureFlags) { var programFeatures = ProgramFeatures.GetUnrecognizedRomFeatures(); var intellivoiceCompatibililty = (uint)(featureFlags & LuigiFeatureFlags.IntellivoiceMask); programFeatures.Intellivoice = (FeatureCompatibility)(intellivoiceCompatibililty >> IntellivoiceOffset); var ecsCompatibility = (uint)(featureFlags & LuigiFeatureFlags.EcsMask); programFeatures.Ecs = (EcsFeatures)(ecsCompatibility >> EcsOffset); var intellivisionIICompatibility = (uint)(featureFlags & LuigiFeatureFlags.IntellivisionIIMask); programFeatures.IntellivisionII = (FeatureCompatibility)(intellivisionIICompatibility >> IntellivisionIIOffset); var keyboardComponentCompatibility = (uint)(featureFlags & LuigiFeatureFlags.KeyboardComponentMask); programFeatures.KeyboardComponent = (KeyboardComponentFeatures)(keyboardComponentCompatibility >> KeyboardComponentOffset); var extendedPeripheralCompatibilityVersion = featureFlags.ExtendedPeripheralCompatabilityBitsVersion(); if (extendedPeripheralCompatibilityVersion > 0) { var tutorvisionCompatibility = (uint)(featureFlags & LuigiFeatureFlags.TutorVisionMask); programFeatures.Tutorvision = (FeatureCompatibility)(tutorvisionCompatibility >> TutorVisionOffset); } if (extendedPeripheralCompatibilityVersion > 1) { // TBD } if (extendedPeripheralCompatibilityVersion > 2) { // TBD } var jlpAccelerationCompatibility = (uint)(featureFlags & LuigiFeatureFlags.JlpAccelerationMask); programFeatures.Jlp = (JlpFeatures)(jlpAccelerationCompatibility >> JlpAccelerationOffset); programFeatures.JlpFlashMinimumSaveSectors = featureFlags.MinimumFlashSaveDataSectors(); if (programFeatures.JlpFlashMinimumSaveSectors > 0) { programFeatures.Jlp |= JlpFeatures.SaveDataRequired; } if ((jlpAccelerationCompatibility != 0) || (programFeatures.JlpFlashMinimumSaveSectors > 0)) { if (programFeatures.JlpHardwareVersion == JlpHardwareVersion.None) { programFeatures.JlpHardwareVersion = JlpHardwareVersion.Jlp03; } } var ltoFlashMemoryMapper = (ulong)(featureFlags & LuigiFeatureFlags.LtoFlashMemoryMapperEnabled); if (ltoFlashMemoryMapper != 0) { programFeatures.LtoFlash |= LtoFlashFeatures.LtoFlashMemoryMapped; } return(programFeatures); }