1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - OS
3 File: ownerInfo.c
4
5 Copyright 2003-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-09-18#$
14 $Rev: 8573 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17
18 #include <nitro/os/common/ownerInfo.h>
19 #include <nitro/os/common/systemWork.h>
20
21
22 /*---------------------------------------------------------------------------*
23 Name: OS_GetMacAddress
24
25 Description: Gets the MAC address of the wireless hardware.
26
27 Arguments: macAddress: Pointer to the buffer getting the MAC address.
28 Six bytes of data get written to this buffer.
29
30 Returns: None.
31 *---------------------------------------------------------------------------*/
OS_GetMacAddress(u8 * macAddress)32 void OS_GetMacAddress(u8 *macAddress)
33 {
34 u8 *src;
35
36 src =
37 (u8 *)((u32)(OS_GetSystemWork()->nvramUserInfo) +
38 ((sizeof(NVRAMConfig) + 3) & ~0x00000003));
39 MI_CpuCopy8(src, macAddress, 6);
40 }
41
42 /*---------------------------------------------------------------------------*
43 Name: OS_GetOwnerInfo
44
45 Description: Gets the owner information.
46
47 Arguments: info: Pointer to the buffer getting the owner information.
48 Data gets written to this buffer.
49
50 Returns: None.
51 *---------------------------------------------------------------------------*/
OS_GetOwnerInfo(OSOwnerInfo * info)52 void OS_GetOwnerInfo(OSOwnerInfo *info)
53 {
54 NVRAMConfig *src;
55
56 src = (NVRAMConfig *)(OS_GetSystemWork()->nvramUserInfo);
57 info->language = (u8)(src->ncd.option.language);
58 info->favoriteColor = (u8)(src->ncd.owner.favoriteColor);
59 info->birthday.month = (u8)(src->ncd.owner.birthday.month);
60 info->birthday.day = (u8)(src->ncd.owner.birthday.day);
61 info->nickNameLength = (u16)(src->ncd.owner.nickname.length);
62 info->commentLength = (u16)(src->ncd.owner.comment.length);
63 MI_CpuCopy16(src->ncd.owner.nickname.str,
64 info->nickName, OS_OWNERINFO_NICKNAME_MAX * sizeof(u16));
65 MI_CpuCopy16(src->ncd.owner.comment.str, info->comment, OS_OWNERINFO_COMMENT_MAX * sizeof(u16));
66 info->nickName[OS_OWNERINFO_NICKNAME_MAX] = 0;
67 info->comment[OS_OWNERINFO_COMMENT_MAX] = 0;
68 }
69
70 /*---------------------------------------------------------------------------*
71 Name: OS_GetOwnerRtcOffset
72
73 Description: Gets the offset (in units of seconds) which fluctuates in response to the new value every time the owner changes the RTC setting.
74
75 If the RTC is pushed forward into the future relative to the RTC time prior to being reset, the push-forward time is added.
76 If the RTC is pushed back into the past, the push-back time is subtracted.
77
78 Arguments: None.
79
80 Returns: s64: Returns the offset value for RTC settings.
81 *---------------------------------------------------------------------------*/
OS_GetOwnerRtcOffset(void)82 s64 OS_GetOwnerRtcOffset(void)
83 {
84 NVRAMConfig *src = (NVRAMConfig *)(OS_GetSystemWork()->nvramUserInfo);
85
86 return src->ncd.option.rtcOffset;
87 }
88
89 /*---------------------------------------------------------------------------*
90 Name: OS_GetFavoriteColorTable
91
92 Description: Gets a pointer to the "Favorite Color" array that corresponds to the number of the favoriteColor member of the OSOwnerInfo structure.
93
94
95 Arguments: None.
96
97 Returns: Pointer to the GXRgb type constant array that stores corresponding color value.
98 *---------------------------------------------------------------------------*/
OS_GetFavoriteColorTable(void)99 const GXRgb *OS_GetFavoriteColorTable(void)
100 {
101 static const GXRgb col_table[OS_FAVORITE_COLOR_MAX] = {
102 OS_FAVORITE_COLOR_VALUE_GRAY,
103 OS_FAVORITE_COLOR_VALUE_BROWN,
104 OS_FAVORITE_COLOR_VALUE_RED,
105 OS_FAVORITE_COLOR_VALUE_PINK,
106 OS_FAVORITE_COLOR_VALUE_ORANGE,
107 OS_FAVORITE_COLOR_VALUE_YELLOW,
108 OS_FAVORITE_COLOR_VALUE_LIME_GREEN,
109 OS_FAVORITE_COLOR_VALUE_GREEN,
110 OS_FAVORITE_COLOR_VALUE_DARK_GREEN,
111 OS_FAVORITE_COLOR_VALUE_SEA_GREEN,
112 OS_FAVORITE_COLOR_VALUE_TURQUOISE,
113 OS_FAVORITE_COLOR_VALUE_BLUE,
114 OS_FAVORITE_COLOR_VALUE_DARK_BLUE,
115 OS_FAVORITE_COLOR_VALUE_PURPLE,
116 OS_FAVORITE_COLOR_VALUE_VIOLET,
117 OS_FAVORITE_COLOR_VALUE_MAGENTA,
118 };
119 return col_table;
120 }
121
122 /*---------------------------------------------------------------------------*
123 End of file
124 *---------------------------------------------------------------------------*/
125