citra_qt: Add a game region column

This commit is contained in:
FearlessTobi 2018-05-01 19:57:01 +02:00
parent 9c65a45358
commit 36c4765054
5 changed files with 81 additions and 0 deletions

View file

@ -48,4 +48,20 @@ std::array<u16, 0x40> SMDH::GetShortTitle(Loader::SMDH::TitleLanguage language)
return titles[static_cast<int>(language)].short_title;
}
SMDH::GameRegion SMDH::GetRegion() const {
if (region_lockout == 0x7fffffff) {
return GameRegion::RegionFree;
}
constexpr u32 REGION_COUNT = 7;
u32 region = 0;
for (; region < REGION_COUNT; ++region) {
if (region_lockout & (1 << region)) {
return static_cast<GameRegion>(region);
}
}
return GameRegion::Invalid;
}
} // namespace Loader

View file

@ -62,6 +62,18 @@ struct SMDH {
TraditionalChinese = 11
};
enum class GameRegion {
Invalid = -1,
Japan = 0,
NorthAmerica = 1,
Europe = 2,
Australia = 3,
China = 4,
Korea = 5,
Taiwan = 6,
RegionFree = 7,
};
/**
* Gets game icon from SMDH
* @param large If true, returns large icon (48x48), otherwise returns small icon (24x24)
@ -75,6 +87,8 @@ struct SMDH {
* @return UTF-16 array of the short title
*/
std::array<u16, 0x40> GetShortTitle(Loader::SMDH::TitleLanguage language) const;
GameRegion GetRegion() const;
};
static_assert(sizeof(SMDH) == 0x36C0, "SMDH structure size is wrong");