From 39fa07f471e424e6b7fb94f385b1838a1aa01030 Mon Sep 17 00:00:00 2001 From: Frog Date: Sat, 18 Jul 2026 04:30:10 -0700 Subject: [PATCH] Adjust SmokeAPI Config Read Logging - Add additional clarity to SmokeAPI logs for reading DLC unlocked/original state. - Count how many DLCs SmokeAPI attempts to auto unlock, include this in the logging --- CreamInstaller/Forms/SelectForm.cs | 3 ++- CreamInstaller/Resources/SmokeAPI.cs | 34 ++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs index 811ac8e..6bec632 100644 --- a/CreamInstaller/Forms/SelectForm.cs +++ b/CreamInstaller/Forms/SelectForm.cs @@ -1476,7 +1476,8 @@ internal sealed partial class SelectForm : CustomForm { foreach (string directory in selection.DllDirectories) { - var (enabledIds, disabledIds) = SmokeAPI.ReadConfigDlcIds(directory); + HashSet allDlcIds = selection.DLC.Select(d => d.Id).ToHashSet(); + var (enabledIds, disabledIds) = SmokeAPI.ReadConfigDlcIds(directory, allDlcIds); if (enabledIds is not null) // config was found and read { foreach (SelectionDLC dlc in selection.DLC) diff --git a/CreamInstaller/Resources/SmokeAPI.cs b/CreamInstaller/Resources/SmokeAPI.cs index ca8eebb..2cfcf60 100644 --- a/CreamInstaller/Resources/SmokeAPI.cs +++ b/CreamInstaller/Resources/SmokeAPI.cs @@ -34,7 +34,7 @@ internal static class SmokeAPI cache = directory + @"\SmokeAPI.cache.json"; } - internal static (HashSet enabledDlcIds, HashSet disabledDlcIds) ReadConfigDlcIds(string directory) + internal static (HashSet enabledDlcIds, HashSet disabledDlcIds) ReadConfigDlcIds(string directory, HashSet allDlcIds = null) { directory.GetSmokeApiComponents(out _, out _, out _, out _, out _, out string config, out _, out _, out _); if (!config.FileExists()) @@ -47,19 +47,45 @@ internal static class SmokeAPI HashSet enabled = []; HashSet disabled = []; + int overrideLocked = 0, overrideUnlocked = 0, overrideOriginal = 0; + HashSet allOverriddenIds = []; if (obj["override_dlc_status"] is JObject overrideStatus) foreach (JProperty prop in overrideStatus.Properties()) - if (prop.Value.ToString() == "locked") - disabled.Add(prop.Name); + { + _ = allOverriddenIds.Add(prop.Name); + switch (prop.Value.ToString()) + { + case "locked": + disabled.Add(prop.Name); + overrideLocked++; + break; + case "unlocked": + enabled.Add(prop.Name); + overrideUnlocked++; + break; + case "original": + overrideOriginal++; + break; + } + } + int extraDlcEntries = 0; if (obj["extra_dlcs"] is JObject extraDlcs) foreach (JProperty appProp in extraDlcs.Properties()) if (appProp.Value["dlcs"] is JObject dlcs) foreach (JProperty dlcProp in dlcs.Properties()) + { enabled.Add(dlcProp.Name); + extraDlcEntries++; + } - ProgramData.Log.Info($"[SmokeAPI] Read config: {config} — {enabled.Count} enabled, {disabled.Count} disabled DLC", LogDestination.Unlocker); + int notPresent = allDlcIds?.Count(id => !allOverriddenIds.Contains(id)) ?? 0; + + string logMessage = $"[SmokeAPI] Read config: {config} — override_dlc_status: {overrideLocked} locked, {overrideUnlocked} unlocked, {overrideOriginal} original | extra_dlcs: {extraDlcEntries} entries"; + if (notPresent > 0) + logMessage += $" | {notPresent} game DLCs not present in config — SmokeAPI will attempt to unlock automatically"; + ProgramData.Log.Info(logMessage, LogDestination.Unlocker); return (enabled, disabled); } catch (Exception e)