最適化: ラベル表示状態のキャッシュ永続化および実在検証の超高速化

- UnifiedGameCacheEntryにIsModded等のラベル状態を保持し、起動直後の0秒時点から全ラベルを即時表示
- フォルダ更新日時(LastWriteTime)比較により、不変ゲームの重いディスクI/O検証を完全スキップ
- 実在検証完了後に一覧およびステータスラベルの最新描画リフレッシュを追加
This commit is contained in:
armonica committed 2026-10-20 15:11:37 +09:00
1 parent b0fdea2411
commit f50976a6c0
2 files changed
+44 -6

No files matched your search

+38 -5
View File
@@ -54,6 +54,7 @@ namespace GameLauncher.Services
public int TkoolEngineType { get; set; }
public bool HasCustomApplyMod { get; set; }
public bool ApplyMod { get; set; } = true;
public bool IsModded { get; set; }
public Dictionary<string, bool>? PluginSettings { get; set; }
public bool IsAsar { get; set; }
public bool IsAsarExtracted { get; set; }
@@ -198,7 +199,7 @@ namespace GameLauncher.Services
LastLaunched = entry.LastLaunched,
FolderLastModified = entry.FolderLastModified,
IsBookmarked = entry.IsBookmarked,
IsModded = false,
IsModded = entry.IsModded,
IsAsar = entry.IsAsar,
IsAsarExtracted = entry.IsAsarExtracted,
AsarPath = entry.AsarPath,
@@ -471,6 +472,7 @@ namespace GameLauncher.Services
TkoolEngineType = (int)tg.EngineType,
HasCustomApplyMod = tg.HasCustomApplyMod,
ApplyMod = tg.ApplyMod,
IsModded = tg.IsModded,
PluginSettings = tg.PluginSettings.Count > 0 ? tg.PluginSettings : null,
IsAsar = tg.IsAsar,
IsAsarExtracted = tg.IsAsarExtracted,
@@ -637,14 +639,45 @@ namespace GameLauncher.Services
onProgress(current, total, $"実在検証中... ({current}/{total})");
}
// 実在検証
if (!Directory.Exists(game.RootDirectory))
// 実在検証および更新日時の取得
DateTime currentLastWrite;
try
{
if (!Directory.Exists(game.RootDirectory))
{
onGameRemoved(game);
Interlocked.Exchange(ref cacheNeedsSave, 1);
return;
}
currentLastWrite = Directory.GetLastWriteTime(game.RootDirectory);
}
catch
{
onGameRemoved(game);
Interlocked.Exchange(ref cacheNeedsSave, 1);
return;
}
// キャッシュのフォルダ更新日時と完全一致している場合、内部構成(exe/plugins/アーカイブ/EVB等)は不変のため
// 重いディスクI/O(EVBバイナリ解析、plugins.js読み取り、wolf走査等)を完全にスキップして超高速化
bool isUnchanged = game.FolderLastModified.HasValue && game.FolderLastModified.Value == currentLastWrite;
if (isUnchanged)
{
// 未ロードのアイコンのみ必要に応じてロード
if (game.IconImage == null)
{
var icon = LoadIcon(game.ExecutablePath, game.RootDirectory);
if (icon != null)
{
game.IconImage = icon;
onGameUpdated(game);
}
}
return;
}
// 更新があった、または初回検証の場合は更新日時を最新化
game.FolderLastModified = currentLastWrite;
Interlocked.Exchange(ref cacheNeedsSave, 1);
if (game is UnityGameItem ug)
{
if (!File.Exists(ug.ExecutablePath))