1 /*---------------------------------------------------------------------------*
2   Project:  WiiConnect24 API demos
3   File:     FLViewerRender.c
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: FLViewerRender.c,v $
14   Revision 1.1  2006/09/27 08:56:17  torigoe_nobutaka
15   Moved from nwc24demo/src.
16 
17   Revision 1.1  2006/09/13 10:07:05  torigoe_nobutaka
18   Initial check in.
19 
20   $NoKeywords: $
21  *---------------------------------------------------------------------------*/
22 #include <revolution.h>
23 #include <revolution/nwc24.h>
24 #include <stdio.h>
25 
26 #define DEMO_USE_MEMLIB 1
27 #include <demo.h>
28 
29 #include "FLViewer.h"
30 #include "FLViewerRender.h"
31 
32 /*---------------------------------------------------------------------------*
33    Static constants
34  *---------------------------------------------------------------------------*/
35 static const s16        LARGE_FONT_SIZE     =   32;
36 static const s16        FONT_LEADING        =   (s16)(FONT_SIZE + 2);
37 
38 static const s16        LIST_BOX_TL_X       =   2 * FONT_SIZE;
39 static const s16        LIST_BOX_TL_Y       =   3 * FONT_LEADING;
40 static const s16        LIST_BOX_WIDTH      =   15 * FONT_SIZE;
41 
42 static const s16        INFO_BOX_TL_X       =   17 * FONT_SIZE;
43 static const s16        INFO_BOX_TL_Y       =   3 * FONT_LEADING;
44 
45 static const s16        HELP_BOX_TL_X       =   17 * FONT_SIZE;
46 static const s16        HELP_BOX_TL_Y       =   16 * FONT_LEADING;
47 
48 static const s16        HEX_BOX_TL_X        =   30 * FONT_SIZE;
49 static const s16        HEX_BOX_TL_Y        =   2 * FONT_LEADING;
50 
51 static const char*      STR_EDIT_ITEM[]     =
52 {
53     "Type",
54     "Status",
55     "FDID",
56     "Name",
57     "Address"
58 };
59 
60 /*---------------------------------------------------------------------------*
61    Forward declarations of function
62  *---------------------------------------------------------------------------*/
63 static void             SetFontColor    ( GXColor color );
64 static void             SetFontSize     ( s16 size );
65 static void             RenderFriendList( void );
66 static void             RenderFriendInfo( void );
67 static void             PrintType       ( s16 x, s16 y, NWC24FriendInfo* info );
68 static void             PrintTypeCore   ( s16 x, s16 y, u32 type, BOOL bEditMode );
69 static void             PrintStatus     ( s16 x, s16 y, NWC24FriendInfo* info );
70 static void             PrintStatusCore ( s16 x, s16 y, u32 status, BOOL bEditMode );
71 static void             PrintFdId       ( s16 x, s16 y, NWC24FriendInfo* info );
72 static void             PrintFdIdCore   ( s16 x, s16 y, const char* strFdId, BOOL bEditMode );
73 static void             PrintName       ( s16 x, s16 y, NWC24FriendInfo* info );
74 static void             PrintNameCore   ( s16 x, s16 y, const char* name, BOOL bEditMode );
75 static void             PrintAddress    ( s16 x, s16 y, NWC24FriendInfo* info );
76 static void             PrintWiiId      ( s16 x, s16 y, const char* strWiiId, BOOL bEditMode );
77 static void             PrintMailAddr   ( s16 x, s16 y, const char* mailAddr, BOOL bEditMode );
78 
79 /*---------------------------------------------------------------------------*
80    Render scene
81  *---------------------------------------------------------------------------*/
Render(void)82 void Render( void )
83 {
84     s16     printX;
85     s16     printY;
86 
87     /* Friend information list */
88     RenderFriendList();
89 
90     /* Friend information */
91     if ( (g_state == STATE_SELECT_FRIEND && TRUE == NWC24IsFriendInfoThere( g_idxSelectedFriend ))
92          || g_state != STATE_SELECT_FRIEND )
93     {
94         RenderFriendInfo();
95     }
96 
97     /* Hexadecimal input mode*/
98     if ( g_hexBuf[0] != '\0' )
99     {
100         printX = HEX_BOX_TL_X;
101         printY = HEX_BOX_TL_Y;
102         printX += DEMORFPrintf( printX, printY, 0, "(hex) 0x" );
103         SetFontColor( CLR_GREEN );
104         (void)DEMORFPrintf( printX, printY, 0, "%s", g_hexBuf );
105         SetFontColor( CLR_WHITE );
106     }
107 
108     /* Frame count */
109     {
110         static u8   frames  = 0;
111 
112         printX = LIST_BOX_TL_X;
113         printY = (s16)(LIST_BOX_TL_Y + ((LIST_BOX_ROWS + 1) * FONT_LEADING));
114 
115         /* Frame count */
116         frames = (u8)((frames + 1) % 60);
117         (void)DEMORFPrintf( printX, printY, 0, "%d", frames );
118     }
119 
120     /* Friend information deletion verification */
121     if ( g_state == STATE_DELETE_FRIEND )
122     {
123         printX = HELP_BOX_TL_X;
124         printY = HELP_BOX_TL_Y - FONT_LEADING;
125         SetFontColor( CLR_YELLOW );
126         (void)DEMORFPrintf( printX, printY, 0, "Delete this friend info? (A/B)" );
127         SetFontColor( CLR_WHITE );
128     }
129 
130     /* Controls */
131     {
132         if ( !g_bHelp )
133         {
134             printX = (s16)(g_screenWidth - (2 * FONT_SIZE) - DEMOGetRFTextWidth( "<1>: Show help" ));
135             printY = (s16)(LIST_BOX_TL_Y + (LIST_BOX_ROWS * FONT_LEADING));
136             (void)DEMORFPrintf( printX, printY, 0, "<1>: Show help" );
137         }
138         else
139         {
140             printX = HELP_BOX_TL_X;
141             printY = HELP_BOX_TL_Y;
142             (void)DEMORFPrintf( printX, printY, 0, "<Up/Down>:\n"
143                                                    "<Right/Left>:\n"
144                                                    "<A>:\n"
145                                                    "<B>:\n"
146                                                    "<+>:\n"
147                                                    "<->:\n"
148                                                    "<1>:" );
149             printX += DEMOGetRFTextWidth( "<00000/0000>: " );
150             (void)DEMORFPrintf( printX, printY, 0, "\n\n\n\n\n\nHide help" );
151 
152             switch ( g_state )
153             {
154                 case STATE_SELECT_FRIEND:
155                 {
156                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
157                                                            "-\n"
158                                                            "Edit\n"
159                                                            "Delete\n"
160                                                            "-\n"
161                                                            "-" );
162                     break;
163                 }
164 
165                 case STATE_SELECT_EDIT_ITEM:
166                 {
167                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
168                                                            "-\n"
169                                                            "Edit\n"
170                                                            "Cancel\n"
171                                                            "Register\n"
172                                                            "-" );
173                     break;
174                 }
175 
176                 case STATE_EDIT_TYPE:
177                 case STATE_EDIT_STATUS:
178                 case STATE_EDIT_FD_ID:
179                 {
180                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
181                                                            "-\n"
182                                                            "Input\n"
183                                                            "Back space\n"
184                                                            "-\n"
185                                                            "-" );
186                     break;
187                 }
188 
189                 case STATE_EDIT_NAME:
190                 {
191                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
192                                                            "Change char-type\n"
193                                                            "Input\n"
194                                                            "Back space\n"
195                                                            "Decide\n"
196                                                            "Toggle hex-mode" );
197                     break;
198                 }
199 
200                 case STATE_EDIT_WII_ID:
201                 {
202                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
203                                                            "-\n"
204                                                            "Input\n"
205                                                            "Back space\n"
206                                                            "-\n"
207                                                            "-" );
208                     break;
209                 }
210 
211                 case STATE_EDIT_MAIL_ADDR:
212                 {
213                     (void)DEMORFPrintf( printX, printY, 0, "Select\n"
214                                                            "Change char-type\n"
215                                                            "Input\n"
216                                                            "Back space\n"
217                                                            "Decide\n"
218                                                            "-" );
219                     break;
220                 }
221 
222                 case STATE_DELETE_FRIEND:
223                 {
224                     (void)DEMORFPrintf( printX, printY, 0, "-\n"
225                                                            "-\n"
226                                                            "Yes\n"
227                                                            "No\n"
228                                                            "-\n"
229                                                            "-" );
230                     break;
231                 }
232             }   // end switch
233         }   // end else
234     }
235     return;
236 }
237 
238 /*---------------------------------------------------------------------------*/
SetFontColor(GXColor color)239 static void SetFontColor( GXColor color )
240 {
241     GXSetTevColor( GX_TEVREG0, color );
242     return;
243 }
244 
245 /*---------------------------------------------------------------------------*/
SetFontSize(s16 size)246 static void SetFontSize( s16 size )
247 {
248     DEMOSetROMFontSize( size, 0 );
249     return;
250 }
251 
252 /*---------------------------------------------------------------------------*
253    Display of friend information list
254  *---------------------------------------------------------------------------*/
RenderFriendList(void)255 static void RenderFriendList( void )
256 {
257     u32     i;
258     s16     printX;
259     s16     printY      = LIST_BOX_TL_Y;
260 
261     for ( i = 0; i < LIST_BOX_ROWS; ++i )
262     {
263         u32     idxFriend   = g_idxTopOfFriendList + i;
264         u32     idxBuf      = (g_idxNameBufStart + i) % LIST_BOX_ROWS;
265 
266         if ( g_numFriendInfos <= idxFriend )
267         {
268             break;
269         }
270 
271         if ( idxFriend == g_idxSelectedFriend )
272         {
273             SetFontColor( (g_state == STATE_SELECT_FRIEND) ? CLR_YELLOW : CLR_DARKYELLOW );
274         }
275 
276         printX = LIST_BOX_TL_X;
277         (void)DEMORFPrintf( printX, printY, 0, "[%03u", idxFriend );
278         printX += DEMOGetRFTextWidth( "[000" );
279         printX += DEMORFPrintf( printX, printY, 0, "] " );
280 
281         (void)DEMORFPrintf( printX, printY, 0, "%s", g_nameBuf[idxBuf] );
282 
283         SetFontColor( CLR_WHITE );
284         printY += FONT_LEADING;
285     }
286     return;
287 }
288 
289 /*---------------------------------------------------------------------------*
290    Display of friend information
291  *---------------------------------------------------------------------------*/
RenderFriendInfo(void)292 static void RenderFriendInfo( void )
293 {
294     NWC24Err            err;
295     NWC24FriendInfo*    info        = NULL;
296     BOOL                bRegistered;
297     u8                  iItem;
298     s16                 printX      = INFO_BOX_TL_X;
299     s16                 printY      = INFO_BOX_TL_Y;
300 
301     bRegistered = (BOOL)(TRUE == NWC24IsFriendInfoThere( g_idxSelectedFriend ));
302 
303     if ( bRegistered )
304     {
305         err = NWC24ReadFriendInfo( g_tempInfo, g_idxSelectedFriend );
306         CheckError( "NWC24GetNumFriendInfos()", err );
307     }
308 
309     /* Item name of friend information */
310     for ( iItem = 0; iItem < NUM_EDIT_ITEMS; ++iItem )
311     {
312         if ( g_state != STATE_SELECT_FRIEND && g_state != STATE_DELETE_FRIEND )
313         {
314             if ( bRegistered && !UPDATABLE_ITEM_TABLE[iItem] )
315             {
316                 SetFontColor( CLR_GRAY );
317             }
318             else if ( iItem == g_selectedEditItem )
319             {
320                 SetFontColor( (g_state == STATE_SELECT_EDIT_ITEM) ? CLR_YELLOW : CLR_DARKYELLOW );
321             }
322         }
323 
324         (void)DEMORFPrintf( printX, printY, 0, "%s:", STR_EDIT_ITEM[iItem] );
325         SetFontColor( CLR_WHITE );
326         printY += 2 * FONT_LEADING;
327     }
328 
329     printX += (s16)DEMOGetRFTextWidth( "00000000: " );
330     printY = INFO_BOX_TL_Y;
331 
332     /* Friend information value */
333     if ( bRegistered && (g_state == STATE_SELECT_FRIEND || g_state == STATE_DELETE_FRIEND) )
334     {
335         PrintType( printX, printY, g_tempInfo );    printY += 2 * FONT_LEADING;
336         PrintStatus( printX, printY, g_tempInfo );  printY += 2 * FONT_LEADING;
337         PrintFdId( printX, printY, g_tempInfo );    printY += 2 * FONT_LEADING;
338         PrintName( printX, printY, g_tempInfo );    printY += 2 * FONT_LEADING;
339         PrintAddress( printX, printY, g_tempInfo );
340     }
341     else if ( g_state != STATE_SELECT_FRIEND )
342     {
343         PrintTypeCore( printX, printY, g_editFriendInfo.type, g_state == STATE_EDIT_TYPE );
344         printY += 2 * FONT_LEADING;
345 
346         PrintStatusCore( printX, printY, g_editFriendInfo.status, g_state == STATE_EDIT_STATUS );
347         printY += 2 * FONT_LEADING;
348 
349         PrintFdIdCore( printX, printY, g_editFriendInfo.fdId, g_state == STATE_EDIT_FD_ID );
350         printY += 2 * FONT_LEADING;
351 
352         PrintNameCore( printX, printY, g_editFriendInfo.name, g_state == STATE_EDIT_NAME );
353         printY += 2 * FONT_LEADING;
354 
355         if ( g_editFriendInfo.type == NWC24_FI_TYPE_WII )
356         {
357             PrintWiiId( printX, printY, g_editFriendInfo.wiiId, g_state == STATE_EDIT_WII_ID );
358         }
359         else if ( g_editFriendInfo.type == NWC24_FI_TYPE_PUBLIC )
360         {
361             PrintMailAddr( printX, printY, g_editFriendInfo.mailAddr, g_state == STATE_EDIT_MAIL_ADDR );
362         }
363     }
364     return;
365 }
366 
367 /*---------------------------------------------------------------------------*
368   Name: PrintType
369   Description: Displays friend information address type
370   Arguments   : x       - x-coordinate value of the display position.
371                 y       - y-coordinate value of the display position.
372                 info    - Pointer to the NWC24FriendInfo structure displaying the content.
373   Returns: None.
374  *---------------------------------------------------------------------------*/
PrintType(s16 x,s16 y,NWC24FriendInfo * info)375 static void PrintType( s16 x, s16 y, NWC24FriendInfo* info )
376 {
377     ASSERT( info );
378 
379     PrintTypeCore( x, y, info->attr.type, FALSE );
380     return;
381 }
382 
383 /*---------------------------------------------------------------------------*/
PrintTypeCore(s16 x,s16 y,u32 type,BOOL bEditMode)384 static void PrintTypeCore( s16 x, s16 y, u32 type, BOOL bEditMode )
385 {
386     if ( bEditMode )
387     {
388         SetFontColor( CLR_YELLOW );
389         SetFontSize( LARGE_FONT_SIZE );
390         y += LARGE_FONT_SIZE - FONT_SIZE;
391     }
392 
393     if ( type == NWC24_FI_TYPE_WII )
394     {
395         (void)DEMORFPrintf( x, y, 0, "Wii" );
396     }
397     else if ( type == NWC24_FI_TYPE_PUBLIC )
398     {
399         (void)DEMORFPrintf( x, y, 0, "Public" );
400     }
401     else
402     {
403         (void)DEMORFPrintf( x, y, 0, "Invalid type" );
404     }
405 
406     SetFontColor( CLR_WHITE );
407     SetFontSize( FONT_SIZE );
408     return;
409 }
410 
411 /*---------------------------------------------------------------------------*
412   Name: PrintStatus
413   Description: Displays the friendship establishment state of friend information
414   Arguments   : x       - x-coordinate value of the display position.
415                 y       - y-coordinate value of the display position.
416                 info    - Pointer to the NWC24FriendInfo structure displaying the content.
417   Returns: None.
418  *---------------------------------------------------------------------------*/
PrintStatus(s16 x,s16 y,NWC24FriendInfo * info)419 static void PrintStatus( s16 x, s16 y, NWC24FriendInfo* info )
420 {
421     ASSERT( info );
422 
423     PrintStatusCore( x, y, info->attr.status, FALSE );
424     return;
425 }
426 
427 /*---------------------------------------------------------------------------*/
PrintStatusCore(s16 x,s16 y,u32 status,BOOL bEditMode)428 static void PrintStatusCore( s16 x, s16 y, u32 status, BOOL bEditMode )
429 {
430     if ( bEditMode )
431     {
432         SetFontColor( CLR_YELLOW );
433         SetFontSize( LARGE_FONT_SIZE );
434         y += LARGE_FONT_SIZE - FONT_SIZE;
435     }
436 
437     if ( status == NWC24_FI_STAT_PENDING )
438     {
439         (void)DEMORFPrintf( x, y, 0, "Pending" );
440     }
441     else if ( status == NWC24_FI_STAT_ESTABLISHED )
442     {
443         (void)DEMORFPrintf( x, y, 0, "Established" );
444     }
445     else
446     {
447         (void)DEMORFPrintf( x, y, 0, "Invalid status" );
448     }
449 
450     SetFontColor( CLR_WHITE );
451     SetFontSize( FONT_SIZE );
452     return;
453 }
454 
455 /*---------------------------------------------------------------------------*
456   Name: PrintFdId
457   Description: Displays fdId member value of friend information.
458   Arguments   : x       - x-coordinate value of the display position.
459                 y       - y-coordinate value of the display position.
460                 info    - Pointer to the NWC24FriendInfo structure displaying the content.
461   Returns: None.
462  *---------------------------------------------------------------------------*/
PrintFdId(s16 x,s16 y,NWC24FriendInfo * info)463 static void PrintFdId( s16 x, s16 y, NWC24FriendInfo* info )
464 {
465     char    strFdId[FD_ID_BUF_SIZE];
466 
467     (void)sprintf( strFdId, "%016llu", info->attr.fdId );
468     PrintFdIdCore( x, y, strFdId, FALSE );
469     return;
470 }
471 
472 /*---------------------------------------------------------------------------*/
PrintFdIdCore(s16 x,s16 y,const char * strFdId,BOOL bEditMode)473 static void PrintFdIdCore( s16 x, s16 y, const char* strFdId, BOOL bEditMode )
474 {
475     u32     i;
476 
477     for ( i = 0; i < WII_ID_BUF_SIZE - 1; ++i )
478     {
479         if ( strFdId[i] == '\0' )
480         {
481             break;
482         }
483 
484         if ( bEditMode && strFdId[i + 1] == '\0' )
485         {
486             SetFontColor( CLR_YELLOW );
487             SetFontSize( LARGE_FONT_SIZE );
488             y += LARGE_FONT_SIZE - FONT_SIZE;
489         }
490         x += DEMORFPrintf( x, y, 0, "%c", strFdId[i] );
491 
492         if ( i % 4 == 3 )
493         {
494             x += DEMORFPrintf( x, y, 0, " " );
495         }
496     }
497     SetFontColor( CLR_WHITE );
498     SetFontSize( FONT_SIZE );
499     return;
500 }
501 
502 /*---------------------------------------------------------------------------*
503   Name: PrintName
504   Description: Displays the name (nickname) of friend information
505   Arguments   : x       - x-coordinate value of the display position.
506                 y       - y-coordinate value of the display position.
507                 info    - Pointer to the NWC24FriendInfo structure displaying the content.
508   Returns: None.
509  *---------------------------------------------------------------------------*/
PrintName(s16 x,s16 y,NWC24FriendInfo * info)510 static void PrintName( s16 x, s16 y, NWC24FriendInfo* info )
511 {
512     char    name[NAME_BUF_SIZE];
513 
514     ConvNameUtf16ToSjis( name, info->attr.name );
515 
516     PrintNameCore( x, y, name, FALSE );
517     return;
518 }
519 
520 /*---------------------------------------------------------------------------*/
PrintNameCore(s16 x,s16 y,const char * name,BOOL bEditMode)521 static void PrintNameCore( s16 x, s16 y, const char* name, BOOL bEditMode )
522 {
523     u32     i;
524     s32     charSize;
525 
526     for ( i = 0; i < NAME_LEN; ++i )
527     {
528         if ( *name == '\0' )
529         {
530             break;
531         }
532 
533         charSize = SjisIsMultibyte( name ) ? 2 : 1;
534 
535         if ( bEditMode && *(name + charSize) == '\0' )
536         {
537             SetFontColor( CLR_YELLOW );
538             SetFontSize( LARGE_FONT_SIZE );
539             y += LARGE_FONT_SIZE - FONT_SIZE;
540         }
541 
542         x += DEMORFPutsEx( x, y, 0, (char*)name, g_screenWidth, charSize );
543         name += charSize;
544     }
545     SetFontColor( CLR_WHITE );
546     SetFontSize( FONT_SIZE );
547     return;
548 }
549 
550 /*---------------------------------------------------------------------------*
551   Name: PrintAddress
552   Description: Displays friend information address
553   Arguments   : x           - x-coordinate value of the display position.
554                 y           - y-coordinate value of the display position.
555                 info        - Pointer to the NWC24FriendInfo structure displaying the content.
556 
557   Returns: None.
558  *---------------------------------------------------------------------------*/
PrintAddress(s16 x,s16 y,NWC24FriendInfo * info)559 static void PrintAddress( s16 x, s16 y, NWC24FriendInfo* info )
560 {
561     ASSERT( info );
562 
563     if ( info->attr.type == NWC24_FI_TYPE_WII )
564     {
565         char    strWiiId[WII_ID_BUF_SIZE];
566 
567         (void)sprintf( strWiiId, "%016llu", info->addr.wiiId );
568         PrintWiiId( x, y, strWiiId, FALSE );
569     }
570     else if ( info->attr.type == NWC24_FI_TYPE_PUBLIC )
571     {
572         PrintMailAddr( x, y, info->addr.mailAddr, FALSE );
573     }
574     return;
575 }
576 
577 /*---------------------------------------------------------------------------*/
PrintWiiId(s16 x,s16 y,const char * strWiiId,BOOL bEditMode)578 static void PrintWiiId( s16 x, s16 y, const char* strWiiId, BOOL bEditMode )
579 {
580     u32     i;
581 
582     if ( strWiiId[0] == '\0' )
583     {
584         SetFontColor( CLR_GREEN );
585         (void)DEMORFPrintf( x, y, 0, "Bad Wii ID" );
586         SetFontColor( CLR_WHITE );
587         return;
588     }
589 
590     for ( i = 0; i < WII_ID_BUF_SIZE - 1; ++i )
591     {
592         if ( strWiiId[i] == '\0' )
593         {
594             break;
595         }
596 
597         if ( bEditMode && strWiiId[i + 1] == '\0' )
598         {
599             SetFontColor( CLR_YELLOW );
600             SetFontSize( LARGE_FONT_SIZE );
601             y += LARGE_FONT_SIZE - FONT_SIZE;
602         }
603         x += DEMORFPrintf( x, y, 0, "%c", strWiiId[i] );
604 
605         if ( i % 4 == 3 )
606         {
607             x += DEMORFPrintf( x, y, 0, " " );
608         }
609     }
610     SetFontColor( CLR_WHITE );
611     SetFontSize( FONT_SIZE );
612     return;
613 }
614 
615 /*---------------------------------------------------------------------------*/
PrintMailAddr(s16 x,s16 y,const char * mailAddr,BOOL bEditMode)616 static void PrintMailAddr( s16 x, s16 y, const char* mailAddr, BOOL bEditMode )
617 {
618     u32     i;
619     s32     width;
620     s16     printX  = x;
621     s16     printY  = y;
622 
623     for ( i = 0; i < MAIL_ADDR_BUF_SIZE - 1; ++i )
624     {
625         if ( mailAddr[i] == '\0' )
626         {
627             break;
628         }
629 
630         if ( bEditMode && mailAddr[i + 1] == '\0' )
631         {
632             SetFontColor( CLR_YELLOW );
633             SetFontSize( LARGE_FONT_SIZE );
634             printY += LARGE_FONT_SIZE - FONT_SIZE;
635         }
636         (void)OSGetFontWidth( &mailAddr[i], &width );
637         if ( g_screenWidth < (s16)(printX + width + (2 * FONT_SIZE)) )
638         {
639             printX = x;
640             printY += FONT_LEADING;
641         }
642         printX += DEMORFPrintf( printX, printY, 0, "%c", mailAddr[i] );
643     }
644     SetFontColor( CLR_WHITE );
645     SetFontSize( FONT_SIZE );
646     return;
647 }
648 
649 /*======== End of FLViewerRender.c ========*/
650