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:
parent
1cf75e55c2
commit
82fea86717
@ -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(), [®ions](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));
|
||||
|
Loading…
Reference in New Issue
Block a user