changeset 133:9cfa0553e7f9

Add support for reading PSID/RSID v4 in sidlib.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 02 Jun 2017 02:39:15 +0300
parents b3e034b8c4b9
children b9a3f93f69d1
files sidlib.c sidlib.h
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sidlib.c	Fri Jun 02 02:38:41 2017 +0300
+++ b/sidlib.c	Fri Jun 02 02:39:15 2017 +0300
@@ -92,7 +92,7 @@
 
     if ((psid->magic[0] != 'R' && psid->magic[0] != 'P') ||
         psid->magic[1] != 'S' || psid->magic[2] != 'I' || psid->magic[3] != 'D' ||
-        psid->version < 1 || psid->version > 3)
+        psid->version < 1 || psid->version > 4)
     {
         th_io_error(ctx, THERR_NOT_SUPPORTED,
             "Not a supported PSID or RSID file.\n");
@@ -118,7 +118,8 @@
         if (!thfread_be16(ctx, &psid->flags) ||
             !thfread_u8(ctx, &psid->startPage) ||
             !thfread_u8(ctx, &psid->pageLength) ||
-            !thfread_be16(ctx, &psid->reserved))
+            !thfread_u8(ctx, &psid->sid2Addr) ||
+            !thfread_u8(ctx, &psid->sid3Addr))
         {
             th_io_error(ctx, ctx->status,
                 "Error reading PSID/RSID v2+ extra header data: %s.\n",
--- a/sidlib.h	Fri Jun 02 02:38:41 2017 +0300
+++ b/sidlib.h	Fri Jun 02 02:39:15 2017 +0300
@@ -58,7 +58,7 @@
     // PSIDv2 data
     uint16_t flags;      // Flags
     uint8_t  startPage, pageLength;
-    uint16_t reserved;
+    uint8_t  sid2Addr, sid3Addr;
 
     // Extra data
     BOOL isRSID;