Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1d8f465
Correct a typo.
Clownacy Feb 3, 2026
ba5656f
Add DVD identifier.
Clownacy Feb 3, 2026
225b713
Add new file IO callback API.
Clownacy Feb 3, 2026
2d9b1a5
Remove stubbed `chd_codec_config` and `chd_get_codec_name` functions.
Clownacy Feb 3, 2026
efe696e
Remove usage of `ssize_t`.
Clownacy Feb 3, 2026
58a2e9e
Avoid potentially including C++ code in `extern "C"` block.
Clownacy Feb 3, 2026
f79df8a
Address 'unused variable' compiler warnings.
Clownacy Feb 3, 2026
b2a9bea
Remove unused `map_assemble`.
Clownacy Feb 3, 2026
ebebe3c
Remove unused cached-chunk logic.
Clownacy Feb 3, 2026
dbd8b78
Add missing handling of `core_fread` return values.
Clownacy Feb 3, 2026
593ea49
Fix C++ incompatibilities.
Clownacy Feb 3, 2026
5e746bc
Address some 'comparing signed with unsigned' warnings.
Clownacy Feb 3, 2026
f92beb2
Remove some useless indirection of function pointers.
Clownacy Feb 3, 2026
5bbfbcd
Make comments consistently C89.
Clownacy Feb 3, 2026
35f290e
Correct some goofy integer types in `chd.h`'s comments.
Clownacy Feb 3, 2026
c9b2581
Tidy-up `flac_decoder_decode_interleaved`.
Clownacy Feb 3, 2026
7b7a9e7
Deduplicate macros by moving them to a header file.
Clownacy Feb 3, 2026
a2f0bb4
Use proper constants for `flac_decoder_seek_callback` return values.
Clownacy Feb 3, 2026
75a4f42
Deduplicate endian-detection code.
Clownacy Feb 3, 2026
66a1f73
Add missing `#if 0` blocks around debug code.
Clownacy Feb 3, 2026
79b87d4
Use `memcmp` instead of `strncmp`.
Clownacy Feb 3, 2026
9e73e2e
Make the version-specific header logic more robust.
Clownacy Feb 3, 2026
a0d52c4
Correct a typo.
Clownacy Feb 3, 2026
62bfe4c
Merge header reading and validation.
Clownacy Feb 3, 2026
16e1ccf
Handle fseek errors.
Clownacy Feb 3, 2026
63beef8
Deduplicate file seeking-and-reading logic.
Clownacy Feb 3, 2026
0ffb578
Apply `EARLY_EXIT` macro to more code.
Clownacy Feb 3, 2026
dcc2205
Only read as much header data as there actually is.
Clownacy Feb 5, 2026
1cc6b0a
Replace bundled zlib with miniz.
Clownacy Feb 5, 2026
78e7fbc
Replace bundled zstd with a single-file-library version of itself.
Clownacy Feb 5, 2026
6027f85
Remove unused LZMA files.
Clownacy Feb 5, 2026
c85c8bf
Remove the need for specifying LZMA's include directory.
Clownacy Feb 5, 2026
2923c70
Update LZMA to 25.01.
Clownacy Feb 5, 2026
7e69896
Switch all include paths to relative.
Clownacy Feb 5, 2026
13cd596
Add unity-build script.
Clownacy Feb 5, 2026
bd50295
Add `CHDR_INLINE` macros.
Clownacy Feb 5, 2026
9526f4b
Namespace LZMA functions to prevent name-collisions.
Clownacy Feb 5, 2026
86de86b
Update dr_flac to v0.13.3.
Clownacy Feb 5, 2026
bc7266b
Split zlib codec to its own file.
Clownacy Feb 5, 2026
6c5519d
Split CDZL codec to its own file.
Clownacy Feb 5, 2026
3422671
Split LZMA codec to its own file.
Clownacy Feb 5, 2026
fa8736b
Split CDLZ codec to its own file.
Clownacy Feb 5, 2026
b5b2c82
Split zstd codec to its own file.
Clownacy Feb 5, 2026
d4cc037
Split CDZS codec to its own file.
Clownacy Feb 5, 2026
150943f
Split FLAC codec to its own file.
Clownacy Feb 5, 2026
cb87905
Split CDFL codec to its own file.
Clownacy Feb 5, 2026
3fe7dc1
Split Huffman codec to its own file.
Clownacy Feb 5, 2026
1af8d73
Update unity file.
Clownacy Feb 5, 2026
a70471d
Move `s_cd_sync_header` to `libchdr_cdrom.c`.
Clownacy Feb 5, 2026
55a55b3
Deduplicate CDXX decompress functions.
Clownacy Feb 5, 2026
052b429
Rename `lzma` target to avoid collision with SwanStation.
Clownacy Feb 6, 2026
f956f13
Fix compiling with `WANT_RAW_DATA_SECTOR` disabled.
Clownacy Feb 7, 2026
2203b5a
Add CMake options for `WANT_RAW_DATA_SECTOR`, `WANT_SUBCODE`, and `VE…
Clownacy Feb 7, 2026
22d0f6f
Correct some indentation.
Clownacy Feb 11, 2026
6fe4041
Silence some 'case may fall through' warnings.
Clownacy Feb 11, 2026
ff1365d
Avoid 'type and field name matching is incompatible with C++' warnings.
Clownacy Feb 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
70 changes: 50 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ endif()
option(INSTALL_STATIC_LIBS "Install static libraries" OFF)
option(WITH_SYSTEM_ZLIB "Use system provided zlib library" OFF)
option(WITH_SYSTEM_ZSTD "Use system provided zstd library" OFF)
option(CHDR_WANT_RAW_DATA_SECTOR "Output ECC data and sync header" ON)
option(CHDR_WANT_SUBCODE "Output CD subchannel data" ON)
option(CHDR_VERIFY_BLOCK_CRC "Verify integrity of decoded data" ON)

option(BUILD_LTO "Compile libchdr with link-time optimization if supported" OFF)
if(BUILD_LTO)
Expand All @@ -32,25 +35,22 @@ include(GNUInstallDirs)
# dependencies
#--------------------------------------------------


# lzma
if(NOT TARGET lzma)
add_subdirectory(deps/lzma-24.05 EXCLUDE_FROM_ALL)
if(NOT TARGET chdr-lzma)
add_subdirectory(deps/lzma-25.01 EXCLUDE_FROM_ALL)
endif()
list(APPEND CHDR_LIBS lzma)
list(APPEND CHDR_INCLUDES lzma)
list(APPEND CHDR_LIBS chdr-lzma)

# zlib
if (WITH_SYSTEM_ZLIB)
find_package(ZLIB REQUIRED)
list(APPEND PLATFORM_LIBS ZLIB::ZLIB)
list(APPEND CHDR_DEFINES CHDR_SYSTEM_ZLIB)
else()
if(NOT TARGET zlibstatic)
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" OFF)
add_subdirectory(deps/zlib-1.3.1 EXCLUDE_FROM_ALL)
set_target_properties(zlibstatic PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(NOT TARGET miniz)
add_subdirectory(deps/miniz-3.1.0 EXCLUDE_FROM_ALL)
endif()
list(APPEND CHDR_LIBS zlibstatic)
list(APPEND CHDR_LIBS miniz)
endif()

# zstd
Expand All @@ -61,15 +61,36 @@ if (WITH_SYSTEM_ZSTD)
else()
list(APPEND PLATFORM_LIBS zstd::libzstd_static)
endif()
list(APPEND CHDR_DEFINES CHDR_SYSTEM_ZSTD)
else()
if(NOT TARGET libzstd_static)
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
add_subdirectory(deps/zstd-1.5.6/build/cmake EXCLUDE_FROM_ALL)
if(NOT TARGET zstd)
add_subdirectory(deps/zstd-1.5.7 EXCLUDE_FROM_ALL)
endif()
list(APPEND CHDR_LIBS libzstd_static)
list(APPEND CHDR_LIBS zstd)
endif()

#--------------------------------------------------
# options
#--------------------------------------------------

if(CHDR_WANT_RAW_DATA_SECTOR)
list(APPEND CHDR_DEFINES WANT_RAW_DATA_SECTOR=1)
else()
list(APPEND CHDR_DEFINES WANT_RAW_DATA_SECTOR=0)
endif()

if(CHDR_WANT_SUBCODE)
list(APPEND CHDR_DEFINES WANT_SUBCODE=1)
else()
list(APPEND CHDR_DEFINES WANT_SUBCODE=0)
endif()

if(CHDR_VERIFY_BLOCK_CRC)
list(APPEND CHDR_DEFINES VERIFY_BLOCK_CRC=1)
else()
list(APPEND CHDR_DEFINES VERIFY_BLOCK_CRC=0)
endif()

#--------------------------------------------------
# chdr
#--------------------------------------------------
Expand All @@ -78,15 +99,23 @@ set(CHDR_SOURCES
src/libchdr_bitstream.c
src/libchdr_cdrom.c
src/libchdr_chd.c
src/libchdr_codec_cdfl.c
src/libchdr_codec_cdlz.c
src/libchdr_codec_cdzl.c
src/libchdr_codec_cdzs.c
src/libchdr_codec_flac.c
src/libchdr_codec_huff.c
src/libchdr_codec_lzma.c
src/libchdr_codec_zlib.c
src/libchdr_codec_zstd.c
src/libchdr_flac.c
src/libchdr_huffman.c
)

list(APPEND CHDR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/include)

add_library(chdr-static STATIC ${CHDR_SOURCES})
target_include_directories(chdr-static PRIVATE ${CHDR_INCLUDES} PUBLIC include)
target_include_directories(chdr-static INTERFACE include)
target_link_libraries(chdr-static PRIVATE ${CHDR_LIBS} ${PLATFORM_LIBS})
target_compile_definitions(chdr-static PRIVATE ${CHDR_DEFINES})

if(MSVC)
target_compile_definitions(chdr-static PRIVATE _CRT_SECURE_NO_WARNINGS)
Expand All @@ -100,8 +129,9 @@ endif()

if (BUILD_SHARED_LIBS)
add_library(chdr SHARED ${CHDR_SOURCES})
target_include_directories(chdr PRIVATE ${CHDR_INCLUDES} PUBLIC include)
target_include_directories(chdr INTERFACE include)
target_link_libraries(chdr PRIVATE ${CHDR_LIBS} ${PLATFORM_LIBS})
target_compile_definitions(chdr PRIVATE ${CHDR_DEFINES})

if(MSVC)
target_compile_definitions(chdr PUBLIC "CHD_DLL")
Expand Down
101 changes: 0 additions & 101 deletions deps/lzma-24.05/include/7zWindows.h

This file was deleted.

76 changes: 0 additions & 76 deletions deps/lzma-24.05/include/Alloc.h

This file was deleted.

Loading