Skip to content

Commit

Permalink
Fix doubled games & anti cheat detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Drommedhar committed Nov 2, 2024
1 parent 6cc4df2 commit 8255561
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 36 additions & 2 deletions DlssUpdater/Singletons/GameContainer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Text.Json;
Expand Down Expand Up @@ -148,14 +149,45 @@ private async Task loadGamesAsync()
.Select(g => g.First())
.ToList();

// We need to check our local list against the library games and remove
// the ones that are no longer reported
List<GameInfo> gamesToDelete = [];
foreach (var item in Games)
{
if (item.LibraryType == LibraryType.Manual)
{
continue;
}

var game = totalGames.FirstOrDefault(g => g.UniqueId == item.UniqueId);
if(game is null)
{
gamesToDelete.Add(item);
}
}
foreach (var item in gamesToDelete)
{
Games.Remove(item);
}

var amount = totalGames.Count;
var current = 0;
foreach (var item in totalGames)
{
current++;
InfoMessage?.Invoke(this, $"Parsing games {current}/{amount}");
var index = -1;
if(item.LibraryType != LibraryType.Manual)
{
// For library games, we check against the id, not the path
index = Games.IndexOf(g => g.UniqueId == item.UniqueId);
}
else
{
index = Games.IndexOf(g => g.GamePath == item.GamePath);
}

var index = Games.IndexOf(g => g.GamePath == item.GamePath);

if (index != -1)
{
var id = Games[index].UniqueId;
Expand All @@ -164,11 +196,13 @@ private async Task loadGamesAsync()
Games[index].UniqueId = id;
Games[index].IsHidden = isHidden;
await Games[index].GatherInstalledVersions();
Games[index].Update();
}
else
{
var info = new GameInfo(item);
await info.GatherInstalledVersions();
info.Update();
Games.Add(info);
}
_watcher.AddFile(item);
Expand Down
2 changes: 2 additions & 0 deletions DlssUpdater/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 2.0.5.0
* Executable is now properly signed
* Splashscreen shows progress for each library
* Correctly remove games from library if they are no logner reported by launcher
* Detect anti cheat on startup again

# 2.0.4.0
* Improve speed of game gather step
Expand Down

0 comments on commit 8255561

Please sign in to comment.