VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I just wonder how my sdfimg dynamic disk image format compares to other used formats used by other emulators(sparse disk image formats).

It uses a disk header with basic information on the disk image, one or more lookup tables (three level lookup tables to address up to 2TB, each lookup table representing 1024, 1024 and 4096 sector locations (The primary index of the primary table(1024 items) gives the location of the secondary table(1024 items), the secondary index gives the location of the tertiary table(4096 items), the tertiary index giving the location of the sector. A location of 0 means the sector or table isn't allocated yet. The location of the primary table is set in the image header when it's allocated. The final position of the last valid data allocated (512 bytes for a sector, 8KB for a table contains 1024 locations and 32KB for a table containing 4096 locations). A disk image without anything added yet only contains a header, with the end position(effective filesize to use in case of erroneous file size because of a failed fwrite) set to the size of the header and primary table location set to 0 to indicate no primary table exists yet (in the same fashion primary, secondary and tertiary table items work). Allocated data is allocated in whole blocks (512 bytes, 8KB and 32KB which by default is zeroed out until indexes are updated). Indexes are updated by locating the start of the table (calculated or taken from another lookup table or header(primary table) for the start location, adding 8 times the index to read(64-bit file index) and reading(when retrieving) or writing(when updating) the 64-bit value from/to the file.

Disk image header:

typedef struct
{
byte SIG[7]; //SFDIMG\0
uint_32 headersize; //The size of this header!
int_64 filesize; //The size of the dynamic image, in sectors.
word sectorsize; //The size of a sector (512)
int_64 firstlevellocation; //The location of the first level, in bytes!
int_64 currentsize; //The current file size, in bytes!
} DYNAMICIMAGE_HEADER; //Dynamic image .DAT header.

Anyone knows the other formats used by the other emulators and knows if the format used by my sfdimg disk structure is efficient?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 1, by vladstamate

User metadata
Rank Oldbie
Rank
Oldbie

Your format seems pretty good, definitely well thought out. I went with supporting VHD because I wanted to support a format that other VMs support, and this one is virtually supported by all of them (VirtualBox, VMWare, Parallels, etc) so I can exchange disks. Also Windows (and I think MacOSX too) mounts it naturally, so I can copy games, software to it before mounting it in my emulator.

Now I've only implemented support for the fixed disk format however if you check the spec (https://msdn.microsoft.com/en-us/librar ... s.85).aspx) it has support for dynamic (sparse) format, as well as differential format (which I am actually quite interested in adding support for). You can have a look at the spec and and see how it compares to your format.

YouTube channel: https://www.youtube.com/channel/UC7HbC_nq8t1S9l7qGYL0mTA
Collection: http://www.digiloguemuseum.com/index.html
Emulator: https://sites.google.com/site/capex86/
Raytracer: https://sites.google.com/site/opaqueraytracer/