Fix Native Game compiler installs

This commit is contained in:
Timothy Baldridge 2022-09-26 17:39:50 -06:00
parent b94e55c78b
commit 931733c49d
2 changed files with 42 additions and 32 deletions

View File

@ -3,6 +3,7 @@
#### Version - 3.0.1.6 - 9/??/2022
* Fix Cyberpunk 2077 GoG recognition
* Add a CLI command `list-games` to list all games recognized by WJ and their versions/locations
* Fix Native Game compiler installs
#### Version - 3.0.1.5 - 9/26/2022
* Fix MO2ArchiveName resolution

View File

@ -169,7 +169,11 @@ public class StandardInstaller : AInstaller<StandardInstaller>
private void CreateOutputMods()
{
_configuration.Install.Combine("profiles")
// Non MO2 Installs won't have this
var profileDir = _configuration.Install.Combine("profiles");
if (!profileDir.DirectoryExists()) return;
profileDir.Combine("profiles")
.EnumerateFiles()
.Where(f => f.FileName == Consts.SettingsIni)
.Do(f =>
@ -331,45 +335,50 @@ public class StandardInstaller : AInstaller<StandardInstaller>
private void SetScreenSizeInPrefs()
{
var profilesPath = _configuration.Install.Combine("profiles");
if (_configuration.SystemParameters == null)
_logger.LogWarning("No SystemParameters set, ignoring ini settings for system parameters");
var config = new IniParserConfiguration {AllowDuplicateKeys = true, AllowDuplicateSections = true};
config.CommentRegex = new Regex(@"^(#|;)(.*)");
var oblivionPath = (RelativePath) "Oblivion.ini";
foreach (var file in _configuration.Install.Combine("profiles").EnumerateFiles()
.Where(f => ((string) f.FileName).EndsWith("refs.ini") || f.FileName == oblivionPath))
try
{
var parser = new FileIniDataParser(new IniDataParser(config));
var data = parser.ReadFile(file.ToString());
var modified = false;
if (data.Sections["Display"] != null)
if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null)
{
data.Sections["Display"]["iSize W"] =
_configuration.SystemParameters.ScreenWidth.ToString(CultureInfo.CurrentCulture);
data.Sections["Display"]["iSize H"] =
_configuration.SystemParameters.ScreenHeight.ToString(CultureInfo.CurrentCulture);
modified = true;
}
if (data.Sections["MEMORY"] != null)
if (data.Sections["MEMORY"]["VideoMemorySizeMb"] != null)
{
data.Sections["MEMORY"]["VideoMemorySizeMb"] =
_configuration.SystemParameters.EnbLEVRAMSize.ToString(CultureInfo.CurrentCulture);
modified = true;
}
if (profilesPath.DirectoryExists())
{
foreach (var file in profilesPath.EnumerateFiles()
.Where(f => ((string) f.FileName).EndsWith("refs.ini") || f.FileName == oblivionPath))
try
{
var parser = new FileIniDataParser(new IniDataParser(config));
var data = parser.ReadFile(file.ToString());
var modified = false;
if (data.Sections["Display"] != null)
if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null)
{
data.Sections["Display"]["iSize W"] =
_configuration.SystemParameters.ScreenWidth.ToString(CultureInfo.CurrentCulture);
data.Sections["Display"]["iSize H"] =
_configuration.SystemParameters.ScreenHeight.ToString(CultureInfo.CurrentCulture);
modified = true;
}
if (!modified) continue;
parser.WriteFile(file.ToString(), data);
_logger.LogTrace("Remapped screen size in {file}", file);
}
catch (Exception ex)
{
_logger.LogCritical(ex, "Skipping screen size remap for {file} due to parse error.", file);
}
if (data.Sections["MEMORY"] != null)
if (data.Sections["MEMORY"]["VideoMemorySizeMb"] != null)
{
data.Sections["MEMORY"]["VideoMemorySizeMb"] =
_configuration.SystemParameters.EnbLEVRAMSize.ToString(CultureInfo.CurrentCulture);
modified = true;
}
if (!modified) continue;
parser.WriteFile(file.ToString(), data);
_logger.LogTrace("Remapped screen size in {file}", file);
}
catch (Exception ex)
{
_logger.LogCritical(ex, "Skipping screen size remap for {file} due to parse error.", file);
}
}
var tweaksPath = (RelativePath) "SSEDisplayTweaks.ini";
foreach (var file in _configuration.Install.EnumerateFiles()