Discussion about a little WBFS extension
Each WBFS partition/file has an internal data structure for each disc. I call this info area wbfs inode or short inode. Each inode consists of 2 parts:
My idea: Only some bytes of the disc header copy are needed by usb loaders and wbfs managers. The second half of the disc header copy is completely senseless. And so I want to use this second half to hold more infos.
And this is my first idea:
Constructive ideas and discussions are welcome. Flames like 'FAT is better' are not constructive!
Each WBFS partition/file has an internal data structure for each disc. I call this info area wbfs inode or short inode. Each inode consists of 2 parts:
- A copy of the first 256 bytes of the disc. This parts contains ID, name, language and some more infos.
- The block mapping (Wii block -> WBFS block)
My idea: Only some bytes of the disc header copy are needed by usb loaders and wbfs managers. The second half of the disc header copy is completely senseless. And so I want to use this second half to hold more infos.
And this is my first idea:
Code:
// Some definitions. The inode is located in the padding area of the ISO header
// see http://www.wiibrew.org/wiki/Wiidisc#Header for more details
#define WBFS_INODE_INFO_VERSIONÂÂÂÂÂÂÂÂ 1
#define WBFS_INODE_INFO_HEAD_SIZEÂÂÂÂ12
#define WBFS_INODE_INFO_HEAD_CMP_SIZEÂÂÂÂ10
#define WBFS_INODE_INFO_OFFÂÂÂÂÂÂÂÂ0x80
#define WBFS_INODE_INFO_SIZEÂÂÂÂÂÂÂÂ(0x100-WBFS_INODE_INFO_OFF)
// all binary data are store in network byte order (big endian)
typedef struct wbfs_inode_info_s
{
ÂÂÂÂ// A complete copy of the first WBFS_INODE_INFO_HEAD_SIZE (12) bytes
ÂÂÂÂ// of the WBFS header. The first WBFS_INODE_INFO_HEAD_CMP_SIZE (10)
ÂÂÂÂ// bytes can be used to validate the existence of this info block.
ÂÂÂÂ// They are also good for recovery.
ÂÂÂÂbe32_t magic;ÂÂÂÂÂÂÂÂ// the magic (char*)"WBFS"
ÂÂÂÂbe32_t n_hd_sec;ÂÂÂÂ// total number of hd_sec in this partition
ÂÂÂÂu8ÂÂhd_sec_sz_s;ÂÂÂÂ// sector size in this partition
ÂÂÂÂu8ÂÂwbfs_sec_sz_s;ÂÂÂÂ// size of a wbfs sec
ÂÂÂÂu8ÂÂwbfs_version;ÂÂÂÂ// informative version number
ÂÂÂÂu8ÂÂhead_padding;
ÂÂÂÂ// The version number of this data structure.
ÂÂÂÂ// I may be importand for future extensions
ÂÂÂÂbe32_t info_version;ÂÂÂÂ// == 1
ÂÂÂÂ// 64 bit time stamps: They are only informative but nice to have.
ÂÂÂÂ//ÂÂ- itime is ths disc inserting time.
ÂÂÂÂ//ÂÂÂÂIf 2 discs uses the same wbfs block a repair function knows
ÂÂÂÂ//ÂÂÂÂwhich one disc are newer and which is definitly bad.
ÂÂÂÂ//ÂÂ- mtime is a copy of the mtime of the source file.
ÂÂÂÂ//ÂÂÂÂIt is also changed if the the ISO-header is modified (renamed).
ÂÂÂÂ//ÂÂÂÂWhile extrating the mtime of dest file is set by this mtime.
ÂÂÂÂ//ÂÂ- ctime is updated if adding, renaming.
ÂÂÂÂ//ÂÂ- atime can be updated by usb loaders when loading the disc.
ÂÂÂÂ//ÂÂ- dtime is only set for deleted games.
ÂÂÂÂbe64_t itime;ÂÂÂÂÂÂÂÂ// the disc insertion time
ÂÂÂÂbe64_t mtime;ÂÂÂÂÂÂÂÂ// the last modification time (copied from source)
ÂÂÂÂbe64_t ctime;ÂÂÂÂÂÂÂÂ// the last status changed time
ÂÂÂÂbe64_t atime;ÂÂÂÂÂÂÂÂ// the last access time
ÂÂÂÂbe64_t dtime;ÂÂÂÂÂÂÂÂ// the deletion time
ÂÂÂÂ// there is enough space for more information like a game load counter
ÂÂÂÂ// or other statistics and game settings. This infos can be share across
ÂÂÂÂ// usb loaders.
ÂÂÂÂ// EXAMPLES:
ÂÂÂÂ//ÂÂÂÂbe32_tÂÂÂÂload_count;
ÂÂÂÂ//ÂÂÂÂu8ÂÂÂÂfavorite
ÂÂÂÂ//ÂÂÂÂu8ÂÂÂÂios
ÂÂÂÂ// padding up to WBFS_INODE_INFO_SIZE bytes, always filled with zeros
ÂÂÂÂu8 padding[ WBFS_INODE_INFO_SIZE - WBFS_INODE_INFO_HEAD_SIZE
ÂÂÂÂÂÂÂÂÂÂÂÂ- 0 /* num ofÂÂ8 bit parameters */ * sizeof(u8)
ÂÂÂÂÂÂÂÂÂÂÂÂ- 0 /* num of 16 bit parameters */ * sizeof(be16_t)
ÂÂÂÂÂÂÂÂÂÂÂÂ- 1 /* num of 32 bit parameters */ * sizeof(be32_t)
ÂÂÂÂÂÂÂÂÂÂÂÂ- 5 /* num of 64 bit parameters */ * sizeof(be64_t) ];
} wbfs_inode_info_t;
// sizeof(wbfs_inode_info_t) == WBFS_INODE_INFO_SIZE
Constructive ideas and discussions are welcome. Flames like 'FAT is better' are not constructive!