Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update libchdr #433

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 39 additions & 28 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,47 @@ endif

ifdef HAVE_CHD
CXXFLAGS += -DHAVE_CHD -I./src/libchdr/include
CFLAGS += -D_7ZIP_ST -I./src/libchdr/include -I./src/libchdr/deps/lzma-22.01/include -I./src/libchdr/deps/zlib-1.2.12
CHD_OBJS = src/libchdr/deps/lzma-22.01/src/Alloc.o \
src/libchdr/deps/lzma-22.01/src/Bra86.o \
src/libchdr/deps/lzma-22.01/src/BraIA64.o \
src/libchdr/deps/lzma-22.01/src/CpuArch.o \
src/libchdr/deps/lzma-22.01/src/Delta.o \
src/libchdr/deps/lzma-22.01/src/LzFind.o \
src/libchdr/deps/lzma-22.01/src/Lzma86Dec.o \
src/libchdr/deps/lzma-22.01/src/Lzma86Enc.o \
src/libchdr/deps/lzma-22.01/src/LzmaDec.o \
src/libchdr/deps/lzma-22.01/src/LzmaEnc.o \
src/libchdr/deps/lzma-22.01/src/Sort.o \
src/libchdr/deps/zlib-1.2.12/adler32.o \
src/libchdr/deps/zlib-1.2.12/compress.o \
src/libchdr/deps/zlib-1.2.12/crc32.o \
src/libchdr/deps/zlib-1.2.12/deflate.o \
src/libchdr/deps/zlib-1.2.12/gzclose.o \
src/libchdr/deps/zlib-1.2.12/gzlib.o \
src/libchdr/deps/zlib-1.2.12/gzread.o \
src/libchdr/deps/zlib-1.2.12/gzwrite.o \
src/libchdr/deps/zlib-1.2.12/infback.o \
src/libchdr/deps/zlib-1.2.12/inffast.o \
src/libchdr/deps/zlib-1.2.12/inflate.o \
src/libchdr/deps/zlib-1.2.12/inftrees.o \
src/libchdr/deps/zlib-1.2.12/trees.o \
src/libchdr/deps/zlib-1.2.12/uncompr.o \
src/libchdr/deps/zlib-1.2.12/zutil.o \
CFLAGS += -DZ7_ST -DZSTD_DISABLE_ASM -I./src/libchdr/include -I./src/libchdr/deps/lzma-24.05/include -I./src/libchdr/deps/zlib-1.3.1 -I./src/libchdr/deps/zstd-1.5.6/lib
CHD_OBJS = src/libchdr/deps/lzma-24.05/src/Alloc.o \
src/libchdr/deps/lzma-24.05/src/Bra86.o \
src/libchdr/deps/lzma-24.05/src/BraIA64.o \
src/libchdr/deps/lzma-24.05/src/CpuArch.o \
src/libchdr/deps/lzma-24.05/src/Delta.o \
src/libchdr/deps/lzma-24.05/src/LzFind.o \
src/libchdr/deps/lzma-24.05/src/Lzma86Dec.o \
src/libchdr/deps/lzma-24.05/src/LzmaDec.o \
src/libchdr/deps/lzma-24.05/src/LzmaEnc.o \
src/libchdr/deps/lzma-24.05/src/Sort.o \
src/libchdr/deps/zlib-1.3.1/adler32.o \
src/libchdr/deps/zlib-1.3.1/compress.o \
src/libchdr/deps/zlib-1.3.1/crc32.o \
src/libchdr/deps/zlib-1.3.1/deflate.o \
src/libchdr/deps/zlib-1.3.1/gzclose.o \
src/libchdr/deps/zlib-1.3.1/gzlib.o \
src/libchdr/deps/zlib-1.3.1/gzread.o \
src/libchdr/deps/zlib-1.3.1/gzwrite.o \
src/libchdr/deps/zlib-1.3.1/infback.o \
src/libchdr/deps/zlib-1.3.1/inffast.o \
src/libchdr/deps/zlib-1.3.1/inflate.o \
src/libchdr/deps/zlib-1.3.1/inftrees.o \
src/libchdr/deps/zlib-1.3.1/trees.o \
src/libchdr/deps/zlib-1.3.1/uncompr.o \
src/libchdr/deps/zlib-1.3.1/zutil.o \
src/libchdr/deps/zstd-1.5.6/lib/common/debug.o \
src/libchdr/deps/zstd-1.5.6/lib/common/entropy_common.o \
src/libchdr/deps/zstd-1.5.6/lib/common/error_private.o \
src/libchdr/deps/zstd-1.5.6/lib/common/fse_decompress.o \
src/libchdr/deps/zstd-1.5.6/lib/common/pool.o \
src/libchdr/deps/zstd-1.5.6/lib/common/threading.o \
src/libchdr/deps/zstd-1.5.6/lib/common/xxhash.o \
src/libchdr/deps/zstd-1.5.6/lib/common/zstd_common.o \
src/libchdr/deps/zstd-1.5.6/lib/decompress/huf_decompress.o \
src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_ddict.o \
src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_decompress.o \
src/libchdr/deps/zstd-1.5.6/lib/decompress/zstd_decompress_block.o \
src/libchdr/src/libchdr_bitstream.o \
src/libchdr/src/libchdr_cdrom.o \
src/libchdr/src/libchdr_chd.o \
src/libchdr/src/libchdr_flac.o \
src/libchdr/src/libchdr_huffman.o
endif
endif
17 changes: 16 additions & 1 deletion src/HashCHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ static bool rc_hash_get_chd_metadata(chd_file* file, uint32_t idx, metadata_t* m
return true;
}

/* DVD formatted track is not yet supported by libchdr, but we can fake it. A DVD only has one track, so
* if we're looking for the first metadata, and haven't found it yet, look for the DVD tag and go with it. */
if (idx == 0)
{
err = chd_get_metadata(file, CHD_MAKE_TAG('D', 'V', 'D', ' '), idx, meta, sizeof(meta), &meta_size, NULL, NULL);
if (err == CHDERR_NONE)
{
/* DVD-ROM track doesn't have metadata. It's just raw 2048 byte sectors with no header/footer (MODE1) */
memset(metadata, 0, sizeof(metadata));
metadata->track = 1;
memcpy(metadata->type, "MODE1", strlen("MODE1") + 1);
return true;
}
}

return false;
}

Expand Down Expand Up @@ -240,7 +255,7 @@ static void* rc_hash_handle_chd_open_track(const char* path, uint32_t track)
chd_error err = chd_open(path, CHD_OPEN_READ, NULL, &file);
if (err != CHDERR_NONE) {
char errmessage[128];
snprintf(errmessage, sizeof(errmessage), "CHD %s", chd_error_string(err));
snprintf(errmessage, sizeof(errmessage), "chd_open failed: %s", chd_error_string(err));
rc_hash_error(errmessage);
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libchdr
Submodule libchdr updated 1127 files
97 changes: 45 additions & 52 deletions src/libchdr.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_7ZIP_ST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;Z7_ST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-22.01\include;$(ProjectDir)libchdr\deps\zlib-1.2.12;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-24.05\include;$(ProjectDir)libchdr\deps\zstd-1.5.6\lib;$(ProjectDir)libchdr\deps\zlib-1.3.1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<ConformanceMode>true</ConformanceMode>
<WarningLevel>Level2</WarningLevel>
Expand All @@ -69,22 +69,18 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
<PreBuildEvent>
<Command>IF NOT EXIST $(ProjectDir)libchdr\deps\zalib-1.2.12\zconf.h COPY $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h.included $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_7ZIP_ST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;Z7_ST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-22.01\include;$(ProjectDir)libchdr\deps\zlib-1.2.12;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-24.05\include;$(ProjectDir)libchdr\deps\zstd-1.5.6\lib;$(ProjectDir)libchdr\deps\zlib-1.3.1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<ConformanceMode>true</ConformanceMode>
<WarningLevel>Level2</WarningLevel>
Expand All @@ -97,20 +93,16 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
<PreBuildEvent>
<Command>IF NOT EXIST $(ProjectDir)libchdr\deps\zalib-1.2.12\zconf.h COPY $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h.included $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_7ZIP_ST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;Z7_ST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-22.01\include;$(ProjectDir)libchdr\deps\zlib-1.2.12;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-24.05\include;$(ProjectDir)libchdr\deps\zstd-1.5.6\lib;$(ProjectDir)libchdr\deps\zlib-1.3.1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
Expand All @@ -120,18 +112,13 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
<Lib />
<PreBuildEvent>
<Command>IF NOT EXIST $(ProjectDir)libchdr\deps\zalib-1.2.12\zconf.h COPY $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h.included $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_7ZIP_ST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;Z7_ST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-22.01\include;$(ProjectDir)libchdr\deps\zlib-1.2.12;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)libchdr\include;$(ProjectDir)libchdr\deps\lzma-24.05\include;$(ProjectDir)libchdr\deps\zstd-1.5.6\lib;$(ProjectDir)libchdr\deps\zlib-1.3.1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
Expand All @@ -142,39 +129,45 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
<Lib />
<PreBuildEvent>
<Command>IF NOT EXIST $(ProjectDir)libchdr\deps\zalib-1.2.12\zconf.h COPY $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h.included $(ProjectDir)libchdr\deps\zlib-1.2.12\zconf.h</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="libchdr\deps\lzma-22.01\src\Alloc.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\Bra86.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\BraIA64.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\CpuArch.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\Delta.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\LzFind.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\Lzma86Dec.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\Lzma86Enc.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\LzmaDec.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\LzmaEnc.c" />
<ClCompile Include="libchdr\deps\lzma-22.01\src\Sort.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\adler32.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\compress.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\crc32.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\deflate.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\gzclose.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\gzlib.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\gzread.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\gzwrite.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\infback.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\inffast.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\inflate.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\inftrees.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\trees.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\uncompr.c" />
<ClCompile Include="libchdr\deps\zlib-1.2.12\zutil.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\Alloc.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\Bra86.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\BraIA64.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\CpuArch.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\Delta.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\LzFind.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\Lzma86Dec.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\LzmaDec.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\LzmaEnc.c" />
<ClCompile Include="libchdr\deps\lzma-24.05\src\Sort.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\adler32.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\compress.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\crc32.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\deflate.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\gzclose.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\gzlib.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\gzread.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\gzwrite.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\infback.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\inffast.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\inflate.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\inftrees.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\trees.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\uncompr.c" />
<ClCompile Include="libchdr\deps\zlib-1.3.1\zutil.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\debug.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\entropy_common.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\error_private.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\fse_decompress.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\pool.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\threading.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\xxhash.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\common\zstd_common.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\decompress\huf_decompress.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\decompress\zstd_ddict.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\decompress\zstd_decompress.c" />
<ClCompile Include="libchdr\deps\zstd-1.5.6\lib\decompress\zstd_decompress_block.c" />
<ClCompile Include="libchdr\src\libchdr_bitstream.c" />
<ClCompile Include="libchdr\src\libchdr_cdrom.c" />
<ClCompile Include="libchdr\src\libchdr_chd.c" />
Expand Down
Loading
Loading