Skip to content

Commit

Permalink
Check mods status post patching
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauriethefish committed Oct 25, 2023
1 parent 47b668c commit 13bc113
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion QuestPatcher.Core/Modding/ConfigModProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public abstract class ConfigModProvider : JsonConverter<IMod>, IModProvider
public abstract string FileExtension { get; }
public abstract Task<IMod> 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();
}
Expand Down
2 changes: 1 addition & 1 deletion QuestPatcher.Core/Modding/IModProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IModProvider
/// Loads the mods from the quest.
/// </summary>
/// <returns>Task completing when all mods are loaded</returns>
Task LoadMods();
Task LoadModsStatus();

/// <summary>
/// Clears currently loaded mods
Expand Down
8 changes: 7 additions & 1 deletion QuestPatcher.Core/Modding/ModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion QuestPatcher.Core/Modding/QModProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> modFiles = await _debugBridge.ListDirectoryFiles(_modManager.ModsPath, true);
List<string> libFiles = await _debugBridge.ListDirectoryFiles(_modManager.LibsPath, true);
Expand Down
2 changes: 2 additions & 0 deletions QuestPatcher.Core/Patching/PatchingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 13bc113

Please sign in to comment.