GUI: Speed up GUI loading by caching game sizes (#2130)

* Add show game size toggle

* Fix (#7)

* Fix

I removed the gameSizeCheckBox from the 'Emulator' group and put it in 'GUI settings'
hLayoutTrophy which contains the Trophy information was inside the GUIMusicLayout, so I fixed that too.

* TR

* Use cached sizes if the feature is enabled

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
This commit is contained in:
kalaposfos13 2025-01-12 21:31:05 +01:00 committed by GitHub
parent c6ab149c56
commit 4f2f9494b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 239 additions and 68 deletions

View file

@ -72,6 +72,7 @@ static bool checkCompatibilityOnStartup = false;
static std::string trophyKey;
// Gui
static bool load_game_size = true;
std::vector<std::filesystem::path> settings_install_dirs = {};
std::filesystem::path settings_addon_install_dir = {};
u32 main_window_geometry_x = 400;
@ -102,6 +103,14 @@ void setTrophyKey(std::string key) {
trophyKey = key;
}
bool GetLoadGameSizeEnabled() {
return load_game_size;
}
void setLoadGameSizeEnabled(bool enable) {
load_game_size = enable;
}
bool isNeoModeConsole() {
return isNeo;
}
@ -650,6 +659,7 @@ void load(const std::filesystem::path& path) {
if (data.contains("GUI")) {
const toml::value& gui = data.at("GUI");
load_game_size = toml::find_or<bool>(gui, "loadGameSizeEnabled", true);
m_icon_size = toml::find_or<int>(gui, "iconSize", 0);
m_icon_size_grid = toml::find_or<int>(gui, "iconSizeGrid", 0);
m_slider_pos = toml::find_or<int>(gui, "sliderPos", 0);
@ -755,6 +765,7 @@ void save(const std::filesystem::path& path) {
install_dirs.emplace_back(std::string{fmt::UTF(dirString.u8string()).data});
}
data["GUI"]["installDirs"] = install_dirs;
data["GUI"]["loadGameSizeEnabled"] = load_game_size;
data["GUI"]["addonInstallDir"] =
std::string{fmt::UTF(settings_addon_install_dir.u8string()).data};

View file

@ -17,6 +17,8 @@ void saveMainWindow(const std::filesystem::path& path);
std::string getTrophyKey();
void setTrophyKey(std::string key);
bool GetLoadGameSizeEnabled();
void setLoadGameSizeEnabled(bool enable);
bool getIsFullscreen();
std::string getFullscreenMode();
bool isNeoModeConsole();