mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fixes for features requested by Ultimate Skyrim
This commit is contained in:
parent
b5b635ac39
commit
452bd7c886
@ -535,6 +535,7 @@ namespace Wabbajack.Lib
|
||||
new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Papyrus Compiler")),
|
||||
new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Skyrim")),
|
||||
new IgnoreRegex(this, Consts.GameFolderFilesDir + "\\\\.*\\.bsa"),
|
||||
new IncludeRegex(this, "^[^\\\\]*\\.bat$"),
|
||||
new IncludeModIniData(this),
|
||||
new DirectMatch(this),
|
||||
new IncludeTaggedMods(this, Consts.WABBAJACK_INCLUDE),
|
||||
|
@ -315,16 +315,32 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
var parser = new FileIniDataParser(new IniDataParser(config));
|
||||
var data = parser.ReadFile(file);
|
||||
if (data.Sections["Display"] == null)
|
||||
return;
|
||||
|
||||
if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null)
|
||||
bool modified = false;
|
||||
if (data.Sections["Display"] != null)
|
||||
{
|
||||
data.Sections["Display"]["iSize W"] = SystemParameters.ScreenWidth.ToString(CultureInfo.CurrentCulture);
|
||||
data.Sections["Display"]["iSize H"] = SystemParameters.ScreenHeight.ToString(CultureInfo.CurrentCulture);
|
||||
|
||||
if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null)
|
||||
{
|
||||
data.Sections["Display"]["iSize W"] =
|
||||
SystemParameters.ScreenWidth.ToString(CultureInfo.CurrentCulture);
|
||||
data.Sections["Display"]["iSize H"] =
|
||||
SystemParameters.ScreenHeight.ToString(CultureInfo.CurrentCulture);
|
||||
modified = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (data.Sections["MEMORY"] != null)
|
||||
{
|
||||
if (data.Sections["MEMORY"]["VideoMemorySizeMb"] != null)
|
||||
{
|
||||
data.Sections["MEMORY"]["VideoMemorySizeMb"] =
|
||||
SystemParameters.EnbLEVRAMSize.ToString(CultureInfo.CurrentCulture);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
parser.WriteFile(file, data);
|
||||
if (modified)
|
||||
parser.WriteFile(file, data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1,8 +1,23 @@
|
||||
namespace Wabbajack.Lib
|
||||
using System;
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public class SystemParameters
|
||||
{
|
||||
private static long ToMB(long input)
|
||||
{
|
||||
// KB MB
|
||||
return input / 1024 / 1024;
|
||||
}
|
||||
|
||||
public int ScreenHeight { get; set; }
|
||||
public int ScreenWidth { get; set; }
|
||||
public long VideoMemorySize { get; set; }
|
||||
public long SystemMemorySize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Value used in LE ENBs for VideoMemorySizeMb
|
||||
/// </summary>
|
||||
public long EnbLEVRAMSize => Math.Min(ToMB(SystemMemorySize) + ToMB(VideoMemorySize), 10240);
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,11 @@ namespace Wabbajack.Test
|
||||
$"matchAll= {Path.GetFileName(modfiles[2].Download)}"
|
||||
});
|
||||
|
||||
File.WriteAllLines(Path.Combine(utils.MO2Folder, "startup.bat"), new []
|
||||
{
|
||||
"ModOrganizer2.exe SKSE"
|
||||
});
|
||||
|
||||
|
||||
var modlist = await CompileAndInstall(profile);
|
||||
utils.VerifyAllFiles();
|
||||
|
@ -8,6 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.CompilationSteps.CompilationErrors;
|
||||
using Wabbajack.Util;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
|
||||
@ -197,15 +198,20 @@ namespace Wabbajack.Test
|
||||
"iSize H=3",
|
||||
"iSize W=-200",
|
||||
"[Display]",
|
||||
"foo=4"
|
||||
"foo=4",
|
||||
"[MEMORY]",
|
||||
"VideoMemorySizeMb=22"
|
||||
});
|
||||
|
||||
var modlist = await CompileAndInstall(profile);
|
||||
|
||||
var ini = Path.Combine(utils.InstallFolder, "profiles", profile, "somegameprefs.ini").LoadIniFile();
|
||||
|
||||
var sysinfo = SystemParametersConstructor.Create();
|
||||
|
||||
Assert.AreEqual(System.Windows.SystemParameters.PrimaryScreenHeight.ToString(), ini?.Display?["iSize H"]);
|
||||
Assert.AreEqual(System.Windows.SystemParameters.PrimaryScreenWidth.ToString(), ini?.Display?["iSize W"]);
|
||||
Assert.AreEqual(sysinfo.EnbLEVRAMSize.ToString(), ini?.MEMORY?["VideoMemorySizeMb"]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Util;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using MahApps.Metro.Controls;
|
||||
using Microsoft.VisualBasic;
|
||||
using PInvoke;
|
||||
using SharpDX.DXGI;
|
||||
using Wabbajack.Lib;
|
||||
using static PInvoke.User32;
|
||||
using static PInvoke.Gdi32;
|
||||
@ -44,10 +45,17 @@ namespace Wabbajack.Util
|
||||
public static SystemParameters Create()
|
||||
{
|
||||
var (width, height, _) = GetDisplays().First(d => d.IsPrimary);
|
||||
|
||||
using var f = new Factory1();
|
||||
var video_memory = f.Adapters1.Select(a =>
|
||||
Math.Max(a.Description.DedicatedSystemMemory, (long)a.Description.DedicatedVideoMemory)).Max();
|
||||
var memory = Common.Utils.GetMemoryStatus();
|
||||
return new SystemParameters
|
||||
{
|
||||
ScreenWidth = width,
|
||||
ScreenHeight = height
|
||||
ScreenHeight = height,
|
||||
VideoMemorySize = video_memory,
|
||||
SystemMemorySize = (long)memory.ullTotalPhys
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using MahApps.Metro.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.LibCefHelpers;
|
||||
using Wabbajack.Util;
|
||||
using Application = System.Windows.Application;
|
||||
using Utils = Wabbajack.Common.Utils;
|
||||
|
||||
@ -31,6 +32,9 @@ namespace Wabbajack
|
||||
};
|
||||
|
||||
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
|
||||
var p = SystemParametersConstructor.Create();
|
||||
Utils.Log(
|
||||
$"System settings - ({p.SystemMemorySize.ToFileSizeString()} RAM), Display: {p.ScreenWidth} x {p.ScreenHeight} ({p.VideoMemorySize.ToFileSizeString()} VRAM - VideoMemorySizeMb={p.EnbLEVRAMSize})");
|
||||
|
||||
// Run logic to associate wabbajack lists with this app in the background
|
||||
Task.Run(async () =>
|
||||
|
@ -71,6 +71,7 @@
|
||||
<PackageReference Include="ReactiveUI" Version="11.2.3" />
|
||||
<PackageReference Include="ReactiveUI.Fody" Version="11.2.3" />
|
||||
<PackageReference Include="ReactiveUI.WPF" Version="11.2.3" />
|
||||
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
|
||||
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
|
||||
<PackageReference Include="WPFThemes.DarkBlend" Version="1.0.8" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user