diff --git a/AcManager.Controls/Services/TimeSliderService.cs b/AcManager.Controls/Services/TimeSliderService.cs index c45ae5ebe..3e3ee5f8b 100644 --- a/AcManager.Controls/Services/TimeSliderService.cs +++ b/AcManager.Controls/Services/TimeSliderService.cs @@ -2,7 +2,6 @@ using System.Windows.Controls; using AcManager.Tools.Data; using AcTools; -using AcTools.Utils; namespace AcManager.Controls.Services { public static class TimeSliderService { diff --git a/AcManager.Tools/Data/PatchVersionInfo.cs b/AcManager.Tools/Data/PatchVersionInfo.cs index fd69e0555..21de21f1a 100644 --- a/AcManager.Tools/Data/PatchVersionInfo.cs +++ b/AcManager.Tools/Data/PatchVersionInfo.cs @@ -442,6 +442,11 @@ await Task.Run(() => { toRemove.Add(shadersDirectory); } + var shadersPack = Path.Combine(PatchHelper.GetRootDirectory(), "shaders.zip"); + if (File.Exists(shadersPack)) { + toRemove.Add(shadersPack); + } + FileUtils.Recycle(toRemove.ToArray()); }).ConfigureAwait(false); } else { diff --git a/AcManager.Tools/Objects/UserChampionshipObject.cs b/AcManager.Tools/Objects/UserChampionshipObject.cs index 7c2baf97d..3ab0c0353 100644 --- a/AcManager.Tools/Objects/UserChampionshipObject.cs +++ b/AcManager.Tools/Objects/UserChampionshipObject.cs @@ -878,6 +878,7 @@ private void LoadExtended() { CoherentTime = json.GetBoolValueOnly("coherentTime") ?? false; RealConditions = json.GetBoolValueOnly("realConditions") ?? false; RealConditionsManualTime = json.GetBoolValueOnly("realConditionsManualTime") ?? false; + TimeMultiplier = json.GetIntValueOnly("timeMultiplier", 1); Author = json.GetStringValueOnly("author")?.Trim(); Version = json.GetStringValueOnly("version")?.Trim(); @@ -922,6 +923,7 @@ private void SaveExtended() { json.SetNonDefault("coherentTime", CoherentTime); json.SetNonDefault("realConditions", RealConditions); json.SetNonDefault("realConditionsManualTime", RealConditionsManualTime); + json.SetNonDefault("timeMultiplier", TimeMultiplier, 1); json.SetNonDefault("author", Author); json.SetNonDefault("version", Version); json.SetNonDefault("url", Url); diff --git a/AcManager/Pages/Dialogs/GameDialog.xaml.cs b/AcManager/Pages/Dialogs/GameDialog.xaml.cs index 8a59fe703..3792c9dae 100644 --- a/AcManager/Pages/Dialogs/GameDialog.xaml.cs +++ b/AcManager/Pages/Dialogs/GameDialog.xaml.cs @@ -139,22 +139,6 @@ public void Show(Game.StartProperties properties, GameMode mode) { _properties = properties; _mode = mode; - if (MessageDialog.Show( - "Oculus Rift might not work properly with Content Manager is in AC root folder. It’s better to move it somewhere else to avoid potential issues.", - "Important note", new MessageDialogButton { - [MessageBoxResult.Yes] = "Move it now", - [MessageBoxResult.No] = "Ignore" - }, "oculusRiftWarningMessage") == MessageBoxResult.Yes) { - try { - var newLocation = FilesStorage.Instance.GetFilename(MainExecutingFile.Name); - File.Copy(MainExecutingFile.Location, newLocation, true); - ProcessExtension.Start(newLocation, new[] { @"--restart", @"--move-app=" + MainExecutingFile.Location }); - Environment.Exit(0); - } catch (Exception e) { - NonfatalError.Notify("Failed to move CM executable", "I’m afraid you’ll have to do it manually.", e); - } - } - ShowDialogAsync().Forget(); Model.WaitingStatus = AppStrings.Race_Initializing; @@ -174,6 +158,24 @@ public void OnProgress(Game.ProgressState progress) { Model.WaitingStatus = AppStrings.Race_Preparing; break; case Game.ProgressState.Launching: + if (AcRootDirectory.CheckDirectory(MainExecutingFile.Directory) + && new IniFile(AcPaths.GetCfgVideoFilename())["CAMERA"].GetNonEmpty("MODE") == "OCULUS" + && MessageDialog.Show( + "Oculus Rift might not work properly with Content Manager is in AC root folder. It’s better to move it somewhere else to avoid potential issues.", + "Important note", new MessageDialogButton { + [MessageBoxResult.Yes] = "Move it now", + [MessageBoxResult.No] = "Ignore" + }, "oculusRiftWarningMessage") == MessageBoxResult.Yes) { + try { + var newLocation = FilesStorage.Instance.GetFilename(MainExecutingFile.Name); + File.Copy(MainExecutingFile.Location, newLocation, true); + ProcessExtension.Start(newLocation, new[] { @"--restart", @"--move-app=" + MainExecutingFile.Location }); + Environment.Exit(0); + } catch (Exception e) { + NonfatalError.Notify("Failed to move CM executable", "I’m afraid you’ll have to do it manually.", e); + } + } + if (SettingsHolder.Drive.SelectedStarterType == SettingsHolder.DriveSettings.DeveloperStarterType) { Model.WaitingStatus = "Now, run AC…"; } else { diff --git a/AcManager/Pages/Drive/QuickDrive.xaml.cs b/AcManager/Pages/Drive/QuickDrive.xaml.cs index 66395e217..8108efed6 100644 --- a/AcManager/Pages/Drive/QuickDrive.xaml.cs +++ b/AcManager/Pages/Drive/QuickDrive.xaml.cs @@ -42,7 +42,6 @@ using FirstFloor.ModernUI.Presentation; using FirstFloor.ModernUI.Windows; using FirstFloor.ModernUI.Windows.Controls; -using FirstFloor.ModernUI.Windows.Media; using FirstFloor.ModernUI.Windows.Navigation; using JetBrains.Annotations; using Newtonsoft.Json; diff --git a/AcManager/Pages/Settings/SettingsShadersPatch.xaml.cs b/AcManager/Pages/Settings/SettingsShadersPatch.xaml.cs index 64f0920b7..8ce8f8f5b 100644 --- a/AcManager/Pages/Settings/SettingsShadersPatch.xaml.cs +++ b/AcManager/Pages/Settings/SettingsShadersPatch.xaml.cs @@ -87,9 +87,9 @@ private void OnPatchInstallationEnd(object sender, EventArgs e) { private void OnPatchUpdaterPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(PatchUpdater.NothingAtAll)) { - UpdateContentTranslate(true); + ActionExtension.InvokeInMainThreadAsync(() => UpdateContentTranslate(true)); } - Model.OnPatchUpdaterChanged(sender, e); + ActionExtension.InvokeInMainThreadAsync(() => Model.OnPatchUpdaterChanged(sender, e)); } private EasingFunctionBase _selectionEasingFunction; @@ -159,6 +159,10 @@ public class ViewModel : NotifyPropertyChanged, IDisposable { private FileSystemWatcher _watcher; public ViewModel(bool isLive) { + if (PatchHelper.GetInstalledVersion() == null) { + _selectedPageId.Value = null; + } + PagesView = new BetterListCollectionView(Pages); PagesView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(PatchPage.Group))); @@ -223,9 +227,10 @@ private void OnWatcherRenamed(object sender, RenamedEventArgs e) { private string _foundIssuesMessage; + [CanBeNull] public string FoundIssuesMessage { get => _foundIssuesMessage; - set => Apply(value, ref _foundIssuesMessage); + set => Apply(string.IsNullOrWhiteSpace(value) ? null : value.Trim(), ref _foundIssuesMessage); } private class FoundIssue { @@ -291,8 +296,8 @@ private void RescanPossibleIssues() { Directory.Exists(Path.Combine(root, "config")) ? null : new FoundIssue("Base configs in “extension/config” are missing", @"reinstallCurrent", "reinstall patch", "Reinstall currently active patch version to fix the problem automatically"), - Directory.Exists(Path.Combine(root, "shaders", "custom")) ? null - : new FoundIssue("Custom shaders in “extension/shaders” are missing", @"reinstallCurrent", "reinstall patch", + File.Exists(Path.Combine(root, "shaders.zip")) || Directory.Exists(Path.Combine(root, "shaders", "custom")) ? null + : new FoundIssue("Custom shaders pack “extension/shaders.zip” are missing", @"reinstallCurrent", "reinstall patch", "Reinstall currently active patch version to fix the problem automatically"), File.Exists(Path.Combine(root, "lua", "ac_common.lua")) ? null : new FoundIssue("Lua utilities in “extension/lua” are missing", @"reinstallCurrent", "reinstall patch", @@ -424,11 +429,9 @@ private void CreateConfigs() { Mode = Mode.NoConfigs; } - if (PatchHelper.OptionPatchSupport) { - Pages.ReplaceEverythingBy_Direct(BasePages.Concat(Configs.Select(x => new PatchPage(x)))); - } else { - Pages.ReplaceEverythingBy_Direct(Configs.Select(x => new PatchPage(x))); - } + Pages.ReplaceEverythingBy_Direct(PatchHelper.OptionPatchSupport + ? BasePages.Concat(Configs.Select(x => new PatchPage(x))) + : Configs.Select(x => new PatchPage(x))); SelectedPage = Pages?.GetByIdOrDefault(_selectedPageId.Value) ?? Pages?.FirstOrDefault(); if (Configs != null) { diff --git a/AcManager/Pages/ShadersPatch/ShadersInstalledDetails.xaml b/AcManager/Pages/ShadersPatch/ShadersInstalledDetails.xaml index ae2b81e3e..54b739209 100644 --- a/AcManager/Pages/ShadersPatch/ShadersInstalledDetails.xaml +++ b/AcManager/Pages/ShadersPatch/ShadersInstalledDetails.xaml @@ -66,7 +66,7 @@ + Visibility="{Binding Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=inverse}"> - public static int OptionDecodeImageSyncThreshold = 50 * 1000; // 50 KB + // public static int OptionDecodeImageSyncThreshold = 50 * 1000; // 50 KB + public static int OptionDecodeImageSyncThreshold = 50; // 50 KB /// /// Considering that 30 KB image takes ≈1.8 ms to be decoded and value of @@ -80,7 +81,8 @@ public partial class BetterImage : Control { /// /// Before loading cached entity, check if according file exists and was not updated. /// - public static bool OptionEnsureCacheIsFresh = true; + // public static bool OptionEnsureCacheIsFresh = true; + public static bool OptionEnsureCacheIsFresh = false; /// /// Do not set it to zero if OptionReadFileSync is true and OptionDecodeImageSync is true!