@@ -471,6 +471,55 @@ std::vector<LoadOrderTuple> MapToLoadOrderTuples(
471471 return data;
472472}
473473
474+ bool HadCreationClub (GameId gameId) {
475+ return gameId == GameId::tes5se || gameId == GameId::fo4;
476+ }
477+
478+ void CreationClubPlugins::Load (GameId gameId,
479+ const std::filesystem::path& gamePath) {
480+ const auto logger = getLogger ();
481+
482+ creationClubPlugins_.clear ();
483+
484+ if (!HadCreationClub (gameId)) {
485+ if (logger) {
486+ logger->debug (
487+ " The current game was not part of the Creation Club while it was "
488+ " active, skipping loading Creation Club plugin names." );
489+ }
490+ return ;
491+ }
492+
493+ const auto cccFilename = GetCCCFilename (gameId);
494+
495+ if (!cccFilename.has_value ()) {
496+ if (logger) {
497+ logger->debug (
498+ " The current game does not have a CCC file, the Creation Club filter "
499+ " will have no effect." );
500+ }
501+ return ;
502+ }
503+
504+ const auto cccFilePath = gamePath / cccFilename.value ();
505+
506+ if (!fs::exists (cccFilePath)) {
507+ if (logger) {
508+ logger->debug (
509+ " The CCC file at {} does not exist, the Creation Club filter "
510+ " will have no effect." ,
511+ cccFilePath.u8string ());
512+ }
513+ return ;
514+ }
515+
516+ creationClubPlugins_ = ReadFilenamesInFile (cccFilePath);
517+ }
518+
519+ bool CreationClubPlugins::IsCreationClubPlugin (const std::string& name) const {
520+ return creationClubPlugins_.count (Filename (name)) != 0 ;
521+ }
522+
474523namespace gui {
475524Game::Game (const GameSettings& gameSettings,
476525 const std::filesystem::path& lootDataPath,
@@ -484,6 +533,7 @@ Game::Game(const GameSettings& gameSettings,
484533
485534Game::Game (Game&& game) {
486535 settings_ = std::move (game.settings_ );
536+ creationClubPlugins_ = std::move (game.creationClubPlugins_ );
487537 gameHandle_ = std::move (game.gameHandle_ );
488538 messages_ = std::move (game.messages_ );
489539 lootDataPath_ = std::move (game.lootDataPath_ );
@@ -497,6 +547,7 @@ Game::Game(Game&& game) {
497547Game& Game::operator =(Game&& game) {
498548 if (&game != this ) {
499549 settings_ = std::move (game.settings_ );
550+ creationClubPlugins_ = std::move (game.creationClubPlugins_ );
500551 gameHandle_ = std::move (game.gameHandle_ );
501552 messages_ = std::move (game.messages_ );
502553 lootDataPath_ = std::move (game.lootDataPath_ );
@@ -514,6 +565,14 @@ const GameSettings& Game::GetSettings() const { return settings_; }
514565
515566GameSettings& Game::GetSettings () { return settings_; }
516567
568+ const CreationClubPlugins& Game::GetCreationClubPlugins () const {
569+ return creationClubPlugins_;
570+ }
571+
572+ CreationClubPlugins& Game::GetCreationClubPlugins () {
573+ return creationClubPlugins_;
574+ }
575+
517576void Game::Init () {
518577 auto logger = getLogger ();
519578 if (logger) {
@@ -596,52 +655,6 @@ void Game::RedatePlugins() {
596655 }
597656}
598657
599- void Game::LoadCreationClubPluginNames () {
600- const auto logger = getLogger ();
601-
602- creationClubPlugins_.clear ();
603-
604- if (!HadCreationClub ()) {
605- if (logger) {
606- logger->debug (
607- " The current game was not part of the Creation Club while it was "
608- " active, skipping loading Creation Club plugin names." );
609- }
610- return ;
611- }
612-
613- const auto cccFilename = GetCCCFilename (settings_.Id ());
614-
615- if (!cccFilename.has_value ()) {
616- if (logger) {
617- logger->debug (
618- " The current game does not have a CCC file, the Creation Club filter "
619- " will have no effect." );
620- }
621- return ;
622- }
623-
624- const auto cccFilePath = settings_.GamePath () / cccFilename.value ();
625-
626- if (!fs::exists (cccFilePath)) {
627- if (logger) {
628- logger->debug (
629- " The CCC file at {} does not exist, the Creation Club filter "
630- " will have no effect." ,
631- cccFilePath.u8string ());
632- }
633- return ;
634- }
635-
636- creationClubPlugins_ = ReadFilenamesInFile (cccFilePath);
637- }
638-
639- bool Game::HadCreationClub () const {
640- // The Creation Club has been replaced, but while it was active it was
641- // available for Skyrim SE and Fallout 4.
642- return settings_.Id () == GameId::tes5se || settings_.Id () == GameId::fo4;
643- }
644-
645658void Game::LoadAllInstalledPlugins (bool headersOnly) {
646659 LoadCurrentLoadOrderState ();
647660
@@ -1081,10 +1094,6 @@ void Game::AppendMessages(std::vector<SourcedMessage> messages) {
10811094 }
10821095}
10831096
1084- bool Game::IsCreationClubPlugin (const std::string& name) const {
1085- return creationClubPlugins_.count (Filename (name)) != 0 ;
1086- }
1087-
10881097std::optional<std::filesystem::path> Game::ResolveGameFilePath (
10891098 const std::string& filePath) const {
10901099 return loot::ResolveGameFilePath (settings_.Id (),
0 commit comments