Dispaly all valid game regions
This commit is contained in:
parent
aabc2144bf
commit
848bfaf8cb
3 changed files with 30 additions and 35 deletions
|
@ -48,26 +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 {
|
||||
std::vector<SMDH::GameRegion> SMDH::GetRegions() const {
|
||||
if (region_lockout == 0x7fffffff) {
|
||||
return GameRegion::RegionFree;
|
||||
return std::vector<GameRegion>{GameRegion::RegionFree};
|
||||
}
|
||||
|
||||
constexpr u32 taiwan_and_china =
|
||||
(1 << static_cast<u32>(GameRegion::Taiwan)) | (1 << static_cast<u32>(GameRegion::China));
|
||||
if (region_lockout == taiwan_and_china) {
|
||||
return GameRegion::Taiwan;
|
||||
} // hack to fix TWN games that support CHN consoles
|
||||
|
||||
constexpr u32 REGION_COUNT = 7;
|
||||
u32 region = 0;
|
||||
for (; region < REGION_COUNT; ++region) {
|
||||
std::vector<GameRegion> result;
|
||||
for (u32 region = 0; region < REGION_COUNT; ++region) {
|
||||
if (region_lockout & (1 << region)) {
|
||||
return static_cast<GameRegion>(region);
|
||||
result.push_back(static_cast<GameRegion>(region));
|
||||
}
|
||||
}
|
||||
|
||||
return GameRegion::Invalid;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Loader
|
||||
|
|
|
@ -63,7 +63,6 @@ struct SMDH {
|
|||
};
|
||||
|
||||
enum class GameRegion {
|
||||
Invalid = -1,
|
||||
Japan = 0,
|
||||
NorthAmerica = 1,
|
||||
Europe = 2,
|
||||
|
@ -88,7 +87,7 @@ struct SMDH {
|
|||
*/
|
||||
std::array<u16, 0x40> GetShortTitle(Loader::SMDH::TitleLanguage language) const;
|
||||
|
||||
GameRegion GetRegion() const;
|
||||
std::vector<GameRegion> GetRegions() const;
|
||||
};
|
||||
static_assert(sizeof(SMDH) == 0x36C0, "SMDH structure size is wrong");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue