Skip to content

Commit

Permalink
Wabbajack 3.3.0.0 Update (#2416)
Browse files Browse the repository at this point in the history
* added more visible error messages to avoid user confusion

added hard drive free space detection, added red error message text, removed overwrite checkbox, added wiki button link

extended the error text for starting wabbajack in protected location

removed debug code

shortened error message to fit in text box

* restored warning removed in error, updated changelog, removed debug includes

* Update InstallerVM.cs

* Update InstallerVM.cs

* Update MainWindowViewModel.cs

* added json optional flag to only show version number over modlist image in installer view, if the modlist image already contains the title

removed debug code

change to pascal case and match existing code style

update changelog

* Fix manual downloads sometimes launching in browser

* Fix manual downloads from secure servers

* Remove duplicate user agent code

* Create configuration project and performance settings

* Bind new performance settings to UI

* Use performance settings to limit maximum memory per download

* Remove unused settings and related classes

* Updated CHANGELOG.md

* update CHANGELOG.md

* moved the existing files popup to an error message , heralding the return of the overwrite install checkbox

* added newline

* reverted erroneous edit

* gogID for fallout4 added

* update CHANGELOG.md

* Fix deadlock when loading new settings

* change folder/directory check logic

* update CHANGELOG.md

* revert unnecessary change

* update CHANGELOG.md

* Bump Wabbajack to .NET 7

* Bump ReactiveUI packages & deps

* Update GameFinder to 4.0.0

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: JanuarySnow <bobfordiscord12@gmail.com>
Co-authored-by: JanuarySnow <85711747+JanuarySnow@users.noreply.github.com>
Co-authored-by: UrbanCMC <UrbanCMC@web.de>
Co-authored-by: trawzified <55751269+tr4wzified@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 12, 2023
1 parent 0cba392 commit fab17a6
Show file tree
Hide file tree
Showing 107 changed files with 580 additions and 903 deletions.
35 changes: 23 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
### Changelog

#### Version - 3.3.0.0 - TBA
* Fixed some UI issues arising from 3.2.0.0 changes - more informative error text, wiki link button
* Added optional JSON flag for `DisplayVersionOnlyInInstallerView` to enable the installer image to only show version number.
* Fixed manual downloader downloading in the OS's "Downloads" folder
* Added RAM Limit setting for downloads
* This fixes the High RAM usage (and sometimes app crashes) on some Hardware + Very High Speed Internet Connection Systems
* Added Fallout 4 (GOG) to the index
* Updated App to .NET 7.0
* Should fix random crashes on some systems
* Updated GameFinder to 4.0.0

#### Version - 3.2.0.1 - 7/23/2023
* Code cleanup: re-added some network and diagnostic code missing since 2.5

#### Version - 3.2.0.0 - 7/16/2023
* Fixed issues related to high RAM usage
* The resumable downloads now reserve drive space to write to in advance instead of being managed in system RAM
* remove LoversLab from the "Logins" Setting because it is deprecated for ages now and only causes confusion,
just for the unlikely probability that LL will fix their proper API.
* Added safety to install path selection, to ensure that no files are deleted that are not intended to be.
* Fixed allowing back button during install which can result in multiple install processes
* fixed search filter not applying when pressing back button and reaccessing gallery
* Added more robust checking for protected location paths and subfolders for the launcher exe and install and download paths
* Fixed readme double opening when modlist details are prepoulated
* Added a check if Downloadpath is alongside Wabbajack.exe location, to match the install path check that already exists
* Added check for identical download and install paths
* Fixed No Delete and NoDelete being handled by stripping whitespace before the regex, to idiotproof things a bit
* Fixed issues related to high RAM usage
* The resumable downloads now reserve drive space to write to in advance instead of being managed in system RAM
* remove LoversLab from the "Logins" Setting because it is deprecated for ages now and only causes confusion,
just for the unlikely probability that LL will fix their proper API.
* Added safety to install path selection, to ensure that no files are deleted that are not intended to be.
* Fixed allowing back button during install which can result in multiple install processes
* fixed search filter not applying when pressing back button and reaccessing gallery
* Added more robust checking for protected location paths and subfolders for the launcher exe and install and download paths
* Fixed readme double opening when modlist details are prepoulated
* Added a check if Downloadpath is alongside Wabbajack.exe location, to match the install path check that already exists
* Added check for identical download and install paths
* Fixed No Delete and NoDelete being handled by stripping whitespace before the regex, to idiotproof things a bit

#### Version - 3.1.0.0 - 5/7/2023
* Fixed Readme opening twice
Expand Down
4 changes: 1 addition & 3 deletions Wabbajack.App.Wpf/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Reactive.Disposables;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -166,7 +165,6 @@ private static IServiceCollection ConfigureServices(IServiceCollection services)
services.AddSingleton<LauncherUpdater>();
services.AddSingleton<ResourceMonitor>();

services.AddSingleton<MainSettings>();
services.AddTransient<CompilerVM>();
services.AddTransient<InstallerVM>();
services.AddTransient<ModeSelectionVM>();
Expand All @@ -182,7 +180,7 @@ private static IServiceCollection ConfigureServices(IServiceCollection services)
services.AddTransient<LoversLabLoginHandler>();

// Login Managers

//Disabled LL because it is currently not used and broken due to the way LL butchers their API
//services.AddAllSingleton<INeedsLogin, LoversLabLoginManager>();
services.AddAllSingleton<INeedsLogin, NexusLoginManager>();
Expand Down
19 changes: 10 additions & 9 deletions Wabbajack.App.Wpf/LauncherUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic.CompilerServices;
using Newtonsoft.Json;
using Wabbajack.Common;
using Wabbajack.Downloaders;
using Wabbajack.DTOs;
using Wabbajack.DTOs.DownloadStates;
Expand All @@ -27,9 +28,9 @@ public class LauncherUpdater
private readonly HttpClient _client;
private readonly Client _wjclient;
private readonly DTOSerializer _dtos;

private readonly DownloadDispatcher _downloader;

private static Uri GITHUB_REPO_RELEASES = new("https://api.github.com/repos/wabbajack-tools/wabbajack/releases");

public LauncherUpdater(ILogger<LauncherUpdater> logger, HttpClient client, Client wjclient, DTOSerializer dtos,
Expand All @@ -41,8 +42,8 @@ public LauncherUpdater(ILogger<LauncherUpdater> logger, HttpClient client, Clien
_dtos = dtos;
_downloader = downloader;
}


public static Lazy<AbsolutePath> CommonFolder = new (() =>
{
var entryPoint = KnownFolders.EntryPoint;
Expand Down Expand Up @@ -105,7 +106,7 @@ public async Task Run()

var launcherFolder = KnownFolders.EntryPoint.Parent;
var exePath = launcherFolder.Combine("Wabbajack.exe");

var launcherVersion = FileVersionInfo.GetVersionInfo(exePath.ToString());

if (release != default && release.version > Version.Parse(launcherVersion.FileVersion!))
Expand All @@ -119,7 +120,7 @@ await _downloader.Download(new Archive
Name = release.asset.Name,
Size = release.asset.Size
}, tempPath, CancellationToken.None);

if (tempPath.Size() != release.asset.Size)
{
_logger.LogInformation(
Expand All @@ -130,12 +131,12 @@ await _downloader.Download(new Archive
if (exePath.FileExists())
exePath.Delete();
await tempPath.MoveToAsync(exePath, true, CancellationToken.None);

_logger.LogInformation("Finished updating wabbajack");
await _wjclient.SendMetric("updated_launcher", $"{launcherVersion.FileVersion} -> {release.version}");
}
}

private async Task<Release[]> GetReleases()
{
_logger.LogInformation("Getting new Wabbajack version list");
Expand All @@ -146,7 +147,7 @@ private async Task<Release[]> GetReleases()
private HttpRequestMessage MakeMessage(Uri uri)
{
var msg = new HttpRequestMessage(HttpMethod.Get, uri);
msg.UseChromeUserAgent();
msg.AddChromeAgent();
return msg;
}

Expand Down
183 changes: 23 additions & 160 deletions Wabbajack.App.Wpf/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,84 +1,11 @@
using System;
using System.Collections.Generic;
using System.Reactive;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Wabbajack.Compiler;
using Wabbajack.Downloaders;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack;
using Wabbajack.Paths;
using Consts = Wabbajack.Consts;
using Wabbajack.RateLimiter;
using Wabbajack.Util;

namespace Wabbajack
{
[JsonName("MainSettings")]
[JsonObject(MemberSerialization.OptOut)]
public class MainSettings
{
public byte Version { get; set; } = Consts.SettingsVersion;
public double PosX { get; set; }
public double PosY { get; set; }
public double Height { get; set; }
public double Width { get; set; }
public InstallerSettings Installer { get; set; } = new();
public FiltersSettings Filters { get; set; } = new();
public CompilerSettings Compiler { get; set; } = new();
public PerformanceSettings Performance { get; set; } = new();

private Subject<Unit> _saveSignal = new();
[JsonIgnore]
public IObservable<Unit> SaveSignal => _saveSignal;

public static async ValueTask<(MainSettings settings, bool loaded)> TryLoadTypicalSettings()
{
/*
if (!Consts.SettingsFile.Exists)
{
return default;
}
// Version check
try
{
var settings = Consts.SettingsFile.FromJson<MainSettings>();
if (settings.Version == Consts.SettingsVersion)
return (settings, true);
}
catch (Exception ex)
{
Utils.Error(ex, "Error loading settings");
}
var backup = Consts.SettingsFile.AppendToName("-backup");
await backup.DeleteAsync();
await Consts.SettingsFile.CopyToAsync(backup);
await Consts.SettingsFile.DeleteAsync();
*/
return default;
}

public static async ValueTask SaveSettings(MainSettings settings)
{
settings._saveSignal.OnNext(Unit.Default);

// Might add this if people are putting save work on other threads or other
// things that delay the operation.
//settings._saveSignal.OnCompleted();
//await settings._saveSignal;

//await settings.ToJsonAsync(Consts.SettingsFile);
}
}

[JsonName("InstallerSettings")]
public class InstallerSettings
{
public AbsolutePath LastInstalledListLocation { get; set; }
public Dictionary<AbsolutePath, Mo2ModlistInstallationSettings> Mo2ModlistSettings { get; } = new Dictionary<AbsolutePath, Mo2ModlistInstallationSettings>();
}

[JsonName("Mo2ModListInstallerSettings")]
public class Mo2ModlistInstallationSettings
{
Expand All @@ -87,105 +14,41 @@ public class Mo2ModlistInstallationSettings
public bool AutomaticallyOverrideExistingInstall { get; set; }
}

[JsonName("FiltersSettings")]
[JsonObject(MemberSerialization.OptOut)]
public class FiltersSettings : ViewModel
{
public bool ShowNSFW { get; set; }
public bool OnlyInstalled { get; set; }
public string Game { get; set; }
public string Search { get; set; }
private bool _isPersistent = true;
public bool IsPersistent { get => _isPersistent; set => RaiseAndSetIfChanged(ref _isPersistent, value); }

private bool _useCompression = false;
public bool UseCompression { get => _useCompression; set => RaiseAndSetIfChanged(ref _useCompression, value); }
public bool ShowUtilityLists { get; set; }
}

[JsonName("PerformanceSettings")]
[JsonObject(MemberSerialization.OptOut)]
public class PerformanceSettings : ViewModel
{
public PerformanceSettings()
{
_reduceHDDThreads = true;
_favorPerfOverRam = false;
_diskThreads = Environment.ProcessorCount;
_downloadThreads = Environment.ProcessorCount <= 8 ? Environment.ProcessorCount : 8;
}
private readonly Configuration.MainSettings _settings;
private readonly int _defaultMaximumMemoryPerDownloadThreadMb;

private int _downloadThreads;
public int DownloadThreads { get => _downloadThreads; set => RaiseAndSetIfChanged(ref _downloadThreads, value); }

private int _diskThreads;
public int DiskThreads { get => _diskThreads; set => RaiseAndSetIfChanged(ref _diskThreads, value); }
public PerformanceSettings(Configuration.MainSettings settings, IResource<DownloadDispatcher> downloadResources, SystemParametersConstructor systemParams)
{
var p = systemParams.Create();

private bool _reduceHDDThreads;
public bool ReduceHDDThreads { get => _reduceHDDThreads; set => RaiseAndSetIfChanged(ref _reduceHDDThreads, value); }
_settings = settings;
// Split half of available memory among download threads
_defaultMaximumMemoryPerDownloadThreadMb = (int)(p.SystemMemorySize / downloadResources.MaxTasks / 1024 / 1024) / 2;
_maximumMemoryPerDownloadThreadMb = settings.PerformanceSettings.MaximumMemoryPerDownloadThreadMb;

private bool _favorPerfOverRam;
public bool FavorPerfOverRam { get => _favorPerfOverRam; set => RaiseAndSetIfChanged(ref _favorPerfOverRam, value); }

private bool _networkWorkaroundMode;
public bool NetworkWorkaroundMode
{
get => _networkWorkaroundMode;
set
if (MaximumMemoryPerDownloadThreadMb < 0)
{
Consts.UseNetworkWorkaroundMode = value;
RaiseAndSetIfChanged(ref _networkWorkaroundMode, value);
ResetMaximumMemoryPerDownloadThreadMb();
}
}


private bool _disableTextureResizing;
public bool DisableTextureResizing
private int _maximumMemoryPerDownloadThreadMb;

public int MaximumMemoryPerDownloadThreadMb
{
get => _disableTextureResizing;
get => _maximumMemoryPerDownloadThreadMb;
set
{
RaiseAndSetIfChanged(ref _disableTextureResizing, value);
RaiseAndSetIfChanged(ref _maximumMemoryPerDownloadThreadMb, value);
_settings.PerformanceSettings.MaximumMemoryPerDownloadThreadMb = value;
}
}



/*
public void SetProcessorSettings(ABatchProcessor processor)
public void ResetMaximumMemoryPerDownloadThreadMb()
{
processor.DownloadThreads = DownloadThreads;
processor.DiskThreads = DiskThreads;
processor.ReduceHDDThreads = ReduceHDDThreads;
processor.FavorPerfOverRam = FavorPerfOverRam;
if (processor is MO2Compiler mo2c)
mo2c.DisableTextureResizing = DisableTextureResizing;
}*/
}

[JsonName("CompilationModlistSettings")]
public class CompilationModlistSettings
{
public string ModListName { get; set; }
public string Version { get; set; }
public string Author { get; set; }
public string Description { get; set; }
public string Website { get; set; }
public string Readme { get; set; }
public bool IsNSFW { get; set; }

public string MachineUrl { get; set; }
public AbsolutePath SplashScreen { get; set; }
public bool Publish { get; set; }
}

[JsonName("MO2CompilationSettings")]
public class MO2CompilationSettings
{
public AbsolutePath DownloadLocation { get; set; }
public AbsolutePath LastCompiledProfileLocation { get; set; }
public Dictionary<AbsolutePath, CompilationModlistSettings> ModlistSettings { get; } = new Dictionary<AbsolutePath, CompilationModlistSettings>();
MaximumMemoryPerDownloadThreadMb = _defaultMaximumMemoryPerDownloadThreadMb;
}
}

}
15 changes: 6 additions & 9 deletions Wabbajack.App.Wpf/UserIntervention/ManualDownloadHandler.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System.Security.Policy;
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.DTOs;
using Wabbajack.DTOs.DownloadStates;
using Wabbajack.DTOs.Interventions;
using Wabbajack.Paths;

namespace Wabbajack.UserIntervention;

Expand All @@ -17,18 +14,18 @@ protected override async Task Run(CancellationToken token)
//await WaitForReady();
var archive = Intervention.Archive;
var md = Intervention.Archive.State as Manual;

HeaderText = $"Manual download ({md.Url.Host})";

Instructions = string.IsNullOrWhiteSpace(md.Prompt) ? $"Please download {archive.Name}" : md.Prompt;
await NavigateTo(md.Url);

Instructions = string.IsNullOrWhiteSpace(md.Prompt) ? $"Please download {archive.Name}" : md.Prompt;

var uri = await WaitForDownloadUri(token, async () =>
var task = WaitForDownloadUri(token, async () =>
{
await RunJavaScript("Array.from(document.getElementsByTagName(\"iframe\")).forEach(f => f.remove())");
});

await NavigateTo(md.Url);
var uri = await task;

Intervention.Finish(uri);
}
}
Loading

0 comments on commit fab17a6

Please sign in to comment.