2020-10-03 18:09:29 +01:00
/*
* nacp . h
*
2024-04-12 10:47:36 +01:00
* Copyright ( c ) 2020 - 2024 , DarkMatterCore < pabloacurielz @ gmail . com > .
2020-10-03 18:09:29 +01:00
*
* This file is part of nxdumptool ( https : //github.com/DarkMatterCore/nxdumptool).
*
2021-03-25 19:26:58 +00:00
* nxdumptool is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
2020-10-03 18:09:29 +01:00
*
2021-03-25 19:26:58 +00:00
* nxdumptool is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
2020-10-03 18:09:29 +01:00
*
* You should have received a copy of the GNU General Public License
2021-03-25 19:26:58 +00:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2020-10-03 18:09:29 +01:00
*/
# pragma once
# ifndef __NACP_H__
# define __NACP_H__
# include "romfs.h"
2021-03-24 17:25:19 +00:00
# ifdef __cplusplus
extern " C " {
# endif
2020-10-03 18:09:29 +01:00
# define NACP_MAX_ICON_SIZE 0x20000 /* 128 KiB. */
typedef struct {
char name [ 0x200 ] ;
char publisher [ 0x100 ] ;
} NacpTitle ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( NacpTitle , 0x300 ) ;
2020-10-03 18:09:29 +01:00
typedef enum {
NacpStartupUserAccount_None = 0 ,
NacpStartupUserAccount_Required = 1 ,
NacpStartupUserAccount_RequiredWithNetworkServiceAccountAvailable = 2 ,
2020-10-08 19:31:09 +01:00
NacpStartupUserAccount_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpStartupUserAccount ;
typedef enum {
NacpUserAccountSwitchLock_Disable = 0 ,
NacpUserAccountSwitchLock_Enable = 1 ,
2022-03-18 16:48:16 +00:00
NacpUserAccountSwitchLock_Count = 2 , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2022-03-18 16:48:16 +00:00
// Old.
NacpTouchScreenUsage_None = 0 ,
NacpTouchScreenUsage_Supported = 1 ,
NacpTouchScreenUsage_Required = 2
2020-10-03 18:09:29 +01:00
} NacpUserAccountSwitchLock ;
typedef enum {
NacpAddOnContentRegistrationType_AllOnLaunch = 0 ,
NacpAddOnContentRegistrationType_OnDemand = 1 ,
2020-10-08 19:31:09 +01:00
NacpAddOnContentRegistrationType_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpAddOnContentRegistrationType ;
typedef enum {
2023-07-17 00:03:05 +01:00
NacpAttribute_None = 0 ,
2020-10-08 19:31:09 +01:00
NacpAttribute_Demo = BIT ( 0 ) ,
NacpAttribute_RetailInteractiveDisplay = BIT ( 1 ) ,
2022-03-18 16:48:16 +00:00
NacpAttribute_DownloadPlay = BIT ( 2 ) , ///< Removed.
NacpAttribute_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpAttribute ;
2020-10-08 19:31:09 +01:00
/// Indexes used to access NACP Title structs.
2020-10-03 18:09:29 +01:00
typedef enum {
NacpLanguage_AmericanEnglish = 0 ,
NacpLanguage_BritishEnglish = 1 ,
NacpLanguage_Japanese = 2 ,
NacpLanguage_French = 3 ,
NacpLanguage_German = 4 ,
NacpLanguage_LatinAmericanSpanish = 5 ,
NacpLanguage_Spanish = 6 ,
NacpLanguage_Italian = 7 ,
NacpLanguage_Dutch = 8 ,
NacpLanguage_CanadianFrench = 9 ,
NacpLanguage_Portuguese = 10 ,
NacpLanguage_Russian = 11 ,
NacpLanguage_Korean = 12 ,
NacpLanguage_TraditionalChinese = 13 ,
NacpLanguage_SimplifiedChinese = 14 ,
NacpLanguage_BrazilianPortuguese = 15 ,
2020-10-28 22:48:46 +00:00
NacpLanguage_Count = 16 , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2020-10-28 22:48:46 +00:00
/// Old.
NacpLanguage_Taiwanese = NacpLanguage_TraditionalChinese ,
NacpLanguage_Chinese = NacpLanguage_SimplifiedChinese
2020-10-03 18:09:29 +01:00
} NacpLanguage ;
typedef enum {
2023-07-17 00:03:05 +01:00
NacpSupportedLanguage_None = 0 ,
NacpSupportedLanguage_AmericanEnglish = BIT ( NacpLanguage_AmericanEnglish ) ,
NacpSupportedLanguage_BritishEnglish = BIT ( NacpLanguage_BritishEnglish ) ,
NacpSupportedLanguage_Japanese = BIT ( NacpLanguage_Japanese ) ,
NacpSupportedLanguage_French = BIT ( NacpLanguage_French ) ,
NacpSupportedLanguage_German = BIT ( NacpLanguage_German ) ,
NacpSupportedLanguage_LatinAmericanSpanish = BIT ( NacpLanguage_LatinAmericanSpanish ) ,
NacpSupportedLanguage_Spanish = BIT ( NacpLanguage_Spanish ) ,
NacpSupportedLanguage_Italian = BIT ( NacpLanguage_Italian ) ,
NacpSupportedLanguage_Dutch = BIT ( NacpLanguage_Dutch ) ,
NacpSupportedLanguage_CanadianFrench = BIT ( NacpLanguage_CanadianFrench ) ,
NacpSupportedLanguage_Portuguese = BIT ( NacpLanguage_Portuguese ) ,
NacpSupportedLanguage_Russian = BIT ( NacpLanguage_Russian ) ,
NacpSupportedLanguage_Korean = BIT ( NacpLanguage_Korean ) ,
NacpSupportedLanguage_TraditionalChinese = BIT ( NacpLanguage_TraditionalChinese ) ,
NacpSupportedLanguage_SimplifiedChinese = BIT ( NacpLanguage_SimplifiedChinese ) ,
NacpSupportedLanguage_BrazilianPortuguese = BIT ( NacpLanguage_BrazilianPortuguese ) ,
NacpSupportedLanguage_Count = NacpLanguage_Count , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2021-06-01 02:12:15 +01:00
///< Old.
NacpSupportedLanguage_Taiwanese = NacpSupportedLanguage_TraditionalChinese ,
NacpSupportedLanguage_Chinese = NacpSupportedLanguage_SimplifiedChinese
2020-10-08 19:31:09 +01:00
} NacpSupportedLanguage ;
2020-10-03 18:09:29 +01:00
2020-10-08 19:31:09 +01:00
typedef enum {
2023-07-17 00:03:05 +01:00
NacpParentalControl_None = 0 ,
2020-10-08 19:31:09 +01:00
NacpParentalControl_FreeCommunication = BIT ( 0 ) ,
NacpParentalControl_Count = 1 ///< Total values supported by this enum.
} NacpParentalControl ;
2020-10-03 18:09:29 +01:00
typedef enum {
NacpScreenshot_Allow = 0 ,
NacpScreenshot_Deny = 1 ,
2020-10-08 19:31:09 +01:00
NacpScreenshot_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpScreenshot ;
typedef enum {
NacpVideoCapture_Disable = 0 ,
NacpVideoCapture_Manual = 1 ,
NacpVideoCapture_Enable = 2 ,
2020-10-08 19:31:09 +01:00
NacpVideoCapture_Count = 3 , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
/// Old.
NacpVideoCapture_Deny = NacpVideoCapture_Disable ,
NacpVideoCapture_Allow = NacpVideoCapture_Manual
} NacpVideoCapture ;
typedef enum {
NacpDataLossConfirmation_None = 0 ,
NacpDataLossConfirmation_Required = 1 ,
2020-10-08 19:31:09 +01:00
NacpDataLossConfirmation_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpDataLossConfirmation ;
typedef enum {
NacpPlayLogPolicy_Open = 0 ,
NacpPlayLogPolicy_LogOnly = 1 ,
NacpPlayLogPolicy_None = 2 ,
NacpPlayLogPolicy_Closed = 3 ,
2020-10-08 19:31:09 +01:00
NacpPlayLogPolicy_Count = 4 , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
/// Old.
NacpPlayLogPolicy_All = NacpPlayLogPolicy_Open
} NacpPlayLogPolicy ;
2020-10-08 19:31:09 +01:00
/// Indexes used to access NACP RatingAge info.
2020-10-03 18:09:29 +01:00
typedef enum {
NacpRatingAgeOrganization_CERO = 0 ,
NacpRatingAgeOrganization_GRACGCRB = 1 ,
NacpRatingAgeOrganization_GSRMR = 2 ,
NacpRatingAgeOrganization_ESRB = 3 ,
NacpRatingAgeOrganization_ClassInd = 4 ,
NacpRatingAgeOrganization_USK = 5 ,
NacpRatingAgeOrganization_PEGI = 6 ,
NacpRatingAgeOrganization_PEGIPortugal = 7 ,
NacpRatingAgeOrganization_PEGIBBFC = 8 ,
NacpRatingAgeOrganization_Russian = 9 ,
NacpRatingAgeOrganization_ACB = 10 ,
NacpRatingAgeOrganization_OFLC = 11 ,
NacpRatingAgeOrganization_IARCGeneric = 12 ,
2020-10-08 19:31:09 +01:00
NacpRatingAgeOrganization_Count = 13 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpRatingAgeOrganization ;
typedef struct {
2020-10-28 22:48:46 +00:00
s8 cero ;
s8 grac_gcrb ;
s8 gsrmr ;
s8 esrb ;
s8 class_ind ;
s8 usk ;
s8 pegi ;
s8 pegi_portugal ;
s8 pegi_bbfc ;
s8 russian ;
s8 acb ;
s8 oflc ;
s8 iarc_generic ;
s8 reserved [ 0x13 ] ;
2020-10-03 18:09:29 +01:00
} NacpRatingAge ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( NacpRatingAge , 0x20 ) ;
2020-10-03 18:09:29 +01:00
typedef enum {
NacpLogoType_LicensedByNintendo = 0 ,
NacpLogoType_DistributedByNintendo = 1 , ///< Removed.
2020-10-04 08:05:05 +01:00
NacpLogoType_Nintendo = 2 ,
2020-10-08 19:31:09 +01:00
NacpLogoType_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpLogoType ;
typedef enum {
NacpLogoHandling_Auto = 0 ,
2020-10-04 08:05:05 +01:00
NacpLogoHandling_Manual = 1 ,
2020-10-08 19:31:09 +01:00
NacpLogoHandling_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpLogoHandling ;
typedef enum {
NacpRuntimeAddOnContentInstall_Deny = 0 ,
NacpRuntimeAddOnContentInstall_AllowAppend = 1 ,
2020-10-04 08:05:05 +01:00
NacpRuntimeAddOnContentInstall_AllowAppendButDontDownloadWhenUsingNetwork = 2 ,
2020-10-08 19:31:09 +01:00
NacpRuntimeAddOnContentInstall_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpRuntimeAddOnContentInstall ;
typedef enum {
NacpRuntimeParameterDelivery_Always = 0 ,
NacpRuntimeParameterDelivery_AlwaysIfUserStateMatched = 1 ,
2020-10-04 08:05:05 +01:00
NacpRuntimeParameterDelivery_OnRestart = 2 ,
2020-10-08 19:31:09 +01:00
NacpRuntimeParameterDelivery_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpRuntimeParameterDelivery ;
2022-03-18 16:48:16 +00:00
typedef enum {
NacpAppropriateAgeForChina_None = 0 ,
NacpAppropriateAgeForChina_Age8 = 1 ,
NacpAppropriateAgeForChina_Age12 = 2 ,
NacpAppropriateAgeForChina_Age16 = 3 ,
NacpAppropriateAgeForChina_Count = 4 ///< Total values supported by this enum.
} NacpAppropriateAgeForChina ;
2021-09-26 22:59:41 +01:00
typedef enum {
NacpUndecidedParameter75b8b_A = 0 ,
NacpUndecidedParameter75b8b_B = 1 ,
NacpUndecidedParameter75b8b_Count = 2 ///< Total values supported by this enum.
} NacpUndecidedParameter75b8b ;
2020-10-03 18:09:29 +01:00
typedef enum {
NacpCrashReport_Deny = 0 ,
2020-10-04 08:05:05 +01:00
NacpCrashReport_Allow = 1 ,
2020-10-08 19:31:09 +01:00
NacpCrashReport_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpCrashReport ;
typedef enum {
NacpHdcp_None = 0 ,
2020-10-04 08:05:05 +01:00
NacpHdcp_Required = 1 ,
2020-10-08 19:31:09 +01:00
NacpHdcp_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpHdcp ;
2020-10-04 08:05:05 +01:00
typedef enum {
2023-07-17 00:03:05 +01:00
NacpStartupUserAccountOption_None = 0 ,
2020-10-08 19:31:09 +01:00
NacpStartupUserAccountOption_IsOptional = BIT ( 0 ) ,
NacpStartupUserAccountOption_Count = 1 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpStartupUserAccountOption ;
2022-03-18 16:48:16 +00:00
typedef enum {
NacpRuntimeUpgrade_Deny = 0 ,
NacpRuntimeUpgrade_Allow = 1 ,
NacpRuntimeUpgrade_Count = 2 ///< Total values supported by this enum.
} NacpRuntimeUpgrade ;
typedef enum {
2023-07-17 00:03:05 +01:00
NacpSupportingLimitedApplicationLicenses_None = 0 ,
2023-03-29 22:14:21 +01:00
NacpSupportingLimitedApplicationLicenses_Demo = BIT ( 0 ) ,
NacpSupportingLimitedApplicationLicenses_Count = 1 ///< Total values supported by this enum.
} NacpSupportingLimitedApplicationLicenses ;
2022-03-18 16:48:16 +00:00
2020-10-03 18:09:29 +01:00
typedef enum {
NacpPlayLogQueryCapability_None = 0 ,
NacpPlayLogQueryCapability_WhiteList = 1 ,
2020-10-04 08:05:05 +01:00
NacpPlayLogQueryCapability_All = 2 ,
2020-10-08 19:31:09 +01:00
NacpPlayLogQueryCapability_Count = 3 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpPlayLogQueryCapability ;
2020-10-04 08:05:05 +01:00
typedef enum {
2023-07-17 00:03:05 +01:00
NacpRepair_None = 0 ,
2020-10-08 19:31:09 +01:00
NacpRepair_SuppressGameCardAccess = BIT ( 0 ) ,
NacpRepair_Count = 1 ///< Total values supported by this enum.
2020-10-04 08:05:05 +01:00
} NacpRepair ;
typedef enum {
2023-07-17 00:03:05 +01:00
NacpRequiredNetworkServiceLicenseOnLaunch_None = 0 ,
2020-10-08 19:31:09 +01:00
NacpRequiredNetworkServiceLicenseOnLaunch_Common = BIT ( 0 ) ,
NacpRequiredNetworkServiceLicenseOnLaunch_Count = 1 ///< Total values supported by this enum.
2020-10-04 08:05:05 +01:00
} NacpRequiredNetworkServiceLicenseOnLaunch ;
2020-10-03 18:09:29 +01:00
typedef enum {
2023-07-17 00:03:05 +01:00
NacpJitConfigurationFlag_None = 0 ,
2023-07-10 17:06:34 +01:00
NacpJitConfigurationFlag_Enabled = BITL ( 0 ) ,
2022-03-18 16:48:16 +00:00
NacpJitConfigurationFlag_Count = 1 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpJitConfigurationFlag ;
typedef struct {
u64 jit_configuration_flag ; ///< NacpJitConfigurationFlag.
u64 memory_size ;
} NacpJitConfiguration ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( NacpJitConfiguration , 0x10 ) ;
2022-03-18 16:48:16 +00:00
typedef enum {
NacpRequiredAddOnContentsSetDescriptorFlag_None = 0 ,
2023-07-17 00:03:05 +01:00
NacpRequiredAddOnContentsSetDescriptorFlag_Continue = 1 ,
NacpRequiredAddOnContentsSetDescriptorFlag_Count = 2 ///< Total values supported by this enum.
2022-03-18 16:48:16 +00:00
} NacpRequiredAddOnContentsSetDescriptorFlag ;
2020-10-03 18:09:29 +01:00
typedef struct {
2022-03-18 16:48:16 +00:00
u16 index : 15 ;
u16 flag : 1 ; ///< NacpRequiredAddOnContentsSetDescriptorFlag.
} NacpRequiredAddOnContentsSetDescriptor ;
2020-10-03 18:09:29 +01:00
2022-03-18 16:48:16 +00:00
NXDT_ASSERT ( NacpRequiredAddOnContentsSetDescriptor , 0x2 ) ;
2021-03-24 17:25:19 +00:00
2020-10-03 18:09:29 +01:00
typedef struct {
2022-03-18 16:48:16 +00:00
NacpRequiredAddOnContentsSetDescriptor descriptors [ 0x20 ] ;
2020-10-03 18:09:29 +01:00
} NacpRequiredAddOnContentsSetBinaryDescriptor ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( NacpRequiredAddOnContentsSetBinaryDescriptor , 0x40 ) ;
2020-10-03 18:09:29 +01:00
typedef enum {
2023-07-17 00:03:05 +01:00
NacpPlayReportPermission_None = 0 ,
2022-03-18 16:48:16 +00:00
NacpPlayReportPermission_TargetMarketing = BIT ( 0 ) ,
NacpPlayReportPermission_Count = 1 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpPlayReportPermission ;
typedef enum {
NacpCrashScreenshotForProd_Deny = 0 ,
2020-10-04 08:05:05 +01:00
NacpCrashScreenshotForProd_Allow = 1 ,
2020-10-08 19:31:09 +01:00
NacpCrashScreenshotForProd_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpCrashScreenshotForProd ;
typedef enum {
NacpCrashScreenshotForDev_Deny = 0 ,
2020-10-04 08:05:05 +01:00
NacpCrashScreenshotForDev_Allow = 1 ,
2020-10-08 19:31:09 +01:00
NacpCrashScreenshotForDev_Count = 2 ///< Total values supported by this enum.
2020-10-03 18:09:29 +01:00
} NacpCrashScreenshotForDev ;
2022-03-18 16:48:16 +00:00
typedef enum {
NacpContentsAvailabilityTransitionPolicy_NoPolicy = 0 ,
NacpContentsAvailabilityTransitionPolicy_Stable = 1 ,
NacpContentsAvailabilityTransitionPolicy_Changeable = 2 ,
NacpContentsAvailabilityTransitionPolicy_Count = 3 , ///< Total values supported by this enum.
2022-07-05 02:04:28 +01:00
2022-03-18 16:48:16 +00:00
// Old.
NacpContentsAvailabilityTransitionPolicy_Legacy = NacpContentsAvailabilityTransitionPolicy_NoPolicy
} NacpContentsAvailabilityTransitionPolicy ;
2020-10-06 16:41:26 +01:00
typedef struct {
u64 application_id [ 8 ] ;
} NacpAccessibleLaunchRequiredVersion ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( NacpAccessibleLaunchRequiredVersion , 0x40 ) ;
2020-10-03 18:09:29 +01:00
typedef struct {
NacpTitle title [ 0x10 ] ;
char isbn [ 0x25 ] ;
u8 startup_user_account ; ///< NacpStartupUserAccount.
2022-03-18 16:48:16 +00:00
u8 user_account_switch_lock ; ///< NacpUserAccountSwitchLock.
2020-10-03 18:09:29 +01:00
u8 add_on_content_registration_type ; ///< NacpAddOnContentRegistrationType.
2020-10-08 19:31:09 +01:00
u32 attribute ; ///< NacpAttribute.
u32 supported_language ; ///< NacpSupportedLanguage.
u32 parental_control ; ///< NacpParentalControl.
2020-10-03 18:09:29 +01:00
u8 screenshot ; ///< NacpScreenshot.
u8 video_capture ; ///< NacpVideoCapture.
u8 data_loss_confirmation ; ///< NacpDataLossConfirmation.
u8 play_log_policy ; ///< NacpPlayLogPolicy.
u64 presence_group_id ;
NacpRatingAge rating_age ;
char display_version [ 0x10 ] ;
u64 add_on_content_base_id ;
u64 save_data_owner_id ;
2020-10-28 22:48:46 +00:00
s64 user_account_save_data_size ;
s64 user_account_save_data_journal_size ;
s64 device_save_data_size ;
s64 device_save_data_journal_size ;
s64 bcat_delivery_cache_storage_size ;
2020-10-03 18:09:29 +01:00
char application_error_code_category [ 0x8 ] ;
2022-06-24 01:22:01 +01:00
u64 local_communication_id [ 0x8 ] ;
2020-10-03 18:09:29 +01:00
u8 logo_type ; ///< NacpLogoType.
u8 logo_handling ; ///< NacpLogoHandling.
u8 runtime_add_on_content_install ; ///< NacpRuntimeAddOnContentInstall.
u8 runtime_parameter_delivery ; ///< NacpRuntimeParameterDelivery.
2022-03-18 16:48:16 +00:00
u8 appropriate_age_for_china ; ///< NacpAppropriateAgeForChina.
2021-12-01 17:35:19 +00:00
u8 undecided_parameter_75b8b ; ///< NacpUndecidedParameter75b8b.
2020-10-03 18:09:29 +01:00
u8 crash_report ; ///< NacpCrashReport.
u8 hdcp ; ///< NacpHdcp.
u64 seed_for_pseudo_device_id ;
char bcat_passphrase [ 0x41 ] ;
2020-10-08 19:31:09 +01:00
u8 startup_user_account_option ; ///< NacpStartupUserAccountOption.
2022-03-18 16:48:16 +00:00
u8 reserved_for_user_account_save_data_operation [ 0x6 ] ;
2020-10-28 22:48:46 +00:00
s64 user_account_save_data_size_max ;
s64 user_account_save_data_journal_size_max ;
s64 device_save_data_size_max ;
s64 device_save_data_journal_size_max ;
s64 temporary_storage_size ;
s64 cache_storage_size ;
s64 cache_storage_journal_size ;
s64 cache_storage_data_and_journal_size_max ;
2020-10-03 18:09:29 +01:00
u16 cache_storage_index_max ;
2022-06-24 01:22:01 +01:00
u8 reserved_1 ;
2022-03-18 16:48:16 +00:00
u8 runtime_upgrade ; ///< NacpRuntimeUpgrade.
2023-03-29 22:14:21 +01:00
u32 supporting_limited_application_licenses ; ///< NacpSupportingLimitedApplicationLicenses.
2020-10-03 18:09:29 +01:00
u64 play_log_queryable_application_id [ 0x10 ] ;
u8 play_log_query_capability ; ///< NacpPlayLogQueryCapability.
2020-10-08 19:31:09 +01:00
u8 repair ; ///< NacpRepair.
2020-10-03 18:09:29 +01:00
u8 program_index ;
2020-10-08 19:31:09 +01:00
u8 required_network_service_license_on_launch ; ///< NacpRequiredNetworkServiceLicenseOnLaunch.
2022-03-18 16:48:16 +00:00
u8 reserved_2 [ 0x4 ] ;
2020-10-03 18:09:29 +01:00
NacpNeighborDetectionClientConfiguration neighbor_detection_client_configuration ;
NacpJitConfiguration jit_configuration ;
NacpRequiredAddOnContentsSetBinaryDescriptor required_add_on_contents_set_binary_descriptor ;
u8 play_report_permission ; ///< NacpPlayReportPermission.
u8 crash_screenshot_for_prod ; ///< NacpCrashScreenshotForProd.
u8 crash_screenshot_for_dev ; ///< NacpCrashScreenshotForDev.
2022-03-18 16:48:16 +00:00
u8 contents_availability_transition_policy ; ///< NacpContentsAvailabilityTransitionPolicy.
u8 reserved_3 [ 0x4 ] ;
2020-10-06 16:41:26 +01:00
NacpAccessibleLaunchRequiredVersion accessible_launch_required_version ;
2022-03-18 16:48:16 +00:00
u8 reserved_4 [ 0xBB8 ] ;
2020-10-03 18:09:29 +01:00
} _NacpStruct ;
2021-03-24 17:25:19 +00:00
NXDT_ASSERT ( _NacpStruct , 0x4000 ) ;
2020-10-03 18:09:29 +01:00
typedef struct {
u8 language ; ///< NacpLanguage.
u64 icon_size ; ///< JPG icon size. Must not exceed NACP_MAX_ICON_SIZE.
u8 * icon_data ; ///< Pointer to a dynamically allocated buffer that holds the JPG icon data.
} NacpIconContext ;
typedef struct {
NcaContext * nca_ctx ; ///< Pointer to the NCA context for the Control NCA from which NACP data is retrieved.
RomFileSystemContext romfs_ctx ; ///< RomFileSystemContext for the Control NCA FS section #0, which is where the NACP is stored.
RomFileSystemFileEntry * romfs_file_entry ; ///< RomFileSystemFileEntry for the NACP in the Control NCA FS section #0. Used to generate a RomFileSystemFileEntryPatch if needed.
RomFileSystemFileEntryPatch nca_patch ; ///< RomFileSystemFileEntryPatch generated if NACP modifications are needed. Used to seamlessly replace Control NCA data while writing it.
///< Bear in mind that generating a patch modifies the NCA context.
_NacpStruct * data ; ///< Pointer to a dynamically allocated buffer that holds the full NACP.
u8 data_hash [ SHA256_HASH_SIZE ] ; ///< SHA-256 checksum calculated over the whole NACP. Used to determine if NcaHierarchicalSha256Patch generation is truly needed.
2020-10-04 08:05:05 +01:00
u8 icon_count ; ///< NACP icon count. May be zero if no icons are available.
2020-10-03 18:09:29 +01:00
NacpIconContext * icon_ctx ; ///< Pointer to a dynamically allocated buffer that holds 'icon_count' NACP icon contexts. May be NULL if no icons are available.
2022-07-05 02:04:28 +01:00
char * authoring_tool_xml ; ///< Pointer to a dynamically allocated, NULL-terminated buffer that holds AuthoringTool-like XML data.
2020-10-03 18:09:29 +01:00
///< This is always NULL unless nacpGenerateAuthoringToolXml() is used on this NacpContext.
u64 authoring_tool_xml_size ; ///< Size for the AuthoringTool-like XML. This is essentially the same as using strlen() on 'authoring_tool_xml'.
///< This is always 0 unless nacpGenerateAuthoringToolXml() is used on this NacpContext.
} NacpContext ;
/// Initializes a NacpContext using a previously initialized NcaContext (which must belong to a Control NCA).
bool nacpInitializeContext ( NacpContext * out , NcaContext * nca_ctx ) ;
2020-10-28 22:48:46 +00:00
/// Changes flags in the NACP from the input NacpContext and generates a RomFS file entry patch if needed.
/// If 'patch_sua' is true, StartupUserAccount is set to None, the IsOptional bit in StartupUserAccountOption is cleared and UserAccountSwitchLock is set to Disable.
/// If 'patch_screenshot' is true, Screenshot is set to Allow.
/// If 'patch_video_capture' is true, VideoCapture is set to Enable.
2021-06-01 02:12:15 +01:00
/// If 'patch_hdcp' is true, Hdcp is set to None.
bool nacpGenerateNcaPatch ( NacpContext * nacp_ctx , bool patch_sua , bool patch_screenshot , bool patch_video_capture , bool patch_hdcp ) ;
2020-10-28 22:48:46 +00:00
/// Writes data from the RomFS file entry patch in the input NacpContext to the provided buffer.
void nacpWriteNcaPatch ( NacpContext * nacp_ctx , void * buf , u64 buf_size , u64 buf_offset ) ;
2020-10-06 16:41:26 +01:00
/// Generates an AuthoringTool-like XML using information from a previously initialized NacpContext, as well as the Application/Patch version and the required system version.
2020-10-03 18:09:29 +01:00
/// If the function succeeds, XML data and size will get saved to the 'authoring_tool_xml' and 'authoring_tool_xml_size' members from the NacpContext.
2020-10-06 16:41:26 +01:00
bool nacpGenerateAuthoringToolXml ( NacpContext * nacp_ctx , u32 version , u32 required_system_version ) ;
2020-10-03 18:09:29 +01:00
2020-10-08 19:31:09 +01:00
/// These functions return pointers to string representations of the input flag/value index (e.g. nacpGetLanguageString(NacpLanguage_AmericanEnglish) -> "AmericanEnglish").
/// If the input flag/value index is invalid, "Unknown" will be returned.
2022-03-18 16:48:16 +00:00
/// If dealing with a bitflag field such as:
/// * NacpAttribute
/// * NacpSupportedLanguage
/// * NacpParentalControl
/// * NacpStartupUserAccountOption
/// * NacpRepair
/// Then, the provided value must be a 0-based index to the desired flag and not a bitmask from its enum (e.g. NacpAttribute_RetailInteractiveDisplay -> use 1 instead).
2021-02-13 06:09:18 +00:00
const char * nacpGetLanguageString ( u8 language ) ; /// Can also be used for NacpSupportedLanguage flags with values from the NacpLanguage enum.
2020-10-03 18:09:29 +01:00
const char * nacpGetStartupUserAccountString ( u8 startup_user_account ) ;
const char * nacpGetUserAccountSwitchLockString ( u8 user_account_switch_lock ) ;
const char * nacpGetAddOnContentRegistrationTypeString ( u8 add_on_content_registration_type ) ;
const char * nacpGetAttributeString ( u8 attribute ) ;
const char * nacpGetParentalControlString ( u8 parental_control ) ;
const char * nacpGetScreenshotString ( u8 screenshot ) ;
const char * nacpGetVideoCaptureString ( u8 video_capture ) ;
const char * nacpGetDataLossConfirmationString ( u8 data_loss_confirmation ) ;
const char * nacpGetPlayLogPolicyString ( u8 play_log_policy ) ;
const char * nacpGetRatingAgeOrganizationString ( u8 rating_age_organization ) ;
2020-10-04 08:05:05 +01:00
const char * nacpGetLogoTypeString ( u8 logo_type ) ;
const char * nacpGetLogoHandlingString ( u8 logo_handling ) ;
const char * nacpGetRuntimeAddOnContentInstallString ( u8 runtime_add_on_content_install ) ;
const char * nacpGetRuntimeParameterDeliveryString ( u8 runtime_parameter_delivery ) ;
2022-03-18 16:48:16 +00:00
const char * nacpGetAppropriateAgeForChina ( u8 appropriate_age_for_china ) ;
2021-09-26 22:59:41 +01:00
const char * nacpGetUndecidedParameter75b8bString ( u8 undecided_parameter_75b8b ) ;
2020-10-04 08:05:05 +01:00
const char * nacpGetCrashReportString ( u8 crash_report ) ;
const char * nacpGetHdcpString ( u8 hdcp ) ;
const char * nacpGetStartupUserAccountOptionString ( u8 startup_user_account_option ) ;
2022-03-18 16:48:16 +00:00
const char * nacpGetRuntimeUpgradeString ( u8 runtime_upgrade ) ;
2020-10-06 16:41:26 +01:00
const char * nacpGetPlayLogQueryCapabilityString ( u8 play_log_query_capability ) ;
2020-10-04 08:05:05 +01:00
const char * nacpGetRepairString ( u8 repair ) ;
const char * nacpGetRequiredNetworkServiceLicenseOnLaunchString ( u8 required_network_service_license_on_launch ) ;
const char * nacpGetCrashScreenshotForProdString ( u8 crash_screenshot_for_prod ) ;
const char * nacpGetCrashScreenshotForDevString ( u8 crash_screenshot_for_dev ) ;
2022-03-18 16:48:16 +00:00
const char * nacpGetContentsAvailabilityTransitionPolicyString ( u8 contents_availability_transition_policy ) ;
2020-10-03 18:09:29 +01:00
/// Helper inline functions.
NX_INLINE void nacpFreeContext ( NacpContext * nacp_ctx )
{
if ( ! nacp_ctx ) return ;
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
romfsFreeContext ( & ( nacp_ctx - > romfs_ctx ) ) ;
romfsFreeFileEntryPatch ( & ( nacp_ctx - > nca_patch ) ) ;
if ( nacp_ctx - > data ) free ( nacp_ctx - > data ) ;
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
if ( nacp_ctx - > icon_ctx )
{
2020-10-04 08:05:05 +01:00
for ( u8 i = 0 ; i < nacp_ctx - > icon_count ; i + + )
2020-10-03 18:09:29 +01:00
{
if ( nacp_ctx - > icon_ctx [ i ] . icon_data ) free ( nacp_ctx - > icon_ctx [ i ] . icon_data ) ;
}
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
free ( nacp_ctx - > icon_ctx ) ;
}
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
if ( nacp_ctx - > authoring_tool_xml ) free ( nacp_ctx - > authoring_tool_xml ) ;
memset ( nacp_ctx , 0 , sizeof ( NacpContext ) ) ;
}
NX_INLINE bool nacpIsValidIconContext ( NacpIconContext * icon_ctx )
{
return ( icon_ctx & & icon_ctx - > language < NacpLanguage_Count & & icon_ctx - > icon_size & & icon_ctx - > icon_data ) ;
}
NX_INLINE bool nacpIsValidContext ( NacpContext * nacp_ctx )
{
if ( ! nacp_ctx | | ! nacp_ctx - > nca_ctx | | ! nacp_ctx - > romfs_file_entry | | ! nacp_ctx - > data | | ( ! nacp_ctx - > icon_count & & nacp_ctx - > icon_ctx ) | | ( nacp_ctx - > icon_count & & ! nacp_ctx - > icon_ctx ) ) return false ;
2022-07-05 02:04:28 +01:00
2020-10-04 08:05:05 +01:00
for ( u8 i = 0 ; i < nacp_ctx - > icon_count ; i + + )
2020-10-03 18:09:29 +01:00
{
if ( ! nacpIsValidIconContext ( & ( nacp_ctx - > icon_ctx [ i ] ) ) ) return false ;
}
2022-07-05 02:04:28 +01:00
2020-10-03 18:09:29 +01:00
return true ;
}
2021-03-23 14:06:52 +00:00
# ifdef __cplusplus
}
2021-03-24 17:25:19 +00:00
# endif
# endif /* __NACP_H__ */