1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     applet_API.h
4 
5   Copyright (C)2010 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: 38552 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_APPLET_CTR_APPLET_API_H_
17 #define NN_APPLET_CTR_APPLET_API_H_
18 
19 #include <nn/os.h>
20 #include <nn/applet/CTR/applet_Parameters.h>
21 
22 #include <nn/gx.h>
23 #include <nn/hid.h>
24 #include <nn/fs/fs_Parameters.h>
25 
26 /* Please see man pages for details
27 
28 */
29 namespace nn {
30 namespace applet {
31 namespace CTR {
32 namespace detail {
33 
34     using namespace nn::applet::CTR;
35 
36     //----Initialization and termination
37     Result Initialize( AppletAttr appletAttr = DEFAULT_APPLET_ATTRIBUTE );
38     void   Enable(bool isSleepEnabled=true);
39 
40     void   Lock(void);
41     bool   TryLock( nn::fnd::TimeSpan timeout=NO_WAIT);
42     void   Unlock(void);
43 
44     int    CountRegisteredApplet(void);
45     bool   IsRegistered( AppletId appletId );
46     bool   WaitForRegister( AppletId appletId, nn::fnd::TimeSpan span );
47     bool   IsActive(void);
48     void   SetActive(void);
49     void   SetInactive(void);
50     nn::Result SaveVramSysArea(void);
51     nn::Result RestoreVramSysArea(void);
52 
53     //================
54     // GPU rights
55     void   AssignGpuRight( bool flag=true );
ReleaseGpuRight(void)56     inline void ReleaseGpuRight(void)
57     {
58         AssignGpuRight(false);
59     }
60     bool   IsGpuRightGiven(void);
61 
62     //================
63     // DSP rights
64     void   AssignDspRight( bool flag = true );
ReleaseDspRight(void)65     inline void ReleaseDspRight( void )
66     {
67         AssignDspRight(false);
68     }
69     //================
70     // Camera launch control
71     void   AssignCameraRight( bool flag = true );
ReleaseCameraRight(void)72     inline void ReleaseCameraRight( void )
73     {
74         AssignCameraRight(false);
75     }
76 
77     //================
78     // Attach sharedMemory
79     void AttachTransferMemoryHandle( os::TransferMemoryBlock* transferMemory, nn::Handle handle, size_t size, bit32 otherPermission );
80 
81     //================
82     // Send user message to applet
83     Result SendMessage( AppletId receiverId, const u8* pParam, size_t paramSize, nn::Handle handle=NN_APPLET_HANDLE_NONE, nn::fnd::TimeSpan timeout=WAIT_INFINITE );
84     Result TrySendMessage( AppletId receiverId, const u8* pParam, size_t paramSize, nn::Handle handle=NN_APPLET_HANDLE_NONE );
85 
86 
87     //================
88     // HOME Button state
89     AppletHomeButtonState GetAbsoluteHomeButtonState(void);
90     void ClearAbsoluteHomeButtonState(void);
91 
92     // Shutdown notification state
93     AppletShutdownState GetShutdownState(void);
94     void ClearShutdownState(void);
95 
96     // Power button click notification
97     AppletPowerButtonState GetPowerButtonState(void);
98     void ClearPowerButtonState(void);
99 
100     // Termination request
101     AppletOrderToCloseState GetOrderToCloseState(void);
102     void ClearOrderToCloseState(void);
103 
104     //================
105     // Preload library applet
106     Result PreloadLibraryApplet( AppletId id );
107 
108     // Launch library applet
109     Result PrepareToStartLibraryApplet( AppletId id );
110     Result StartLibraryApplet( AppletId id, const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE );
111 
112     // Cancel launch
113     Result CancelLibraryApplet( bool isApplicationEnd=false );
114     Result CancelLibraryAppletIfRegistered( bool isApplicationEnd=false, AppletWakeupState *pWakeupState=NULL );
115 
116     // Quit the application
117     Result PrepareToCloseApplication( bool isCancelPreload=false );
118     Result CloseApplication( const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE );
119 
120     // Prepare transition to HOME Menu
121     Result PrepareToJumpToHomeMenu(void);
122     Result JumpToHomeMenu( const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE );
123 
124     // Application jump
125     Result PrepareToJumpToOtherApplication( ProgramId programId, nn::fs::MediaType mediaType=nn::fs::MEDIA_TYPE_NAND );
126     Result PrepareToJumpToCallerApplication(void);
127     Result PrepareToJumpToSelfApplication(void);
128     Result JumpToOtherApplication(  const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize );
129     Result JumpToOtherApplication(  const u8 pParam[], const u8 pHmacBuf[] );
130     Result JumpToCallerApplication( const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize );
131     Result JumpToCallerApplication( const u8 pParam[], const u8 pHmacBuf[] );
132     Result JumpToSelfApplication(   const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize );
133     Result JumpToSelfApplication(   const u8 pParam[], const u8 pHmacBuf[] );
134 
135     //================
136     // Receive arguments
137     bool ReceiveDeliverArg( u8 pParam[], size_t paramSize, u8 pHmacBuf[], size_t hmacBufSize, bit32* pUniqueId );
138     bool ReceiveDeliverArg( u8 pParam[], u8 pHmacBuf[], bit32* pUniqueId );
139     AppletWakeupState GetInitialWakeupState(void);
140     bool GetInitialParam( AppletId* pSenderId, u8* pParam, size_t paramSize, s32* pReadSize );
141 
142     //================
143     Result GetSharedFont(Handle* pHandle, uptr* pAddr);
144     Result GetWirelessRebootInfo(u8* pInfo, size_t size);
145     Result Wrap(void* pWrappedBuffer, const void* pData, size_t dataSize, s32 idOffset, size_t idSize);
146     Result Unwrap(void* pData, const void* pWrapped, size_t wrappedSize, s32 idOffset, size_t idSize);
147 }
148 }
149 }
150 }
151 
152 namespace nn {
153 namespace applet {
154 namespace CTR {
155 
156     using namespace nn::applet::CTR;
157 
158     //================================================================
159     // Initialization
160     //================================================================
161     /* Please see man pages for details
162 
163 
164      */
165     /* Please see man pages for details
166 
167 
168 
169 
170      */
171     inline Result Initialize(AppletAttr appletAttr = NN_APPLET_DEFAULT_APPLET_ATTRIBUTE )
172     {
173         return detail::Initialize( appletAttr );
174     }
175     /* Please see man pages for details
176 
177 
178 
179 
180      */
181     inline void Enable(bool isSleepEnabled=true)
182     {
183         detail::Enable(isSleepEnabled);
184     }
185     /*
186 
187 */
188 
189     //================================================================
190     // Mutex
191     //================================================================
192     /* Please see man pages for details
193 
194 
195      */
196     /* Please see man pages for details
197 
198      */
Lock(void)199     inline void Lock(void)
200     {
201         detail::Lock();
202     }
203 
204     /* Please see man pages for details
205 
206 
207 
208 
209 
210 
211 
212 
213      */
214     inline bool TryLock(nn::fnd::TimeSpan timeout = NN_APPLET_NO_WAIT)
215     {
216         return detail::TryLock(timeout);
217     }
218 
219     /* Please see man pages for details
220 
221      */
Unlock(void)222     inline void Unlock(void)
223     {
224         detail::Unlock();
225     }
226     /*
227 
228 */
229 
230     //================================================================
231     // Get Information
232     //================================================================
233     /* Please see man pages for details
234 
235 
236      */
237     /* Please see man pages for details
238 
239 
240 
241 
242 
243     */
ReceiveDeliverArg(u8 pParam[],size_t paramSize,u8 pHmacBuf[],size_t hmacBufSize,bit32 * pUniqueId)244     inline bool ReceiveDeliverArg( u8 pParam[], size_t paramSize, u8 pHmacBuf[], size_t hmacBufSize, bit32* pUniqueId )
245     {
246         return detail::ReceiveDeliverArg( pParam, paramSize, pHmacBuf, hmacBufSize, pUniqueId );
247     }
ReceiveDeliverArg(u8 pParam[],u8 pHmacBuf[],bit32 * pUniqueId)248     inline bool ReceiveDeliverArg( u8 pParam[], u8 pHmacBuf[], bit32* pUniqueId )
249     {
250         return detail::ReceiveDeliverArg( pParam, pHmacBuf, pUniqueId );
251     }
252 
253     /* Please see man pages for details
254 
255 
256     */
GetInitialWakeupState(void)257     inline AppletWakeupState GetInitialWakeupState(void)
258     {
259         return detail::GetInitialWakeupState();
260     }
261 
262     // Get initialization arguments.
263     // (Not yet used)
GetInitialParam(AppletId * pSenderId,u8 * pParam,size_t paramSize,s32 * pReadSize)264     inline bool GetInitialParam( AppletId* pSenderId, u8* pParam, size_t paramSize, s32* pReadSize )
265     {
266         return detail::GetInitialParam( pSenderId, pParam, paramSize, pReadSize );
267     }
268 
269 
270     /* Please see man pages for details
271 
272 
273 
274 
275 
276      */
CountRegisteredApplet(void)277     inline int CountRegisteredApplet(void)
278     {
279         return detail::CountRegisteredApplet();
280     }
281 
282     /* Please see man pages for details
283 
284 
285 
286      */
IsRegistered(AppletId appletId)287     inline bool IsRegistered( AppletId appletId )
288     {
289         return detail::IsRegistered( appletId );
290     }
291 
292     /* Please see man pages for details
293 
294 
295      */
IsActive(void)296     inline bool IsActive(void)
297     {
298         return detail::IsActive();
299     }
300 
301     /* Please see man pages for details
302 
303 
304 
305      */
SetActive(void)306     inline void SetActive(void)
307     {
308         detail::SetActive();
309     }
310 
311     /* Please see man pages for details
312 
313 
314 
315     */
SetInactive(void)316     inline void SetInactive(void)
317     {
318         detail::SetInactive();
319     }
320 
321     /* Please see man pages for details
322 
323 
324 
325      */
326     bool IsInitialized();
327 
328     /* Please see man pages for details
329 
330 
331 
332 
333      */
334     AppletId   GetId(void);
335 
336     /* Please see man pages for details
337 
338 
339 
340 
341 
342      */
343     AppletAttr GetAttribute(void);
344     /*
345 
346 */
347 
348     // :private
349     AppletAttr GetAppletType(void);
350 
351     //================================================================
352     // Operation control
353     //================================================================
354     /* Please see man pages for details
355 
356 
357      */
358     /* Please see man pages for details
359 
360 
361 
362 
363      */
364     inline bool WaitForRegister( AppletId appletId, nn::fnd::TimeSpan span = NN_APPLET_WAIT_INFINITE )
365     {
366         return detail::WaitForRegister( appletId, span );
367     }
368 
369     //================================================================
370     // Render rights
371     //================================================================
372     /* Please see man pages for details
373 
374 
375      */
376     /* Please see man pages for details
377 
378 
379 
380      */
IsGpuRightGiven(void)381     inline bool IsGpuRightGiven(void)
382     {
383         return detail::IsGpuRightGiven();
384     }
385 
386     /* Please see man pages for details
387 
388 
389      */
390     inline void AssignGpuRight( bool flag = true )
391     {
392         detail::AssignGpuRight(flag);
393     }
394 
395     /* Please see man pages for details
396 
397      */
ReleaseGpuRight(void)398     inline void ReleaseGpuRight(void)
399     {
400         detail::AssignGpuRight(false);
401     }
402     /*
403 
404 */
405 
406     //================================================================
407     // DSP usage rights
408     //================================================================
409     /* Please see man pages for details
410 
411 
412      */
413     /* Please see man pages for details
414 
415 
416 
417 
418 
419 
420 
421      */
422     inline void AssignDspRight( bool flag = true )
423     {
424         detail::AssignDspRight(flag);
425     }
426 
427     /* Please see man pages for details
428 
429 
430 
431 
432 
433      */
ReleaseDspRight(void)434     inline void ReleaseDspRight( void )
435     {
436         detail::AssignDspRight(false);
437     }
438     /*
439 
440 */
441 
442     /* Please see man pages for details
443 
444 
445 
446 
447 
448      */
AttachTransferMemoryHandle(os::TransferMemoryBlock * transferMemory,nn::Handle handle,size_t size,bit32 otherPermission)449     inline void AttachTransferMemoryHandle( os::TransferMemoryBlock* transferMemory, nn::Handle handle, size_t size, bit32 otherPermission )
450     {
451         detail::AttachTransferMemoryHandle( transferMemory, handle, size, otherPermission );
452     }
453 
454     //================================================================
455     // Camera launch control
456     //================================================================
457     /* Please see man pages for details
458 
459 
460      */
461     /* Please see man pages for details
462 
463      */
464     inline void AssignCameraRight( bool flag = true )
465     {
466         detail::AssignCameraRight(flag);
467     }
468 
469     /* Please see man pages for details
470 
471      */
ReleaseCameraRight(void)472     inline void ReleaseCameraRight( void )
473     {
474         detail::AssignCameraRight(false);
475     }
476     /*
477 
478 */
479 
480     //================================================================
481     // Message
482     //================================================================
483     /* Please see man pages for details
484 
485 
486      */
487     /* Please see man pages for details
488 
489 
490 
491 
492 
493 
494 
495      */
496     inline Result SendMessage( AppletId receiverId, const u8* pParam, size_t paramSize, nn::Handle handle=NN_APPLET_HANDLE_NONE, nn::fnd::TimeSpan timeout=WAIT_INFINITE )
497     {
498         return detail::SendMessage( receiverId, pParam, paramSize, handle, timeout );
499     }
500 
501     /* Please see man pages for details
502 
503 
504 
505 
506 
507 
508      */
509     inline Result TrySendMessage( AppletId receiverId, const u8* pParam, size_t paramSize, nn::Handle handle=NN_APPLET_HANDLE_NONE )
510     {
511         return detail::TrySendMessage( receiverId, pParam, paramSize, handle );
512     }
513     /*
514 
515 */
516 
517     /* Please see man pages for details
518 
519 
520 
521 
522 
523 
524      */
GetAbsoluteHomeButtonState(void)525     inline AppletHomeButtonState GetAbsoluteHomeButtonState(void)
526     {
527         return detail::GetAbsoluteHomeButtonState();
528     }
529     /* Please see man pages for details
530 
531 
532 
533      */
ClearAbsoluteHomeButtonState(void)534     inline void ClearAbsoluteHomeButtonState(void)
535     {
536         return detail::ClearAbsoluteHomeButtonState();
537     }
538 
539     //================================================================
540     // shutdown
541     //================================================================
542     /* Please see man pages for details
543 
544 
545      */
546     /* Please see man pages for details
547 
548 
549      */
GetShutdownState(void)550     inline AppletShutdownState GetShutdownState(void)
551     {
552         return detail::GetShutdownState();
553     }
554 
555     /* Please see man pages for details
556 
557      */
ClearShutdownState(void)558     inline void ClearShutdownState(void)
559     {
560         detail::ClearShutdownState();
561     }
562     /*
563 
564 */
565 
566     //================================================================
567     // Power Button
568     //================================================================
569     /* Please see man pages for details
570 
571 
572      */
573     /* Please see man pages for details
574 
575 
576 
577 
578 
579 
580 
581 
582      */
GetPowerButtonState(void)583     inline AppletPowerButtonState GetPowerButtonState(void)
584     {
585         return detail::GetPowerButtonState();
586     }
587 
588     /* Please see man pages for details
589 
590      */
ClearPowerButtonState(void)591     inline void ClearPowerButtonState(void)
592     {
593         detail::ClearPowerButtonState();
594     }
595 
596     bool IsReceivedWakeupByCancel(void);
597 
598     /* Please see man pages for details
599 
600 
601 
602      */
IsExpectedToProcessPowerButton(void)603     inline bool IsExpectedToProcessPowerButton(void)
604     {
605         return ( GetPowerButtonState() != POWER_BUTTON_STATE_NONE )? true: false;
606     }
607     /*
608 
609 */
610 
611     //================================================================
612     // Termination request
613     //================================================================
GetOrderToCloseState(void)614     inline AppletOrderToCloseState GetOrderToCloseState(void)
615     {
616         return detail::GetOrderToCloseState();
617     }
ClearOrderToCloseState(void)618     inline void ClearOrderToCloseState(void)
619     {
620         detail::ClearOrderToCloseState();
621     }
622 
623     /* Please see man pages for details
624 
625 
626      */
627     /* Please see man pages for details
628 
629 
630 
631      */
IsExpectedToCloseApplication(void)632     inline bool IsExpectedToCloseApplication(void)
633     {
634         return ( GetOrderToCloseState() != ORDER_TO_CLOSE_STATE_NONE ||
635                  IsReceivedWakeupByCancel() )? true: false;
636     }
637 
638     //================================================================
639     // Preload and terminate library applet
640     //================================================================
641     /* Please see man pages for details
642 
643 
644      */
645     /* Please see man pages for details
646 
647 
648 
649 
650 
651 
652 
653 
654 
655      */
PreloadLibraryApplet(AppletId id)656     inline Result PreloadLibraryApplet( AppletId id )
657     {
658         return detail::PreloadLibraryApplet(id);
659     }
660     /*
661 
662 */
663 
664     /* Please see man pages for details
665 
666 
667 
668 
669 
670 
671 
672 
673      */
674     inline Result CancelLibraryAppletIfRegistered( bool isApplicationEnd, AppletWakeupState *pWakeupState=NULL )
675     {
676         return detail::CancelLibraryAppletIfRegistered( isApplicationEnd, pWakeupState );
677     }
678     /*
679 
680 */
681 
682     //================================================================
683     // Library applet/launch
684     //================================================================
685     /* Please see man pages for details
686 
687 
688      */
689     /* Please see man pages for details
690 
691 
692 
693 
694 
695 
696 
697 
698 
699 
700      */
PrepareToStartLibraryApplet(AppletId id)701     inline Result PrepareToStartLibraryApplet( AppletId id )
702     {
703         return detail::PrepareToStartLibraryApplet(id);
704     }
705 
706     /* Please see man pages for details
707 
708 
709 
710 
711 
712 
713 
714 
715 
716 
717 
718 
719 
720 
721 
722      */
723     inline Result StartLibraryApplet( AppletId id, const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE )
724     {
725         return detail::StartLibraryApplet(id, pParam, paramSize, handle);
726     }
727 
728     /*
729 
730 */
731 
732     //================================================================
733     // Quit the application
734     //================================================================
735     /* Please see man pages for details
736 
737 
738      */
739     /* Please see man pages for details
740 
741 
742 
743      */
PrepareToCloseApplication(void)744     inline Result PrepareToCloseApplication(void)
745     {
746         return detail::PrepareToCloseApplication();
747     }
748 
749     /* Please see man pages for details
750 
751 
752 
753 
754 
755 
756      */
757     inline Result CloseApplication( const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE )
758     {
759         return detail::CloseApplication( pParam, paramSize, handle );
760     }
761     /*
762 
763 */
764 
765     // Obsolete function.
PrepareToClosePreloadedApplication(void)766     inline Result PrepareToClosePreloadedApplication(void)
767     {
768         return detail::PrepareToCloseApplication( true );
769     }
770     inline Result ClosePreloadedApplication( const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE )
771     {
772         return detail::CloseApplication( pParam, paramSize, handle );
773     }
774 
775     //================================================================
776     // Home menu
777     //================================================================
778     /* Please see man pages for details
779 
780 
781      */
782     /* Please see man pages for details
783 
784 
785 
786 
787 
788 
789 
790      */
PrepareToJumpToHomeMenu(void)791     inline Result PrepareToJumpToHomeMenu(void)
792     {
793         return detail::PrepareToJumpToHomeMenu();
794     }
795 
796     /* Please see man pages for details
797 
798 
799 
800 
801 
802 
803 
804 
805 
806 
807 
808 
809      */
810     inline Result JumpToHomeMenu( const u8* pParam=NULL, size_t paramSize=0, Handle handle=NN_APPLET_HANDLE_NONE )
811     {
812         return detail::JumpToHomeMenu( pParam, paramSize, handle );
813     }
814     /*
815 
816 */
817 
818     //================================================================
819     // Application jump
820     //================================================================
821     /* Please see man pages for details
822 
823 
824      */
825     inline Result PrepareToJumpToOtherApplication( ProgramId programId, nn::fs::MediaType mediaType=nn::fs::MEDIA_TYPE_NAND )
826     {
827         return detail::PrepareToJumpToOtherApplication( programId, mediaType );
828     }
PrepareToJumpToCallerApplication(void)829     inline Result PrepareToJumpToCallerApplication(void)
830     {
831         return detail::PrepareToJumpToCallerApplication();
832     }
PrepareToJumpToSelfApplication(void)833     inline Result PrepareToJumpToSelfApplication(void)
834     {
835         return detail::PrepareToJumpToSelfApplication();
836     }
837     /* Please see man pages for details
838 
839 
840 
841 
842      */
JumpToOtherApplication(const u8 pParam[],size_t paramSize,const u8 pHmacBuf[],size_t hmacBufSize)843     inline Result JumpToOtherApplication( const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize )
844     {
845         return detail::JumpToOtherApplication( pParam, paramSize, pHmacBuf, hmacBufSize );
846     }
847     inline Result JumpToOtherApplication( const u8 pParam[]=NULL, const u8 pHmacBuf[]=NULL )
848     {
849         return detail::JumpToOtherApplication( pParam, pHmacBuf );
850     }
851     /* Please see man pages for details
852 
853 
854 
855 
856      */
JumpToCallerApplication(const u8 pParam[],size_t paramSize,const u8 pHmacBuf[],size_t hmacBufSize)857     inline Result JumpToCallerApplication( const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize )
858     {
859         return detail::JumpToCallerApplication( pParam, paramSize, pHmacBuf, hmacBufSize );
860     }
861     inline Result JumpToCallerApplication( const u8 pParam[]=NULL, const u8 pHmacBuf[]=NULL )
862     {
863         return detail::JumpToCallerApplication( pParam, pHmacBuf );
864     }
865     /* Please see man pages for details
866 
867 
868 
869 
870 
871 
872 
873 
874      */
JumpToSelfApplication(const u8 pParam[],size_t paramSize,const u8 pHmacBuf[],size_t hmacBufSize)875     inline Result JumpToSelfApplication( const u8 pParam[], size_t paramSize, const u8 pHmacBuf[], size_t hmacBufSize )
876     {
877         return detail::JumpToSelfApplication( pParam, paramSize, pHmacBuf, hmacBufSize );
878     }
879     inline Result JumpToSelfApplication( const u8 pParam[]=NULL, const u8 pHmacBuf[]=NULL )
880     {
881         return detail::JumpToSelfApplication( pParam, pHmacBuf );
882     }
883     /*
884 
885 */
886 
887     //================================================================
888     // non-public
889     //================================================================
890     /* Please see man pages for details
891 
892 
893      */
SaveVramSysArea(void)894     inline nn::Result SaveVramSysArea(void)
895     {
896         return detail::SaveVramSysArea();
897     }
898 
899     /* Please see man pages for details
900 
901 
902      */
RestoreVramSysArea(void)903     inline nn::Result RestoreVramSysArea(void)
904     {
905         return detail::RestoreVramSysArea();
906     }
907     /*
908 
909 */
910 
911     /* Please see man pages for details
912 
913 
914      */
915     bool IsApplicationExisting( u32 titleCode, u32 flag );
916 }
917 }
918 }
919 
920 /* Please see man pages for details
921 
922 
923 
924 
925 
926 */
927 
928 #include <nn/util/detail/util_CLibImpl.h>
929 
930 
931 /* Please see man pages for details
932 
933 
934 
935 */
936 NN_EXTERN_C inline nn::Result nnappletInitialize( AppletAttr appletAttr = NN_APPLET_DEFAULT_APPLET_ATTRIBUTE)
937 {
938     return nn::applet::CTR::Initialize(appletAttr);
939 }
940 /* Please see man pages for details
941 
942 
943 
944 */
nnappletLock(void)945 NN_EXTERN_C inline void nnappletLock(void)
946 {
947     nn::applet::CTR::Lock();
948 }
949 /* Please see man pages for details
950 
951 
952 
953 */
954 NN_EXTERN_C inline bool nnappletTryLock(nn::fnd::TimeSpan timeout=NN_APPLET_NO_WAIT)
955 {
956     return nn::applet::CTR::TryLock(timeout);
957 }
958 /* Please see man pages for details
959 
960 
961 
962 */
nnappletUnlock(void)963 NN_EXTERN_C inline void nnappletUnlock(void)
964 {
965     nn::applet::CTR::Unlock();
966 }
967 
968 //----------------------------------------------------------------
969 /* Please see man pages for details
970 
971 
972 
973 */
nnappletCountRegisteredApplet(void)974 NN_EXTERN_C inline int nnappletCountRegisteredApplet(void)
975 {
976     return nn::applet::CTR::CountRegisteredApplet();
977 }
978 /* Please see man pages for details
979 
980 
981 
982 */
nnappletIsRegistered(AppletId appletId)983 NN_EXTERN_C inline bool nnappletIsRegistered( AppletId appletId )
984 {
985     return nn::applet::CTR::IsRegistered( appletId );
986 }
987 
988 NN_EXTERN_C inline bool nnappletWaitForRegister( AppletId appletId, nn::fnd::TimeSpan span=NN_APPLET_WAIT_INFINITE )
989 {
990     return nn::applet::CTR::WaitForRegister( appletId, span );
991 }
992 
993     /* Please see man pages for details
994 
995 
996 
997 */
nnappletIsActive(void)998 NN_EXTERN_C inline bool nnappletIsActive(void)
999 {
1000     return nn::applet::CTR::IsActive();
1001 }
1002 
1003 NN_EXTERN_C inline void nnappletAssignGpuRight(bool flag=true)
1004 {
1005     nn::applet::CTR::AssignGpuRight(flag);
1006 }
nnappletReleaseGpuRight(void)1007 NN_EXTERN_C inline void nnappletReleaseGpuRight(void)
1008 {
1009     nn::applet::CTR::AssignGpuRight(false);
1010 }
1011 
1012 /* Please see man pages for details
1013 
1014 
1015 
1016 */
nnappletIsGpuRightGiven(void)1017 NN_EXTERN_C inline bool nnappletIsGpuRightGiven(void)
1018 {
1019     return nn::applet::CTR::IsGpuRightGiven();
1020 }
1021 
nnappletAttachTransferMemoryHandle(nn::os::TransferMemoryBlock * transferMemory,nn::Handle handle,size_t size,bit32 otherPermission)1022 NN_EXTERN_C inline void nnappletAttachTransferMemoryHandle( nn::os::TransferMemoryBlock* transferMemory, nn::Handle handle, size_t size, bit32 otherPermission )
1023 {
1024     nn::applet::CTR::AttachTransferMemoryHandle( transferMemory, handle, size, otherPermission );
1025 }
1026 
1027 
1028 /*
1029 
1030 */
1031 
1032 #endif  // ifndef NN_APPLET_CTR_APPLET_API_H_
1033