VFF
This is an old revision of this page, as edited by Yellows8 (talk | contribs) at 16:01, 7 June 2010. It may differ significantly from the current revision. |
VFF is a "virtual FAT filesystem", which is used as a container for primarily WC24 downloaded content, as well as E-Mail storage.
Header
Start | Length | Typical value | Description |
---|---|---|---|
0 | 4 | 'VFF ' | 4-byte magic |
4 | 2 | feff | Byte-order-marker? |
6 | 2 | 0100 | ? (2's complement of previous field ?) |
8 | 4 | 01400000 | Total file size |
12 | 2 | 0020 | Size of header |
14 | 18 | zeroes | padding |
Following the header is two FATs, which are FAT16. Each FAT size is determined by the below algo. The format of the FAT is not regular FAT16, there's unknown flags and values, so it's currently not possible to process cluster chains. Following the FATs is the root directory cluster, 0x1000 bytes long. Following the root cluster is the data "clusters". The data "clusters" have are 0x200 bytes long each. The size of the FAT is determined by the following algorithm:
u32 WC24_GetVFF_FATSize(u32 filesize) { if(filesize < 0x100000) {//This block is executed for filesizes less than 1MB. u32 base = (filesize / 0x200) - 8; u32 fatsz = base; if(base % 0x200)//Should always be executed. { if(base<0x200) { fatsz = 0x200; } else { fatsz++; } } return fatsz; } else { return filesize >> 8;//VFF files larger than 1MB must be aligned to a MB, since this algo doesn't work right with filesizes not aligned. } }