/// <summary> /// Converts JlpFeatures to LuigiFeatureFlags. /// </summary> /// <param name="features">The JLP features to convert.</param> /// <returns>The JLP feature flags represented as LuigiFeatureFlags.</returns> public static LuigiFeatureFlags ToLuigiFeatureFlags(this JlpFeatures features) { var luigiFeatureFlags = ((FeatureCompatibility)features & FeatureCompatibilityHelpers.ValidFeaturesMask).ToLuigiFeatureFlags(FeatureCategory.Jlp); var minimumFlashSaveDataSectorsCount = features.MinimumFlashSaveDataSectorsCount(); luigiFeatureFlags |= minimumFlashSaveDataSectorsCount.MinimumFlashSaveDataSectorsCountToLuigiFeatureFlags(); return(luigiFeatureFlags); }
/// <inheritdoc /> public IProgramFeaturesBuilder WithJlpFeatures(JlpFeatures jlpFeatures) { _programFeatures.Jlp = jlpFeatures; return(this); }
/// <summary> /// Gets the minimum number of JLP Flash save data sectors encoded in the feature bits. /// </summary> /// <param name="features">The JLP features including the save data sectors count.</param> /// <returns>The save data sectors.</returns> public static ushort MinimumFlashSaveDataSectorsCount(this JlpFeatures features) { var minimumFlashSaveDataSectorsCount = (ushort)((uint)(features & FlashSaveDataSectorsCountMask) >> FlashSaveDataSectorsOffset); return(minimumFlashSaveDataSectorsCount); }
public void LuigiFeatureFlags_LuigiFeatureFlagsForJlpToProgramFeatures_ProduceCorrectlyFormedProgramFeaturesJlpFields(LuigiFeatureFlags flagsToTest, JlpHardwareVersion expectedJlpHardwareVersion, JlpFeatures expectedJlpFeatures) { var expectedProgramFeatures = CreateProgramFeaturesWithoutCoreCompatibility(flagsToTest); expectedProgramFeatures.JlpHardwareVersion = expectedJlpHardwareVersion; expectedProgramFeatures.Jlp = expectedJlpFeatures; var programFeatures = flagsToTest.ToProgramFeatures(); Assert.Equal(expectedProgramFeatures, programFeatures); }