diff --git a/src/common/config.cpp b/src/common/config.cpp index b46ab8d6e..158bfeddf 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -72,6 +72,7 @@ static bool checkCompatibilityOnStartup = false; static std::string trophyKey; // Gui +static bool load_game_size = true; std::vector 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(gui, "loadGameSizeEnabled", true); m_icon_size = toml::find_or(gui, "iconSize", 0); m_icon_size_grid = toml::find_or(gui, "iconSizeGrid", 0); m_slider_pos = toml::find_or(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}; diff --git a/src/common/config.h b/src/common/config.h index 6e6a5d960..c86e35ebc 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -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(); diff --git a/src/qt_gui/game_list_frame.cpp b/src/qt_gui/game_list_frame.cpp index b1cd07216..9753f511b 100644 --- a/src/qt_gui/game_list_frame.cpp +++ b/src/qt_gui/game_list_frame.cpp @@ -106,6 +106,8 @@ void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) { void GameListFrame::PopulateGameList() { // Do not show status column if it is not enabled this->setColumnHidden(2, !Config::getCompatibilityEnabled()); + this->setColumnHidden(6, !Config::GetLoadGameSizeEnabled()); + this->setRowCount(m_game_info->m_games.size()); ResizeIcons(icon_size); diff --git a/src/qt_gui/game_list_utils.h b/src/qt_gui/game_list_utils.h index ab9233886..581a8a55f 100644 --- a/src/qt_gui/game_list_utils.h +++ b/src/qt_gui/game_list_utils.h @@ -62,11 +62,46 @@ public: QDir dir(dirPath); QDirIterator it(dir.absolutePath(), QDirIterator::Subdirectories); qint64 total = 0; + + if (!Config::GetLoadGameSizeEnabled()) { + game.size = FormatSize(0).toStdString(); + return; + } + + // Cache path + QFile size_cache_file(Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / + game.serial / "size_cache.txt"); + QFileInfo cacheInfo(size_cache_file); + QFileInfo dirInfo(dirPath); + + // Check if cache file exists and is valid + if (size_cache_file.exists() && cacheInfo.lastModified() >= dirInfo.lastModified()) { + if (size_cache_file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&size_cache_file); + QString cachedSize = in.readLine(); + size_cache_file.close(); + + if (!cachedSize.isEmpty()) { + game.size = cachedSize.toStdString(); + return; + } + } + } + + // Cache is invalid or does not exist; calculate size while (it.hasNext()) { it.next(); total += it.fileInfo().size(); } + game.size = FormatSize(total).toStdString(); + + // Save new cache + if (size_cache_file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream out(&size_cache_file); + out << QString::fromStdString(game.size) << "\n"; + size_cache_file.close(); + } } static QString GetRegion(char region) { diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 3f4970dad..a4b584294 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -315,6 +315,7 @@ void SettingsDialog::LoadValuesFromConfig() { toml::find_or(data, "General", "FullscreenMode", "Borderless"))); ui->separateUpdatesCheckBox->setChecked( toml::find_or(data, "General", "separateUpdateEnabled", false)); + ui->gameSizeCheckBox->setChecked(toml::find_or(data, "GUI", "loadGameSizeEnabled", true)); ui->showSplashCheckBox->setChecked(toml::find_or(data, "General", "showSplash", false)); ui->logTypeComboBox->setCurrentText( QString::fromStdString(toml::find_or(data, "General", "logType", "async"))); @@ -568,6 +569,7 @@ void SettingsDialog::UpdateSettings() { Config::setDumpShaders(ui->dumpShadersCheckBox->isChecked()); Config::setNullGpu(ui->nullGpuCheckBox->isChecked()); Config::setSeparateUpdateEnabled(ui->separateUpdatesCheckBox->isChecked()); + Config::setLoadGameSizeEnabled(ui->gameSizeCheckBox->isChecked()); Config::setShowSplash(ui->showSplashCheckBox->isChecked()); Config::setDebugDump(ui->debugDump->isChecked()); Config::setVkValidation(ui->vkValidationCheckBox->isChecked()); diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index 089158fd3..8d68d1c90 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -68,7 +68,7 @@ 0 0 946 - 536 + 586 @@ -134,7 +134,7 @@ - + Fullscreen Mode @@ -483,6 +483,13 @@ 11 + + + + Show Game Size In List + + + @@ -557,59 +564,59 @@ + + + + + + 6 + + + 0 + + + 50 + - - - 6 - - - 0 - - - 80 - + - - - - - Trophy - - - - - - Disable Trophy Pop-ups - - - - - - - Trophy Key - - - - - - - - 0 - 0 - - - - - 10 - false - - - - - - - - + + + Trophy + + + + + + Disable Trophy Pop-ups + + + + + + + Trophy Key + + + + + + + + 0 + 0 + + + + + 10 + false + + + + + + @@ -637,8 +644,8 @@ 0 0 - 926 - 536 + 946 + 586 @@ -853,13 +860,13 @@ - - - - Enable Motion Controls - - - + + + + Enable Motion Controls + + + @@ -935,8 +942,8 @@ 0 0 - 926 - 536 + 946 + 586 @@ -1186,8 +1193,8 @@ 0 0 - 926 - 536 + 946 + 586 @@ -1259,8 +1266,8 @@ 0 0 - 926 - 536 + 946 + 586 diff --git a/src/qt_gui/translations/ar.ts b/src/qt_gui/translations/ar.ts index 4fc9c2de1..a4dadcb1a 100644 --- a/src/qt_gui/translations/ar.ts +++ b/src/qt_gui/translations/ar.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + عرض حجم اللعبة في القائمة + Show Splash إظهار شاشة البداية diff --git a/src/qt_gui/translations/da_DK.ts b/src/qt_gui/translations/da_DK.ts index ef1ae27a3..70b7d3ecc 100644 --- a/src/qt_gui/translations/da_DK.ts +++ b/src/qt_gui/translations/da_DK.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Vis vis spilstørrelse i listen + Show Splash Show Splash diff --git a/src/qt_gui/translations/de.ts b/src/qt_gui/translations/de.ts index 2fc6a29fe..7f1de3afd 100644 --- a/src/qt_gui/translations/de.ts +++ b/src/qt_gui/translations/de.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Zeigen Sie die Spielgröße in der Liste + Show Splash Startbildschirm anzeigen diff --git a/src/qt_gui/translations/el.ts b/src/qt_gui/translations/el.ts index 8d3885808..84165536e 100644 --- a/src/qt_gui/translations/el.ts +++ b/src/qt_gui/translations/el.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Εμφάνιση Μεγέθους Παιχνιδιού στη Λίστα + Show Splash Show Splash diff --git a/src/qt_gui/translations/en.ts b/src/qt_gui/translations/en.ts index 0262ee149..fad185d41 100644 --- a/src/qt_gui/translations/en.ts +++ b/src/qt_gui/translations/en.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Show Game Size In List + Show Splash Show Splash diff --git a/src/qt_gui/translations/es_ES.ts b/src/qt_gui/translations/es_ES.ts index a25ff639e..a97d3d3c8 100644 --- a/src/qt_gui/translations/es_ES.ts +++ b/src/qt_gui/translations/es_ES.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Mostrar Tamaño del Juego en la Lista + Show Splash Mostrar splash diff --git a/src/qt_gui/translations/fa_IR.ts b/src/qt_gui/translations/fa_IR.ts index 52aa4b17c..697e615fb 100644 --- a/src/qt_gui/translations/fa_IR.ts +++ b/src/qt_gui/translations/fa_IR.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder فعال‌سازی پوشه جداگانه برای به‌روزرسانی + + Show Game Size In List + نمایش اندازه بازی در لیست + Show Splash Splash نمایش diff --git a/src/qt_gui/translations/fi.ts b/src/qt_gui/translations/fi.ts index 97fee5dfa..51e85dfbb 100644 --- a/src/qt_gui/translations/fi.ts +++ b/src/qt_gui/translations/fi.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Ota Käyttöön Erillinen Päivityshakemisto + + Show Game Size In List + Näytä pelin koko luettelossa + Show Splash Näytä Aloitusnäyttö diff --git a/src/qt_gui/translations/fr.ts b/src/qt_gui/translations/fr.ts index d25ad30f4..35f3eb55f 100644 --- a/src/qt_gui/translations/fr.ts +++ b/src/qt_gui/translations/fr.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Dossier séparé pour les mises à jours + + Show Game Size In List + Afficher la taille du jeu dans la liste + Show Splash Afficher l'image du jeu diff --git a/src/qt_gui/translations/hu_HU.ts b/src/qt_gui/translations/hu_HU.ts index 6ecc3fc90..a2bd9c1da 100644 --- a/src/qt_gui/translations/hu_HU.ts +++ b/src/qt_gui/translations/hu_HU.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Külön Frissítési Mappa Engedélyezése + + Show Game Size In List + Játékméret megjelenítése a listában + Show Splash Indítóképernyő Mutatása diff --git a/src/qt_gui/translations/id.ts b/src/qt_gui/translations/id.ts index fc5ad4a99..b97914ca2 100644 --- a/src/qt_gui/translations/id.ts +++ b/src/qt_gui/translations/id.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Tampilkan Ukuran Game di Daftar + Show Splash Show Splash diff --git a/src/qt_gui/translations/it.ts b/src/qt_gui/translations/it.ts index f7ba3661b..d4ea1c7e6 100644 --- a/src/qt_gui/translations/it.ts +++ b/src/qt_gui/translations/it.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Abilita Cartella Aggiornamenti Separata + + Show Game Size In List + Mostra la dimensione del gioco nell'elenco + Show Splash Mostra Schermata Iniziale diff --git a/src/qt_gui/translations/ja_JP.ts b/src/qt_gui/translations/ja_JP.ts index 21c8145ed..359955765 100644 --- a/src/qt_gui/translations/ja_JP.ts +++ b/src/qt_gui/translations/ja_JP.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + ゲームサイズをリストに表示 + Show Splash スプラッシュを表示する diff --git a/src/qt_gui/translations/ko_KR.ts b/src/qt_gui/translations/ko_KR.ts index fea8d55bc..9cca0b656 100644 --- a/src/qt_gui/translations/ko_KR.ts +++ b/src/qt_gui/translations/ko_KR.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + 게임 크기를 목록에 표시 + Show Splash Show Splash diff --git a/src/qt_gui/translations/lt_LT.ts b/src/qt_gui/translations/lt_LT.ts index eaf51a975..0594bcbd2 100644 --- a/src/qt_gui/translations/lt_LT.ts +++ b/src/qt_gui/translations/lt_LT.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Rodyti žaidimo dydį sąraše + Show Splash Show Splash diff --git a/src/qt_gui/translations/nb.ts b/src/qt_gui/translations/nb.ts index 83dbf7dd8..8ca8246ba 100644 --- a/src/qt_gui/translations/nb.ts +++ b/src/qt_gui/translations/nb.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Aktiver seperat oppdateringsmappe + + Show Game Size In List + Vis spillstørrelse i listen + Show Splash Vis velkomstbilde diff --git a/src/qt_gui/translations/nl.ts b/src/qt_gui/translations/nl.ts index 3142a17e5..12d644458 100644 --- a/src/qt_gui/translations/nl.ts +++ b/src/qt_gui/translations/nl.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Toon grootte van het spel in de lijst + Show Splash Show Splash diff --git a/src/qt_gui/translations/pl_PL.ts b/src/qt_gui/translations/pl_PL.ts index 378673a30..782db12e2 100644 --- a/src/qt_gui/translations/pl_PL.ts +++ b/src/qt_gui/translations/pl_PL.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Pokaż rozmiar gry na liście + Show Splash Pokaż ekran powitania diff --git a/src/qt_gui/translations/pt_BR.ts b/src/qt_gui/translations/pt_BR.ts index 5d9c84769..94bbf028a 100644 --- a/src/qt_gui/translations/pt_BR.ts +++ b/src/qt_gui/translations/pt_BR.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Habilitar pasta de atualização separada + + Show Game Size In List + Mostrar Tamanho do Jogo na Lista + Show Splash Mostrar Splash Inicial diff --git a/src/qt_gui/translations/ro_RO.ts b/src/qt_gui/translations/ro_RO.ts index 71354fb06..3bd8e38b5 100644 --- a/src/qt_gui/translations/ro_RO.ts +++ b/src/qt_gui/translations/ro_RO.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Afișează dimensiunea jocului în listă + Show Splash Show Splash diff --git a/src/qt_gui/translations/ru_RU.ts b/src/qt_gui/translations/ru_RU.ts index 0e803ea42..a38e2fd98 100644 --- a/src/qt_gui/translations/ru_RU.ts +++ b/src/qt_gui/translations/ru_RU.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Отдельная папка обновлений + + Show Game Size In List + Показать размер игры в списке + Show Splash Показывать заставку diff --git a/src/qt_gui/translations/sq.ts b/src/qt_gui/translations/sq.ts index 7354b4bd9..a83dc9829 100644 --- a/src/qt_gui/translations/sq.ts +++ b/src/qt_gui/translations/sq.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Aktivizo dosjen e ndarë të përditësimit + + Show Game Size In List + Shfaq madhësinë e lojës në listë + Show Splash Shfaq Pamjen e nisjes diff --git a/src/qt_gui/translations/sv.ts b/src/qt_gui/translations/sv.ts index 3a6f060cb..9a244a9df 100644 --- a/src/qt_gui/translations/sv.ts +++ b/src/qt_gui/translations/sv.ts @@ -1032,6 +1032,10 @@ Enable Separate Update Folder Aktivera separat uppdateringsmapp + + Show Game Size In List + Visa spelstorlek i listan + Show Splash Visa startskärm diff --git a/src/qt_gui/translations/tr_TR.ts b/src/qt_gui/translations/tr_TR.ts index 4596000f2..be50f935a 100644 --- a/src/qt_gui/translations/tr_TR.ts +++ b/src/qt_gui/translations/tr_TR.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Göster oyun boyutunu listede + Show Splash Başlangıç Ekranını Göster diff --git a/src/qt_gui/translations/uk_UA.ts b/src/qt_gui/translations/uk_UA.ts index 5b260050e..ff4e48e80 100644 --- a/src/qt_gui/translations/uk_UA.ts +++ b/src/qt_gui/translations/uk_UA.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Увімкнути окрему папку оновлень + + Show Game Size In List + Показати розмір гри в списку + Show Splash Показувати заставку diff --git a/src/qt_gui/translations/vi_VN.ts b/src/qt_gui/translations/vi_VN.ts index 7fcac6d7e..e546d955c 100644 --- a/src/qt_gui/translations/vi_VN.ts +++ b/src/qt_gui/translations/vi_VN.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + Hiển thị Kích thước Game trong Danh sách + Show Splash Show Splash diff --git a/src/qt_gui/translations/zh_CN.ts b/src/qt_gui/translations/zh_CN.ts index bb4476b9e..ece5f9490 100644 --- a/src/qt_gui/translations/zh_CN.ts +++ b/src/qt_gui/translations/zh_CN.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder 启用单独的更新目录 + + Show Game Size In List + 显示游戏大小在列表中 + Show Splash 显示启动画面 diff --git a/src/qt_gui/translations/zh_TW.ts b/src/qt_gui/translations/zh_TW.ts index 49d419d8b..11642d52b 100644 --- a/src/qt_gui/translations/zh_TW.ts +++ b/src/qt_gui/translations/zh_TW.ts @@ -540,6 +540,10 @@ Enable Separate Update Folder Enable Separate Update Folder + + Show Game Size In List + 顯示遊戲大小在列表中 + Show Splash Show Splash