CARDStat

C Specification

#include <revolution/card.h>
typedef struct CARDStat 
{
     // read-only (Set by CARDGetStatus)
     char fileName[CARD_FILENAME_MAX];
     u32  length;
     u32  time;           // seconds since midnight 01/01/2000
     u8   gameName[4];
     u8   company[2];

     // read/write (Set by CARDGetStatus/CARDSetStatus)
     u8   bannerFormat;
     u32  iconAddr;     
     u16  iconFormat;
     u16  iconSpeed;
     u32  commentAddr;

     // read-only (Set by CARDGetStatus)
     u32  offsetBanner;
     u32  offsetBannerTlut;
     u32  offsetIcon[CARD_ICON_MAX];
     u32  offsetIconTlut;
     u32  offsetData;
} CARDStat;

#define CARDGetBannerFormat(stat)       (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK)
#define CARDGetIconAnim(stat)           (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
#define CARDGetIconFormat(stat, n)      (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK)
#define CARDGetIconSpeed(stat, n)       (((stat)->iconSpeed  >> (2 * (n))) & CARD_STAT_SPEED_MASK)
#define CARDSetIconFormat(stat, n, f)   ((stat)->iconFormat = (u16) (((stat)->iconFormat & ~(CARD_STAT_ICON_MASK  << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconSpeed(stat, n, f)    ((stat)->iconSpeed  = (u16) (((stat)->iconSpeed  & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))

#define CARD_STAT_ICON_NONE     0
#define CARD_STAT_ICON_C8       1
#define CARD_STAT_ICON_RGB5A3   2
#define CARD_STAT_ICON_MASK     3

#define CARD_STAT_BANNER_NONE   0
#define CARD_STAT_BANNER_C8     1
#define CARD_STAT_BANNER_RGB5A3 2
#define CARD_STAT_BANNER_MASK   3

// .bannerFormat
#define CARD_STAT_ANIM_LOOP     0x00
#define CARD_STAT_ANIM_BOUNCE   0x04
#define CARD_STAT_ANIM_MASK     0x04

#define CARD_STAT_SPEED_END     0
#define CARD_STAT_SPEED_FAST    1
#define CARD_STAT_SPEED_MIDDLE  2
#define CARD_STAT_SPEED_SLOW    3
#define CARD_STAT_SPEED_MASK    3

Description

The CARDStat data structure represents the status of a file.

gameName Game code.
company Company code.
length File length in bytes.
fileName File name. fileName is not shown on the card menu screen.
time Last access time in seconds since midnight 1/1/2000.
bannerFormat One CARD_STAT_BANNER_* ORed with one CARD_STAT_ANIM_*. Referred by the CARDGetBannerFormat and CARDGetIconAnim functions.
iconAddr File offset to the banner/icon data. iconAddr must be 0xffffffff (no icon) or less than CARD_READ_SIZE. At least one icon is required in a game file.
iconFormat bit 1-0: Icon 0 format (one CARD_STAT_ICON_*).
bit 3-2: Icon 1 format (one CARD_STAT_ICON_*).
bit 5-4: Icon 2 format (one CARD_STAT_ICON_*).
bit 7-6: Icon 3 format (one CARD_STAT_ICON_*).
bit 9-8: Icon 4 format (one CARD_STAT_ICON_*).
bit 11-10: Icon 5 format (one CARD_STAT_ICON_*).
bit 13-12: Icon 6 format (one CARD_STAT_ICON_*).
bit 15-14: Icon 7 format (one CARD_STAT_ICON_*).
Referred by the CARDGetIconFormat/CARDSetIconFormat function.
iconSpeed bit 1-0: Icon 0 speed (one CARD_STAT_SPEED_*).
bit 3-2: Icon 1 speed (one CARD_STAT_SPEED_*).
bit 5-4: Icon 2 speed (one CARD_STAT_SPEED_*).
bit 7-6: Icon 3 speed (one CARD_STAT_SPEED_*).
bit 9-8: Icon 4 speed (one CARD_STAT_SPEED_*).
bit 11-10: Icon 5 speed (one CARD_STAT_SPEED_*).
bit 13-12: Icon 6 speed (one CARD_STAT_SPEED_*).
bit 15-14: Icon 7 speed (one CARD_STAT_SPEED_*).
Referred by the CARDGetIconSpeed/CARDSetIconSpeed function.
commentAddr File offset to two pairs of '\0'-terminated 32-byte (including the terminating '\0) file description strings. Both strings are shown on the card menu screen. The 64-byte comment data must not cross the 8-KB boundary of the file (i.e., the comment data must fit an 8KB block of the file).
offsetBanner File offset to the banner texture.
offsetBannerTlut File offset to TLUT of the banner texture.
offsetIcon[n] File offset to the nth icon texture.
offsetIconTlut File offset to the TLUT of the icon.
offsetData File offset to the byte next to the end of the icon/banner data.

See Also

Card Functions,
CARDGetStatus, CARDSetStatus, CARDSetStatusAsync,

Revision History

03/01/2006 Initial version.