New Wabbajack release (#2479)

* 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

* Don't try to add cookies if array is empty

* Start download from scratch if .download_package can't be parsed

* Log when application is shutting down

* update CHANGELOG.md

* exclude the "SP Consent Message" on nexus from the cleared iframes

* Actually use the --outputPath compile option if the user provides one

It was just not being used, defaulting to the parent of installPath. it
still does, if the user does not specify a directory using --outputPath

* update Wabbajack.Compression.BSA dependencies

* improve log message to include storage space reference

* clearing temp folder when the app closes

* update logging message

* update CHANGELOG.md

* update CHANGELOG.md

* update logging for possible exceptions thrown when clearing temp folder

* fix cloudflare captcha

* update Final Fantasy VII: RI metadata

* Update CHANGELOG.md

* fix error

* Update GameRegistry.cs

* Updated GameFinder, Added EADesktop module

* updated version number in CHANGELOG.md

* updated logging code

* update CHANGELOG.md

* Fix Nexus login (#2476)

* Fix Nexus login handler after API keys web page changes

* Automatically press request button

* Automatically press request API key button

* Fix BG3 being named badlursgate3 in Game enum instead of baldursgate3

* Fix WebView2 taking up tons of memory, use single WebView window - still needs refactoring

* Remove commented WebView

* Add changelog, fix Wabbajack CLI bat pointing to the wrong directory

---------

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: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com>
Co-authored-by: Marco Antonio Jaguaribe Costa <marco.antonio.costa@gmail.com>
This commit is contained in:
trawzified 2024-01-14 22:48:34 +01:00 committed by GitHub
parent e3505f4ea0
commit b8fe48178b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 124 additions and 41 deletions

View File

@ -1,11 +1,24 @@
### Changelog
#### Version - TBD
* Updated GameFinder to 4.1.0
* Fixes Wabbajack not Launching on some systems
* Added the GameFinder module for EA Desktop
* Only `Dragon Age: Origins` & `Dragon Age: Inquisition` supported for now.
* For other games we still need to collect the right store IDs
* Fixed Final Fantasy 7: Remake Intergrade meta data
* Fixed new WebView2 instances being created constantly causing a memory leak
* Fixed the Nexus API key no longer being picked up when logging in
* Fixed Baldur's Gate 3 having to be named 'badlursgate3' instead of 'baldursgate3' when defining a modlist JSON
* Fixed wabbajack-cli.bat pointing to the wrong CLI executable path
#### Version - 3.4.1.0 - 12/21/2023
* Added Support for Final Fantasy 7: Remake Intergrade
* Update CLI to .NET 8.0 (was missed in the last update)
* Added Support for Baldur's Gate 3
* Very Work in Progress
* **NOT** Plug and Play for compiling and installing!
* Fixed a logging error when closing the App without a `temp` folder to delete
#### Version - 3.4.0.0 - 11/19/2023
* Fixed `--outputPath` not being used for the CLI `compile` (thanks to @majcosta for fixing that)

View File

@ -8,6 +8,7 @@ using System.Windows.Threading;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Web.WebView2.Wpf;
using NLog.Extensions.Logging;
using NLog.Targets;
using Orc.FileAssociation;
@ -164,6 +165,7 @@ namespace Wabbajack
services.AddSingleton<SystemParametersConstructor>();
services.AddSingleton<LauncherUpdater>();
services.AddSingleton<ResourceMonitor>();
services.AddSingleton<WebView2>();
services.AddTransient<CompilerVM>();
services.AddTransient<InstallerVM>();

View File

@ -66,7 +66,7 @@ public class LoversLabLoginManager : ViewModel, ILoginFor<LoversLabDownloader>
private void StartLogin()
{
var view = new BrowserWindow();
var view = new BrowserWindow(_serviceProvider);
view.Closed += (sender, args) => { RefreshTokenState(); };
var provider = _serviceProvider.GetRequiredService<LoversLabLoginHandler>();
view.DataContext = provider;

View File

@ -62,7 +62,7 @@ public class NexusLoginManager : ViewModel, ILoginFor<NexusDownloader>
private void StartLogin()
{
var view = new BrowserWindow();
var view = new BrowserWindow(_serviceProvider);
view.Closed += (sender, args) => { RefreshTokenState(); };
var provider = _serviceProvider.GetRequiredService<NexusLoginHandler>();
view.DataContext = provider;

View File

@ -66,7 +66,7 @@ public class VectorPlexusLoginManager : ViewModel, ILoginFor<LoversLabDownloader
private void StartLogin()
{
var view = new BrowserWindow();
var view = new BrowserWindow(_serviceProvider);
view.Closed += (sender, args) => { RefreshTokenState(); };
var provider = _serviceProvider.GetRequiredService<VectorPlexusLoginHandler>();
view.DataContext = provider;

View File

@ -45,7 +45,7 @@ public class NexusLoginHandler : BrowserWindowViewModel
Instructions = "Getting API Key...";
await NavigateTo(new Uri("https://www.nexusmods.com/users/myaccount?tab=api"));
await NavigateTo(new Uri("https://next.nexusmods.com/settings/api-keys"));
var key = "";
@ -53,12 +53,7 @@ public class NexusLoginHandler : BrowserWindowViewModel
{
try
{
key = (await GetDom(token))
.DocumentNode
.QuerySelectorAll("input[value=wabbajack]")
.SelectMany(p => p.ParentNode.ParentNode.QuerySelectorAll("textarea.application-key"))
.Select(node => node.InnerHtml)
.FirstOrDefault() ?? "";
key = (await GetDom(token)).DocumentNode.QuerySelectorAll("img[alt='Wabbajack']").SelectMany(p => p.ParentNode.ParentNode.QuerySelectorAll("input[aria-label='api key']")).Select(node => node.Attributes["value"]).FirstOrDefault()?.Value;
}
catch (Exception)
{
@ -71,11 +66,10 @@ public class NexusLoginHandler : BrowserWindowViewModel
try
{
await EvaluateJavaScript(
"var found = document.querySelector(\"input[value=wabbajack]\").parentElement.parentElement.querySelector(\"form button[type=submit]\");" +
"var found = document.querySelector(\"img[alt='Wabbajack']\").parentElement.parentElement.querySelector(\"button[aria-label='Request Api Key']\");" +
"found.onclick= function() {return true;};" +
"found.class = \" \"; " +
"found.click();" +
"found.remove(); found = undefined;"
"found.click();"
);
Instructions = "Generating API Key, Please Wait...";
}

View File

@ -25,7 +25,7 @@ public class NexusLogin
public async Task<int> Run(CancellationToken token)
{
var tcs = new TaskCompletionSource<int>();
var view = new BrowserWindow();
var view = new BrowserWindow(_services);
view.Closed += (sender, args) => { tcs.TrySetResult(0); };
var provider = _services.GetRequiredService<NexusLoginHandler>();
view.DataContext = provider;

View File

@ -23,7 +23,7 @@
WindowTitleBrush="{StaticResource MahApps.Brushes.Accent}"
ContentRendered="BrowserWindow_OnActivated"
mc:Ignorable="d">
<Grid Background="#121212" MouseDown="UIElement_OnMouseDown">
<Grid x:Name="MainGrid" Background="#121212" MouseDown="UIElement_OnMouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
@ -46,8 +46,5 @@
<icon:PackIconModern Kind="PageCopy"></icon:PackIconModern>
</Button>
<TextBox Grid.Row="2" Grid.Column="3" Margin="4" VerticalContentAlignment="Center" Name="AddressBar" IsEnabled="False"></TextBox>
<wpf:WebView2 Grid.Row="3" Grid.ColumnSpan="3" Name="Browser"></wpf:WebView2>
</Grid>
</mahapps:MetroWindow>

View File

@ -1,11 +1,15 @@
using System;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using MahApps.Metro.Controls;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Web.WebView2.Wpf;
using ReactiveUI;
using Wabbajack.Common;
@ -14,12 +18,27 @@ namespace Wabbajack;
public partial class BrowserWindow : MetroWindow
{
private readonly CompositeDisposable _disposable;
private readonly IServiceProvider _serviceProvider;
public WebView2 Browser { get; set; }
public BrowserWindow()
public BrowserWindow(IServiceProvider serviceProvider)
{
InitializeComponent();
_disposable = new CompositeDisposable();
_serviceProvider = serviceProvider;
Browser = _serviceProvider.GetRequiredService<WebView2>();
RxApp.MainThreadScheduler.Schedule(() =>
{
if(Browser.Parent != null)
{
((Panel)Browser.Parent).Children.Remove(Browser);
}
MainGrid.Children.Add(Browser);
Grid.SetRow(Browser, 3);
Grid.SetColumnSpan(Browser, 3);
});
}
private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
@ -58,7 +77,6 @@ public partial class BrowserWindow : MetroWindow
.ContinueWith(_ => Dispatcher.Invoke(() =>
{
Close();
Browser = null;
}));
}
}

View File

@ -52,14 +52,14 @@ namespace Wabbajack
// Cleaning the temp folder when the app closes since it can take up multiple Gigabytes of Storage
var tempDirectory = Environment.CurrentDirectory + "\\temp";
_logger.LogInformation("Clearing {TempDir}",tempDirectory);
var directoryInfo = new DirectoryInfo(tempDirectory);
try
{
var directoryInfo = new DirectoryInfo(tempDirectory);
foreach (var file in directoryInfo.EnumerateFiles())
{
file.Delete();
}
foreach (var dir in directoryInfo.EnumerateDirectories())
{
dir.Delete(true);
@ -67,12 +67,11 @@ namespace Wabbajack
_logger.LogInformation("Finished clearing {TempDir}", tempDirectory);
}
catch (Exception ex)
catch (DirectoryNotFoundException)
{
_logger.LogError(ex,"Failed clearing {TempDir}",tempDirectory);
_logger.LogInformation("Unable to find {TempDir}", tempDirectory);
}
Application.Current.Shutdown();
};

View File

@ -54,5 +54,5 @@ public enum Game
[Description("Modding Tools")] ModdingTools,
[Description("Final Fantasy VII Remake")] FinalFantasy7Remake,
[Description("Baldur's Gate 3")] BadlursGate3
[Description("Baldur's Gate 3")] BaldursGate3
}

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.InteropServices.JavaScript;
using Wabbajack.Paths;
namespace Wabbajack.DTOs;
@ -29,6 +30,8 @@ public class GameMetaData
// EAPlay games may have @subscription appended to the file name
public string[] OriginIDs { get; set; } = Array.Empty<string>();
public string[] EADesktopIDs { get; set; } = Array.Empty<string>();
public string[] EpicGameStoreIDs { get; internal init; } = Array.Empty<string>();
// to get BethNet IDs: check the registry

View File

@ -357,6 +357,22 @@ public static class GameRegistry
MO2Name = "Dragon Age: Origins",
SteamIDs = new[] {47810},
OriginIDs = new[] {"DR:169789300", "DR:208591800"},
EADesktopIDs = new [] // Possibly Wrong
{
"9df89a8e-b201-4507-8a8d-bd6799fedb18",
"Origin.SFT.50.0000078",
"Origin.SFT.50.0000078",
"Origin.SFT.50.0000078",
"Origin.SFT.50.0000085",
"Origin.SFT.50.0000086",
"Origin.SFT.50.0000087",
"Origin.SFT.50.0000088",
"Origin.SFT.50.0000089",
"Origin.SFT.50.0000090",
"Origin.SFT.50.0000091",
"Origin.SFT.50.0000097",
"Origin.SFT.50.0000098"
},
GOGIDs = new long[] {1949616134},
RequiredFiles = new[]
{
@ -374,6 +390,22 @@ public static class GameRegistry
MO2Name = "Dragon Age 2", // Probably wrong
SteamIDs = new[] {1238040},
OriginIDs = new[] {"OFB-EAST:59474", "DR:201797000"},
EADesktopIDs = new [] // Possibly Wrong
{
"Origin.SFT.50.0000073",
"Origin.SFT.50.0000255",
"Origin.SFT.50.0000256",
"Origin.SFT.50.0000257",
"Origin.SFT.50.0000288",
"Origin.SFT.50.0000310",
"Origin.SFT.50.0000311",
"Origin.SFT.50.0000356",
"Origin.SFT.50.0000385",
"Origin.SFT.50.0000429",
"Origin.SFT.50.0000449",
"Origin.SFT.50.0000452",
"Origin.SFT.50.0000453"
},
RequiredFiles = new[]
{
@"bin_ship\DragonAge2.exe".ToRelativePath()
@ -540,21 +572,22 @@ public static class GameRegistry
Game = Game.FinalFantasy7Remake,
NexusName = "finalfantasy7remake",
NexusGameId = 4202,
MO2Name = "FINAL FANTASY VII REMAKE",
MO2Name = "FINAL FANTASY VII REMAKE INTERGRADE",
MO2ArchiveName = "finalfantasy7remake",
SteamIDs = new[] { 1462040 },
IsGenericMO2Plugin = true,
RequiredFiles = new []
{
@"ff7remake.exe".ToRelativePath()
@"End\Binaries\Win64\ff7remake_.exe".ToRelativePath(),
@"ff7remake_.exe".ToRelativePath()
},
MainExecutable = @"ff7remake.exe".ToRelativePath()
MainExecutable = @"End\Binaries\Win64\ff7remake_.exe".ToRelativePath()
}
},
{
Game.BadlursGate3, new GameMetaData
Game.BaldursGate3, new GameMetaData
{
Game = Game.BadlursGate3,
Game = Game.BaldursGate3,
NexusName = "baldursgate3",
NexusGameId = 3474,
MO2Name = "Baldur's Gate 3",

View File

@ -1,6 +1,8 @@
using System.Runtime.InteropServices;
using GameFinder.Common;
using GameFinder.RegistryUtils;
using GameFinder.StoreHandlers.EADesktop;
using GameFinder.StoreHandlers.EADesktop.Crypto.Windows;
using GameFinder.StoreHandlers.EGS;
using GameFinder.StoreHandlers.GOG;
using GameFinder.StoreHandlers.Origin;
@ -20,11 +22,13 @@ public class GameLocator : IGameLocator
private readonly GOGHandler? _gog;
private readonly EGSHandler? _egs;
private readonly OriginHandler? _origin;
private readonly EADesktopHandler? _eaDesktop;
private readonly Dictionary<AppId, AbsolutePath> _steamGames = new();
private readonly Dictionary<GOGGameId, AbsolutePath> _gogGames = new();
private readonly Dictionary<EGSGameId, AbsolutePath> _egsGames = new();
private readonly Dictionary<OriginGameId, AbsolutePath> _originGames = new();
private readonly Dictionary<EADesktopGameId, AbsolutePath> _eaDesktopGames = new();
private readonly Dictionary<Game, AbsolutePath> _locationCache;
private readonly ILogger<GameLocator> _logger;
@ -42,6 +46,7 @@ public class GameLocator : IGameLocator
_gog = new GOGHandler(windowsRegistry, fileSystem);
_egs = new EGSHandler(windowsRegistry, fileSystem);
_origin = new OriginHandler(fileSystem);
_eaDesktop = new EADesktopHandler(fileSystem, new HardwareInfoProvider());
}
else
{
@ -90,6 +95,14 @@ public class GameLocator : IGameLocator
{
_logger.LogError(e, "While finding games installed with Origin");
}
try
{
FindStoreGames(_eaDesktop, _eaDesktopGames, game => (AbsolutePath)game.BaseInstallPath.GetFullPath());
}
catch (Exception e)
{
_logger.LogError(e, "While finding games installed with EADesktop");
}
}
private void FindStoreGames<TGame, TId>(
@ -190,6 +203,13 @@ public class GameLocator : IGameLocator
return true;
}
foreach (var id in metaData.EADesktopIDs)
{
if (!_eaDesktopGames.TryGetValue(EADesktopGameId.From(id), out var found)) continue;
path = found;
return true;
}
path = default;
return false;
}

View File

@ -18,10 +18,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="GameFinder.StoreHandlers.EGS" Version="4.0.0" />
<PackageReference Include="GameFinder.StoreHandlers.GOG" Version="4.0.0" />
<PackageReference Include="GameFinder.StoreHandlers.Origin" Version="4.0.0" />
<PackageReference Include="GameFinder.StoreHandlers.Steam" Version="4.0.0" />
<PackageReference Include="GameFinder.StoreHandlers.EADesktop" Version="4.1.0" />
<PackageReference Include="GameFinder.StoreHandlers.EGS" Version="4.1.0" />
<PackageReference Include="GameFinder.StoreHandlers.GOG" Version="4.1.0" />
<PackageReference Include="GameFinder.StoreHandlers.Origin" Version="4.1.0" />
<PackageReference Include="GameFinder.StoreHandlers.Steam" Version="4.1.0" />
</ItemGroup>
</Project>

View File

@ -303,10 +303,13 @@ public class MainWindowViewModel : ViewModelBase
{
try
{
filename = filename.Parent.Combine("wabbajack-cli.exe");
filename = filename.Parent.Combine("cli", "wabbajack-cli.exe");
var data = $"\"{filename}\" %*";
var file = Path.Combine(Directory.GetCurrentDirectory(), "wabbajack-cli.bat");
if (File.Exists(file) && await File.ReadAllTextAsync(file) == data) return;
var parent = Directory.GetParent(file).FullName;
if (!Directory.Exists(file))
Directory.CreateDirectory(parent);
await File.WriteAllTextAsync(file, data);
}
catch (Exception ex)