1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: applet_Parameters.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_APPLET_CTR_APPLET_PARAMETERS_H_ 17 #define NN_APPLET_CTR_APPLET_PARAMETERS_H_ 18 19 #include <nn/fnd.h> 20 #include <nn/gx/CTR/gx_Lcd.h> 21 22 namespace nn{ 23 namespace applet{ 24 namespace CTR{ 25 26 enum Attribute 27 { 28 //Applet type 29 TYPE_APP = (0x0<<0), //000 Application 30 TYPE_APPLIB = (0x1<<0), //001 Library applet 31 TYPE_SYS = (0x2<<0), //010 System applet 32 TYPE_SYSLIB = (0x3<<0), //011 System library applet 33 TYPE_RESIDENT = (0x4<<0), //100 Resident applet 34 TYPE_MASK = (0x7<<0), //111 (Applet type mask) 35 36 //Setting GPU rights 37 MANUAL_GPU_RIGHT = (1<<3), // Assign/release manually 38 39 //Setting DSP rights 40 MANUAL_DSP_RIGHT = (1<<4) // Assign/release manually 41 }; 42 const bit32 DEFAULT_APPLET_ATTRIBUTE = (TYPE_APP); 43 44 enum DisplayBufferMode 45 { 46 FORMAT_R8G8B8A8 = 0, 47 FORMAT_R8G8B8 = 1, 48 FORMAT_R5G6B5 = 2, 49 FORMAT_R5G5B5A1 = 3, 50 FORAMT_R4G4B4A4 = 4, 51 FORMAT_UNIMPORTABLE = 0xFFFFFFFF 52 }; 53 54 /* Please see man pages for details 55 56 57 58 59 60 */ 61 enum HomeButtonState 62 { 63 HOME_BUTTON_NONE = 0, // 64 HOME_BUTTON_SINGLE_PRESSED = 1, // 65 HOME_BUTTON_DOUBLE_PRESSED = 2 // 66 }; 67 68 enum ShutdownState 69 { 70 SHUTDOWN_STATE_NONE = 0, // No shutdown notification has been received 71 SHUTDOWN_STATE_RECEIVED = 1 // A shutdown notification has been received 72 }; 73 74 enum PowerButtonState 75 { 76 POWER_BUTTON_STATE_NONE = 0, // Not pressed 77 POWER_BUTTON_STATE_CLICK = 1 // Clicked 78 }; 79 80 enum OrderToCloseState 81 { 82 ORDER_TO_CLOSE_STATE_NONE = 0, // No close request 83 ORDER_TO_CLOSE_STATE_RECEIVED = 1 // Close request received 84 }; 85 86 /* Please see man pages for details 87 88 89 90 */ 91 enum SleepNotificationState 92 { 93 NOTIFY_NONE = 0, // 94 NOTIFY_SLEEP_QUERY = 1, // 95 NOTIFY_SLEEP_ACCEPT = 2, // 96 NOTIFY_SLEEP_REJECT = 3, // 97 NOTIFY_SLEEP_ACCEPTED = 4, // 98 NOTIFY_AWAKE = 5 // 99 }; 100 101 enum AppJumpType 102 { 103 JUMP_OTHER = 0, // Jump to another application 104 JUMP_CALLER = 1, // Jump to the original caller 105 JUMP_SELF = 2 // Jump to self 106 }; 107 108 enum AppletPos 109 { 110 POS_APP = 0, // Application 111 POS_APPLIB = 1, // Library applet started by the application 112 POS_SYS = 2, // System 113 POS_SYSLIB = 3, // Library applet started by the library 114 POS_RESIDENT = 4, // Resident applet 115 POS_MAX, 116 117 POS_NONE = -1 // No position 118 }; 119 120 /* Please see man pages for details 121 122 123 124 */ 125 enum WakeupState 126 { 127 // Timeout 128 WAKEUP_BY_TIMEOUT = -1, // 129 130 //Went sleeping 131 WAKEUP_SKIP = 0, // 132 133 //Wake-up due to a regular request > The waking application resumes execution 134 WAKEUP_TO_START = 1, // 135 //Wake-up due to shutdown > The waking application resumes execution 136 WAKEUP_BY_EXIT = 2, // 137 // Wake-up due to interrupt > The waking application resumes execution 138 WAKEUP_BY_PAUSE = 3, // 139 //Wake-up due to cancel notification > The waking application exits. 140 WAKEUP_BY_CANCEL = 4, // 141 //Wake-up due to cancel notification > The waking application exits > Also make other applets/applications exit if necessary 142 WAKEUP_BY_CANCELALL = 5, // 143 // Wake-up due to POWER Button click > Jump to the sleep recommend screen, and the system menu is the only applet that could possibly wake up 144 WAKEUP_BY_POWER_BUTTON_CLICK = 6, // 145 //Wake-up in order to jump to the HOME Menu > The waking application executes JumpToHomeMenu(). 146 WAKEUP_TO_JUMP_HOME = 7, // 147 //Wake-up in order to jump to the application > The waking application executes LeaveHomeMenu(). 148 WAKEUP_TO_JUMP_APPLICATION = 8, // 149 //Wake-up to start application > The waking application executes StartApplication(). 150 WAKEUP_TO_LAUNCH_APPLICATION = 9, // 151 152 WAKEUP_STATE_MAX = 63 153 }; 154 155 /* Please see man pages for details 156 157 158 159 160 161 162 163 164 165 166 */ 167 168 enum QueryReply 169 { 170 REPLY_REJECT = 0, // 171 REPLY_ACCEPT = 1, // 172 REPLY_LATER = 2 // 173 }; 174 175 176 enum UsableAppletId 177 { 178 APPLET_ID_NONE = 0, // Unused Buttons 179 // 180 // application 181 APPLICATION_APPLET_ID = 0x300, // application 182 183 // library applet 184 APPLIB_APPLET_ID = 0x400, // library applet 185 186 // resident applet 187 ERRDISP_APPLET_ID = 0x501, // ERROR DISPLAY 188 189 APPLET_ID_MAX 190 }; 191 192 193 enum SleepCheckOnEnableSleep 194 { 195 SLEEP_IF_SHELL_CLOSED = true, 196 NO_SHELL_CHECK = false 197 }; 198 enum ReplyRejectOnDisableSleep 199 { 200 REPLY_REJECT_IF_LATER = true, 201 NO_REPLY_REJECT = false 202 }; 203 204 enum ParentalControlsScene 205 { 206 PARENTAL_CONTROLS_TOP = 0, 207 PARENTAL_CONTROLS_COPPACS = 1 208 }; 209 enum DataManagementScene 210 { 211 DATA_MANAGEMENT_TOP = 0, // Do not use this value. 212 DATA_MANAGEMENT_STREETPASS = 1 213 }; 214 215 enum MsetScene 216 { 217 MSET_INTERNET_SETTING_TOP = 110, 218 MSET_PARENTAL_CONTROLS_TOP = 111, 219 MSET_PARENTAL_CONTROLS_COPPACS = 112, 220 MSET_DATA_MANAGEMENT_TOP = 113, // Do not use this value. 221 MSET_DATA_MANAGEMENT_STREETPASS = 117, 222 223 MSET_SCENE_INVALID_VALUE = 0xFFFFFFFF 224 }; 225 226 /* Please see man pages for details 227 228 */ 229 typedef bit32 AppletId; 230 231 /* Please see man pages for details 232 233 */ 234 typedef bit32 AppletAttr; 235 236 typedef nn::applet::CTR::DisplayBufferMode AppletDisplayBufferMode; 237 238 typedef nn::applet::CTR::HomeButtonState AppletHomeButtonState; 239 240 typedef nn::applet::CTR::SleepNotificationState AppletSleepNotificationState; 241 242 typedef nn::applet::CTR::ShutdownState AppletShutdownState; 243 244 typedef nn::applet::CTR::PowerButtonState AppletPowerButtonState; 245 246 typedef nn::applet::CTR::OrderToCloseState AppletOrderToCloseState; 247 248 typedef nn::applet::CTR::WakeupState AppletWakeupState; 249 250 typedef nn::applet::CTR::QueryReply AppletQueryReply; 251 252 typedef nn::applet::CTR::AppJumpType AppletAppJumpType; 253 254 typedef nn::applet::CTR::ParentalControlsScene AppletParentalControlsScene; 255 256 typedef nn::applet::CTR::DataManagementScene AppletDataManagementScene; 257 258 typedef nn::applet::CTR::MsetScene AppletMsetScene; 259 260 // Invalid handle 261 extern const nn::Handle HANDLE_NONE; 262 263 // Time 264 /* Please see man pages for details 265 266 267 */ 268 const nn::fnd::TimeSpan WAIT_INFINITE = nn::fnd::TimeSpan::FromNanoSeconds((s64)-1); 269 /* Please see man pages for details 270 271 272 */ 273 const nn::fnd::TimeSpan NO_WAIT = 0; 274 275 // Invalid applet ID 276 const bit32 INVALID_ID = 0; 277 278 // Invalid program ID 279 const bit64 INVALID_PROGRAM_ID = 0xffffffffffffffffull; 280 281 // ----- Group of callbacks 282 /* Please see man pages for details 283 284 */ 285 typedef bool (*AppletHomeButtonCallback)( uptr arg, bool isActive, nn::applet::CTR::HomeButtonState state ); 286 /* Please see man pages for details 287 288 */ 289 typedef void (*AppletMessageCallback)( uptr arg, AppletId senderId, u8 pParam[], size_t paramSize, nn::Handle handle ); 290 291 // Memory request 292 typedef void (*AppletRequestMemoryCallback)( uptr arg, size_t size, nn::Handle* pHandle ); 293 // Finalize memory request 294 typedef void (*AppletReleaseMemoryCallback)( uptr arg ); 295 296 // DSP sleep 297 typedef void (*AppletDspSleepCallback)( uptr arg ); 298 // DSP wakeup 299 typedef void (*AppletDspWakeUpCallback)( uptr arg ); 300 301 /* Please see man pages for details 302 303 */ 304 typedef AppletQueryReply (*AppletSleepQueryCallback)( uptr arg ); 305 /* Please see man pages for details 306 307 */ 308 typedef void (*AppletSleepCanceledCallback)( uptr arg ); 309 /* Please see man pages for details 310 311 */ 312 typedef void (*AppletAwakeCallback)( uptr arg ); 313 314 /* Please see man pages for details 315 316 */ 317 typedef void (*AppletShutdownCallback)( uptr arg ); 318 /* Please see man pages for details 319 320 */ 321 typedef void (*AppletCloseAppletCallback)( uptr arg ); // Actually this is shared by all applets. 322 323 /* Please see man pages for details 324 325 */ 326 typedef void (*AppletPowerButtonCallback)( uptr arg ); 327 328 /* Please see man pages for details 329 330 */ 331 typedef void (*AppletTransitionCallback)( uptr arg ); 332 333 /* Please see man pages for details 334 335 */ 336 typedef void (*AppletCloseCallback)( uptr arg ); 337 338 } 339 } 340 } 341 342 /* Please see man pages for details 343 344 345 */ 346 #define NN_APPLET_PORT_NAME_USER "APT:U" // User Application 347 348 /* Please see man pages for details 349 350 */ 351 #define NN_APPLET_MAX_APPLET_NUM 5 352 353 #define NN_APPLET_PARAMETER_MAX 4096 // 354 #define NN_APPLET_PARAM_BUF_SIZE 768 355 #define NN_APPLET_HMAC_BUF_SIZE 32 356 357 // Includes padding so that the size (924KB) of the buffer used to store captured images can be used to store texture data. 358 #define NN_APPLET_CAPTURE_BUF_SIZE (256 * (NN_GX_DISPLAY0_HEIGHT + NN_GX_DISPLAY1_HEIGHT + 512) * 3) 359 360 // Attributes 361 #define NN_APPLET_TYPE_APP (nn::applet::CTR::TYPE_APP) 362 #define NN_APPLET_TYPE_APPLIB (nn::applet::CTR::TYPE_APPLIB) 363 #define NN_APPLET_TYPE_SYS (nn::applet::CTR::TYPE_SYS) 364 #define NN_APPLET_TYPE_SYSLIB (nn::applet::CTR::TYPE_SYSLIB) 365 #define NN_APPLET_TYPE_RESIDENT (nn::applet::CTR::TYPE_RESIDENT) 366 #define NN_APPLET_TYPE_MASK (nn::applet::CTR::TYPE_MASK) 367 368 #define NN_APPLET_MANUAL_GPU_RIGHT (nn::applet::CTR::MANUAL_GPU_RIGHT) 369 #define NN_APPLET_MANUAL_DSP_RIGHT (nn::applet::CTR::MANUAL_DSP_RIGHT) 370 371 // HOME Button 372 #define NN_APPLET_HOME_BUTTON_NONE (nn::applet::CTR::HOME_BUTTON_NONE) 373 #define NN_APPLET_HOME_BUTTON_SINGLE_PRESSED (nn::applet::CTR::HOME_BUTTON_SINGLE_PRESSED) 374 #define NN_APPLET_HOME_BUTTON_DOUBLE_PRESSED (nn::applet::CTR::HOME_BUTTON_DOUBLE_PRESSED) 375 376 // System notifications 377 #define NN_APPLET_NOTIFY_NONE (nn::applet::NOTIFY_NONE) 378 #define NN_APPLET_NOTIFY_SLEEP_QUERY (nn::applet::NOTIFY_SLEEP_QUERY) 379 #define NN_APPLET_NOTIFY_SLEEP_ACCEPT (nn::applet::NOTIFY_SLEEP_ACCEPT) 380 #define NN_APPLET_NOTIFY_SLEEP_REJECT (nn::applet::NOTIFY_SLEEP_REJECT) 381 #define NN_APPLET_NOTIFY_AWAKE (nn::applet::NOTIFY_AWAKE) 382 383 // Applet type 384 #define NN_APPLET_POS_SYSLIB (nn::applet::CTR::POS_SYSLIB) 385 #define NN_APPLET_POS_SYS (nn::applet::CTR::POS_SYS) 386 #define NN_APPLET_POS_APP (nn::applet::CTR::POS_APP) 387 #define NN_APPLET_POS_APPLIB (nn::applet::CTR::POS_APPLIB) 388 #define NN_APPLET_POS_RESIDENT (nn::applet::CTR::POS_RESIDENT) 389 #define NN_APPLET_POS_MAX (nn::applet::CTR::POS_MAX) 390 391 // Responses to sleep queries 392 #define NN_APPLET_REPLY_ACCEPT (nn::applet::REPLY_ACCEPT) 393 #define NN_APPLET_REPLY_REJECT (nn::applet::REPLY_REJECT) 394 #define NN_APPLET_REPLY_LATER (nn::applet::REPLY_LATER) 395 396 // 397 #define NN_APPLET_NO_PREPARATION (nn::applet::NO_PREPARATION) 398 #define NN_APPLET_PREPARED_TO_LAUNCH_APP (nn::applet::PREPARED_TO_LAUNCH_APP) 399 #define NN_APPLET_PREPARED_TO_CLOSE_APP (nn::applet::PREPARED_TO_CLOSE_APP) 400 #define NN_APPLET_PREPARED_TO_LAUNCH_APPLIB (nn::applet::PREPARED_TO_LAUNCH_APPLIB) 401 #define NN_APPLET_PREPARED_TO_CLOSE_APPLIB (nn::applet::PREPARED_TO_CLOSE_APPLIB) 402 #define NN_APPLET_PREPARED_TO_LAUNCH_SYS (nn::applet::PREPARED_TO_LAUNCH_SYS) 403 #define NN_APPLET_PREPARED_TO_CLOSE_SYS (nn::applet::PREPARED_TO_CLOSE_SYS) 404 #define NN_APPLET_PREPARED_TO_LAUNCH_SYSLIB (nn::applet::PREPARED_TO_LAUNCH_SYSLIB) 405 #define NN_APPLET_PREPARED_TO_CLOSE_SYSLIB (nn::applet::PREPARED_TO_CLOSE_SYSLIB) 406 #define NN_APPLET_PREPARED_TO_LAUNCH_RESIDENT (nn::applet::PREPARED_TO_LAUNCH_RESIDENT) 407 #define NN_APPLET_PREPARED_TO_LEAVE_RESIDENT (nn::applet::PREPARED_TO_LEAVE_RESIDENT) 408 #define NN_APPLET_PREPARED_TO_DO_HOMEMENU (nn::applet::PREPARED_TO_DO_HOMEMENU) 409 #define NN_APPLET_PREPARED_TO_LEAVE_HOMEMENU (nn::applet::PREPARED_TO_LEAVE_HOMEMENU) 410 411 // Applet ID 412 #define NN_APPLET_APPLICATION_APPLET_ID (nn::applet::CTR::APPLICATION_APPLET_ID) 413 #define NN_APPLET_ERRDISP_APPLET_ID (nn::applet::CTR::ERRDISP_APPLET_ID) 414 415 // Invalid handle 416 #define NN_APPLET_HANDLE_NONE (nn::applet::CTR::HANDLE_NONE) 417 418 // Time 419 #define NN_APPLET_WAIT_INFINITE (nn::applet::CTR::WAIT_INFINITE) 420 #define NN_APPLET_NO_WAIT (nn::applet::CTR::NO_WAIT) 421 422 // Invalid applet ID 423 #define NN_APPLET_INVALID_ID (nn::applet::CTR::INVALID_ID) 424 // Invalid program ID 425 #define NN_APPLET_INVALID_PROGRAM_ID (nn::applet::CTR::INVALID_PROGRAM_ID) 426 427 #define NN_APPLET_DEFAULT_APPLET_ATTRIBUTE (nn::applet::CTR::DEFAULT_APPLET_ATTRIBUTE) 428 429 /* 430 431 */ 432 433 434 using nn::applet::CTR::AppletId; 435 using nn::applet::CTR::AppletAttr; 436 437 using nn::applet::CTR::AppletHomeButtonState; 438 using nn::applet::CTR::AppletSleepNotificationState; 439 440 using nn::applet::CTR::AppletHomeButtonCallback; 441 using nn::applet::CTR::AppletMessageCallback; 442 using nn::applet::CTR::AppletRequestMemoryCallback; 443 using nn::applet::CTR::AppletReleaseMemoryCallback; 444 using nn::applet::CTR::AppletDspSleepCallback; 445 using nn::applet::CTR::AppletDspWakeUpCallback; 446 using nn::applet::CTR::AppletSleepQueryCallback; 447 using nn::applet::CTR::AppletSleepCanceledCallback; 448 using nn::applet::CTR::AppletAwakeCallback; 449 using nn::applet::CTR::AppletShutdownCallback; 450 using nn::applet::CTR::AppletCloseAppletCallback; 451 using nn::applet::CTR::AppletPowerButtonCallback; 452 453 using nn::applet::CTR::AppletWakeupState; 454 using nn::applet::CTR::AppletQueryReply; 455 456 457 #endif // ifndef NN_APPLET_CTR_APPLET_PARAMETERS_H_ 458