From e6ba4abfdcf12dd503da4d58cb95395feba39a9b Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Sat, 9 Jan 2021 23:04:05 -0700 Subject: [PATCH 1/4] Fix detection of Windows 10 versions --- Wabbajack/Views/MainWindow.xaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Wabbajack/Views/MainWindow.xaml.cs b/Wabbajack/Views/MainWindow.xaml.cs index 13591de1..96d71895 100644 --- a/Wabbajack/Views/MainWindow.xaml.cs +++ b/Wabbajack/Views/MainWindow.xaml.cs @@ -42,7 +42,8 @@ namespace Wabbajack Utils.Log($"Detected Windows Version: {p.WindowsVersion}"); - if (!(p.WindowsVersion.Major >= 6 && p.WindowsVersion.Minor >= 2)) + if (!((p.WindowsVersion.Major >= 10 && p.WindowsVersion.Minor >= 0) || + (p.WindowsVersion.Major >= 6 && p.WindowsVersion.Minor >= 2))) Utils.Log( $"You are not running a recent version of Windows (version 10 or greater), Wabbajack is not supported on OS versions older than Windows 10."); @@ -83,7 +84,7 @@ namespace Wabbajack catch (Exception ex) { Utils.LogStraightToFile("Error"); - Utils.LogStraightToFile(ex.ToString()); + Utils.LogStraightToFile(ex.ToString()); Environment.Exit(-1); } } From 44f81bb61fea4ad2245424557f1a8b1b51638edc Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Sat, 9 Jan 2021 23:11:51 -0700 Subject: [PATCH 2/4] Only Windows 10 is supported --- Wabbajack/Views/MainWindow.xaml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Wabbajack/Views/MainWindow.xaml.cs b/Wabbajack/Views/MainWindow.xaml.cs index 96d71895..98267750 100644 --- a/Wabbajack/Views/MainWindow.xaml.cs +++ b/Wabbajack/Views/MainWindow.xaml.cs @@ -42,8 +42,7 @@ namespace Wabbajack Utils.Log($"Detected Windows Version: {p.WindowsVersion}"); - if (!((p.WindowsVersion.Major >= 10 && p.WindowsVersion.Minor >= 0) || - (p.WindowsVersion.Major >= 6 && p.WindowsVersion.Minor >= 2))) + if (!(p.WindowsVersion.Major >= 10 && p.WindowsVersion.Minor >= 0)) Utils.Log( $"You are not running a recent version of Windows (version 10 or greater), Wabbajack is not supported on OS versions older than Windows 10."); From 359d85ccf968cb79bb7eef414a8b245530c9bdc8 Mon Sep 17 00:00:00 2001 From: Unnoen Date: Mon, 11 Jan 2021 17:59:32 +1100 Subject: [PATCH 3/4] Log pagefile and warn if disabled or suboptimal --- Wabbajack.Lib/SystemParameters.cs | 2 ++ Wabbajack/Util/SystemParametersConstructor.cs | 1 + Wabbajack/Views/MainWindow.xaml.cs | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Wabbajack.Lib/SystemParameters.cs b/Wabbajack.Lib/SystemParameters.cs index 2f288894..c19822ca 100644 --- a/Wabbajack.Lib/SystemParameters.cs +++ b/Wabbajack.Lib/SystemParameters.cs @@ -15,6 +15,8 @@ namespace Wabbajack.Lib public long VideoMemorySize { get; set; } public long SystemMemorySize { get; set; } + public long SystemPageSize { get; set; } + public Version WindowsVersion { get; set; } = Environment.OSVersion.Version; /// diff --git a/Wabbajack/Util/SystemParametersConstructor.cs b/Wabbajack/Util/SystemParametersConstructor.cs index d867035e..efdd0cc5 100644 --- a/Wabbajack/Util/SystemParametersConstructor.cs +++ b/Wabbajack/Util/SystemParametersConstructor.cs @@ -56,6 +56,7 @@ namespace Wabbajack.Util ScreenHeight = height, VideoMemorySize = video_memory, SystemMemorySize = (long)memory.ullTotalPhys, + SystemPageSize = (long)memory.ullTotalPageFile - (long)memory.ullTotalPhys }; } } diff --git a/Wabbajack/Views/MainWindow.xaml.cs b/Wabbajack/Views/MainWindow.xaml.cs index 98267750..a74772c7 100644 --- a/Wabbajack/Views/MainWindow.xaml.cs +++ b/Wabbajack/Views/MainWindow.xaml.cs @@ -47,7 +47,12 @@ namespace Wabbajack $"You are not running a recent version of Windows (version 10 or greater), Wabbajack is not supported on OS versions older than Windows 10."); Utils.Log( - $"System settings - ({p.SystemMemorySize.ToFileSizeString()} RAM), Display: {p.ScreenWidth} x {p.ScreenHeight} ({p.VideoMemorySize.ToFileSizeString()} VRAM - VideoMemorySizeMb={p.EnbLEVRAMSize})"); + $"System settings - ({p.SystemMemorySize.ToFileSizeString()} RAM) ({p.SystemPageSize.ToFileSizeString()} Page), Display: {p.ScreenWidth} x {p.ScreenHeight} ({p.VideoMemorySize.ToFileSizeString()} VRAM - VideoMemorySizeMb={p.EnbLEVRAMSize})"); + + if (p.SystemPageSize == 0) + Utils.Log("Pagefile is disabled! Consider increasing to 20000MB. A disabled pagefile can cause crashes and poor in-game performance."); + else if (p.SystemPageSize < 2e+10) + Utils.Log("Pagefile below recommended! Consider increasing to 20000MB. A suboptimal pagefile can cause crashes and poor in-game performance."); Warmup(); From 13e0b21e95d6c174df6433bb345041806da48591 Mon Sep 17 00:00:00 2001 From: Unnoen Date: Mon, 11 Jan 2021 19:42:03 +1100 Subject: [PATCH 4/4] Retry from B-CDN if unable to connect to cache server. --- .../Downloaders/WabbajackCDNDownloader.cs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Wabbajack.Lib/Downloaders/WabbajackCDNDownloader.cs b/Wabbajack.Lib/Downloaders/WabbajackCDNDownloader.cs index 688322b5..082fafef 100644 --- a/Wabbajack.Lib/Downloaders/WabbajackCDNDownloader.cs +++ b/Wabbajack.Lib/Downloaders/WabbajackCDNDownloader.cs @@ -11,6 +11,7 @@ using Wabbajack.Common.Exceptions; using Wabbajack.Common.Serialization.Json; using Wabbajack.Lib.AuthorApi; using Wabbajack.Lib.Validation; +using System.Linq; namespace Wabbajack.Lib.Downloaders { @@ -89,7 +90,7 @@ namespace Wabbajack.Lib.Downloaders if (DomainRemaps.TryGetValue(Url.Host, out var remap)) { var builder = new UriBuilder(Url) {Host = remap}; - using var response = await client.GetAsync($"{builder}/parts/{part.Index}"); + using var response = await GetWithCDNRetry(client, $"{builder}/parts/{part.Index}"); if (!response.IsSuccessStatusCode) throw new HttpException((int)response.StatusCode, response.ReasonPhrase ?? "Unknown"); await response.Content.CopyToAsync(ostream); @@ -114,6 +115,31 @@ namespace Wabbajack.Lib.Downloaders return true; } + private async Task GetWithCDNRetry(Http.Client client, string url, CancellationToken? token = null) + { + int retries = 0; + + TOP: + + try + { + return await client.GetAsync(url, retry: false, token: token); + } + catch (Exception ex) + { + if (retries > 2) + { + Utils.Log($"Trying CDN..."); + var remap = url.Replace(new Uri(url).Host, DomainRemaps.FirstOrDefault(x => x.Value == new Uri(url).Host).Key); + return await client.GetAsync(remap, retry: false, token: token); + } + retries += 1; + Utils.Log($"Error reading {url} retrying [{retries}]"); + Utils.Log(ex.ToString()); + goto TOP; + } + } + private async Task GetWithMirroredRetry(Http.Client client, string url) { int retries = 0; @@ -157,7 +183,7 @@ namespace Wabbajack.Lib.Downloaders if (DomainRemaps.TryGetValue(Url.Host, out var remap)) { var builder = new UriBuilder(Url) {Host = remap}; - using var data = await client.GetAsync(builder + "/definition.json.gz", token: token); + using var data = await GetWithCDNRetry(client, builder + "/definition.json.gz", token: token); await using var gz = new GZipStream(await data.Content.ReadAsStreamAsync(), CompressionMode.Decompress); return gz.FromJson();