1 /*---------------------------------------------------------------------------* 2 Project: WiiConnect24 API demos 3 File: FLViewer.h 4 5 Copyright 2006 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: FLViewer.h,v $ 14 Revision 1.1 2006/09/13 10:07:22 torigoe_nobutaka 15 Initial check in. 16 17 $NoKeywords: $ 18 *---------------------------------------------------------------------------*/ 19 #ifndef __DEMOS_NWC24DEMO_FRIEND_LIST_VIEWER_H__ 20 #define __DEMOS_NWC24DEMO_FRIEND_LIST_VIEWER_H__ 21 22 #include <revolution/types.h> 23 #include <revolution/nwc24/NWC24Types.h> 24 25 #define FONT_SIZE 16 26 #define HEX_BUF_SIZE 5 27 #define LIST_BOX_ROWS 20 28 #define FD_ID_BUF_SIZE 17 29 #define NAME_LEN 10 30 #define NAME_BUF_SIZE 2 * NAME_LEN + 1 31 #define WII_ID_BUF_SIZE 17 32 #define MAIL_ADDR_BUF_SIZE 256 33 34 #define NUM_EDIT_ITEMS 5 35 #define EDIT_ITEM_TYPE 0 36 #define EDIT_ITEM_STATUS 1 37 #define EDIT_ITEM_FD_ID 2 38 #define EDIT_ITEM_NAME 3 39 #define EDIT_ITEM_ADDRESS 4 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 /*===========================================================================*/ 45 46 /*---------------------------------------------------------------------------* 47 Type definitions 48 *---------------------------------------------------------------------------*/ 49 /* Tentative friend information being edited */ 50 typedef struct EditFriendInfo 51 { 52 u32 type; 53 u32 status; 54 char fdId[FD_ID_BUF_SIZE]; 55 char name[NAME_BUF_SIZE]; 56 char wiiId[WII_ID_BUF_SIZE]; 57 char mailAddr[MAIL_ADDR_BUF_SIZE]; 58 u8 padding[5]; 59 60 } EditFriendInfo; 61 62 /* Application status */ 63 typedef enum AppState 64 { 65 STATE_SELECT_FRIEND, // Selection of friend 66 STATE_SELECT_EDIT_ITEM, // Select friend information item to edit 67 STATE_EDIT_TYPE, // Editing address type 68 STATE_EDIT_STATUS, // Editing communication capable/incapable information 69 STATE_EDIT_FD_ID, // Editing FDID 70 STATE_EDIT_NAME, // Editing nickname 71 STATE_EDIT_WII_ID, // Editing Wii number 72 STATE_EDIT_MAIL_ADDR, // Editing e-mail address 73 STATE_DELETE_FRIEND // Delete friend information 74 75 } AppState; 76 77 /*---------------------------------------------------------------------------* 78 Global constants 79 *---------------------------------------------------------------------------*/ 80 extern const GXColor CLR_DARKBLUE; 81 extern const GXColor CLR_WHITE; 82 extern const GXColor CLR_GRAY; 83 extern const GXColor CLR_YELLOW; 84 extern const GXColor CLR_DARKYELLOW; 85 extern const GXColor CLR_GREEN; 86 extern const char* STR_NOT_REGISTERED; 87 extern const BOOL UPDATABLE_ITEM_TABLE[]; 88 89 /*---------------------------------------------------------------------------* 90 Global variables 91 *---------------------------------------------------------------------------*/ 92 extern s16 g_screenWidth; 93 extern s16 g_screenHeight; 94 extern u32 g_longHold; // Button held down 95 extern AppState g_state; 96 extern u32 g_numFriendInfos; 97 extern u32 g_idxSelectedFriend; 98 extern u32 g_idxTopOfFriendList; 99 extern u8 g_selectedEditItem; 100 extern NWC24FriendInfo* g_tempInfo; 101 extern EditFriendInfo g_editFriendInfo; // Friend information being edited 102 extern EditFriendInfo g_backupFriendInfo; // Friend information for Undo 103 extern char g_nameBuf[][NAME_BUF_SIZE]; 104 extern u32 g_idxNameBufStart; 105 extern char g_hexBuf[]; 106 extern BOOL g_bHelp; 107 108 /*---------------------------------------------------------------------------* 109 Function prototypes 110 *---------------------------------------------------------------------------*/ 111 void CheckError ( const char* strFunc, NWC24Err err ); 112 u64 ConvStringTo16Digits( const char* str ); 113 void ConvNameUtf16ToSjis ( char* dst, const u16* src ); 114 void ConvNameSjisToUtf16 ( u16* dst, const char* src ); 115 u32 SjisStrLen ( const char* str ); 116 BOOL SjisIsMultibyte ( const char* str ); 117 void InitEditFriendInfo ( NWC24FriendInfo* info ); 118 void RegisterFriendInfo ( u32 index ); 119 120 /*===========================================================================*/ 121 #ifdef __cplusplus 122 } 123 #endif 124 #endif /* __DEMOS_NWC24DEMO_FRIEND_LIST_VIEWER_H__ */ 125 126 /*======== End of FLViewer.h ========*/ 127