patch_manager: fix owned games o. for all versions

This commit is contained in:
Megamouse 2020-06-28 15:16:09 +02:00
commit ef203f6bcb
5 changed files with 19 additions and 12 deletions

View file

@ -1946,20 +1946,13 @@ void game_list_frame::PopulateGameList()
} }
// Version // Version
QString app_version = qstr(game->info.app_ver); QString app_version = qstr(GetGameVersion(game));
const QString unknown = localized.category.unknown;
if (app_version == unknown)
{
// Fall back to Disc/Pkg Revision
app_version = qstr(game->info.version);
}
if (game->info.bootable && !game->compat.latest_version.isEmpty()) if (game->info.bootable && !game->compat.latest_version.isEmpty())
{ {
// If the app is bootable and the compat database contains info about the latest patch version: // If the app is bootable and the compat database contains info about the latest patch version:
// add a hint for available software updates if the app version is unknown or lower than the latest version. // add a hint for available software updates if the app version is unknown or lower than the latest version.
if (app_version == unknown || game->compat.latest_version.toDouble() > app_version.toDouble()) if (app_version == localized.category.unknown || game->compat.latest_version.toDouble() > app_version.toDouble())
{ {
app_version = tr("%0 (Update available: %1)").arg(app_version, game->compat.latest_version); app_version = tr("%0 (Update available: %1)").arg(app_version, game->compat.latest_version);
} }
@ -2235,3 +2228,14 @@ QList<game_info> game_list_frame::GetGameInfo() const
{ {
return m_game_data; return m_game_data;
} }
std::string game_list_frame::GetGameVersion(const game_info& game)
{
if (game->info.app_ver == sstr(Localized().category.unknown))
{
// Fall back to Disc/Pkg Revision
return game->info.version;
}
return game->info.app_ver;
}

View file

@ -71,6 +71,9 @@ public:
QList<game_info> GetGameInfo() const; QList<game_info> GetGameInfo() const;
// Returns the visible version string in the game list
static std::string GetGameVersion(const game_info& game);
public Q_SLOTS: public Q_SLOTS:
void BatchCreatePPUCaches(); void BatchCreatePPUCaches();
void BatchRemovePPUCaches(); void BatchRemovePPUCaches();

View file

@ -1542,7 +1542,7 @@ void main_window::CreateConnects()
{ {
if (game) if (game)
{ {
games[game->info.serial].insert(game->info.app_ver); games[game->info.serial].insert(game_list_frame::GetGameVersion(game));
} }
} }
} }

View file

@ -332,7 +332,7 @@ void patch_manager_dialog::filter_patches(const QString& term)
const std::string app_version = item->data(0, app_version_role).toString().toStdString(); const std::string app_version = item->data(0, app_version_role).toString().toStdString();
if (serial != patch_key::all && if (serial != patch_key::all &&
(m_owned_games.find(serial) == m_owned_games.end() || !m_owned_games.at(serial).contains(app_version))) (m_owned_games.find(serial) == m_owned_games.end() || (app_version != patch_key::all && !m_owned_games.at(serial).contains(app_version))))
{ {
item->setHidden(true); item->setHidden(true);
return 0; return 0;

View file

@ -121,7 +121,7 @@
<item> <item>
<widget class="QGroupBox" name="gb_app_version"> <widget class="QGroupBox" name="gb_app_version">
<property name="title"> <property name="title">
<string>App Version</string> <string>Game Version</string>
</property> </property>
<layout class="QVBoxLayout" name="layout_app_version"> <layout class="QVBoxLayout" name="layout_app_version">
<item> <item>