Try to distinguish between Update and DLC (Part 2)

This commit is contained in:
Megamouse 2020-11-25 19:04:12 +01:00
parent cde802b16c
commit 36189b8c3b
4 changed files with 29 additions and 8 deletions

View file

@ -274,10 +274,19 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam
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())
if (info.category == "GD")
{
info.is_dlc = true;
// For now let's assume that PS3 Game Data packages are always updates or DLC.
// Update packages always seem to have an APP_VER, so let's say it's a DLC otherwise.
// Ideally this would simply be the package content type, but I am too lazy to implement this right now.
if (info.version.isEmpty())
{
info.type = compat::package_type::dlc;
}
else
{
info.type = compat::package_type::update;
}
}
}
@ -307,6 +316,9 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam
info.changelog = qstr(localized_changelog);
}
// This should be an update since it was found in a patch set
info.type = compat::package_type::update;
break;
}
}

View file

@ -89,6 +89,14 @@ namespace compat
std::vector<pkg_patchset> patch_sets;
};
// The type of the package. In the future this should signify the proper PKG_CONTENT_TYPE.
enum class package_type
{
update,
dlc,
other
};
/** Concicely represents a specific pkg's localized information for use in the GUI */
struct package_info
{
@ -99,7 +107,8 @@ namespace compat
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
package_type type = package_type::other; // The type of package (Update, DLC or other)
};
}

View file

@ -515,9 +515,9 @@ 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);
if (info.category == "GD")
if (info.type != compat::package_type::other)
{
if (info.is_dlc)
if (info.type == compat::package_type::dlc)
{
info.local_cat = tr("\nDLC", "Block for package type (DLC)");
}

View file

@ -69,14 +69,14 @@ pkg_install_dialog::pkg_install_dialog(const QStringList& paths, game_compatibil
accumulated_info = info.title_id;
}
if (info.category == "GD")
if (info.type != compat::package_type::other)
{
if (!accumulated_info.isEmpty())
{
accumulated_info += ", ";
}
if (info.is_dlc)
if (info.type == compat::package_type::dlc)
{
accumulated_info += tr("DLC", "Package type info (DLC)");
}