Merge branch 'master' into improve-building-docs

This commit is contained in:
Megamouse 2025-03-17 14:41:28 +01:00 committed by GitHub
commit 1a44ce1149
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 99 additions and 101 deletions

View file

@ -73,7 +73,7 @@ void game_list_base::IconLoadFunction(game_info game, qreal device_pixel_ratio,
const QColor color = GetGridCompatibilityColor(game->compat.color);
{
std::lock_guard lock(game->item->pixmap_mutex);
game->pxmap = PaintedPixmap(game->icon, device_pixel_ratio, game->hasCustomConfig, game->hasCustomPadConfig, color);
game->pxmap = PaintedPixmap(game->icon, device_pixel_ratio, game->has_custom_config, game->has_custom_pad_config, color);
}
if (!cancel || !cancel->load())
@ -197,17 +197,17 @@ QIcon game_list_base::GetCustomConfigIcon(const game_info& game)
static const QIcon icon_custom_config(":/Icons/custom_config.png");
static const QIcon icon_controllers(":/Icons/controllers.png");
if (game->hasCustomConfig && game->hasCustomPadConfig)
if (game->has_custom_config && game->has_custom_pad_config)
{
return icon_combo_config_bordered;
}
if (game->hasCustomConfig)
if (game->has_custom_config)
{
return icon_custom_config;
}
if (game->hasCustomPadConfig)
if (game->has_custom_pad_config)
{
return icon_controllers;
}

View file

@ -582,8 +582,8 @@ void game_list_frame::OnParsingFinished()
const auto add_game = [this, localized_title, localized_icon, localized_movie, dev_flash, cat_unknown_localized = localized.category.unknown.toStdString(), cat_unknown = cat::cat_unknown.toStdString(), game_icon_path, _hdd, play_hover_movies = m_play_hover_movies, show_custom_icons = m_show_custom_icons](const std::string& dir_or_elf)
{
GameInfo game{};
game.path = dir_or_elf;
gui_game_info game{};
game.info.path = dir_or_elf;
const Localized thread_localized;
@ -599,13 +599,13 @@ void game_list_frame::OnParsingFinished()
return;
}
game.serial = dir_or_elf.substr(dir_or_elf.find_last_of(fs::delim) + 1);
game.category = cat::cat_ps3_os.toStdString(); // Key for operating system executables
game.version = utils::get_firmware_version();
game.app_ver = game.version;
game.fw = game.version;
game.bootable = 1;
game.icon_path = dev_flash + "vsh/resource/explore/icon/icon_home.png";
game.info.serial = dir_or_elf.substr(dir_or_elf.find_last_of(fs::delim) + 1);
game.info.category = cat::cat_ps3_os.toStdString(); // Key for operating system executables
game.info.version = utils::get_firmware_version();
game.info.app_ver = game.info.version;
game.info.fw = game.info.version;
game.info.bootable = 1;
game.info.icon_path = dev_flash + "vsh/resource/explore/icon/icon_home.png";
if (dir_or_elf.starts_with(dev_flash))
{
@ -618,13 +618,13 @@ void game_list_frame::OnParsingFinished()
if (const auto it = thread_localized.title.titles.find(path_vfs); it != thread_localized.title.titles.cend())
{
game.name = it->second.toStdString();
game.info.name = it->second.toStdString();
}
}
if (game.name.empty())
if (game.info.name.empty())
{
game.name = game.serial;
game.info.name = game.info.serial;
}
}
else
@ -632,52 +632,57 @@ void game_list_frame::OnParsingFinished()
std::string_view name = psf::get_string(psf, localized_title);
if (name.empty()) name = psf::get_string(psf, "TITLE", cat_unknown_localized);
game.serial = std::string(title_id);
game.name = std::string(name);
game.app_ver = std::string(psf::get_string(psf, "APP_VER", cat_unknown_localized));
game.version = std::string(psf::get_string(psf, "VERSION", cat_unknown_localized));
game.category = std::string(psf::get_string(psf, "CATEGORY", cat_unknown));
game.fw = std::string(psf::get_string(psf, "PS3_SYSTEM_VER", cat_unknown_localized));
game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL", 0);
game.resolution = psf::get_integer(psf, "RESOLUTION", 0);
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT", 0);
game.bootable = psf::get_integer(psf, "BOOTABLE", 0);
game.attr = psf::get_integer(psf, "ATTRIBUTE", 0);
game.info.serial = std::string(title_id);
game.info.name = std::string(name);
game.info.app_ver = std::string(psf::get_string(psf, "APP_VER", cat_unknown_localized));
game.info.version = std::string(psf::get_string(psf, "VERSION", cat_unknown_localized));
game.info.category = std::string(psf::get_string(psf, "CATEGORY", cat_unknown));
game.info.fw = std::string(psf::get_string(psf, "PS3_SYSTEM_VER", cat_unknown_localized));
game.info.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL", 0);
game.info.resolution = psf::get_integer(psf, "RESOLUTION", 0);
game.info.sound_format = psf::get_integer(psf, "SOUND_FORMAT", 0);
game.info.bootable = psf::get_integer(psf, "BOOTABLE", 0);
game.info.attr = psf::get_integer(psf, "ATTRIBUTE", 0);
}
if (show_custom_icons)
{
if (std::string icon_path = game_icon_path + game.serial + "/ICON0.PNG"; fs::is_file(icon_path))
if (std::string icon_path = game_icon_path + game.info.serial + "/ICON0.PNG"; fs::is_file(icon_path))
{
game.icon_path = std::move(icon_path);
game.info.icon_path = std::move(icon_path);
game.has_custom_icon = true;
}
}
if (game.icon_path.empty())
if (game.info.icon_path.empty())
{
if (std::string icon_path = sfo_dir + "/" + localized_icon; fs::is_file(icon_path))
{
game.icon_path = std::move(icon_path);
game.info.icon_path = std::move(icon_path);
}
else
{
game.icon_path = sfo_dir + "/ICON0.PNG";
game.info.icon_path = sfo_dir + "/ICON0.PNG";
}
}
if (game.movie_path.empty())
if (std::string movie_path = game_icon_path + game.info.serial + "/hover.gif"; fs::is_file(movie_path))
{
if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path))
{
game.movie_path = std::move(movie_path);
}
else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path))
{
game.movie_path = std::move(movie_path);
}
game.info.movie_path = std::move(movie_path);
game.has_hover_gif = true;
}
else if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
game.has_hover_pam = true;
}
else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path))
{
game.info.movie_path = std::move(movie_path);
game.has_hover_pam = true;
}
const QString serial = qstr(game.serial);
const QString serial = QString::fromStdString(game.info.serial);
m_games_mutex.lock();
@ -709,7 +714,7 @@ void game_list_frame::OnParsingFinished()
m_games_mutex.unlock();
QString qt_cat = qstr(game.category);
QString qt_cat = QString::fromStdString(game.info.category);
if (const auto boot_cat = thread_localized.category.cat_boot.find(qt_cat); boot_cat != thread_localized.category.cat_boot.cend())
{
@ -719,7 +724,7 @@ void game_list_frame::OnParsingFinished()
{
qt_cat = data_cat->second;
}
else if (game.category == cat_unknown)
else if (game.info.category == cat_unknown)
{
qt_cat = thread_localized.category.unknown;
}
@ -728,16 +733,12 @@ void game_list_frame::OnParsingFinished()
qt_cat = thread_localized.category.other;
}
gui_game_info info{};
info.info = std::move(game);
info.localized_category = std::move(qt_cat);
info.compat = m_game_compat->GetCompatibility(info.info.serial);
info.hasCustomConfig = fs::is_file(rpcs3::utils::get_custom_config_path(info.info.serial));
info.hasCustomPadConfig = fs::is_file(rpcs3::utils::get_custom_input_config_path(info.info.serial));
info.has_hover_gif = fs::is_file(game_icon_path + info.info.serial + "/hover.gif");
info.has_hover_pam = !info.info.movie_path.empty();
game.localized_category = std::move(qt_cat);
game.compat = m_game_compat->GetCompatibility(game.info.serial);
game.has_custom_config = fs::is_file(rpcs3::utils::get_custom_config_path(game.info.serial));
game.has_custom_pad_config = fs::is_file(rpcs3::utils::get_custom_input_config_path(game.info.serial));
m_games.push(std::make_shared<gui_game_info>(std::move(info)));
m_games.push(std::make_shared<gui_game_info>(std::move(game)));
};
const auto add_disc_dir = [this](const std::string& path, std::vector<std::string>& legit_paths)
@ -896,24 +897,30 @@ void game_list_frame::OnRefreshFinished()
}
}
if (std::string icon_path = other->info.path + "/" + localized_icon; fs::is_file(icon_path))
if (!entry->has_custom_icon)
{
entry->info.icon_path = std::move(icon_path);
}
else if (std::string icon_path = other->info.path + "/ICON0.PNG"; fs::is_file(icon_path))
{
entry->info.icon_path = std::move(icon_path);
if (std::string icon_path = other->info.path + "/" + localized_icon; fs::is_file(icon_path))
{
entry->info.icon_path = std::move(icon_path);
}
else if (std::string icon_path = other->info.path + "/ICON0.PNG"; fs::is_file(icon_path))
{
entry->info.icon_path = std::move(icon_path);
}
}
if (std::string movie_path = other->info.path + "/" + localized_movie; fs::is_file(movie_path))
if (!entry->has_hover_gif)
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
}
else if (std::string movie_path = other->info.path + "/ICON1.PAM"; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
if (std::string movie_path = other->info.path + "/" + localized_movie; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
}
else if (std::string movie_path = other->info.path + "/ICON1.PAM"; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
}
}
}
}
@ -1168,7 +1175,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
const bool is_current_running_game = is_game_running(current_game.serial);
QAction* boot = new QAction(gameinfo->hasCustomConfig
QAction* boot = new QAction(gameinfo->has_custom_config
? (is_current_running_game
? tr("&Reboot with global configuration")
: tr("&Boot with global configuration"))
@ -1179,7 +1186,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
QFont font = boot->font();
font.setBold(true);
if (gameinfo->hasCustomConfig)
if (gameinfo->has_custom_config)
{
QAction* boot_custom = menu.addAction(is_current_running_game
? tr("&Reboot with custom configuration")
@ -1243,12 +1250,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
menu.addSeparator();
QAction* configure = menu.addAction(gameinfo->hasCustomConfig
QAction* configure = menu.addAction(gameinfo->has_custom_config
? tr("&Change Custom Configuration")
: tr("&Create Custom Configuration From Global Settings"));
QAction* create_game_default_config = gameinfo->hasCustomConfig ? nullptr
QAction* create_game_default_config = gameinfo->has_custom_config ? nullptr
: menu.addAction(tr("&Create Custom Configuration From Default Settings"));
QAction* pad_configure = menu.addAction(gameinfo->hasCustomPadConfig
QAction* pad_configure = menu.addAction(gameinfo->has_custom_pad_config
? tr("&Change Custom Gamepad Configuration")
: tr("&Create Custom Gamepad Configuration"));
QAction* configure_patches = menu.addAction(tr("&Manage Game Patches"));
@ -1260,7 +1267,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
// Remove menu
QMenu* remove_menu = menu.addMenu(tr("&Remove"));
if (gameinfo->hasCustomConfig)
if (gameinfo->has_custom_config)
{
QAction* remove_custom_config = remove_menu->addAction(tr("&Remove Custom Configuration"));
connect(remove_custom_config, &QAction::triggered, [this, current_game, gameinfo]()
@ -1271,7 +1278,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
}
});
}
if (gameinfo->hasCustomPadConfig)
if (gameinfo->has_custom_pad_config)
{
QAction* remove_custom_pad_config = remove_menu->addAction(tr("&Remove Custom Gamepad Configuration"));
connect(remove_custom_pad_config, &QAction::triggered, [this, current_game, gameinfo]()
@ -1588,7 +1595,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
});
}
if (gameinfo->hasCustomConfig)
if (gameinfo->has_custom_config)
{
QAction* open_config_dir = open_folder_menu->addAction(tr("&Open Custom Config Folder"));
connect(open_config_dir, &QAction::triggered, [current_game]()
@ -1675,9 +1682,9 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
connect(&dlg, &settings_dialog::EmuSettingsApplied, [this, gameinfo]()
{
if (!gameinfo->hasCustomConfig)
if (!gameinfo->has_custom_config)
{
gameinfo->hasCustomConfig = true;
gameinfo->has_custom_config = true;
ShowCustomConfigIcon(gameinfo);
}
Q_EMIT NotifyEmuSettingsChange();
@ -1700,9 +1707,9 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
{
pad_settings_dialog dlg(m_gui_settings, this, &current_game);
if (dlg.exec() == QDialog::Accepted && !gameinfo->hasCustomPadConfig)
if (dlg.exec() == QDialog::Accepted && !gameinfo->has_custom_pad_config)
{
gameinfo->hasCustomPadConfig = true;
gameinfo->has_custom_pad_config = true;
ShowCustomConfigIcon(gameinfo);
}
});
@ -2041,7 +2048,7 @@ bool game_list_frame::RemoveCustomConfiguration(const std::string& title_id, con
{
if (game)
{
game->hasCustomConfig = false;
game->has_custom_config = false;
}
game_list_log.success("Removed configuration file: %s", path);
}
@ -2084,7 +2091,7 @@ bool game_list_frame::RemoveCustomPadConfiguration(const std::string& title_id,
{
if (game)
{
game->hasCustomPadConfig = false;
game->has_custom_pad_config = false;
}
if (!Emu.IsStopped(true) && Emu.GetTitleID() == title_id)
{
@ -2556,7 +2563,7 @@ void game_list_frame::BatchRemoveCustomConfigurations()
std::set<std::string> serials;
for (const auto& game : m_game_data)
{
if (game->hasCustomConfig && !serials.count(game->info.serial))
if (game->has_custom_config && !serials.count(game->info.serial))
{
serials.emplace(game->info.serial);
}
@ -2591,7 +2598,7 @@ void game_list_frame::BatchRemoveCustomPadConfigurations()
std::set<std::string> serials;
for (const auto& game : m_game_data)
{
if (game->hasCustomPadConfig && !serials.count(game->info.serial))
if (game->has_custom_pad_config && !serials.count(game->info.serial))
{
serials.emplace(game->info.serial);
}
@ -2667,15 +2674,15 @@ void game_list_frame::ShowCustomConfigIcon(const game_info& game)
}
const std::string serial = game->info.serial;
const bool has_custom_config = game->hasCustomConfig;
const bool has_custom_pad_config = game->hasCustomPadConfig;
const bool has_custom_config = game->has_custom_config;
const bool has_custom_pad_config = game->has_custom_pad_config;
for (const auto& other_game : m_game_data)
{
if (other_game->info.serial == serial)
{
other_game->hasCustomConfig = has_custom_config;
other_game->hasCustomPadConfig = has_custom_pad_config;
other_game->has_custom_config = has_custom_config;
other_game->has_custom_pad_config = has_custom_pad_config;
}
}

View file

@ -48,7 +48,6 @@ void game_list_grid::populate(
{
clear_list();
const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : "";
game_list_grid_item* selected_item = nullptr;
blockSignals(true);
@ -109,11 +108,7 @@ void game_list_grid::populate(
}
});
if (play_hover_movies && game->has_hover_gif)
{
item->set_movie_path(game_icon_path % serial % "/hover.gif");
}
else if (play_hover_movies && game->has_hover_pam)
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
{
item->set_movie_path(QString::fromStdString(game->info.movie_path));
}

View file

@ -216,7 +216,6 @@ void game_list_table::populate(
const QLocale locale{};
const Localized localized;
const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : "";
const std::string dev_flash = g_cfg_vfs.get_dev_flash();
int row = 0;
@ -292,11 +291,7 @@ void game_list_table::populate(
}
});
if (play_hover_movies && game->has_hover_gif)
{
icon_item->set_movie_path(game_icon_path % serial % "/hover.gif");
}
else if (play_hover_movies && game->has_hover_pam)
if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam))
{
icon_item->set_movie_path(QString::fromStdString(game->info.movie_path));
}

View file

@ -15,8 +15,9 @@ struct gui_game_info
compat::status compat;
QPixmap icon;
QPixmap pxmap;
bool hasCustomConfig = false;
bool hasCustomPadConfig = false;
bool has_custom_config = false;
bool has_custom_pad_config = false;
bool has_custom_icon = false;
bool has_hover_gif = false;
bool has_hover_pam = false;
movie_item_base* item = nullptr;