diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 58bf31976..ebcfee71a 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -1046,6 +1046,17 @@ void GuiMenu::openOtherOptions() } }); + // Whether to preload the gamelists on application startup. + auto preloadGamelists = std::make_shared(mWindow); + preloadGamelists->setState(Settings::getInstance()->getBool("PreloadGamelists")); + s->addWithLabel("PRELOAD GAMELISTS ON STARTUP", preloadGamelists); + s->addSaveFunc([preloadGamelists, s] { + if (preloadGamelists->getState() != Settings::getInstance()->getBool("PreloadGamelists")) { + Settings::getInstance()->setBool("PreloadGamelists", preloadGamelists->getState()); + s->setNeedsSaving(); + } + }); + // Whether to enable alternative emulators per game (the option to disable this is intended // primarily for testing purposes). auto alternativeEmulatorPerGame = std::make_shared(mWindow); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 5daa8fdc9..366c30a81 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -961,7 +961,11 @@ void ViewController::preload() std::to_string(systemCount) + ")"); } (*it)->getIndex()->resetFilters(); - getGameListView(*it); + + if (Settings::getInstance()->getBool("PreloadGamelists")) + getGameListView(*it)->preloadGamelist(); + else + getGameListView(*it); } // Load navigation sounds, either from the theme if it supports it, or otherwise from diff --git a/es-app/src/views/gamelist/DetailedGameListView.h b/es-app/src/views/gamelist/DetailedGameListView.h index ed4db80c2..08302d5a7 100644 --- a/es-app/src/views/gamelist/DetailedGameListView.h +++ b/es-app/src/views/gamelist/DetailedGameListView.h @@ -25,6 +25,8 @@ public: virtual std::string getName() const override { return "detailed"; } virtual void launch(FileData* game) override; + virtual void preloadGamelist() override { updateInfoPanel(); } + protected: virtual void update(int deltaTime) override; diff --git a/es-app/src/views/gamelist/IGameListView.h b/es-app/src/views/gamelist/IGameListView.h index 853aa925e..212a062e9 100644 --- a/es-app/src/views/gamelist/IGameListView.h +++ b/es-app/src/views/gamelist/IGameListView.h @@ -32,6 +32,8 @@ public: void setTheme(const std::shared_ptr& theme); const std::shared_ptr& getTheme() const { return mTheme; } + virtual void preloadGamelist(){}; + virtual FileData* getCursor() = 0; virtual void setCursor(FileData*) = 0; virtual FileData* getNextEntry() = 0; diff --git a/es-app/src/views/gamelist/VideoGameListView.h b/es-app/src/views/gamelist/VideoGameListView.h index 06d1c1034..e0d6775de 100644 --- a/es-app/src/views/gamelist/VideoGameListView.h +++ b/es-app/src/views/gamelist/VideoGameListView.h @@ -28,6 +28,8 @@ public: virtual std::string getName() const override { return "video"; } virtual void launch(FileData* game) override; + virtual void preloadGamelist() override { updateInfoPanel(); } + protected: virtual void update(int deltaTime) override; diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index e7035633c..34c3a8c8b 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -242,6 +242,7 @@ void Settings::setDefaults() mBoolMap["VideoHardwareDecoding"] = {false, false}; #endif mBoolMap["VideoUpscaleFrameRate"] = {false, false}; + mBoolMap["PreloadGamelists"] = {true, true}; mBoolMap["AlternativeEmulatorPerGame"] = {true, true}; mBoolMap["ShowHiddenFiles"] = {true, true}; mBoolMap["ShowHiddenGames"] = {true, true};