Small fixes for a bunch of small issues that came up in the past few weeks.

This commit is contained in:
Timothy Baldridge 2020-03-18 20:10:55 -06:00
parent 61374fae2c
commit 3e2b23f07d
5 changed files with 71 additions and 10 deletions

View File

@ -18,6 +18,7 @@ namespace Wabbajack.Common
Fallout3,
[Description("Fallout New Vegas")]
FalloutNewVegas,
[Description("Skyrim Legendary Edition")]
Skyrim,
[Description("Skyrim Special Edition")]
SkyrimSpecialEdition,
@ -63,6 +64,9 @@ namespace Wabbajack.Common
// Nexus DB id for the game, used in some specific situations
public long NexusGameId { get; internal set; }
public string MO2Name { get; internal set; }
public string HumanFriendlyGameName => Game.GetDescription();
public string GameLocationRegistryKey { get; internal set; }
// to get steam ids: https://steamdb.info
public List<int> SteamIDs { get; internal set; }
@ -74,6 +78,9 @@ namespace Wabbajack.Common
public List<string> RequiredFiles { get; internal set; }
public bool Disabled { get; internal set; }
// Games that this game are commonly confused with, for example Skyrim SE vs Skyrim LE
public Game[] CommonlyConfusedWith { get; set; }
public string InstalledVersion
{
get
@ -104,6 +111,30 @@ namespace Wabbajack.Common
}
}
public static class EnumExtensions
{
public static string GetDescription<T>(this T enumerationValue)
where T : struct
{
var type = enumerationValue.GetType();
if(!type.IsEnum)
{
throw new ArgumentException($"{nameof(enumerationValue)} must be of Enum type", nameof(enumerationValue));
}
var memberInfo = type.GetMember(enumerationValue.ToString());
if(memberInfo.Length > 0)
{
var attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if(attrs.Length > 0)
{
return ((DescriptionAttribute)attrs[0]).Description;
}
}
return enumerationValue.ToString();
}
}
public class GameRegistry
{
public static GameMetaData GetByMO2ArchiveName(string gameName)
@ -150,12 +181,17 @@ namespace Wabbajack.Common
{
SupportedModManager = ModManager.MO2,
Game = Game.Morrowind,
Disabled = true,
SteamIDs = new List<int>{0},
Disabled = false,
SteamIDs = new List<int>{22320},
NexusName = "morrowind",
NexusGameId = 100,
MO2Name = "Morrowind",
MO2ArchiveName = "morrowind"
MO2ArchiveName = "morrowind",
RequiredFiles = new List<string>
{
"Morrowind.exe"
},
MainExecutable = "Morrowind.exe"
}
},
{
@ -231,7 +267,8 @@ namespace Wabbajack.Common
{
"tesv.exe"
},
MainExecutable = "TESV.exe"
MainExecutable = "TESV.exe",
CommonlyConfusedWith = new [] {Game.SkyrimSpecialEdition, Game.SkyrimVR}
}
},
{
@ -249,7 +286,8 @@ namespace Wabbajack.Common
{
"SkyrimSE.exe"
},
MainExecutable = "SkyrimSE.exe"
MainExecutable = "SkyrimSE.exe",
CommonlyConfusedWith = new []{Game.Skyrim, Game.SkyrimVR}
}
},
{

View File

@ -54,11 +54,24 @@ namespace Wabbajack.Lib
GameFolder = game.GameLocation();
if (GameFolder == null)
{
var otherGame = game.CommonlyConfusedWith.Where(g => g.MetaData().IsInstalled).Select(g => g.MetaData()).FirstOrDefault();
if (otherGame != null)
{
await Utils.Log(new CriticalFailureIntervention(
$"In order to do a proper install Wabbajack needs to know where your {game.MO2Name} folder resides. We tried looking the " +
"game location up in the Windows Registry but were unable to find it, please make sure you launch the game once before running this installer. ",
"Could not find game location")).Task;
$"In order to do a proper install Wabbajack needs to know where your {game.HumanFriendlyGameName} folder resides. However this game doesn't seem to be installed, we did however find a installed" +
$"copy of {otherGame.HumanFriendlyGameName}, did you install the wrong game?",
$"Could not locate {game.HumanFriendlyGameName}"))
.Task;
}
else
{
await Utils.Log(new CriticalFailureIntervention(
$"In order to do a proper install Wabbajack needs to know where your {game.HumanFriendlyGameName} folder resides. However this game doesn't seem to be installed",
$"Could not locate {game.HumanFriendlyGameName}"))
.Task;
}
Utils.Log("Exiting because we couldn't find the game folder.");
return false;
}

View File

@ -15,6 +15,8 @@ namespace Wabbajack.Lib
public long VideoMemorySize { get; set; }
public long SystemMemorySize { get; set; }
public Version WindowsVersion { get; set; }
/// <summary>
/// Value used in LE ENBs for VideoMemorySizeMb
/// </summary>

View File

@ -55,7 +55,8 @@ namespace Wabbajack.Util
ScreenWidth = width,
ScreenHeight = height,
VideoMemorySize = video_memory,
SystemMemorySize = (long)memory.ullTotalPhys
SystemMemorySize = (long)memory.ullTotalPhys,
WindowsVersion = Environment.OSVersion.Version
};
}
}

View File

@ -33,6 +33,13 @@ namespace Wabbajack
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
var p = SystemParametersConstructor.Create();
Utils.Log($"Detected Windows Version: {p.WindowsVersion}");
if (!(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.");
Utils.Log(
$"System settings - ({p.SystemMemorySize.ToFileSizeString()} RAM), Display: {p.ScreenWidth} x {p.ScreenHeight} ({p.VideoMemorySize.ToFileSizeString()} VRAM - VideoMemorySizeMb={p.EnbLEVRAMSize})");