mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Try to distinguish between Update and DLC
This commit is contained in:
parent
fbe91fb245
commit
1500e5f588
4 changed files with 101 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "game_compatibility.h"
|
#include "game_compatibility.h"
|
||||||
#include "gui_settings.h"
|
#include "gui_settings.h"
|
||||||
#include "downloader.h"
|
#include "downloader.h"
|
||||||
|
#include "localized.h"
|
||||||
|
|
||||||
#include "Crypto/unpkg.h"
|
#include "Crypto/unpkg.h"
|
||||||
#include "Loader/PSF.h"
|
#include "Loader/PSF.h"
|
||||||
|
@ -256,9 +257,30 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam
|
||||||
compat::package_info info;
|
compat::package_info info;
|
||||||
info.path = pkg_path;
|
info.path = pkg_path;
|
||||||
info.title = qstr(std::string(psf::get_string(psf, title_key))); // Let's read this from the psf first
|
info.title = qstr(std::string(psf::get_string(psf, title_key))); // Let's read this from the psf first
|
||||||
info.title_id = qstr(std::string(psf::get_string(psf, "TITLE_ID", "Unknown")));
|
info.title_id = qstr(std::string(psf::get_string(psf, "TITLE_ID")));
|
||||||
|
info.category = qstr(std::string(psf::get_string(psf, "CATEGORY")));
|
||||||
info.version = qstr(std::string(psf::get_string(psf, "APP_VER")));
|
info.version = qstr(std::string(psf::get_string(psf, "APP_VER")));
|
||||||
|
|
||||||
|
if (!info.category.isEmpty())
|
||||||
|
{
|
||||||
|
const Localized localized;
|
||||||
|
|
||||||
|
if (const auto boot_cat = localized.category.cat_boot.find(info.category); boot_cat != localized.category.cat_boot.end())
|
||||||
|
{
|
||||||
|
info.local_cat = boot_cat->second;
|
||||||
|
}
|
||||||
|
else if (const auto data_cat = localized.category.cat_data.find(info.category); data_cat != localized.category.cat_data.end())
|
||||||
|
{
|
||||||
|
info.local_cat = data_cat->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update packages always seem to have an APP_VER, so let's assume it's a DLC otherwise.
|
||||||
|
if (info.category == "GD" && info.version.isEmpty())
|
||||||
|
{
|
||||||
|
info.is_dlc = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (info.version.isEmpty())
|
if (info.version.isEmpty())
|
||||||
{
|
{
|
||||||
// Fallback to VERSION
|
// Fallback to VERSION
|
||||||
|
|
|
@ -92,11 +92,14 @@ namespace compat
|
||||||
/** Concicely represents a specific pkg's localized information for use in the GUI */
|
/** Concicely represents a specific pkg's localized information for use in the GUI */
|
||||||
struct package_info
|
struct package_info
|
||||||
{
|
{
|
||||||
QString path; // File path
|
QString path; // File path
|
||||||
QString title_id; // TEST12345
|
QString title_id; // TEST12345
|
||||||
QString title; // Localized
|
QString title; // Localized
|
||||||
QString changelog; // Localized, may be empty
|
QString changelog; // Localized, may be empty
|
||||||
QString version; // May be empty
|
QString version; // May be empty
|
||||||
|
QString category; // HG, DG, GD etc.
|
||||||
|
QString local_cat; // Localized category
|
||||||
|
bool is_dlc = false; // Distinguish between update and DLC if category is GD
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -515,23 +515,39 @@ void main_window::InstallPackages(QStringList file_paths)
|
||||||
|
|
||||||
compat::package_info info = game_compatibility::GetPkgInfo(file_path, m_game_list_frame ? m_game_list_frame->GetGameCompatibility() : nullptr);
|
compat::package_info info = game_compatibility::GetPkgInfo(file_path, m_game_list_frame ? m_game_list_frame->GetGameCompatibility() : nullptr);
|
||||||
|
|
||||||
if (!info.title_id.isEmpty())
|
if (info.category == "GD")
|
||||||
{
|
{
|
||||||
info.title_id = tr("\n%0").arg(info.title_id);
|
if (info.is_dlc)
|
||||||
|
{
|
||||||
|
info.local_cat = tr("\nDLC", "Block for package type (DLC)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info.local_cat = tr("\nUpdate", "Block for package type (Update)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!info.local_cat.isEmpty())
|
||||||
|
{
|
||||||
|
info.local_cat = tr("\n%0", "Block for package type").arg(info.local_cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.changelog.isEmpty())
|
if (!info.title_id.isEmpty())
|
||||||
{
|
{
|
||||||
info.changelog = tr("\n\nChangelog:\n%0").arg(info.changelog);
|
info.title_id = tr("\n%0", "Block for Title ID").arg(info.title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.version.isEmpty())
|
if (!info.version.isEmpty())
|
||||||
{
|
{
|
||||||
info.version = tr("\nVersion %0").arg(info.version);
|
info.version = tr("\nVersion %0", "Block for Version").arg(info.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0%1%2%3")
|
if (!info.changelog.isEmpty())
|
||||||
.arg(info.title).arg(info.title_id).arg(info.version).arg(info.changelog),
|
{
|
||||||
|
info.changelog = tr("\n\nChangelog:\n%0", "Block for Changelog").arg(info.changelog);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Do you want to install this package?\n\n%0%1%2%3%4")
|
||||||
|
.arg(info.title).arg(info.local_cat).arg(info.title_id).arg(info.version).arg(info.changelog),
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
gui_log.notice("PKG: Cancelled installation from drop. File: %s", sstr(file_paths.front()));
|
gui_log.notice("PKG: Cancelled installation from drop. File: %s", sstr(file_paths.front()));
|
||||||
|
|
|
@ -59,24 +59,65 @@ pkg_install_dialog::pkg_install_dialog(const QStringList& paths, game_compatibil
|
||||||
{
|
{
|
||||||
const compat::package_info info = game_compatibility::GetPkgInfo(path, compat);
|
const compat::package_info info = game_compatibility::GetPkgInfo(path, compat);
|
||||||
|
|
||||||
|
// We have to build our complicated localized string in some annoying manner
|
||||||
|
QString accumulated_info;
|
||||||
|
QString additional_info;
|
||||||
QString tooltip;
|
QString tooltip;
|
||||||
QString version = info.version;
|
|
||||||
|
if (!info.title_id.isEmpty())
|
||||||
|
{
|
||||||
|
accumulated_info = info.title_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.category == "GD")
|
||||||
|
{
|
||||||
|
if (!accumulated_info.isEmpty())
|
||||||
|
{
|
||||||
|
accumulated_info += ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.is_dlc)
|
||||||
|
{
|
||||||
|
accumulated_info += tr("DLC", "Package type info (DLC)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
accumulated_info += tr("Update", "Package type info (Update)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!info.local_cat.isEmpty())
|
||||||
|
{
|
||||||
|
if (!accumulated_info.isEmpty())
|
||||||
|
{
|
||||||
|
accumulated_info += ", ";
|
||||||
|
}
|
||||||
|
accumulated_info += tr("%0", "Package type info").arg(info.local_cat);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!info.version.isEmpty())
|
||||||
|
{
|
||||||
|
if (!accumulated_info.isEmpty())
|
||||||
|
{
|
||||||
|
accumulated_info += ", ";
|
||||||
|
}
|
||||||
|
accumulated_info += tr("v.%0", "Version info").arg(info.version);
|
||||||
|
}
|
||||||
|
|
||||||
if (info.changelog.isEmpty())
|
if (info.changelog.isEmpty())
|
||||||
{
|
{
|
||||||
tooltip = tr("No info");
|
tooltip = tr("No info", "Changelog info placeholder");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tooltip = tr("Changelog:\n\n%0").arg(info.changelog);
|
tooltip = tr("Changelog:\n\n%0", "Changelog info").arg(info.changelog);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!version.isEmpty())
|
if (!accumulated_info.isEmpty())
|
||||||
{
|
{
|
||||||
version = tr("v.%0").arg(info.version);
|
additional_info = tr(" (%0)", "Additional info").arg(accumulated_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString text = tr("%0 (%1 %2)").arg(info.title).arg(info.title_id).arg(version);
|
const QString text = tr("%0%1", "Package text").arg(info.title).arg(additional_info);
|
||||||
|
|
||||||
QListWidgetItem* item = new numbered_widget_item(text, m_dir_list);
|
QListWidgetItem* item = new numbered_widget_item(text, m_dir_list);
|
||||||
item->setData(Roles::FullPathRole, info.path);
|
item->setData(Roles::FullPathRole, info.path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue