mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-15 11:25:13 +00:00
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:
parent
c6ab149c56
commit
4f2f9494b0
|
@ -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};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -315,6 +315,7 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||
toml::find_or<std::string>(data, "General", "FullscreenMode", "Borderless")));
|
||||
ui->separateUpdatesCheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "separateUpdateEnabled", false));
|
||||
ui->gameSizeCheckBox->setChecked(toml::find_or<bool>(data, "GUI", "loadGameSizeEnabled", true));
|
||||
ui->showSplashCheckBox->setChecked(toml::find_or<bool>(data, "General", "showSplash", false));
|
||||
ui->logTypeComboBox->setCurrentText(
|
||||
QString::fromStdString(toml::find_or<std::string>(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());
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>946</width>
|
||||
<height>536</height>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="generalTabVLayout" stretch="0">
|
||||
|
@ -483,6 +483,13 @@
|
|||
<property name="bottomMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="gameSizeCheckBox">
|
||||
<property name="text">
|
||||
<string>Show Game Size In List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="playBGMCheckBox">
|
||||
<property name="sizePolicy">
|
||||
|
@ -557,6 +564,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="vLayoutTrophy">
|
||||
<property name="spacing">
|
||||
|
@ -566,7 +575,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>80</number>
|
||||
<number>50</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hLayoutTrophy">
|
||||
|
@ -614,8 +623,6 @@
|
|||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -637,8 +644,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>926</width>
|
||||
<height>536</height>
|
||||
<width>946</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0">
|
||||
|
@ -935,8 +942,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>926</width>
|
||||
<height>536</height>
|
||||
<width>946</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="graphicsTabVLayout" stretch="0,0">
|
||||
|
@ -1186,8 +1193,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>926</width>
|
||||
<height>536</height>
|
||||
<width>946</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="pathsTabLayout" stretch="0">
|
||||
|
@ -1259,8 +1266,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>926</width>
|
||||
<height>536</height>
|
||||
<width>946</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="debugTabVLayout" stretch="0,1">
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>عرض حجم اللعبة في القائمة</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>إظهار شاشة البداية</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Vis vis spilstørrelse i listen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Zeigen Sie die Spielgröße in der Liste</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Startbildschirm anzeigen</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Εμφάνιση Μεγέθους Παιχνιδιού στη Λίστα</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Show Game Size In List</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Mostrar Tamaño del Juego en la Lista</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Mostrar splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>فعالسازی پوشه جداگانه برای بهروزرسانی</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>نمایش اندازه بازی در لیست</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Splash نمایش</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Ota Käyttöön Erillinen Päivityshakemisto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Näytä pelin koko luettelossa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Näytä Aloitusnäyttö</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Dossier séparé pour les mises à jours</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Afficher la taille du jeu dans la liste</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Afficher l'image du jeu</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Külön Frissítési Mappa Engedélyezése</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Játékméret megjelenítése a listában</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Indítóképernyő Mutatása</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Tampilkan Ukuran Game di Daftar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Abilita Cartella Aggiornamenti Separata</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Mostra la dimensione del gioco nell'elenco</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Mostra Schermata Iniziale</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>ゲームサイズをリストに表示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>スプラッシュを表示する</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>게임 크기를 목록에 표시</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Rodyti žaidimo dydį sąraše</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Aktiver seperat oppdateringsmappe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Vis spillstørrelse i listen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Vis velkomstbilde</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Toon grootte van het spel in de lijst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Pokaż rozmiar gry na liście</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Pokaż ekran powitania</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Habilitar pasta de atualização separada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Mostrar Tamanho do Jogo na Lista</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Mostrar Splash Inicial</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Afișează dimensiunea jocului în listă</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Отдельная папка обновлений</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Показать размер игры в списке</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Показывать заставку</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Aktivizo dosjen e ndarë të përditësimit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Shfaq madhësinë e lojës në listë</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Shfaq Pamjen e nisjes</translation>
|
||||
|
|
|
@ -1032,6 +1032,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Aktivera separat uppdateringsmapp</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Visa spelstorlek i listan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Visa startskärm</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Göster oyun boyutunu listede</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Başlangıç Ekranını Göster</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Увімкнути окрему папку оновлень</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Показати розмір гри в списку</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Показувати заставку</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>Hiển thị Kích thước Game trong Danh sách</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>启用单独的更新目录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>显示游戏大小在列表中</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>显示启动画面</translation>
|
||||
|
|
|
@ -540,6 +540,10 @@
|
|||
<source>Enable Separate Update Folder</source>
|
||||
<translation>Enable Separate Update Folder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Game Size In List</source>
|
||||
<translation>顯示遊戲大小在列表中</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Splash</source>
|
||||
<translation>Show Splash</translation>
|
||||
|
|
Loading…
Reference in a new issue