Adjust Unlocker Scanning Logs

- Adjusts the unlocker scanning logs to go to the correct destination
- Adjusts the headers for some of the logs so logs are slightly more clear
This commit is contained in:
Frog
2026-07-18 04:18:41 -07:00
parent fcb099b960
commit 896ad4857e
2 changed files with 40 additions and 45 deletions
+24 -29
View File
@@ -1460,7 +1460,7 @@ internal sealed partial class SelectForm : CustomForm
ProgramData.WriteExtraProtectionChoices(extraProtectionChoices);
// Detect installed unlockers and proxy DLLs from disk for all selections
// Detect installed unlockers, proxy DLLs, and read config files — grouped per-game
foreach (Selection selection in Selection.All.Keys)
{
selection.InstalledUnlocker = selection.DetectInstalledUnlocker();
@@ -1472,42 +1472,37 @@ internal sealed partial class SelectForm : CustomForm
selection.UseProxy = true;
selection.Proxy = detectedProxy;
}
}
}
// Read config files for detected unlockers and adjust DLC enabled state accordingly
foreach (Selection selection in Selection.All.Keys)
{
if (selection.InstalledUnlocker == InstalledUnlocker.SmokeAPI)
{
foreach (string directory in selection.DllDirectories)
if (selection.InstalledUnlocker == InstalledUnlocker.SmokeAPI)
{
var (enabledIds, disabledIds) = SmokeAPI.ReadConfigDlcIds(directory);
if (enabledIds is not null) // config was found and read
foreach (string directory in selection.DllDirectories)
{
foreach (SelectionDLC dlc in selection.DLC)
var (enabledIds, disabledIds) = SmokeAPI.ReadConfigDlcIds(directory);
if (enabledIds is not null) // config was found and read
{
if (enabledIds.Contains(dlc.Id))
dlc.Enabled = true;
else if (disabledIds.Contains(dlc.Id))
dlc.Enabled = false;
else
dlc.Enabled = false; // not in config at all
foreach (SelectionDLC dlc in selection.DLC)
{
if (enabledIds.Contains(dlc.Id))
dlc.Enabled = true;
else if (disabledIds.Contains(dlc.Id))
dlc.Enabled = false;
else
dlc.Enabled = false; // not in config at all
}
break;
}
break;
}
}
}
else if (selection.InstalledUnlocker == InstalledUnlocker.CreamAPI)
{
foreach (string directory in selection.DllDirectories)
else if (selection.InstalledUnlocker == InstalledUnlocker.CreamAPI)
{
HashSet<string> enabledIds = CreamAPI.ReadConfigDlcIds(directory);
if (enabledIds is not null)
foreach (string directory in selection.DllDirectories)
{
foreach (SelectionDLC dlc in selection.DLC)
dlc.Enabled = enabledIds.Contains(dlc.Id);
break;
HashSet<string> enabledIds = CreamAPI.ReadConfigDlcIds(directory);
if (enabledIds is not null)
{
foreach (SelectionDLC dlc in selection.DLC)
dlc.Enabled = enabledIds.Contains(dlc.Id);
break;
}
}
}
}
+16 -16
View File
@@ -155,14 +155,14 @@ internal sealed class Selection : IEquatable<Selection>
out string smokeConfig, out _, out _, out _);
if (smokeConfig.FileExists() || smokeOldConfig.FileExists())
{
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.SmokeAPI;
}
directory.GetCreamApiComponents(out _, out _, out _, out _, out string creamConfig);
if (creamConfig.FileExists())
{
ProgramData.Log.Info($"[Unlocker] CreamAPI detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] CreamAPI detected | Game: {Name} ({Id})", LogDestination.Unlocker);
ReadCreamApiConfig(creamConfig);
return InstalledUnlocker.CreamAPI;
}
@@ -175,10 +175,10 @@ internal sealed class Selection : IEquatable<Selection>
if ((smokeApi32.FileExists() && smokeApi32.IsResourceFile(ResourceIdentifier.Steamworks32))
|| (smokeApi64.FileExists() && smokeApi64.IsResourceFile(ResourceIdentifier.Steamworks64)))
{
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected (via _o files) | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected (via _o files) | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.SmokeAPI;
}
ProgramData.Log.Info($"[Unlocker] CreamAPI detected (via _o files) | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] CreamAPI detected (via _o files) | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.CreamAPI;
}
}
@@ -189,7 +189,7 @@ internal sealed class Selection : IEquatable<Selection>
out _, out string config, out _, out _);
if (config.FileExists() || api32_o.FileExists() || api64_o.FileExists())
{
ProgramData.Log.Info($"[Unlocker] ScreamAPI detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] ScreamAPI detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.ScreamAPI;
}
}
@@ -200,14 +200,14 @@ internal sealed class Selection : IEquatable<Selection>
out string config, out _);
if (config.FileExists() || api32_o.FileExists() || api64_o.FileExists())
{
ProgramData.Log.Info($"[Unlocker] UplayR1 detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] UplayR1 detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.UplayR1;
}
directory.GetUplayR2Components(out _, out _, out _, out api32_o, out _, out api64_o,
out config, out _);
if (config.FileExists() || api32_o.FileExists() || api64_o.FileExists())
{
ProgramData.Log.Info($"[Unlocker] UplayR2 detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] UplayR2 detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.UplayR2;
}
}
@@ -220,7 +220,7 @@ internal sealed class Selection : IEquatable<Selection>
proxy.FileExists() && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|| config.FileExists())
{
ProgramData.Log.Info($"[Unlocker] Koaloader detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] Koaloader detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.Koaloader;
}
@@ -229,33 +229,33 @@ internal sealed class Selection : IEquatable<Selection>
directory.GetSmokeApiComponents(out _, out _, out _, out _, out _, out string smokeConfig, out _, out _, out _);
if (smokeConfig.FileExists())
{
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected (proxy) | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] SmokeAPI detected (proxy) | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.SmokeAPI;
}
directory.GetCreamApiComponents(out _, out _, out _, out _, out string creamConfig);
if (creamConfig.FileExists())
{
ProgramData.Log.Info($"[Unlocker] CreamAPI detected (proxy) | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] CreamAPI detected (proxy) | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.CreamAPI;
}
if (directory.GetSmokeApiProxies().Any(proxy =>
proxy.FileExists() && (proxy.IsResourceFile(ResourceIdentifier.Steamworks32) ||
proxy.IsResourceFile(ResourceIdentifier.Steamworks64))))
{
ProgramData.Log.Info($"[Unlocker] SmokeAPI proxy DLL detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] SmokeAPI proxy DLL detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.SmokeAPI;
}
if (directory.GetCreamApiProxies().Any(proxy =>
proxy.FileExists() && (proxy.IsResourceFile(ResourceIdentifier.Steamworks32) ||
proxy.IsResourceFile(ResourceIdentifier.Steamworks64))))
{
ProgramData.Log.Info($"[Unlocker] CreamAPI proxy DLL detected | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] CreamAPI proxy DLL detected | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.CreamAPI;
}
}
}
ProgramData.Log.Info($"[Unlocker] No installed unlocker found | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[Unlocker] No installed unlocker found | Game: {Name} ({Id})", LogDestination.Unlocker);
return InstalledUnlocker.None;
}
@@ -278,11 +278,11 @@ internal sealed class Selection : IEquatable<Selection>
{
if (!configPath.FileExists())
{
ProgramData.Log.Info($"[Unlocker] Config not found: {configPath} | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[CreamAPI] Config not found: {configPath} | Game: {Name} ({Id})", LogDestination.Unlocker);
return;
}
ProgramData.Log.Info($"[Unlocker] Reading config: {configPath} | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[CreamAPI] Reading config: {configPath} | Game: {Name} ({Id})", LogDestination.Unlocker);
string[] lines = File.ReadAllLines(configPath);
foreach (string line in lines)
{
@@ -294,7 +294,7 @@ internal sealed class Selection : IEquatable<Selection>
{
string value = parts[1].Trim();
UseExtraProtection = value.Equals("true", StringComparison.OrdinalIgnoreCase);
ProgramData.Log.Info($"[Unlocker] ExtraProtection = {UseExtraProtection} | Game: {Name} ({Id})", LogDestination.Scan);
ProgramData.Log.Info($"[CreamAPI] ExtraProtection = {UseExtraProtection} | Game: {Name} ({Id})", LogDestination.Unlocker);
}
break;
}