Commit Graph

821 Commits

Author SHA1 Message Date
Kevin Bortis
2cbd88a15b spec: clarify LZMA properties prefix in cmpLength and cmpCrc64 scope 2026-03-31 08:59:52 +02:00
3af5f1ec41 Merge pull request #24 from RomTholos/fix/lzma-threading-cleanup
Replace hardcoded LZMA thread count with LZMA_THREADS(ctx)
2026-03-29 22:26:11 +01:00
0e79486a9e [spec] Add annex about Nintendo Wii U Disc Encryption 2026-03-29 19:47:03 +01:00
1172630c84 [spec] Add annex about Nintendo Wii Disc Encryption 2026-03-29 19:37:16 +01:00
88e4b7cf57 [spec] Add annex about GameCube / Wii junk. 2026-03-29 19:30:36 +01:00
ea669e4040 [spec] Add annex about PlayStation 3 encryption. 2026-03-29 19:19:37 +01:00
01e46f9e16 [spec] Add emojis to all headings. 2026-03-29 19:05:06 +01:00
1dcf9fb619 [spec] Add emojis to Annex A. 2026-03-29 19:00:19 +01:00
ee93001607 [spec] Register emoji font. 2026-03-29 18:56:17 +01:00
8adb38096f [spec] Fixed heading in compression. 2026-03-29 18:50:39 +01:00
e168226e9a [spec] Write media types annex. 2026-03-29 18:47:15 +01:00
bf9328f755 [spec] Added historical mistake block identifier. 2026-03-29 18:35:23 +01:00
530dac88a9 [spec] Fixed metadata block description. 2026-03-29 18:33:55 +01:00
9f02e9ab62 [spec] Add Generable sector status. 2026-03-29 18:32:51 +01:00
bf55a0140c Update dependencies to latest version. 2026-03-29 18:31:27 +01:00
43385ad920 [spec] Add missing data types. 2026-03-29 18:31:14 +01:00
85098b0b9e [spec] Fix data type typo. 2026-03-29 18:30:59 +01:00
258d9e33d8 [spec] Fix incorrect data types in specification. 2026-03-29 18:28:54 +01:00
Kevin Bortis
3c00aed352 Replace hardcoded LZMA thread count with LZMA_THREADS(ctx)
The LZMA encoder was called with numThreads=8 at all 19 call sites,
but LZMA only supports 1 or 2 (and _7ZIP_ST forces it to 1 anyway).
Replace with LZMA_THREADS(ctx) macro that clamps ctx->num_threads
to [1, 2], making the code say what it means and honoring the
consumer's threading preference from the threads=N option.
2026-03-29 19:14:38 +02:00
c58bfc167f Merge remote-tracking branch 'origin/devel' into devel 2026-03-29 18:08:31 +01:00
a81a0fe09a Merge pull request #23 from RomTholos/fix/flac-error-handling
fix: FLAC error handling — decode corruption, encode crash, unchecked…
2026-03-29 18:01:20 +01:00
742851934a Merge pull request #22 from RomTholos/spec/clarify-string-encoding
spec: clarify string encoding per block type
2026-03-29 17:59:59 +01:00
d1f7665b3a Merge pull request #21 from RomTholos/spec/document-v1-crc64-byteswap
spec: document CRC64 byte-swap for V1 images
2026-03-29 17:58:24 +01:00
627a1d7edd Merge pull request #19 from RomTholos/spec/document-cst-algorithm
spec: full byte-level algorithm for Claunia Subchannel Transform
2026-03-29 17:56:33 +01:00
24bc41068c Merge pull request #18 from RomTholos/spec/document-blake3-checksum
spec: document BLAKE3 checksum algorithm (ID 5)
2026-03-29 17:54:42 +01:00
69cb91bcad Merge pull request #17 from RomTholos/spec/document-zstd-compression
spec: document Zstandard compression types (IDs 4, 5)
2026-03-29 17:54:06 +01:00
c2e71490df Merge pull request #16 from RomTholos/fix/spec-ddt2-alignment-formula
Fix/spec ddt2 alignment formula
2026-03-29 17:53:23 +01:00
94d2c6e67e Merge pull request #15 from RomTholos/feat/zstd-multithread
Add multi-threaded zstd compression support
2026-03-29 17:52:40 +01:00
Kevin Bortis
26e8d92810 fix: FLAC error handling — decode corruption, encode crash, unchecked returns 2026-03-29 15:47:27 +02:00
Kevin Bortis
4a3ddab743 spec: clarify string encoding per block type 2026-03-29 15:35:04 +02:00
Kevin Bortis
69186ae173 spec: document CRC64 byte-swap for V1 images 2026-03-29 15:32:28 +02:00
Kevin Bortis
94cfa27089 spec: full byte-level algorithm for Claunia Subchannel Transform 2026-03-29 15:24:14 +02:00
Kevin Bortis
4b14de20d8 spec: document BLAKE3 checksum algorithm (ID 5) 2026-03-29 15:16:49 +02:00
Kevin Bortis
b4262d1cf8 spec: document Zstandard compression types (IDs 4, 5) 2026-03-29 15:16:34 +02:00
Kevin Bortis
d9c1c9d607 spec: fix shift formulas in header block spec 2026-03-29 15:06:24 +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
b1240dd079 spec: fix block alignment shift formulas in DDT2 spec
The spec used `2 << x` where `1 << x` (= 2^x) was intended.
`2 << x` equals 2^(x+1), which is off by factor 2. The code
unanimously uses `1 << x` across 40+ sites. Corrects the
example result from 0x6A0000 to 0x350000 accordingly.
2026-03-26 18:05:30 +01:00
176a363996 Bump version to 1.0.0-alpha.35 in libaaruformat.nuspec 2026-03-25 16:49:46 +00:00
42c4febd98 Increase maximum number of plaintext regions from 32 to 64 in ps3_encryption_map.h 2026-03-25 16:49:24 +00:00
d3aea257ed Bump version to 1.0.0-alpha.34 in libaaruformat.nuspec v1.0.0-alpha.34 2026-03-22 21:48:54 +00:00
0b6f10e526 Merge pull request #14 from FakeShemp/fakeshemp/wii-long
Add long sector for Wii/GC
2026-03-19 20:07:18 +00:00
45a494e1a2 Merge pull request #13 from RomTholos/perf/lru-integer-keys
lru: use native uint64 keys instead of string conversion
2026-03-19 20:02:24 +00:00
Kevin Bortis
8a8a89450d lru: use native uint64 keys instead of string conversion
Replace string-keyed uthash lookups with HASH_FIND/HASH_ADD on native
uint64_t keys. This eliminates per-lookup malloc/snprintf/strlen/free
overhead from the block cache hot path (2 lookups per sector read).

Before: malloc(17) + snprintf hex + HASH_FIND_STR + free per lookup
After:  HASH_FIND with 8-byte integer key, zero allocations

Also removes the unused string-key API (find_in_cache/add_to_cache)
and the uint64_to_string helper — all callers use uint64 keys.

Fix off-by-one in eviction: >= caused cache to hold max_items-1
entries instead of max_items. Changed to > so the configured
capacity is honored exactly.
2026-03-19 20:35:42 +01:00
6dbd5f1bb2 Merge pull request #12 from RomTholos/fix/cross-compilation-arm-riscv
Fix cross-compilation for ARM FPU variants and add RISC-V support
2026-03-19 11:58:49 +00:00
c9cf1a42c0 Merge pull request #11 from RomTholos/fix/mode2-errored-suffix-read
Fix Mode 2 errored sector suffix not restored on read
2026-03-19 11:57:44 +00:00
Kevin Bortis
bd01e7d8a5 Fix cross-compilation for ARM FPU variants and add RISC-V support 2026-03-19 12:34:00 +01:00
65b00baf1a Merge pull request #10 from RomTholos/fix/calling-convention-pointer-order
Fix calling convention placement for pointer-returning functions
2026-03-19 09:50:02 +00:00
336934e2d5 Merge pull request #9 from RomTholos/feat/zstd-compression
Add Zstandard compression support
2026-03-19 09:49:30 +00:00
Kevin Bortis
48093ba779 Fix Mode 2 errored sector suffix not restored on read
When reading back Mode 2 sectors with errored ECC/EDC (SectorStatusErrored),
the else branch copied 2328 bytes from bare_data. However, bare_data only
contains the user data portion (2048 bytes for Form 1, 2324 for Form 2).
The EDC/ECC suffix was stored separately in sector_suffix during write but
never read back, causing the suffix area to contain stale data from adjacent
sectors in the decompressed block.

Fix both DDT v2 and v1 code paths to check the subheader form bit and copy
user data + suffix from their respective storage locations.

Affects any Mode 2 disc image (Dreamcast, PS1, PS2 CD, Saturn, Mega CD,
PC Engine CD, Neo Geo CD) where sectors have incorrect or zeroed ECC/EDC.
2026-03-19 10:11:06 +01:00
Kevin Bortis
981b54562e Fix calling convention placement for pointer-returning functions 2026-03-19 08:53:35 +01:00