1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - OS
3 File: os_msJump.c
4
5 Copyright 2008 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 $Date:: 2008-12-08#$
14 $Rev: 9573 $
15 $Author: okajima_manabu $
16 *---------------------------------------------------------------------------*/
17
18 #include <nitro.h>
19 #include <twl/os/common/msJump.h>
20
21 /*---------------------------------------------------------------------------*
22 Constant Definitions
23 *---------------------------------------------------------------------------*/
24 #define TITLE_ID_MACHINE_SETTING 0x00030015484e4241 /* HNBA and location of destination do not matter */
25
26 //============================================================================
27
28 /* The following code is located in the TWL extended memory region */
29 #ifdef SDK_TWL
30 #include <twl/ltdmain_begin.h>
31 #endif
32 /*---------------------------------------------------------------------------*
33 Name: OSi_JumpToMachineSetting
34
35 Description: Application jump to the item specified in the TWL system configuration
36
37 Arguments: dest: Setting
38
39 Returns: FALSE Application jump failed for some reason
40 * If the process was successful, a reset occurred during this function so TRUE is not returned
41
42 *---------------------------------------------------------------------------*/
OSi_JumpToMachineSetting(u8 dest)43 BOOL OSi_JumpToMachineSetting(u8 dest)
44 {
45 switch( dest )
46 {
47 OSTWLRegion region = OS_GetRegion();
48
49 case OS_TWL_MACHINE_SETTING_COUNTRY:
50 /* With a region that does not have a country setting in the system configuration, end with FALSE */
51 switch ( OS_GetRegion() )
52 {
53 case OS_TWL_REGION_AMERICA:
54 case OS_TWL_REGION_EUROPE:
55 case OS_TWL_REGION_AUSTRALIA:
56
57 break;
58
59 case OS_TWL_REGION_JAPAN:
60 // case OS_TWL_REGION_CHINA:
61 // case OS_TWL_REGION_KOREA:
62 /* Regions other than the above end with FALSE */
63 default:
64 OS_Warning("Region Error.");
65 return FALSE;
66 }
67 break;
68
69 case OS_TWL_MACHINE_SETTING_LANGUAGE:
70 /* With a region that does not have a language setting in the system configuration, end with FALSE */
71 switch ( OS_GetRegion() )
72 {
73 case OS_TWL_REGION_AMERICA:
74 case OS_TWL_REGION_EUROPE:
75
76 break;
77
78 case OS_TWL_REGION_JAPAN:
79 case OS_TWL_REGION_AUSTRALIA:
80 // case OS_TWL_REGION_CHINA:
81 // case OS_TWL_REGION_KOREA:
82 /* Regions other than the above end with FALSE */
83 default:
84 OS_Warning("Region Error.");
85 return FALSE;
86 }
87 break;
88
89 case OS_TWL_MACHINE_SETTING_PAGE_1:
90 case OS_TWL_MACHINE_SETTING_PAGE_2:
91 case OS_TWL_MACHINE_SETTING_PAGE_3:
92 case OS_TWL_MACHINE_SETTING_PAGE_4:
93 case OS_TWL_MACHINE_SETTING_APP_MANAGER:
94 case OS_TWL_MACHINE_SETTING_WIRELESS_SW:
95 case OS_TWL_MACHINE_SETTING_BRIGHTNESS:
96 case OS_TWL_MACHINE_SETTING_USER_INFO:
97 case OS_TWL_MACHINE_SETTING_DATE:
98 case OS_TWL_MACHINE_SETTING_TIME:
99 case OS_TWL_MACHINE_SETTING_ALARM:
100 case OS_TWL_MACHINE_SETTING_TP_CALIBRATION:
101 case OS_TWL_MACHINE_SETTING_PARENTAL_CONTROL:
102 case OS_TWL_MACHINE_SETTING_NETWORK_SETTING:
103 case OS_TWL_MACHINE_SETTING_NETWORK_EULA:
104 case OS_TWL_MACHINE_SETTING_NETWORK_OPTION:
105 case OS_TWL_MACHINE_SETTING_SYSTEM_UPDATE:
106 case OS_TWL_MACHINE_SETTING_SYSTEM_INITIALIZE:
107 break;
108 default:
109 OS_Warning("Unknown Destination");
110 return FALSE;
111 }
112
113 /* Set Deliver Argument */
114 {
115 OSDeliverArgInfo argInfo;
116 int result;
117
118 OS_InitDeliverArgInfo(&argInfo, 0);
119 (void)OS_DecodeDeliverArg(); //There are cases where the DeliverArg is not set in advance, so continue processing regardless of whether it is right or wrong
120 OSi_SetDeliverArgState( OS_DELIVER_ARG_BUF_ACCESSIBLE | OS_DELIVER_ARG_BUF_WRITABLE );
121 result = OS_SetSysParamToDeliverArg( (u16)dest );
122
123 if(result != OS_DELIVER_ARG_SUCCESS )
124 {
125 OS_Warning("Failed to Set DeliverArgument.");
126 return FALSE;
127 }
128 result = OS_EncodeDeliverArg();
129 if(result != OS_DELIVER_ARG_SUCCESS )
130 {
131 OS_Warning("Failed to Encode DeliverArgument.");
132 return FALSE;
133 }
134 }
135 /* Do Application Jump */
136 return OS_DoApplicationJump( TITLE_ID_MACHINE_SETTING, OS_APP_JUMP_NORMAL );
137
138
139 return FALSE;
140 }
141
142 /*---------------------------------------------------------------------------*
143 Name: OSi_JumpToEulaDirect
144
145 Description: Application jump in the TWL system settings to startup the "Internet - Usage Agreement."
146
147
148 Arguments: None.
149
150 Returns: FALSE Application jump failed for some reason
151 * If the process was successful, a reset occurred during this function so TRUE is not returned
152
153 *---------------------------------------------------------------------------*/
OSi_JumpToEulaDirect(void)154 BOOL OSi_JumpToEulaDirect( void )
155 {
156 return OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_NETWORK_EULA );
157 }
158
159 /*---------------------------------------------------------------------------*
160 Name: OSi_JumpToApplicationManagerDirect
161
162 Description: Application jump in the TWL system settings to startup the "Software Managment."
163
164
165 Arguments: None.
166
167 Returns: FALSE Application jump failed for some reason
168 * If the process was successful, a reset occurred during this function so TRUE is not returned
169
170 *---------------------------------------------------------------------------*/
OSi_JumpToApplicationManagerDirect(void)171 BOOL OSi_JumpToApplicationManagerDirect( void )
172 {
173 return OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_APP_MANAGER );
174 }
175
176 /*---------------------------------------------------------------------------*
177 Name: OSi_JumpToNetworkSettngDirect
178
179 Description: Application jump in the TWL system settings to startup the "Internet - Connection Settings."
180
181
182 Arguments: None.
183
184 Returns: FALSE Application jump failed for some reason
185 * If the process was successful, a reset occurred during this function so TRUE is not returned
186
187 *---------------------------------------------------------------------------*/
OSi_JumpToNetworkSettngDirect(void)188 BOOL OSi_JumpToNetworkSettngDirect( void )
189 {
190 return OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_NETWORK_SETTING );
191 }
192
193 /*---------------------------------------------------------------------------*
194 Name: OSi_JumpToCountrySettingDirect
195
196 Description: Application jump in the TWL system settings to startup the "Country."
197
198 * Because the same settings do not exist on TWL for the Japanese market, jump to the top of this setting.
199
200 Arguments: None.
201
202 Returns: FALSE Application jump failed for some reason
203 * If the process was successful, a reset occurred during this function so TRUE is not returned
204
205 *---------------------------------------------------------------------------*/
OSi_JumpToCountrySettingDirect(void)206 BOOL OSi_JumpToCountrySettingDirect( void )
207 {
208 return OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_COUNTRY );
209 }
210
211 /*---------------------------------------------------------------------------*
212 Name: OS_JumpToSystemUpdateDirect
213
214 Description: Application jump in the TWL system settings to startup the "update system."
215
216
217 Arguments: None.
218
219 Returns: FALSE Application jump failed for some reason
220 * If the process was successful, a reset occurred during this function so TRUE is not returned
221
222 *---------------------------------------------------------------------------*/
OSi_JumpToSystemUpdateDirect(void)223 BOOL OSi_JumpToSystemUpdateDirect( void )
224 {
225 return OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_SYSTEM_UPDATE );
226 }
227
228 /* The code above is located in the TWL extended memory region */
229 #ifdef SDK_TWL
230 #include <twl/ltdmain_end.h>
231 #endif
232
233 /*---------------------------------------------------------------------------*
234 Name: OS_JumpToInternetSetting
235
236 Description: Run a hardware reset and jump to the Internet connection settings of the TWL system settings.
237
238
239 Arguments: None.
240
241 Returns: FALSE Application jump failed for some reason
242 * If the process was successful, a reset occurred during this function so TRUE is not returned
243
244 *---------------------------------------------------------------------------*/
OS_JumpToInternetSetting(void)245 BOOL OS_JumpToInternetSetting(void)
246 {
247 BOOL result = FALSE;
248 #ifdef SDK_TWL
249 if( OS_IsRunOnTwl() )
250 {
251 result = OSi_JumpToNetworkSettngDirect();
252 }
253 else
254 #endif
255 {
256 OS_Warning("This Hardware don't support this funciton");
257 }
258 return result;
259 }
260
261 /*---------------------------------------------------------------------------*
262 Name: OS_JumpToEULAViewer
263
264 Description: Run a hardware reset and jump to the Internet usage agreement of the TWL system settings.
265
266
267 Arguments: None.
268
269 Returns: FALSE Application jump failed for some reason
270 * If the process was successful, a reset occurred during this function so TRUE is not returned
271
272 *---------------------------------------------------------------------------*/
OS_JumpToEULAViewer(void)273 BOOL OS_JumpToEULAViewer(void)
274 {
275 BOOL result = FALSE;
276 #ifdef SDK_TWL
277 if( OS_IsRunOnTwl() )
278 {
279 result = OSi_JumpToEulaDirect();
280 }
281 else
282 #endif
283 {
284 OS_Warning("This Hardware don't support this funciton");
285 }
286 return result;
287 }
288
289 /*---------------------------------------------------------------------------*
290 Name: OS_JumpToWirelessSetting
291
292 Description: Run a hardware reset and jump to the wireless communcations of the TWL system settings.
293
294 Arguments: None.
295
296 Returns: FALSE Application jump failed for some reason
297 * If the process was successful, a reset occurred during this function so TRUE is not returned
298
299 *---------------------------------------------------------------------------*/
OS_JumpToWirelessSetting(void)300 BOOL OS_JumpToWirelessSetting(void)
301 {
302 BOOL result = FALSE;
303 #ifdef SDK_TWL
304 if( OS_IsRunOnTwl() )
305 {
306 result = OSi_JumpToMachineSetting( OS_TWL_MACHINE_SETTING_WIRELESS_SW );
307 }
308 else
309 #endif
310 {
311 OS_Warning("This Hardware don't support this funciton");
312 }
313 return result;
314 }
315 /*---------------------------------------------------------------------------*
316 End of file
317 *---------------------------------------------------------------------------*/
318