Commit Graph

770 Commits

Author SHA1 Message Date
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
a1cf319999 Merge pull request #8 from RomTholos/feat/reserve-zstd-compression-id
Reserve compression ID 4 for Zstandard (zstd)
2026-03-18 21:21:29 +00:00
Kevin Bortis
95908b328a Reserve compression IDs 4 and 5 for Zstandard (zstd)
Adds kCompressionZstd = 4 and kCompressionZstdCst = 5 to the
CompressionType enum, following the existing LZMA/LzmaCst pattern.

Ref: https://github.com/aaru-dps/libaaruformat/issues/5
2026-03-18 22:20:26 +01:00
1987d5898d Merge pull request #7 from RomTholos/cmake/build-shared-static
Support static and shared library builds via BUILD_SHARED_LIBS
2026-03-18 21:20:03 +00:00
0b47ee5730 Merge pull request #6 from RomTholos/fix/mode2-form2-nocrc-edc
Fix uninitialized EDC bytes for Mode 2 Form 2 NoCrc sectors
2026-03-18 21:18:54 +00:00
Kevin Bortis
c5f79a350f Support static and shared library builds via BUILD_SHARED_LIBS
Replace hardcoded SHARED in add_library() with the standard CMake
BUILD_SHARED_LIBS variable. Default remains shared for backwards
compatibility.

  -DBUILD_SHARED_LIBS=OFF → static library (libaaruformat.a)
  -DBUILD_SHARED_LIBS=ON  → shared library (libaaruformat.so, default)

Also define _POSIX_C_SOURCE=200809L on non-Windows platforms so that
POSIX functions (strdup, fseeko, ftello) are properly declared when
building with CMAKE_C_EXTENSIONS=OFF (strict C99 mode).

Tested: shared + static with GCC, static with musl cross-compiler.
2026-03-18 21:48:27 +01:00
Kevin Bortis
cf4b09b8b0 Fix uninitialized EDC bytes for Mode 2 Form 2 NoCrc sectors
When reading back Mode 2 Form 2 sectors with SectorStatusMode2Form2NoCrc,
the 4-byte EDC field at bytes 2348-2351 was left untouched. Since the
caller's buffer may contain arbitrary data, this results in non-deterministic
output for those bytes.

The NoCrc status indicates the original disc had no CRC (zeroed EDC).
The fix adds the missing else branch to zero the EDC field, matching
the behavior that Mode2Form2Ok already has via aaruf_ecc_cd_reconstruct.

Both DDT v1 and v2 code paths are fixed.
2026-03-18 21:36:44 +01:00
d841cbbafe Bump version to 1.0.0-alpha.33 in libaaruformat.nuspec v1.0.0-alpha.33 2026-03-18 09:13:19 +00:00
a9be6b51bc Return correct error status and expected buffer length when buffer is null in generated sectors. 2026-03-18 09:13:01 +00:00
c989ba6131 Reorder includes in helpers.c: move wincrypt.h after windows.h for better organization v1.0.0-alpha.31 2026-03-17 01:26:13 +00:00
5a744cad80 Bump version to 1.0.0-alpha.31 in libaaruformat.nuspec 2026-03-16 23:07:35 +00: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
1956900b80 Add disc information display for GameCube/Wii: include game ID, title, maker code, disc number, version, region, and size 2026-03-16 19:30:29 +00:00
a15cc47b84 Fix stream position calculation for junk region: adjust to use block start for seed alignment 2026-03-16 19:30:07 +00:00
41efd51f5d Enhance progress display for GameCube/Wii conversion: add speed and progress bar visualization 2026-03-16 19:10:31 +00:00
58a78c795c Refactor include paths for PS3 tools: update headers to use the ps3 directory 2026-03-16 19:07:19 +00:00
7b05275c47 Add tests for Nintendo GameCube/Wii LFG PRNG and junk map serialization 2026-03-16 19:05:09 +00:00
39dff09653 Add implementation for GameCube/Wii disc image conversion: complete convert-ngcw function and related utilities 2026-03-16 19:02:02 +00:00
347e689ebc Add support for converting Nintendo GameCube/Wii images: implement convert-ngcw command and usage 2026-03-16 18:54:23 +00:00
ebf3fd3e85 Add support for Nintendo GameCube/WiiU: include additional source files for encryption and junk handling 2026-03-16 18:50:10 +00:00
bd10c2ea29 Free resources for Nintendo GameCube/Wii junk map and Wii encryption contexts: implement cleanup in close function 2026-03-16 18:49:33 +00:00
96cace1860 Add support for regenerating junk sectors and Wii re-encryption: implement lazy initialization and encryption handling 2026-03-16 18:47:18 +00:00
05e451d68e Add support for generable sectors in write process: implement DDT entry handling without data storage 2026-03-16 18:42:25 +00:00
dd23682c16 Disable checksums for unencrypted and generable sectors in write process 2026-03-16 18:41:54 +00:00
a128473f41 Add Wii disc encryption support: implement partition key map and group encrypt/decrypt functions 2026-03-16 18:39:18 +00:00
d5d6e036e4 Add junk map serialization and deserialization for Nintendo GameCube/Wii: implement functions for entry management and lazy initialization 2026-03-16 18:39:08 +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
b50f2e56b6 Add new media tag mappings for Wii and GameCube: include WiiPartitionKeyMap and NgcwJunkMap for improved data handling 2026-03-16 18:32:45 +00:00
53bbb3c7a6 Add new data types for Nintendo Wii and GameCube: introduce WiiPartitionKeyMap and NgcwJunkMap for enhanced region mapping 2026-03-16 18:31:27 +00:00
2ebe8127bd Add Lagged Fibonacci Generator for Nintendo GameCube/Wii: implement LFG context and functions for junk data generation 2026-03-16 18:28:22 +00:00
7ee97105b5 Add new sector status: introduce SectorStatusGenerable to indicate content that can be generated using a known algorithm 2026-03-16 17:28:54 +00:00
98ec0c4add Refactor file structure: rename and reorganize PS3 and Wii U source files for better clarity and maintainability 2026-03-16 17:21:58 +00:00
317ca23a3e Refactor file structure: rename and reorganize PS3 and Wii U source files for better clarity and maintainability 2026-03-16 17:21:48 +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
70b51ec38e Add Wii U conversion support: implement command and usage for converting WUD/WUX to AaruFormat 2026-03-16 12:01:38 +00:00
03a5a06888 Add WIIU disc image converter: implement conversion logic for WUD/WUX to AaruFormat 2026-03-16 11:55:07 +00:00
f8cf406709 Add WIIU reader abstraction: implement WUD/WUX file handling and reading logic 2026-03-16 11:27:50 +00:00
8112899246 Add Wii U crypto support: include source files for Wii U encryption 2026-03-16 11:24:38 +00:00
1c577808d1 Add Wii U re-encryption support: implement sector key retrieval and encryption logic 2026-03-16 11:20:46 +00:00
a6226e0c2e Add Wii U disc encryption support: implement key mapping, encrypt/decrypt functions, and serialization 2026-03-16 11:16:27 +00:00
b6fddcced6 Add Wii U partition key mapping to data type and media tag handling 2026-03-16 11:13:10 +00:00
93357cbf1f Add Wii U encryption support to context structure and cleanup logic 2026-03-16 11:11:40 +00:00
5857e16662 Add Wii U partition-to-key mapping to enums and media tags 2026-03-16 10:51:17 +00:00
a8f500fd5f Refactor AES-128 implementation: move source files to lib directory and update includes 2026-03-16 10:48:54 +00:00
45994c885d Add PS3 disc image conversion command with key resolution and metadata extraction 2026-03-16 00:40:46 +00:00
eec6c33195 Add minimal ISO 9660 reader and tests for PlayStation 3 2026-03-15 21:03:40 +00:00
8bbda5bf2b Add PARAM.SFO parser for PlayStation 3 game metadata 2026-03-15 20:07:52 +00:00
04f9204a25 Add IRD file parser for PlayStation 3 disc images 2026-03-15 19:49:12 +00:00
73dac131b8 Implement PS3 encryption support with lazy initialization and error handling 2026-03-15 19:12:59 +00:00
85dc9ea1b8 Added PS3 encryption. 2026-03-15 18:32:08 +00:00