/*---------------------------------------------------------------------------* Project: Cafe File: sysapp.h Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __SYSAPP_H__ #define __SYSAPP_H__ #include #include #include #ifdef __cplusplus extern "C" { #endif /// @addtogroup pub Public /// @{ //=============================================================================== /** * A common, standard argument passed when making application jumps. */ typedef struct SysStandardArgsIn { /** Make an application jump, and upon returning from that jump, specify the data that can be obtained with SYSGetArguments. * Use this data to determine the sequence of the jump and return. */ const char * cp_Anchor; /** Specify the size of the data block specified above. (Maximum: 4096 bytes) */ u32 anchorSize; } SysStandardArgsIn; /*---------------------------------------------------------------------------*/ /** * A standard argument that can be obtained when making application jumps. */ typedef struct SysStandardArgs { const char * cp_Anchor; // Pointer to data used to determine which application control returned after returning from an application jump. u32 anchorSize; // char * p_Result; // Pointer to data that is passed from the application that was jumped to after returning from an application jump. u32 resultSize; // } SysStandardArgs; //=============================================================================== /* * browser */ /*---------------------------------------------------------------------------*/ /** ** An argument passed when starting the browser. */ typedef struct SysBrowserArgsIn { SysStandardArgsIn stdIn; ///< A common, standard argument. /** Specifies a pointer to the URL string. * The URL must be a NULL-terminated string that starts with either http:// or https://. * The maximum length, including the scheme at the beginning, is 1023 characters (not including the NULL terminator). * If you are including characters that cannot be used in the URI, percent-encode them beforehand. */ const char * cp_URL; /** Specifies the size of the URL string. Specify a size that includes a string terminator. */ u32 urlSize; } SysBrowserArgsIn; /*---------------------------------------------------------------------------*/ /** * Switch to the browser. * * @param[in] cp_Args Specifies a pointer to the argument structure to pass to the browser. If 0 is specified, it simply jumps to the browser. * * @retval 0 Indicates success. * @retval -40000 Indicates that anchorSize is too big. Specify 0. * @retval -50000 Indicates that urlSize is too big. Specify 1024 or less. */ s32 SYSSwitchToBrowser( const SysBrowserArgsIn *cp_Args ); /*---------------------------------------------------------------------------*/ /** * An argument passed when starting the browser. A callback URL can be specified. */ typedef struct SysBrowserArgsInForCallbackURL { SysStandardArgsIn stdIn; ///< A common, standard argument. /** Specifies a pointer to the URL string. * The URL must be a NULL-terminated string that starts with either http:// or https://. * The maximum length, including the scheme at the beginning, is 1023 characters (not including the NULL terminator). * If you are including characters that cannot be used in the URI, percent-encode them beforehand. */ const char * cp_URL; /** Specifies the size of the URL string. Specify a size that includes a string terminator. */ u32 urlSize; /** Specifies a pointer to the callback URL string. */ const char * cp_CallbackURL; /** Specifies the size of the callback URL string. Specify a size that includes a string terminator. */ u32 callbackUrlSize; /** This flag indicates whether to prohibit the HOME Button menu in the browser. */ BOOL hbmDisable; } SysBrowserArgsInForCallbackURL; /*---------------------------------------------------------------------------*/ /** * Switch to the browser. * * @param[in] cp_Args Specifies a pointer to the argument structure to pass to the browser. If 0 is specified, it simply jumps to the browser. * * @retval 0 Indicates success. * @retval -40000 Indicates that anchorSize is too big. Specify 0. * @retval -50000 Indicates that urlSize is too big. Specify 1024 or less. */ s32 SYSSwitchToBrowserForCallbackURL( const SysBrowserArgsInForCallbackURL *cp_Args ); //=============================================================================== /* * EManual */ /*---------------------------------------------------------------------------*/ /** * Switches to the e-manual. */ s32 SYSSwitchToEManual( void ); //=============================================================================== /** * account */ /*---------------------------------------------------------------------------*/ /** An argument passed when starting the account management screen. */ typedef struct SysAccountArgsIn { SysStandardArgsIn stdIn; ///< A common, standard argument. /** Specifies the slot number you want to change. */ u32 slotId; } SysAccountArgsIn; /*---------------------------------------------------------------------------*/ /** * Starts the account management application. * (The application exits.) * @retval 0 Indicates success. * @retval -100000 Indicates a fatal error. * @retval -40000 Indicates that anchorSize is too big. Specify 0. */ s32 SYSLaunchAccount( const SysAccountArgsIn * cp_Args ); //=============================================================================== /** * settings */ /*---------------------------------------------------------------------------*/ /** */ typedef enum SysSettingsJumpTo { SYS_SETTINGS_JUMP_TO_TOP = 0, ///< Top screen. SYS_SETTINGS_JUMP_TO_INTERNET, ///< Internet settings. SYS_SETTINGS_JUMP_TO_DATA_MANAGE, ///< Data management screen. SYS_SETTINGS_JUMP_TO_TV_REMOTE, ///< TV remote control settings screen. SYS_SETTINGS_JUMP_TO_DATE_TIME, ///< Time and date management screen. SYS_SETTINGS_JUMP_TO_COUNTRY, ///< Country settings screen. SYS_SETTINGS_JUMP_TO_UPDATE, ///< System update screen. } SysSettingsJumpTo; /*---------------------------------------------------------------------------*/ /** */ typedef struct SysSettingsArgsIn { SysStandardArgsIn stdIn; ///< A common, standard argument. SysSettingsJumpTo jumpTo; ///< Specifies the jump destination. } SysSettingsArgsIn; /*---------------------------------------------------------------------------*/ /** * Starts System Settings. * (The application exits.) * @retval 0 Indicates success. * @retval -100000 Indicates a fatal error. * @retval -40000 Indicates that anchorSize is too big. Specify 0. */ s32 SYSLaunchSettings( const SysSettingsArgsIn * cp_Args ); /*---------------------------------------------------------------------------*/ /** * Starts the Launcher. * (The application exits.) * @retval 0 Indicates success. * @retval -100000 Indicates a fatal error. */ s32 SYSLaunchMenu( void ); /*---------------------------------------------------------------------------*/ /** * Jumps to the Wii Remote pairing screen in the HOME Button menu. * @retval 0 Indicates success. * @retval -100000 Indicates a fatal error. */ s32 SYSSwitchToSyncControllerOnHBM( void ); //=============================================================================== /* * vod */ /*---------------------------------------------------------------------------*/ /** * A structure for getting arguments for Video On Demand (VOD) applications. */ typedef struct SysVodArgs { SysStandardArgs std; ///< A common, standard argument. const char * cp_URL; ///< Contains the URL string for the VOD application. u32 urlSize; ///< The size of the URL string. } SysVodArgs; /*---------------------------------------------------------------------------*/ /** * Gets the VOD application arguments. * * Call this function right after starting the application and when returning from the HOME Button menu to get the arguments. * @retval 1 Specifies that there are no arguments. * @retval 0 Indicates success. * @retval -100000 Specifies that a fatal error occurred. (NULL is specified in an argument.) */ s32 SYSGetVodArgs( SysVodArgs *p_Args ); /*---------------------------------------------------------------------------*/ /** * Restarts itself. * * @retval 0 Indicates success. * @retval -100000 Specifies that a fatal error occurred. (NULL is specified in an argument.) */ s32 SYSRelaunchTitle( u32 argc, char * pa_Argv[] ); /*---------------------------------------------------------------------------*/ /** * Type representing arguments that are passed when jumping. */ typedef enum SysArgType { SYS_ARG_TYPE_NODATA = 0, SYS_ARG_TYPE_U32, SYS_ARG_TYPE_U64, SYS_ARG_TYPE_DATA_BLOCK, SYS_ARG_TYPE_CONST_DATA_BLOCK, SYS_ARG_TYPE_NUM } SysArgType; /*---------------------------------------------------------------------------*/ /** * IDs of arguments that are passed when jumping. */ typedef enum SysArgID { SYS_ARG_ID_TERMINATOR = 0, ///< Specify the last element in the array. SYS_ARG_ID_ANCHOR = 100, ///< The ID of the anchor argument. SYS_ARG_ID_RESULT, ///< The ID of the result argument. SYS_ARG_ID_VOD_URL = 200, ///< The ID of the URL argument for the video on demand application. SYS_ARG_ID_MIIVERSE_DATA = 300, ///< The ID of the Miiverse argument. SYS_ARG_ID_JOIN_PID = 400 ///< The ID of the join-in argument. } SysArgID; /*---------------------------------------------------------------------------*/ /** * */ typedef struct SysArgBase { SysArgID id; SysArgType type; } SysArgBase; /*---------------------------------------------------------------------------*/ /** * Stores data of type u32. */ typedef struct SysArgU32 { SysArgBase base; u32 value; } SysArgU32; /*---------------------------------------------------------------------------*/ /** * Stores data of type u64. */ typedef struct SysArgU64 { SysArgBase base; u64 value; } SysArgU64; /*---------------------------------------------------------------------------*/ /** * Stores a data block. */ typedef struct SysArgDataBlock { SysArgBase base; char * p_Data; u32 dataSize; } SysArgDataBlock; /*---------------------------------------------------------------------------*/ /** * Stores a data block. */ typedef struct SysArgConstDataBlock { SysArgBase base; const char * cp_Data; u32 dataSize; } SysArgConstDataBlock; /*---------------------------------------------------------------------------*/ /** * */ typedef union SysArgSlot { SysArgBase _base; SysArgU32 _u32; SysArgU64 _u64; SysArgDataBlock _blk; SysArgConstDataBlock _cblk; } SysArgSlot; /*---------------------------------------------------------------------------*/ /** * Enumerates callers. */ typedef enum SysCallerType { SYS_CALLER_TYPE_INVALID = -1, SYS_CALLER_TYPE_LAUNCHER = 2, SYS_CALLER_TYPE_TVII = 3, SYS_CALLER_TYPE_HBM = 5, SYS_CALLER_TYPE_MINI_MIIVERSE = 7, SYS_CALLER_TYPE_MIIVERSE = 9, SYS_CALLER_TYPE_FRIEND_LIST = 11, SYS_CALLER_TYPE_GAME = 15, SYS_CALLER_TYPE_END } SysCallerType; /*---------------------------------------------------------------------------*/ /** * */ typedef struct SysCallerData { SysCallerType type; u64 titleId; } SysCallerData; /*---------------------------------------------------------------------------*/ /** * This is a generic function for retrieving arguments. * * @param[in,out] ap_SysArgSlot Specifies a pointer to an array of SysArgSlot unions. * @param[out] p_Caller Specifies a pointer to the SysCallerData structure that stores information on the application jump origin. * * @retval 0 Indicates success. * @retval 1 Finished normally, but there were no retrievable arguments. * @retval <0 Indicates a program error. Zero was passed to an argument. * * Prepare an array of SysArgSlot elements and set the IDs of the arguments to retrieve. * Be sure to set SYS_ARG_ID_TERMINATOR in the last element of the array. * * If the function succeeds, information on the jump origin is stored in the SysCallerData structure. * If the jump origin passes any arguments, the data is stored in the Slot with the corresponding ID. * If no arguments are passed, _base.type becomes SYS_ARG_TYPE_NODATA. * * First, use SysCallerData to determine where the jump is from, and then access the Slot that contains the argument. * */ s32 SYSGetArguments( SysArgSlot * ap_SysArgSlot, SysCallerData * p_Caller ); /*---------------------------------------------------------------------------*/ /** * */ typedef enum SysCheckableSystemApplicationID { SYS_CHECK_ID_EMANUAL = 4, SYS_CHECK_ID_MINI_MIIVERSE = 7, SYS_CHECK_ID_BROWSER = 8, SYS_CHECK_ID_MIIVERSE = 9, SYS_CHECK_ID_ESHOP = 10, SYS_CHECK_ID_END } SysCheckableSystemApplicationID; /*---------------------------------------------------------------------------*/ /** * Function that checks whether the specified system application is installed on the development hardware. * * @attention This is used for debugging purposes only. */ BOOL SYSCheckSystemApplicationExists( SysCheckableSystemApplicationID id ); /*---------------------------------------------------------------------------*/ /* */ #define SYS_ERROR_NO_ARGS (1) ///< The return value when no arguments could be retrieved. This value is returned when no arguments are passed from the jump origin. #define SYS_ERROR_NONE (0) ///< Normal end. #define SYS_ERROR_FATAL (-100000) ///< Fatal error. #define SYS_ERROR_SERIALIZE_ANCHOR_SIZE_MAX (-40000) ///< The anchor size is too large. #define SYS_ERROR_SERIALIZE_URL_SIZE_MAX (-50000) ///< The URL string is too large. #ifdef __cplusplus } #endif /// @} #endif // __SYSAPP_H__