mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-04-05 21:51:03 +00:00
79b2c0dff8f40e3fe81de247431b0b8fac977bd1
7 tests across two files covering three upstreamed Mode 2 bug fixes: mode2_nocrc.cpp — fix/mode2-form2-nocrc-edc regression: - NoCrcEdcBytesAreZero: Form 2 sectors with zero EDC read back with bytes 2348..2351 zeroed (not uninitialized). Uses poisoned buffer (0xCC fill) to detect missing memset. - ValidEdcSurvivesRoundtrip: sanity check that valid-EDC sectors are not treated as NoCrc. - MixedNoCrcAndValidEdcPerSector: alternating NoCrc/Ok sectors verify per-sector DDT suffix status tracking. mode2_errored.cpp — fix/mode2-errored-suffix-read and fix/mode2-form-detection-read regressions: - ErroredForm2SuffixRestored: wrong EDC (0xDEADBEEF) survives roundtrip through the 4-byte suffix buffer for Form 2 errored sectors. - ErroredForm1SuffixRestored: full 280-byte suffix (EDC+ECC) survives roundtrip for Form 1 errored sectors. - MixedErroredForm1AndForm2: alternating forms in one track, verifying the DDT correctly dispatches per-sector. - DisagreeingSubheaderUsesForm2: subheader copy 1 says Form 1, copy 2 says Form 2 — verifies OR logic picks Form 2 and all 2324 bytes of user data are intact (old bug corrupted bytes 2072+). All tests use programmatic fixtures via aaruf_create/write_sector_long with crafted 2352-byte sectors — no external data files needed.
libaaruformat
C implementation of Aaru file format.
The target is to be able to compile it with a normal C (C89 compliant) compiler.
There are no external dependencies.
cmake is not a hard dependency, it's merely for the ease of using IDEs (specifically CLion).
Currently supported features:
- AaruFormat V1 images reading (writing will never be implemented)
- AaruFormat V2 images reading and writing
- LZMA compression
- Claunia Subchannel Transform
- Optical disc tracks
- XML metadata retrieval (writing will never be implemented)
- JSON metadata retrieval and writing
- Hashing while writing (MD5, SHA1, SHA256, SpamSum and BLAKE3)
- Deduplication
- Tape file and partitions
- Dump hardware lists
- Currently on sync (as of October 2025) with Aaru's media type list
- CHS geometry retrieval and setting
- Metadata
- Unit testing
- Automatic generation of API documentation
- It is to all effects feature parity with C#
Things still to be implemented that are already in the C# version:
- Automatic media type generation from C# enumeration
- Nuget package for linking with Aaru
Things to be implemented not in the C# version (maybe):
- Compile for Dreamcast (KallistiOS preferibly)
- Compile for PlayStation Portable
- Compile for Wii
- Compile for Wii U
- Compile for PlayStation 2
- Compile for PlayStation 3
- Snapshots
- Parent images
- Data positioning measurements
Building and Testing
Standard Build
mkdir build
cd build
cmake ..
cmake --build .
Running Tests
cd build
ctest --verbose
Building with Address Sanitizer
For debugging memory issues, you can build with Address Sanitizer enabled:
mkdir build-asan
cd build-asan
cmake -DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .
ctest --verbose
For detailed information on using Address Sanitizer to detect memory issues, see docs/ASAN_USAGE.md.
Other Build Options
-DUSE_SLOG=ON- Enable slog logging for debugging-DUSE_ASAN=ON- Enable Address Sanitizer for memory error detection
Languages
C
90.4%
C++
8.1%
CMake
1.2%
Shell
0.2%
PowerShell
0.1%