diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp index 2b93d4e56..6e17c4b67 100644 --- a/src/duckstation-qt/gamelistwidget.cpp +++ b/src/duckstation-qt/gamelistwidget.cpp @@ -457,36 +457,36 @@ QIcon GameListModel::getIconForGame(const QString& path) { QIcon ret; - if (m_show_game_icons && !path.isEmpty()) - { - const auto lock = GameList::GetLock(); - const GameList::Entry* entry = GameList::GetEntryForPath(path.toStdString()); - if (!entry) - return ret; + if (!m_show_game_icons || path.isEmpty()) + return ret; + const auto lock = GameList::GetLock(); + const GameList::Entry* entry = GameList::GetEntryForPath(path.toStdString()); + if (!entry || entry->serial.empty() || !entry->IsDisc() && !entry->IsDiscSet()) + return ret; + + // Only use the cache if we're not using larger icons. Otherwise they'll get double scaled. + // Provides a small performance boost when using default size icons. + if (m_icon_size == MEMORY_CARD_ICON_SIZE) + { if (const QPixmap* pm = m_memcard_pixmap_cache.Lookup(entry->serial)) { // If we already have the icon cached, return it. ret = QIcon(*pm); return ret; } - else + } + + // See above. + const std::string icon_path = GameList::GetGameIconPath(entry->serial, entry->path); + if (!icon_path.empty()) + { + QPixmap newpm; + if (!icon_path.empty() && newpm.load(QString::fromStdString(icon_path))) { - // See above. - if (!entry->serial.empty() && (entry->IsDisc() || entry->IsDiscSet())) - { - const std::string icon_path = GameList::GetGameIconPath(entry->serial, entry->path); - if (!icon_path.empty()) - { - QPixmap newpm; - if (!icon_path.empty() && newpm.load(QString::fromStdString(icon_path))) - { - fixIconPixmapSize(newpm); - ret = QIcon(*m_memcard_pixmap_cache.Insert(entry->serial, std::move(newpm))); - return ret; - } - } - } + fixIconPixmapSize(newpm); + ret = QIcon(*m_memcard_pixmap_cache.Insert(entry->serial, std::move(newpm))); + return ret; } } diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index fd5b33d1f..d5cb28525 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -641,12 +641,12 @@ void MainWindow::onSystemDestroyed() switchToGameListView(); } -void MainWindow::onSystemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title) +void MainWindow::onSystemGameChanged(const QString& path, const QString& game_serial, const QString& game_title) { - s_current_game_path = filename; + s_current_game_path = path; s_current_game_title = game_title; s_current_game_serial = game_serial; - s_current_game_icon = m_game_list_widget->getModel()->getIconForGame(filename); + s_current_game_icon = m_game_list_widget->getModel()->getIconForGame(path); updateWindowTitle(); } diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 2653cd67b..7ed79910b 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -153,7 +153,7 @@ private Q_SLOTS: void onSystemDestroyed(); void onSystemPaused(); void onSystemResumed(); - void onSystemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title); + void onSystemGameChanged(const QString& path, const QString& game_serial, const QString& game_title); void onSystemUndoStateAvailabilityChanged(bool available, quint64 timestamp); void onMediaCaptureStarted(); void onMediaCaptureStopped(); diff --git a/src/duckstation-qt/qthost.h b/src/duckstation-qt/qthost.h index 2eee5bf34..96873de1d 100644 --- a/src/duckstation-qt/qthost.h +++ b/src/duckstation-qt/qthost.h @@ -138,7 +138,7 @@ Q_SIGNALS: void systemDestroyed(); void systemPaused(); void systemResumed(); - void systemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title); + void systemGameChanged(const QString& path, const QString& game_serial, const QString& game_title); void systemUndoStateAvailabilityChanged(bool available, quint64 timestamp); void gameListRefreshed(); void gameListRowsChanged(const QList& rows_changed);