Use GodMode9 naming scheme

This commit is contained in:
Pengfei
2021-07-01 15:22:38 +08:00
parent e2bef4d705
commit 19bc9d0210
7 changed files with 112 additions and 50 deletions
+11
View File
@@ -371,6 +371,17 @@ ResultStatus NCCHContainer::ReadCodesetName(std::string& name) {
return ResultStatus::Success;
}
ResultStatus NCCHContainer::ReadProductCode(std::string& product_code) {
ResultStatus result = Load();
if (result != ResultStatus::Success)
return result;
std::array<char, 17> data{};
std::memcpy(data.data(), ncch_header.product_code, 16);
product_code = data.data();
return ResultStatus::Success;
}
ResultStatus NCCHContainer::ReadEncryptionType(EncryptionType& encryption) {
ResultStatus result = Load();
if (result != ResultStatus::Success)
+6
View File
@@ -257,6 +257,12 @@ public:
*/
ResultStatus ReadCodesetName(std::string& name);
/**
* Reads the product code.
* @return ResultStatus result of function.
*/
ResultStatus ReadProductCode(std::string& name);
/**
* Gets encryption type (which key is used).
* @return ResultStatus result of function.
+13 -8
View File
@@ -88,20 +88,25 @@ std::array<u16, 0x40> SMDH::GetShortTitle(Core::SMDH::TitleLanguage language) co
return titles[static_cast<int>(language)].short_title;
}
std::vector<SMDH::GameRegion> SMDH::GetRegions() const {
if (region_lockout == 0x7fffffff) {
return std::vector<GameRegion>{GameRegion::RegionFree};
}
std::string SMDH::GetRegionString() const {
constexpr u32 REGION_COUNT = 7;
std::vector<GameRegion> result;
// JPN/USA/EUR/Australia/CHN/KOR/TWN
// Australia does not have a symbol because it's practically the same as Europe
static const std::array<std::string, REGION_COUNT> RegionSymbols{
{"J", "U", "E", "", "C", "K", "T"}};
std::string region_string;
for (u32 region = 0; region < REGION_COUNT; ++region) {
if (region_lockout & (1 << region)) {
result.push_back(static_cast<GameRegion>(region));
region_string.append(RegionSymbols[region]);
}
}
return result;
if (region_string == "JUECKT") {
return "W";
}
return region_string;
}
} // namespace Core
+2 -12
View File
@@ -62,17 +62,6 @@ struct SMDH {
TraditionalChinese = 11
};
enum class GameRegion {
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)
@@ -87,7 +76,8 @@ struct SMDH {
*/
std::array<u16, 0x40> GetShortTitle(Core::SMDH::TitleLanguage language) const;
std::vector<GameRegion> GetRegions() const;
/// Gets a string representing the supported regions.
std::string GetRegionString() const;
};
static_assert(sizeof(SMDH) == 0x36C0, "SMDH structure size is wrong");