citra_qt/game_list: Add an All Regions check

Some titles (mostly homebrews) do not use the region free value 0x7FFF but instead set all of the region flags, resulting in all regions displayed in game list, which is not beautiful and not what we want. This fixes it by adding an all_regions check.
This commit is contained in:
zhupengfei 2019-08-20 19:57:33 +08:00
parent 1cf75e55c2
commit 82fea86717
No known key found for this signature in database
GPG Key ID: DD129E108BD09378
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#pragma once
#include <algorithm>
#include <map>
#include <unordered_map>
#include <utility>
@ -95,6 +96,14 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) {
return QObject::tr("Region free");
}
const bool all_regions =
std::all_of(regions_map.begin(), regions_map.end(), [&regions](const auto& it) {
return std::find(regions.begin(), regions.end(), it.first) != regions.end();
});
if (all_regions) {
return QObject::tr("All regions");
}
QString result = QObject::tr(regions_map.at(regions.front()));
for (auto region = ++regions.begin(); region != regions.end(); ++region) {
result += QStringLiteral("\n") + QObject::tr(regions_map.at(*region));