Skip to content

Commit

Permalink
Merge branch 'main' into fix/mod-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz committed Dec 1, 2024
2 parents 79ca322 + 5e07df8 commit e103820
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions primedev/mods/modmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ void ModManager::LoadMods()
if (m_bHasLoadedMods)
UnloadMods();

std::vector<fs::path> modDirs;

// ensure dirs exist
fs::remove_all(GetCompiledAssetsPath());
fs::create_directories(GetModFolderPath());
Expand Down Expand Up @@ -171,6 +169,7 @@ void ModManager::LoadMods()
}
}

// Load mod info from filesystem into `m_LoadedMods`
SearchFilesystemForMods();

// This is used to check if some mods have a folder but no entry in enabledmods.json
Expand Down Expand Up @@ -664,6 +663,8 @@ void ModManager::SearchFilesystemForMods()
{
mod.m_bEnabled = m_EnabledModsCfg[mod.Name.c_str()][mod.Version.c_str()].IsTrue();
}
if (m_bHasEnabledModsCfg && m_EnabledModsCfg.HasMember(mod.Name.c_str()))
mod.m_bEnabled = m_EnabledModsCfg[mod.Name.c_str()].IsTrue();
else
mod.m_bEnabled = true;

Expand Down
12 changes: 11 additions & 1 deletion primedev/mods/modmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,19 @@ class ModManager
std::unordered_set<std::string> m_PluginDependencyConstants;

private:
void SearchFilesystemForMods();
void ExportModsConfigurationToFile();

/**
* Load information for all mods from filesystem.
*
* This looks for mods in several directories (expecting them to be formatted in
* some way); it then uses respective `mod.json` manifest files to create `Mod`
* instances, which are then stored in the `m_LoadedMods` variable.
*
* @returns nothing
**/
void SearchFilesystemForMods();

public:
ModManager();
void LoadMods();
Expand Down

0 comments on commit e103820

Please sign in to comment.