mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
General refactor and cleanup.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# libaaruformat
|
||||
|
||||
C implementation of [Aaru](https://www.github.com/aaru-dps/Aaru) file format.
|
||||
|
||||
Work in progress, don't expect it to work yet.
|
||||
@@ -9,6 +10,7 @@ This means any hash or compression algorithm must be statically linked inside th
|
||||
cmake is not a hard dependency, it's merely for the ease of using IDEs (specifically CLion).
|
||||
|
||||
Things still to be implemented that are already in the C# version:
|
||||
|
||||
- Tape file blocks
|
||||
- Automatic media type generation from C# enumeration
|
||||
- Nuget package for linking with Aaru
|
||||
@@ -17,6 +19,7 @@ Things still to be implemented that are already in the C# version:
|
||||
- Deduplication (requires SHA256)
|
||||
|
||||
Things to be implemented not in the C# version:
|
||||
|
||||
- Compile for Dreamcast (KallistiOS preferibly)
|
||||
- Compile for PlayStation Portable
|
||||
- Compile for Wii
|
||||
|
||||
@@ -232,7 +232,8 @@ const static uint64_t crc64_table[4][256] = {
|
||||
0xA0A13C6791602FF9, 0xBD4FB639B34C8E25, 0x9B7C28DBD5396C41, 0x8692A285F715CD9D, 0xD71B151F19D2A889,
|
||||
0xCAF59F413BFE0955, 0xECC601A35D8BEB31, 0xF1288BFD7FA74AED, 0x4FD56E9680052119, 0x523BE4C8A22980C5,
|
||||
0x74087A2AC45C62A1, 0x69E6F074E670C37D, 0x386F47EE08B7A669, 0x2581CDB02A9B07B5, 0x03B253524CEEE5D1,
|
||||
0x1E5CD90C6EC2440D}};
|
||||
0x1E5CD90C6EC2440D}
|
||||
};
|
||||
|
||||
#define CRC64_ECMA_POLY 0xC96C5795D7870F42
|
||||
#define CRC64_ECMA_SEED 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
@@ -74,9 +74,7 @@ AARU_EXPORT void AARU_CALL aaruf_crc64_slicing(uint64_t* previous_crc, con
|
||||
AARU_EXPORT uint64_t AARU_CALL aaruf_crc64_data(const uint8_t *data, uint32_t len);
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_read_sector(void *context, uint64_t sectorAddress, uint8_t *data, uint32_t *length);
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void* context,
|
||||
uint64_t sectorAddress,
|
||||
uint8_t* data,
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void *context, uint64_t sectorAddress, uint8_t *data,
|
||||
uint32_t *length);
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_verify_image(void *context);
|
||||
@@ -91,36 +89,18 @@ AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct(void* context, const u
|
||||
|
||||
AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector);
|
||||
|
||||
AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_check(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint32_t majorCount,
|
||||
uint32_t minorCount,
|
||||
uint32_t majorMult,
|
||||
uint32_t minorInc,
|
||||
const uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
int32_t eccOffset);
|
||||
AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data,
|
||||
uint32_t majorCount, uint32_t minorCount, uint32_t majorMult,
|
||||
uint32_t minorInc, const uint8_t *ecc, int32_t addressOffset,
|
||||
int32_t dataOffset, int32_t eccOffset);
|
||||
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint32_t majorCount,
|
||||
uint32_t minorCount,
|
||||
uint32_t majorMult,
|
||||
uint32_t minorInc,
|
||||
uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
int32_t eccOffset);
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data,
|
||||
uint32_t majorCount, uint32_t minorCount, uint32_t majorMult,
|
||||
uint32_t minorInc, uint8_t *ecc, int32_t addressOffset,
|
||||
int32_t dataOffset, int32_t eccOffset);
|
||||
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write_sector(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data,
|
||||
uint8_t *ecc, int32_t addressOffset, int32_t dataOffset,
|
||||
int32_t eccOffset);
|
||||
|
||||
AARU_LOCAL void AARU_CALL aaruf_cd_lba_to_msf(int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame);
|
||||
@@ -131,8 +111,8 @@ AARU_EXPORT void AARU_CALL aaruf_ecc_cd_reconstruct(void* context, uint8_t* sect
|
||||
|
||||
AARU_EXPORT uint32_t AARU_CALL aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos);
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL
|
||||
aaruf_read_track_sector(void* context, uint8_t* data, uint64_t sectorAddress, uint32_t* length, uint8_t track);
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, uint64_t sectorAddress,
|
||||
uint32_t *length, uint8_t track);
|
||||
|
||||
AARU_LOCAL int32_t AARU_CALL aaruf_get_media_tag_type_for_datatype(int32_t type);
|
||||
|
||||
@@ -148,48 +128,23 @@ AARU_LOCAL void roll_hash(spamsum_ctx* ctx, uint8_t c);
|
||||
AARU_LOCAL void fuzzy_try_reduce_blockhash(spamsum_ctx *ctx);
|
||||
AARU_LOCAL void fuzzy_try_fork_blockhash(spamsum_ctx *ctx);
|
||||
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t* dst_buffer,
|
||||
size_t dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t src_size);
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
|
||||
const uint8_t *src_buffer, size_t src_size);
|
||||
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(uint8_t* dst_buffer,
|
||||
size_t dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t src_size,
|
||||
uint32_t blocksize,
|
||||
int32_t do_mid_side_stereo,
|
||||
int32_t loose_mid_side_stereo,
|
||||
const char* apodization,
|
||||
uint32_t max_lpc_order,
|
||||
uint32_t qlp_coeff_precision,
|
||||
int32_t do_qlp_coeff_prec_search,
|
||||
int32_t do_exhaustive_model_search,
|
||||
uint32_t min_residual_partition_order,
|
||||
uint32_t max_residual_partition_order,
|
||||
const char* application_id,
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(
|
||||
uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize,
|
||||
int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order,
|
||||
uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search,
|
||||
uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
|
||||
uint32_t application_id_len);
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t* dst_buffer,
|
||||
size_t* dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t* src_size,
|
||||
const uint8_t* props,
|
||||
size_t propsSize);
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
|
||||
size_t *src_size, const uint8_t *props, size_t propsSize);
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t* dst_buffer,
|
||||
size_t* dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t src_size,
|
||||
uint8_t* outProps,
|
||||
size_t* outPropsSize,
|
||||
int32_t level,
|
||||
uint32_t dictSize,
|
||||
int32_t lc,
|
||||
int32_t lp,
|
||||
int32_t pb,
|
||||
int32_t fb,
|
||||
int32_t numThreads);
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
|
||||
size_t src_size, uint8_t *outProps, size_t *outPropsSize,
|
||||
int32_t level, uint32_t dictSize, int32_t lc, int32_t lp,
|
||||
int32_t pb, int32_t fb, int32_t numThreads);
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
|
||||
defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/bswap.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(__BSWAP_RENAME) && !defined(__bswap_32)
|
||||
#define bswap_16(x) bswap16(x)
|
||||
#define bswap_32(x) bswap32(x)
|
||||
|
||||
@@ -77,8 +77,7 @@ AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previ
|
||||
vld1q_u32((const uint32_t *)alignedData)); // Use a signed shift right to create a mask with the sign bit
|
||||
const uint64x2_t data0 =
|
||||
vreinterpretq_u64_u8(vbslq_u8(vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_u64(leadInMask), 7)),
|
||||
vreinterpretq_u8_u64(b),
|
||||
vreinterpretq_u8_u64(a)));
|
||||
vreinterpretq_u8_u64(b), vreinterpretq_u8_u64(a)));
|
||||
|
||||
const uint64x2_t initialCrc = vsetq_lane_u64(~previous_crc, vdupq_n_u64(0), 0);
|
||||
|
||||
@@ -149,7 +148,8 @@ AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previ
|
||||
}
|
||||
|
||||
uint64x2_t P;
|
||||
if(len == 16) P = veorq_u64(accumulator, vreinterpretq_u64_u32(vld1q_u32((const uint32_t*)alignedData)));
|
||||
if(len == 16)
|
||||
P = veorq_u64(accumulator, vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)alignedData)));
|
||||
else
|
||||
{
|
||||
const uint64x2_t end0 =
|
||||
|
||||
53
src/ecc_cd.c
53
src/ecc_cd.c
@@ -139,17 +139,9 @@ bool aaruf_ecc_cd_is_suffix_correct_mode2(void* context, const uint8_t* sector)
|
||||
return calculatedEdc == storedEdc;
|
||||
}
|
||||
|
||||
bool aaruf_ecc_cd_check(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint32_t majorCount,
|
||||
uint32_t minorCount,
|
||||
uint32_t majorMult,
|
||||
uint32_t minorInc,
|
||||
const uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
int32_t eccOffset)
|
||||
bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, uint32_t majorCount,
|
||||
uint32_t minorCount, uint32_t majorMult, uint32_t minorInc, const uint8_t *ecc,
|
||||
int32_t addressOffset, int32_t dataOffset, int32_t eccOffset)
|
||||
{
|
||||
CdEccContext *ctx;
|
||||
uint32_t size, major, idx, minor;
|
||||
@@ -184,17 +176,9 @@ bool aaruf_ecc_cd_check(void* context,
|
||||
return true;
|
||||
}
|
||||
|
||||
void aaruf_ecc_cd_write(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint32_t majorCount,
|
||||
uint32_t minorCount,
|
||||
uint32_t majorMult,
|
||||
uint32_t minorInc,
|
||||
uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
int32_t eccOffset)
|
||||
void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, uint32_t majorCount,
|
||||
uint32_t minorCount, uint32_t majorMult, uint32_t minorInc, uint8_t *ecc, int32_t addressOffset,
|
||||
int32_t dataOffset, int32_t eccOffset)
|
||||
{
|
||||
CdEccContext *ctx;
|
||||
uint32_t size, major, idx, minor;
|
||||
@@ -229,13 +213,8 @@ void aaruf_ecc_cd_write(void* context,
|
||||
}
|
||||
}
|
||||
|
||||
void aaruf_ecc_cd_write_sector(void* context,
|
||||
const uint8_t* address,
|
||||
const uint8_t* data,
|
||||
uint8_t* ecc,
|
||||
int32_t addressOffset,
|
||||
int32_t dataOffset,
|
||||
int32_t eccOffset)
|
||||
void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc,
|
||||
int32_t addressOffset, int32_t dataOffset, int32_t eccOffset)
|
||||
{
|
||||
aaruf_ecc_cd_write(context, address, data, 86, 24, 2, 86, ecc, addressOffset, dataOffset, eccOffset); // P
|
||||
aaruf_ecc_cd_write(context, address, data, 52, 43, 86, 88, ecc, addressOffset, dataOffset, eccOffset + 0xAC); // Q
|
||||
@@ -249,8 +228,7 @@ void aaruf_cd_lba_to_msf(int64_t pos, uint8_t* minute, uint8_t* second, uint8_t*
|
||||
}
|
||||
|
||||
void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, // must point to a full 2352-byte sector
|
||||
uint8_t type,
|
||||
int64_t lba)
|
||||
uint8_t type, int64_t lba)
|
||||
{
|
||||
uint8_t minute, second, frame;
|
||||
|
||||
@@ -301,7 +279,8 @@ void aaruf_ecc_cd_reconstruct_prefix(uint8_t* sector, // must point to a full 23
|
||||
sector[0x012] = sector[0x016];
|
||||
sector[0x013] = sector[0x017];
|
||||
break;
|
||||
default: return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +316,8 @@ void aaruf_ecc_cd_reconstruct(void* context,
|
||||
computedEdc = aaruf_edc_cd_compute(context, 0, sector, 0x91C, 0x10);
|
||||
memcpy(sector + 0x92C, &computedEdc, 4);
|
||||
break;
|
||||
default: return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&zeroaddress, 0, 4);
|
||||
@@ -361,8 +341,11 @@ void aaruf_ecc_cd_reconstruct(void* context,
|
||||
sector[0x81B] = 0x00;
|
||||
aaruf_ecc_cd_write_sector(context, sector, sector, sector, 0xC, 0x10, 0x81C);
|
||||
break;
|
||||
case CdMode2Form1: aaruf_ecc_cd_write_sector(context, zeroaddress, sector, sector, 0, 0x10, 0x81C); break;
|
||||
default: return;
|
||||
case CdMode2Form1:
|
||||
aaruf_ecc_cd_write_sector(context, zeroaddress, sector, sector, 0, 0x10, 0x81C);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
70
src/flac.c
70
src/flac.c
@@ -27,19 +27,15 @@
|
||||
#include "../3rdparty/flac/include/FLAC/stream_encoder.h"
|
||||
#include "flac.h"
|
||||
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
read_callback(const FLAC__StreamDecoder* decoder, FLAC__byte buffer[], size_t* bytes, void* client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* decoder,
|
||||
const FLAC__Frame* frame,
|
||||
const FLAC__int32* const buffer[],
|
||||
static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
|
||||
size_t *bytes, void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame,
|
||||
const FLAC__int32 *const buffer[], void *client_data);
|
||||
static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status,
|
||||
void *client_data);
|
||||
static void
|
||||
error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
|
||||
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t* dst_buffer,
|
||||
size_t dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t src_size)
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
|
||||
const uint8_t *src_buffer, size_t src_size)
|
||||
{
|
||||
FLAC__StreamDecoder *decoder;
|
||||
FLAC__StreamDecoderInitStatus init_status;
|
||||
@@ -66,8 +62,8 @@ AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t* dst
|
||||
|
||||
FLAC__stream_decoder_set_md5_checking(decoder, false);
|
||||
|
||||
init_status = FLAC__stream_decoder_init_stream(
|
||||
decoder, read_callback, NULL, NULL, NULL, NULL, write_callback, NULL, error_callback, ctx);
|
||||
init_status = FLAC__stream_decoder_init_stream(decoder, read_callback, NULL, NULL, NULL, NULL, write_callback, NULL,
|
||||
error_callback, ctx);
|
||||
|
||||
if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK)
|
||||
{
|
||||
@@ -87,8 +83,8 @@ AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t* dst
|
||||
return ret_size;
|
||||
}
|
||||
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
read_callback(const FLAC__StreamDecoder* decoder, FLAC__byte buffer[], size_t* bytes, void* client_data)
|
||||
static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
|
||||
size_t *bytes, void *client_data)
|
||||
{
|
||||
aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
|
||||
|
||||
@@ -102,10 +98,8 @@ static FLAC__StreamDecoderReadStatus
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* decoder,
|
||||
const FLAC__Frame* frame,
|
||||
const FLAC__int32* const buffer[],
|
||||
void* client_data)
|
||||
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame,
|
||||
const FLAC__int32 *const buffer[], void *client_data)
|
||||
{
|
||||
aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
|
||||
size_t i;
|
||||
@@ -144,27 +138,14 @@ static void error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecod
|
||||
}
|
||||
|
||||
static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamEncoder *encoder,
|
||||
const FLAC__byte buffer[],
|
||||
size_t bytes,
|
||||
uint32_t samples,
|
||||
uint32_t current_frame,
|
||||
void* client_data);
|
||||
const FLAC__byte buffer[], size_t bytes, uint32_t samples,
|
||||
uint32_t current_frame, void *client_data);
|
||||
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(uint8_t* dst_buffer,
|
||||
size_t dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t src_size,
|
||||
uint32_t blocksize,
|
||||
int32_t do_mid_side_stereo,
|
||||
int32_t loose_mid_side_stereo,
|
||||
const char* apodization,
|
||||
uint32_t max_lpc_order,
|
||||
uint32_t qlp_coeff_precision,
|
||||
int32_t do_qlp_coeff_prec_search,
|
||||
int32_t do_exhaustive_model_search,
|
||||
uint32_t min_residual_partition_order,
|
||||
uint32_t max_residual_partition_order,
|
||||
const char* application_id,
|
||||
AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(
|
||||
uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize,
|
||||
int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order,
|
||||
uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search,
|
||||
uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
|
||||
uint32_t application_id_len)
|
||||
{
|
||||
FLAC__StreamEncoder *encoder;
|
||||
@@ -228,8 +209,8 @@ AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(uint8_t* dst
|
||||
|
||||
if(application_id_len > 0 && application_id != NULL)
|
||||
if((metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)) != NULL)
|
||||
FLAC__metadata_object_application_set_data(
|
||||
metadata[0], (unsigned char*)application_id, application_id_len, true);
|
||||
FLAC__metadata_object_application_set_data(metadata[0], (unsigned char *)application_id, application_id_len,
|
||||
true);
|
||||
|
||||
FLAC__stream_encoder_set_metadata(encoder, metadata, 1);
|
||||
|
||||
@@ -261,11 +242,8 @@ AARU_EXPORT size_t AARU_CALL aaruf_flac_encode_redbook_buffer(uint8_t* dst
|
||||
}
|
||||
|
||||
static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamEncoder *encoder,
|
||||
const FLAC__byte buffer[],
|
||||
size_t bytes,
|
||||
uint32_t samples,
|
||||
uint32_t current_frame,
|
||||
void* client_data)
|
||||
const FLAC__byte buffer[], size_t bytes, uint32_t samples,
|
||||
uint32_t current_frame, void *client_data)
|
||||
{
|
||||
aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
|
||||
|
||||
|
||||
216
src/helpers.c
216
src/helpers.c
@@ -25,76 +25,146 @@ int32_t aaruf_get_media_tag_type_for_datatype(int32_t type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case CompactDiscPartialToc: return CD_TOC;
|
||||
case CompactDiscSessionInfo: return CD_SessionInfo;
|
||||
case CompactDiscToc: return CD_FullTOC;
|
||||
case CompactDiscPma: return CD_PMA;
|
||||
case CompactDiscAtip: return CD_ATIP;
|
||||
case CompactDiscLeadInCdText: return CD_TEXT;
|
||||
case DvdPfi: return DVD_PFI;
|
||||
case DvdLeadInCmi: return DVD_CMI;
|
||||
case DvdDiscKey: return DVD_DiscKey;
|
||||
case DvdBca: return DVD_BCA;
|
||||
case DvdDmi: return DVD_DMI;
|
||||
case DvdMediaIdentifier: return DVD_MediaIdentifier;
|
||||
case DvdMediaKeyBlock: return DVD_MKB;
|
||||
case DvdRamDds: return DVDRAM_DDS;
|
||||
case DvdRamMediumStatus: return DVDRAM_MediumStatus;
|
||||
case DvdRamSpareArea: return DVDRAM_SpareArea;
|
||||
case DvdRRmd: return DVDR_RMD;
|
||||
case DvdRPrerecordedInfo: return DVDR_PreRecordedInfo;
|
||||
case DvdRMediaIdentifier: return DVDR_MediaIdentifier;
|
||||
case DvdRPfi: return DVDR_PFI;
|
||||
case DvdAdip: return DVD_ADIP;
|
||||
case HdDvdCpi: return HDDVD_CPI;
|
||||
case HdDvdMediumStatus: return HDDVD_MediumStatus;
|
||||
case DvdDlLayerCapacity: return DVDDL_LayerCapacity;
|
||||
case DvdDlMiddleZoneAddress: return DVDDL_MiddleZoneAddress;
|
||||
case DvdDlJumpIntervalSize: return DVDDL_JumpIntervalSize;
|
||||
case DvdDlManualLayerJumpLba: return DVDDL_ManualLayerJumpLBA;
|
||||
case BlurayDi: return BD_DI;
|
||||
case BlurayBca: return BD_BCA;
|
||||
case BlurayDds: return BD_DDS;
|
||||
case BlurayCartridgeStatus: return BD_CartridgeStatus;
|
||||
case BluraySpareArea: return BD_SpareArea;
|
||||
case AacsVolumeIdentifier: return AACS_VolumeIdentifier;
|
||||
case AacsSerialNumber: return AACS_SerialNumber;
|
||||
case AacsMediaIdentifier: return AACS_MediaIdentifier;
|
||||
case AacsMediaKeyBlock: return AACS_MKB;
|
||||
case AacsDataKeys: return AACS_DataKeys;
|
||||
case AacsLbaExtents: return AACS_LBAExtents;
|
||||
case CprmMediaKeyBlock: return AACS_CPRM_MKB;
|
||||
case HybridRecognizedLayers: return Hybrid_RecognizedLayers;
|
||||
case ScsiMmcWriteProtection: return MMC_WriteProtection;
|
||||
case ScsiMmcDiscInformation: return MMC_DiscInformation;
|
||||
case ScsiMmcTrackResourcesInformation: return MMC_TrackResourcesInformation;
|
||||
case ScsiMmcPowResourcesInformation: return MMC_POWResourcesInformation;
|
||||
case ScsiInquiry: return SCSI_INQUIRY;
|
||||
case ScsiModePage2A: return SCSI_MODEPAGE_2A;
|
||||
case AtaIdentify: return ATA_IDENTIFY;
|
||||
case AtapiIdentify: return ATAPI_IDENTIFY;
|
||||
case PcmciaCis: return PCMCIA_CIS;
|
||||
case SecureDigitalCid: return SD_CID;
|
||||
case SecureDigitalCsd: return SD_CSD;
|
||||
case SecureDigitalScr: return SD_SCR;
|
||||
case SecureDigitalOcr: return SD_OCR;
|
||||
case MultiMediaCardCid: return MMC_CID;
|
||||
case MultiMediaCardCsd: return MMC_CSD;
|
||||
case MultiMediaCardOcr: return MMC_OCR;
|
||||
case MultiMediaCardExtendedCsd: return MMC_ExtendedCSD;
|
||||
case XboxSecuritySector: return Xbox_SecuritySector;
|
||||
case FloppyLeadOut: return Floppy_LeadOut;
|
||||
case DvdDiscControlBlock: return DCB;
|
||||
case CompactDiscFirstTrackPregap: return CD_FirstTrackPregap;
|
||||
case CompactDiscLeadOut: return CD_LeadOut;
|
||||
case ScsiModeSense6: return SCSI_MODESENSE_6;
|
||||
case ScsiModeSense10: return SCSI_MODESENSE_10;
|
||||
case UsbDescriptors: return USB_Descriptors;
|
||||
case XboxDmi: return Xbox_DMI;
|
||||
case XboxPfi: return Xbox_PFI;
|
||||
case CompactDiscMediaCatalogueNumber: return CD_MCN;
|
||||
case CompactDiscLeadIn: return CD_LeadIn;
|
||||
default: return -1;
|
||||
case CompactDiscPartialToc:
|
||||
return CD_TOC;
|
||||
case CompactDiscSessionInfo:
|
||||
return CD_SessionInfo;
|
||||
case CompactDiscToc:
|
||||
return CD_FullTOC;
|
||||
case CompactDiscPma:
|
||||
return CD_PMA;
|
||||
case CompactDiscAtip:
|
||||
return CD_ATIP;
|
||||
case CompactDiscLeadInCdText:
|
||||
return CD_TEXT;
|
||||
case DvdPfi:
|
||||
return DVD_PFI;
|
||||
case DvdLeadInCmi:
|
||||
return DVD_CMI;
|
||||
case DvdDiscKey:
|
||||
return DVD_DiscKey;
|
||||
case DvdBca:
|
||||
return DVD_BCA;
|
||||
case DvdDmi:
|
||||
return DVD_DMI;
|
||||
case DvdMediaIdentifier:
|
||||
return DVD_MediaIdentifier;
|
||||
case DvdMediaKeyBlock:
|
||||
return DVD_MKB;
|
||||
case DvdRamDds:
|
||||
return DVDRAM_DDS;
|
||||
case DvdRamMediumStatus:
|
||||
return DVDRAM_MediumStatus;
|
||||
case DvdRamSpareArea:
|
||||
return DVDRAM_SpareArea;
|
||||
case DvdRRmd:
|
||||
return DVDR_RMD;
|
||||
case DvdRPrerecordedInfo:
|
||||
return DVDR_PreRecordedInfo;
|
||||
case DvdRMediaIdentifier:
|
||||
return DVDR_MediaIdentifier;
|
||||
case DvdRPfi:
|
||||
return DVDR_PFI;
|
||||
case DvdAdip:
|
||||
return DVD_ADIP;
|
||||
case HdDvdCpi:
|
||||
return HDDVD_CPI;
|
||||
case HdDvdMediumStatus:
|
||||
return HDDVD_MediumStatus;
|
||||
case DvdDlLayerCapacity:
|
||||
return DVDDL_LayerCapacity;
|
||||
case DvdDlMiddleZoneAddress:
|
||||
return DVDDL_MiddleZoneAddress;
|
||||
case DvdDlJumpIntervalSize:
|
||||
return DVDDL_JumpIntervalSize;
|
||||
case DvdDlManualLayerJumpLba:
|
||||
return DVDDL_ManualLayerJumpLBA;
|
||||
case BlurayDi:
|
||||
return BD_DI;
|
||||
case BlurayBca:
|
||||
return BD_BCA;
|
||||
case BlurayDds:
|
||||
return BD_DDS;
|
||||
case BlurayCartridgeStatus:
|
||||
return BD_CartridgeStatus;
|
||||
case BluraySpareArea:
|
||||
return BD_SpareArea;
|
||||
case AacsVolumeIdentifier:
|
||||
return AACS_VolumeIdentifier;
|
||||
case AacsSerialNumber:
|
||||
return AACS_SerialNumber;
|
||||
case AacsMediaIdentifier:
|
||||
return AACS_MediaIdentifier;
|
||||
case AacsMediaKeyBlock:
|
||||
return AACS_MKB;
|
||||
case AacsDataKeys:
|
||||
return AACS_DataKeys;
|
||||
case AacsLbaExtents:
|
||||
return AACS_LBAExtents;
|
||||
case CprmMediaKeyBlock:
|
||||
return AACS_CPRM_MKB;
|
||||
case HybridRecognizedLayers:
|
||||
return Hybrid_RecognizedLayers;
|
||||
case ScsiMmcWriteProtection:
|
||||
return MMC_WriteProtection;
|
||||
case ScsiMmcDiscInformation:
|
||||
return MMC_DiscInformation;
|
||||
case ScsiMmcTrackResourcesInformation:
|
||||
return MMC_TrackResourcesInformation;
|
||||
case ScsiMmcPowResourcesInformation:
|
||||
return MMC_POWResourcesInformation;
|
||||
case ScsiInquiry:
|
||||
return SCSI_INQUIRY;
|
||||
case ScsiModePage2A:
|
||||
return SCSI_MODEPAGE_2A;
|
||||
case AtaIdentify:
|
||||
return ATA_IDENTIFY;
|
||||
case AtapiIdentify:
|
||||
return ATAPI_IDENTIFY;
|
||||
case PcmciaCis:
|
||||
return PCMCIA_CIS;
|
||||
case SecureDigitalCid:
|
||||
return SD_CID;
|
||||
case SecureDigitalCsd:
|
||||
return SD_CSD;
|
||||
case SecureDigitalScr:
|
||||
return SD_SCR;
|
||||
case SecureDigitalOcr:
|
||||
return SD_OCR;
|
||||
case MultiMediaCardCid:
|
||||
return MMC_CID;
|
||||
case MultiMediaCardCsd:
|
||||
return MMC_CSD;
|
||||
case MultiMediaCardOcr:
|
||||
return MMC_OCR;
|
||||
case MultiMediaCardExtendedCsd:
|
||||
return MMC_ExtendedCSD;
|
||||
case XboxSecuritySector:
|
||||
return Xbox_SecuritySector;
|
||||
case FloppyLeadOut:
|
||||
return Floppy_LeadOut;
|
||||
case DvdDiscControlBlock:
|
||||
return DCB;
|
||||
case CompactDiscFirstTrackPregap:
|
||||
return CD_FirstTrackPregap;
|
||||
case CompactDiscLeadOut:
|
||||
return CD_LeadOut;
|
||||
case ScsiModeSense6:
|
||||
return SCSI_MODESENSE_6;
|
||||
case ScsiModeSense10:
|
||||
return SCSI_MODESENSE_10;
|
||||
case UsbDescriptors:
|
||||
return USB_Descriptors;
|
||||
case XboxDmi:
|
||||
return Xbox_DMI;
|
||||
case XboxPfi:
|
||||
return Xbox_PFI;
|
||||
case CompactDiscMediaCatalogueNumber:
|
||||
return CD_MCN;
|
||||
case CompactDiscLeadIn:
|
||||
return CD_LeadIn;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +263,9 @@ int32_t aaruf_get_xml_mediatype(int32_t type)
|
||||
case MilCD:
|
||||
case VideoNow:
|
||||
case VideoNowColor:
|
||||
case VideoNowXp: return OpticalDisc;
|
||||
default: return BlockMedia;
|
||||
case VideoNowXp:
|
||||
return OpticalDisc;
|
||||
default:
|
||||
return BlockMedia;
|
||||
}
|
||||
}
|
||||
|
||||
29
src/lzma.c
29
src/lzma.c
@@ -23,30 +23,17 @@
|
||||
|
||||
#include "../3rdparty/lzma-21.03beta/C/LzmaLib.h"
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t* dst_buffer,
|
||||
size_t* dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t* srcLen,
|
||||
const uint8_t* props,
|
||||
size_t propsSize)
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
|
||||
size_t *srcLen, const uint8_t *props, size_t propsSize)
|
||||
{
|
||||
return LzmaUncompress(dst_buffer, dst_size, src_buffer, srcLen, props, propsSize);
|
||||
}
|
||||
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t* dst_buffer,
|
||||
size_t* dst_size,
|
||||
const uint8_t* src_buffer,
|
||||
size_t srcLen,
|
||||
uint8_t* outProps,
|
||||
size_t* outPropsSize,
|
||||
int32_t level,
|
||||
uint32_t dictSize,
|
||||
int32_t lc,
|
||||
int32_t lp,
|
||||
int32_t pb,
|
||||
int32_t fb,
|
||||
int32_t numThreads)
|
||||
AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
|
||||
size_t srcLen, uint8_t *outProps, size_t *outPropsSize,
|
||||
int32_t level, uint32_t dictSize, int32_t lc, int32_t lp,
|
||||
int32_t pb, int32_t fb, int32_t numThreads)
|
||||
{
|
||||
return LzmaCompress(
|
||||
dst_buffer, dst_size, src_buffer, srcLen, outProps, outPropsSize, level, dictSize, lc, lp, pb, fb, numThreads);
|
||||
return LzmaCompress(dst_buffer, dst_size, src_buffer, srcLen, outProps, outPropsSize, level, dictSize, lc, lp, pb,
|
||||
fb, numThreads);
|
||||
}
|
||||
|
||||
226
src/open.c
226
src/open.c
@@ -97,9 +97,7 @@ void* aaruf_open(const char* filepath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Opening image version %d.%d\n",
|
||||
ctx->header.imageMajorVersion,
|
||||
fprintf(stderr, "libaaruformat: Opening image version %d.%d\n", ctx->header.imageMajorVersion,
|
||||
ctx->header.imageMinorVersion);
|
||||
|
||||
ctx->readableSectorTags = (bool *)malloc(sizeof(bool) * MaxSectorTag);
|
||||
@@ -119,9 +117,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(ctx->imageInfo.ApplicationVersion != NULL)
|
||||
{
|
||||
memset(ctx->imageInfo.ApplicationVersion, 0, 32);
|
||||
sprintf((char*)ctx->imageInfo.ApplicationVersion,
|
||||
"%d.%d",
|
||||
ctx->header.applicationMajorVersion,
|
||||
sprintf((char *)ctx->imageInfo.ApplicationVersion, "%d.%d", ctx->header.applicationMajorVersion,
|
||||
ctx->header.applicationMinorVersion);
|
||||
}
|
||||
ctx->imageInfo.Version = (uint8_t *)malloc(32);
|
||||
@@ -161,9 +157,7 @@ void* aaruf_open(const char* filepath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Index at %" PRIu64 " contains %d entries\n",
|
||||
ctx->header.indexOffset,
|
||||
fprintf(stderr, "libaaruformat: Index at %" PRIu64 " contains %d entries\n", ctx->header.indexOffset,
|
||||
idxHeader.entries);
|
||||
|
||||
idxEntries = (IndexEntry *)malloc(sizeof(IndexEntry) * idxHeader.entries);
|
||||
@@ -191,11 +185,8 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
for(i = 0; i < idxHeader.entries; i++)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Block type %4.4s with data type %d is indexed to be at %" PRIu64 "\n",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].dataType,
|
||||
idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Block type %4.4s with data type %d is indexed to be at %" PRIu64 "\n",
|
||||
(char *)&idxEntries[i].blockType, idxEntries[i].dataType, idxEntries[i].offset);
|
||||
}
|
||||
|
||||
bool foundUserDataDdt = false;
|
||||
@@ -208,8 +199,7 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not seek to %" PRIu64 " as indicated by index entry %d, continuing...\n",
|
||||
idxEntries[i].offset,
|
||||
i);
|
||||
idxEntries[i].offset, i);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -227,8 +217,8 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
if(readBytes != sizeof(BlockHeader))
|
||||
{
|
||||
fprintf(
|
||||
stderr, "libaaruformat: Could not read block header at %" PRIu64 "\n", idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Could not read block header at %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -246,8 +236,7 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
if(blockHeader.identifier != idxEntries[i].blockType)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
break;
|
||||
}
|
||||
@@ -257,26 +246,20 @@ void* aaruf_open(const char* filepath)
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Expected block with data type %4.4s at position %" PRIu64
|
||||
" but found data type %4.4s\n",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].offset,
|
||||
(char*)&blockHeader.type);
|
||||
(char *)&idxEntries[i].blockType, idxEntries[i].offset, (char *)&blockHeader.type);
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Found data block with type %4.4s at position %" PRIu64 "\n",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Found data block with type %4.4s at position %" PRIu64 "\n",
|
||||
(char *)&idxEntries[i].blockType, idxEntries[i].offset);
|
||||
|
||||
if(blockHeader.compression == Lzma || blockHeader.compression == LzmaClauniaSubchannelTransform)
|
||||
{
|
||||
if(blockHeader.compression == LzmaClauniaSubchannelTransform &&
|
||||
blockHeader.type != CdSectorSubchannel)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Invalid compression type %d for block with data type %d, continuing...\n",
|
||||
blockHeader.compression,
|
||||
blockHeader.type);
|
||||
fprintf(stderr, "Invalid compression type %d for block with data type %d, continuing...\n",
|
||||
blockHeader.compression, blockHeader.type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -316,8 +299,8 @@ void* aaruf_open(const char* filepath)
|
||||
}
|
||||
|
||||
readBytes = blockHeader.length;
|
||||
errorNo = aaruf_lzma_decode_buffer(
|
||||
data, &readBytes, cmpData, &lzmaSize, lzmaProperties, LZMA_PROPERTIES_LENGTH);
|
||||
errorNo = aaruf_lzma_decode_buffer(data, &readBytes, cmpData, &lzmaSize, lzmaProperties,
|
||||
LZMA_PROPERTIES_LENGTH);
|
||||
|
||||
if(errorNo != 0)
|
||||
{
|
||||
@@ -381,8 +364,7 @@ void* aaruf_open(const char* filepath)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
fprintf(stderr, "libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
blockHeader.compression);
|
||||
break;
|
||||
}
|
||||
@@ -399,8 +381,7 @@ void* aaruf_open(const char* filepath)
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...\n",
|
||||
crc64,
|
||||
blockHeader.crc64);
|
||||
crc64, blockHeader.crc64);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -420,7 +401,8 @@ void* aaruf_open(const char* filepath)
|
||||
break;
|
||||
case CdSectorSuffix:
|
||||
case CdSectorSuffixCorrected:
|
||||
if(idxEntries[i].dataType == CdSectorSuffixCorrected) ctx->sectorSuffixCorrected = data;
|
||||
if(idxEntries[i].dataType == CdSectorSuffixCorrected)
|
||||
ctx->sectorSuffixCorrected = data;
|
||||
else
|
||||
ctx->sectorSuffix = data;
|
||||
|
||||
@@ -440,7 +422,9 @@ void* aaruf_open(const char* filepath)
|
||||
ctx->sectorSubchannel = data;
|
||||
ctx->readableSectorTags[AppleSectorTag] = true;
|
||||
break;
|
||||
case CompactDiscMode2Subheader: ctx->mode2Subheaders = data; break;
|
||||
case CompactDiscMode2Subheader:
|
||||
ctx->mode2Subheaders = data;
|
||||
break;
|
||||
default:
|
||||
mediaTag = (mediaTagEntry *)malloc(sizeof(mediaTagEntry));
|
||||
|
||||
@@ -474,8 +458,8 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
if(readBytes != sizeof(DdtHeader))
|
||||
{
|
||||
fprintf(
|
||||
stderr, "libaaruformat: Could not read block header at %" PRIu64 "\n", idxEntries[i].offset);
|
||||
fprintf(stderr, "libaaruformat: Could not read block header at %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -532,12 +516,8 @@ void* aaruf_open(const char* filepath)
|
||||
}
|
||||
|
||||
readBytes = ddtHeader.length;
|
||||
errorNo = aaruf_lzma_decode_buffer((uint8_t*)ctx->userDataDdt,
|
||||
&readBytes,
|
||||
cmpData,
|
||||
&lzmaSize,
|
||||
lzmaProperties,
|
||||
LZMA_PROPERTIES_LENGTH);
|
||||
errorNo = aaruf_lzma_decode_buffer((uint8_t *)ctx->userDataDdt, &readBytes, cmpData,
|
||||
&lzmaSize, lzmaProperties, LZMA_PROPERTIES_LENGTH);
|
||||
|
||||
if(errorNo != 0)
|
||||
{
|
||||
@@ -573,12 +553,8 @@ void* aaruf_open(const char* filepath)
|
||||
case None:
|
||||
#ifdef __linux__
|
||||
ctx->mappedMemoryDdtSize = sizeof(uint64_t) * ddtHeader.entries;
|
||||
ctx->userDataDdt = mmap(NULL,
|
||||
ctx->mappedMemoryDdtSize,
|
||||
PROT_READ,
|
||||
MAP_SHARED,
|
||||
fileno(ctx->imageStream),
|
||||
idxEntries[i].offset + sizeof(ddtHeader));
|
||||
ctx->userDataDdt = mmap(NULL, ctx->mappedMemoryDdtSize, PROT_READ, MAP_SHARED,
|
||||
fileno(ctx->imageStream), idxEntries[i].offset + sizeof(ddtHeader));
|
||||
|
||||
if(ctx->userDataDdt == MAP_FAILED)
|
||||
{
|
||||
@@ -595,8 +571,7 @@ void* aaruf_open(const char* filepath)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
fprintf(stderr, "libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
blockHeader.compression);
|
||||
foundUserDataDdt = false;
|
||||
break;
|
||||
@@ -647,12 +622,8 @@ void* aaruf_open(const char* filepath)
|
||||
}
|
||||
|
||||
readBytes = ddtHeader.length;
|
||||
errorNo = aaruf_lzma_decode_buffer((uint8_t*)cdDdt,
|
||||
&readBytes,
|
||||
cmpData,
|
||||
&lzmaSize,
|
||||
lzmaProperties,
|
||||
LZMA_PROPERTIES_LENGTH);
|
||||
errorNo = aaruf_lzma_decode_buffer((uint8_t *)cdDdt, &readBytes, cmpData, &lzmaSize,
|
||||
lzmaProperties, LZMA_PROPERTIES_LENGTH);
|
||||
|
||||
if(errorNo != 0)
|
||||
{
|
||||
@@ -680,7 +651,8 @@ void* aaruf_open(const char* filepath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(idxEntries[i].dataType == CdSectorPrefixCorrected) ctx->sectorPrefixDdt = cdDdt;
|
||||
if(idxEntries[i].dataType == CdSectorPrefixCorrected)
|
||||
ctx->sectorPrefixDdt = cdDdt;
|
||||
else if(idxEntries[i].dataType == CdSectorSuffixCorrected)
|
||||
ctx->sectorSuffixDdt = cdDdt;
|
||||
else
|
||||
@@ -707,7 +679,8 @@ void* aaruf_open(const char* filepath)
|
||||
break;
|
||||
}
|
||||
|
||||
if(idxEntries[i].dataType == CdSectorPrefixCorrected) ctx->sectorPrefixDdt = cdDdt;
|
||||
if(idxEntries[i].dataType == CdSectorPrefixCorrected)
|
||||
ctx->sectorPrefixDdt = cdDdt;
|
||||
else if(idxEntries[i].dataType == CdSectorSuffixCorrected)
|
||||
ctx->sectorSuffixDdt = cdDdt;
|
||||
else
|
||||
@@ -715,8 +688,7 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
fprintf(stderr, "libaaruformat: Found unknown compression type %d, continuing...\n",
|
||||
blockHeader.compression);
|
||||
break;
|
||||
}
|
||||
@@ -735,11 +707,8 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
if(ctx->geometryBlock.identifier == GeometryBlock)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Geometry set to %d cylinders %d heads %d sectors per track\n",
|
||||
ctx->geometryBlock.cylinders,
|
||||
ctx->geometryBlock.heads,
|
||||
ctx->geometryBlock.sectorsPerTrack);
|
||||
fprintf(stderr, "libaaruformat: Geometry set to %d cylinders %d heads %d sectors per track\n",
|
||||
ctx->geometryBlock.cylinders, ctx->geometryBlock.heads, ctx->geometryBlock.sectorsPerTrack);
|
||||
|
||||
ctx->imageInfo.Cylinders = ctx->geometryBlock.cylinders;
|
||||
ctx->imageInfo.Heads = ctx->geometryBlock.heads;
|
||||
@@ -763,8 +732,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(ctx->metadataBlockHeader.identifier != idxEntries[i].blockType)
|
||||
{
|
||||
memset(&ctx->metadataBlockHeader, 0, sizeof(MetadataBlockHeader));
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
break;
|
||||
}
|
||||
@@ -793,9 +761,7 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->imageInfo.MediaSequence = ctx->metadataBlockHeader.mediaSequence;
|
||||
ctx->imageInfo.LastMediaSequence = ctx->metadataBlockHeader.lastMediaSequence;
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Setting media sequence as %d of %d\n",
|
||||
ctx->imageInfo.MediaSequence,
|
||||
fprintf(stderr, "libaaruformat: Setting media sequence as %d of %d\n", ctx->imageInfo.MediaSequence,
|
||||
ctx->imageInfo.LastMediaSequence);
|
||||
}
|
||||
|
||||
@@ -806,8 +772,7 @@ void* aaruf_open(const char* filepath)
|
||||
ctx->imageInfo.Creator = (uint8_t *)malloc(ctx->metadataBlockHeader.creatorLength);
|
||||
if(ctx->imageInfo.Creator != NULL)
|
||||
{
|
||||
memcpy(ctx->imageInfo.Creator,
|
||||
ctx->metadataBlock + ctx->metadataBlockHeader.creatorOffset,
|
||||
memcpy(ctx->imageInfo.Creator, ctx->metadataBlock + ctx->metadataBlockHeader.creatorOffset,
|
||||
ctx->metadataBlockHeader.creatorLength);
|
||||
}
|
||||
}
|
||||
@@ -819,8 +784,7 @@ void* aaruf_open(const char* filepath)
|
||||
ctx->imageInfo.Comments = (uint8_t *)malloc(ctx->metadataBlockHeader.commentsLength);
|
||||
if(ctx->imageInfo.Comments != NULL)
|
||||
{
|
||||
memcpy(ctx->imageInfo.Comments,
|
||||
ctx->metadataBlock + ctx->metadataBlockHeader.commentsOffset,
|
||||
memcpy(ctx->imageInfo.Comments, ctx->metadataBlock + ctx->metadataBlockHeader.commentsOffset,
|
||||
ctx->metadataBlockHeader.commentsLength);
|
||||
}
|
||||
}
|
||||
@@ -979,8 +943,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(ctx->tracksHeader.identifier != TracksBlock)
|
||||
{
|
||||
memset(&ctx->tracksHeader, 0, sizeof(TracksHeader));
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -1004,8 +967,8 @@ void* aaruf_open(const char* filepath)
|
||||
fprintf(stderr, "libaaruformat: Could not read metadata block, continuing...\n");
|
||||
}
|
||||
|
||||
crc64 =
|
||||
aaruf_crc64_data((const uint8_t*)ctx->trackEntries, ctx->tracksHeader.entries * sizeof(TrackEntry));
|
||||
crc64 = aaruf_crc64_data((const uint8_t *)ctx->trackEntries,
|
||||
ctx->tracksHeader.entries * sizeof(TrackEntry));
|
||||
|
||||
// Due to how C# wrote it, it is effectively reversed
|
||||
if(ctx->header.imageMajorVersion <= AARUF_VERSION) crc64 = bswap_64(crc64);
|
||||
@@ -1015,14 +978,11 @@ void* aaruf_open(const char* filepath)
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...\n",
|
||||
crc64,
|
||||
ctx->tracksHeader.crc64);
|
||||
crc64, ctx->tracksHeader.crc64);
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Found %d tracks at position %" PRIu64 ".\n",
|
||||
ctx->tracksHeader.entries,
|
||||
fprintf(stderr, "libaaruformat: Found %d tracks at position %" PRIu64 ".\n", ctx->tracksHeader.entries,
|
||||
idxEntries[i].offset);
|
||||
|
||||
ctx->imageInfo.HasPartitions = true;
|
||||
@@ -1060,8 +1020,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(ctx->cicmBlockHeader.identifier != CicmBlock)
|
||||
{
|
||||
memset(&ctx->cicmBlockHeader, 0, sizeof(CicmMetadataBlock));
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -1102,8 +1061,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(ctx->dumpHardwareHeader.identifier != DumpHardwareBlock)
|
||||
{
|
||||
memset(&ctx->dumpHardwareHeader, 0, sizeof(DumpHardwareHeader));
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for data block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -1132,8 +1090,7 @@ void* aaruf_open(const char* filepath)
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||
", continuing...\n",
|
||||
crc64,
|
||||
ctx->dumpHardwareHeader.crc64);
|
||||
crc64, ctx->dumpHardwareHeader.crc64);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1152,14 +1109,13 @@ void* aaruf_open(const char* filepath)
|
||||
break;
|
||||
}
|
||||
|
||||
memset(ctx->dumpHardwareEntriesWithData,
|
||||
0,
|
||||
memset(ctx->dumpHardwareEntriesWithData, 0,
|
||||
sizeof(DumpHardwareEntriesWithData) * ctx->dumpHardwareHeader.entries);
|
||||
|
||||
for(e = 0; e < ctx->dumpHardwareHeader.entries; e++)
|
||||
{
|
||||
readBytes = fread(
|
||||
&ctx->dumpHardwareEntriesWithData[e].entry, 1, sizeof(DumpHardwareEntry), ctx->imageStream);
|
||||
readBytes = fread(&ctx->dumpHardwareEntriesWithData[e].entry, 1, sizeof(DumpHardwareEntry),
|
||||
ctx->imageStream);
|
||||
|
||||
if(readBytes != sizeof(DumpHardwareEntry))
|
||||
{
|
||||
@@ -1177,17 +1133,15 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.manufacturer[ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].manufacturer,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength,
|
||||
ctx->imageStream);
|
||||
readBytes =
|
||||
fread(ctx->dumpHardwareEntriesWithData[e].manufacturer, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].manufacturer);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.manufacturerLength = 0;
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
"continuing...\n");
|
||||
}
|
||||
}
|
||||
@@ -1202,10 +1156,8 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.model[ctx->dumpHardwareEntriesWithData[e].entry.modelLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].model,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.modelLength,
|
||||
ctx->imageStream);
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].model, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.modelLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.modelLength)
|
||||
{
|
||||
@@ -1227,17 +1179,15 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.revision[ctx->dumpHardwareEntriesWithData[e].entry.revisionLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].revision,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.revisionLength,
|
||||
ctx->imageStream);
|
||||
readBytes =
|
||||
fread(ctx->dumpHardwareEntriesWithData[e].revision, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.revisionLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.revisionLength)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].revision);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.revisionLength = 0;
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not read dump hardware block entry revision, "
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block entry revision, "
|
||||
"continuing...\n");
|
||||
}
|
||||
}
|
||||
@@ -1252,17 +1202,15 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.firmware[ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].firmware,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength,
|
||||
ctx->imageStream);
|
||||
readBytes =
|
||||
fread(ctx->dumpHardwareEntriesWithData[e].firmware, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].firmware);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.firmwareLength = 0;
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not read dump hardware block entry firmware, "
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block entry firmware, "
|
||||
"continuing...\n");
|
||||
}
|
||||
}
|
||||
@@ -1277,10 +1225,8 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.serial[ctx->dumpHardwareEntriesWithData[e].entry.serialLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].serial,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.serialLength,
|
||||
ctx->imageStream);
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].serial, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.serialLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.serialLength)
|
||||
{
|
||||
@@ -1302,10 +1248,9 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.softwareName[ctx->dumpHardwareEntriesWithData[e].entry.softwareNameLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].softwareName,
|
||||
1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareNameLength,
|
||||
ctx->imageStream);
|
||||
readBytes =
|
||||
fread(ctx->dumpHardwareEntriesWithData[e].softwareName, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareNameLength, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData[e].entry.softwareNameLength)
|
||||
{
|
||||
@@ -1327,8 +1272,7 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e]
|
||||
.softwareVersion[ctx->dumpHardwareEntriesWithData[e].entry.softwareVersionLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].softwareVersion,
|
||||
1,
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].softwareVersion, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareVersionLength,
|
||||
ctx->imageStream);
|
||||
|
||||
@@ -1352,8 +1296,7 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
ctx->dumpHardwareEntriesWithData[e].softwareOperatingSystem
|
||||
[ctx->dumpHardwareEntriesWithData[e].entry.softwareOperatingSystemLength] = 0;
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].softwareOperatingSystem,
|
||||
1,
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].softwareOperatingSystem, 1,
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareOperatingSystemLength,
|
||||
ctx->imageStream);
|
||||
|
||||
@@ -1361,8 +1304,7 @@ void* aaruf_open(const char* filepath)
|
||||
{
|
||||
free(ctx->dumpHardwareEntriesWithData[e].softwareOperatingSystem);
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.softwareOperatingSystemLength = 0;
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
fprintf(stderr, "libaaruformat: Could not read dump hardware block entry manufacturer, "
|
||||
"continuing...\n");
|
||||
}
|
||||
}
|
||||
@@ -1373,16 +1315,13 @@ void* aaruf_open(const char* filepath)
|
||||
|
||||
if(ctx->dumpHardwareEntriesWithData[e].extents == NULL)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Could not allocate memory for dump hardware block extents, "
|
||||
fprintf(stderr, "libaaruformat: Could not allocate memory for dump hardware block extents, "
|
||||
"continuing...\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].extents,
|
||||
sizeof(DumpExtent),
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.extents,
|
||||
ctx->imageStream);
|
||||
readBytes = fread(ctx->dumpHardwareEntriesWithData[e].extents, sizeof(DumpExtent),
|
||||
ctx->dumpHardwareEntriesWithData[e].entry.extents, ctx->imageStream);
|
||||
|
||||
if(readBytes != ctx->dumpHardwareEntriesWithData->entry.extents)
|
||||
{
|
||||
@@ -1408,8 +1347,7 @@ void* aaruf_open(const char* filepath)
|
||||
if(checksum_header.identifier != ChecksumBlock)
|
||||
{
|
||||
memset(&checksum_header, 0, sizeof(ChecksumHeader));
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Incorrect identifier for checksum block at position %" PRIu64 "\n",
|
||||
fprintf(stderr, "libaaruformat: Incorrect identifier for checksum block at position %" PRIu64 "\n",
|
||||
idxEntries[i].offset);
|
||||
}
|
||||
|
||||
@@ -1476,9 +1414,7 @@ void* aaruf_open(const char* filepath)
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"libaaruformat: Unhandled block type %4.4s with data type %d is indexed to be at %" PRIu64 "\n",
|
||||
(char*)&idxEntries[i].blockType,
|
||||
idxEntries[i].dataType,
|
||||
idxEntries[i].offset);
|
||||
(char *)&idxEntries[i].blockType, idxEntries[i].dataType, idxEntries[i].offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
40
src/read.c
40
src/read.c
@@ -240,7 +240,8 @@ int32_t aaruf_read_sector(void* context, uint64_t sectorAddress, uint8_t* data,
|
||||
free(cmpData);
|
||||
|
||||
break;
|
||||
default: return AARUF_ERROR_UNSUPPORTED_COMPRESSION;
|
||||
default:
|
||||
return AARUF_ERROR_UNSUPPORTED_COMPRESSION;
|
||||
}
|
||||
|
||||
// Add block to cache
|
||||
@@ -338,11 +339,14 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
switch(trk.type)
|
||||
{
|
||||
case Audio:
|
||||
case Data: memcpy(data, bareData, bareLength); return res;
|
||||
case Data:
|
||||
memcpy(data, bareData, bareLength);
|
||||
return res;
|
||||
case CdMode1:
|
||||
memcpy(data + 16, bareData, 2048);
|
||||
|
||||
if(ctx->sectorPrefix != NULL) memcpy(data, ctx->sectorPrefix + (sectorAddress * 16), 16);
|
||||
if(ctx->sectorPrefix != NULL)
|
||||
memcpy(data, ctx->sectorPrefix + (sectorAddress * 16), 16);
|
||||
else if(ctx->sectorPrefixDdt != NULL)
|
||||
{
|
||||
if((ctx->sectorPrefixDdt[sectorAddress] & CD_XFIX_MASK) == Correct)
|
||||
@@ -367,7 +371,8 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
|
||||
if(res != AARUF_STATUS_OK) return res;
|
||||
|
||||
if(ctx->sectorSuffix != NULL) memcpy(data + 2064, ctx->sectorSuffix + sectorAddress * 288, 288);
|
||||
if(ctx->sectorSuffix != NULL)
|
||||
memcpy(data + 2064, ctx->sectorSuffix + sectorAddress * 288, 288);
|
||||
else if(ctx->sectorSuffixDdt != NULL)
|
||||
{
|
||||
if((ctx->sectorSuffixDdt[sectorAddress] & CD_XFIX_MASK) == Correct)
|
||||
@@ -394,7 +399,8 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
case CdMode2Formless:
|
||||
case CdMode2Form1:
|
||||
case CdMode2Form2:
|
||||
if(ctx->sectorPrefix != NULL) memcpy(data, ctx->sectorPrefix + sectorAddress * 16, 16);
|
||||
if(ctx->sectorPrefix != NULL)
|
||||
memcpy(data, ctx->sectorPrefix + sectorAddress * 16, 16);
|
||||
else if(ctx->sectorPrefixDdt != NULL)
|
||||
{
|
||||
if((ctx->sectorPrefixDdt[sectorAddress] & CD_XFIX_MASK) == Correct)
|
||||
@@ -452,7 +458,8 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
memcpy(data + 16, bareData, 2336);
|
||||
|
||||
return res;
|
||||
default: return AARUF_ERROR_INVALID_TRACK_FORMAT;
|
||||
default:
|
||||
return AARUF_ERROR_INVALID_TRACK_FORMAT;
|
||||
}
|
||||
case BlockMedia:
|
||||
switch(ctx->imageInfo.MediaType)
|
||||
@@ -469,11 +476,18 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
{
|
||||
case AppleFileWare:
|
||||
case AppleProfile:
|
||||
case AppleWidget: tagLength = 20; break;
|
||||
case AppleWidget:
|
||||
tagLength = 20;
|
||||
break;
|
||||
case AppleSonySS:
|
||||
case AppleSonyDS: tagLength = 12; break;
|
||||
case PriamDataTower: tagLength = 24; break;
|
||||
default: return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
case AppleSonyDS:
|
||||
tagLength = 12;
|
||||
break;
|
||||
case PriamDataTower:
|
||||
tagLength = 24;
|
||||
break;
|
||||
default:
|
||||
return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
}
|
||||
|
||||
bareLength = 512;
|
||||
@@ -498,8 +512,10 @@ int32_t aaruf_read_sector_long(void* context, uint64_t sectorAddress, uint8_t* d
|
||||
free(bareData);
|
||||
|
||||
return res;
|
||||
default: return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
default:
|
||||
return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
}
|
||||
default: return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
default:
|
||||
return AARUF_ERROR_INCORRECT_MEDIA_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -104,9 +104,7 @@ int32_t aaruf_verify_image(void* context)
|
||||
|
||||
for(i = 0; i < index_header.entries; i++)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Checking block with type %4.4s at position %" PRIu64 "\n",
|
||||
(char*)&index_entries[i].blockType,
|
||||
fprintf(stderr, "Checking block with type %4.4s at position %" PRIu64 "\n", (char *)&index_entries[i].blockType,
|
||||
index_entries[i].offset);
|
||||
|
||||
fseek(ctx->imageStream, index_entries[i].offset, SEEK_SET);
|
||||
@@ -233,7 +231,9 @@ int32_t aaruf_verify_image(void* context)
|
||||
}
|
||||
|
||||
break;
|
||||
default: fprintf(stderr, "Ignoring block type %4.4s.\n", (char*)&index_entries[i].blockType); break;
|
||||
default:
|
||||
fprintf(stderr, "Ignoring block type %4.4s.\n", (char *)&index_entries[i].blockType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,14 +1091,8 @@ FSeek(header.indexOffset);
|
||||
local uint idxid = ReadUInt();
|
||||
FSeek(header.indexOffset);
|
||||
|
||||
if(idxid == 0x32584449)
|
||||
{
|
||||
Index2 index;
|
||||
}
|
||||
else
|
||||
{
|
||||
Index index;
|
||||
}
|
||||
if(idxid == 0x32584449) { Index2 index; }
|
||||
else { Index index; }
|
||||
|
||||
for(i = 0; i < index.entries; i++)
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#include <std/core.pat>
|
||||
#include <std/mem.pat>
|
||||
#include <type/guid.pat>
|
||||
#include <std/sys.pat>
|
||||
#include <std/string.pat>
|
||||
#include <std/sys.pat>
|
||||
#include <type/guid.pat>
|
||||
|
||||
enum MediaType : u32
|
||||
{
|
||||
@@ -822,41 +822,29 @@ struct MetadataBlock
|
||||
u32 driveFirmwareRevisionOffset;
|
||||
u32 driveFirmwareRevisionLength;
|
||||
|
||||
if(creatorLength > 0)
|
||||
char16 creator[creatorLength];
|
||||
if(creatorLength > 0) char16 creator[creatorLength];
|
||||
|
||||
if(commentsLength > 0)
|
||||
char16 comments[commentsLength];
|
||||
if(commentsLength > 0) char16 comments[commentsLength];
|
||||
|
||||
if(mediaTitleLength > 0)
|
||||
char16 mediaTitle[mediaTitleLength];
|
||||
if(mediaTitleLength > 0) char16 mediaTitle[mediaTitleLength];
|
||||
|
||||
if(mediaManufacturerLength > 0)
|
||||
char16 mediaManufacturer[mediaManufacturerLength];
|
||||
if(mediaManufacturerLength > 0) char16 mediaManufacturer[mediaManufacturerLength];
|
||||
|
||||
if(mediaModelLength > 0)
|
||||
char16 mediaModel[mediaModelLength];
|
||||
if(mediaModelLength > 0) char16 mediaModel[mediaModelLength];
|
||||
|
||||
if(mediaSerialNumberLength > 0)
|
||||
char16 mediaSerialNumber[mediaSerialNumberLength];
|
||||
if(mediaSerialNumberLength > 0) char16 mediaSerialNumber[mediaSerialNumberLength];
|
||||
|
||||
if(mediaBarcodeLength > 0)
|
||||
char16 mediaBarcode[mediaBarcodeLength];
|
||||
if(mediaBarcodeLength > 0) char16 mediaBarcode[mediaBarcodeLength];
|
||||
|
||||
if(mediaPartNumberLength > 0)
|
||||
char16 mediaPartNumber[mediaPartNumberLength];
|
||||
if(mediaPartNumberLength > 0) char16 mediaPartNumber[mediaPartNumberLength];
|
||||
|
||||
if(driveManufacturerLength > 0)
|
||||
char16 driveManufacturer[driveManufacturerLength];
|
||||
if(driveManufacturerLength > 0) char16 driveManufacturer[driveManufacturerLength];
|
||||
|
||||
if(driveModelLength > 0)
|
||||
char16 driveModel[driveModelLength];
|
||||
if(driveModelLength > 0) char16 driveModel[driveModelLength];
|
||||
|
||||
if(driveSerialNumberLength > 0)
|
||||
char16 driveSerialNumber[driveSerialNumberLength];
|
||||
if(driveSerialNumberLength > 0) char16 driveSerialNumber[driveSerialNumberLength];
|
||||
|
||||
if(driveFirmwareRevisionLength > 0)
|
||||
char16 driveFirmwareRevision[driveFirmwareRevisionLength];
|
||||
if(driveFirmwareRevisionLength > 0) char16 driveFirmwareRevision[driveFirmwareRevisionLength];
|
||||
};
|
||||
|
||||
struct TrackEntry
|
||||
@@ -942,29 +930,21 @@ struct DumpHardwareEntry
|
||||
u32 softwareOperatingSystemLength;
|
||||
u32 extents;
|
||||
|
||||
if(manufacturerLength > 0)
|
||||
char manufacturer[manufacturerLength];
|
||||
if(manufacturerLength > 0) char manufacturer[manufacturerLength];
|
||||
|
||||
if(modelLength > 0)
|
||||
char model[modelLength];
|
||||
if(modelLength > 0) char model[modelLength];
|
||||
|
||||
if(revisionLength > 0)
|
||||
char revision[revisionLength];
|
||||
if(revisionLength > 0) char revision[revisionLength];
|
||||
|
||||
if(firmwareLength > 0)
|
||||
char firmware[firmwareLength];
|
||||
if(firmwareLength > 0) char firmware[firmwareLength];
|
||||
|
||||
if(serialLength > 0)
|
||||
char serial[serialLength];
|
||||
if(serialLength > 0) char serial[serialLength];
|
||||
|
||||
if(softwareNameLength > 0)
|
||||
char name[softwareNameLength];
|
||||
if(softwareNameLength > 0) char name[softwareNameLength];
|
||||
|
||||
if(softwareVersionLength > 0)
|
||||
char version[softwareVersionLength];
|
||||
if(softwareVersionLength > 0) char version[softwareVersionLength];
|
||||
|
||||
if(softwareOperatingSystemLength > 0)
|
||||
char operatingSystem[softwareOperatingSystemLength];
|
||||
if(softwareOperatingSystemLength > 0) char operatingSystem[softwareOperatingSystemLength];
|
||||
};
|
||||
|
||||
struct DumpHardwareBlock
|
||||
@@ -1137,7 +1117,8 @@ struct Index
|
||||
BlockType identifier;
|
||||
|
||||
std::assert(identifier == BlockType::Index || identifier == BlockType::Index2 ||
|
||||
identifier == BlockType::IndexContinuation, "Invalid index identifier!");
|
||||
identifier == BlockType::IndexContinuation,
|
||||
"Invalid index identifier!");
|
||||
|
||||
if(identifier == BlockType::Index2 || identifier == BlockType::IndexContinuation)
|
||||
u64 entries;
|
||||
|
||||
@@ -35,7 +35,8 @@ extern "C"
|
||||
uint32_t entry = (uint32_t)i;
|
||||
|
||||
for(j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_ISO_POLY;
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC32_ISO_POLY;
|
||||
else
|
||||
entry >>= 1;
|
||||
|
||||
|
||||
@@ -110,22 +110,9 @@ TEST_F(flacFixture, flacCompress)
|
||||
original_crc = crc32_data(original, original_len);
|
||||
|
||||
// Compress
|
||||
newSize = aaruf_flac_encode_redbook_buffer(cmp_buffer,
|
||||
cmp_len,
|
||||
original,
|
||||
original_len,
|
||||
4608,
|
||||
1,
|
||||
0,
|
||||
"partial_tukey(0/1.0/1.0)",
|
||||
12,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
0,
|
||||
8,
|
||||
"Aaru.Compression.Native.Tests",
|
||||
strlen("Aaru.Compression.Native.Tests"));
|
||||
newSize = aaruf_flac_encode_redbook_buffer(
|
||||
cmp_buffer, cmp_len, original, original_len, 4608, 1, 0, "partial_tukey(0/1.0/1.0)", 12, 0, 1, false, 0, 8,
|
||||
"Aaru.Compression.Native.Tests", strlen("Aaru.Compression.Native.Tests"));
|
||||
cmp_len = newSize;
|
||||
|
||||
// Decompress
|
||||
|
||||
@@ -115,8 +115,8 @@ TEST_F(lzmaFixture, lzmaCompress)
|
||||
original_crc = crc32_data(original, original_len);
|
||||
|
||||
// Compress
|
||||
err = aaruf_lzma_encode_buffer(
|
||||
cmp_buffer, &cmp_len, original, original_len, props, &props_len, 9, 1048576, 3, 0, 2, 273, 2);
|
||||
err = aaruf_lzma_encode_buffer(cmp_buffer, &cmp_len, original, original_len, props, &props_len, 9, 1048576, 3, 0, 2,
|
||||
273, 2);
|
||||
EXPECT_EQ(err, 0);
|
||||
|
||||
// Decompress
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
#ifdef AARU_HAS_SHA256
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
@@ -31,14 +31,7 @@ int printhex(unsigned char* array, unsigned int length, int width, bool color)
|
||||
int read_long(unsigned long long sector_no, char *path);
|
||||
int verify(char *path);
|
||||
int verify_sectors(char *path);
|
||||
bool check_cd_sector_channel(CdEccContext* context,
|
||||
uint8_t* sector,
|
||||
bool* unknown,
|
||||
bool* has_edc,
|
||||
bool* edc_correct,
|
||||
bool* has_ecc_p,
|
||||
bool* ecc_p_correct,
|
||||
bool* has_ecc_q,
|
||||
bool* ecc_q_correct);
|
||||
bool check_cd_sector_channel(CdEccContext *context, uint8_t *sector, bool *unknown, bool *has_edc, bool *edc_correct,
|
||||
bool *has_ecc_p, bool *ecc_p_correct, bool *has_ecc_q, bool *ecc_q_correct);
|
||||
|
||||
#endif // LIBAARUFORMAT_TOOL_AARUFORMATTOOL_H_
|
||||
|
||||
@@ -22,15 +22,8 @@
|
||||
|
||||
#include <aaruformat.h>
|
||||
|
||||
bool check_cd_sector_channel(CdEccContext* context,
|
||||
uint8_t* sector,
|
||||
bool* unknown,
|
||||
bool* has_edc,
|
||||
bool* edc_correct,
|
||||
bool* has_ecc_p,
|
||||
bool* ecc_p_correct,
|
||||
bool* has_ecc_q,
|
||||
bool* ecc_q_correct)
|
||||
bool check_cd_sector_channel(CdEccContext *context, uint8_t *sector, bool *unknown, bool *has_edc, bool *edc_correct,
|
||||
bool *has_ecc_p, bool *ecc_p_correct, bool *has_ecc_q, bool *ecc_q_correct)
|
||||
{
|
||||
int i;
|
||||
uint32_t storedEdc, edc, calculatedEdc;
|
||||
@@ -58,10 +51,7 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
for(i = 0x010; i < 0x930; i++)
|
||||
if(sector[i] != 0x00)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 0 sector with error at address: %2X:%2X:%2X.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Mode 0 sector with error at address: %2X:%2X:%2X.\n", sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
return false;
|
||||
}
|
||||
@@ -76,11 +66,8 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
sector[0x815] != 0x00 || sector[0x816] != 0x00 || sector[0x817] != 0x00 || sector[0x818] != 0x00 ||
|
||||
sector[0x819] != 0x00 || sector[0x81A] != 0x00 || sector[0x81B] != 0x00)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 1 with data in reserved bytes at address: %2X:%2X:%2X.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
sector[0x00E]);
|
||||
fprintf(stderr, "Mode 1 with data in reserved bytes at address: %2X:%2X:%2X.\n", sector[0x00C],
|
||||
sector[0x00D], sector[0x00E]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,8 +78,8 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
*ecc_p_correct = aaruf_ecc_cd_check(context, sector, sector, 86, 24, 2, 86, sector, 0xC, 0x10, 0x81C);
|
||||
*ecc_q_correct = aaruf_ecc_cd_check(context, sector, sector, 52, 43, 86, 88, sector, 0xC, 0x10, 0x81C + 0xAC);
|
||||
|
||||
storedEdc =
|
||||
(sector[0x813] << 24) + (sector[0x812] << 16) + (sector[0x811] << 8) + sector[0x810]; // TODO: Check casting
|
||||
storedEdc = (sector[0x813] << 24) + (sector[0x812] << 16) + (sector[0x811] << 8) +
|
||||
sector[0x810]; // TODO: Check casting
|
||||
edc = 0;
|
||||
size = 0x810;
|
||||
pos = 0;
|
||||
@@ -103,30 +90,19 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
|
||||
if(!*edc_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 1 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
sector[0x00E],
|
||||
calculatedEdc,
|
||||
storedEdc);
|
||||
fprintf(stderr, "Mode 1 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n", sector[0x00C],
|
||||
sector[0x00D], sector[0x00E], calculatedEdc, storedEdc);
|
||||
}
|
||||
|
||||
if(!*ecc_p_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 1 sector at address: %2X:%2X:%2X, fails ECC P check.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Mode 1 sector at address: %2X:%2X:%2X, fails ECC P check.\n", sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
}
|
||||
|
||||
if(!*ecc_q_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 1 sector at address: %2X:%2X:%2X, fails ECC Q check.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Mode 1 sector at address: %2X:%2X:%2X, fails ECC Q check.\n", sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
}
|
||||
|
||||
@@ -139,11 +115,8 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
{
|
||||
if(sector[0x010] != sector[0x014] || sector[0x011] != sector[0x015] || sector[0x012] != sector[0x016] ||
|
||||
sector[0x013] != sector[0x017])
|
||||
fprintf(stderr,
|
||||
"Subheader copies differ in mode 2 form 2 sector at address: %2X:%2X:%2X",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
sector[0x00E]);
|
||||
fprintf(stderr, "Subheader copies differ in mode 2 form 2 sector at address: %2X:%2X:%2X",
|
||||
sector[0x00C], sector[0x00D], sector[0x00E]);
|
||||
|
||||
storedEdc = sector[0x91C];
|
||||
|
||||
@@ -162,13 +135,8 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
|
||||
if(!*edc_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 2 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
sector[0x00E],
|
||||
calculatedEdc,
|
||||
storedEdc);
|
||||
fprintf(stderr, "Mode 2 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n", sector[0x00C],
|
||||
sector[0x00D], sector[0x00E], calculatedEdc, storedEdc);
|
||||
}
|
||||
|
||||
return *edc_correct;
|
||||
@@ -190,41 +158,26 @@ bool check_cd_sector_channel(CdEccContext* context,
|
||||
|
||||
if(!*edc_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 2 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
sector[0x00E],
|
||||
calculatedEdc,
|
||||
storedEdc);
|
||||
fprintf(stderr, "Mode 2 sector at address: %2X:%2X:%2X, got CRC 0x%8X expected 0x%8X\n", sector[0x00C],
|
||||
sector[0x00D], sector[0x00E], calculatedEdc, storedEdc);
|
||||
}
|
||||
|
||||
if(!*ecc_p_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 2 sector at address: %2X:%2X:%2X, fails ECC P check.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Mode 2 sector at address: %2X:%2X:%2X, fails ECC P check.\n", sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
}
|
||||
|
||||
if(!*ecc_q_correct)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Mode 2 sector at address: %2X:%2X:%2X, fails ECC Q check.\n",
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Mode 2 sector at address: %2X:%2X:%2X, fails ECC Q check.\n", sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
}
|
||||
|
||||
return *edc_correct && *ecc_p_correct && *ecc_q_correct;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Unknown mode %d sector at address: %2X:%2X:%2X",
|
||||
sector[0x00F],
|
||||
sector[0x00C],
|
||||
sector[0x00D],
|
||||
fprintf(stderr, "Unknown mode %d sector at address: %2X:%2X:%2X", sector[0x00F], sector[0x00C], sector[0x00D],
|
||||
sector[0x00E]);
|
||||
|
||||
return false;
|
||||
|
||||
171
tool/info.c
171
tool/info.c
@@ -88,30 +88,23 @@ int info(char* path)
|
||||
if(ctx->sectorPrefixDdt != NULL) printf("Sector suffix DDT has been read to memory.\n");
|
||||
|
||||
if(ctx->geometryBlock.identifier == GeometryBlock)
|
||||
printf("Media has %d cylinders, %d heads and %d sectors per track.\n",
|
||||
ctx->geometryBlock.cylinders,
|
||||
ctx->geometryBlock.heads,
|
||||
ctx->geometryBlock.sectorsPerTrack);
|
||||
printf("Media has %d cylinders, %d heads and %d sectors per track.\n", ctx->geometryBlock.cylinders,
|
||||
ctx->geometryBlock.heads, ctx->geometryBlock.sectorsPerTrack);
|
||||
|
||||
if(ctx->metadataBlockHeader.identifier == MetadataBlock)
|
||||
{
|
||||
printf("Metadata block:\n");
|
||||
if(ctx->metadataBlockHeader.mediaSequence > 0)
|
||||
printf("\tMedia is no. %d in a set of %d media\n",
|
||||
ctx->metadataBlockHeader.mediaSequence,
|
||||
printf("\tMedia is no. %d in a set of %d media\n", ctx->metadataBlockHeader.mediaSequence,
|
||||
ctx->metadataBlockHeader.lastMediaSequence);
|
||||
|
||||
if(ctx->metadataBlockHeader.creatorLength > 0)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.creatorLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.creatorLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.creatorLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.creatorLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.creatorOffset),
|
||||
(int)ctx->metadataBlockHeader.creatorLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.creatorLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -120,13 +113,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.commentsLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.commentsLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.commentsLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.commentsLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.commentsOffset),
|
||||
(int)ctx->metadataBlockHeader.commentsLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.commentsLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -135,13 +124,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaTitleLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaTitleLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaTitleLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaTitleLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaTitleOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaTitleLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaTitleLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -150,13 +135,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaManufacturerLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaManufacturerLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaManufacturerLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaManufacturerLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaManufacturerOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaManufacturerLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaManufacturerLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -165,13 +146,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaModelLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaModelLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaModelLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaModelLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaModelOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaModelLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaModelLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -180,13 +157,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaSerialNumberLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaSerialNumberLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaSerialNumberLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaSerialNumberLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaSerialNumberOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaSerialNumberLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaSerialNumberLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -195,13 +168,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaBarcodeLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaBarcodeLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaBarcodeLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaBarcodeLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaBarcodeOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaBarcodeLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaBarcodeLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -210,13 +179,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.mediaPartNumberLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.mediaPartNumberLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.mediaPartNumberLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.mediaPartNumberLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.mediaPartNumberOffset),
|
||||
(int)ctx->metadataBlockHeader.mediaPartNumberLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.mediaPartNumberLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -225,13 +190,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.driveManufacturerLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.driveManufacturerLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.driveManufacturerLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.driveManufacturerLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.driveManufacturerOffset),
|
||||
(int)ctx->metadataBlockHeader.driveManufacturerLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.driveManufacturerLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -240,13 +201,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.driveModelLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.driveModelLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.driveModelLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.driveModelLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.driveModelOffset),
|
||||
(int)ctx->metadataBlockHeader.driveModelLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.driveModelLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -255,13 +212,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.driveSerialNumberLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.driveSerialNumberLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.driveSerialNumberLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.driveSerialNumberLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.driveSerialNumberOffset),
|
||||
(int)ctx->metadataBlockHeader.driveSerialNumberLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.driveSerialNumberLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -270,13 +223,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->metadataBlockHeader.driveFirmwareRevisionLength + 1);
|
||||
memset(strBuffer, 0, ctx->metadataBlockHeader.driveFirmwareRevisionLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-16LE",
|
||||
strBuffer,
|
||||
(int)ctx->metadataBlockHeader.driveFirmwareRevisionLength,
|
||||
ucnv_convert(NULL, "UTF-16LE", strBuffer, (int)ctx->metadataBlockHeader.driveFirmwareRevisionLength,
|
||||
(char *)(ctx->metadataBlock + ctx->metadataBlockHeader.driveFirmwareRevisionOffset),
|
||||
(int)ctx->metadataBlockHeader.driveFirmwareRevisionLength,
|
||||
&u_error_code);
|
||||
(int)ctx->metadataBlockHeader.driveFirmwareRevisionLength, &u_error_code);
|
||||
printf("\tCreator: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -319,13 +268,10 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].manufacturer),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength, &u_error_code);
|
||||
printf("\t\tManufacturer: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -334,13 +280,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].model),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength, &u_error_code);
|
||||
printf("\t\tModel: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -349,13 +291,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].revision),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength, &u_error_code);
|
||||
printf("\t\tRevision: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -364,13 +302,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].firmware),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength, &u_error_code);
|
||||
printf("\t\tFirmware version: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -379,13 +313,9 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].serial),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength, &u_error_code);
|
||||
printf("\t\tSerial number: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -394,13 +324,10 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].softwareName),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength, &u_error_code);
|
||||
printf("\t\tSoftware name: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -409,13 +336,10 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].softwareVersion),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength,
|
||||
&u_error_code);
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength, &u_error_code);
|
||||
printf("\t\tSoftware version: %s\n", strBuffer);
|
||||
free(strBuffer);
|
||||
}
|
||||
@@ -424,9 +348,7 @@ int info(char* path)
|
||||
{
|
||||
strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength + 1);
|
||||
memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength + 1);
|
||||
ucnv_convert(NULL,
|
||||
"UTF-8",
|
||||
strBuffer,
|
||||
ucnv_convert(NULL, "UTF-8", strBuffer,
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength,
|
||||
(char *)(ctx->dumpHardwareEntriesWithData[i].softwareOperatingSystem),
|
||||
(int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength,
|
||||
@@ -494,8 +416,7 @@ int info(char* path)
|
||||
printf("\tMedia type: %u\n", ctx->imageInfo.MediaType);
|
||||
|
||||
if(ctx->imageInfo.MediaSequence > 0 || ctx->imageInfo.LastMediaSequence > 0)
|
||||
printf("\tMedia is number %d in a set of %d media\n",
|
||||
ctx->imageInfo.MediaSequence,
|
||||
printf("\tMedia is number %d in a set of %d media\n", ctx->imageInfo.MediaSequence,
|
||||
ctx->imageInfo.LastMediaSequence);
|
||||
|
||||
if(ctx->imageInfo.DriveManufacturer != NULL) printf("\tDrive manufacturer: %s\n", ctx->imageInfo.DriveManufacturer);
|
||||
@@ -506,10 +427,8 @@ int info(char* path)
|
||||
printf("\tDrive firmware revision: %s\n", ctx->imageInfo.DriveFirmwareRevision);
|
||||
printf("\tXML media type: %d\n", ctx->imageInfo.XmlMediaType);
|
||||
if(ctx->imageInfo.Cylinders > 0 || ctx->imageInfo.Heads > 0 || ctx->imageInfo.SectorsPerTrack > 0)
|
||||
printf("\tMedia has %d cylinders, %d heads and %d sectors per track\n",
|
||||
ctx->imageInfo.Cylinders,
|
||||
ctx->imageInfo.Heads,
|
||||
ctx->imageInfo.SectorsPerTrack);
|
||||
printf("\tMedia has %d cylinders, %d heads and %d sectors per track\n", ctx->imageInfo.Cylinders,
|
||||
ctx->imageInfo.Heads, ctx->imageInfo.SectorsPerTrack);
|
||||
|
||||
if(ctx->checksums.hasMd5)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,8 @@ int verify(char* path)
|
||||
|
||||
res = aaruf_verify_image(ctx);
|
||||
|
||||
if(res == AARUF_STATUS_OK) printf("Image blocks contain no errors.\n");
|
||||
if(res == AARUF_STATUS_OK)
|
||||
printf("Image blocks contain no errors.\n");
|
||||
else if(res == AARUF_ERROR_INVALID_BLOCK_CRC)
|
||||
printf("A block contains an invalid CRC value.\n");
|
||||
else
|
||||
@@ -89,15 +90,8 @@ int verify_sectors(char* path)
|
||||
continue;
|
||||
}
|
||||
|
||||
verify_result = check_cd_sector_channel(cd_ecc_context,
|
||||
buffer,
|
||||
&unknown,
|
||||
&has_edc,
|
||||
&edc_correct,
|
||||
&has_ecc_p,
|
||||
&ecc_p_correct,
|
||||
&has_ecc_q,
|
||||
&ecc_q_correct);
|
||||
verify_result = check_cd_sector_channel(cd_ecc_context, buffer, &unknown, &has_edc, &edc_correct, &has_ecc_p,
|
||||
&ecc_p_correct, &has_ecc_q, &ecc_q_correct);
|
||||
|
||||
if(verify_result) continue;
|
||||
|
||||
@@ -118,7 +112,8 @@ int verify_sectors(char* path)
|
||||
any_error = true;
|
||||
}
|
||||
|
||||
if(any_error) printf("\rSome sectors had incorrect checksums.\n");
|
||||
if(any_error)
|
||||
printf("\rSome sectors had incorrect checksums.\n");
|
||||
else
|
||||
printf("\rAll sector checksums are correct.\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user