mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Move system startup info into the constructor class
This commit is contained in:
parent
9beafe8da4
commit
87e0a59371
@ -20,36 +20,9 @@ public partial class MainWindow
|
||||
_logger = logger;
|
||||
_loggerProvider = loggerProvider;
|
||||
_systemParams = systemParams;
|
||||
|
||||
InitializeComponent();
|
||||
BlazorWebView.Services = serviceProvider;
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: [Low] Not sure how to set this up.
|
||||
//_logger.LogInformation("Wabbajack Build - {Sha}", ThisAssembly.Git.Sha);
|
||||
_logger.LogInformation("Running in {EntryPoint}", KnownFolders.EntryPoint);
|
||||
|
||||
SystemParameters p = _systemParams.Create();
|
||||
|
||||
_logger.LogInformation("Detected Windows Version: {Version}", Environment.OSVersion.VersionString);
|
||||
|
||||
_logger.LogInformation(
|
||||
"System settings - ({MemorySize} RAM) ({PageSize} Page), Display: {ScreenWidth} x {ScreenHeight} ({Vram} VRAM - VideoMemorySizeMb={ENBVRam})",
|
||||
p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight,
|
||||
p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize);
|
||||
|
||||
if (p.SystemPageSize == 0)
|
||||
_logger.LogInformation(
|
||||
"Page file is disabled! Consider increasing to 20000MB. A disabled page file can cause crashes and poor in-game performance");
|
||||
else if (p.SystemPageSize < 2e+10)
|
||||
_logger.LogInformation(
|
||||
"Page file below recommended! Consider increasing to 20000MB. A suboptimal page file can cause crashes and poor in-game performance");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error during Main Window startup.");
|
||||
Environment.Exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ using Silk.NET.DXGI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Installer;
|
||||
using Wabbajack;
|
||||
using Wabbajack.Paths.IO;
|
||||
using static PInvoke.User32;
|
||||
using UnmanagedType = System.Runtime.InteropServices.UnmanagedType;
|
||||
|
||||
@ -25,6 +26,12 @@ public class SystemParametersConstructor
|
||||
public SystemParametersConstructor(ILogger<SystemParametersConstructor> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
_logger.LogInformation("Wabbajack Build - {Sha}", ThisAssembly.Git.Sha);
|
||||
_logger.LogInformation("Running in {EntryPoint}", KnownFolders.EntryPoint);
|
||||
|
||||
_logger.LogInformation("Detected Windows Version: {Version}", Environment.OSVersion.VersionString);
|
||||
|
||||
}
|
||||
|
||||
private IEnumerable<(int Width, int Height, bool IsPrimary)> GetDisplays()
|
||||
@ -111,7 +118,7 @@ public class SystemParametersConstructor
|
||||
}
|
||||
|
||||
MEMORYSTATUSEX? memory = GetMemoryStatus();
|
||||
return new SystemParameters
|
||||
var p = new SystemParameters
|
||||
{
|
||||
ScreenWidth = width,
|
||||
ScreenHeight = height,
|
||||
@ -119,6 +126,20 @@ public class SystemParametersConstructor
|
||||
SystemMemorySize = (long)memory.ullTotalPhys,
|
||||
SystemPageSize = (long)memory.ullTotalPageFile - (long)memory.ullTotalPhys
|
||||
};
|
||||
|
||||
_logger.LogInformation(
|
||||
"System settings - ({MemorySize} RAM) ({PageSize} Page), Display: {ScreenWidth} x {ScreenHeight} ({Vram} VRAM - VideoMemorySizeMb={ENBVRam})",
|
||||
p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight,
|
||||
p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize);
|
||||
|
||||
if (p.SystemPageSize == 0)
|
||||
_logger.LogInformation(
|
||||
"Page file is disabled! Consider increasing to 20000MB. A disabled page file can cause crashes and poor in-game performance");
|
||||
else if (p.SystemPageSize < 2e+10)
|
||||
_logger.LogInformation(
|
||||
"Page file below recommended! Consider increasing to 20000MB. A suboptimal page file can cause crashes and poor in-game performance");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DynamicData" Version="7.4.9" />
|
||||
<PackageReference Include="GitInfo" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="6.0.101-preview.11.2349" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user