mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Implement sector tag types.
This commit is contained in:
@@ -1070,7 +1070,7 @@ typedef struct ImageInfo
|
|||||||
/** Firmware revision of the drive used to read the media represented by the image */
|
/** Firmware revision of the drive used to read the media represented by the image */
|
||||||
uint8_t *DriveFirmwareRevision;
|
uint8_t *DriveFirmwareRevision;
|
||||||
/** Type of the media represented by the image to use in XML sidecars */
|
/** Type of the media represented by the image to use in XML sidecars */
|
||||||
int32_t XmlMediaType;
|
uint8_t XmlMediaType;
|
||||||
// CHS geometry...
|
// CHS geometry...
|
||||||
/** Cylinders of the media represented by the image */
|
/** Cylinders of the media represented by the image */
|
||||||
uint32_t Cylinders;
|
uint32_t Cylinders;
|
||||||
@@ -1080,6 +1080,28 @@ typedef struct ImageInfo
|
|||||||
uint32_t SectorsPerTrack;
|
uint32_t SectorsPerTrack;
|
||||||
} ImageInfo;
|
} ImageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
/// Metadata present for each sector (aka, "tag").
|
||||||
|
/// */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
AppleSectorTag = 0,/** Apple's GCR sector tags, 12 bytes */
|
||||||
|
CdSectorSync = 1, /** Sync frame from CD sector, 12 bytes */
|
||||||
|
CdSectorHeader = 2, /** CD sector header, 4 bytes */
|
||||||
|
CdSectorSubHeader = 3, /** CD mode 2 sector subheader */
|
||||||
|
CdSectorEdc = 4, /** CD sector EDC, 4 bytes */
|
||||||
|
CdSectorEccP = 5, /** CD sector ECC P, 172 bytes */
|
||||||
|
CdSectorEccQ = 6, /** CD sector ECC Q, 104 bytes */
|
||||||
|
CdSectorEcc = 7, /** CD sector ECC (P and Q), 276 bytes */
|
||||||
|
CdSectorSubchannelDic = 8, /** CD sector subchannel, 96 bytes */
|
||||||
|
CdTrackIsrc = 9, /** CD track ISRC, string, 12 bytes */
|
||||||
|
CdTrackText = 10,/** CD track text, string, 13 bytes */
|
||||||
|
CdTrackFlags = 11, /** CD track flags, 1 byte */
|
||||||
|
DvdCmi = 12, /** DVD sector copyright information */
|
||||||
|
FloppyAddressMark = 13,/** Floppy address mark (contents depend on underlying floppy format) */
|
||||||
|
MaxSectorTag = FloppyAddressMark
|
||||||
|
} SectorTagType;
|
||||||
|
|
||||||
|
|
||||||
#endif //LIBDICFORMAT_DIC_H
|
#endif //LIBDICFORMAT_DIC_H
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ typedef struct dicformatContext
|
|||||||
CdEccContext *eccCdContext;
|
CdEccContext *eccCdContext;
|
||||||
uint8_t numberOfDataTracks;
|
uint8_t numberOfDataTracks;
|
||||||
TrackEntry *dataTracks;
|
TrackEntry *dataTracks;
|
||||||
|
bool *readableSectorTags;
|
||||||
} dicformatContext;
|
} dicformatContext;
|
||||||
|
|
||||||
typedef struct dataLinkedList
|
typedef struct dataLinkedList
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ int close(void *context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(ctx->readableSectorTags);
|
||||||
|
|
||||||
free(context);
|
free(context);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
51
src/open.c
51
src/open.c
@@ -100,6 +100,18 @@ void *open(const char *filepath)
|
|||||||
ctx->header.imageMajorVersion,
|
ctx->header.imageMajorVersion,
|
||||||
ctx->header.imageMinorVersion);
|
ctx->header.imageMinorVersion);
|
||||||
|
|
||||||
|
ctx->readableSectorTags = (bool *)malloc(sizeof(bool) * MaxSectorTag);
|
||||||
|
|
||||||
|
if(ctx->readableSectorTags == NULL)
|
||||||
|
{
|
||||||
|
free(ctx);
|
||||||
|
errno = DICF_ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(ctx->readableSectorTags, 0, sizeof(bool) * MaxSectorTag);
|
||||||
|
|
||||||
ctx->imageInfo.Application = ctx->header.application;
|
ctx->imageInfo.Application = ctx->header.application;
|
||||||
ctx->imageInfo.ApplicationVersion = (uint8_t *)malloc(32);
|
ctx->imageInfo.ApplicationVersion = (uint8_t *)malloc(32);
|
||||||
if(ctx->imageInfo.ApplicationVersion != NULL)
|
if(ctx->imageInfo.ApplicationVersion != NULL)
|
||||||
@@ -298,13 +310,8 @@ void *open(const char *filepath)
|
|||||||
else
|
else
|
||||||
ctx->sectorPrefix = data;
|
ctx->sectorPrefix = data;
|
||||||
|
|
||||||
// TODO: ReadableSectorTags
|
ctx->readableSectorTags[CdSectorSync] = true;
|
||||||
/*
|
ctx->readableSectorTags[CdSectorHeader] = true;
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
|
|
||||||
*/
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CdSectorSuffix:
|
case CdSectorSuffix:
|
||||||
@@ -314,35 +321,19 @@ void *open(const char *filepath)
|
|||||||
else
|
else
|
||||||
ctx->sectorSuffix = data;
|
ctx->sectorSuffix = data;
|
||||||
|
|
||||||
// TODO: ReadableSectorTags
|
ctx->readableSectorTags[CdSectorSubHeader] = true;
|
||||||
/*
|
ctx->readableSectorTags[CdSectorEcc] = true;
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader))
|
ctx->readableSectorTags[CdSectorEccP] = true;
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader);
|
ctx->readableSectorTags[CdSectorEccQ] = true;
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEcc))
|
ctx->readableSectorTags[CdSectorEdc] = true;
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEcc);
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccP))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccP);
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccQ))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ);
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc);
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case CdSectorSubchannel:ctx->sectorSubchannel = data;
|
case CdSectorSubchannel:ctx->sectorSubchannel = data;
|
||||||
// TODO: ReadableSectorTags
|
ctx->readableSectorTags[CdSectorSubchannel] = true;
|
||||||
/*
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubchannel);
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case AppleProfileTag:
|
case AppleProfileTag:
|
||||||
case AppleSonyTag:
|
case AppleSonyTag:
|
||||||
case PriamDataTowerTag:ctx->sectorSubchannel = data;
|
case PriamDataTowerTag:ctx->sectorSubchannel = data;
|
||||||
// TODO: ReadableSectorTags
|
ctx->readableSectorTags[AppleSectorTag] = true;
|
||||||
/*
|
|
||||||
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
|
||||||
imageInfo.ReadableSectorTags.Add(SectorTagType.AppleSectorTag);
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case CompactDiscMode2Subheader:ctx->mode2Subheaders = data;
|
case CompactDiscMode2Subheader:ctx->mode2Subheaders = data;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user