Skip to content

Commit

Permalink
Added a lot of extra logging for Steam loading to try diagnose issue
Browse files Browse the repository at this point in the history
  • Loading branch information
beeradmoore committed Mar 30, 2024
1 parent c673b7c commit 96aca54
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 42 deletions.
6 changes: 6 additions & 0 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public App()

Logger.Info($"App launch - v{versionString}", null);

Logger.Verbose("Test verbose log");
Logger.Debug("Test debug log");
Logger.Info("Test info log");
Logger.Warning("Test warning log");
Logger.Error("Test error log");

_httpClient.DefaultRequestHeaders.Add("User-Agent", $"dlss-swapper v{versionString}");

GlobalElementTheme = Settings.Instance.AppTheme;
Expand Down
72 changes: 41 additions & 31 deletions src/Data/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,55 +85,65 @@ public string BaseDLSSHash

public void DetectDLSS()
{
BaseDLSSVersion = String.Empty;
CurrentDLSSVersion = "N/A";


if (String.IsNullOrEmpty(InstallPath))
try
{
return;
}
Logger.Info($"Looking for DLSS in {InstallPath}");

if (Directory.Exists(InstallPath) == false)
{
return;
}
BaseDLSSVersion = String.Empty;
CurrentDLSSVersion = "N/A";

var enumerationOptions = new EnumerationOptions();
enumerationOptions.RecurseSubdirectories = true;
enumerationOptions.AttributesToSkip |= FileAttributes.ReparsePoint;
var dlssDlls = Directory.GetFiles(InstallPath, "nvngx_dlss.dll", enumerationOptions);

if (dlssDlls.Length > 0)
{
HasDLSS = true;

// TODO: Handle a single folder with various versions of DLSS detected.
// Currently we are just using the first.
if (String.IsNullOrEmpty(InstallPath))
{
return;
}

foreach (var dlssDll in dlssDlls)
if (Directory.Exists(InstallPath) == false)
{
var dllVersionInfo = FileVersionInfo.GetVersionInfo(dlssDll);
CurrentDLSSVersion = dllVersionInfo.GetFormattedFileVersion();
CurrentDLSSHash = dllVersionInfo.GetMD5Hash();
break;
return;
}

dlssDlls = Directory.GetFiles(InstallPath, "nvngx_dlss.dll.dlsss", enumerationOptions);
var enumerationOptions = new EnumerationOptions();
enumerationOptions.RecurseSubdirectories = true;
enumerationOptions.AttributesToSkip |= FileAttributes.ReparsePoint;
var dlssDlls = Directory.GetFiles(InstallPath, "nvngx_dlss.dll", enumerationOptions);
Logger.Info($"Found {dlssDlls.Length} dlls.");

if (dlssDlls.Length > 0)
{
HasDLSS = true;

// TODO: Handle a single folder with various versions of DLSS detected.
// Currently we are just using the first.

foreach (var dlssDll in dlssDlls)
{
var dllVersionInfo = FileVersionInfo.GetVersionInfo(dlssDll);
BaseDLSSVersion = dllVersionInfo.GetFormattedFileVersion();
BaseDLSSHash = dllVersionInfo.GetMD5Hash();
CurrentDLSSVersion = dllVersionInfo.GetFormattedFileVersion();
CurrentDLSSHash = dllVersionInfo.GetMD5Hash();
break;
}

dlssDlls = Directory.GetFiles(InstallPath, "nvngx_dlss.dll.dlsss", enumerationOptions);
if (dlssDlls.Length > 0)
{
foreach (var dlssDll in dlssDlls)
{
var dllVersionInfo = FileVersionInfo.GetVersionInfo(dlssDll);
BaseDLSSVersion = dllVersionInfo.GetFormattedFileVersion();
BaseDLSSHash = dllVersionInfo.GetMD5Hash();
break;
}
}
}
else
{
HasDLSS = false;
}
}
else
catch (Exception err)
{
HasDLSS = false;
Logger.Error($"Error trying to find DLSS dlls, {err.Message}");
}
}

Expand Down
53 changes: 42 additions & 11 deletions src/Data/Steam/SteamLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public async Task<List<Game>> ListGamesAsync()

var baseSteamAppsFolder = Path.Combine(installPath, "steamapps");

Logger.Info($"Base steamspps folder: {baseSteamAppsFolder}");
var libraryFolders = new List<string>();
libraryFolders.Add(Helpers.PathHelpers.NormalizePath(baseSteamAppsFolder));

Expand Down Expand Up @@ -88,27 +89,57 @@ public async Task<List<Game>> ListGamesAsync()
// Makes sure all library folders are unique.
libraryFolders = libraryFolders.Distinct().ToList();

Logger.Info($"Found {libraryFolders.Count} library folders.");
foreach (var libraryFolder in libraryFolders)
{
if (Directory.Exists(libraryFolder))
Logger.Info(libraryFolder);
}

foreach (var libraryFolder in libraryFolders)
{
try
{
var appManifests = Directory.GetFiles(libraryFolder, "appmanifest_*.acf");
foreach (var appManifest in appManifests)
if (Directory.Exists(libraryFolder))
{
// Don't bother adding Steamworks Common Redistributables.
if (appManifest.EndsWith("appmanifest_228980.acf") == true)
{
continue;
}

var game = GetGameFromAppManifest(appManifest);
if (game != null)
var appManifests = Directory.GetFiles(libraryFolder, "appmanifest_*.acf");
foreach (var appManifest in appManifests)
{
games.Add(game);
Logger.Info($"Loading app manifest file {appManifest}");

// Don't bother adding Steamworks Common Redistributables.
if (appManifest.EndsWith("appmanifest_228980.acf") == true)
{
continue;
}

var game = GetGameFromAppManifest(appManifest);
if (game != null)
{
Logger.Info($"Loaded {game.Title}, installed to {game.InstallPath}");
games.Add(game);
}
else
{
Logger.Error($"Could not load app manifest {Path.GetFileName(appManifest)}");

}
}
}
else
{
Logger.Info($"Library folder does not exist: {libraryFolder}");

}
}
catch (Exception err)
{
Logger.Error($"Unable to load game or game directory, {err.Message}");
}
}

Logger.Info($"Loaded {games.Count} games.");

games.Sort();
_loadedGames.AddRange(games);
_loadedDLSSGames.AddRange(games.Where(g => g.HasDLSS == true));
Expand Down

0 comments on commit 96aca54

Please sign in to comment.