Update NACP spec. Not backwards compatible with previous version. TouchScreenUsageMode deprecated.

This commit is contained in:
jakcron 2019-01-10 18:14:18 +08:00
parent f6991312f9
commit af5e9e4909
5 changed files with 139 additions and 17 deletions

View file

@ -109,8 +109,8 @@ namespace hac
nacp::StartupUserAccount getStartupUserAccount() const;
void setStartupUserAccount(nacp::StartupUserAccount var);
nacp::TouchScreenUsageMode getTouchScreenUsageMode() const;
void setTouchScreenUsageMode(nacp::TouchScreenUsageMode var);
nacp::UserAccountSwitchLockValue getUserAccountSwitchLockValue() const;
void setUserAccountSwitchLockValue(nacp::UserAccountSwitchLockValue var);
nacp::AocRegistrationType getAocRegistrationType() const;
void setAocRegistrationType(nacp::AocRegistrationType var);
@ -217,6 +217,8 @@ namespace hac
byte_t getProgramIndex() const;
void setProgramIndex(byte_t var);
nacp::RequiredNetworkServiceLicenseOnLaunchValue getRequiredNetworkServiceLicenseOnLaunchValue() const;
void setRequiredNetworkServiceLicenseOnLaunchValue(nacp::RequiredNetworkServiceLicenseOnLaunchValue var);
private:
const std::string kModuleName = "APPLICATION_CONTROL_PROPERTY";
@ -228,7 +230,7 @@ namespace hac
fnd::List<sTitle> mTitle;
std::string mIsbn;
nacp::StartupUserAccount mStartupUserAccount;
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
nacp::UserAccountSwitchLockValue mUserAccountSwitchLockValue;
nacp::AocRegistrationType mAocRegistrationType;
nacp::AttributeFlag mAttributeFlag;
fnd::List<nn::hac::nacp::Language> mSupportedLanguages;
@ -264,6 +266,7 @@ namespace hac
nacp::PlayLogQueryCapability mPlayLogQueryCapability;
nacp::RepairFlag mRepairFlag;
byte_t mProgramIndex;
nacp::RequiredNetworkServiceLicenseOnLaunchValue mRequiredNetworkServiceLicenseOnLaunchValue;
};
}
}

View file

@ -124,6 +124,12 @@ namespace hac
REPF_SuppressGameCardAccess
};
enum RequiredNetworkServiceLicenseOnLaunchValue
{
REQNETLIC_None,
REQNETLIC_Common
};
enum RuntimeAocInstallMode
{
RTAOC_Deny,
@ -150,6 +156,12 @@ namespace hac
TOUCH_Required,
};
enum UserAccountSwitchLockValue
{
UASL_Disable,
UASL_Enable
};
enum VideoCaptureMode
{
VCAP_Disable,
@ -167,6 +179,60 @@ namespace hac
};
struct sApplicationControlProperty
{
sApplicationTitle title[nacp::kMaxLanguageCount];
char isbn[nacp::kIsbnLength];
byte_t startup_user_account;
byte_t user_account_switch_lock;
byte_t add_on_content_registration_type;
le_uint32_t attribute_flag;
le_uint32_t supported_language_flag;
le_uint32_t parental_control_flag;
byte_t screenshot;
byte_t video_capture;
byte_t data_loss_confirmation;
byte_t play_log_policy;
le_uint64_t presence_group_id;
int8_t rating_age[nacp::kRatingAgeCount];
char display_version[nacp::kDisplayVersionLength];
le_uint64_t add_on_content_base_id;
le_uint64_t save_data_owner_id;
le_uint64_t user_account_save_data_size;
le_uint64_t user_account_save_data_journal_size;
le_uint64_t device_save_data_size;
le_uint64_t device_save_data_journal_size;
le_uint64_t bcat_delivery_cache_storage_size;
char application_error_code_category[nacp::kApplicationErrorCodeCategoryLength];
le_uint64_t local_communication_id[nacp::kLocalCommunicationIdCount];
byte_t logo_type;
byte_t logo_handling;
byte_t runtime_add_on_content_install;
byte_t reserved_00[3];
byte_t crash_report;
byte_t hdcp;
le_uint64_t seed_for_pseudo_device_id;
char bcat_passphrase[nacp::kBcatPassphraseLength];
byte_t reserved_01;
byte_t reserved_02[6]; //reserved_for_user_account_save_data_operation
le_uint64_t user_account_save_data_size_max;
le_uint64_t user_account_save_data_journal_size_max;
le_uint64_t device_save_data_size_max;
le_uint64_t device_save_data_journal_size_max;
le_uint64_t temporary_storage_size;
le_uint64_t cache_storage_size;
le_uint64_t cache_storage_journal_size;
le_uint64_t cache_storage_data_and_journal_size_max;
le_uint16_t cache_storage_index_max;
byte_t reserved_03[6];
le_uint64_t play_log_queryable_application_id[nacp::kPlayLogQueryableApplicationIdCount];
byte_t play_log_query_capability;
byte_t repair_flag;
byte_t program_index;
byte_t required_network_service_license_on_launch_flag;
byte_t reserved_04[0xDEC];
};
struct sApplicationControlProperty_v0
{
sApplicationTitle title[nacp::kMaxLanguageCount];
char isbn[nacp::kIsbnLength];

View file

@ -17,7 +17,7 @@ void nn::hac::ApplicationControlProperty::operator=(const ApplicationControlProp
mTitle = other.mTitle;
mIsbn = other.mIsbn;
mStartupUserAccount = other.mStartupUserAccount;
mTouchScreenUsageMode = other.mTouchScreenUsageMode;
mUserAccountSwitchLockValue = other.mUserAccountSwitchLockValue;
mAocRegistrationType = other.mAocRegistrationType;
mAttributeFlag = other.mAttributeFlag;
mSupportedLanguages = other.mSupportedLanguages;
@ -53,6 +53,7 @@ void nn::hac::ApplicationControlProperty::operator=(const ApplicationControlProp
mPlayLogQueryCapability = other.mPlayLogQueryCapability;
mRepairFlag = other.mRepairFlag;
mProgramIndex = other.mProgramIndex;
mRequiredNetworkServiceLicenseOnLaunchValue = other.mRequiredNetworkServiceLicenseOnLaunchValue;
}
bool nn::hac::ApplicationControlProperty::operator==(const ApplicationControlProperty& other) const
@ -60,7 +61,7 @@ bool nn::hac::ApplicationControlProperty::operator==(const ApplicationControlPro
return (mTitle == other.mTitle) \
&& (mIsbn == other.mIsbn) \
&& (mStartupUserAccount == other.mStartupUserAccount) \
&& (mTouchScreenUsageMode == other.mTouchScreenUsageMode) \
&& (mUserAccountSwitchLockValue == other.mUserAccountSwitchLockValue) \
&& (mAocRegistrationType == other.mAocRegistrationType) \
&& (mAttributeFlag == other.mAttributeFlag) \
&& (mSupportedLanguages == other.mSupportedLanguages) \
@ -95,7 +96,8 @@ bool nn::hac::ApplicationControlProperty::operator==(const ApplicationControlPro
&& (mPlayLogQueryableApplicationId == other.mPlayLogQueryableApplicationId) \
&& (mPlayLogQueryCapability == other.mPlayLogQueryCapability) \
&& (mRepairFlag == other.mRepairFlag) \
&& (mProgramIndex == other.mProgramIndex);
&& (mProgramIndex == other.mProgramIndex) \
&& (mRequiredNetworkServiceLicenseOnLaunchValue == other.mRequiredNetworkServiceLicenseOnLaunchValue);
}
bool nn::hac::ApplicationControlProperty::operator!=(const ApplicationControlProperty& other) const
@ -130,7 +132,7 @@ void nn::hac::ApplicationControlProperty::toBytes()
// enum type casts
data->startup_user_account = mStartupUserAccount;
data->touch_screen_usage = mTouchScreenUsageMode;
data->user_account_switch_lock = mUserAccountSwitchLockValue;
data->add_on_content_registration_type = mAocRegistrationType;
data->attribute_flag = mAttributeFlag;
data->parental_control_flag = mParentalControlFlag;
@ -145,6 +147,7 @@ void nn::hac::ApplicationControlProperty::toBytes()
data->hdcp = mHdcp;
data->play_log_query_capability = mPlayLogQueryCapability;
data->repair_flag = mRepairFlag;
data->required_network_service_license_on_launch_flag = mRequiredNetworkServiceLicenseOnLaunchValue;
// misc params
data->presence_group_id = mPresenceGroupId;
@ -221,7 +224,7 @@ void nn::hac::ApplicationControlProperty::fromBytes(const byte_t* bytes, size_t
// enum type casts
mStartupUserAccount = (nacp::StartupUserAccount)data->startup_user_account;
mTouchScreenUsageMode = (nacp::TouchScreenUsageMode)data->touch_screen_usage;
mUserAccountSwitchLockValue = (nacp::UserAccountSwitchLockValue)data->user_account_switch_lock;
mAocRegistrationType = (nacp::AocRegistrationType)data->add_on_content_registration_type;
mAttributeFlag = (nacp::AttributeFlag)data->attribute_flag.get();
mParentalControlFlag = (nacp::ParentalControlFlag)data->parental_control_flag.get();
@ -236,6 +239,7 @@ void nn::hac::ApplicationControlProperty::fromBytes(const byte_t* bytes, size_t
mHdcp = (nacp::Hdcp)data->hdcp;
mPlayLogQueryCapability = (nacp::PlayLogQueryCapability)data->play_log_query_capability;
mRepairFlag = (nacp::RepairFlag)data->repair_flag;
mRequiredNetworkServiceLicenseOnLaunchValue = (nacp::RequiredNetworkServiceLicenseOnLaunchValue)data->required_network_service_license_on_launch_flag;
// misc params
mPresenceGroupId = data->presence_group_id.get();
@ -287,7 +291,7 @@ void nn::hac::ApplicationControlProperty::clear()
mTitle.clear();
mIsbn.clear();
mStartupUserAccount = nacp::USER_None;
mTouchScreenUsageMode = nacp::TOUCH_None;
mUserAccountSwitchLockValue = nacp::UASL_Disable;
mAocRegistrationType = nacp::AOC_AllOnLaunch;
mAttributeFlag = nacp::ATTR_None;
mSupportedLanguages.clear();
@ -323,6 +327,7 @@ void nn::hac::ApplicationControlProperty::clear()
mPlayLogQueryCapability = nacp::PLQC_None;
mRepairFlag = nacp::REPF_None;
mProgramIndex = 0;
mRequiredNetworkServiceLicenseOnLaunchValue = nacp::REQNETLIC_None;
}
const fnd::List<nn::hac::ApplicationControlProperty::sTitle>& nn::hac::ApplicationControlProperty::getTitle() const
@ -355,14 +360,14 @@ void nn::hac::ApplicationControlProperty::setStartupUserAccount(nacp::StartupUse
mStartupUserAccount = var;
}
nn::hac::nacp::TouchScreenUsageMode nn::hac::ApplicationControlProperty::getTouchScreenUsageMode() const
nn::hac::nacp::UserAccountSwitchLockValue nn::hac::ApplicationControlProperty::getUserAccountSwitchLockValue() const
{
return mTouchScreenUsageMode;
return mUserAccountSwitchLockValue;
}
void nn::hac::ApplicationControlProperty::setTouchScreenUsageMode(nacp::TouchScreenUsageMode var)
void nn::hac::ApplicationControlProperty::setUserAccountSwitchLockValue(nacp::UserAccountSwitchLockValue var)
{
mTouchScreenUsageMode = var;
mUserAccountSwitchLockValue = var;
}
nn::hac::nacp::AocRegistrationType nn::hac::ApplicationControlProperty::getAocRegistrationType() const
@ -713,4 +718,14 @@ byte_t nn::hac::ApplicationControlProperty::getProgramIndex() const
void nn::hac::ApplicationControlProperty::setProgramIndex(byte_t var)
{
mProgramIndex = var;
}
nn::hac::nacp::RequiredNetworkServiceLicenseOnLaunchValue nn::hac::ApplicationControlProperty::getRequiredNetworkServiceLicenseOnLaunchValue() const
{
return mRequiredNetworkServiceLicenseOnLaunchValue;
}
void nn::hac::ApplicationControlProperty::setRequiredNetworkServiceLicenseOnLaunchValue(nacp::RequiredNetworkServiceLicenseOnLaunchValue var)
{
mRequiredNetworkServiceLicenseOnLaunchValue = var;
}

View file

@ -150,10 +150,7 @@ void NacpProcess::displayNacp()
}
std::cout << " Other Flags:" << std::endl;
std::cout << " StartupUserAccount: " << getStartupUserAccountStr(mNacp.getStartupUserAccount()) << std::endl;
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
{
std::cout << " TouchScreenUsageMode: " << getTouchScreenUsageModeStr(mNacp.getTouchScreenUsageMode()) << std::endl;
}
std::cout << " UserAccountSwitchLock: " << getUserAccountSwitchLockValueStr(mNacp.getUserAccountSwitchLockValue()) << std::endl;
std::cout << " AttributeFlag: " << getAttributeFlagStr(mNacp.getAttributeFlag()) << std::endl;
std::cout << " CrashReportMode: " << getCrashReportModeStr(mNacp.getCrashReportMode()) << std::endl;
std::cout << " HDCP: " << getHdcpStr(mNacp.getHdcp()) << std::endl;
@ -162,6 +159,7 @@ void NacpProcess::displayNacp()
std::cout << " DataLossConfirmation: " << getDataLossConfirmationStr(mNacp.getDataLossConfirmation()) << std::endl;
std::cout << " RepairFlag: " << getRepairFlagStr(mNacp.getRepairFlag()) << std::endl;
std::cout << " ProgramIndex: 0x" << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)mNacp.getProgramIndex() << std::endl;
std::cout << " Req NetworkLicenseOnLaunch: " << getRequiredNetworkServiceLicenseOnLaunchValueStr(mNacp.getRequiredNetworkServiceLicenseOnLaunchValue()) << std::endl;
if (mNacp.getApplicationErrorCodeCategory().empty() == false || _HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
{
std::cout << " ApplicationErrorCodeCategory: " << mNacp.getApplicationErrorCodeCategory() << std::endl;
@ -278,6 +276,25 @@ const char* NacpProcess::getTouchScreenUsageModeStr(nn::hac::nacp::TouchScreenUs
return str;
}
const char* NacpProcess::getUserAccountSwitchLockValueStr(nn::hac::nacp::UserAccountSwitchLockValue var) const
{
const char* str = nullptr;
switch (var)
{
case (nn::hac::nacp::UASL_Disable):
str = "Disable";
break;
case (nn::hac::nacp::UASL_Enable):
str = "Enable";
break;
default:
str = "Unknown";
}
return str;
}
const char* NacpProcess::getAocRegistrationTypeStr(nn::hac::nacp::AocRegistrationType var) const
{
const char* str = nullptr;
@ -608,6 +625,25 @@ const char* NacpProcess::getRepairFlagStr(nn::hac::nacp::RepairFlag var) const
return str;
}
const char* NacpProcess::getRequiredNetworkServiceLicenseOnLaunchValueStr(nn::hac::nacp::RequiredNetworkServiceLicenseOnLaunchValue var) const
{
const char* str = nullptr;
switch (var)
{
case (nn::hac::nacp::REQNETLIC_None):
str = "None";
break;
case (nn::hac::nacp::REQNETLIC_Common):
str = "Common";
break;
default:
str = "Unknown";
}
return str;
}
std::string NacpProcess::getSaveDataSizeStr(int64_t size) const
{
static const int64_t kKiloByte = 1024;

View file

@ -33,6 +33,7 @@ private:
void displayNacp();
const char* getLanguageStr(nn::hac::nacp::Language var) const;
const char* getStartupUserAccountStr(nn::hac::nacp::StartupUserAccount var) const;
const char* getUserAccountSwitchLockValueStr(nn::hac::nacp::UserAccountSwitchLockValue var) const;
const char* getTouchScreenUsageModeStr(nn::hac::nacp::TouchScreenUsageMode var) const;
const char* getAocRegistrationTypeStr(nn::hac::nacp::AocRegistrationType var) const;
const char* getAttributeFlagStr(nn::hac::nacp::AttributeFlag var) const;
@ -49,5 +50,6 @@ private:
const char* getHdcpStr(nn::hac::nacp::Hdcp var) const;
const char* getPlayLogQueryCapabilityStr(nn::hac::nacp::PlayLogQueryCapability var) const;
const char* getRepairFlagStr(nn::hac::nacp::RepairFlag var) const;
const char* getRequiredNetworkServiceLicenseOnLaunchValueStr(nn::hac::nacp::RequiredNetworkServiceLicenseOnLaunchValue var) const;
std::string getSaveDataSizeStr(int64_t size) const;
};