예제 #1
0
        public void ExportConfiguration(DomainModelService domainModel, string gameExecutableFilePath)
        {
            // Scenarios for each reversible code module
            // Scenario 1: If currently applied and should not be applied, apply unmodified code
            // Scenario 2: If currently not applied and should be applied, apply modified code
            // Scenario 3: If currently applied and should be applied, do nothing
            // Scenario 4: If currently not applied and should not be applied, do nothing

            // Compatibility
            var isGameCdFixApplied  = _gameCdFix.IsCodeModified(gameExecutableFilePath);
            var isGameCdFixRequired = domainModel.Configurations.DisableGameCd;

            if (isGameCdFixApplied != isGameCdFixRequired)
            {
                ApplyReversibleCode(_gameCdFix, isGameCdFixRequired, gameExecutableFilePath);
            }

            var isDisplayModeFixApplied  = _displayModeFix.IsCodeModified(gameExecutableFilePath);
            var isDisplayModeFixRequired = domainModel.Configurations.DisableColourMode;

            if (isDisplayModeFixApplied != isDisplayModeFixRequired)
            {
                ApplyReversibleCode(_displayModeFix, isDisplayModeFixRequired, gameExecutableFilePath);
            }

            var isSampleAppFixApplied  = _sampleAppFix.IsCodeModified(gameExecutableFilePath);
            var isSampleAppFixRequired = domainModel.Configurations.DisableSampleApp;

            if (isSampleAppFixApplied != isSampleAppFixRequired)
            {
                ApplyReversibleCode(_sampleAppFix, isSampleAppFixRequired, gameExecutableFilePath);
            }

            var isRaceSoundsFixApplied  = _raceSoundsFix.IsCodeModified(gameExecutableFilePath);
            var isRaceSoundsFixRequired = domainModel.Configurations.DisableMemoryResetForRaceSounds;

            if (isRaceSoundsFixApplied != isRaceSoundsFixRequired)
            {
                ApplyReversibleCode(_raceSoundsFix, isRaceSoundsFixRequired, gameExecutableFilePath);
            }

            // var isPitExitPriorityFixApplied = _pitExitPriorityFix.IsCodeModified(gameExecutableFilePath);       // TODO: Not implemented yet
            // var isPitExitPriorityFixRequired = domainModel.Configurations.DisablePitExitPriority;               // TODO: Not implemented yet
            // if (isPitExitPriorityFixApplied != isPitExitPriorityFixRequired)                                    // TODO: Not implemented yet
            // {                                                                                                   // TODO: Not implemented yet
            //     ApplyReversibleCode(_pitExitPriorityFix, isPitExitPriorityFixRequired, gameExecutableFilePath); // TODO: Not implemented yet
            // }                                                                                                   // TODO: Not implemented yet

            // Gameplay
            var isYellowFlagFixApplied  = _yellowFlagFix.IsCodeModified(gameExecutableFilePath);
            var isYellowFlagFixRequired = domainModel.Configurations.DisableYellowFlagPenalties;

            if (isYellowFlagFixApplied != isYellowFlagFixRequired)
            {
                ApplyReversibleCode(_yellowFlagFix, isYellowFlagFixRequired, gameExecutableFilePath);
            }

            var isCarDesignCalculationUpdateApplied  = _carDesignCalculationUpdate.IsCodeModified(gameExecutableFilePath);
            var isCarDesignCalculationUpdateRequired = domainModel.Configurations.EnableCarHandlingDesignCalculation;

            if (isCarDesignCalculationUpdateApplied != isCarDesignCalculationUpdateRequired)
            {
                ApplyReversibleCode(_carDesignCalculationUpdate, isCarDesignCalculationUpdateRequired, gameExecutableFilePath);
            }

            var isCarHandlingPerformanceFixApplied  = _carHandlingPerformanceFix.IsCodeModified(gameExecutableFilePath);
            var isCarHandlingPerformanceFixRequired = domainModel.Configurations.EnableCarPerformanceRaceCalcuation;

            if (isCarHandlingPerformanceFixApplied != isCarHandlingPerformanceFixRequired)
            {
                ApplyReversibleCode(_carHandlingPerformanceFix, isCarHandlingPerformanceFixRequired, gameExecutableFilePath);
            }

            _gameYearUpdate.SetGameYear(domainModel.Configurations.GameYear, gameExecutableFilePath);

            // Scenarios for each irreversible code module
            // Scenario 1: If currently not applied and should be applied, apply modified code
            // Scenario 2: If currently not applied and should not be applied, do nothing
            // Scenario 3: If currently applied, do nothing

            // Points Scoring System
            var isPointsScoringSystemDefaultApplied  = _pointsSystemF119912002Update.IsCodeModified(gameExecutableFilePath);
            var isPointsScoringSystemDefaultRequired = domainModel.Configurations.PointsScoringSystemDefault;

            if (!isPointsScoringSystemDefaultApplied && isPointsScoringSystemDefaultRequired)
            {
                ApplyIrreversibleCode(_pointsSystemF119912002Update, gameExecutableFilePath);
            }

            var isPointsScoringSystemOption1Applied  = _pointsSystemF119811990Update.IsCodeModified(gameExecutableFilePath);
            var isPointsScoringSystemOption1Required = domainModel.Configurations.PointsScoringSystemOption1;

            if (!isPointsScoringSystemOption1Applied && isPointsScoringSystemOption1Required)
            {
                ApplyIrreversibleCode(_pointsSystemF119811990Update, gameExecutableFilePath);
            }

            var isPointsScoringSystemOption2Applied  = _pointsSystemF120032009Update.IsCodeModified(gameExecutableFilePath);
            var isPointsScoringSystemOption2Required = domainModel.Configurations.PointsScoringSystemOption2;

            if (!isPointsScoringSystemOption2Applied && isPointsScoringSystemOption2Required)
            {
                ApplyIrreversibleCode(_pointsSystemF120032009Update, gameExecutableFilePath);
            }

            var isPointsScoringSystemOption3Applied  = _pointsSystemF1201020XxUpdate.IsCodeModified(gameExecutableFilePath);
            var isPointsScoringSystemOption3Required = domainModel.Configurations.PointsScoringSystemOption3;

            if (!isPointsScoringSystemOption3Applied && isPointsScoringSystemOption3Required)
            {
                ApplyIrreversibleCode(_pointsSystemF1201020XxUpdate, gameExecutableFilePath);
            }

            // Track Editor
            var isTrackEditorFixApplied  = _trackEditorFix.IsCodeModified(gameExecutableFilePath);
            var isTrackEditorFixRequired = domainModel.Configurations.EnableTrackEditor;

            if (isTrackEditorFixApplied != isTrackEditorFixRequired)
            {
                ApplyReversibleCode(_trackEditorFix, isTrackEditorFixRequired, gameExecutableFilePath);
            }
        }
예제 #2
0
        private void ExportGameConfiguration(string gameExecutablePath)
        {
            // Scenarios for each reversible code module
            // Scenario 1: If currently applied and should not be applied, apply unmodified code
            // Scenario 2: If currently not applied and should be applied, apply modified code
            // Scenario 3: If currently applied and should be applied, do nothing
            // Scenario 4: If currently not applied and should not be applied, do nothing

            var gameCdFix          = new GameCdFix(gameExecutablePath);
            var isGameCdFixApplied = gameCdFix.IsCodeModified();

            if (isGameCdFixApplied != IsGameCdFixRequired)
            {
                ApplyReversibleCode(gameCdFix, IsGameCdFixRequired);
            }

            var displayModeFix          = new DisplayModeFix(gameExecutablePath);
            var isDisplayModeFixApplied = displayModeFix.IsCodeModified();

            if (isDisplayModeFixApplied != IsDisplayModeFixRequired)
            {
                ApplyReversibleCode(displayModeFix, IsDisplayModeFixRequired);
            }

            var sampleAppFix          = new SampleAppFix(gameExecutablePath);
            var isSampleAppFixApplied = sampleAppFix.IsCodeModified();

            if (isSampleAppFixApplied != IsSampleAppFixRequired)
            {
                ApplyReversibleCode(sampleAppFix, IsSampleAppFixRequired);
            }

            var raceSoundsFix          = new RaceSoundsFix(gameExecutablePath);
            var isRaceSoundsFixApplied = raceSoundsFix.IsCodeModified();

            if (isRaceSoundsFixApplied != IsRaceSoundsFixRequired)
            {
                ApplyReversibleCode(raceSoundsFix, IsRaceSoundsFixRequired);
            }

            // TODO: var pitExitPriorityFix = new PitExitPriorityFix(gameExecutablePath);
            // TODO: var isPitExitPriorityFixApplied = pitExitPriorityFix.IsCodeModified();
            // TODO: if (isPitExitPriorityFixApplied != IsPitExitPriorityFixRequired)
            // TODO: {
            // TODO:     ApplyReversibleCode(pitExitPriorityFix, IsPitExitPriorityFixRequired);
            // TODO: }

            var yellowFlagFix          = new YellowFlagFix(gameExecutablePath);
            var isYellowFlagFixApplied = yellowFlagFix.IsCodeModified();

            if (isYellowFlagFixApplied != IsYellowFlagFixRequired)
            {
                ApplyReversibleCode(yellowFlagFix, IsYellowFlagFixRequired);
            }

            var carDesignCalculationUpdate = new CarDesignCalculationUpdate(gameExecutablePath);
            var isEnableCarHandlingDesignCalculationApplied = carDesignCalculationUpdate.IsCodeModified();

            if (isEnableCarHandlingDesignCalculationApplied != IsCarDesignCalculationUpdateRequired)
            {
                ApplyReversibleCode(carDesignCalculationUpdate, IsCarDesignCalculationUpdateRequired);
            }

            var carHandlingPerformanceFix = new CarHandlingPerformanceFix(gameExecutablePath);
            var isEnableCarPerformanceRaceCalcuationApplied = carHandlingPerformanceFix.IsCodeModified();

            if (isEnableCarPerformanceRaceCalcuationApplied != IsCarHandlingPerformanceFixRequired)
            {
                ApplyReversibleCode(carHandlingPerformanceFix, IsCarHandlingPerformanceFixRequired);
            }

            // Scenarios for each irreversible code module
            // Scenario 1: If currently not applied and should be applied, apply modified code
            // Scenario 2: If currently not applied and should not be applied, do nothing
            // Scenario 3: If currently applied, do nothing

            var pointsScoringSystemDefault          = new PointsSystemF119912002Update(gameExecutablePath);
            var isPointsScoringSystemDefaultApplied = pointsScoringSystemDefault.IsCodeModified();

            if (!isPointsScoringSystemDefaultApplied && IsPointsScoringSystemDefaultRequired)
            {
                ApplyIrreversibleCode(pointsScoringSystemDefault);
            }

            var pointsScoringSystemOption1          = new PointsSystemF119811990Update(gameExecutablePath);
            var isPointsScoringSystemOption1Applied = pointsScoringSystemOption1.IsCodeModified();

            if (!isPointsScoringSystemOption1Applied && IsPointsScoringSystemOption1Required)
            {
                ApplyIrreversibleCode(pointsScoringSystemOption1);
            }

            var pointsScoringSystemOption2          = new PointsSystemF120032009Update(gameExecutablePath);
            var isPointsScoringSystemOption2Applied = pointsScoringSystemOption2.IsCodeModified();

            if (!isPointsScoringSystemOption2Applied && IsPointsScoringSystemOption2Required)
            {
                ApplyIrreversibleCode(pointsScoringSystemOption2);
            }

            var pointsScoringSystemOption3          = new PointsSystemF1201020xxUpdate(gameExecutablePath);
            var isPointsScoringSystemOption3Applied = pointsScoringSystemOption3.IsCodeModified();

            if (!isPointsScoringSystemOption3Applied && IsPointsScoringSystemOption3Required)
            {
                ApplyIrreversibleCode(pointsScoringSystemOption3);
            }
        }