Esempio n. 1
0
        private void ImportGameConfiguration(string gameExecutablePath)
        {
            IsGameCdFixApplied      = new GameCdFix(gameExecutablePath).IsCodeModified();
            IsDisplayModeFixApplied = new DisplayModeFix(gameExecutablePath).IsCodeModified();
            IsSampleAppFixApplied   = new SampleAppFix(gameExecutablePath).IsCodeModified();
            IsRaceSoundsFixApplied  = new RaceSoundsFix(gameExecutablePath).IsCodeModified();
            // TODO: IsPitExitPriorityFixApplied = new PitExitPriorityFix(gameExecutablePath).IsCodeModified();

            IsYellowFlagFixApplied = new YellowFlagFix(gameExecutablePath).IsCodeModified();
            IsCarDesignCalculationUpdateApplied = new CarDesignCalculationUpdate(gameExecutablePath).IsCodeModified();
            IsCarHandlingPerformanceFixApplied  = new CarHandlingPerformanceFix(gameExecutablePath).IsCodeModified();

            IsPointsScoringSystemDefaultApplied = new PointsSystemF119912002Update(gameExecutablePath).IsCodeModified();
            IsPointsScoringSystemOption1Applied = new PointsSystemF119811990Update(gameExecutablePath).IsCodeModified();
            IsPointsScoringSystemOption2Applied = new PointsSystemF120032009Update(gameExecutablePath).IsCodeModified();
            IsPointsScoringSystemOption3Applied = new PointsSystemF1201020xxUpdate(gameExecutablePath).IsCodeModified();

            // TODO: IsCommentaryModifiedApplied = ???;
        }
 public GameExecutableCodePatcher(
     CodeShiftPatcher codeShiftPatcher,
     GlobalUnlockPatcher globalUnlockPatcher,
     JumpBypassPatcher jumpBypassPatcher,
     SwitchIdiomPatcher switchIdiomPatcher,
     GameYearUpdate gameYearUpdate,
     PointsSystemF119912002Update pointsSystemF119912002Update,
     PointsSystemF119811990Update pointsSystemF119811990Update,
     PointsSystemF120032009Update pointsSystemF120032009Update,
     PointsSystemF1201020xxUpdate pointsSystemF1201020XxUpdate,
     GameCdFix gameCdFix,
     DisplayModeFix displayModeFix,
     SampleAppFix sampleAppFix,
     RaceSoundsFix raceSoundsFix,
     YellowFlagFix yellowFlagFix,
     CarDesignCalculationUpdate carDesignCalculationUpdate,
     CarHandlingPerformanceFix carHandlingPerformanceFix,
     TrackEditorFix trackEditorFix)
 {
     _codeShiftPatcher             = codeShiftPatcher ?? throw new ArgumentNullException(nameof(codeShiftPatcher));
     _globalUnlockPatcher          = globalUnlockPatcher ?? throw new ArgumentNullException(nameof(globalUnlockPatcher));
     _jumpBypassPatcher            = jumpBypassPatcher ?? throw new ArgumentNullException(nameof(jumpBypassPatcher));
     _switchIdiomPatcher           = switchIdiomPatcher ?? throw new ArgumentNullException(nameof(switchIdiomPatcher));
     _gameYearUpdate               = gameYearUpdate ?? throw new ArgumentNullException(nameof(gameYearUpdate));
     _pointsSystemF119912002Update = pointsSystemF119912002Update ?? throw new ArgumentNullException(nameof(pointsSystemF119912002Update));
     _pointsSystemF119811990Update = pointsSystemF119811990Update ?? throw new ArgumentNullException(nameof(pointsSystemF119811990Update));
     _pointsSystemF120032009Update = pointsSystemF120032009Update ?? throw new ArgumentNullException(nameof(pointsSystemF120032009Update));
     _pointsSystemF1201020XxUpdate = pointsSystemF1201020XxUpdate ?? throw new ArgumentNullException(nameof(pointsSystemF1201020XxUpdate));
     _gameCdFix                  = gameCdFix ?? throw new ArgumentNullException(nameof(gameCdFix));
     _displayModeFix             = displayModeFix ?? throw new ArgumentNullException(nameof(displayModeFix));
     _sampleAppFix               = sampleAppFix ?? throw new ArgumentNullException(nameof(sampleAppFix));
     _raceSoundsFix              = raceSoundsFix ?? throw new ArgumentNullException(nameof(raceSoundsFix));
     _yellowFlagFix              = yellowFlagFix ?? throw new ArgumentNullException(nameof(yellowFlagFix));
     _carDesignCalculationUpdate = carDesignCalculationUpdate ?? throw new ArgumentNullException(nameof(carDesignCalculationUpdate));
     _carHandlingPerformanceFix  = carHandlingPerformanceFix ?? throw new ArgumentNullException(nameof(carHandlingPerformanceFix));
     _trackEditorFix             = trackEditorFix ?? throw new ArgumentNullException(nameof(trackEditorFix));
 }
Esempio n. 3
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);
            }
        }