mirror of
https://github.com/jakcron/nstool
synced 2024-11-23 05:59:29 +00:00
[nx] Fix behaviour in NACP processing, supported langs don't indicate what title strings are set.
This commit is contained in:
parent
1a30f05256
commit
b8b97066dd
2 changed files with 28 additions and 2 deletions
|
@ -116,6 +116,9 @@ namespace nx
|
||||||
nacp::AttributeFlag getAttributeFlag() const;
|
nacp::AttributeFlag getAttributeFlag() const;
|
||||||
void setAttributeFlag(nacp::AttributeFlag var);
|
void setAttributeFlag(nacp::AttributeFlag var);
|
||||||
|
|
||||||
|
const fnd::List<nacp::Language>& getSupportedLanguages() const;
|
||||||
|
void setSupportedLanguages(const fnd::List<nacp::Language>& var);
|
||||||
|
|
||||||
nacp::ParentalControlFlag getParentalControlFlag() const;
|
nacp::ParentalControlFlag getParentalControlFlag() const;
|
||||||
void setParentalControlFlag(nacp::ParentalControlFlag var);
|
void setParentalControlFlag(nacp::ParentalControlFlag var);
|
||||||
|
|
||||||
|
@ -226,6 +229,7 @@ namespace nx
|
||||||
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
||||||
nacp::AocRegistrationType mAocRegistrationType;
|
nacp::AocRegistrationType mAocRegistrationType;
|
||||||
nacp::AttributeFlag mAttributeFlag;
|
nacp::AttributeFlag mAttributeFlag;
|
||||||
|
fnd::List<nx::nacp::Language> mSupportedLanguages;
|
||||||
nacp::ParentalControlFlag mParentalControlFlag;
|
nacp::ParentalControlFlag mParentalControlFlag;
|
||||||
nacp::ScreenshotMode mScreenshotMode;
|
nacp::ScreenshotMode mScreenshotMode;
|
||||||
nacp::VideoCaptureMode mVideoCaptureMode;
|
nacp::VideoCaptureMode mVideoCaptureMode;
|
||||||
|
|
|
@ -19,6 +19,7 @@ void nx::ApplicationControlPropertyBinary::operator=(const ApplicationControlPro
|
||||||
mTouchScreenUsageMode = other.mTouchScreenUsageMode;
|
mTouchScreenUsageMode = other.mTouchScreenUsageMode;
|
||||||
mAocRegistrationType = other.mAocRegistrationType;
|
mAocRegistrationType = other.mAocRegistrationType;
|
||||||
mAttributeFlag = other.mAttributeFlag;
|
mAttributeFlag = other.mAttributeFlag;
|
||||||
|
mSupportedLanguages = other.mSupportedLanguages;
|
||||||
mParentalControlFlag = other.mParentalControlFlag;
|
mParentalControlFlag = other.mParentalControlFlag;
|
||||||
mScreenshotMode = other.mScreenshotMode;
|
mScreenshotMode = other.mScreenshotMode;
|
||||||
mVideoCaptureMode = other.mVideoCaptureMode;
|
mVideoCaptureMode = other.mVideoCaptureMode;
|
||||||
|
@ -61,6 +62,7 @@ bool nx::ApplicationControlPropertyBinary::operator==(const ApplicationControlPr
|
||||||
&& (mTouchScreenUsageMode == other.mTouchScreenUsageMode) \
|
&& (mTouchScreenUsageMode == other.mTouchScreenUsageMode) \
|
||||||
&& (mAocRegistrationType == other.mAocRegistrationType) \
|
&& (mAocRegistrationType == other.mAocRegistrationType) \
|
||||||
&& (mAttributeFlag == other.mAttributeFlag) \
|
&& (mAttributeFlag == other.mAttributeFlag) \
|
||||||
|
&& (mSupportedLanguages == other.mSupportedLanguages) \
|
||||||
&& (mParentalControlFlag == other.mParentalControlFlag) \
|
&& (mParentalControlFlag == other.mParentalControlFlag) \
|
||||||
&& (mScreenshotMode == other.mScreenshotMode) \
|
&& (mScreenshotMode == other.mScreenshotMode) \
|
||||||
&& (mVideoCaptureMode == other.mVideoCaptureMode) \
|
&& (mVideoCaptureMode == other.mVideoCaptureMode) \
|
||||||
|
@ -107,13 +109,17 @@ void nx::ApplicationControlPropertyBinary::toBytes()
|
||||||
sApplicationControlProperty* data = (sApplicationControlProperty*)mRawBinary.data();
|
sApplicationControlProperty* data = (sApplicationControlProperty*)mRawBinary.data();
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
uint32_t supported_langs = 0;
|
|
||||||
for (size_t i = 0; i < mTitle.size(); i++)
|
for (size_t i = 0; i < mTitle.size(); i++)
|
||||||
{
|
{
|
||||||
supported_langs = _BIT(mTitle[i].language);
|
|
||||||
strncpy(data->title[mTitle[i].language].name, mTitle[i].name.c_str(), nacp::kNameLength);
|
strncpy(data->title[mTitle[i].language].name, mTitle[i].name.c_str(), nacp::kNameLength);
|
||||||
strncpy(data->title[mTitle[i].language].publisher, mTitle[i].publisher.c_str(), nacp::kPublisherLength);
|
strncpy(data->title[mTitle[i].language].publisher, mTitle[i].publisher.c_str(), nacp::kPublisherLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t supported_langs = 0;
|
||||||
|
for (size_t i = 0; i < mSupportedLanguages.size(); i++)
|
||||||
|
{
|
||||||
|
supported_langs |= _BIT(mSupportedLanguages[i]);
|
||||||
|
}
|
||||||
data->supported_language_flag = supported_langs;
|
data->supported_language_flag = supported_langs;
|
||||||
|
|
||||||
strncpy(data->isbn, mIsbn.c_str(), nacp::kIsbnLength);
|
strncpy(data->isbn, mIsbn.c_str(), nacp::kIsbnLength);
|
||||||
|
@ -194,10 +200,15 @@ void nx::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, size_t
|
||||||
for (size_t i = 0; i < nacp::kMaxLanguageCount; i++)
|
for (size_t i = 0; i < nacp::kMaxLanguageCount; i++)
|
||||||
{
|
{
|
||||||
if (_HAS_BIT(data->supported_language_flag.get(), i))
|
if (_HAS_BIT(data->supported_language_flag.get(), i))
|
||||||
|
{
|
||||||
|
mSupportedLanguages.addElement((nacp::Language)i);
|
||||||
|
}
|
||||||
|
if (data->title[i].name[0] != '\0' && data->title[i].publisher[0] != '\0')
|
||||||
{
|
{
|
||||||
mTitle.addElement({ (nacp::Language)i, std::string(data->title[i].name, _MIN(strlen(data->title[i].name), nacp::kNameLength)), std::string(data->title[i].publisher, _MIN(strlen(data->title[i].publisher), nacp::kPublisherLength)) });
|
mTitle.addElement({ (nacp::Language)i, std::string(data->title[i].name, _MIN(strlen(data->title[i].name), nacp::kNameLength)), std::string(data->title[i].publisher, _MIN(strlen(data->title[i].publisher), nacp::kPublisherLength)) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->isbn[0] != 0)
|
if (data->isbn[0] != 0)
|
||||||
mIsbn = std::string(data->isbn, _MIN(strlen(data->isbn), nacp::kIsbnLength));
|
mIsbn = std::string(data->isbn, _MIN(strlen(data->isbn), nacp::kIsbnLength));
|
||||||
if (data->display_version[0] != 0)
|
if (data->display_version[0] != 0)
|
||||||
|
@ -278,6 +289,7 @@ void nx::ApplicationControlPropertyBinary::clear()
|
||||||
mTouchScreenUsageMode = nacp::TOUCH_None;
|
mTouchScreenUsageMode = nacp::TOUCH_None;
|
||||||
mAocRegistrationType = nacp::AOC_AllOnLaunch;
|
mAocRegistrationType = nacp::AOC_AllOnLaunch;
|
||||||
mAttributeFlag = nacp::ATTR_None;
|
mAttributeFlag = nacp::ATTR_None;
|
||||||
|
mSupportedLanguages.clear();
|
||||||
mParentalControlFlag = nacp::PC_None;
|
mParentalControlFlag = nacp::PC_None;
|
||||||
mScreenshotMode = nacp::SCRN_Allow;
|
mScreenshotMode = nacp::SCRN_Allow;
|
||||||
mVideoCaptureMode = nacp::VCAP_Disable;
|
mVideoCaptureMode = nacp::VCAP_Disable;
|
||||||
|
@ -372,6 +384,16 @@ void nx::ApplicationControlPropertyBinary::setAttributeFlag(nacp::AttributeFlag
|
||||||
mAttributeFlag = var;
|
mAttributeFlag = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fnd::List<nx::nacp::Language>& nx::ApplicationControlPropertyBinary::getSupportedLanguages() const
|
||||||
|
{
|
||||||
|
return mSupportedLanguages;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nx::ApplicationControlPropertyBinary::setSupportedLanguages(const fnd::List<nacp::Language>& var)
|
||||||
|
{
|
||||||
|
mSupportedLanguages = var;
|
||||||
|
}
|
||||||
|
|
||||||
nx::nacp::ParentalControlFlag nx::ApplicationControlPropertyBinary::getParentalControlFlag() const
|
nx::nacp::ParentalControlFlag nx::ApplicationControlPropertyBinary::getParentalControlFlag() const
|
||||||
{
|
{
|
||||||
return mParentalControlFlag;
|
return mParentalControlFlag;
|
||||||
|
|
Loading…
Reference in a new issue