void NetPlaySetupDialog::show() { PopulateGameList(); QDialog::show(); }
void game_list_frame::Refresh(bool fromDrive) { if (fromDrive) { // Load PSF m_game_data.clear(); const std::string& game_path = Emu.GetGameDir(); for (const auto& entry : fs::dir(Emu.GetGameDir())) { if (!entry.is_directory) { continue; } const std::string& dir = game_path + entry.name; const std::string& sfb = dir + "/PS3_DISC.SFB"; const std::string& sfo = dir + (fs::is_file(sfb) ? "/PS3_GAME/PARAM.SFO" : "/PARAM.SFO"); const fs::file sfo_file(sfo); if (!sfo_file) { continue; } const auto& psf = psf::load_object(sfo_file); GameInfo game; game.root = entry.name; game.serial = psf::get_string(psf, "TITLE_ID", ""); game.name = psf::get_string(psf, "TITLE", "unknown"); game.app_ver = psf::get_string(psf, "APP_VER", "unknown"); game.category = psf::get_string(psf, "CATEGORY", "unknown"); game.fw = psf::get_string(psf, "PS3_SYSTEM_VER", "unknown"); game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL"); game.resolution = psf::get_integer(psf, "RESOLUTION"); game.sound_format = psf::get_integer(psf, "SOUND_FORMAT"); if (game.category == "HG") { game.category = sstr(category::hdd_Game); game.icon_path = dir + "/ICON0.PNG"; } else if (game.category == "DG") { game.category = sstr(category::disc_Game); game.icon_path = dir + "/PS3_GAME/ICON0.PNG"; } else if (game.category == "HM") { game.category = sstr(category::home); game.icon_path = dir + "/ICON0.PNG"; } else if (game.category == "AV") { game.category = sstr(category::audio_Video); game.icon_path = dir + "/ICON0.PNG"; } else if (game.category == "GD") { game.category = sstr(category::game_Data); game.icon_path = dir + "/ICON0.PNG"; } else if (game.category == "unknown") { game.category = sstr(category::unknown); } // Load Image QImage img; QPixmap pxmap; if (!game.icon_path.empty() && img.load(qstr(game.icon_path))) { QImage scaled = img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation); pxmap = QPixmap::fromImage(scaled); } else { img = QImage(m_Icon_Size, QImage::Format_ARGB32); QString abspath = QDir(qstr(game.icon_path)).absolutePath(); LOG_ERROR(HLE, "Count not load image from path %s", sstr(abspath)); img.fill(QColor(0, 0, 0, 0)); pxmap = QPixmap::fromImage(img); } m_game_data.push_back({ game, img, pxmap }); } auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) { return game1.info.name < game2.info.name; }; // Sort by name at the very least. std::sort(m_game_data.begin(), m_game_data.end(), op); } // Fill Game List / Game Grid if (m_isListLayout) { int row = PopulateGameList(); FilterData(); gameList->selectRow(row); gameList->sortByColumn(m_sortColumn, m_colSortOrder); gameList->verticalHeader()->setMinimumSectionSize(m_Icon_Size.height()); gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height()); gameList->resizeRowsToContents(); gameList->resizeColumnToContents(0); gameList->scrollTo(gameList->currentIndex()); } else { if (m_Icon_Size.width() > 0 && m_Icon_Size.height() > 0) { m_games_per_row = width() / (m_Icon_Size.width() + m_Icon_Size.width() * m_xgrid->getMarginFactor() * 2); } else { m_games_per_row = 0; } PopulateGameGrid(m_games_per_row, m_Icon_Size); connect(m_xgrid, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot); connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu); m_Central_Widget->addWidget(m_xgrid); m_Central_Widget->setCurrentWidget(m_xgrid); m_xgrid->scrollTo(m_xgrid->currentIndex()); } }