]> Shamusworld >> Repos - wozmaker/blobdiff - src/fileio.h
Move saving code to fileio, add WOZ2 support, misc. DSP tweaks.
[wozmaker] / src / fileio.h
index 0ee24d276f10dcac6eafa044cbc597390e8e7adf..3b42dbf02cf7cf3b5b0d8a74675834983ae4a156 100644 (file)
@@ -92,10 +92,55 @@ struct WOZ
        WOZTrack track[];               // Variable length array for the track data proper
 };
 
+struct WOZTrack2
+{
+       uint16_t startingBlock; // 512 byte block # where this track starts (relative to the start of the file)
+       uint16_t blockCount;    // # of blocks in this track
+       uint32_t bitCount;              // # of bits in this track
+};
+
+struct WOZ2
+{
+       // Header
+       uint8_t magic1[4];              // "WOZ1"
+       uint8_t magic2[4];              // $FF $0A $0D $0A
+       uint32_t crc32;                 // CRC32 of the remaining data in the file
+
+       // INFO chunk
+       uint8_t infoTag[4];             // "INFO"
+       uint32_t infoSize;              // Always 60 bytes long
+       uint8_t infoVersion;    // Currently 1
+       uint8_t diskType;               // 1 = 5 1/4", 2 = 3 1/2"
+       uint8_t writeProtected; // 1 = write protected disk
+       uint8_t synchronized;   // 1 = cross-track sync was used during imaging
+       uint8_t cleaned;                // 1 = fake bits removed from image
+       uint8_t creator[32];    // Software that made this image, padded with 0x20
+       uint8_t diskSides;              // 5 1/4" disks always have 1 side (v2 from here on)
+       uint8_t bootSectorFmt;  // 5 1/4" only (0=unknown, 1=16 sector, 2=13 sector, 3=both)
+       uint8_t optimalBitTmg;  // In ticks, standard for 5 1/4" is 32 (4 µs)
+       uint16_t compatibleHW;  // Bitfield showing hardware compatibility (1=][, 2=][+, 4=//e (unenh), 8=//c, 16=//e (enh), 32=IIgs, 64=//c+, 128=///, 256=///+)
+       uint16_t requiredRAM;   // Minimum size in K, 0=unknown
+       uint16_t largestTrack;  // Number of 512 byte blocks used by largest track
+       uint8_t pad1[14];               // Padding to 60 bytes
+
+       // TMAP chunk
+       uint8_t tmapTag[4];             // "TMAP"
+       uint32_t tmapSize;              // Always 160 bytes long
+       uint8_t tmap[160];              // Track map, with empty tracks set to $FF
+
+       // TRKS chunk
+       uint8_t trksTag[4];             // "TRKS"
+       uint32_t trksSize;              // Varies, depending on # of tracks imaged
+       WOZTrack2 track[160];   // Actual track info (corresponding to TMAP data)
+       uint8_t data[];                 // Variable length array for the track data proper
+};
+
 
 // Exported functions
 uint32_t CRC32(const uint8_t * data, uint32_t length);
 uint8_t * ReadFile(const char * filename, uint32_t * size);
+bool LoadA2R(const char * filename);
+bool WriteWOZFile(const char * filename);
 
 
 // Inline functions ("get" functions--need to write "set" functions)