Added an option to preload gamelists on startup.

This commit is contained in:
Leon Styhre 2021-10-25 17:56:17 +02:00
parent 62d810d46c
commit 270a2e3857
6 changed files with 23 additions and 1 deletions

View file

@ -1046,6 +1046,17 @@ void GuiMenu::openOtherOptions()
}
});
// Whether to preload the gamelists on application startup.
auto preloadGamelists = std::make_shared<SwitchComponent>(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<SwitchComponent>(mWindow);

View file

@ -961,6 +961,10 @@ void ViewController::preload()
std::to_string(systemCount) + ")");
}
(*it)->getIndex()->resetFilters();
if (Settings::getInstance()->getBool("PreloadGamelists"))
getGameListView(*it)->preloadGamelist();
else
getGameListView(*it);
}

View file

@ -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;

View file

@ -32,6 +32,8 @@ public:
void setTheme(const std::shared_ptr<ThemeData>& theme);
const std::shared_ptr<ThemeData>& getTheme() const { return mTheme; }
virtual void preloadGamelist(){};
virtual FileData* getCursor() = 0;
virtual void setCursor(FileData*) = 0;
virtual FileData* getNextEntry() = 0;

View file

@ -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;

View file

@ -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};