Skip to content

Commit

Permalink
Another update
Browse files Browse the repository at this point in the history
  • Loading branch information
gro-ove committed Mar 12, 2019
1 parent b1022eb commit d3edd20
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 47 deletions.
1 change: 0 additions & 1 deletion AcManager.Controls/Services/TimeSliderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions AcManager.Tools/Data/PatchVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions AcManager.Tools/Objects/UserChampionshipObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
34 changes: 18 additions & 16 deletions AcManager/Pages/Dialogs/GameDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion AcManager/Pages/Drive/QuickDrive.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 13 additions & 10 deletions AcManager/Pages/Settings/SettingsShadersPatch.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)));

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion AcManager/Pages/ShadersPatch/ShadersInstalledDetails.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<DockPanel Visibility="{Binding NothingAtAll, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=inverse}">
<DockPanel DataContext="{Binding Model.FoundIssuesMessage, Source={x:Static settings:SettingsShadersPatch.Instance}}" DockPanel.Dock="Top"
Visibility="{Binding Length, Converter={StaticResource MoreToVisibilityConverter}}">
Visibility="{Binding Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=inverse}">
<DockPanel HorizontalAlignment="Stretch" Dock="Top" Margin="0 0 0 4">
<Path Data="{StaticResource AlertIconData}" Width="16" Height="16" Fill="{DynamicResource Error}" Stretch="Uniform" />
<TextBlock Margin="10 2 2 2" Style="{StaticResource Heading2}" Foreground="{DynamicResource Error}"
Expand Down
4 changes: 4 additions & 0 deletions AcTools.Render/Kn5Specific/Objects/Kn5RenderableCollider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ namespace AcTools.Render.Kn5Specific.Objects {
public class Kn5RenderableCollider : Kn5RenderableFile {
public Kn5RenderableCollider(Kn5 kn5, Matrix matrix, bool asyncTexturesLoading = true, IKn5ToRenderableConverter converter = null)
: base(kn5, matrix, asyncTexturesLoading, converter) {
foreach (var mesh in Dummies) {
mesh.LocalMatrix = Matrix.Identity;
}

foreach (var mesh in Meshes) {
mesh.SetTransparent(true);
}
Expand Down
10 changes: 5 additions & 5 deletions AcTools/Kn5File/Kn5Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Kn5Material ReadMaterial() {
public void SkipMaterial() {
SkipString(); // name
SkipString(); // shader name
Skip(6); // blend (byte) + alphatested (byte) + depth mode
Skip(6); // blend (byte) + alpha tested (byte) + depth mode

var properties = ReadInt32();
for (var i = 0; i < properties; i++) {
Expand Down Expand Up @@ -142,7 +142,7 @@ public Kn5Node ReadNode() {

node.Vertices = new Kn5Node.Vertex[ReadUInt32()];
for (var i = 0; i < node.Vertices.Length; i++) {
// 44 bytes per vertice
// 44 bytes per vertex
node.Vertices[i] = new Kn5Node.Vertex {
Position = ReadSingle3D(),
Normal = ReadSingle3D(),
Expand Down Expand Up @@ -185,7 +185,7 @@ public Kn5Node ReadNode() {
node.Vertices = new Kn5Node.Vertex[ReadUInt32()];
node.VerticeWeights = new Kn5Node.VerticeWeight[node.Vertices.Length];
for (var i = 0; i < node.Vertices.Length; i++) {
// 76 bytes per vertice
// 76 bytes per vertex
node.Vertices[i] = new Kn5Node.Vertex {
Position = ReadSingle3D(),
Normal = ReadSingle3D(),
Expand All @@ -209,7 +209,7 @@ public Kn5Node ReadNode() {
node.MaterialId = ReadUInt32();
node.Layer = ReadUInt32();

node.MisteryBytes = ReadBytes(8); // the only mistery left?
node.MisteryBytes = ReadBytes(8); // the only mystery left?
node.IsRenderable = true;
break;
}
Expand Down Expand Up @@ -283,7 +283,7 @@ public Kn5Node ReadNodeHierarchy() {
node.MaterialId = ReadUInt32();
node.Layer = ReadUInt32();

node.MisteryBytes = ReadBytes(8); // the only mistery left?
node.MisteryBytes = ReadBytes(8); // the only mystery left?
node.IsRenderable = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions AcTools/Utils/Helpers/JsonExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ public static void SetNonDefault(this JObject obj, [LocalizationRequired(false)]
}
}

public static void SetNonDefault(this JObject obj, [LocalizationRequired(false)] string key, int? value) {
if (!value.HasValue || value == 0) {
public static void SetNonDefault(this JObject obj, [LocalizationRequired(false)] string key, int? value, int defaultValue = 0) {
if (!value.HasValue || value == defaultValue) {
obj.Remove(key);
} else {
obj[key] = value.Value;
Expand Down
12 changes: 6 additions & 6 deletions CustomTracksBakery/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public class Options {
[Option("sample-resolution", DefaultValue = 16, Required = false, HelpText = "Sample resolution.")]
public int SampleResolution { get; set; }

[Option("ground", DefaultValue = true, HelpText = "Add shadows from the ground below.")]
public bool Ground { get; set; }
[Option("no-ground", DefaultValue = false, HelpText = "Add shadows from the ground below.")]
public bool NoGround { get; set; }

[Option("hdr", DefaultValue = false, HelpText = "Make HDR samples.")]
public bool HdrSamples { get; set; }
Expand All @@ -140,8 +140,8 @@ public class Options {
[Option("bake-into-kn5", DefaultValue = false, HelpText = "Bake shadows into KN5 instead of creating a small patch.")]
public bool ModifyKn5Directly { get; set; }

[Option("special-grass-ambient", DefaultValue = true, HelpText = "Copy grass ambient from the surface underneath.")]
public bool SpecialGrassAmbient { get; set; }
[Option("no-special-grass-ambient", DefaultValue = false, HelpText = "Copy grass ambient from the surface underneath.")]
public bool NoSpecialGrassAmbient { get; set; }

[Option("debug-pos", DefaultValue = null, HelpText = "Bake shadows only around certain point, to test settings.")]
public string DebugPos { get; set; }
Expand Down Expand Up @@ -356,7 +356,7 @@ public static int Main(string[] args) {
SampleResolution = options.SampleResolution,
ExtraPassBrightnessGain = options.ExtraPassBrightnessGain,
HdrSamples = options.HdrSamples,
Ground = options.Ground,
Ground = !options.NoGround,
SyncNormalsFilter = options.SyncNormals,
SyncNormalsPartiallyFilter = options.SyncNormalsPartially,
SyncNormalsPartiallyValue = options.SyncNormalsPartiallyValue,
Expand All @@ -365,7 +365,7 @@ public static int Main(string[] args) {
GrassFilter = options.GrassFilter,
RegularObjectsFilter = options.RegularObjectsFilter,
SkipOccludersFilter = options.SkipOccludersFilter,
SpecialGrassAmbient = options.SpecialGrassAmbient,
SpecialGrassAmbient = !options.NoSpecialGrassAmbient,
SurfacesFilter = options.Surfaces,
SurfacesAoOpacity = options.SurfacesAoOpacity,
SetMiltiplierForSkipped = options.SetMiltiplierForSkipped,
Expand Down
6 changes: 3 additions & 3 deletions CustomTracksBakery/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.0.0.711")]
[assembly: AssemblyFileVersion("1.0.0.711")]
// Modified at: 18/12/24 22:32:02
[assembly: AssemblyVersion("1.0.0.712")]
[assembly: AssemblyFileVersion("1.0.0.712")]
// Modified at: 19/03/09 18:43:47
6 changes: 4 additions & 2 deletions FirstFloor.ModernUI/Windows/Controls/BetterImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public partial class BetterImage : Control {
/// If image’s size is smaller than this, it will be decoded in the UI thread.
/// Doesn’t do anything if OptionDecodeImageSync is true.
/// </summary>
public static int OptionDecodeImageSyncThreshold = 50 * 1000; // 50 KB
// public static int OptionDecodeImageSyncThreshold = 50 * 1000; // 50 KB
public static int OptionDecodeImageSyncThreshold = 50; // 50 KB

/// <summary>
/// Considering that 30 KB image takes ≈1.8 ms to be decoded and value of
Expand All @@ -80,7 +81,8 @@ public partial class BetterImage : Control {
/// <summary>
/// Before loading cached entity, check if according file exists and was not updated.
/// </summary>
public static bool OptionEnsureCacheIsFresh = true;
// public static bool OptionEnsureCacheIsFresh = true;
public static bool OptionEnsureCacheIsFresh = false;

/// <summary>
/// Do not set it to zero if OptionReadFileSync is true and OptionDecodeImageSync is true!
Expand Down

0 comments on commit d3edd20

Please sign in to comment.