Commit Graph

80 Commits

Author SHA1 Message Date
0941efe22c Recover a damaged Data Position Measurement block with erasure coding, once the erasure coding map is loaded 2026-10-08 18:30:20 +01:00
7b26941537 Add the Data Position Measurement block, with aaruf_get_dpm, aaruf_set_dpm and aaruf_clear_dpm, kept on resume and verified by its CRC 2026-10-08 14:45:59 +01:00
Rebecca Wallander
a6345b7efc Handle flux-only images 2026-05-01 09:14:06 +02:00
2676d8fe0c Merge branch 'devel' of github.com:aaru-dps/libaaruformat into devel 2026-04-12 14:49:24 +01:00
a5bd3279f5 Do EC recovery on secondary level DDT2 reading. 2026-04-12 14:45:52 +01:00
1f7532b0ee Add EC recovery of non-data blocks. 2026-04-12 14:37:54 +01:00
Rebecca Wallander
71f1ab5290 Actually write the BD sector tags to file 2026-04-12 15:09:38 +02:00
92ca533db8 Use EC to recover damaged data blocks. 2026-04-11 21:02:44 +01:00
af4503f376 Write EC when writing data blocks. 2026-04-11 20:28:48 +01:00
Kevin Bortis
d8ff7b4a28 refactor: split close.c into reader/writer
Separate writer finalization from resource cleanup in close.c to
enable a future reader-only library target (aaruformatread).

close_write.c contains all write_* helpers and aaruf_finalize_write().
close.c retains aaruf_close() with cleanup only, dispatching writer
finalization via a function pointer set by aaruf_create()/aaruf_open().

Zero behavioral change — same tests pass, same error semantics.
2026-04-02 08:32:10 +02:00
Kevin Bortis
6fabbefb30 Extend zstd compression to all sections, add featureIncompatible bit 2026-04-01 19:45:41 +02:00
Kevin Bortis
120174e4cd Add multi-threaded zstd compression support
Switch zstd encoder from simple API (ZSTD_compress) to advanced API
(ZSTD_CCtx + ZSTD_compress2) with configurable worker threads via
ZSTD_c_nbWorkers. Consumer controls threading through threads=N
option string parameter. Default is 1 (single-threaded, bit-identical
output to previous behavior).

- Enable ZSTD_MULTITHREAD compile definition and link pthreads
- Add num_threads field to options struct and context
- Parse threads=N in option string (clamped >= 1)
- Rewrite aaruf_zstd_encode_buffer() with num_threads parameter
- Update all call sites (write.c, close.c)
2026-03-29 12:56:19 +02:00
Kevin Bortis
6be36b6bda Add Zstandard compression support
Implements zstd as an alternative to LZMA for data block and
subchannel compression using the allocated compression IDs 4
(kCompressionZstd) and 5 (kCompressionZstdCst).

Adds zstd v1.5.7 as a bundled submodule with a static library
build including x86_64 assembly fast path for decompression.

Write path selects zstd or LZMA based on the zstd option.
Subchannel blocks use zstd+CST instead of LZMA+CST when enabled.
LZMA properties header is only written for LZMA-based compression
types, preventing format corruption in zstd-compressed images.

Activated via options string: "zstd=true;zstd_level=19".
Default remains LZMA for backwards compatibility.

Tested: SHA-256 verified lossless roundtrips across 9 disc systems
(Dreamcast, Saturn, Mega CD, PC Engine CD, Neo Geo CD, PS1, PS2 CD,
PS2 DVD) and PS1 SBI subchannel preservation with zstd+CST.
2026-03-19 08:45:07 +01:00
694601cc63 Enhance Wii junk data handling: reconstruct junk in user data area during read and write operations 2026-03-16 22:54:53 +00:00
5b93c56e7b Add support for Nintendo Wii and GameCube junk map and encryption: implement lazy initialization for NgcwJunkEntry and WiiPartitionRegion 2026-03-16 18:34:24 +00:00
913d0508a2 Add recursion guard for Wii U re-encryption: implement flag to prevent recursive calls during sector processing 2026-03-16 13:28:16 +00:00
93357cbf1f Add Wii U encryption support to context structure and cleanup logic 2026-03-16 11:11:40 +00:00
73dac131b8 Implement PS3 encryption support with lazy initialization and error handling 2026-03-15 19:12:59 +00:00
Rebecca Wallander
65d34b1e9a Add flux implementation 2026-01-01 13:35:43 +01:00
050810c91d Update copyright year to 2026. 2025-12-23 08:23:40 +00:00
03c091fdee Add dirty flags so structures only get rewritten on resume if they are changed. 2025-12-12 12:22:39 +00:00
94e44ef304 Do not consider rewinded the first time block 0 is written. 2025-10-20 01:13:14 +01:00
e9f2dad6bf Fix typo in aaruformatContext structure documentation 2025-10-10 22:37:52 +01:00
ffe9311a74 Fix some places where the DDT was still being used with 32-bit values. 2025-10-10 11:45:18 +01:00
17e1c0f2bd Set DDTv2 as 64-bit and remove concept of multiple sizes of DDTs. 2025-10-10 02:39:57 +01:00
ac0e2610e1 Refactor context structure for improved padding 2025-10-09 02:37:46 +01:00
b884cfe8ea Rename field names for consistency across the codebase 2025-10-09 02:33:35 +01:00
fb4acfcbda Refactor metadata handling in context structures to improve organization and clarity 2025-10-09 02:06:34 +01:00
b02f9d4402 Refactor aaruformatContext structure for improved organization and clarity 2025-10-09 01:57:32 +01:00
fafca45dae Remove concept of 16-bit DDTs. 2025-10-09 01:47:39 +01:00
2ec5aabd00 Add support for tape DDT management with hash table implementation 2025-10-07 18:03:19 +01:00
ca60bc53ed Add support for processing tape partition metadata blocks 2025-10-07 14:40:57 +01:00
f62899ed06 Add support for processing tape files and update context structures 2025-10-07 11:34:37 +01:00
82980a8b0b Add support for block compression with LZMA and FLAC in writing process 2025-10-06 15:41:45 +01:00
93c402ceff Add function to write per-sector tag data for optical and block media 2025-10-06 05:47:56 +01:00
365f4f534a Add support for write long for DVD sector 2025-10-06 04:53:30 +01:00
4491df8689 Add support for processing Aaru metadata JSON blocks 2025-10-05 05:06:30 +01:00
bed8b39af6 Rename sectorSubchannel to sector_subchannel for consistency across the codebase 2025-10-04 02:08:58 +01:00
74ba5c8bfe Rename sectorSuffix to sector_suffix for consistency 2025-10-03 22:53:45 +01:00
1feb82a678 Rename sectorPrefix to sector_prefix for consistency 2025-10-03 19:53:16 +01:00
cc56c2cc34 Rename mode2Subheaders to mode2_subheaders for consistency in context.h, data.c, close.c, read.c, and info.c 2025-10-03 19:19:31 +01:00
879a41d5a1 Add long sector writing support and related error handling in write.c and context.h 2025-10-03 17:58:07 +01:00
38b9d1fa26 Implement track type handling for optical images in write.c and context.h 2025-10-03 15:25:01 +01:00
506b153930 Add support for on-the-fly BLAKE3 checksum calculation 2025-10-03 04:01:30 +01:00
6ebf65d36d Add on-the-fly SpamSum calculation support 2025-10-03 03:45:20 +01:00
79ac2e380c Add SHA-256 checksum calculation support 2025-10-03 02:03:39 +01:00
1e569c68a1 Add SHA-1 checksum calculation support 2025-10-03 01:49:44 +01:00
59addd3efc Implement on-the-fly MD5 checksum calculation 2025-10-03 00:57:14 +01:00
9e128a0ab8 Add rewind tracking to aaruformatContext and initialize in create.c 2025-10-03 00:17:16 +01:00
1c0c9cbf71 Remove legacy Crc64Context structure for improved code clarity 2025-10-02 20:46:06 +01:00