diff --git a/QuestPatcher.Core/Modding/ConfigModProvider.cs b/QuestPatcher.Core/Modding/ConfigModProvider.cs index b6c1545..6e3e2bb 100644 --- a/QuestPatcher.Core/Modding/ConfigModProvider.cs +++ b/QuestPatcher.Core/Modding/ConfigModProvider.cs @@ -13,7 +13,7 @@ public abstract class ConfigModProvider : JsonConverter, IModProvider public abstract string FileExtension { get; } public abstract Task LoadFromFile(string modPath); public abstract Task DeleteMod(IMod mod); - public abstract Task LoadMods(); + public abstract Task LoadModsStatus(); public abstract void ClearMods(); public abstract Task LoadLegacyMods(); } diff --git a/QuestPatcher.Core/Modding/IModProvider.cs b/QuestPatcher.Core/Modding/IModProvider.cs index 9b99777..7882f76 100644 --- a/QuestPatcher.Core/Modding/IModProvider.cs +++ b/QuestPatcher.Core/Modding/IModProvider.cs @@ -29,7 +29,7 @@ public interface IModProvider /// Loads the mods from the quest. /// /// Task completing when all mods are loaded - Task LoadMods(); + Task LoadModsStatus(); /// /// Clears currently loaded mods diff --git a/QuestPatcher.Core/Modding/ModManager.cs b/QuestPatcher.Core/Modding/ModManager.cs index 7fe3f38..187e34b 100644 --- a/QuestPatcher.Core/Modding/ModManager.cs +++ b/QuestPatcher.Core/Modding/ModManager.cs @@ -180,9 +180,15 @@ public async Task LoadModsForCurrentApp() await SaveMods(); } + await UpdateModsStatus(); + } + + public async Task UpdateModsStatus() + { + Log.Information("Checking if mods are installed"); foreach (IModProvider provider in _modProviders.Values) { - await provider.LoadMods(); + await provider.LoadModsStatus(); } } diff --git a/QuestPatcher.Core/Modding/QModProvider.cs b/QuestPatcher.Core/Modding/QModProvider.cs index f83c91f..ac3f371 100644 --- a/QuestPatcher.Core/Modding/QModProvider.cs +++ b/QuestPatcher.Core/Modding/QModProvider.cs @@ -243,7 +243,7 @@ public override void Write(Utf8JsonWriter writer, IMod value, JsonSerializerOpti JsonSerializer.Serialize(writer, AssertQMod(value).Manifest, options); } - public override async Task LoadMods() + public override async Task LoadModsStatus() { List modFiles = await _debugBridge.ListDirectoryFiles(_modManager.ModsPath, true); List libFiles = await _debugBridge.ListDirectoryFiles(_modManager.LibsPath, true); diff --git a/QuestPatcher.Core/Patching/PatchingManager.cs b/QuestPatcher.Core/Patching/PatchingManager.cs index 621eb91..a76aec0 100644 --- a/QuestPatcher.Core/Patching/PatchingManager.cs +++ b/QuestPatcher.Core/Patching/PatchingManager.cs @@ -649,6 +649,8 @@ public async Task PatchApp() // Recreate the mod directories as they will not be present after the uninstall/backup restore await _modManager.CreateModDirectories(); + // When repatching, certain mods may have been deleted when the app was uninstalled, so we will check for this + await _modManager.UpdateModsStatus(); await _installManager.NewApkInstalled(_patchedApkPath);