]> Shamusworld >> Repos - apple2/blobdiff - src/fileio.cpp
Docs were missing GPLv3. Thanks to schampailler for the heads up. :-)
[apple2] / src / fileio.cpp
index ccda0d71369582574fa3c27e2f6624a2bd4953cf..1048be90dfc26fac4996535d310f53f36d78a078 100644 (file)
@@ -33,7 +33,7 @@ uint8_t standardTMAP[160] = {
 //
 // sizePtr is optional
 //
-uint8_t * ReadFile(const char * filename, uint32_t * sizePtr/*= NULL*/)
+uint8_t * ReadFile(const char * filename, uint32_t * sizePtr/*= NULL*/, uint32_t skip/*= 0*/)
 {
        FILE * fp = fopen(filename, "rb");
 
@@ -44,6 +44,12 @@ uint8_t * ReadFile(const char * filename, uint32_t * sizePtr/*= NULL*/)
        uint32_t size = ftell(fp);
        fseek(fp, 0, SEEK_SET);
 
+       if (skip > 0)
+       {
+               fseek(fp, skip, SEEK_CUR);
+               size -= skip;
+       }
+
        uint8_t * buffer = (uint8_t *)malloc(size);
        fread(buffer, 1, size, fp);
        fclose(fp);
@@ -199,7 +205,8 @@ bool CheckWOZIntegrity(const uint8_t * wozData, uint32_t wozSize)
        else if (wozCRC == 0)
                WriteLog("FILEIO: Warning--WOZ file has no CRC...\n");
 
-#if 0 // Need to fix this so it works with both 1 & 2 (works with only 1 ATM)
+#if 1
+       // Need to fix this so it works with both 1 & 2 (works with only 1 ATM)
        WriteLog("Track map:\n");
        WriteLog("                                        1   1   1   1   1   1   1   1\n");
        WriteLog("0.,.1.,.2.,.3.,.4.,.5.,.6.,.7.,.8.,.9.,.0.,.1.,.2.,.3.,.4.,.5.,.6.,.7.,.\n");
@@ -242,6 +249,7 @@ bool CheckWOZIntegrity(const uint8_t * wozData, uint32_t wozSize)
 
        WriteLog("\n");
 
+#if 0
        uint8_t numTracks = woz.trksSize / sizeof(WOZ1Track);
 
        // N.B.: Need to check the track in tmap[] to have this tell the correct track...  Right now, it doesn't
@@ -249,6 +257,7 @@ bool CheckWOZIntegrity(const uint8_t * wozData, uint32_t wozSize)
        {
                WriteLog("WOZ: Stream %u: %d bits (packed into %d bytes)\n", i, woz.track[i].bitCount, (woz.track[i].bitCount + 7) / 8);
        }
+#endif
 #endif
 
        WriteLog("FILEIO: Well formed WOZ file found\n");