1 /*---------------------------------------------------------------------------*
2   Project:      APIs for channel install sequence
3   File:         OSInstall.h
4 
5   Copyright (C) 2007 Nintendo.  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   $Log: OSInstall.h,v $
14   Revision 1.1  2009/10/05 02:25:34  iwai_yuma
15   Changed storage path.
16 
17   Revision 1.5  2007/07/23 04:10:33  ooizumi
18   Modified to include OSTitle.h.
19 
20   Revision 1.4  2007/07/19 06:05:07  wada_jumpei
21   Added OSGetLaunchCode.
22 
23   Revision 1.3  2007/04/23 00:22:27  ooizumi
24   Changed struct name.
25 
26   Revision 1.2  2007/04/17 08:06:55  ooizumi
27   Added return code from channel installer.
28 
29   Revision 1.1  2007/04/13 12:55:52  ooizumi
30   Initial check-in.
31 
32  *---------------------------------------------------------------------------*/
33 
34 #ifndef __OSINSTALL_H__
35 #define __OSINSTALL_H__
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include <revolution/types.h>
42 #include <revolution/nand.h>
43 #include <revolution/OSTitle.h>
44 
45 typedef struct OSInstallInfo
46 {
47     char*   fileName;  // channel application's file name to install
48     u16*    titleName; // channel application's title name to draw on scree
49 } OSInstallInfo;
50 
51 #define OSINSTALL_CHECK_SYS_INSSPACE     0x00000001
52 #define OSINSTALL_CHECK_SYS_INSINODE     0x00000002
53 #define OSINSTALL_CHECK_SYS_INSCHAN      0x00000004
54 
55 #define OSINSTALL_RESULT_OK                0
56 #define OSINSTALL_RESULT_NOINFO         ( -1)
57 #define OSINSTALL_RESULT_ALLOC_FAILED   ( -2)
58 #define OSINSTALL_RESULT_BUSY           ( -3)
59 #define OSINSTALL_RESULT_INVALID        ( -4)
60 #define OSINSTALL_RESULT_UNKNOWN        (-64)
61 #define OSINSTALL_RESULT_FATAL_ERROR   (-128)
62 
63 #define OSINSTALL_RETURN_OK             0x00000000 // No error
64 #define OSINSTALL_RETURN_INVALID        0x00000001 // Invalid parameters
65 #define OSINSTALL_RETURN_INIT_FAILED    0x00000002 // Failed to initialize
66 #define OSINSTALL_RETURN_NOEXISTS       0x00000004 // Wad file does not exist in disc
67 #define OSINSTALL_RETURN_EXISTS         0x00000008 // All files are already installed
68 #define OSINSTALL_RETURN_MAXBLOCKS      0x00000010 // Ran out of FS blocks
69 #define OSINSTALL_RETURN_MAXFILES       0x00000020 // Ran out of inode entries
70 #define OSINSTALL_RETURN_MAXCHANNELS    0x00000040 // Ran out of channel entries
71 #define OSINSTALL_RETURN_IMPORT_FAILED  0x00000080 // Failed to import
72 #define OSINSTALL_RETURN_UNKNOWN        0x40000000 // Uknown error
73 #define OSINSTALL_RETURN_FATAL_ERROR    0x80000000 // Fatal error (never return to app)
74 
75 typedef struct OSInstallCommandBlock
76 {
77     void             *userData;
78 
79     // Do not access below members.
80     void             *callback;
81     u32              *answer;
82     u32               nandAnswer;
83     NANDCommandBlock  nandCb;
84 } OSInstallCommandBlock;
85 
86 typedef void (*OSInstallCallback)( s32 result, OSInstallCommandBlock *block );
87 
88 void OSLaunchInstaller(u32 launchCode, u16* gameTitleName, OSInstallInfo* info);
89 
90 s32  OSCheckInstall(u32 num, u32 fsBlock, u32 inode, u32* answer);
91 s32  OSCheckInstallAsync(u32 num, u32 fsBlock, u32 inode, u32* answer, OSInstallCallback cb, OSInstallCommandBlock *block);
92 u32  OSGetLaunchCode(void);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif // __OSINSTALL_H__
99