/*---------------------------------------------------------------------------* Project: Horizon File: applet_Parameters.h Copyright (C)2009 Nintendo Co., Ltd. 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. $Rev: 35614 $ *---------------------------------------------------------------------------*/ #ifndef NN_APPLET_CTR_APPLET_PARAMETERS_H_ #define NN_APPLET_CTR_APPLET_PARAMETERS_H_ #include #include namespace nn{ namespace applet{ namespace CTR{ enum Attribute { //---- Applet types TYPE_APP = (0x0<<0), //000 application TYPE_APPLIB = (0x1<<0), //001 Library applet TYPE_SYS = (0x2<<0), //010 System applet TYPE_SYSLIB = (0x3<<0), //011 System library applet TYPE_RESIDENT = (0x4<<0), //100 Static applet TYPE_MASK = (0x7<<0), //111 (Mask for applet types) //---- GPU rights settings MANUAL_GPU_RIGHT = (1<<3), // Manually perform Assign/Release //---- DSP rights settings MANUAL_DSP_RIGHT = (1<<4) // Manually perform Assign/Release }; const bit32 DEFAULT_APPLET_ATTRIBUTE = (TYPE_APP); enum DisplayBufferMode { FORMAT_R8G8B8A8 = 0, FORMAT_R8G8B8 = 1, FORMAT_R5G6B5 = 2, FORMAT_R5G5B5A1 = 3, FORAMT_R4G4B4A4 = 4, FORMAT_UNIMPORTABLE = 0xFFFFFFFF }; /* Please see man pages for details */ enum HomeButtonState { HOME_BUTTON_NONE = 0, // HOME_BUTTON_SINGLE_PRESSED = 1, // HOME_BUTTON_DOUBLE_PRESSED = 2 // }; enum ShutdownState { SHUTDOWN_STATE_NONE = 0, // Haven't received shutdown notification SHUTDOWN_STATE_RECEIVED = 1 // Received shutdown notification }; enum PowerButtonState { POWER_BUTTON_STATE_NONE = 0, // Not pressed POWER_BUTTON_STATE_CLICK = 1 // Click }; enum OrderToCloseState { ORDER_TO_CLOSE_STATE_NONE = 0, // No close order ORDER_TO_CLOSE_STATE_RECEIVED = 1 // Close order received }; /* Please see man pages for details */ enum SleepNotificationState { NOTIFY_NONE = 0, // NOTIFY_SLEEP_QUERY = 1, // NOTIFY_SLEEP_ACCEPT = 2, // NOTIFY_SLEEP_REJECT = 3, // NOTIFY_SLEEP_ACCEPTED = 4, // NOTIFY_AWAKE = 5 // }; enum AppJumpType { JUMP_OTHER = 0, // Jump to another application JUMP_CALLER = 1, // Jump to the caller JUMP_SELF = 2 // Jump to self }; enum AppletPos { POS_APP = 0, // Application POS_APPLIB = 1, // Library applet launched by the application POS_SYS = 2, // System POS_SYSLIB = 3, // Library applet launched by the system POS_RESIDENT = 4, // Static applet POS_MAX, POS_NONE = -1 // No definite position }; /* Please see man pages for details */ enum WakeupState { //Entered sleep WAKEUP_SKIP = 0, // //Woken by a normal request → The woken side starts operation WAKEUP_TO_START = 1, // //Terminated and woken → Woken side starts operation WAKEUP_BY_EXIT = 2, // // Paused and woken → Woken side starts operation WAKEUP_BY_PAUSE = 3, // //Woken up by cancel notification → Woken side terminates WAKEUP_BY_CANCEL = 4, // //Woken by cancel notification → Woken side terminates → Terminate others as needed WAKEUP_BY_CANCELALL = 5, // // Woken by Power button click → Only the system menu can be woken up. Transition to sleep recommended screen WAKEUP_BY_POWER_BUTTON_CLICK = 6, // //Woken for transition to HOME Menu→ The woken up side calls JumpToHomeMenu() WAKEUP_TO_JUMP_HOME = 7, // //Woken for transition to application → The woken side calls LeaveHomeMenu() WAKEUP_TO_JUMP_APPLICATION = 8, // //Woken to launch application → The woken side calls StartApplication() WAKEUP_TO_LAUNCH_APPLICATION = 9, // // Time out WAKEUP_BY_TIMEOUT = -1 // }; /* Please see man pages for details */ enum QueryReply { REPLY_REJECT = 0, // REPLY_ACCEPT = 1, // REPLY_LATER = 2 // }; enum UsableAppletId { APPLET_ID_NONE = 0, // Unused // // application APPLICATION_APPLET_ID = 0x300, // application // library applet APPLIB_APPLET_ID = 0x400, // Library applet // resident applet ERRDISP_APPLET_ID = 0x501, // ERROR DISPLAY APPLET_ID_MAX }; enum SleepCheckOnEnableSleep { SLEEP_IF_SHELL_CLOSED = true, NO_SHELL_CHECK = false }; enum ReplyRejectOnDisableSleep { REPLY_REJECT_IF_LATER = true, NO_REPLY_REJECT = false }; /* Please see man pages for details */ typedef bit32 AppletId; /* Please see man pages for details */ typedef bit32 AppletAttr; typedef nn::applet::CTR::DisplayBufferMode AppletDisplayBufferMode; typedef nn::applet::CTR::HomeButtonState AppletHomeButtonState; typedef nn::applet::CTR::SleepNotificationState AppletSleepNotificationState; typedef nn::applet::CTR::ShutdownState AppletShutdownState; typedef nn::applet::CTR::PowerButtonState AppletPowerButtonState; typedef nn::applet::CTR::OrderToCloseState AppletOrderToCloseState; typedef nn::applet::CTR::WakeupState AppletWakeupState; typedef nn::applet::CTR::QueryReply AppletQueryReply; typedef nn::applet::CTR::AppJumpType AppletAppJumpType; // Invalid handle extern const nn::Handle HANDLE_NONE; // Time /* Please see man pages for details */ extern const nn::fnd::TimeSpan WAIT_INFINITE; /* Please see man pages for details */ extern const nn::fnd::TimeSpan NO_WAIT; // Invalid applet ID const bit32 INVALID_ID = 0; // Invalid program ID const bit64 INVALID_PROGRAM_ID = 0xffffffffffffffffull; // ----- Callbacks /* Please see man pages for details */ typedef bool (*AppletHomeButtonCallback)( uptr arg, bool isActive, nn::applet::CTR::HomeButtonState state ); /* Please see man pages for details */ typedef void (*AppletMessageCallback)( uptr arg, AppletId senderId, u8 pParam[], size_t paramSize, nn::Handle handle ); // Memory request typedef void (*AppletRequestMemoryCallback)( uptr arg, size_t size, nn::Handle* pHandle ); // Finalize memory request typedef void (*AppletReleaseMemoryCallback)( uptr arg ); // DSP sleep typedef void (*AppletDspSleepCallback)( uptr arg ); // DSP wakeup typedef void (*AppletDspWakeUpCallback)( uptr arg ); /* Please see man pages for details */ typedef AppletQueryReply (*AppletSleepQueryCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletSleepCanceledCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletAwakeCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletShutdownCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletCloseAppletCallback)( uptr arg ); // This is actually common to all applets /* Please see man pages for details */ typedef void (*AppletPowerButtonCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletTransitionCallback)( uptr arg ); /* Please see man pages for details */ typedef void (*AppletCloseCallback)( uptr arg ); } } } /* Please see man pages for details */ #define NN_APPLET_PORT_NAME_USER "APT:U" // User Application /* Please see man pages for details */ #define NN_APPLET_MAX_APPLET_NUM 5 #define NN_APPLET_PARAMETER_MAX 4096 // #define NN_APPLET_PARAM_BUF_SIZE 768 #define NN_APPLET_HMAC_BUF_SIZE 32 // The size of the buffer (924 KB) that stores the capture image includes padding so that it can be used as texture data. #define NN_APPLET_CAPTURE_BUF_SIZE (256 * (NN_GX_DISPLAY0_HEIGHT + NN_GX_DISPLAY1_HEIGHT + 512) * 3) // Attribute #define NN_APPLET_TYPE_APP (nn::applet::CTR::TYPE_APP) #define NN_APPLET_TYPE_APPLIB (nn::applet::CTR::TYPE_APPLIB) #define NN_APPLET_TYPE_SYS (nn::applet::CTR::TYPE_SYS) #define NN_APPLET_TYPE_SYSLIB (nn::applet::CTR::TYPE_SYSLIB) #define NN_APPLET_TYPE_RESIDENT (nn::applet::CTR::TYPE_RESIDENT) #define NN_APPLET_TYPE_MASK (nn::applet::CTR::TYPE_MASK) #define NN_APPLET_MANUAL_GPU_RIGHT (nn::applet::CTR::MANUAL_GPU_RIGHT) #define NN_APPLET_MANUAL_DSP_RIGHT (nn::applet::CTR::MANUAL_DSP_RIGHT) // HOME Button #define NN_APPLET_HOME_BUTTON_NONE (nn::applet::CTR::HOME_BUTTON_NONE) #define NN_APPLET_HOME_BUTTON_SINGLE_PRESSED (nn::applet::CTR::HOME_BUTTON_SINGLE_PRESSED) #define NN_APPLET_HOME_BUTTON_DOUBLE_PRESSED (nn::applet::CTR::HOME_BUTTON_DOUBLE_PRESSED) // System application notification #define NN_APPLET_NOTIFY_NONE (nn::applet::NOTIFY_NONE) #define NN_APPLET_NOTIFY_SLEEP_QUERY (nn::applet::NOTIFY_SLEEP_QUERY) #define NN_APPLET_NOTIFY_SLEEP_ACCEPT (nn::applet::NOTIFY_SLEEP_ACCEPT) #define NN_APPLET_NOTIFY_SLEEP_REJECT (nn::applet::NOTIFY_SLEEP_REJECT) #define NN_APPLET_NOTIFY_AWAKE (nn::applet::NOTIFY_AWAKE) // Applet type #define NN_APPLET_POS_SYSLIB (nn::applet::CTR::POS_SYSLIB) #define NN_APPLET_POS_SYS (nn::applet::CTR::POS_SYS) #define NN_APPLET_POS_APP (nn::applet::CTR::POS_APP) #define NN_APPLET_POS_APPLIB (nn::applet::CTR::POS_APPLIB) #define NN_APPLET_POS_RESIDENT (nn::applet::CTR::POS_RESIDENT) #define NN_APPLET_POS_MAX (nn::applet::CTR::POS_MAX) // Sleep request response #define NN_APPLET_REPLY_ACCEPT (nn::applet::REPLY_ACCEPT) #define NN_APPLET_REPLY_REJECT (nn::applet::REPLY_REJECT) #define NN_APPLET_REPLY_LATER (nn::applet::REPLY_LATER) // #define NN_APPLET_NO_PREPARATION (nn::applet::NO_PREPARATION) #define NN_APPLET_PREPARED_TO_LAUNCH_APP (nn::applet::PREPARED_TO_LAUNCH_APP) #define NN_APPLET_PREPARED_TO_CLOSE_APP (nn::applet::PREPARED_TO_CLOSE_APP) #define NN_APPLET_PREPARED_TO_LAUNCH_APPLIB (nn::applet::PREPARED_TO_LAUNCH_APPLIB) #define NN_APPLET_PREPARED_TO_CLOSE_APPLIB (nn::applet::PREPARED_TO_CLOSE_APPLIB) #define NN_APPLET_PREPARED_TO_LAUNCH_SYS (nn::applet::PREPARED_TO_LAUNCH_SYS) #define NN_APPLET_PREPARED_TO_CLOSE_SYS (nn::applet::PREPARED_TO_CLOSE_SYS) #define NN_APPLET_PREPARED_TO_LAUNCH_SYSLIB (nn::applet::PREPARED_TO_LAUNCH_SYSLIB) #define NN_APPLET_PREPARED_TO_CLOSE_SYSLIB (nn::applet::PREPARED_TO_CLOSE_SYSLIB) #define NN_APPLET_PREPARED_TO_LAUNCH_RESIDENT (nn::applet::PREPARED_TO_LAUNCH_RESIDENT) #define NN_APPLET_PREPARED_TO_LEAVE_RESIDENT (nn::applet::PREPARED_TO_LEAVE_RESIDENT) #define NN_APPLET_PREPARED_TO_DO_HOMEMENU (nn::applet::PREPARED_TO_DO_HOMEMENU) #define NN_APPLET_PREPARED_TO_LEAVE_HOMEMENU (nn::applet::PREPARED_TO_LEAVE_HOMEMENU) // Applet ID #define NN_APPLET_APPLICATION_APPLET_ID (nn::applet::CTR::APPLICATION_APPLET_ID) #define NN_APPLET_ERRDISP_APPLET_ID (nn::applet::CTR::ERRDISP_APPLET_ID) // Invalid handle #define NN_APPLET_HANDLE_NONE (nn::applet::CTR::HANDLE_NONE) // Time #define NN_APPLET_WAIT_INFINITE (nn::applet::CTR::WAIT_INFINITE) #define NN_APPLET_NO_WAIT (nn::applet::CTR::NO_WAIT) // Invalid applet ID #define NN_APPLET_INVALID_ID (nn::applet::CTR::INVALID_ID) // Invalid program ID #define NN_APPLET_INVALID_PROGRAM_ID (nn::applet::CTR::INVALID_PROGRAM_ID) #define NN_APPLET_DEFAULT_APPLET_ATTRIBUTE (nn::applet::CTR::DEFAULT_APPLET_ATTRIBUTE) /* */ using nn::applet::CTR::AppletId; using nn::applet::CTR::AppletAttr; using nn::applet::CTR::AppletHomeButtonState; using nn::applet::CTR::AppletSleepNotificationState; using nn::applet::CTR::AppletHomeButtonCallback; using nn::applet::CTR::AppletMessageCallback; using nn::applet::CTR::AppletRequestMemoryCallback; using nn::applet::CTR::AppletReleaseMemoryCallback; using nn::applet::CTR::AppletDspSleepCallback; using nn::applet::CTR::AppletDspWakeUpCallback; using nn::applet::CTR::AppletSleepQueryCallback; using nn::applet::CTR::AppletSleepCanceledCallback; using nn::applet::CTR::AppletAwakeCallback; using nn::applet::CTR::AppletShutdownCallback; using nn::applet::CTR::AppletCloseAppletCallback; using nn::applet::CTR::AppletPowerButtonCallback; using nn::applet::CTR::AppletWakeupState; using nn::applet::CTR::AppletQueryReply; #endif // ifndef NN_APPLET_CTR_APPLET_PARAMETERS_H_