private static ProgramFeatures CreateProgramFeaturesWithoutCoreCompatibility(LuigiFeatureFlags featuresUnderTest)
        {
            var programFeaturesHavingNoLuigiFeatureFlags = new ProgramFeatures()
            {
                Ecs               = EcsFeatures.Incompatible,
                IntellivisionII   = FeatureCompatibility.Incompatible,
                Intellivoice      = FeatureCompatibility.Incompatible,
                KeyboardComponent = KeyboardComponentFeatures.Incompatible,
            };

            if (featuresUnderTest.ExtendedPeripheralCompatabilityBitsVersion() > 0)
            {
                programFeaturesHavingNoLuigiFeatureFlags.Tutorvision = FeatureCompatibility.Incompatible;
            }
            programFeaturesHavingNoLuigiFeatureFlags.SetUnrecongizedRomFeatures();

            return(programFeaturesHavingNoLuigiFeatureFlags);
        }
Ejemplo n.º 2
0
        /// <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);
        }