1 /*---------------------------------------------------------------------------*
2   Project:  CARD utilities
3   File:     CARDUtil.h
4 
5   Copyright 2000-2001 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: cardutil.h,v $
14   Revision 1.2  02/20/2006 04:13:08  mitu
15   changed include path from dolphin/ to revolution/.
16 
17   Revision 1.1  01/31/2006 10:48:30  mitu
18   (none)
19 
20 
21     5     7/13/01 12:03:00 Shiki
22     Moved demo specified CARDUTIL_CMD_ to listdemo.c.
23 
24     4     5/24/01 8:53a Shiki
25     Removed #include <private/CARDDir.h>.
26 
27     3     5/18/01 5:07p Shiki
28     Added CardUtilGetProgress().
29 
30     2     01/04/25 14:33 Shiki
31     Added size param to CardUtilDrawIcon().
32 
33     1     01/04/23 17:18 Shiki
34     Initial check-in.
35   $NoKeywords: $
36  *---------------------------------------------------------------------------*/
37 
38 #include <string.h>
39 #include <demo.h>
40 #include <revolution/card.h>
41 
42 static void DrawIcon(s16 x, s16 y, void* image, void* tlut, u16 width, u16 height, int format);
43 
44 enum
45 {
46     CARDUTIL_CMD_NONE = 0,
47     CARDUTIL_CMD_MOUNT,
48     CARDUTIL_CMD_UNMOUNT,
49     CARDUTIL_CMD_FORMAT,
50     CARDUTIL_CMD_LIST,
51     CARDUTIL_CMD_ERASE,
52     CARDUTIL_CMD_OPEN,
53     CARDUTIL_CMD_SAVE
54 };
55 
56 typedef struct CardUtilDirent
57 {
58     u8          buffer[2 * (CARD_BANNER_WIDTH * CARD_BANNER_HEIGHT +
59                        CARD_ICON_MAX * CARD_ICON_WIDTH * CARD_ICON_HEIGHT) +
60                        CARD_READ_SIZE];
61 
62     char        comment[CARD_COMMENT_SIZE];
63 
64     int         fileNo;
65     CARDStat    stat;
66 
67     int         cFrame;                         // total # of icon animation frames
68     int         nFrame[2 * CARD_ICON_MAX - 2];  // start frame number of each icon
69     int         iIcon[2 * CARD_ICON_MAX - 2];   // icon # of each icon
70 
71     u8          padding[28];
72 } CardUtilDirent;   // 32 byte aligned
73 
74 void CardUtilInit      ( void* stackBase, u32 stackSize, OSPriority prio );
75 
76 s32 CardUtilResultCode ( void );
77 s32 CardUtilMount      ( s32 slot, void* workArea );
78 s32 CardUtilUnmount    ( s32 slot );
79 s32 CardUtilList       ( s32 slot, CardUtilDirent* directory );
80 s32 CardUtilFormat     ( s32 slot );
81 s32 CardUtilErase      ( s32 slot, s32 fileNo );
82 s32 CardUtilOpen       ( s32 slot, s32 fileNo, void* buffer );
83 s32 CardUtilSave       ( s32 slot, CARDStat* stat, void* buffer );
84 s32 CardUtilGetProgress( s32 slot );
85 
86 s32 CardUtilByteNotUsed  ( void );
87 s32 CardUtilBlocksNotUsed( void );
88 s32 CardUtilFilesNotUsed ( void );
89 s32 CardUtilSectorSize   ( void );
90 
91 s32 CardUtilLockDirectory   ( void );
92 void CardUtilUnlockDirectory( void );
93 s32 CardUtilNumFiles        ( void );
94 
95 void CardUtilDrawIcon        ( int x, int y, int size, void* image, void* tlut, u16 width, u16 height, int format );
96 void CardUtilDrawAnimatedIcon( CardUtilDirent* ent, int x, int y, int size );
97