Exemplo n.º 1
0
 private static void RevertFileChanges()
 {
     PresetsPerModeBackup.Revert();
     WeatherSpecificCloudsHelper.Revert();
     WeatherSpecificTyreSmokeHelper.Revert();
     WeatherSpecificVideoSettingsHelper.Revert();
     WeatherSpecificLightingHelper.Revert();
     CarSpecificControlsPresetHelper.Revert();
     CarCustomDataHelper.Revert();
     CopyFilterToSystemForOculusHelper.Revert();
     AcShadowsPatcher.Revert();
 }
Exemplo n.º 2
0
        private static void StartAsync_Prepare(Game.StartProperties properties)
        {
            if (!_nationCodesProviderSet)
            {
                _nationCodesProviderSet = true;
                try {
                    Game.NationCodeProvider = NationCodeProvider.Instance;
                } catch (Exception e) {
                    Logging.Unexpected(e);
                }
            }

            AcSettingsHolder.Graphics.FixShadowMapBias();
            CarCustomDataHelper.Revert();

            if (SettingsHolder.Drive.CheckAndFixControlsOrder)
            {
                try {
                    AcSettingsHolder.Controls.FixControllersOrder();
                } catch (Exception e) {
                    VisualCppTool.OnException(e, null);
                }
            }

            if (SettingsHolder.Common.FixResolutionAutomatically)
            {
                Logging.Debug("Trying to fix resolution just in case…");
                AcSettingsHolder.Video.EnsureResolutionIsCorrect();
            }

            properties.SetAdditional(new TrackDetails());
            properties.SetAdditional(
                new WeatherProceduralHelper(properties.ConditionProperties != null && properties.ConditionProperties.RoadTemperature == null));
            properties.SetAdditional(new WeatherSpecificLightingHelper());

            if (SettingsHolder.Drive.WeatherSpecificClouds)
            {
                properties.SetAdditional(new WeatherSpecificCloudsHelper());
            }

            if (SettingsHolder.Drive.WeatherSpecificTyreSmoke)
            {
                properties.SetAdditional(new WeatherSpecificTyreSmokeHelper());
            }

            if (File.Exists(properties.GetAdditional <CustomTrackState>()?.Filename))
            {
                properties.SetAdditional(new CustomTrackPropertiesHelper(properties.GetAdditional <CustomTrackState>()?.Filename ?? string.Empty));
            }

            if (SettingsHolder.Live.RsrEnabled && SettingsHolder.Live.RsrDisableAppAutomatically)
            {
                PrepareRaceModeRsr(properties);
            }

            var carId = properties.BasicProperties?.CarId;

            if (carId != null)
            {
                if (SettingsHolder.Drive.CamberExtravaganzaIntegration)
                {
                    CamberExtravaganzaHelper.UpdateDatabase(carId);
                }

                if (SettingsHolder.Drive.SidekickIntegration)
                {
                    SidekickHelper.UpdateSidekickDatabase(carId);
                }

                if (SettingsHolder.Drive.SidekickOdometerExportValues)
                {
                    SidekickHelper.OdometerExport(carId);
                }

                if (SettingsHolder.Drive.RaceEssentialsIntegration)
                {
                    RaceEssentialsHelper.UpdateRaceEssentialsDatabase(carId, false);
                }

                if (SettingsHolder.Drive.StereoOdometerExportValues)
                {
                    StereoOdometerHelper.Export(carId);
                }

                if (PatchHelper.IsFeatureSupported(PatchHelper.FeatureNeedsOdometerValue))
                {
                    var car = CarsManager.Instance.GetById(carId);
                    if (car != null)
                    {
                        properties.SetAdditional(new DrivenDistance(car.TotalDrivenDistance));
                    }
                }
            }

            properties.SetAdditional(new ModeSpecificPresetsHelper());
            properties.SetAdditional(new WeatherSpecificVideoSettingsHelper());
            properties.SetAdditional(new CarSpecificControlsPresetHelper());
            properties.SetAdditional(new CarRaceTextures());

            if (PatchHelper.GetInstalledVersion() != null)
            {
                properties.SetAdditional(new AcPatchTrackOutline());
            }

            properties.SetAdditional(new ExtraHotkeysRaceHelper());

            if (SettingsHolder.Drive.CopyFilterToSystemForOculus &&
                (AcSettingsHolder.Video.CameraMode.Id == "OCULUS" || AcSettingsHolder.Video.CameraMode.Id == "OPENVR"))
            {
                properties.SetAdditional(new CopyFilterToSystemForOculusHelper());
            }
        }