Drop internal PhysFS, bump PhysFS requirement to 3.0.0
authorWuzzy <Wuzzy2@mail.ru>
Fri, 12 Oct 2018 03:40:21 +0200
changeset 13881 99b265e0d1d0
parent 13880 5f819b90d479
child 13882 b172a5d40eee
Drop internal PhysFS, bump PhysFS requirement to 3.0.0
CMakeLists.txt
INSTALL.md
hedgewars/CMakeLists.txt
misc/libphysfs/Android.mk
misc/libphysfs/CMakeLists.txt
misc/libphysfs/Xcode/Physfs.xcodeproj/project.pbxproj
misc/libphysfs/Xcode/Physfs_Prefix.pch
misc/libphysfs/archiver_dir.c
misc/libphysfs/archiver_grp.c
misc/libphysfs/archiver_hog.c
misc/libphysfs/archiver_iso9660.c
misc/libphysfs/archiver_lzma.c
misc/libphysfs/archiver_mvl.c
misc/libphysfs/archiver_qpak.c
misc/libphysfs/archiver_slb.c
misc/libphysfs/archiver_unpacked.c
misc/libphysfs/archiver_wad.c
misc/libphysfs/archiver_zip.c
misc/libphysfs/lzma/7zC.txt
misc/libphysfs/lzma/7zFormat.txt
misc/libphysfs/lzma/C/7zCrc.c
misc/libphysfs/lzma/C/7zCrc.h
misc/libphysfs/lzma/C/7zCrcT8.c
misc/libphysfs/lzma/C/Alloc.c
misc/libphysfs/lzma/C/Alloc.h
misc/libphysfs/lzma/C/Archive/7z/7zAlloc.c
misc/libphysfs/lzma/C/Archive/7z/7zAlloc.h
misc/libphysfs/lzma/C/Archive/7z/7zBuffer.c
misc/libphysfs/lzma/C/Archive/7z/7zBuffer.h
misc/libphysfs/lzma/C/Archive/7z/7zDecode.c
misc/libphysfs/lzma/C/Archive/7z/7zDecode.h
misc/libphysfs/lzma/C/Archive/7z/7zExtract.c
misc/libphysfs/lzma/C/Archive/7z/7zExtract.h
misc/libphysfs/lzma/C/Archive/7z/7zHeader.c
misc/libphysfs/lzma/C/Archive/7z/7zHeader.h
misc/libphysfs/lzma/C/Archive/7z/7zIn.c
misc/libphysfs/lzma/C/Archive/7z/7zIn.h
misc/libphysfs/lzma/C/Archive/7z/7zItem.c
misc/libphysfs/lzma/C/Archive/7z/7zItem.h
misc/libphysfs/lzma/C/Archive/7z/7zMain.c
misc/libphysfs/lzma/C/Archive/7z/7zMethodID.c
misc/libphysfs/lzma/C/Archive/7z/7zMethodID.h
misc/libphysfs/lzma/C/Archive/7z/7z_C.dsp
misc/libphysfs/lzma/C/Archive/7z/7z_C.dsw
misc/libphysfs/lzma/C/Archive/7z/makefile
misc/libphysfs/lzma/C/Archive/7z/makefile.gcc
misc/libphysfs/lzma/C/Compress/Branch/BranchARM.c
misc/libphysfs/lzma/C/Compress/Branch/BranchARM.h
misc/libphysfs/lzma/C/Compress/Branch/BranchARMThumb.c
misc/libphysfs/lzma/C/Compress/Branch/BranchARMThumb.h
misc/libphysfs/lzma/C/Compress/Branch/BranchIA64.c
misc/libphysfs/lzma/C/Compress/Branch/BranchIA64.h
misc/libphysfs/lzma/C/Compress/Branch/BranchPPC.c
misc/libphysfs/lzma/C/Compress/Branch/BranchPPC.h
misc/libphysfs/lzma/C/Compress/Branch/BranchSPARC.c
misc/libphysfs/lzma/C/Compress/Branch/BranchSPARC.h
misc/libphysfs/lzma/C/Compress/Branch/BranchTypes.h
misc/libphysfs/lzma/C/Compress/Branch/BranchX86.c
misc/libphysfs/lzma/C/Compress/Branch/BranchX86.h
misc/libphysfs/lzma/C/Compress/Branch/BranchX86_2.c
misc/libphysfs/lzma/C/Compress/Branch/BranchX86_2.h
misc/libphysfs/lzma/C/Compress/Huffman/HuffmanEncode.c
misc/libphysfs/lzma/C/Compress/Huffman/HuffmanEncode.h
misc/libphysfs/lzma/C/Compress/Lz/LzHash.h
misc/libphysfs/lzma/C/Compress/Lz/MatchFinder.c
misc/libphysfs/lzma/C/Compress/Lz/MatchFinder.h
misc/libphysfs/lzma/C/Compress/Lz/MatchFinderMt.c
misc/libphysfs/lzma/C/Compress/Lz/MatchFinderMt.h
misc/libphysfs/lzma/C/Compress/Lzma/LzmaDecode.c
misc/libphysfs/lzma/C/Compress/Lzma/LzmaDecode.h
misc/libphysfs/lzma/C/Compress/Lzma/LzmaDecodeSize.c
misc/libphysfs/lzma/C/Compress/Lzma/LzmaStateDecode.c
misc/libphysfs/lzma/C/Compress/Lzma/LzmaStateDecode.h
misc/libphysfs/lzma/C/Compress/Lzma/LzmaStateTest.c
misc/libphysfs/lzma/C/Compress/Lzma/LzmaTest.c
misc/libphysfs/lzma/C/Compress/Lzma/LzmaTypes.h
misc/libphysfs/lzma/C/CpuArch.h
misc/libphysfs/lzma/C/IStream.h
misc/libphysfs/lzma/C/Sort.c
misc/libphysfs/lzma/C/Sort.h
misc/libphysfs/lzma/C/Threads.c
misc/libphysfs/lzma/C/Threads.h
misc/libphysfs/lzma/C/Types.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7z.ico
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zDecode.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zDecode.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zEncode.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zEncode.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zExtract.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zFolderOutStream.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zHandler.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zHandler.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zHeader.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zHeader.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zIn.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zIn.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zItem.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zOut.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zOut.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zProperties.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zProperties.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zRegister.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zSpecStream.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/7zUpdate.h
misc/libphysfs/lzma/CPP/7zip/Archive/7z/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/7z/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Archive/Archive.def
misc/libphysfs/lzma/CPP/7zip/Archive/Archive2.def
misc/libphysfs/lzma/CPP/7zip/Archive/ArchiveExports.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CoderMixer2.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CoderMixer2MT.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CrossThreadProgress.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/CrossThreadProgress.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/DummyOutStream.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/HandlerOut.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/MultiStream.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/MultiStream.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h
misc/libphysfs/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/Common/ParseProperties.h
misc/libphysfs/lzma/CPP/7zip/Archive/DllExports2.cpp
misc/libphysfs/lzma/CPP/7zip/Archive/IArchive.h
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/makefile
misc/libphysfs/lzma/CPP/7zip/Bundles/Alone7z/resource.rc
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zR/makefile
misc/libphysfs/lzma/CPP/7zip/Bundles/Format7zR/resource.rc
misc/libphysfs/lzma/CPP/7zip/Common/CreateCoder.cpp
misc/libphysfs/lzma/CPP/7zip/Common/CreateCoder.h
misc/libphysfs/lzma/CPP/7zip/Common/FilePathAutoRename.cpp
misc/libphysfs/lzma/CPP/7zip/Common/FilePathAutoRename.h
misc/libphysfs/lzma/CPP/7zip/Common/FileStreams.cpp
misc/libphysfs/lzma/CPP/7zip/Common/FileStreams.h
misc/libphysfs/lzma/CPP/7zip/Common/FilterCoder.cpp
misc/libphysfs/lzma/CPP/7zip/Common/FilterCoder.h
misc/libphysfs/lzma/CPP/7zip/Common/InBuffer.cpp
misc/libphysfs/lzma/CPP/7zip/Common/InBuffer.h
misc/libphysfs/lzma/CPP/7zip/Common/InOutTempBuffer.cpp
misc/libphysfs/lzma/CPP/7zip/Common/InOutTempBuffer.h
misc/libphysfs/lzma/CPP/7zip/Common/LimitedStreams.cpp
misc/libphysfs/lzma/CPP/7zip/Common/LimitedStreams.h
misc/libphysfs/lzma/CPP/7zip/Common/LockedStream.cpp
misc/libphysfs/lzma/CPP/7zip/Common/LockedStream.h
misc/libphysfs/lzma/CPP/7zip/Common/MethodId.cpp
misc/libphysfs/lzma/CPP/7zip/Common/MethodId.h
misc/libphysfs/lzma/CPP/7zip/Common/MethodProps.cpp
misc/libphysfs/lzma/CPP/7zip/Common/MethodProps.h
misc/libphysfs/lzma/CPP/7zip/Common/OffsetStream.cpp
misc/libphysfs/lzma/CPP/7zip/Common/OffsetStream.h
misc/libphysfs/lzma/CPP/7zip/Common/OutBuffer.cpp
misc/libphysfs/lzma/CPP/7zip/Common/OutBuffer.h
misc/libphysfs/lzma/CPP/7zip/Common/ProgressUtils.cpp
misc/libphysfs/lzma/CPP/7zip/Common/ProgressUtils.h
misc/libphysfs/lzma/CPP/7zip/Common/RegisterArc.h
misc/libphysfs/lzma/CPP/7zip/Common/RegisterCodec.h
misc/libphysfs/lzma/CPP/7zip/Common/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Common/StreamBinder.cpp
misc/libphysfs/lzma/CPP/7zip/Common/StreamBinder.h
misc/libphysfs/lzma/CPP/7zip/Common/StreamObjects.cpp
misc/libphysfs/lzma/CPP/7zip/Common/StreamObjects.h
misc/libphysfs/lzma/CPP/7zip/Common/StreamUtils.cpp
misc/libphysfs/lzma/CPP/7zip/Common/StreamUtils.h
misc/libphysfs/lzma/CPP/7zip/Common/VirtThread.cpp
misc/libphysfs/lzma/CPP/7zip/Common/VirtThread.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/ARM.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/ARM.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/ARMThumb.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/ARMThumb.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BCJ2Register.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BCJRegister.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BranchCoder.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BranchCoder.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BranchRegister.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/IA64.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/IA64.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/PPC.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/PPC.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/SPARC.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/SPARC.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/x86.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/x86.h
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/x86_2.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Branch/x86_2.h
misc/libphysfs/lzma/CPP/7zip/Compress/ByteSwap/ByteSwap.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/ByteSwap/ByteSwap.h
misc/libphysfs/lzma/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/ByteSwap/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/ByteSwap/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/CodecExports.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Copy/CopyCoder.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Copy/CopyCoder.h
misc/libphysfs/lzma/CPP/7zip/Compress/Copy/CopyRegister.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Copy/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/Copy/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZ/LZOutWindow.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZ/LZOutWindow.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZ/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMA.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMADecoder.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMAEncoder.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/LZMARegister.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsw
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaRam.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/makefile
misc/libphysfs/lzma/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/RangeCoder.h
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/RangeCoderBit.h
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h
misc/libphysfs/lzma/CPP/7zip/Compress/RangeCoder/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/ICoder.h
misc/libphysfs/lzma/CPP/7zip/IDecl.h
misc/libphysfs/lzma/CPP/7zip/IPassword.h
misc/libphysfs/lzma/CPP/7zip/IProgress.h
misc/libphysfs/lzma/CPP/7zip/IStream.h
misc/libphysfs/lzma/CPP/7zip/MyVersion.h
misc/libphysfs/lzma/CPP/7zip/MyVersionInfo.rc
misc/libphysfs/lzma/CPP/7zip/PropID.h
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/Client7z.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/Client7z.dsp
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/Client7z.dsw
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/UI/Client7z/makefile
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveName.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveName.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/DefaultName.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/DefaultName.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/DirItem.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/EnumDirItems.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ExitCode.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/Extract.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/Extract.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ExtractMode.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/LoadCodecs.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/OpenArchive.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/OpenArchive.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/PropIDUtils.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/Property.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/SetProperties.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/SetProperties.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/SortUtils.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/SortUtils.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/TempFiles.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/TempFiles.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/Update.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/Update.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateAction.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateAction.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateCallback.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdatePair.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdatePair.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/UpdateProduce.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/WorkDir.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Common/WorkDir.h
misc/libphysfs/lzma/CPP/7zip/UI/Common/ZipRegistry.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/ConsoleClose.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/List.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/List.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/Main.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/MainAr.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/PercentPrinter.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/StdAfx.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/StdAfx.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
misc/libphysfs/lzma/CPP/7zip/UI/Console/UserInputUtils.h
misc/libphysfs/lzma/CPP/7zip/UI/Console/afxres.h
misc/libphysfs/lzma/CPP/Build.mak
misc/libphysfs/lzma/CPP/Common/AutoPtr.h
misc/libphysfs/lzma/CPP/Common/Buffer.h
misc/libphysfs/lzma/CPP/Common/CRC.cpp
misc/libphysfs/lzma/CPP/Common/C_FileIO.cpp
misc/libphysfs/lzma/CPP/Common/C_FileIO.h
misc/libphysfs/lzma/CPP/Common/ComTry.h
misc/libphysfs/lzma/CPP/Common/CommandLineParser.cpp
misc/libphysfs/lzma/CPP/Common/CommandLineParser.h
misc/libphysfs/lzma/CPP/Common/Defs.h
misc/libphysfs/lzma/CPP/Common/DynamicBuffer.h
misc/libphysfs/lzma/CPP/Common/IntToString.cpp
misc/libphysfs/lzma/CPP/Common/IntToString.h
misc/libphysfs/lzma/CPP/Common/ListFileUtils.cpp
misc/libphysfs/lzma/CPP/Common/ListFileUtils.h
misc/libphysfs/lzma/CPP/Common/MyCom.h
misc/libphysfs/lzma/CPP/Common/MyException.h
misc/libphysfs/lzma/CPP/Common/MyGuidDef.h
misc/libphysfs/lzma/CPP/Common/MyInitGuid.h
misc/libphysfs/lzma/CPP/Common/MyString.cpp
misc/libphysfs/lzma/CPP/Common/MyString.h
misc/libphysfs/lzma/CPP/Common/MyUnknown.h
misc/libphysfs/lzma/CPP/Common/MyVector.cpp
misc/libphysfs/lzma/CPP/Common/MyVector.h
misc/libphysfs/lzma/CPP/Common/MyWindows.h
misc/libphysfs/lzma/CPP/Common/NewHandler.cpp
misc/libphysfs/lzma/CPP/Common/NewHandler.h
misc/libphysfs/lzma/CPP/Common/StdAfx.h
misc/libphysfs/lzma/CPP/Common/StdInStream.cpp
misc/libphysfs/lzma/CPP/Common/StdInStream.h
misc/libphysfs/lzma/CPP/Common/StdOutStream.cpp
misc/libphysfs/lzma/CPP/Common/StdOutStream.h
misc/libphysfs/lzma/CPP/Common/StringConvert.cpp
misc/libphysfs/lzma/CPP/Common/StringConvert.h
misc/libphysfs/lzma/CPP/Common/StringToInt.cpp
misc/libphysfs/lzma/CPP/Common/StringToInt.h
misc/libphysfs/lzma/CPP/Common/Types.h
misc/libphysfs/lzma/CPP/Common/UTFConvert.cpp
misc/libphysfs/lzma/CPP/Common/UTFConvert.h
misc/libphysfs/lzma/CPP/Common/Wildcard.cpp
misc/libphysfs/lzma/CPP/Common/Wildcard.h
misc/libphysfs/lzma/CPP/Windows/DLL.cpp
misc/libphysfs/lzma/CPP/Windows/DLL.h
misc/libphysfs/lzma/CPP/Windows/Defs.h
misc/libphysfs/lzma/CPP/Windows/Error.cpp
misc/libphysfs/lzma/CPP/Windows/Error.h
misc/libphysfs/lzma/CPP/Windows/FileDir.cpp
misc/libphysfs/lzma/CPP/Windows/FileDir.h
misc/libphysfs/lzma/CPP/Windows/FileFind.cpp
misc/libphysfs/lzma/CPP/Windows/FileFind.h
misc/libphysfs/lzma/CPP/Windows/FileIO.cpp
misc/libphysfs/lzma/CPP/Windows/FileIO.h
misc/libphysfs/lzma/CPP/Windows/FileMapping.cpp
misc/libphysfs/lzma/CPP/Windows/FileMapping.h
misc/libphysfs/lzma/CPP/Windows/FileName.cpp
misc/libphysfs/lzma/CPP/Windows/FileName.h
misc/libphysfs/lzma/CPP/Windows/Handle.h
misc/libphysfs/lzma/CPP/Windows/MemoryLock.cpp
misc/libphysfs/lzma/CPP/Windows/MemoryLock.h
misc/libphysfs/lzma/CPP/Windows/PropVariant.cpp
misc/libphysfs/lzma/CPP/Windows/PropVariant.h
misc/libphysfs/lzma/CPP/Windows/PropVariantConversions.cpp
misc/libphysfs/lzma/CPP/Windows/PropVariantConversions.h
misc/libphysfs/lzma/CPP/Windows/StdAfx.h
misc/libphysfs/lzma/CPP/Windows/Synchronization.cpp
misc/libphysfs/lzma/CPP/Windows/Synchronization.h
misc/libphysfs/lzma/CPP/Windows/System.cpp
misc/libphysfs/lzma/CPP/Windows/System.h
misc/libphysfs/lzma/CPP/Windows/Thread.h
misc/libphysfs/lzma/CPP/Windows/Time.h
misc/libphysfs/lzma/CS/7zip/Common/CRC.cs
misc/libphysfs/lzma/CS/7zip/Common/CommandLineParser.cs
misc/libphysfs/lzma/CS/7zip/Common/InBuffer.cs
misc/libphysfs/lzma/CS/7zip/Common/OutBuffer.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZ/LzBinTree.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZ/LzInWindow.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs
misc/libphysfs/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs
misc/libphysfs/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs
misc/libphysfs/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs
misc/libphysfs/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs
misc/libphysfs/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs
misc/libphysfs/lzma/CS/7zip/ICoder.cs
misc/libphysfs/lzma/Java/SevenZip/CRC.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZ/BinTree.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZ/InWindow.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZ/OutWindow.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZMA/Base.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZMA/Decoder.java
misc/libphysfs/lzma/Java/SevenZip/Compression/LZMA/Encoder.java
misc/libphysfs/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java
misc/libphysfs/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java
misc/libphysfs/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java
misc/libphysfs/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java
misc/libphysfs/lzma/Java/SevenZip/ICodeProgress.java
misc/libphysfs/lzma/Java/SevenZip/LzmaAlone.java
misc/libphysfs/lzma/Java/SevenZip/LzmaBench.java
misc/libphysfs/lzma/LGPL.txt
misc/libphysfs/lzma/Methods.txt
misc/libphysfs/lzma/history.txt
misc/libphysfs/lzma/lzma.txt
misc/libphysfs/physfs.c
misc/libphysfs/physfs.h
misc/libphysfs/physfs_byteorder.c
misc/libphysfs/physfs_casefolding.h
misc/libphysfs/physfs_internal.h
misc/libphysfs/physfs_miniz.h
misc/libphysfs/physfs_platforms.h
misc/libphysfs/physfs_unicode.c
misc/libphysfs/platform_beos.cpp
misc/libphysfs/platform_macosx.c
misc/libphysfs/platform_posix.c
misc/libphysfs/platform_unix.c
misc/libphysfs/platform_windows.c
misc/libphysfs/platform_winrt.cpp
--- a/CMakeLists.txt	Thu Oct 11 23:43:31 2018 +0200
+++ b/CMakeLists.txt	Fri Oct 12 03:40:21 2018 +0200
@@ -27,10 +27,8 @@
 option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON)
 
 if(WIN32 OR APPLE)
-    option(PHYSFS_SYSTEM "Use system physfs (off)" OFF)
     option(LUA_SYSTEM "Use system lua (off)" OFF)
 else()
-    option(PHYSFS_SYSTEM "Use system physfs (on)" ON)
     option(LUA_SYSTEM "Use system lua (on)" ON)
 endif()
 
@@ -61,7 +59,6 @@
     set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(BUILD_ENGINE_LIBRARY ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
-    set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
@@ -199,40 +196,32 @@
 
 
 #physfs discovery
-if(PHYSFS_SYSTEM)
-    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
-        find_package(PhysFS)
-    endif()
-
-    find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
-    if(physfs_h)
-        file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
-        file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
-        file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
-        string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
-        string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
-        string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
-        set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
+if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
+    find_package(PhysFS)
+endif()
 
-        if(${physfs_detected_ver} VERSION_LESS 2.0.0)
-            message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 2.0.0)\n"
-                                "Perform an update or rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
-        endif()
-    endif()
+find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
+if(physfs_h)
+    file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
+    file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
+    file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
+    string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
+    string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
+    string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
+    set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
 
-    if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
-        #use an IMPORTED tharget so that we can just use 'physfs' to link
-        add_library(physfs UNKNOWN IMPORTED)
-        set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
-    else()
-        message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
+    if(${physfs_detected_ver} VERSION_LESS 3.0.0)
+        message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 3.0.0)\n"
+                            "Perform an update of PhysFS to fix this.")
     endif()
+endif()
+
+if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
+    #use an IMPORTED tharget so that we can just use 'physfs' to link
+    add_library(physfs UNKNOWN IMPORTED)
+    set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
 else()
-    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
-        message(STATUS "PhysFS will be provided by the bundled sources")
-    endif()
-    set(physfs_output_name "hwphysfs")
-    add_subdirectory(misc/libphysfs)
+    message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.")
 endif()
 
 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
--- a/INSTALL.md	Thu Oct 11 23:43:31 2018 +0200
+++ b/INSTALL.md	Fri Oct 12 03:40:21 2018 +0200
@@ -24,6 +24,7 @@
 - SDL\_mixer >= 2.0
 - SDL\_image >= 2.0
 - SDL\_ttf >= 2.0
+- PhysFS >= 3.0.0
 
 ### Recommended optional dependencies
 
@@ -32,7 +33,6 @@
 in if these are not found on your system.
 
 - qtstyleplugins (for Qt 5)
-- PhysFS >= 2.0.0
 - Lua = 5.1.0
 
 ### Optional dependencies
@@ -47,9 +47,6 @@
     - GHC >= 6.10
     - Various Haskell packages (see below)
 
-PhysFS will be internally built if `-DPHYSFS_SYSTEM=OFF` is passed to `cmake`
-(also allows to set `PHYSFS_LIBRARY` and `PHYSFS_INCLUDE_DIR` if needed).
-
 Lua will be automatically built if not found.
 
 ### Hedgewars Server dependencies
@@ -123,7 +120,6 @@
 - `CMAKE_INSTALL_PREFIX`: Installation directory
 - `NOSERVER`: Set to `ON` to *not* build the server
 - `NOVIDEOREC`: Set to `ON` to *not* build the video recorder
-- `SYSTEM_PHYSFS`: Set to `OFF` to use Hedgewars-bundled PhysFS
 
 ### Step 2: Make
 
@@ -159,15 +155,6 @@
 If this didn't work, make sure you have the correct Qt version
 (see above).
 
-### Hedgewars compiles successfully, but games instantly crash the map preview fails
-
-This is likely to be a problem with PhysFS. Try to build Hedgewars
-with the Hedgewars-bundled PhysFS by setting the CMake option
-`SYSTEM_PHYSFS=OFF`, then try to run `make` again.
-
-If the _bundled_ PhysFS fails, too, this is likely to be a bug in
-Hedgewars, please report at <https://issues.hedgewars.org/>.
-
 ### Broken/missing Haskell dependencies
 
 First, try to obtain the missing Haskell packages and make sure GHC
--- a/hedgewars/CMakeLists.txt	Thu Oct 11 23:43:31 2018 +0200
+++ b/hedgewars/CMakeLists.txt	Fri Oct 12 03:40:21 2018 +0200
@@ -164,17 +164,10 @@
     add_flag_append(CMAKE_Pascal_FLAGS "-XLAlua=${lua_output_name}")
 endif()
 
-if(PHYSFS_SYSTEM)
-    get_filename_component(PHYSFS_LIBRARY_DIR ${PHYSFS_LIBRARY} PATH)
-    add_flag_append(CMAKE_Pascal_FLAGS "-Fl${PHYSFS_LIBRARY}")
-else()
-    add_definitions(-dPHYSFS_INTERNAL)
-    list(APPEND HW_LINK_LIBS physfs)
-    #-XLA is a beta fpc flag that renames libraries before passing them to the linker
-    #we also have to pass PHYSFS_INTERNAL to satisfy windows runtime requirements
-    #(should be harmless on other platforms)
-    add_flag_append(CMAKE_Pascal_FLAGS "-XLAphysfs=${physfs_output_name}")
-endif()
+# PhysFS
+get_filename_component(PHYSFS_LIBRARY_DIR ${PHYSFS_LIBRARY} PATH)
+add_flag_append(CMAKE_Pascal_FLAGS "-Fl${PHYSFS_LIBRARY}")
+
 list(APPEND HW_LINK_LIBS physlayer)
 
 
--- a/misc/libphysfs/Android.mk	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE    := physfs
-
-LOCAL_CFLAGS := -O2 -DPHYSFS_NO_CDROM_SUPPORT
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)
-
-LOCAL_SRC_FILES := physfs.c \
-                   physfs_byteorder.c \
-                   physfs_unicode.c \
-                   platform_posix.c \
-                   platform_unix.c \
-                   platform_macosx.c \
-                   platform_windows.c \
-                   archiver_dir.c \
-                   archiver_grp.c \
-                   archiver_hog.c \
-                   archiver_lzma.c \
-                   archiver_mvl.c \
-                   archiver_qpak.c \
-                   archiver_wad.c \
-                   archiver_zip.c \
-
-include $(BUILD_SHARED_LIBRARY)
--- a/misc/libphysfs/CMakeLists.txt	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-# PhysicsFS; a portable, flexible file i/o abstraction.
-# Copyright (C) 2007  Ryan C. Gordon.
-#
-# Please see the file LICENSE.txt in the source's root directory.
-
-## lines starting with '##' are lines overridden/modified/added by Hedgewars configuration
-##CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-##PROJECT(PhysicsFS)
-set(PHYSFS_VERSION 2.1.0)
-
-# Increment this if/when we break backwards compatibility.
-set(PHYSFS_SOVERSION 1)
-
-# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
-if(WIN32 AND NOT WINDOWS)
-    set(WINDOWS TRUE)
-endif(WIN32 AND NOT WINDOWS)
-
-# Bleh, let's do it for "APPLE" too.
-if(APPLE AND NOT MACOSX)
-    set(MACOSX TRUE)
-endif(APPLE AND NOT MACOSX)
-
-# For now, Haiku and BeOS are the same, as far as the build system cares.
-if(HAIKU AND NOT BEOS)
-    set(BEOS TRUE)
-endif(HAIKU AND NOT BEOS)
-
-if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
-    set(SOLARIS TRUE)
-endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
-
-include(CheckIncludeFile)
-include(CheckLibraryExists)
-include(CheckCSourceCompiles)
-
-
-if(MACOSX)
-    # Fallback to older OS X on PowerPC to support wider range of systems...
-    if(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
-        add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
-        list(APPEND OTHER_LDFLAGS "-mmacosx-version-min=10.2")
-    endif(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
-
-    # Need these everywhere...
-    add_definitions(-fno-common)
-    find_library(foundation_framework NAMES Foundation)
-    list(APPEND OTHER_LDFLAGS ${foundation_framework})
-    find_library(iokit_framework NAMES IOKit)
-    list(APPEND OTHER_LDFLAGS ${iokit_framework})
-endif(MACOSX)
-
-# Add some gcc-specific command lines.
-if(CMAKE_COMPILER_IS_GNUCC)
-    # Always build with debug symbols... you can strip it later.
-    add_definitions(-g -fsigned-char)
-endif(CMAKE_COMPILER_IS_GNUCC)
-
-if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
-    add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
-    add_definitions(-xldscope=hidden)
-endif(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
-
-if(MSVC)
-    # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
-    #  cleaned up our code, zlib, etc still use...so disable the warning.
-    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
-endif(MSVC)
-
-
-if(BEOS)
-    # We add this explicitly, since we don't want CMake to think this
-    #  is a C++ project unless we're on BeOS.
-    set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
-    find_library(BE_LIBRARY be)
-    find_library(ROOT_LIBRARY root)
-    set(optional_library_libs ${optional_library_libs} ${BE_LIBRARY} ${ROOT_LIBRARY})
-endif(BEOS)
-
-
-# Almost everything is "compiled" here, but things that don't apply to the
-#  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
-#  another project or bring up a new build system: just compile all the source
-#  code and #define the things you want.
-set(PHYSFS_SRCS
-    physfs.c
-    physfs_byteorder.c
-    physfs_unicode.c
-    platform_posix.c
-    platform_unix.c
-    platform_macosx.c
-    platform_windows.c
-    archiver_dir.c
-    archiver_unpacked.c
-    archiver_grp.c
-    archiver_hog.c
-    archiver_lzma.c
-    archiver_mvl.c
-    archiver_qpak.c
-    archiver_wad.c
-    archiver_zip.c
-    archiver_iso9660.c
-    ${PHYSFS_BEOS_SRCS}
-)
-
-
-# platform layers ...
-
-if(UNIX)
-    if(BEOS)
-        set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-        set(HAVE_PTHREAD_H TRUE)
-    else(BEOS)
-        CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
-        if(HAVE_UCRED_H)
-            add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1)
-            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        endif(HAVE_UCRED_H)
-
-        CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
-        if(HAVE_MNTENT_H)
-            add_definitions(-DPHYSFS_HAVE_MNTENT_H=1)
-            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        endif(HAVE_MNTENT_H)
-
-        # !!! FIXME: Solaris fails this, because mnttab.h implicitly
-        # !!! FIXME:  depends on other system headers.  :(
-        #CHECK_INCLUDE_FILE(sys/mnttab.h HAVE_SYS_MNTTAB_H)
-        CHECK_C_SOURCE_COMPILES("
-            #include <stdio.h>
-            #include <sys/mnttab.h>
-            int main(int argc, char **argv) { return 0; }
-        " HAVE_SYS_MNTTAB_H)
-
-        if(HAVE_SYS_MNTTAB_H)
-            add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
-            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-        endif(HAVE_SYS_MNTTAB_H)
-
-        CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
-        if(HAVE_PTHREAD_H)
-            set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-        endif(HAVE_PTHREAD_H)
-    endif(BEOS)
-endif(UNIX)
-
-if(WINDOWS)
-    set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
-    set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-    list(APPEND OTHER_LDFLAGS ${SDL2_LIBRARY})
-endif(WINDOWS)
-
-if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
-    add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
-    message(WARNING " ***")
-    message(WARNING " *** There is no CD-ROM support in this build!")
-    message(WARNING " *** PhysicsFS will just pretend there are no discs.")
-    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
-    message(WARNING " ***   but is this what you REALLY wanted?")
-    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
-    message(WARNING " ***")
-endif(NOT PHYSFS_HAVE_CDROM_SUPPORT)
-
-if(PHYSFS_HAVE_THREAD_SUPPORT)
-    add_definitions(-D_REENTRANT -D_THREAD_SAFE)
-else(PHYSFS_HAVE_THREAD_SUPPORT)
-    add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1)
-    message(WARNING " ***")
-    message(WARNING " *** There is no thread support in this build!")
-    message(WARNING " *** PhysicsFS will NOT be reentrant!")
-    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
-    message(WARNING " ***   but is this what you REALLY wanted?")
-    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
-    message(WARNING " ***")
-endif(PHYSFS_HAVE_THREAD_SUPPORT)
-
-
-# Archivers ...
-
-option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
-if(PHYSFS_ARCHIVE_ZIP)
-    add_definitions(-DPHYSFS_SUPPORTS_ZIP=1)
-    set(PHYSFS_FEATURES "ZIP")
-endif(PHYSFS_ARCHIVE_ZIP)
-
-#option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
-#if(PHYSFS_ARCHIVE_GRP)
-#    add_definitions(-DPHYSFS_SUPPORTS_GRP=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} GRP")
-#endif(PHYSFS_ARCHIVE_GRP)
-
-#option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
-#if(PHYSFS_ARCHIVE_WAD)
-#    add_definitions(-DPHYSFS_SUPPORTS_WAD=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} WAD")
-#endif(PHYSFS_ARCHIVE_WAD)
-
-#option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
-#if(PHYSFS_ARCHIVE_HOG)
-#    add_definitions(-DPHYSFS_SUPPORTS_HOG=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} HOG")
-#endif(PHYSFS_ARCHIVE_HOG)
-
-#option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
-#if(PHYSFS_ARCHIVE_MVL)
-#    add_definitions(-DPHYSFS_SUPPORTS_MVL=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} MVL")
-#endif(PHYSFS_ARCHIVE_MVL)
-
-#option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
-#if(PHYSFS_ARCHIVE_QPAK)
-#    add_definitions(-DPHYSFS_SUPPORTS_QPAK=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} QPAK")
-#endif(PHYSFS_ARCHIVE_QPAK)
-
-#option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
-#if(PHYSFS_ARCHIVE_ISO9660)
-#    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
-#    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} CD-ROM")
-#endif(PHYSFS_ARCHIVE_ISO9660)
-
-
-##Hedgewars modifications
-add_library(physfs ${PHYSFS_SRCS})
-set_target_properties(physfs PROPERTIES
-                          VERSION ${PHYSFS_VERSION}
-                          SOVERSION ${PHYSFS_SOVERSION}
-                          OUTPUT_NAME ${physfs_output_name})
-target_link_libraries(physfs ${optional_library_libs} ${OTHER_LDFLAGS})
-install(TARGETS physfs RUNTIME DESTINATION ${target_binary_install_dir}
-                       LIBRARY DESTINATION ${target_library_install_dir}
-                       ARCHIVE DESTINATION ${target_library_install_dir})
-get_target_property(physfs_fullpath physfs LOCATION)
-
-## added standard variables emulating the FindPhysFS.cmake ones (FORCE or cmake won't pick 'em)
-set(PHYSFS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Physfs include dir" FORCE)
-set(PHYSFS_LIBRARY ${physfs_fullpath} CACHE STRING "Physfs library path" FORCE)
-
-
-## removed language bindings and test program
-## simplified configuration output
-## merged shared and static library building
-
-#message(STATUS "PhysFS will be built with ${PHYSFS_FEATURES} support")
-
--- a/misc/libphysfs/Xcode/Physfs.xcodeproj/project.pbxproj	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 46;
-	objects = {
-
-/* Begin PBXBuildFile section */
-		617D78F916D932900091D4D6 /* archiver_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78E816D932900091D4D6 /* archiver_dir.c */; };
-		617D78FA16D932900091D4D6 /* archiver_grp.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78E916D932900091D4D6 /* archiver_grp.c */; };
-		617D78FB16D932900091D4D6 /* archiver_hog.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78EA16D932900091D4D6 /* archiver_hog.c */; };
-		617D78FC16D932900091D4D6 /* archiver_iso9660.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78EB16D932900091D4D6 /* archiver_iso9660.c */; };
-		617D78FD16D932900091D4D6 /* archiver_lzma.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78EC16D932900091D4D6 /* archiver_lzma.c */; };
-		617D78FE16D932900091D4D6 /* archiver_mvl.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78ED16D932900091D4D6 /* archiver_mvl.c */; };
-		617D78FF16D932900091D4D6 /* archiver_qpak.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78EE16D932900091D4D6 /* archiver_qpak.c */; };
-		617D790016D932900091D4D6 /* archiver_unpacked.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78EF16D932900091D4D6 /* archiver_unpacked.c */; };
-		617D790116D932900091D4D6 /* archiver_wad.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F016D932900091D4D6 /* archiver_wad.c */; };
-		617D790216D932900091D4D6 /* archiver_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F116D932900091D4D6 /* archiver_zip.c */; };
-		617D790316D932900091D4D6 /* physfs_byteorder.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F216D932900091D4D6 /* physfs_byteorder.c */; };
-		617D790416D932900091D4D6 /* physfs_unicode.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F316D932900091D4D6 /* physfs_unicode.c */; };
-		617D790516D932900091D4D6 /* physfs.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F416D932900091D4D6 /* physfs.c */; };
-		617D790616D932900091D4D6 /* platform_macosx.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F516D932900091D4D6 /* platform_macosx.c */; };
-		617D790716D932900091D4D6 /* platform_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F616D932900091D4D6 /* platform_posix.c */; };
-		617D790816D932900091D4D6 /* platform_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F716D932900091D4D6 /* platform_unix.c */; };
-		617D790916D932900091D4D6 /* platform_windows.c in Sources */ = {isa = PBXBuildFile; fileRef = 617D78F816D932900091D4D6 /* platform_windows.c */; };
-		617D790F16D932BC0091D4D6 /* physfs_casefolding.h in Headers */ = {isa = PBXBuildFile; fileRef = 617D790A16D932BC0091D4D6 /* physfs_casefolding.h */; };
-		617D791016D932BC0091D4D6 /* physfs_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 617D790B16D932BC0091D4D6 /* physfs_internal.h */; };
-		617D791116D932BC0091D4D6 /* physfs_miniz.h in Headers */ = {isa = PBXBuildFile; fileRef = 617D790C16D932BC0091D4D6 /* physfs_miniz.h */; };
-		617D791216D932BC0091D4D6 /* physfs_platforms.h in Headers */ = {isa = PBXBuildFile; fileRef = 617D790D16D932BC0091D4D6 /* physfs_platforms.h */; };
-		617D791316D932BC0091D4D6 /* physfs.h in Headers */ = {isa = PBXBuildFile; fileRef = 617D790E16D932BC0091D4D6 /* physfs.h */; };
-		AA747D9F0F9514B9006C5449 /* Physfs_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* Physfs_Prefix.pch */; };
-		AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
-		617D78E716D932600091D4D6 /* libPhysfs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPhysfs.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		617D78E816D932900091D4D6 /* archiver_dir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_dir.c; path = ../archiver_dir.c; sourceTree = SOURCE_ROOT; };
-		617D78E916D932900091D4D6 /* archiver_grp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_grp.c; path = ../archiver_grp.c; sourceTree = SOURCE_ROOT; };
-		617D78EA16D932900091D4D6 /* archiver_hog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_hog.c; path = ../archiver_hog.c; sourceTree = SOURCE_ROOT; };
-		617D78EB16D932900091D4D6 /* archiver_iso9660.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_iso9660.c; path = ../archiver_iso9660.c; sourceTree = SOURCE_ROOT; };
-		617D78EC16D932900091D4D6 /* archiver_lzma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_lzma.c; path = ../archiver_lzma.c; sourceTree = SOURCE_ROOT; };
-		617D78ED16D932900091D4D6 /* archiver_mvl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_mvl.c; path = ../archiver_mvl.c; sourceTree = SOURCE_ROOT; };
-		617D78EE16D932900091D4D6 /* archiver_qpak.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_qpak.c; path = ../archiver_qpak.c; sourceTree = SOURCE_ROOT; };
-		617D78EF16D932900091D4D6 /* archiver_unpacked.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_unpacked.c; path = ../archiver_unpacked.c; sourceTree = SOURCE_ROOT; };
-		617D78F016D932900091D4D6 /* archiver_wad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_wad.c; path = ../archiver_wad.c; sourceTree = SOURCE_ROOT; };
-		617D78F116D932900091D4D6 /* archiver_zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = archiver_zip.c; path = ../archiver_zip.c; sourceTree = SOURCE_ROOT; };
-		617D78F216D932900091D4D6 /* physfs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = physfs_byteorder.c; path = ../physfs_byteorder.c; sourceTree = SOURCE_ROOT; };
-		617D78F316D932900091D4D6 /* physfs_unicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = physfs_unicode.c; path = ../physfs_unicode.c; sourceTree = SOURCE_ROOT; };
-		617D78F416D932900091D4D6 /* physfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = physfs.c; path = ../physfs.c; sourceTree = SOURCE_ROOT; };
-		617D78F516D932900091D4D6 /* platform_macosx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = platform_macosx.c; path = ../platform_macosx.c; sourceTree = SOURCE_ROOT; };
-		617D78F616D932900091D4D6 /* platform_posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = platform_posix.c; path = ../platform_posix.c; sourceTree = SOURCE_ROOT; };
-		617D78F716D932900091D4D6 /* platform_unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = platform_unix.c; path = ../platform_unix.c; sourceTree = SOURCE_ROOT; };
-		617D78F816D932900091D4D6 /* platform_windows.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = platform_windows.c; path = ../platform_windows.c; sourceTree = SOURCE_ROOT; };
-		617D790A16D932BC0091D4D6 /* physfs_casefolding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = physfs_casefolding.h; path = ../physfs_casefolding.h; sourceTree = SOURCE_ROOT; };
-		617D790B16D932BC0091D4D6 /* physfs_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = physfs_internal.h; path = ../physfs_internal.h; sourceTree = SOURCE_ROOT; };
-		617D790C16D932BC0091D4D6 /* physfs_miniz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = physfs_miniz.h; path = ../physfs_miniz.h; sourceTree = SOURCE_ROOT; };
-		617D790D16D932BC0091D4D6 /* physfs_platforms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = physfs_platforms.h; path = ../physfs_platforms.h; sourceTree = SOURCE_ROOT; };
-		617D790E16D932BC0091D4D6 /* physfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = physfs.h; path = ../physfs.h; sourceTree = SOURCE_ROOT; };
-		AA747D9E0F9514B9006C5449 /* Physfs_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Physfs_Prefix.pch; sourceTree = SOURCE_ROOT; };
-		AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		D2AAC07C0554694100DB518D /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		034768DFFF38A50411DB9C8B /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				617D78E716D932600091D4D6 /* libPhysfs.a */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-		0867D691FE84028FC02AAC07 /* Physfs */ = {
-			isa = PBXGroup;
-			children = (
-				08FB77AEFE84172EC02AAC07 /* Sources */,
-				32C88DFF0371C24200C91783 /* Other Sources */,
-				0867D69AFE84028FC02AAC07 /* Frameworks */,
-				034768DFFF38A50411DB9C8B /* Products */,
-			);
-			name = Physfs;
-			sourceTree = "<group>";
-		};
-		0867D69AFE84028FC02AAC07 /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				AACBBE490F95108600F1A2B1 /* Foundation.framework */,
-			);
-			name = Frameworks;
-			sourceTree = "<group>";
-		};
-		08FB77AEFE84172EC02AAC07 /* Sources */ = {
-			isa = PBXGroup;
-			children = (
-				617D790A16D932BC0091D4D6 /* physfs_casefolding.h */,
-				617D790B16D932BC0091D4D6 /* physfs_internal.h */,
-				617D790C16D932BC0091D4D6 /* physfs_miniz.h */,
-				617D790D16D932BC0091D4D6 /* physfs_platforms.h */,
-				617D790E16D932BC0091D4D6 /* physfs.h */,
-				617D78E816D932900091D4D6 /* archiver_dir.c */,
-				617D78E916D932900091D4D6 /* archiver_grp.c */,
-				617D78EA16D932900091D4D6 /* archiver_hog.c */,
-				617D78EB16D932900091D4D6 /* archiver_iso9660.c */,
-				617D78EC16D932900091D4D6 /* archiver_lzma.c */,
-				617D78ED16D932900091D4D6 /* archiver_mvl.c */,
-				617D78EE16D932900091D4D6 /* archiver_qpak.c */,
-				617D78EF16D932900091D4D6 /* archiver_unpacked.c */,
-				617D78F016D932900091D4D6 /* archiver_wad.c */,
-				617D78F116D932900091D4D6 /* archiver_zip.c */,
-				617D78F216D932900091D4D6 /* physfs_byteorder.c */,
-				617D78F316D932900091D4D6 /* physfs_unicode.c */,
-				617D78F416D932900091D4D6 /* physfs.c */,
-				617D78F516D932900091D4D6 /* platform_macosx.c */,
-				617D78F616D932900091D4D6 /* platform_posix.c */,
-				617D78F716D932900091D4D6 /* platform_unix.c */,
-				617D78F816D932900091D4D6 /* platform_windows.c */,
-			);
-			name = Sources;
-			sourceTree = "<group>";
-		};
-		32C88DFF0371C24200C91783 /* Other Sources */ = {
-			isa = PBXGroup;
-			children = (
-				AA747D9E0F9514B9006C5449 /* Physfs_Prefix.pch */,
-			);
-			name = "Other Sources";
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
-		D2AAC07A0554694100DB518D /* Headers */ = {
-			isa = PBXHeadersBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				AA747D9F0F9514B9006C5449 /* Physfs_Prefix.pch in Headers */,
-				617D790F16D932BC0091D4D6 /* physfs_casefolding.h in Headers */,
-				617D791016D932BC0091D4D6 /* physfs_internal.h in Headers */,
-				617D791116D932BC0091D4D6 /* physfs_miniz.h in Headers */,
-				617D791216D932BC0091D4D6 /* physfs_platforms.h in Headers */,
-				617D791316D932BC0091D4D6 /* physfs.h in Headers */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
-		D2AAC07D0554694100DB518D /* Physfs */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "Physfs" */;
-			buildPhases = (
-				D2AAC07A0554694100DB518D /* Headers */,
-				D2AAC07B0554694100DB518D /* Sources */,
-				D2AAC07C0554694100DB518D /* Frameworks */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = Physfs;
-			productName = Physfs;
-			productReference = 617D78E716D932600091D4D6 /* libPhysfs.a */;
-			productType = "com.apple.product-type.library.static";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		0867D690FE84028FC02AAC07 /* Project object */ = {
-			isa = PBXProject;
-			attributes = {
-				LastUpgradeCheck = 0710;
-			};
-			buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "Physfs" */;
-			compatibilityVersion = "Xcode 3.2";
-			developmentRegion = English;
-			hasScannedForEncodings = 1;
-			knownRegions = (
-				English,
-				Japanese,
-				French,
-				German,
-			);
-			mainGroup = 0867D691FE84028FC02AAC07 /* Physfs */;
-			productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
-			projectDirPath = "";
-			projectRoot = "";
-			targets = (
-				D2AAC07D0554694100DB518D /* Physfs */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
-		D2AAC07B0554694100DB518D /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				617D78F916D932900091D4D6 /* archiver_dir.c in Sources */,
-				617D78FA16D932900091D4D6 /* archiver_grp.c in Sources */,
-				617D78FB16D932900091D4D6 /* archiver_hog.c in Sources */,
-				617D78FC16D932900091D4D6 /* archiver_iso9660.c in Sources */,
-				617D78FD16D932900091D4D6 /* archiver_lzma.c in Sources */,
-				617D78FE16D932900091D4D6 /* archiver_mvl.c in Sources */,
-				617D78FF16D932900091D4D6 /* archiver_qpak.c in Sources */,
-				617D790016D932900091D4D6 /* archiver_unpacked.c in Sources */,
-				617D790116D932900091D4D6 /* archiver_wad.c in Sources */,
-				617D790216D932900091D4D6 /* archiver_zip.c in Sources */,
-				617D790316D932900091D4D6 /* physfs_byteorder.c in Sources */,
-				617D790416D932900091D4D6 /* physfs_unicode.c in Sources */,
-				617D790516D932900091D4D6 /* physfs.c in Sources */,
-				617D790616D932900091D4D6 /* platform_macosx.c in Sources */,
-				617D790716D932900091D4D6 /* platform_posix.c in Sources */,
-				617D790816D932900091D4D6 /* platform_unix.c in Sources */,
-				617D790916D932900091D4D6 /* platform_windows.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
-		1DEB921F08733DC00010E9CD /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				COPY_PHASE_STRIP = NO;
-				DSTROOT = /tmp/Physfs.dst;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_MODEL_TUNING = G5;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PRECOMPILE_PREFIX_HEADER = YES;
-				GCC_PREFIX_HEADER = Physfs_Prefix.pch;
-				INSTALL_PATH = /usr/local/lib;
-				PRODUCT_NAME = Physfs;
-				SKIP_INSTALL = YES;
-			};
-			name = Debug;
-		};
-		1DEB922008733DC00010E9CD /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				DSTROOT = /tmp/Physfs.dst;
-				GCC_MODEL_TUNING = G5;
-				GCC_PRECOMPILE_PREFIX_HEADER = YES;
-				GCC_PREFIX_HEADER = Physfs_Prefix.pch;
-				INSTALL_PATH = /usr/local/lib;
-				PRODUCT_NAME = Physfs;
-				SKIP_INSTALL = YES;
-			};
-			name = Release;
-		};
-		1DEB922308733DC00010E9CD /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-				ENABLE_BITCODE = NO;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				ENABLE_TESTABILITY = YES;
-				GCC_C_LANGUAGE_STANDARD = c99;
-				GCC_NO_COMMON_BLOCKS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PREPROCESSOR_DEFINITIONS = "";
-				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = YES;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				HEADER_SEARCH_PATHS = (
-					"\"$(SRCROOT)/../../liblua\"",
-					"\"$(SRCROOT)/../../../../Library/SDL/include\"",
-				);
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
-				ONLY_ACTIVE_ARCH = YES;
-				OTHER_LDFLAGS = "-ObjC";
-				PREBINDING = NO;
-				SDKROOT = iphoneos;
-				VALID_ARCHS = "armv7 x86_64 arm64";
-			};
-			name = Debug;
-		};
-		1DEB922408733DC00010E9CD /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-				ENABLE_BITCODE = NO;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				GCC_C_LANGUAGE_STANDARD = c99;
-				GCC_NO_COMMON_BLOCKS = YES;
-				GCC_PREPROCESSOR_DEFINITIONS = "";
-				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = YES;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				HEADER_SEARCH_PATHS = (
-					"\"$(SRCROOT)/../../liblua\"",
-					"\"$(SRCROOT)/../../../../Library/SDL/include\"",
-				);
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
-				OTHER_LDFLAGS = "-ObjC";
-				PREBINDING = NO;
-				SDKROOT = iphoneos;
-				VALID_ARCHS = "armv7 x86_64 arm64";
-			};
-			name = Release;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "Physfs" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				1DEB921F08733DC00010E9CD /* Debug */,
-				1DEB922008733DC00010E9CD /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-		1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "Physfs" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				1DEB922308733DC00010E9CD /* Debug */,
-				1DEB922408733DC00010E9CD /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
-}
--- a/misc/libphysfs/Xcode/Physfs_Prefix.pch	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-//
-// Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project.
-//
-
-#ifdef __OBJC__
-    #import <Foundation/Foundation.h>
-#endif
--- a/misc/libphysfs/archiver_dir.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Standard directory I/O support routines for PhysicsFS.
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-/* There's no PHYSFS_Io interface here. Use __PHYSFS_createNativeIo(). */
-
-
-
-static char *cvtToDependent(const char *prepend, const char *path, char *buf)
-{
-    BAIL_IF_MACRO(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    sprintf(buf, "%s%s", prepend ? prepend : "", path);
-
-    if (__PHYSFS_platformDirSeparator != '/')
-    {
-        char *p;
-        for (p = strchr(buf, '/'); p != NULL; p = strchr(p + 1, '/'))
-            *p = __PHYSFS_platformDirSeparator;
-    } /* if */
-
-    return buf;
-} /* cvtToDependent */
-
-
-#define CVT_TO_DEPENDENT(buf, pre, dir) { \
-    const size_t len = ((pre) ? strlen((char *) pre) : 0) + strlen(dir) + 1; \
-    buf = cvtToDependent((char*)pre,dir,(char*)__PHYSFS_smallAlloc(len)); \
-}
-
-
-
-static void *DIR_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_Stat st;
-    const char dirsep = __PHYSFS_platformDirSeparator;
-    char *retval = NULL;
-    const size_t namelen = strlen(name);
-    const size_t seplen = 1;
-
-    assert(io == NULL);  /* shouldn't create an Io for these. */
-    BAIL_IF_MACRO(!__PHYSFS_platformStat(name, &st), ERRPASS, NULL);
-    if (st.filetype != PHYSFS_FILETYPE_DIRECTORY)
-        BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    retval = allocator.Malloc(namelen + seplen + 1);
-    BAIL_IF_MACRO(retval == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    strcpy(retval, name);
-
-    /* make sure there's a dir separator at the end of the string */
-    if (retval[namelen - 1] != dirsep)
-    {
-        retval[namelen] = dirsep;
-        retval[namelen + 1] = '\0';
-    } /* if */
-
-    return retval;
-} /* DIR_openArchive */
-
-
-static void DIR_enumerateFiles(void *opaque, const char *dname,
-                               PHYSFS_EnumFilesCallback cb,
-                               const char *origdir, void *callbackdata)
-{
-    char *d;
-
-    CVT_TO_DEPENDENT(d, opaque, dname);
-    if (d != NULL)
-    {
-        __PHYSFS_platformEnumerateFiles(d, cb, origdir, callbackdata);
-        __PHYSFS_smallFree(d);
-    } /* if */
-} /* DIR_enumerateFiles */
-
-
-static PHYSFS_Io *doOpen(void *opaque, const char *name, const int mode)
-{
-    PHYSFS_Io *io = NULL;
-    char *f = NULL;
-
-    CVT_TO_DEPENDENT(f, opaque, name);
-    BAIL_IF_MACRO(!f, ERRPASS, NULL);
-
-    io = __PHYSFS_createNativeIo(f, mode);
-    if (io == NULL)
-    {
-        const PHYSFS_ErrorCode err = PHYSFS_getLastErrorCode();
-        PHYSFS_Stat statbuf;
-        __PHYSFS_platformStat(f, &statbuf);
-        PHYSFS_setErrorCode(err);
-    } /* if */
-
-    __PHYSFS_smallFree(f);
-
-    return io;
-} /* doOpen */
-
-
-static PHYSFS_Io *DIR_openRead(void *opaque, const char *filename)
-{
-    return doOpen(opaque, filename, 'r');
-} /* DIR_openRead */
-
-
-static PHYSFS_Io *DIR_openWrite(void *opaque, const char *filename)
-{
-    return doOpen(opaque, filename, 'w');
-} /* DIR_openWrite */
-
-
-static PHYSFS_Io *DIR_openAppend(void *opaque, const char *filename)
-{
-    return doOpen(opaque, filename, 'a');
-} /* DIR_openAppend */
-
-
-static int DIR_remove(void *opaque, const char *name)
-{
-    int retval;
-    char *f;
-
-    CVT_TO_DEPENDENT(f, opaque, name);
-    BAIL_IF_MACRO(!f, ERRPASS, 0);
-    retval = __PHYSFS_platformDelete(f);
-    __PHYSFS_smallFree(f);
-    return retval;
-} /* DIR_remove */
-
-
-static int DIR_mkdir(void *opaque, const char *name)
-{
-    int retval;
-    char *f;
-
-    CVT_TO_DEPENDENT(f, opaque, name);
-    BAIL_IF_MACRO(!f, ERRPASS, 0);
-    retval = __PHYSFS_platformMkDir(f);
-    __PHYSFS_smallFree(f);
-    return retval;
-} /* DIR_mkdir */
-
-
-static void DIR_closeArchive(void *opaque)
-{
-    allocator.Free(opaque);
-} /* DIR_closeArchive */
-
-
-static int DIR_stat(void *opaque, const char *name, PHYSFS_Stat *stat)
-{
-    int retval = 0;
-    char *d;
-
-    CVT_TO_DEPENDENT(d, opaque, name);
-    BAIL_IF_MACRO(!d, ERRPASS, 0);
-    retval = __PHYSFS_platformStat(d, stat);
-    __PHYSFS_smallFree(d);
-    return retval;
-} /* DIR_stat */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "",
-        "Non-archive, direct filesystem I/O",
-        "Ryan C. Gordon <icculus@icculus.org>",
-        "https://icculus.org/physfs/",
-        1,  /* supportsSymlinks */
-    },
-    DIR_openArchive,
-    DIR_enumerateFiles,
-    DIR_openRead,
-    DIR_openWrite,
-    DIR_openAppend,
-    DIR_remove,
-    DIR_mkdir,
-    DIR_stat,
-    DIR_closeArchive
-};
-
-/* end of archiver_dir.c ... */
-
--- a/misc/libphysfs/archiver_grp.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * GRP support routines for PhysicsFS.
- *
- * This driver handles BUILD engine archives ("groupfiles"). This format
- *  (but not this driver) was put together by Ken Silverman.
- *
- * The format is simple enough. In Ken's words:
- *
- *    What's the .GRP file format?
- *
- *     The ".grp" file format is just a collection of a lot of files stored
- *     into 1 big one. I tried to make the format as simple as possible: The
- *     first 12 bytes contains my name, "KenSilverman". The next 4 bytes is
- *     the number of files that were compacted into the group file. Then for
- *     each file, there is a 16 byte structure, where the first 12 bytes are
- *     the filename, and the last 4 bytes are the file's size. The rest of
- *     the group file is just the raw data packed one after the other in the
- *     same order as the list of files.
- *
- * (That info is from http://www.advsys.net/ken/build.htm ...)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_GRP
-
-static UNPKentry *grpLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 fileCount)
-{
-    PHYSFS_uint32 location = 16;  /* sizeof sig. */
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-    char *ptr = NULL;
-
-    entries = (UNPKentry *) allocator.Malloc(sizeof (UNPKentry) * fileCount);
-    BAIL_IF_MACRO(entries == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    location += (16 * fileCount);
-
-    for (entry = entries; fileCount > 0; fileCount--, entry++)
-    {
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->name, 12), ERRPASS, failed);
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->size, 4), ERRPASS, failed);
-        entry->name[12] = '\0';  /* name isn't null-terminated in file. */
-        if ((ptr = strchr(entry->name, ' ')) != NULL)
-            *ptr = '\0';  /* trim extra spaces. */
-
-        entry->size = PHYSFS_swapULE32(entry->size);
-        entry->startPos = location;
-        location += entry->size;
-    } /* for */
-
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-} /* grpLoadEntries */
-
-
-static void *GRP_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint8 buf[12];
-    PHYSFS_uint32 count = 0;
-    UNPKentry *entries = NULL;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, sizeof (buf)), ERRPASS, NULL);
-    if (memcmp(buf, "KenSilverman", sizeof (buf)) != 0)
-        BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &count, sizeof(count)), ERRPASS, NULL);
-    count = PHYSFS_swapULE32(count);
-
-    entries = grpLoadEntries(io, count);
-    BAIL_IF_MACRO(!entries, ERRPASS, NULL);
-    return UNPK_openArchive(io, entries, count);
-} /* GRP_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "GRP",
-        "Build engine Groupfile format",
-        "Ryan C. Gordon <icculus@icculus.org>",
-        "https://icculus.org/physfs/",
-        0,  /* supportsSymlinks */
-    },
-    GRP_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_GRP */
-
-/* end of archiver_grp.c ... */
-
--- a/misc/libphysfs/archiver_hog.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
- * HOG support routines for PhysicsFS.
- *
- * This driver handles Descent I/II HOG archives.
- *
- * The format is very simple:
- *
- *   The file always starts with the 3-byte signature "DHF" (Descent
- *   HOG file). After that the files of a HOG are just attached after
- *   another, divided by a 17 bytes header, which specifies the name
- *   and length (in bytes) of the forthcoming file! So you just read
- *   the header with its information of how big the following file is,
- *   and then skip exact that number of bytes to get to the next file
- *   in that HOG.
- *
- *    char sig[3] = {'D', 'H', 'F'}; // "DHF"=Descent HOG File
- *
- *    struct {
- *     char file_name[13]; // Filename, padded to 13 bytes with 0s
- *     int file_size; // filesize in bytes
- *     char data[file_size]; // The file data
- *    } FILE_STRUCT; // Repeated until the end of the file.
- *
- * (That info is from http://www.descent2.com/ddn/specs/hog/)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Bradley Bell.
- *  Based on grp.c by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_HOG
-
-static UNPKentry *hogLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 *_entCount)
-{
-    const PHYSFS_uint64 iolen = io->length(io);
-    PHYSFS_uint32 entCount = 0;
-    void *ptr = NULL;
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-    PHYSFS_uint32 size = 0;
-    PHYSFS_uint32 pos = 3;
-
-    while (pos < iolen)
-    {
-        entCount++;
-        ptr = allocator.Realloc(ptr, sizeof (UNPKentry) * entCount);
-        GOTO_IF_MACRO(ptr == NULL, PHYSFS_ERR_OUT_OF_MEMORY, failed);
-        entries = (UNPKentry *) ptr;
-        entry = &entries[entCount-1];
-
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->name, 13), ERRPASS, failed);
-        pos += 13;
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &size, 4), ERRPASS, failed);
-        pos += 4;
-
-        entry->size = PHYSFS_swapULE32(size);
-        entry->startPos = pos;
-        pos += size;
-
-        /* skip over entry */
-        GOTO_IF_MACRO(!io->seek(io, pos), ERRPASS, failed);
-    } /* while */
-
-    *_entCount = entCount;
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-} /* hogLoadEntries */
-
-
-static void *HOG_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint8 buf[3];
-    PHYSFS_uint32 count = 0;
-    UNPKentry *entries = NULL;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, 3), ERRPASS, NULL);
-    BAIL_IF_MACRO(memcmp(buf, "DHF", 3) != 0, PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    entries = hogLoadEntries(io, &count);
-    BAIL_IF_MACRO(!entries, ERRPASS, NULL);
-    return UNPK_openArchive(io, entries, count);
-} /* HOG_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "HOG",
-        "Descent I/II HOG file format",
-        "Bradley Bell <btb@icculus.org>",
-        "https://icculus.org/physfs/",
-        0,  /* supportsSymlinks */
-    },
-    HOG_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_HOG */
-
-/* end of archiver_hog.c ... */
-
--- a/misc/libphysfs/archiver_iso9660.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,961 +0,0 @@
-/*
- * ISO9660 support routines for PhysicsFS.
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Christoph Nelles.
- */
-
-/* !!! FIXME: this file needs Ryanification. */
-
-/*
- * Handles CD-ROM disk images (and raw CD-ROM devices).
- *
- * Not supported:
- * - RockRidge
- * - Non 2048 Sectors
- * - UDF
- *
- * Deviations from the standard
- * - Ignores mandatory sort order
- * - Allows various invalid file names
- *
- * Problems
- * - Ambiguities in the standard
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_ISO9660
-
-#include <time.h>
-
-/* cache files smaller than this completely in memory */
-#define ISO9660_FULLCACHEMAXSIZE 2048
-
-/* !!! FIXME: this is going to cause trouble. */
-#pragma pack(push)  /* push current alignment to stack */
-#pragma pack(1)     /* set alignment to 1 byte boundary */
-
-/* This is the format as defined by the standard
-typedef struct
-{
-    PHYSFS_uint32 lsb;
-    PHYSFS_uint32 msb;
-} ISOBB32bit; // 32byte Both Byte type, means the value first in LSB then in MSB
-
-typedef struct
-{
-    PHYSFS_uint16 lsb;
-    PHYSFS_uint16 msb;
-} ISOBB16bit; // 16byte Both Byte type, means the value first in LSB then in MSB
-*/
-
-/* define better ones to simplify coding (less if's) */
-#if PHYSFS_BYTEORDER == PHYSFS_LIL_ENDIAN
-#define ISOBB32bit(name) PHYSFS_uint32 name; PHYSFS_uint32 __dummy_##name;
-#define ISOBB16bit(name) PHYSFS_uint16 name; PHYSFS_uint16 __dummy_##name;
-#else
-#define ISOBB32bit(name) PHYSFS_uint32 __dummy_##name; PHYSFS_uint32 name;
-#define ISOBB16bit(name) PHYSFS_uint16 __dummy_##name; PHYSFS_uint16 name;
-#endif
-
-typedef struct
-{
-    char year[4];
-    char month[2];
-    char day[2];
-    char hour[2];
-    char minute[2];
-    char second[2];
-    char centisec[2];
-    PHYSFS_sint8 offset; /* in 15min from GMT */
-} ISO9660VolumeTimestamp;
-
-typedef struct
-{
-    PHYSFS_uint8 year;
-    PHYSFS_uint8 month;
-    PHYSFS_uint8 day;
-    PHYSFS_uint8 hour;
-    PHYSFS_uint8 minute;
-    PHYSFS_uint8 second;
-    PHYSFS_sint8 offset;
-} ISO9660FileTimestamp;
-
-typedef struct
-{
-  unsigned existence:1;
-  unsigned directory:1;
-  unsigned associated_file:1;
-  unsigned record:1;
-  unsigned protection:1;
-  unsigned reserved:2;
-  unsigned multiextent:1;
-} ISO9660FileFlags;
-
-typedef struct
-{
-    PHYSFS_uint8 length;
-    PHYSFS_uint8 attribute_length;
-    ISOBB32bit(extent_location)
-    ISOBB32bit(data_length)
-    ISO9660FileTimestamp timestamp;
-    ISO9660FileFlags file_flags;
-    PHYSFS_uint8 file_unit_size;
-    PHYSFS_uint8 gap_size;
-    ISOBB16bit(vol_seq_no)
-    PHYSFS_uint8 len_fi;
-    char unused;
-} ISO9660RootDirectoryRecord;
-
-/* this structure is combined for all Volume descriptor types */
-typedef struct
-{
-    PHYSFS_uint8 type;
-    char identifier[5];
-    PHYSFS_uint8 version;
-    PHYSFS_uint8 flags;
-    char system_identifier[32];
-    char volume_identifier[32];
-    char unused2[8];
-    ISOBB32bit(space_size)
-    PHYSFS_uint8 escape_sequences[32];
-    ISOBB16bit(vol_set_size)
-    ISOBB16bit(vol_seq_no)
-    ISOBB16bit(block_size)
-    ISOBB32bit(path_table_size)
-/*    PHYSFS_uint32 path_table_start_lsb; // why didn't they use both byte type?
-    PHYSFS_uint32 opt_path_table_start_lsb;
-    PHYSFS_uint32 path_table_start_msb;
-    PHYSFS_uint32 opt_path_table_start_msb;*/
-#if PHYSFS_BYTEORDER == PHYSFS_LIL_ENDIAN
-    PHYSFS_uint32 path_table_start;
-    PHYSFS_uint32 opt_path_table_start;
-    PHYSFS_uint32 unused6;
-    PHYSFS_uint32 unused7;
-#else
-    PHYSFS_uint32 unused6;
-    PHYSFS_uint32 unused7;
-    PHYSFS_uint32 path_table_start;
-    PHYSFS_uint32 opt_path_table_start;
-#endif
-    ISO9660RootDirectoryRecord rootdirectory;
-    char set_identifier[128];
-    char publisher_identifier[128];
-    char preparer_identifer[128];
-    char application_identifier[128];
-    char copyright_file_identifier[37];
-    char abstract_file_identifier[37];
-    char bibliographic_file_identifier[37];
-    ISO9660VolumeTimestamp creation_timestamp;
-    ISO9660VolumeTimestamp modification_timestamp;
-    ISO9660VolumeTimestamp expiration_timestamp;
-    ISO9660VolumeTimestamp effective_timestamp;
-    PHYSFS_uint8 file_structure_version;
-    char unused4;
-    char application_use[512];
-    char unused5[653];
-} ISO9660VolumeDescriptor;
-
-typedef struct
-{
-    PHYSFS_uint8 recordlen;
-    PHYSFS_uint8 extattributelen;
-    ISOBB32bit(extentpos)
-    ISOBB32bit(datalen)
-    ISO9660FileTimestamp recordtime;
-    ISO9660FileFlags flags;
-    PHYSFS_uint8 file_unit_size;
-    PHYSFS_uint8 interleave_gap;
-    ISOBB16bit(volseqno)
-    PHYSFS_uint8 filenamelen;
-    char filename[222]; /* This is not exact, but makes reading easier */
-} ISO9660FileDescriptor;
-
-typedef struct
-{
-    ISOBB16bit(owner)
-    ISOBB16bit(group)
-    PHYSFS_uint16 flags; /* not implemented*/
-    ISO9660VolumeTimestamp create_time; /* yes, not file timestamp */
-    ISO9660VolumeTimestamp mod_time;
-    ISO9660VolumeTimestamp expire_time;
-    ISO9660VolumeTimestamp effective_time;
-    PHYSFS_uint8 record_format;
-    PHYSFS_uint8 record_attributes;
-    ISOBB16bit(record_len)
-    char system_identifier[32];
-    char system_use[64];
-    PHYSFS_uint8 version;
-    ISOBB16bit(escape_len)
-    char reserved[64];
-    /** further fields not implemented */
-} ISO9660ExtAttributeRec;
-
-#pragma pack(pop)   /* restore original alignment from stack */
-
-typedef struct
-{
-    PHYSFS_Io *io;
-    PHYSFS_uint32 rootdirstart;
-    PHYSFS_uint32 rootdirsize;
-    PHYSFS_uint64 currpos;
-    int isjoliet;
-    char *path;
-    void *mutex;
-} ISO9660Handle;
-
-
-typedef struct __ISO9660FileHandle
-{
-    PHYSFS_sint64 filesize;
-    PHYSFS_uint64 currpos;
-    PHYSFS_uint64 startblock;
-    ISO9660Handle *isohandle;
-    PHYSFS_uint32 (*read) (struct __ISO9660FileHandle *filehandle, void *buffer,
-            PHYSFS_uint64 len);
-    int (*seek)(struct __ISO9660FileHandle *filehandle,  PHYSFS_sint64 offset);
-    void (*close)(struct __ISO9660FileHandle *filehandle);
-    /* !!! FIXME: anonymouse union is going to cause problems. */
-    union
-    {
-        /* !!! FIXME: just use a memory PHYSFS_Io here, unify all this code. */
-        char *cacheddata; /* data of file when cached */
-        PHYSFS_Io *io; /* handle to separate opened file */
-    };
-} ISO9660FileHandle;
-
-/*******************************************************************************
- * Time conversion functions
- ******************************************************************************/
-
-static PHYSFS_sint64 iso_mktime(ISO9660FileTimestamp *timestamp)
-{
-    struct tm tm;
-    tm.tm_year = timestamp->year;
-    tm.tm_mon = timestamp->month - 1;
-    tm.tm_mday = timestamp->day;
-    tm.tm_hour = timestamp->hour;
-    tm.tm_min = timestamp->minute;
-    tm.tm_sec = timestamp->second;
-    /* Ignore GMT offset for now... */
-    return mktime(&tm);
-} /* iso_mktime */
-
-static int iso_atoi2(char *text)
-{
-    return ((text[0] - 40) * 10) + (text[1] - 40);
-} /* iso_atoi2 */
-
-static int iso_atoi4(char *text)
-{
-    return ((text[0] - 40) * 1000) + ((text[1] - 40) * 100) +
-           ((text[2] - 40) * 10) + (text[3] - 40);
-} /* iso_atoi4 */
-
-static PHYSFS_sint64 iso_volume_mktime(ISO9660VolumeTimestamp *timestamp)
-{
-    struct tm tm;
-    tm.tm_year = iso_atoi4(timestamp->year);
-    tm.tm_mon = iso_atoi2(timestamp->month) - 1;
-    tm.tm_mday = iso_atoi2(timestamp->day);
-    tm.tm_hour = iso_atoi2(timestamp->hour);
-    tm.tm_min = iso_atoi2(timestamp->minute);
-    tm.tm_sec = iso_atoi2(timestamp->second);
-    /* this allows values outside the range of a unix timestamp... sanitize them */
-    PHYSFS_sint64 value = mktime(&tm);
-    return value == -1 ? 0 : value;
-} /* iso_volume_mktime */
-
-/*******************************************************************************
- * Filename extraction
- ******************************************************************************/
-
-static int iso_extractfilenameISO(ISO9660FileDescriptor *descriptor,
-        char *filename, int *version)
-{
-    *filename = '\0';
-    if (descriptor->flags.directory)
-    {
-        strncpy(filename, descriptor->filename, descriptor->filenamelen);
-        filename[descriptor->filenamelen] = '\0';
-        *version = 0;
-    } /* if */
-    else
-    {
-        /* find last SEPARATOR2 */
-        int pos = 0;
-        int lastfound = -1;
-        for(;pos < descriptor->filenamelen; pos++)
-            if (descriptor->filename[pos] == ';')
-                lastfound = pos;
-        BAIL_IF_MACRO(lastfound < 1, PHYSFS_ERR_NOT_FOUND /* !!! FIXME: PHYSFS_ERR_BAD_FILENAME */, -1);
-        BAIL_IF_MACRO(lastfound == (descriptor->filenamelen -1), PHYSFS_ERR_NOT_FOUND /* !!! PHYSFS_ERR_BAD_FILENAME */, -1);
-        strncpy(filename, descriptor->filename, lastfound);
-        if (filename[lastfound - 1] == '.')
-            filename[lastfound - 1] = '\0'; /* consume trailing ., as done in all implementations */
-        else
-            filename[lastfound] = '\0';
-        *version = atoi(descriptor->filename + lastfound);
-    } /* else */
-
-    return 0;
-} /* iso_extractfilenameISO */
-
-
-static int iso_extractfilenameUCS2(ISO9660FileDescriptor *descriptor,
-        char *filename, int *version)
-{
-    PHYSFS_uint16 tmp[128];
-    PHYSFS_uint16 *src;
-    int len;
-
-    *filename = '\0';
-    *version = 1; /* Joliet does not have versions.. at least not on my images */
-
-    src = (PHYSFS_uint16*) descriptor->filename;
-    len = descriptor->filenamelen / 2;
-    tmp[len] = 0;
-
-    while(len--)
-        tmp[len] = PHYSFS_swapUBE16(src[len]);
-
-    PHYSFS_utf8FromUcs2(tmp, filename, 255);
-
-    return 0;
-} /* iso_extractfilenameUCS2 */
-
-
-static int iso_extractfilename(ISO9660Handle *handle,
-        ISO9660FileDescriptor *descriptor, char *filename,int *version)
-{
-    if (handle->isjoliet)
-        return iso_extractfilenameUCS2(descriptor, filename, version);
-    else
-        return iso_extractfilenameISO(descriptor, filename, version);
-} /* iso_extractfilename */
-
-/*******************************************************************************
- * Basic image read functions
- ******************************************************************************/
-
-static int iso_readimage(ISO9660Handle *handle, PHYSFS_uint64 where,
-                         void *buffer, PHYSFS_uint64 len)
-{
-    BAIL_IF_MACRO(!__PHYSFS_platformGrabMutex(handle->mutex), ERRPASS, -1);
-    int rc = -1;
-    if (where != handle->currpos)
-        GOTO_IF_MACRO(!handle->io->seek(handle->io,where), ERRPASS, unlockme);
-    rc = handle->io->read(handle->io, buffer, len);
-    if (rc == -1)
-    {
-        handle->currpos = (PHYSFS_uint64) -1;
-        goto unlockme;
-    } /* if */
-    handle->currpos += rc;
-
-    unlockme:
-    __PHYSFS_platformReleaseMutex(handle->mutex);
-    return rc;
-} /* iso_readimage */
-
-
-static PHYSFS_sint64 iso_readfiledescriptor(ISO9660Handle *handle,
-                                            PHYSFS_uint64 where,
-                                            ISO9660FileDescriptor *descriptor)
-{
-    PHYSFS_sint64 rc = iso_readimage(handle, where, descriptor,
-                                     sizeof (descriptor->recordlen));
-    BAIL_IF_MACRO(rc == -1, ERRPASS, -1);
-    BAIL_IF_MACRO(rc != 1, PHYSFS_ERR_CORRUPT, -1);
-
-    if (descriptor->recordlen == 0)
-        return 0; /* fill bytes at the end of a sector */
-
-    rc = iso_readimage(handle, where + 1, &descriptor->extattributelen,
-            descriptor->recordlen - sizeof(descriptor->recordlen));
-    BAIL_IF_MACRO(rc == -1, ERRPASS, -1);
-    BAIL_IF_MACRO(rc != 1, PHYSFS_ERR_CORRUPT, -1);
-
-    return 0;
-} /* iso_readfiledescriptor */
-
-static void iso_extractsubpath(char *path, char **subpath)
-{
-    *subpath = strchr(path,'/');
-    if (*subpath != 0)
-    {
-        **subpath = 0;
-        *subpath +=1;
-    } /* if */
-} /* iso_extractsubpath */
-
-/*
- * Don't use path tables, they are not necessarily faster, but more complicated
- * to implement as they store only directories and not files, so searching for
- * a file needs to branch to the directory extent sooner or later.
- */
-static int iso_find_dir_entry(ISO9660Handle *handle,const char *path,
-                              ISO9660FileDescriptor *descriptor)
-{
-    char *subpath = 0;
-    PHYSFS_uint64 readpos, end_of_dir;
-    char filename[255];
-    char pathcopy[256];
-    char *mypath;
-    int version = 0;
-
-    strcpy(pathcopy, path);
-    mypath = pathcopy;
-
-    readpos = handle->rootdirstart;
-    end_of_dir = handle->rootdirstart + handle->rootdirsize;
-    iso_extractsubpath(mypath, &subpath);
-    while (1)
-    {
-        BAIL_IF_MACRO(iso_readfiledescriptor(handle, readpos, descriptor), ERRPASS, -1);
-
-        /* recordlen = 0 -> no more entries or fill entry */
-        if (!descriptor->recordlen)
-        {
-            /* if we are in the last sector of the directory & it's 0 -> end */
-            if ((end_of_dir - 2048) <= (readpos -1))
-                break; /* finished */
-
-            /* else skip to the next sector & continue; */
-            readpos = (((readpos - 1) / 2048) + 1) * 2048;
-            continue;
-        } /* if */
-
-        readpos += descriptor->recordlen;
-        if (descriptor->filenamelen == 1 && (descriptor->filename[0] == 0
-                || descriptor->filename[0] == 1))
-            continue; /* special ones, ignore */
-
-        BAIL_IF_MACRO(
-            iso_extractfilename(handle, descriptor, filename, &version),
-            ERRPASS, -1);
-
-        if (strcmp(filename, mypath) == 0)
-        {
-            if ( (subpath == 0) || (subpath[0] == 0) )
-                return 0;  /* no subpaths left and we found the entry */
-
-            if (descriptor->flags.directory)
-            {
-                /* shorten the path to the subpath */
-                mypath = subpath;
-                iso_extractsubpath(mypath, &subpath);
-                /* gosub to the new directory extent */
-                readpos = descriptor->extentpos * 2048;
-                end_of_dir = readpos + descriptor->datalen;
-            } /* if */
-            else
-            {
-                /* !!! FIXME: set PHYSFS_ERR_NOT_FOUND? */
-                /* we're at a file but have a remaining subpath -> no match */
-                return 0;
-            } /* else */
-        } /* if */
-    } /* while */
-
-    /* !!! FIXME: set PHYSFS_ERR_NOT_FOUND? */
-    return 0;
-} /* iso_find_dir_entry */
-
-
-static int iso_read_ext_attributes(ISO9660Handle *handle, int block,
-                                   ISO9660ExtAttributeRec *attributes)
-{
-    return iso_readimage(handle, block * 2048, attributes,
-                         sizeof(ISO9660ExtAttributeRec));
-} /* iso_read_ext_attributes */
-
-
-static int ISO9660_flush(PHYSFS_Io *io) { return 1;  /* no write support. */ }
-
-static PHYSFS_Io *ISO9660_duplicate(PHYSFS_Io *_io)
-{
-    BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);  /* !!! FIXME: write me. */
-} /* ISO9660_duplicate */
-
-
-static void ISO9660_destroy(PHYSFS_Io *io)
-{
-    ISO9660FileHandle *fhandle = (ISO9660FileHandle*) io->opaque;
-    fhandle->close(fhandle);
-    allocator.Free(io);
-} /* ISO9660_destroy */
-
-
-static PHYSFS_sint64 ISO9660_read(PHYSFS_Io *io, void *buf, PHYSFS_uint64 len)
-{
-    ISO9660FileHandle *fhandle = (ISO9660FileHandle*) io->opaque;
-    return fhandle->read(fhandle, buf, len);
-} /* ISO9660_read */
-
-
-static PHYSFS_sint64 ISO9660_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 l)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, -1);
-} /* ISO9660_write */
-
-
-static PHYSFS_sint64 ISO9660_tell(PHYSFS_Io *io)
-{
-    return ((ISO9660FileHandle*) io->opaque)->currpos;
-} /* ISO9660_tell */
-
-
-static int ISO9660_seek(PHYSFS_Io *io, PHYSFS_uint64 offset)
-{
-    ISO9660FileHandle *fhandle = (ISO9660FileHandle*) io->opaque;
-    return fhandle->seek(fhandle, offset);
-} /* ISO9660_seek */
-
-
-static PHYSFS_sint64 ISO9660_length(PHYSFS_Io *io)
-{
-    return ((ISO9660FileHandle*) io->opaque)->filesize;
-} /* ISO9660_length */
-
-
-static const PHYSFS_Io ISO9660_Io =
-{
-    CURRENT_PHYSFS_IO_API_VERSION, NULL,
-    ISO9660_read,
-    ISO9660_write,
-    ISO9660_seek,
-    ISO9660_tell,
-    ISO9660_length,
-    ISO9660_duplicate,
-    ISO9660_flush,
-    ISO9660_destroy
-};
-
-
-/*******************************************************************************
- * Archive management functions
- ******************************************************************************/
-
-static void *ISO9660_openArchive(PHYSFS_Io *io, const char *filename, int forWriting)
-{
-    char magicnumber[6];
-    ISO9660Handle *handle;
-    int founddescriptor = 0;
-    int foundjoliet = 0;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-
-    /* Skip system area to magic number in Volume descriptor */
-    BAIL_IF_MACRO(!io->seek(io, 32769), ERRPASS, NULL);
-    BAIL_IF_MACRO(io->read(io, magicnumber, 5) != 5, ERRPASS, NULL);
-    if (memcmp(magicnumber, "CD001", 6) != 0)
-        BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    handle = allocator.Malloc(sizeof(ISO9660Handle));
-    GOTO_IF_MACRO(!handle, PHYSFS_ERR_OUT_OF_MEMORY, errorcleanup);
-    handle->path = 0;
-    handle->mutex= 0;
-    handle->io = NULL;
-
-    handle->path = allocator.Malloc(strlen(filename) + 1);
-    GOTO_IF_MACRO(!handle->path, PHYSFS_ERR_OUT_OF_MEMORY, errorcleanup);
-    strcpy(handle->path, filename);
-
-    handle->mutex = __PHYSFS_platformCreateMutex();
-    GOTO_IF_MACRO(!handle->mutex, ERRPASS, errorcleanup);
-
-    handle->io = io;
-
-    /* seek Primary Volume Descriptor */
-    GOTO_IF_MACRO(!io->seek(io, 32768), PHYSFS_ERR_IO, errorcleanup);
-
-    while (1)
-    {
-        ISO9660VolumeDescriptor descriptor;
-        GOTO_IF_MACRO(io->read(io, &descriptor, sizeof(ISO9660VolumeDescriptor)) != sizeof(ISO9660VolumeDescriptor), PHYSFS_ERR_IO, errorcleanup);
-        GOTO_IF_MACRO(strncmp(descriptor.identifier, "CD001", 5) != 0, PHYSFS_ERR_UNSUPPORTED, errorcleanup);
-
-        if (descriptor.type == 255)
-        {
-            /* type 255 terminates the volume descriptor list */
-            if (founddescriptor)
-                return handle; /* ok, we've found one volume descriptor */
-            else
-                GOTO_MACRO(PHYSFS_ERR_CORRUPT, errorcleanup);
-        } /* if */
-        if (descriptor.type == 1 && !founddescriptor)
-        {
-            handle->currpos = io->tell(io);
-            handle->rootdirstart =
-                    descriptor.rootdirectory.extent_location * 2048;
-            handle->rootdirsize =
-                    descriptor.rootdirectory.data_length;
-            handle->isjoliet = 0;
-            founddescriptor = 1; /* continue search for joliet */
-        } /* if */
-        if (descriptor.type == 2 && !foundjoliet)
-        {
-            /* check if is joliet */
-            PHYSFS_uint8 *s = descriptor.escape_sequences;
-            int joliet = !(descriptor.flags & 1)
-                    && (s[0] == 0x25)
-                    && (s[1] == 0x2F)
-                    && ((s[2] == 0x40) || (s[2] == 0x43) || (s[2] == 0x45));
-            if (!joliet)
-                continue;
-
-            handle->currpos = io->tell(io);
-            handle->rootdirstart =
-                    descriptor.rootdirectory.extent_location * 2048;
-            handle->rootdirsize =
-                    descriptor.rootdirectory.data_length;
-            handle->isjoliet = 1;
-            founddescriptor = 1;
-            foundjoliet = 1;
-        } /* if */
-    } /* while */
-
-    GOTO_MACRO(PHYSFS_ERR_CORRUPT, errorcleanup);  /* not found. */
-
-errorcleanup:
-    if (handle)
-    {
-        if (handle->path)
-            allocator.Free(handle->path);
-        if (handle->mutex)
-            __PHYSFS_platformDestroyMutex(handle->mutex);
-        allocator.Free(handle);
-    } /* if */
-    return NULL;
-} /* ISO9660_openArchive */
-
-
-static void ISO9660_closeArchive(void *opaque)
-{
-    ISO9660Handle *handle = (ISO9660Handle*) opaque;
-    handle->io->destroy(handle->io);
-    __PHYSFS_platformDestroyMutex(handle->mutex);
-    allocator.Free(handle->path);
-    allocator.Free(handle);
-} /* ISO9660_closeArchive */
-
-
-/*******************************************************************************
- * Read functions
- ******************************************************************************/
-
-
-static PHYSFS_uint32 iso_file_read_mem(ISO9660FileHandle *filehandle,
-                                       void *buffer, PHYSFS_uint64 len)
-{
-    /* check remaining bytes & max obj which can be fetched */
-    const PHYSFS_sint64 bytesleft = filehandle->filesize - filehandle->currpos;
-    if (bytesleft < len)
-        len = bytesleft;
-
-    if (len == 0)
-        return 0;
-
-    memcpy(buffer, filehandle->cacheddata + filehandle->currpos, (size_t) len);
-
-    filehandle->currpos += len;
-    return (PHYSFS_uint32) len;
-} /* iso_file_read_mem */
-
-
-static int iso_file_seek_mem(ISO9660FileHandle *fhandle, PHYSFS_sint64 offset)
-{
-    BAIL_IF_MACRO(offset < 0, PHYSFS_ERR_INVALID_ARGUMENT, 0);
-    BAIL_IF_MACRO(offset >= fhandle->filesize, PHYSFS_ERR_PAST_EOF, 0);
-
-    fhandle->currpos = offset;
-    return 0;
-} /* iso_file_seek_mem */
-
-
-static void iso_file_close_mem(ISO9660FileHandle *fhandle)
-{
-    allocator.Free(fhandle->cacheddata);
-    allocator.Free(fhandle);
-} /* iso_file_close_mem */
-
-
-static PHYSFS_uint32 iso_file_read_foreign(ISO9660FileHandle *filehandle,
-                                           void *buffer, PHYSFS_uint64 len)
-{
-    /* check remaining bytes & max obj which can be fetched */
-    const PHYSFS_sint64 bytesleft = filehandle->filesize - filehandle->currpos;
-    if (bytesleft < len)
-        len = bytesleft;
-
-    const PHYSFS_sint64 rc = filehandle->io->read(filehandle->io, buffer, len);
-    BAIL_IF_MACRO(rc == -1, ERRPASS, -1);
-
-    filehandle->currpos += rc; /* i trust my internal book keeping */
-    BAIL_IF_MACRO(rc < len, PHYSFS_ERR_CORRUPT, -1);
-    return rc;
-} /* iso_file_read_foreign */
-
-
-static int iso_file_seek_foreign(ISO9660FileHandle *fhandle,
-                                 PHYSFS_sint64 offset)
-{
-    BAIL_IF_MACRO(offset < 0, PHYSFS_ERR_INVALID_ARGUMENT, 0);
-    BAIL_IF_MACRO(offset >= fhandle->filesize, PHYSFS_ERR_PAST_EOF, 0);
-
-    PHYSFS_sint64 pos = fhandle->startblock * 2048 + offset;
-    BAIL_IF_MACRO(!fhandle->io->seek(fhandle->io, pos), ERRPASS, -1);
-
-    fhandle->currpos = offset;
-    return 0;
-} /* iso_file_seek_foreign */
-
-
-static void iso_file_close_foreign(ISO9660FileHandle *fhandle)
-{
-    fhandle->io->destroy(fhandle->io);
-    allocator.Free(fhandle);
-} /* iso_file_close_foreign */
-
-
-static int iso_file_open_mem(ISO9660Handle *handle, ISO9660FileHandle *fhandle)
-{
-    fhandle->cacheddata = allocator.Malloc(fhandle->filesize);
-    BAIL_IF_MACRO(!fhandle->cacheddata, PHYSFS_ERR_OUT_OF_MEMORY, -1);
-    int rc = iso_readimage(handle, fhandle->startblock * 2048,
-                           fhandle->cacheddata, fhandle->filesize);
-    GOTO_IF_MACRO(rc < 0, ERRPASS, freemem);
-    GOTO_IF_MACRO(rc == 0, PHYSFS_ERR_CORRUPT, freemem);
-
-    fhandle->read = iso_file_read_mem;
-    fhandle->seek = iso_file_seek_mem;
-    fhandle->close = iso_file_close_mem;
-    return 0;
-
-freemem:
-    allocator.Free(fhandle->cacheddata);
-    return -1;
-} /* iso_file_open_mem */
-
-
-static int iso_file_open_foreign(ISO9660Handle *handle,
-                                 ISO9660FileHandle *fhandle)
-{
-    int rc;
-    fhandle->io = __PHYSFS_createNativeIo(handle->path, 'r');
-    BAIL_IF_MACRO(!fhandle->io, ERRPASS, -1);
-    rc = fhandle->io->seek(fhandle->io, fhandle->startblock * 2048);
-    GOTO_IF_MACRO(!rc, ERRPASS, closefile);
-
-    fhandle->read = iso_file_read_foreign;
-    fhandle->seek = iso_file_seek_foreign;
-    fhandle->close = iso_file_close_foreign;
-    return 0;
-
-closefile:
-    fhandle->io->destroy(fhandle->io);
-    return -1;
-} /* iso_file_open_foreign */
-
-
-static PHYSFS_Io *ISO9660_openRead(void *opaque, const char *filename)
-{
-    PHYSFS_Io *retval = NULL;
-    ISO9660Handle *handle = (ISO9660Handle*) opaque;
-    ISO9660FileHandle *fhandle;
-    ISO9660FileDescriptor descriptor;
-    int rc;
-
-    fhandle = allocator.Malloc(sizeof(ISO9660FileHandle));
-    BAIL_IF_MACRO(fhandle == 0, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    fhandle->cacheddata = 0;
-
-    retval = allocator.Malloc(sizeof(PHYSFS_Io));
-    GOTO_IF_MACRO(retval == 0, PHYSFS_ERR_OUT_OF_MEMORY, errorhandling);
-
-    /* find file descriptor */
-    rc = iso_find_dir_entry(handle, filename, &descriptor);
-    GOTO_IF_MACRO(rc, ERRPASS, errorhandling);
-
-    fhandle->startblock = descriptor.extentpos + descriptor.extattributelen;
-    fhandle->filesize = descriptor.datalen;
-    fhandle->currpos = 0;
-    fhandle->isohandle = handle;
-    fhandle->cacheddata = NULL;
-    fhandle->io = NULL;
-
-    if (descriptor.datalen <= ISO9660_FULLCACHEMAXSIZE)
-        rc = iso_file_open_mem(handle, fhandle);
-    else
-        rc = iso_file_open_foreign(handle, fhandle);
-    GOTO_IF_MACRO(rc, ERRPASS, errorhandling);
-
-    memcpy(retval, &ISO9660_Io, sizeof (PHYSFS_Io));
-    retval->opaque = fhandle;
-    return retval;
-
-errorhandling:
-    if (retval) allocator.Free(retval);
-    if (fhandle) allocator.Free(fhandle);
-    return NULL;
-} /* ISO9660_openRead */
-
-
-
-/*******************************************************************************
- * Information gathering functions
- ******************************************************************************/
-
-static void ISO9660_enumerateFiles(void *opaque, const char *dname,
-                                   PHYSFS_EnumFilesCallback cb,
-                                   const char *origdir, void *callbackdata)
-{
-    ISO9660Handle *handle = (ISO9660Handle*) opaque;
-    ISO9660FileDescriptor descriptor;
-    PHYSFS_uint64 readpos;
-    PHYSFS_uint64 end_of_dir;
-    char filename[130]; /* ISO allows 31, Joliet 128 -> 128 + 2 eol bytes */
-    int version = 0;
-
-    if (*dname == '\0')
-    {
-        readpos = handle->rootdirstart;
-        end_of_dir = readpos + handle->rootdirsize;
-    } /* if */
-    else
-    {
-        printf("pfad %s\n",dname);
-        BAIL_IF_MACRO(iso_find_dir_entry(handle,dname, &descriptor), ERRPASS,);
-        BAIL_IF_MACRO(!descriptor.flags.directory, ERRPASS,);
-
-        readpos = descriptor.extentpos * 2048;
-        end_of_dir = readpos + descriptor.datalen;
-    } /* else */
-
-    while (1)
-    {
-        BAIL_IF_MACRO(iso_readfiledescriptor(handle, readpos, &descriptor), ERRPASS, );
-
-        /* recordlen = 0 -> no more entries or fill entry */
-        if (!descriptor.recordlen)
-        {
-            /* if we are in the last sector of the directory & it's 0 -> end */
-            if ((end_of_dir - 2048) <= (readpos -1))
-                break;  /* finished */
-
-            /* else skip to the next sector & continue; */
-            readpos = (((readpos - 1) / 2048) + 1) * 2048;
-            continue;
-        } /* if */
-
-        readpos +=  descriptor.recordlen;
-        if (descriptor.filenamelen == 1 && (descriptor.filename[0] == 0
-                || descriptor.filename[0] == 1))
-            continue; /* special ones, ignore */
-
-        strncpy(filename,descriptor.filename,descriptor.filenamelen);
-        iso_extractfilename(handle, &descriptor, filename, &version);
-        cb(callbackdata, origdir,filename);
-    } /* while */
-} /* ISO9660_enumerateFiles */
-
-
-static int ISO9660_stat(void *opaque, const char *name, PHYSFS_Stat *stat)
-{
-    ISO9660Handle *handle = (ISO9660Handle*) opaque;
-    ISO9660FileDescriptor descriptor;
-    ISO9660ExtAttributeRec extattr;
-    BAIL_IF_MACRO(iso_find_dir_entry(handle, name, &descriptor), ERRPASS, -1);
-
-    stat->readonly = 1;
-
-    /* try to get extended info */
-    if (descriptor.extattributelen)
-    {
-        BAIL_IF_MACRO(iso_read_ext_attributes(handle,
-                descriptor.extentpos, &extattr), ERRPASS, -1);
-        stat->createtime = iso_volume_mktime(&extattr.create_time);
-        stat->modtime = iso_volume_mktime(&extattr.mod_time);
-        stat->accesstime = iso_volume_mktime(&extattr.mod_time);
-    } /* if */
-    else
-    {
-        stat->createtime = iso_mktime(&descriptor.recordtime);
-        stat->modtime = iso_mktime(&descriptor.recordtime);
-        stat->accesstime = iso_mktime(&descriptor.recordtime);
-    } /* else */
-
-    if (descriptor.flags.directory)
-    {
-        stat->filesize = 0;
-        stat->filetype = PHYSFS_FILETYPE_DIRECTORY;
-    } /* if */
-    else
-    {
-        stat->filesize = descriptor.datalen;
-        stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    } /* else */
-
-    return 1;
-} /* ISO9660_stat */
-
-
-/*******************************************************************************
- * Not supported functions
- ******************************************************************************/
-
-static PHYSFS_Io *ISO9660_openWrite(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* ISO9660_openWrite */
-
-
-static PHYSFS_Io *ISO9660_openAppend(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* ISO9660_openAppend */
-
-
-static int ISO9660_remove(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* ISO9660_remove */
-
-
-static int ISO9660_mkdir(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* ISO9660_mkdir */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "ISO",
-        "ISO9660 image file",
-        "Christoph Nelles <evilazrael@evilazrael.de>",
-        "https://www.evilazrael.de/",
-        0,  /* supportsSymlinks */
-    },
-    ISO9660_openArchive,
-    ISO9660_enumerateFiles,
-    ISO9660_openRead,
-    ISO9660_openWrite,
-    ISO9660_openAppend,
-    ISO9660_remove,
-    ISO9660_mkdir,
-    ISO9660_stat,
-    ISO9660_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_ISO9660 */
-
-/* end of archiver_iso9660.c ... */
-
--- a/misc/libphysfs/archiver_lzma.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,699 +0,0 @@
-/*
- * LZMA support routines for PhysicsFS.
- *
- * Please see the file lzma.txt in the lzma/ directory.
- *
- *  This file was written by Dennis Schridde, with some peeking at "7zMain.c"
- *   by Igor Pavlov.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_7Z
-
-#include "lzma/C/7zCrc.h"
-#include "lzma/C/Archive/7z/7zIn.h"
-#include "lzma/C/Archive/7z/7zExtract.h"
-
-
-/* 7z internal from 7zIn.c */
-extern int TestSignatureCandidate(Byte *testBytes);
-
-
-#ifdef _LZMA_IN_CB
-# define BUFFER_SIZE (1 << 12)
-#endif /* _LZMA_IN_CB */
-
-
-/*
- * Carries filestream metadata through 7z
- */
-typedef struct _FileInputStream
-{
-    ISzAlloc allocImp; /* Allocation implementation, used by 7z */
-    ISzAlloc allocTempImp; /* Temporary allocation implementation, used by 7z */
-    ISzInStream inStream; /* Input stream with read callbacks, used by 7z */
-    PHYSFS_Io *io;  /* Filehandle, used by read implementation */
-#ifdef _LZMA_IN_CB
-    Byte buffer[BUFFER_SIZE]; /* Buffer, used by read implementation */
-#endif /* _LZMA_IN_CB */
-} FileInputStream;
-
-/*
- * In the 7z format archives are splited into blocks, those are called folders
- * Set by LZMA_read()
-*/
-typedef struct _LZMAfolder
-{
-    PHYSFS_uint32 index; /* Index of folder in archive */
-    PHYSFS_uint32 references; /* Number of files using this block */
-    PHYSFS_uint8 *cache; /* Cached folder */
-    size_t size; /* Size of folder */
-} LZMAfolder;
-
-/*
- * Set by LZMA_openArchive(), except folder which gets it's values
- *  in LZMA_read()
- */
-typedef struct _LZMAarchive
-{
-    struct _LZMAfile *files; /* Array of files, size == archive->db.Database.NumFiles */
-    LZMAfolder *folders; /* Array of folders, size == archive->db.Database.NumFolders */
-    CArchiveDatabaseEx db; /* For 7z: Database */
-    FileInputStream stream; /* For 7z: Input file incl. read and seek callbacks */
-} LZMAarchive;
-
-/* Set by LZMA_openArchive(), except offset which is set by LZMA_read() */
-typedef struct _LZMAfile
-{
-    PHYSFS_uint32 index; /* Index of file in archive */
-    LZMAarchive *archive; /* Link to corresponding archive */
-    LZMAfolder *folder; /* Link to corresponding folder */
-    CFileItem *item; /* For 7z: File info, eg. name, size */
-    size_t offset; /* Offset in folder */
-    size_t position; /* Current "virtual" position in file */
-} LZMAfile;
-
-
-/* Memory management implementations to be passed to 7z */
-
-static void *SzAllocPhysicsFS(size_t size)
-{
-    return ((size == 0) ? NULL : allocator.Malloc(size));
-} /* SzAllocPhysicsFS */
-
-
-static void SzFreePhysicsFS(void *address)
-{
-    if (address != NULL)
-        allocator.Free(address);
-} /* SzFreePhysicsFS */
-
-
-/* Filesystem implementations to be passed to 7z */
-
-#ifdef _LZMA_IN_CB
-
-/*
- * Read implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
-                        size_t *processedSize)
-{
-    FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); /* HACK! */
-    PHYSFS_sint64 processedSizeLoc = 0;
-
-    if (maxReqSize > BUFFER_SIZE)
-        maxReqSize = BUFFER_SIZE;
-    processedSizeLoc = s->io->read(s->io, s->buffer, maxReqSize);
-    *buffer = s->buffer;
-    if (processedSize != NULL)
-        *processedSize = (size_t) processedSizeLoc;
-
-    return SZ_OK;
-} /* SzFileReadImp */
-
-#else
-
-/*
- * Read implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
-                        size_t *processedSize)
-{
-    FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
-    const size_t processedSizeLoc = s->io->read(s->io, buffer, size);
-    if (processedSize != NULL)
-        *processedSize = processedSizeLoc;
-    return SZ_OK;
-} /* SzFileReadImp */
-
-#endif
-
-/*
- * Seek implementation, to be passed to 7z
- * WARNING: If the ISzInStream in 'object' is not contained in a valid FileInputStream this _will_ break horribly!
- */
-SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
-{
-    FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
-    if (s->io->seek(s->io, (PHYSFS_uint64) pos))
-        return SZ_OK;
-    return SZE_FAIL;
-} /* SzFileSeekImp */
-
-
-/*
- * Translate Microsoft FILETIME (used by 7zip) into UNIX timestamp
- */
-static PHYSFS_sint64 lzma_filetime_to_unix_timestamp(CArchiveFileTime *ft)
-{
-    /* MS counts in nanoseconds ... */
-    const PHYSFS_uint64 FILETIME_NANOTICKS_PER_SECOND = __PHYSFS_UI64(10000000);
-    /* MS likes to count seconds since 01.01.1601 ... */
-    const PHYSFS_uint64 FILETIME_UNIX_DIFF = __PHYSFS_UI64(11644473600);
-
-    PHYSFS_uint64 filetime = ft->Low | ((PHYSFS_uint64)ft->High << 32);
-    return filetime/FILETIME_NANOTICKS_PER_SECOND - FILETIME_UNIX_DIFF;
-} /* lzma_filetime_to_unix_timestamp */
-
-
-/*
- * Compare a file with a given name, C89 stdlib variant
- * Used for sorting
- */
-static int lzma_file_cmp_stdlib(const void *key, const void *object)
-{
-    const char *name = (const char *) key;
-    LZMAfile *file = (LZMAfile *) object;
-    return strcmp(name, file->item->Name);
-} /* lzma_file_cmp_posix */
-
-
-/*
- * Compare two files with each other based on the name
- * Used for sorting
- */
-static int lzma_file_cmp(void *_a, size_t one, size_t two)
-{
-    LZMAfile *files = (LZMAfile *) _a;
-    return strcmp(files[one].item->Name, files[two].item->Name);
-} /* lzma_file_cmp */
-
-
-/*
- * Swap two entries in the file array
- */
-static void lzma_file_swap(void *_a, size_t one, size_t two)
-{
-    LZMAfile tmp;
-    LZMAfile *first = &(((LZMAfile *) _a)[one]);
-    LZMAfile *second = &(((LZMAfile *) _a)[two]);
-    memcpy(&tmp, first, sizeof (LZMAfile));
-    memcpy(first, second, sizeof (LZMAfile));
-    memcpy(second, &tmp, sizeof (LZMAfile));
-} /* lzma_file_swap */
-
-
-/*
- * Find entry 'name' in 'archive'
- */
-static LZMAfile * lzma_find_file(const LZMAarchive *archive, const char *name)
-{
-    LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); /* FIXME: Should become __PHYSFS_search!!! */
-
-    BAIL_IF_MACRO(file == NULL, PHYSFS_ERR_NOT_FOUND, NULL);
-
-    return file;
-} /* lzma_find_file */
-
-
-/*
- * Load metadata for the file at given index
- */
-static int lzma_file_init(LZMAarchive *archive, PHYSFS_uint32 fileIndex)
-{
-    LZMAfile *file = &archive->files[fileIndex];
-    PHYSFS_uint32 folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
-
-    file->index = fileIndex; /* Store index into 7z array, since we sort our own. */
-    file->archive = archive;
-    file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); /* Directories don't have a folder (they contain no own data...) */
-    file->item = &archive->db.Database.Files[fileIndex]; /* Holds crucial data and is often referenced -> Store link */
-    file->position = 0;
-    file->offset = 0; /* Offset will be set by LZMA_read() */
-
-    return 1;
-} /* lzma_load_file */
-
-
-/*
- * Load metadata for all files
- */
-static int lzma_files_init(LZMAarchive *archive)
-{
-    PHYSFS_uint32 fileIndex = 0, numFiles = archive->db.Database.NumFiles;
-
-    for (fileIndex = 0; fileIndex < numFiles; fileIndex++ )
-    {
-        if (!lzma_file_init(archive, fileIndex))
-        {
-            return 0; /* FALSE on failure */
-        }
-    } /* for */
-
-   __PHYSFS_sort(archive->files, (size_t) numFiles, lzma_file_cmp, lzma_file_swap);
-
-    return 1;
-} /* lzma_load_files */
-
-
-/*
- * Initialise specified archive
- */
-static void lzma_archive_init(LZMAarchive *archive)
-{
-    memset(archive, 0, sizeof(*archive));
-
-    /* Prepare callbacks for 7z */
-    archive->stream.inStream.Read = SzFileReadImp;
-    archive->stream.inStream.Seek = SzFileSeekImp;
-
-    archive->stream.allocImp.Alloc = SzAllocPhysicsFS;
-    archive->stream.allocImp.Free = SzFreePhysicsFS;
-
-    archive->stream.allocTempImp.Alloc = SzAllocPhysicsFS;
-    archive->stream.allocTempImp.Free = SzFreePhysicsFS;
-}
-
-
-/*
- * Deinitialise archive
- */
-static void lzma_archive_exit(LZMAarchive *archive)
-{
-    /* Free arrays */
-    allocator.Free(archive->folders);
-    allocator.Free(archive->files);
-    allocator.Free(archive);
-}
-
-/*
- * Wrap all 7z calls in this, so the physfs error state is set appropriately.
- */
-static int lzma_err(SZ_RESULT rc)
-{
-    switch (rc)
-    {
-        case SZ_OK: /* Same as LZMA_RESULT_OK */
-            break;
-        case SZE_DATA_ERROR: /* Same as LZMA_RESULT_DATA_ERROR */
-            PHYSFS_setErrorCode(PHYSFS_ERR_CORRUPT); /*!!!FIXME: was "PHYSFS_ERR_DATA_ERROR" */
-            break;
-        case SZE_OUTOFMEMORY:
-            PHYSFS_setErrorCode(PHYSFS_ERR_OUT_OF_MEMORY);
-            break;
-        case SZE_CRC_ERROR:
-            PHYSFS_setErrorCode(PHYSFS_ERR_CORRUPT);
-            break;
-        case SZE_NOTIMPL:
-            PHYSFS_setErrorCode(PHYSFS_ERR_UNSUPPORTED);
-            break;
-        case SZE_FAIL:
-            PHYSFS_setErrorCode(PHYSFS_ERR_OTHER_ERROR);  /* !!! FIXME: right? */
-            break;
-        case SZE_ARCHIVE_ERROR:
-            PHYSFS_setErrorCode(PHYSFS_ERR_CORRUPT);  /* !!! FIXME: right? */
-            break;
-        default:
-            PHYSFS_setErrorCode(PHYSFS_ERR_OTHER_ERROR);
-    } /* switch */
-
-    return rc;
-} /* lzma_err */
-
-
-static PHYSFS_sint64 LZMA_read(PHYSFS_Io *io, void *outBuf, PHYSFS_uint64 len)
-{
-    LZMAfile *file = (LZMAfile *) io->opaque;
-
-    size_t wantedSize = (size_t) len;
-    const size_t remainingSize = file->item->Size - file->position;
-    size_t fileSize = 0;
-
-    BAIL_IF_MACRO(wantedSize == 0, ERRPASS, 0); /* quick rejection. */
-    BAIL_IF_MACRO(remainingSize == 0, PHYSFS_ERR_PAST_EOF, 0);
-
-    if (wantedSize > remainingSize)
-        wantedSize = remainingSize;
-
-    /* Only decompress the folder if it is not already cached */
-    if (file->folder->cache == NULL)
-    {
-        const int rc = lzma_err(SzExtract(
-            &file->archive->stream.inStream, /* compressed data */
-            &file->archive->db, /* 7z's database, containing everything */
-            file->index, /* Index into database arrays */
-            /* Index of cached folder, will be changed by SzExtract */
-            &file->folder->index,
-            /* Cache for decompressed folder, allocated/freed by SzExtract */
-            &file->folder->cache,
-            /* Size of cache, will be changed by SzExtract */
-            &file->folder->size,
-            /* Offset of this file inside the cache, set by SzExtract */
-            &file->offset,
-            &fileSize, /* Size of this file */
-            &file->archive->stream.allocImp,
-            &file->archive->stream.allocTempImp));
-
-        if (rc != SZ_OK)
-            return -1;
-    } /* if */
-
-    /* Copy wanted bytes over from cache to outBuf */
-    memcpy(outBuf, (file->folder->cache + file->offset + file->position),
-            wantedSize);
-    file->position += wantedSize; /* Increase virtual position */
-
-    return wantedSize;
-} /* LZMA_read */
-
-
-static PHYSFS_sint64 LZMA_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 len)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, -1);
-} /* LZMA_write */
-
-
-static PHYSFS_sint64 LZMA_tell(PHYSFS_Io *io)
-{
-    LZMAfile *file = (LZMAfile *) io->opaque;
-    return file->position;
-} /* LZMA_tell */
-
-
-static int LZMA_seek(PHYSFS_Io *io, PHYSFS_uint64 offset)
-{
-    LZMAfile *file = (LZMAfile *) io->opaque;
-
-    BAIL_IF_MACRO(offset > file->item->Size, PHYSFS_ERR_PAST_EOF, 0);
-
-    file->position = offset; /* We only use a virtual position... */
-
-    return 1;
-} /* LZMA_seek */
-
-
-static PHYSFS_sint64 LZMA_length(PHYSFS_Io *io)
-{
-    const LZMAfile *file = (LZMAfile *) io->opaque;
-    return (file->item->Size);
-} /* LZMA_length */
-
-
-static PHYSFS_Io *LZMA_duplicate(PHYSFS_Io *_io)
-{
-    /* !!! FIXME: this archiver needs to be reworked to allow multiple
-     * !!! FIXME:  opens before we worry about duplication. */
-    BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-} /* LZMA_duplicate */
-
-
-static int LZMA_flush(PHYSFS_Io *io) { return 1;  /* no write support. */ }
-
-
-static void LZMA_destroy(PHYSFS_Io *io)
-{
-    LZMAfile *file = (LZMAfile *) io->opaque;
-
-    if (file->folder != NULL)
-    {
-        /* Only decrease refcount if someone actually requested this file... Prevents from overflows and close-on-open... */
-        if (file->folder->references > 0)
-            file->folder->references--;
-        if (file->folder->references == 0)
-        {
-            /* Free the cache which might have been allocated by LZMA_read() */
-            allocator.Free(file->folder->cache);
-            file->folder->cache = NULL;
-        }
-        /* !!! FIXME: we don't free (file) or (file->folder)?! */
-    } /* if */
-} /* LZMA_destroy */
-
-
-static const PHYSFS_Io LZMA_Io =
-{
-    CURRENT_PHYSFS_IO_API_VERSION, NULL,
-    LZMA_read,
-    LZMA_write,
-    LZMA_seek,
-    LZMA_tell,
-    LZMA_length,
-    LZMA_duplicate,
-    LZMA_flush,
-    LZMA_destroy
-};
-
-
-static void *LZMA_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint8 sig[k7zSignatureSize];
-    size_t len = 0;
-    LZMAarchive *archive = NULL;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-
-    if (io->read(io, sig, k7zSignatureSize) != k7zSignatureSize)
-        return 0;
-    BAIL_IF_MACRO(!TestSignatureCandidate(sig), PHYSFS_ERR_UNSUPPORTED, NULL);
-    BAIL_IF_MACRO(!io->seek(io, 0), ERRPASS, NULL);
-
-    archive = (LZMAarchive *) allocator.Malloc(sizeof (LZMAarchive));
-    BAIL_IF_MACRO(archive == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    lzma_archive_init(archive);
-    archive->stream.io = io;
-
-    CrcGenerateTable();
-    SzArDbExInit(&archive->db);
-    if (lzma_err(SzArchiveOpen(&archive->stream.inStream,
-                               &archive->db,
-                               &archive->stream.allocImp,
-                               &archive->stream.allocTempImp)) != SZ_OK)
-    {
-        SzArDbExFree(&archive->db, SzFreePhysicsFS);
-        lzma_archive_exit(archive);
-        return NULL; /* Error is set by lzma_err! */
-    } /* if */
-
-    len = archive->db.Database.NumFiles * sizeof (LZMAfile);
-    archive->files = (LZMAfile *) allocator.Malloc(len);
-    if (archive->files == NULL)
-    {
-        SzArDbExFree(&archive->db, SzFreePhysicsFS);
-        lzma_archive_exit(archive);
-        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    }
-
-    /*
-     * Init with 0 so we know when a folder is already cached
-     * Values will be set by LZMA_openRead()
-     */
-    memset(archive->files, 0, len);
-
-    len = archive->db.Database.NumFolders * sizeof (LZMAfolder);
-    archive->folders = (LZMAfolder *) allocator.Malloc(len);
-    if (archive->folders == NULL)
-    {
-        SzArDbExFree(&archive->db, SzFreePhysicsFS);
-        lzma_archive_exit(archive);
-        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    }
-
-    /*
-     * Init with 0 so we know when a folder is already cached
-     * Values will be set by LZMA_read()
-     */
-    memset(archive->folders, 0, len);
-
-    if(!lzma_files_init(archive))
-    {
-        SzArDbExFree(&archive->db, SzFreePhysicsFS);
-        lzma_archive_exit(archive);
-        BAIL_MACRO(PHYSFS_ERR_OTHER_ERROR, NULL);
-    }
-
-    return archive;
-} /* LZMA_openArchive */
-
-
-/*
- * Moved to seperate function so we can use alloca then immediately throw
- *  away the allocated stack space...
- */
-static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
-                           const char *odir, const char *str, size_t flen)
-{
-    char *newstr = __PHYSFS_smallAlloc(flen + 1);
-    if (newstr == NULL)
-        return;
-
-    memcpy(newstr, str, flen);
-    newstr[flen] = '\0';
-    cb(callbackdata, odir, newstr);
-    __PHYSFS_smallFree(newstr);
-} /* doEnumCallback */
-
-
-static void LZMA_enumerateFiles(void *opaque, const char *dname,
-                                PHYSFS_EnumFilesCallback cb,
-                                const char *origdir, void *callbackdata)
-{
-    size_t dlen = strlen(dname),
-           dlen_inc = dlen + ((dlen > 0) ? 1 : 0);
-    LZMAarchive *archive = (LZMAarchive *) opaque;
-    LZMAfile *file = NULL,
-            *lastFile = &archive->files[archive->db.Database.NumFiles];
-        if (dlen)
-        {
-            file = lzma_find_file(archive, dname);
-            if (file != NULL) /* if 'file' is NULL it should stay so, otherwise errors will not be handled */
-                file += 1;
-        }
-        else
-        {
-            file = archive->files;
-        }
-
-    BAIL_IF_MACRO(file == NULL, PHYSFS_ERR_NOT_FOUND, );
-
-    while (file < lastFile)
-    {
-        const char * fname = file->item->Name;
-        const char * dirNameEnd = fname + dlen_inc;
-
-        if (strncmp(dname, fname, dlen) != 0) /* Stop after mismatch, archive->files is sorted */
-            break;
-
-        if (strchr(dirNameEnd, '/')) /* Skip subdirs */
-        {
-            file++;
-            continue;
-        }
-
-        /* Do the actual callback... */
-        doEnumCallback(cb, callbackdata, origdir, dirNameEnd, strlen(dirNameEnd));
-
-        file++;
-    }
-} /* LZMA_enumerateFiles */
-
-
-static PHYSFS_Io *LZMA_openRead(void *opaque, const char *name)
-{
-    LZMAarchive *archive = (LZMAarchive *) opaque;
-    LZMAfile *file = lzma_find_file(archive, name);
-    PHYSFS_Io *io = NULL;
-
-    BAIL_IF_MACRO(file == NULL, PHYSFS_ERR_NOT_FOUND, NULL);
-    BAIL_IF_MACRO(file->folder == NULL, PHYSFS_ERR_NOT_A_FILE, NULL);
-
-    file->position = 0;
-    file->folder->references++; /* Increase refcount for automatic cleanup... */
-
-    io = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
-    BAIL_IF_MACRO(io == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    memcpy(io, &LZMA_Io, sizeof (*io));
-    io->opaque = file;
-
-    return io;
-} /* LZMA_openRead */
-
-
-static PHYSFS_Io *LZMA_openWrite(void *opaque, const char *filename)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* LZMA_openWrite */
-
-
-static PHYSFS_Io *LZMA_openAppend(void *opaque, const char *filename)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* LZMA_openAppend */
-
-
-static void LZMA_closeArchive(void *opaque)
-{
-    LZMAarchive *archive = (LZMAarchive *) opaque;
-
-#if 0  /* !!! FIXME: you shouldn't have to do this. */
-    PHYSFS_uint32 fileIndex = 0, numFiles = archive->db.Database.NumFiles;
-    for (fileIndex = 0; fileIndex < numFiles; fileIndex++)
-    {
-        LZMA_fileClose(&archive->files[fileIndex]);
-    } /* for */
-#endif
-
-    SzArDbExFree(&archive->db, SzFreePhysicsFS);
-    archive->stream.io->destroy(archive->stream.io);
-    lzma_archive_exit(archive);
-} /* LZMA_closeArchive */
-
-
-static int LZMA_remove(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* LZMA_remove */
-
-
-static int LZMA_mkdir(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* LZMA_mkdir */
-
-static int LZMA_stat(void *opaque, const char *filename, PHYSFS_Stat *stat)
-{
-    const LZMAarchive *archive = (const LZMAarchive *) opaque;
-    const LZMAfile *file = lzma_find_file(archive, filename);
-
-    if (!file)
-        return 0;
-
-    if(file->item->IsDirectory)
-    {
-        stat->filesize = 0;
-        stat->filetype = PHYSFS_FILETYPE_DIRECTORY;
-    } /* if */
-    else
-    {
-        stat->filesize = (PHYSFS_sint64) file->item->Size;
-        stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    } /* else */
-
-    /* !!! FIXME: the 0's should be -1's? */
-    if (file->item->IsLastWriteTimeDefined)
-        stat->modtime = lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime);
-    else
-        stat->modtime = 0;
-
-    /* real create and accesstype are currently not in the lzma SDK */
-    stat->createtime = stat->modtime;
-    stat->accesstime = 0;
-
-    stat->readonly = 1;  /* 7zips are always read only */
-
-    return 1;
-} /* LZMA_stat */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "7Z",
-        "LZMA (7zip) format",
-        "Dennis Schridde <devurandom@gmx.net>",
-        "https://icculus.org/physfs/",
-        0,  /* supportsSymlinks */
-    },
-    LZMA_openArchive,
-    LZMA_enumerateFiles,
-    LZMA_openRead,
-    LZMA_openWrite,
-    LZMA_openAppend,
-    LZMA_remove,
-    LZMA_mkdir,
-    LZMA_stat,
-    LZMA_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_7Z */
-
-/* end of archiver_lzma.c ... */
-
--- a/misc/libphysfs/archiver_mvl.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * MVL support routines for PhysicsFS.
- *
- * This driver handles Descent II Movielib archives.
- *
- * The file format of MVL is quite easy...
- *
- *   //MVL File format - Written by Heiko Herrmann
- *   char sig[4] = {'D','M', 'V', 'L'}; // "DMVL"=Descent MoVie Library
- *
- *   int num_files; // the number of files in this MVL
- *
- *   struct {
- *    char file_name[13]; // Filename, padded to 13 bytes with 0s
- *    int file_size; // filesize in bytes
- *   }DIR_STRUCT[num_files];
- *
- *   struct {
- *    char data[file_size]; // The file data
- *   }FILE_STRUCT[num_files];
- *
- * (That info is from http://www.descent2.com/ddn/specs/mvl/)
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Bradley Bell.
- *  Based on grp.c by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_MVL
-
-static UNPKentry *mvlLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 fileCount)
-{
-    PHYSFS_uint32 location = 8;  /* sizeof sig. */
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-
-    entries = (UNPKentry *) allocator.Malloc(sizeof (UNPKentry) * fileCount);
-    BAIL_IF_MACRO(entries == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    location += (17 * fileCount);
-
-    for (entry = entries; fileCount > 0; fileCount--, entry++)
-    {
-        if (!__PHYSFS_readAll(io, &entry->name, 13)) goto failed;
-        if (!__PHYSFS_readAll(io, &entry->size, 4)) goto failed;
-        entry->size = PHYSFS_swapULE32(entry->size);
-        entry->startPos = location;
-        location += entry->size;
-    } /* for */
-
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-} /* mvlLoadEntries */
-
-
-static void *MVL_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint8 buf[4];
-    PHYSFS_uint32 count = 0;
-    UNPKentry *entries = NULL;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, 4), ERRPASS, NULL);
-    BAIL_IF_MACRO(memcmp(buf, "DMVL", 4) != 0, PHYSFS_ERR_UNSUPPORTED, NULL);
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &count, sizeof(count)), ERRPASS, NULL);
-
-    count = PHYSFS_swapULE32(count);
-    entries = mvlLoadEntries(io, count);
-    return (!entries) ? NULL : UNPK_openArchive(io, entries, count);
-} /* MVL_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "MVL",
-        "Descent II Movielib format",
-        "Bradley Bell <btb@icculus.org>",
-        "https://icculus.org/physfs/",
-        0,  /* supportsSymlinks */
-    },
-    MVL_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_MVL */
-
-/* end of archiver_mvl.c ... */
-
--- a/misc/libphysfs/archiver_qpak.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * QPAK support routines for PhysicsFS.
- *
- *  This archiver handles the archive format utilized by Quake 1 and 2.
- *  Quake3-based games use the PkZip/Info-Zip format (which our zip.c
- *  archiver handles).
- *
- *  ========================================================================
- *
- *  This format info (in more detail) comes from:
- *     http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt
- *
- *  Quake PAK Format
- *
- *  Header
- *   (4 bytes)  signature = 'PACK'
- *   (4 bytes)  directory offset
- *   (4 bytes)  directory length
- *
- *  Directory
- *   (56 bytes) file name
- *   (4 bytes)  file position
- *   (4 bytes)  file length
- *
- *  ========================================================================
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_QPAK
-
-#define QPAK_SIG 0x4B434150   /* "PACK" in ASCII. */
-
-static UNPKentry *qpakLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 fileCount)
-{
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-
-    entries = (UNPKentry *) allocator.Malloc(sizeof (UNPKentry) * fileCount);
-    BAIL_IF_MACRO(entries == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    for (entry = entries; fileCount > 0; fileCount--, entry++)
-    {
-        if (!__PHYSFS_readAll(io, &entry->name, 56)) goto failed;
-        if (!__PHYSFS_readAll(io, &entry->startPos, 4)) goto failed;
-        if (!__PHYSFS_readAll(io, &entry->size, 4)) goto failed;
-        entry->size = PHYSFS_swapULE32(entry->size);
-        entry->startPos = PHYSFS_swapULE32(entry->startPos);
-    } /* for */
-
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-} /* qpakLoadEntries */
-
-
-static void *QPAK_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    UNPKentry *entries = NULL;
-    PHYSFS_uint32 val = 0;
-    PHYSFS_uint32 pos = 0;
-    PHYSFS_uint32 count = 0;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &val, 4), ERRPASS, NULL);
-    if (PHYSFS_swapULE32(val) != QPAK_SIG)
-        BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &val, 4), ERRPASS, NULL);
-    pos = PHYSFS_swapULE32(val);  /* directory table offset. */
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &val, 4), ERRPASS, NULL);
-    count = PHYSFS_swapULE32(val);
-
-    /* corrupted archive? */
-    BAIL_IF_MACRO((count % 64) != 0, PHYSFS_ERR_CORRUPT, NULL);
-    count /= 64;
-
-    BAIL_IF_MACRO(!io->seek(io, pos), ERRPASS, NULL);
-
-    entries = qpakLoadEntries(io, count);
-    BAIL_IF_MACRO(!entries, ERRPASS, NULL);
-    return UNPK_openArchive(io, entries, count);
-} /* QPAK_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "PAK",
-        "Quake I/II format",
-        "Ryan C. Gordon <icculus@icculus.org>",
-        "https://icculus.org/physfs/",
-        0,  /* supportsSymlinks */
-    },
-    QPAK_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_QPAK */
-
-/* end of archiver_qpak.c ... */
-
--- a/misc/libphysfs/archiver_slb.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * SLB support routines for PhysicsFS.
- *
- * This driver handles SLB archives ("slab files"). This uncompressed format
- * is used in I-War / Independence War and Independence War: Defiance.
- *
- * The format begins with four zero bytes (version?), the file count and the
- * location of the table of contents. Each ToC entry contains a 64-byte buffer
- * containing a zero-terminated filename, the offset of the data, and its size.
- * All the filenames begin with the separator character '\'. 
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Aleksi Nurmi, based on the GRP archiver by
- * Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_SLB
-
-static UNPKentry *slbLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 fileCount)
-{
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-
-    entries = (UNPKentry *) allocator.Malloc(sizeof (UNPKentry) * fileCount);
-    BAIL_IF_MACRO(entries == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    for (entry = entries; fileCount > 0; fileCount--, entry++)
-    {
-        char *ptr;
-
-        /* don't include the '\' in the beginning */
-        char backslash;
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &backslash, 1), ERRPASS, failed);
-        GOTO_IF_MACRO(backslash != '\\', ERRPASS, failed);
-
-        /* read the rest of the buffer, 63 bytes */
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->name, 63), ERRPASS, failed);
-        entry->name[63] = '\0'; /* in case the name lacks the null terminator */
-
-        /* convert backslashes */
-        for (ptr = entry->name; *ptr; ptr++)
-        {
-            if (*ptr == '\\')
-                *ptr = '/';
-        } /* for */
-
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->startPos, 4),
-                      ERRPASS, failed);
-        entry->startPos = PHYSFS_swapULE32(entry->startPos);
-
-        GOTO_IF_MACRO(!__PHYSFS_readAll(io, &entry->size, 4), ERRPASS, failed);
-        entry->size = PHYSFS_swapULE32(entry->size);
-    } /* for */
-    
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-
-} /* slbLoadEntries */
-
-
-static void *SLB_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint32 version;
-    PHYSFS_uint32 count = 0;
-    PHYSFS_uint32 tocPos = 0;
-    UNPKentry *entries = NULL;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &version, sizeof(version)),
-                  ERRPASS, NULL);
-    version = PHYSFS_swapULE32(version);
-    BAIL_IF_MACRO(version != 0, ERRPASS, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &count, sizeof(count)), ERRPASS, NULL);
-    count = PHYSFS_swapULE32(count);
-
-    /* offset of the table of contents */
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &tocPos, sizeof(tocPos)),
-                  ERRPASS, NULL);
-    tocPos = PHYSFS_swapULE32(tocPos);
-    
-    /* seek to the table of contents */
-    BAIL_IF_MACRO(!io->seek(io, tocPos), ERRPASS, NULL);
-
-    entries = slbLoadEntries(io, count);
-    BAIL_IF_MACRO(!entries, ERRPASS, NULL);
-
-    return UNPK_openArchive(io, entries, count);
-} /* SLB_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_SLB =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "SLB",
-        "I-War / Independence War Slab file",
-        "Aleksi Nurmi <aleksi.nurmi@gmail.com>",
-        "https://bitbucket.org/ahnurmi/",
-        0,  /* supportsSymlinks */
-    },
-    SLB_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_SLB */
-
-/* end of archiver_slb.c ... */
-
--- a/misc/libphysfs/archiver_unpacked.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,464 +0,0 @@
-/*
- * High-level PhysicsFS archiver for simple unpacked file formats.
- *
- * This is a framework that basic archivers build on top of. It's for simple
- *  formats that can just hand back a list of files and the offsets of their
- *  uncompressed data. There are an alarming number of formats like this.
- *
- * RULES: Archive entries must be uncompressed, must not have separate subdir
- *  entries (but can have subdirs), must be case insensitive LOW ASCII
- *  filenames <= 64 bytes. No symlinks, etc. We can relax some of these rules
- *  as necessary.
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-typedef struct
-{
-    PHYSFS_Io *io;
-    PHYSFS_uint32 entryCount;
-    UNPKentry *entries;
-} UNPKinfo;
-
-
-typedef struct
-{
-    PHYSFS_Io *io;
-    UNPKentry *entry;
-    PHYSFS_uint32 curPos;
-} UNPKfileinfo;
-
-
-void UNPK_closeArchive(void *opaque)
-{
-    UNPKinfo *info = ((UNPKinfo *) opaque);
-    info->io->destroy(info->io);
-    allocator.Free(info->entries);
-    allocator.Free(info);
-} /* UNPK_closeArchive */
-
-
-static PHYSFS_sint64 UNPK_read(PHYSFS_Io *io, void *buffer, PHYSFS_uint64 len)
-{
-    UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque;
-    const UNPKentry *entry = finfo->entry;
-    const PHYSFS_uint64 bytesLeft = (PHYSFS_uint64)(entry->size-finfo->curPos);
-    PHYSFS_sint64 rc;
-
-    if (bytesLeft < len)
-        len = bytesLeft;
-
-    rc = finfo->io->read(finfo->io, buffer, len);
-    if (rc > 0)
-        finfo->curPos += (PHYSFS_uint32) rc;
-
-    return rc;
-} /* UNPK_read */
-
-
-static PHYSFS_sint64 UNPK_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 len)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, -1);
-} /* UNPK_write */
-
-
-static PHYSFS_sint64 UNPK_tell(PHYSFS_Io *io)
-{
-    return ((UNPKfileinfo *) io->opaque)->curPos;
-} /* UNPK_tell */
-
-
-static int UNPK_seek(PHYSFS_Io *io, PHYSFS_uint64 offset)
-{
-    UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque;
-    const UNPKentry *entry = finfo->entry;
-    int rc;
-
-    BAIL_IF_MACRO(offset >= entry->size, PHYSFS_ERR_PAST_EOF, 0);
-    rc = finfo->io->seek(finfo->io, entry->startPos + offset);
-    if (rc)
-        finfo->curPos = (PHYSFS_uint32) offset;
-
-    return rc;
-} /* UNPK_seek */
-
-
-static PHYSFS_sint64 UNPK_length(PHYSFS_Io *io)
-{
-    const UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque;
-    return ((PHYSFS_sint64) finfo->entry->size);
-} /* UNPK_length */
-
-
-static PHYSFS_Io *UNPK_duplicate(PHYSFS_Io *_io)
-{
-    UNPKfileinfo *origfinfo = (UNPKfileinfo *) _io->opaque;
-    PHYSFS_Io *io = NULL;
-    PHYSFS_Io *retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
-    UNPKfileinfo *finfo = (UNPKfileinfo *) allocator.Malloc(sizeof (UNPKfileinfo));
-    GOTO_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_duplicate_failed);
-    GOTO_IF_MACRO(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_duplicate_failed);
-
-    io = origfinfo->io->duplicate(origfinfo->io);
-    if (!io) goto UNPK_duplicate_failed;
-    finfo->io = io;
-    finfo->entry = origfinfo->entry;
-    finfo->curPos = 0;
-    memcpy(retval, _io, sizeof (PHYSFS_Io));
-    retval->opaque = finfo;
-    return retval;
-
-UNPK_duplicate_failed:
-    if (finfo != NULL) allocator.Free(finfo);
-    if (retval != NULL) allocator.Free(retval);
-    if (io != NULL) io->destroy(io);
-    return NULL;
-} /* UNPK_duplicate */
-
-static int UNPK_flush(PHYSFS_Io *io) { return 1;  /* no write support. */ }
-
-static void UNPK_destroy(PHYSFS_Io *io)
-{
-    UNPKfileinfo *finfo = (UNPKfileinfo *) io->opaque;
-    finfo->io->destroy(finfo->io);
-    allocator.Free(finfo);
-    allocator.Free(io);
-} /* UNPK_destroy */
-
-
-static const PHYSFS_Io UNPK_Io =
-{
-    CURRENT_PHYSFS_IO_API_VERSION, NULL,
-    UNPK_read,
-    UNPK_write,
-    UNPK_seek,
-    UNPK_tell,
-    UNPK_length,
-    UNPK_duplicate,
-    UNPK_flush,
-    UNPK_destroy
-};
-
-
-static int entryCmp(void *_a, size_t one, size_t two)
-{
-    if (one != two)
-    {
-        const UNPKentry *a = (const UNPKentry *) _a;
-        return __PHYSFS_stricmpASCII(a[one].name, a[two].name);
-    } /* if */
-
-    return 0;
-} /* entryCmp */
-
-
-static void entrySwap(void *_a, size_t one, size_t two)
-{
-    if (one != two)
-    {
-        UNPKentry tmp;
-        UNPKentry *first = &(((UNPKentry *) _a)[one]);
-        UNPKentry *second = &(((UNPKentry *) _a)[two]);
-        memcpy(&tmp, first, sizeof (UNPKentry));
-        memcpy(first, second, sizeof (UNPKentry));
-        memcpy(second, &tmp, sizeof (UNPKentry));
-    } /* if */
-} /* entrySwap */
-
-
-static PHYSFS_sint32 findStartOfDir(UNPKinfo *info, const char *path,
-                                    int stop_on_first_find)
-{
-    PHYSFS_sint32 lo = 0;
-    PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
-    PHYSFS_sint32 middle;
-    PHYSFS_uint32 dlen = (PHYSFS_uint32) strlen(path);
-    PHYSFS_sint32 retval = -1;
-    const char *name;
-    int rc;
-
-    if (*path == '\0')  /* root dir? */
-        return 0;
-
-    if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
-        dlen--;
-
-    while (lo <= hi)
-    {
-        middle = lo + ((hi - lo) / 2);
-        name = info->entries[middle].name;
-        rc = __PHYSFS_strnicmpASCII(path, name, dlen);
-        if (rc == 0)
-        {
-            char ch = name[dlen];
-            if (ch < '/') /* make sure this isn't just a substr match. */
-                rc = -1;
-            else if (ch > '/')
-                rc = 1;
-            else 
-            {
-                if (stop_on_first_find) /* Just checking dir's existance? */
-                    return middle;
-
-                if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
-                    return (middle + 1);
-
-                /* there might be more entries earlier in the list. */
-                retval = middle;
-                hi = middle - 1;
-            } /* else */
-        } /* if */
-
-        if (rc > 0)
-            lo = middle + 1;
-        else
-            hi = middle - 1;
-    } /* while */
-
-    return retval;
-} /* findStartOfDir */
-
-
-/*
- * Moved to seperate function so we can use alloca then immediately throw
- *  away the allocated stack space...
- */
-static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
-                           const char *odir, const char *str, PHYSFS_sint32 ln)
-{
-    char *newstr = __PHYSFS_smallAlloc(ln + 1);
-    if (newstr == NULL)
-        return;
-
-    memcpy(newstr, str, ln);
-    newstr[ln] = '\0';
-    cb(callbackdata, odir, newstr);
-    __PHYSFS_smallFree(newstr);
-} /* doEnumCallback */
-
-
-void UNPK_enumerateFiles(void *opaque, const char *dname,
-                         PHYSFS_EnumFilesCallback cb,
-                         const char *origdir, void *callbackdata)
-{
-    UNPKinfo *info = ((UNPKinfo *) opaque);
-    PHYSFS_sint32 dlen, dlen_inc, max, i;
-
-    i = findStartOfDir(info, dname, 0);
-    if (i == -1)  /* no such directory. */
-        return;
-
-    dlen = (PHYSFS_sint32) strlen(dname);
-    if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
-        dlen--;
-
-    dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
-    max = (PHYSFS_sint32) info->entryCount;
-    while (i < max)
-    {
-        char *add;
-        char *ptr;
-        PHYSFS_sint32 ln;
-        char *e = info->entries[i].name;
-        if ((dlen) &&
-            ((__PHYSFS_strnicmpASCII(e, dname, dlen)) || (e[dlen] != '/')))
-        {
-            break;  /* past end of this dir; we're done. */
-        } /* if */
-
-        add = e + dlen_inc;
-        ptr = strchr(add, '/');
-        ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
-        doEnumCallback(cb, callbackdata, origdir, add, ln);
-        ln += dlen_inc;  /* point past entry to children... */
-
-        /* increment counter and skip children of subdirs... */
-        while ((++i < max) && (ptr != NULL))
-        {
-            char *e_new = info->entries[i].name;
-            if ((__PHYSFS_strnicmpASCII(e, e_new, ln) != 0) ||
-                (e_new[ln] != '/'))
-            {
-                break;
-            } /* if */
-        } /* while */
-    } /* while */
-} /* UNPK_enumerateFiles */
-
-
-/*
- * This will find the UNPKentry associated with a path in platform-independent
- *  notation. Directories don't have UNPKentries associated with them, but 
- *  (*isDir) will be set to non-zero if a dir was hit.
- */
-static UNPKentry *findEntry(const UNPKinfo *info, const char *path, int *isDir)
-{
-    UNPKentry *a = info->entries;
-    PHYSFS_sint32 pathlen = (PHYSFS_sint32) strlen(path);
-    PHYSFS_sint32 lo = 0;
-    PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
-    PHYSFS_sint32 middle;
-    const char *thispath = NULL;
-    int rc;
-
-    while (lo <= hi)
-    {
-        middle = lo + ((hi - lo) / 2);
-        thispath = a[middle].name;
-        rc = __PHYSFS_strnicmpASCII(path, thispath, pathlen);
-
-        if (rc > 0)
-            lo = middle + 1;
-
-        else if (rc < 0)
-            hi = middle - 1;
-
-        else /* substring match...might be dir or entry or nothing. */
-        {
-            if (isDir != NULL)
-            {
-                *isDir = (thispath[pathlen] == '/');
-                if (*isDir)
-                    return NULL;
-            } /* if */
-
-            if (thispath[pathlen] == '\0') /* found entry? */
-                return &a[middle];
-            /* adjust search params, try again. */
-            else if (thispath[pathlen] > '/')
-                hi = middle - 1;
-            else
-                lo = middle + 1;
-        } /* if */
-    } /* while */
-
-    if (isDir != NULL)
-        *isDir = 0;
-
-    BAIL_MACRO(PHYSFS_ERR_NOT_FOUND, NULL);
-} /* findEntry */
-
-
-PHYSFS_Io *UNPK_openRead(void *opaque, const char *name)
-{
-    PHYSFS_Io *retval = NULL;
-    UNPKinfo *info = (UNPKinfo *) opaque;
-    UNPKfileinfo *finfo = NULL;
-    int isdir = 0;
-    UNPKentry *entry = findEntry(info, name, &isdir);
-
-    GOTO_IF_MACRO(isdir, PHYSFS_ERR_NOT_A_FILE, UNPK_openRead_failed);
-    GOTO_IF_MACRO(!entry, ERRPASS, UNPK_openRead_failed);
-
-    retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
-    GOTO_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_openRead_failed);
-
-    finfo = (UNPKfileinfo *) allocator.Malloc(sizeof (UNPKfileinfo));
-    GOTO_IF_MACRO(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, UNPK_openRead_failed);
-
-    finfo->io = info->io->duplicate(info->io);
-    GOTO_IF_MACRO(!finfo->io, ERRPASS, UNPK_openRead_failed);
-
-    if (!finfo->io->seek(finfo->io, entry->startPos))
-        goto UNPK_openRead_failed;
-
-    finfo->curPos = 0;
-    finfo->entry = entry;
-
-    memcpy(retval, &UNPK_Io, sizeof (*retval));
-    retval->opaque = finfo;
-    return retval;
-
-UNPK_openRead_failed:
-    if (finfo != NULL)
-    {
-        if (finfo->io != NULL)
-            finfo->io->destroy(finfo->io);
-        allocator.Free(finfo);
-    } /* if */
-
-    if (retval != NULL)
-        allocator.Free(retval);
-
-    return NULL;
-} /* UNPK_openRead */
-
-
-PHYSFS_Io *UNPK_openWrite(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* UNPK_openWrite */
-
-
-PHYSFS_Io *UNPK_openAppend(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* UNPK_openAppend */
-
-
-int UNPK_remove(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* UNPK_remove */
-
-
-int UNPK_mkdir(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* UNPK_mkdir */
-
-
-int UNPK_stat(void *opaque, const char *filename, PHYSFS_Stat *stat)
-{
-    int isDir = 0;
-    const UNPKinfo *info = (const UNPKinfo *) opaque;
-    const UNPKentry *entry = findEntry(info, filename, &isDir);
-
-    if (isDir)
-    {
-        stat->filetype = PHYSFS_FILETYPE_DIRECTORY;
-        stat->filesize = 0;
-    } /* if */
-    else if (entry != NULL)
-    {
-        stat->filetype = PHYSFS_FILETYPE_REGULAR;
-        stat->filesize = entry->size;
-    } /* else if */
-    else
-    {
-        return 0;
-    } /* else */
-
-    stat->modtime = -1;
-    stat->createtime = -1;
-    stat->accesstime = -1;
-    stat->readonly = 1;
-
-    return 1;
-} /* UNPK_stat */
-
-
-void *UNPK_openArchive(PHYSFS_Io *io, UNPKentry *e, const PHYSFS_uint32 num)
-{
-    UNPKinfo *info = (UNPKinfo *) allocator.Malloc(sizeof (UNPKinfo));
-    if (info == NULL)
-    {
-        allocator.Free(e);
-        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
-
-    __PHYSFS_sort(e, (size_t) num, entryCmp, entrySwap);
-    info->io = io;
-    info->entryCount = num;
-    info->entries = e;
-
-    return info;
-} /* UNPK_openArchive */
-
-/* end of archiver_unpacked.c ... */
-
--- a/misc/libphysfs/archiver_wad.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * WAD support routines for PhysicsFS.
- *
- * This driver handles DOOM engine archives ("wads"). 
- * This format (but not this driver) was designed by id Software for use
- *  with the DOOM engine.
- * The specs of the format are from the unofficial doom specs v1.666
- * found here: http://www.gamers.org/dhs/helpdocs/dmsp1666.html
- * The format of the archive: (from the specs)
- *
- *  A WAD file has three parts:
- *  (1) a twelve-byte header
- *  (2) one or more "lumps"
- *  (3) a directory or "info table" that contains the names, offsets, and
- *      sizes of all the lumps in the WAD
- *
- *  The header consists of three four-byte parts:
- *    (a) an ASCII string which must be either "IWAD" or "PWAD"
- *    (b) a 4-byte (long) integer which is the number of lumps in the wad
- *    (c) a long integer which is the file offset to the start of
- *    the directory
- *
- *  The directory has one 16-byte entry for every lump. Each entry consists
- *  of three parts:
- *
- *    (a) a long integer, the file offset to the start of the lump
- *    (b) a long integer, the size of the lump in bytes
- *    (c) an 8-byte ASCII string, the name of the lump, padded with zeros.
- *        For example, the "DEMO1" entry in hexadecimal would be
- *        (44 45 4D 4F 31 00 00 00)
- * 
- * Note that there is no way to tell if an opened WAD archive is a
- *  IWAD or PWAD with this archiver.
- * I couldn't think of a way to provide that information, without being too
- *  hacky.
- * I don't think it's really that important though.
- *
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- * This file written by Travis Wells, based on the GRP archiver by
- *  Ryan C. Gordon.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_WAD
-
-static UNPKentry *wadLoadEntries(PHYSFS_Io *io, PHYSFS_uint32 fileCount)
-{
-    PHYSFS_uint32 directoryOffset;
-    UNPKentry *entries = NULL;
-    UNPKentry *entry = NULL;
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &directoryOffset, 4), ERRPASS, 0);
-    directoryOffset = PHYSFS_swapULE32(directoryOffset);
-
-    BAIL_IF_MACRO(!io->seek(io, directoryOffset), ERRPASS, 0);
-
-    entries = (UNPKentry *) allocator.Malloc(sizeof (UNPKentry) * fileCount);
-    BAIL_IF_MACRO(!entries, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-
-    for (entry = entries; fileCount > 0; fileCount--, entry++)
-    {
-        if (!__PHYSFS_readAll(io, &entry->startPos, 4)) goto failed;
-        if (!__PHYSFS_readAll(io, &entry->size, 4)) goto failed;
-        if (!__PHYSFS_readAll(io, &entry->name, 8)) goto failed;
-
-        entry->name[8] = '\0'; /* name might not be null-terminated in file. */
-        entry->size = PHYSFS_swapULE32(entry->size);
-        entry->startPos = PHYSFS_swapULE32(entry->startPos);
-    } /* for */
-
-    return entries;
-
-failed:
-    allocator.Free(entries);
-    return NULL;
-} /* wadLoadEntries */
-
-
-static void *WAD_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    PHYSFS_uint8 buf[4];
-    UNPKentry *entries = NULL;
-    PHYSFS_uint32 count = 0;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, sizeof (buf)), ERRPASS, NULL);
-    if ((memcmp(buf, "IWAD", 4) != 0) && (memcmp(buf, "PWAD", 4) != 0))
-        BAIL_MACRO(PHYSFS_ERR_UNSUPPORTED, NULL);
-
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &count, sizeof (count)), ERRPASS, NULL);
-    count = PHYSFS_swapULE32(count);
-
-    entries = wadLoadEntries(io, count);
-    BAIL_IF_MACRO(!entries, ERRPASS, NULL);
-    return UNPK_openArchive(io, entries, count);
-} /* WAD_openArchive */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "WAD",
-        "DOOM engine format",
-        "Travis Wells <traviswells@mchsi.com>",
-        "http://www.3dmm2.com/doom/",
-        0,  /* supportsSymlinks */
-    },
-    WAD_openArchive,
-    UNPK_enumerateFiles,
-    UNPK_openRead,
-    UNPK_openWrite,
-    UNPK_openAppend,
-    UNPK_remove,
-    UNPK_mkdir,
-    UNPK_stat,
-    UNPK_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_WAD */
-
-/* end of archiver_wad.c ... */
-
--- a/misc/libphysfs/archiver_zip.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1875 +0,0 @@
-/*
- * ZIP support routines for PhysicsFS.
- *
- * Please see the file LICENSE.txt in the source's root directory.
- *
- *  This file written by Ryan C. Gordon, with some peeking at "unzip.c"
- *   by Gilles Vollant.
- */
-
-#define __PHYSICSFS_INTERNAL__
-#include "physfs_internal.h"
-
-#if PHYSFS_SUPPORTS_ZIP
-
-#include <errno.h>
-#include <time.h>
-
-#include "physfs_miniz.h"
-
-/*
- * A buffer of ZIP_READBUFSIZE is allocated for each compressed file opened,
- *  and is freed when you close the file; compressed data is read into
- *  this buffer, and then is decompressed into the buffer passed to
- *  PHYSFS_read().
- *
- * Uncompressed entries in a zipfile do not allocate this buffer; they just
- *  read data directly into the buffer passed to PHYSFS_read().
- *
- * Depending on your speed and memory requirements, you should tweak this
- *  value.
- */
-#define ZIP_READBUFSIZE   (16 * 1024)
-
-
-/*
- * Entries are "unresolved" until they are first opened. At that time,
- *  local file headers parsed/validated, data offsets will be updated to look
- *  at the actual file data instead of the header, and symlinks will be
- *  followed and optimized. This means that we don't seek and read around the
- *  archive until forced to do so, and after the first time, we had to do
- *  less reading and parsing, which is very CD-ROM friendly.
- */
-typedef enum
-{
-    ZIP_UNRESOLVED_FILE,
-    ZIP_UNRESOLVED_SYMLINK,
-    ZIP_RESOLVING,
-    ZIP_RESOLVED,
-    ZIP_DIRECTORY,
-    ZIP_BROKEN_FILE,
-    ZIP_BROKEN_SYMLINK
-} ZipResolveType;
-
-
-/*
- * One ZIPentry is kept for each file in an open ZIP archive.
- */
-typedef struct _ZIPentry
-{
-    char *name;                         /* Name of file in archive        */
-    struct _ZIPentry *symlink;          /* NULL or file we symlink to     */
-    ZipResolveType resolved;            /* Have we resolved file/symlink? */
-    PHYSFS_uint64 offset;               /* offset of data in archive      */
-    PHYSFS_uint16 version;              /* version made by                */
-    PHYSFS_uint16 version_needed;       /* version needed to extract      */
-    PHYSFS_uint16 general_bits;         /* general purpose bits           */
-    PHYSFS_uint16 compression_method;   /* compression method             */
-    PHYSFS_uint32 crc;                  /* crc-32                         */
-    PHYSFS_uint64 compressed_size;      /* compressed size                */
-    PHYSFS_uint64 uncompressed_size;    /* uncompressed size              */
-    PHYSFS_sint64 last_mod_time;        /* last file mod time             */
-    PHYSFS_uint32 dos_mod_time;         /* original MS-DOS style mod time */
-    struct _ZIPentry *hashnext;         /* next item in this hash bucket  */
-    struct _ZIPentry *children;         /* linked list of kids, if dir    */
-    struct _ZIPentry *sibling;          /* next item in same dir          */
-} ZIPentry;
-
-/*
- * One ZIPinfo is kept for each open ZIP archive.
- */
-typedef struct
-{
-    PHYSFS_Io *io;            /* the i/o interface for this archive.    */
-    ZIPentry root;            /* root of directory tree.                */
-    ZIPentry **hash;          /* all entries hashed for fast lookup.    */
-    size_t hashBuckets;       /* number of buckets in hash.             */
-    int zip64;                /* non-zero if this is a Zip64 archive.   */
-    int has_crypto;           /* non-zero if any entry uses encryption. */
-} ZIPinfo;
-
-/*
- * One ZIPfileinfo is kept for each open file in a ZIP archive.
- */
-typedef struct
-{
-    ZIPentry *entry;                      /* Info on file.              */
-    PHYSFS_Io *io;                        /* physical file handle.      */
-    PHYSFS_uint32 compressed_position;    /* offset in compressed data. */
-    PHYSFS_uint32 uncompressed_position;  /* tell() position.           */
-    PHYSFS_uint8 *buffer;                 /* decompression buffer.      */
-    PHYSFS_uint32 crypto_keys[3];         /* for "traditional" crypto.  */
-    PHYSFS_uint32 initial_crypto_keys[3]; /* for "traditional" crypto.  */
-    z_stream stream;                      /* zlib stream state.         */
-} ZIPfileinfo;
-
-
-/* Magic numbers... */
-#define ZIP_LOCAL_FILE_SIG                          0x04034b50
-#define ZIP_CENTRAL_DIR_SIG                         0x02014b50
-#define ZIP_END_OF_CENTRAL_DIR_SIG                  0x06054b50
-#define ZIP64_END_OF_CENTRAL_DIR_SIG                0x06064b50
-#define ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIG  0x07064b50
-#define ZIP64_EXTENDED_INFO_EXTRA_FIELD_SIG         0x0001
-
-/* compression methods... */
-#define COMPMETH_NONE 0
-/* ...and others... */
-
-
-#define UNIX_FILETYPE_MASK    0170000
-#define UNIX_FILETYPE_SYMLINK 0120000
-
-#define ZIP_GENERAL_BITS_TRADITIONAL_CRYPTO   (1 << 0)
-#define ZIP_GENERAL_BITS_IGNORE_LOCAL_HEADER  (1 << 3)
-
-/* support for "traditional" PKWARE encryption. */
-static int zip_entry_is_tradional_crypto(const ZIPentry *entry)
-{
-    return (entry->general_bits & ZIP_GENERAL_BITS_TRADITIONAL_CRYPTO) != 0;
-} /* zip_entry_is_traditional_crypto */
-
-static int zip_entry_ignore_local_header(const ZIPentry *entry)
-{
-    return (entry->general_bits & ZIP_GENERAL_BITS_IGNORE_LOCAL_HEADER) != 0;
-} /* zip_entry_is_traditional_crypto */
-
-static PHYSFS_uint32 zip_crypto_crc32(const PHYSFS_uint32 crc, const PHYSFS_uint8 val)
-{
-    int i;
-    PHYSFS_uint32 xorval = (crc ^ ((PHYSFS_uint32) val)) & 0xFF;
-    for (i = 0; i < 8; i++)
-        xorval = ((xorval & 1) ? (0xEDB88320 ^ (xorval >> 1)) : (xorval >> 1));
-    return xorval ^ (crc >> 8);
-} /* zip_crc32 */
-
-static void zip_update_crypto_keys(PHYSFS_uint32 *keys, const PHYSFS_uint8 val)
-{
-    keys[0] = zip_crypto_crc32(keys[0], val);
-    keys[1] = keys[1] + (keys[0] & 0x000000FF);
-    keys[1] = (keys[1] * 134775813) + 1;
-    keys[2] = zip_crypto_crc32(keys[2], (PHYSFS_uint8) ((keys[1] >> 24) & 0xFF));
-} /* zip_update_crypto_keys */
-
-static PHYSFS_uint8 zip_decrypt_byte(const PHYSFS_uint32 *keys)
-{
-    const PHYSFS_uint16 tmp = keys[2] | 2;
-    return (PHYSFS_uint8) ((tmp * (tmp ^ 1)) >> 8);
-} /* zip_decrypt_byte */
-
-static PHYSFS_sint64 zip_read_decrypt(ZIPfileinfo *finfo, void *buf, PHYSFS_uint64 len)
-{
-    PHYSFS_Io *io = finfo->io;
-    const PHYSFS_sint64 br = io->read(io, buf, len);
-
-    /* Decompression the new data if necessary. */
-    if (zip_entry_is_tradional_crypto(finfo->entry) && (br > 0))
-    {
-        PHYSFS_uint32 *keys = finfo->crypto_keys;
-        PHYSFS_uint8 *ptr = (PHYSFS_uint8 *) buf;
-        PHYSFS_sint64 i;
-        for (i = 0; i < br; i++, ptr++)
-        {
-            const PHYSFS_uint8 ch = *ptr ^ zip_decrypt_byte(keys);
-            zip_update_crypto_keys(keys, ch);
-            *ptr = ch;
-        } /* for */
-    } /* if  */
-
-    return br;
-} /* zip_read_decrypt */
-
-static int zip_prep_crypto_keys(ZIPfileinfo *finfo, const PHYSFS_uint8 *crypto_header, const PHYSFS_uint8 *password)
-{
-    /* It doesn't appear to be documented in PKWare's APPNOTE.TXT, but you
-       need to use a different byte in the header to verify the password
-       if general purpose bit 3 is set. Discovered this from Info-Zip.
-       That's what the (verifier) value is doing, below. */
-
-    PHYSFS_uint32 *keys = finfo->crypto_keys;
-    const ZIPentry *entry = finfo->entry;
-    const int usedate = zip_entry_ignore_local_header(entry);
-    const PHYSFS_uint8 verifier = (PHYSFS_uint8) ((usedate ? (entry->dos_mod_time >> 8) : (entry->crc >> 24)) & 0xFF);
-    PHYSFS_uint8 finalbyte = 0;
-    int i = 0;
-
-    /* initialize vector with defaults, then password, then header. */
-    keys[0] = 305419896;
-    keys[1] = 591751049;
-    keys[2] = 878082192;
-
-    while (*password)
-        zip_update_crypto_keys(keys, *(password++));
-
-    for (i = 0; i < 12; i++)
-    {
-        const PHYSFS_uint8 c = crypto_header[i] ^ zip_decrypt_byte(keys);
-        zip_update_crypto_keys(keys, c);
-        finalbyte = c;
-    } /* for */
-
-    /* you have a 1/256 chance of passing this test incorrectly. :/ */
-    if (finalbyte != verifier)
-        BAIL_MACRO(PHYSFS_ERR_BAD_PASSWORD, 0);
-
-    /* save the initial vector for seeking purposes. Not secure!! */
-    memcpy(finfo->initial_crypto_keys, finfo->crypto_keys, 12);
-    return 1;
-} /* zip_prep_crypto_keys */
-
-
-/*
- * Bridge physfs allocation functions to zlib's format...
- */
-static voidpf zlibPhysfsAlloc(voidpf opaque, uInt items, uInt size)
-{
-    return ((PHYSFS_Allocator *) opaque)->Malloc(items * size);
-} /* zlibPhysfsAlloc */
-
-/*
- * Bridge physfs allocation functions to zlib's format...
- */
-static void zlibPhysfsFree(voidpf opaque, voidpf address)
-{
-    ((PHYSFS_Allocator *) opaque)->Free(address);
-} /* zlibPhysfsFree */
-
-
-/*
- * Construct a new z_stream to a sane state.
- */
-static void initializeZStream(z_stream *pstr)
-{
-    memset(pstr, '\0', sizeof (z_stream));
-    pstr->zalloc = zlibPhysfsAlloc;
-    pstr->zfree = zlibPhysfsFree;
-    pstr->opaque = &allocator;
-} /* initializeZStream */
-
-
-static PHYSFS_ErrorCode zlib_error_code(int rc)
-{
-    switch (rc)
-    {
-        case Z_OK: return PHYSFS_ERR_OK;  /* not an error. */
-        case Z_STREAM_END: return PHYSFS_ERR_OK; /* not an error. */
-        case Z_ERRNO: return PHYSFS_ERR_IO;
-        case Z_MEM_ERROR: return PHYSFS_ERR_OUT_OF_MEMORY;
-        default: return PHYSFS_ERR_CORRUPT;
-    } /* switch */
-} /* zlib_error_string */
-
-
-/*
- * Wrap all zlib calls in this, so the physfs error state is set appropriately.
- */
-static int zlib_err(const int rc)
-{
-    PHYSFS_setErrorCode(zlib_error_code(rc));
-    return rc;
-} /* zlib_err */
-
-/*
- * Hash a string for lookup an a ZIPinfo hashtable.
- */
-static inline PHYSFS_uint32 zip_hash_string(const ZIPinfo *info, const char *s)
-{
-    return __PHYSFS_hashString(s, strlen(s)) % info->hashBuckets;
-} /* zip_hash_string */
-
-/*
- * Read an unsigned 64-bit int and swap to native byte order.
- */
-static int readui64(PHYSFS_Io *io, PHYSFS_uint64 *val)
-{
-    PHYSFS_uint64 v;
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &v, sizeof (v)), ERRPASS, 0);
-    *val = PHYSFS_swapULE64(v);
-    return 1;
-} /* readui64 */
-
-/*
- * Read an unsigned 32-bit int and swap to native byte order.
- */
-static int readui32(PHYSFS_Io *io, PHYSFS_uint32 *val)
-{
-    PHYSFS_uint32 v;
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &v, sizeof (v)), ERRPASS, 0);
-    *val = PHYSFS_swapULE32(v);
-    return 1;
-} /* readui32 */
-
-
-/*
- * Read an unsigned 16-bit int and swap to native byte order.
- */
-static int readui16(PHYSFS_Io *io, PHYSFS_uint16 *val)
-{
-    PHYSFS_uint16 v;
-    BAIL_IF_MACRO(!__PHYSFS_readAll(io, &v, sizeof (v)), ERRPASS, 0);
-    *val = PHYSFS_swapULE16(v);
-    return 1;
-} /* readui16 */
-
-
-static PHYSFS_sint64 ZIP_read(PHYSFS_Io *_io, void *buf, PHYSFS_uint64 len)
-{
-    ZIPfileinfo *finfo = (ZIPfileinfo *) _io->opaque;
-    ZIPentry *entry = finfo->entry;
-    PHYSFS_sint64 retval = 0;
-    PHYSFS_sint64 maxread = (PHYSFS_sint64) len;
-    PHYSFS_sint64 avail = entry->uncompressed_size -
-                          finfo->uncompressed_position;
-
-    if (avail < maxread)
-        maxread = avail;
-
-    BAIL_IF_MACRO(maxread == 0, ERRPASS, 0);    /* quick rejection. */
-
-    if (entry->compression_method == COMPMETH_NONE)
-        retval = zip_read_decrypt(finfo, buf, maxread);
-    else
-    {
-        finfo->stream.next_out = buf;
-        finfo->stream.avail_out = (uInt) maxread;
-
-        while (retval < maxread)
-        {
-            PHYSFS_uint32 before = finfo->stream.total_out;
-            int rc;
-
-            if (finfo->stream.avail_in == 0)
-            {
-                PHYSFS_sint64 br;
-
-                br = entry->compressed_size - finfo->compressed_position;
-                if (br > 0)
-                {
-                    if (br > ZIP_READBUFSIZE)
-                        br = ZIP_READBUFSIZE;
-
-                    br = zip_read_decrypt(finfo, finfo->buffer, (PHYSFS_uint64) br);
-                    if (br <= 0)
-                        break;
-
-                    finfo->compressed_position += (PHYSFS_uint32) br;
-                    finfo->stream.next_in = finfo->buffer;
-                    finfo->stream.avail_in = (PHYSFS_uint32) br;
-                } /* if */
-            } /* if */
-
-            rc = zlib_err(inflate(&finfo->stream, Z_SYNC_FLUSH));
-            retval += (finfo->stream.total_out - before);
-
-            if (rc != Z_OK)
-                break;
-        } /* while */
-    } /* else */
-
-    if (retval > 0)
-        finfo->uncompressed_position += (PHYSFS_uint32) retval;
-
-    return retval;
-} /* ZIP_read */
-
-
-static PHYSFS_sint64 ZIP_write(PHYSFS_Io *io, const void *b, PHYSFS_uint64 len)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, -1);
-} /* ZIP_write */
-
-
-static PHYSFS_sint64 ZIP_tell(PHYSFS_Io *io)
-{
-    return ((ZIPfileinfo *) io->opaque)->uncompressed_position;
-} /* ZIP_tell */
-
-
-static int ZIP_seek(PHYSFS_Io *_io, PHYSFS_uint64 offset)
-{
-    ZIPfileinfo *finfo = (ZIPfileinfo *) _io->opaque;
-    ZIPentry *entry = finfo->entry;
-    PHYSFS_Io *io = finfo->io;
-    const int encrypted = zip_entry_is_tradional_crypto(entry);
-
-    BAIL_IF_MACRO(offset > entry->uncompressed_size, PHYSFS_ERR_PAST_EOF, 0);
-
-    if (!encrypted && (entry->compression_method == COMPMETH_NONE))
-    {
-        PHYSFS_sint64 newpos = offset + entry->offset;
-        BAIL_IF_MACRO(!io->seek(io, newpos), ERRPASS, 0);
-        finfo->uncompressed_position = (PHYSFS_uint32) offset;
-    } /* if */
-
-    else
-    {
-        /*
-         * If seeking backwards, we need to redecode the file
-         *  from the start and throw away the compressed bits until we hit
-         *  the offset we need. If seeking forward, we still need to
-         *  decode, but we don't rewind first.
-         */
-        if (offset < finfo->uncompressed_position)
-        {
-            /* we do a copy so state is sane if inflateInit2() fails. */
-            z_stream str;
-            initializeZStream(&str);
-            if (zlib_err(inflateInit2(&str, -MAX_WBITS)) != Z_OK)
-                return 0;
-
-            if (!io->seek(io, entry->offset + (encrypted ? 12 : 0)))
-                return 0;
-
-            inflateEnd(&finfo->stream);
-            memcpy(&finfo->stream, &str, sizeof (z_stream));
-            finfo->uncompressed_position = finfo->compressed_position = 0;
-
-            if (encrypted)
-                memcpy(finfo->crypto_keys, finfo->initial_crypto_keys, 12);
-        } /* if */
-
-        while (finfo->uncompressed_position != offset)
-        {
-            PHYSFS_uint8 buf[512];
-            PHYSFS_uint32 maxread;
-
-            maxread = (PHYSFS_uint32) (offset - finfo->uncompressed_position);
-            if (maxread > sizeof (buf))
-                maxread = sizeof (buf);
-
-            if (ZIP_read(_io, buf, maxread) != maxread)
-                return 0;
-        } /* while */
-    } /* else */
-
-    return 1;
-} /* ZIP_seek */
-
-
-static PHYSFS_sint64 ZIP_length(PHYSFS_Io *io)
-{
-    const ZIPfileinfo *finfo = (ZIPfileinfo *) io->opaque;
-    return (PHYSFS_sint64) finfo->entry->uncompressed_size;
-} /* ZIP_length */
-
-
-static PHYSFS_Io *zip_get_io(PHYSFS_Io *io, ZIPinfo *inf, ZIPentry *entry);
-
-static PHYSFS_Io *ZIP_duplicate(PHYSFS_Io *io)
-{
-    ZIPfileinfo *origfinfo = (ZIPfileinfo *) io->opaque;
-    PHYSFS_Io *retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
-    ZIPfileinfo *finfo = (ZIPfileinfo *) allocator.Malloc(sizeof (ZIPfileinfo));
-    GOTO_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, failed);
-    GOTO_IF_MACRO(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, failed);
-    memset(finfo, '\0', sizeof (*finfo));
-
-    finfo->entry = origfinfo->entry;
-    finfo->io = zip_get_io(origfinfo->io, NULL, finfo->entry);
-    GOTO_IF_MACRO(!finfo->io, ERRPASS, failed);
-
-	initializeZStream(&finfo->stream);
-    if (finfo->entry->compression_method != COMPMETH_NONE)
-    {
-        finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE);
-        GOTO_IF_MACRO(!finfo->buffer, PHYSFS_ERR_OUT_OF_MEMORY, failed);
-        if (zlib_err(inflateInit2(&finfo->stream, -MAX_WBITS)) != Z_OK)
-            goto failed;
-    } /* if */
-
-    memcpy(retval, io, sizeof (PHYSFS_Io));
-    retval->opaque = finfo;
-    return retval;
-
-failed:
-    if (finfo != NULL)
-    {
-        if (finfo->io != NULL)
-            finfo->io->destroy(finfo->io);
-
-        if (finfo->buffer != NULL)
-        {
-            allocator.Free(finfo->buffer);
-            inflateEnd(&finfo->stream);
-        } /* if */
-
-        allocator.Free(finfo);
-    } /* if */
-
-    if (retval != NULL)
-        allocator.Free(retval);
-
-    return NULL;
-} /* ZIP_duplicate */
-
-static int ZIP_flush(PHYSFS_Io *io) { return 1;  /* no write support. */ }
-
-static void ZIP_destroy(PHYSFS_Io *io)
-{
-    ZIPfileinfo *finfo = (ZIPfileinfo *) io->opaque;
-    finfo->io->destroy(finfo->io);
-
-    if (finfo->entry->compression_method != COMPMETH_NONE)
-        inflateEnd(&finfo->stream);
-
-    if (finfo->buffer != NULL)
-        allocator.Free(finfo->buffer);
-
-    allocator.Free(finfo);
-    allocator.Free(io);
-} /* ZIP_destroy */
-
-
-static const PHYSFS_Io ZIP_Io =
-{
-    CURRENT_PHYSFS_IO_API_VERSION, NULL,
-    ZIP_read,
-    ZIP_write,
-    ZIP_seek,
-    ZIP_tell,
-    ZIP_length,
-    ZIP_duplicate,
-    ZIP_flush,
-    ZIP_destroy
-};
-
-
-
-static PHYSFS_sint64 zip_find_end_of_central_dir(PHYSFS_Io *io, PHYSFS_sint64 *len)
-{
-    PHYSFS_uint8 buf[256];
-    PHYSFS_uint8 extra[4] = { 0, 0, 0, 0 };
-    PHYSFS_sint32 i = 0;
-    PHYSFS_sint64 filelen;
-    PHYSFS_sint64 filepos;
-    PHYSFS_sint32 maxread;
-    PHYSFS_sint32 totalread = 0;
-    int found = 0;
-
-    filelen = io->length(io);
-    BAIL_IF_MACRO(filelen == -1, ERRPASS, -1);
-
-    /*
-     * Jump to the end of the file and start reading backwards.
-     *  The last thing in the file is the zipfile comment, which is variable
-     *  length, and the field that specifies its size is before it in the
-     *  file (argh!)...this means that we need to scan backwards until we
-     *  hit the end-of-central-dir signature. We can then sanity check that
-     *  the comment was as big as it should be to make sure we're in the
-     *  right place. The comment length field is 16 bits, so we can stop
-     *  searching for that signature after a little more than 64k at most,
-     *  and call it a corrupted zipfile.
-     */
-
-    if (sizeof (buf) < filelen)
-    {
-        filepos = filelen - sizeof (buf);
-        maxread = sizeof (buf);
-    } /* if */
-    else
-    {
-        filepos = 0;
-        maxread = (PHYSFS_uint32) filelen;
-    } /* else */
-
-    while ((totalread < filelen) && (totalread < 65557))
-    {
-        BAIL_IF_MACRO(!io->seek(io, filepos), ERRPASS, -1);
-
-        /* make sure we catch a signature between buffers. */
-        if (totalread != 0)
-        {
-            if (!__PHYSFS_readAll(io, buf, maxread - 4))
-                return -1;
-            memcpy(&buf[maxread - 4], &extra, sizeof (extra));
-            totalread += maxread - 4;
-        } /* if */
-        else
-        {
-            if (!__PHYSFS_readAll(io, buf, maxread))
-                return -1;
-            totalread += maxread;
-        } /* else */
-
-        memcpy(&extra, buf, sizeof (extra));
-
-        for (i = maxread - 4; i > 0; i--)
-        {
-            if ((buf[i + 0] == 0x50) &&
-                (buf[i + 1] == 0x4B) &&
-                (buf[i + 2] == 0x05) &&
-                (buf[i + 3] == 0x06) )
-            {
-                found = 1;  /* that's the signature! */
-                break;  
-            } /* if */
-        } /* for */
-
-        if (found)
-            break;
-
-        filepos -= (maxread - 4);
-        if (filepos < 0)
-            filepos = 0;
-    } /* while */
-
-    BAIL_IF_MACRO(!found, PHYSFS_ERR_UNSUPPORTED, -1);
-
-    if (len != NULL)
-        *len = filelen;
-
-    return (filepos + i);
-} /* zip_find_end_of_central_dir */
-
-
-static int isZip(PHYSFS_Io *io)
-{
-    PHYSFS_uint32 sig = 0;
-    int retval = 0;
-
-    /*
-     * The first thing in a zip file might be the signature of the
-     *  first local file record, so it makes for a quick determination.
-     */
-    if (readui32(io, &sig))
-    {
-        retval = (sig == ZIP_LOCAL_FILE_SIG);
-        if (!retval)
-        {
-            /*
-             * No sig...might be a ZIP with data at the start
-             *  (a self-extracting executable, etc), so we'll have to do
-             *  it the hard way...
-             */
-            retval = (zip_find_end_of_central_dir(io, NULL) != -1);
-        } /* if */
-    } /* if */
-
-    return retval;
-} /* isZip */
-
-
-/* Find the ZIPentry for a path in platform-independent notation. */
-static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path)
-{
-    PHYSFS_uint32 hashval;
-    ZIPentry *prev = NULL;
-    ZIPentry *retval;
-
-    if (*path == '\0')
-        return &info->root;
-
-    hashval = zip_hash_string(info, path);
-    for (retval = info->hash[hashval]; retval; retval = retval->hashnext)
-    {
-        if (strcmp(retval->name, path) == 0)
-        {
-            if (prev != NULL)  /* move this to the front of the list */
-            {
-                prev->hashnext = retval->hashnext;
-                retval->hashnext = info->hash[hashval];
-                info->hash[hashval] = retval;
-            } /* if */
-
-            return retval;
-        } /* if */
-
-        prev = retval;
-    } /* for */
-
-    BAIL_MACRO(PHYSFS_ERR_NOT_FOUND, NULL);
-} /* zip_find_entry */
-
-
-/* Convert paths from old, buggy DOS zippers... */
-static void zip_convert_dos_path(ZIPentry *entry, char *path)
-{
-    PHYSFS_uint8 hosttype = (PHYSFS_uint8) ((entry->version >> 8) & 0xFF);
-    if (hosttype == 0)  /* FS_FAT_ */
-    {
-        while (*path)
-        {
-            if (*path == '\\')
-                *path = '/';
-            path++;
-        } /* while */
-    } /* if */
-} /* zip_convert_dos_path */
-
-
-static void zip_expand_symlink_path(char *path)
-{
-    char *ptr = path;
-    char *prevptr = path;
-
-    while (1)
-    {
-        ptr = strchr(ptr, '/');
-        if (ptr == NULL)
-            break;
-
-        if (*(ptr + 1) == '.')
-        {
-            if (*(ptr + 2) == '/')
-            {
-                /* current dir in middle of string: ditch it. */
-                memmove(ptr, ptr + 2, strlen(ptr + 2) + 1);
-            } /* else if */
-
-            else if (*(ptr + 2) == '\0')
-            {
-                /* current dir at end of string: ditch it. */
-                *ptr = '\0';
-            } /* else if */
-
-            else if (*(ptr + 2) == '.')
-            {
-                if (*(ptr + 3) == '/')
-                {
-                    /* parent dir in middle: move back one, if possible. */
-                    memmove(prevptr, ptr + 4, strlen(ptr + 4) + 1);
-                    ptr = prevptr;
-                    while (prevptr != path)
-                    {
-                        prevptr--;
-                        if (*prevptr == '/')
-                        {
-                            prevptr++;
-                            break;
-                        } /* if */
-                    } /* while */
-                } /* if */
-
-                if (*(ptr + 3) == '\0')
-                {
-                    /* parent dir at end: move back one, if possible. */
-                    *prevptr = '\0';
-                } /* if */
-            } /* if */
-        } /* if */
-        else
-        {
-            prevptr = ptr;
-            ptr++;
-        } /* else */
-    } /* while */
-} /* zip_expand_symlink_path */
-
-/* (forward reference: zip_follow_symlink and zip_resolve call each other.) */
-static int zip_resolve(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry);
-
-/*
- * Look for the entry named by (path). If it exists, resolve it, and return
- *  a pointer to that entry. If it's another symlink, keep resolving until you
- *  hit a real file and then return a pointer to the final non-symlink entry.
- *  If there's a problem, return NULL.
- */
-static ZIPentry *zip_follow_symlink(PHYSFS_Io *io, ZIPinfo *info, char *path)
-{
-    ZIPentry *entry;
-
-    zip_expand_symlink_path(path);
-    entry = zip_find_entry(info, path);
-    if (entry != NULL)
-    {
-        if (!zip_resolve(io, info, entry))  /* recursive! */
-            entry = NULL;
-        else
-        {
-            if (entry->symlink != NULL)
-                entry = entry->symlink;
-        } /* else */
-    } /* if */
-
-    return entry;
-} /* zip_follow_symlink */
-
-
-static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
-{
-    const PHYSFS_uint64 size = entry->uncompressed_size;
-    char *path = NULL;
-    int rc = 0;
-
-    /*
-     * We've already parsed the local file header of the symlink at this
-     *  point. Now we need to read the actual link from the file data and
-     *  follow it.
-     */
-
-    BAIL_IF_MACRO(!io->seek(io, entry->offset), ERRPASS, 0);
-
-    path = (char *) __PHYSFS_smallAlloc(size + 1);
-    BAIL_IF_MACRO(!path, PHYSFS_ERR_OUT_OF_MEMORY, 0);
-    
-    if (entry->compression_method == COMPMETH_NONE)
-        rc = __PHYSFS_readAll(io, path, size);
-
-    else  /* symlink target path is compressed... */
-    {
-        z_stream stream;
-        const PHYSFS_uint64 complen = entry->compressed_size;
-        PHYSFS_uint8 *compressed = (PHYSFS_uint8*) __PHYSFS_smallAlloc(complen);
-        if (compressed != NULL)
-        {
-            if (__PHYSFS_readAll(io, compressed, complen))
-            {
-                initializeZStream(&stream);
-                stream.next_in = compressed;
-                stream.avail_in = complen;
-                stream.next_out = (unsigned char *) path;
-                stream.avail_out = size;
-                if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
-                {
-                    rc = zlib_err(inflate(&stream, Z_FINISH));
-                    inflateEnd(&stream);
-
-                    /* both are acceptable outcomes... */
-                    rc = ((rc == Z_OK) || (rc == Z_STREAM_END));
-                } /* if */
-            } /* if */
-            __PHYSFS_smallFree(compressed);
-        } /* if */
-    } /* else */
-
-    if (rc)
-    {
-        path[entry->uncompressed_size] = '\0';    /* null-terminate it. */
-        zip_convert_dos_path(entry, path);
-        entry->symlink = zip_follow_symlink(io, info, path);
-    } /* else */
-
-    __PHYSFS_smallFree(path);
-
-    return (entry->symlink != NULL);
-} /* zip_resolve_symlink */
-
-
-/*
- * Parse the local file header of an entry, and update entry->offset.
- */
-static int zip_parse_local(PHYSFS_Io *io, ZIPentry *entry)
-{
-    PHYSFS_uint32 ui32;
-    PHYSFS_uint16 ui16;
-    PHYSFS_uint16 fnamelen;
-    PHYSFS_uint16 extralen;
-
-    /*
-     * crc and (un)compressed_size are always zero if this is a "JAR"
-     *  archive created with Sun's Java tools, apparently. We only
-     *  consider this archive corrupted if those entries don't match and
-     *  aren't zero. That seems to work well.
-     * We also ignore a mismatch if the value is 0xFFFFFFFF here, since it's
-     *  possible that's a Zip64 thing.
-     */
-
-    /* !!! FIXME: apparently these are zero if general purpose bit 3 is set,
-       !!! FIXME:  which is probably true for Jar files, fwiw, but we don't
-       !!! FIXME:  care about these values anyhow. */
-
-    BAIL_IF_MACRO(!io->seek(io, entry->offset), ERRPASS, 0);
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != ZIP_LOCAL_FILE_SIG, PHYSFS_ERR_CORRUPT, 0);
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-    BAIL_IF_MACRO(ui16 != entry->version_needed, PHYSFS_ERR_CORRUPT, 0);
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);  /* general bits. */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-    BAIL_IF_MACRO(ui16 != entry->compression_method, PHYSFS_ERR_CORRUPT, 0);
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);  /* date/time */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 && (ui32 != entry->crc), PHYSFS_ERR_CORRUPT, 0);
-
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 && (ui32 != 0xFFFFFFFF) &&
-                  (ui32 != entry->compressed_size), PHYSFS_ERR_CORRUPT, 0);
-
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 && (ui32 != 0xFFFFFFFF) &&
-                 (ui32 != entry->uncompressed_size), PHYSFS_ERR_CORRUPT, 0);
-
-    BAIL_IF_MACRO(!readui16(io, &fnamelen), ERRPASS, 0);
-    BAIL_IF_MACRO(!readui16(io, &extralen), ERRPASS, 0);
-
-    entry->offset += fnamelen + extralen + 30;
-    return 1;
-} /* zip_parse_local */
-
-
-static int zip_resolve(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
-{
-    int retval = 1;
-    const ZipResolveType resolve_type = entry->resolved;
-
-    if (resolve_type == ZIP_DIRECTORY)
-        return 1;   /* we're good. */
-
-    /* Don't bother if we've failed to resolve this entry before. */
-    BAIL_IF_MACRO(resolve_type == ZIP_BROKEN_FILE, PHYSFS_ERR_CORRUPT, 0);
-    BAIL_IF_MACRO(resolve_type == ZIP_BROKEN_SYMLINK, PHYSFS_ERR_CORRUPT, 0);
-
-    /* uhoh...infinite symlink loop! */
-    BAIL_IF_MACRO(resolve_type == ZIP_RESOLVING, PHYSFS_ERR_SYMLINK_LOOP, 0);
-
-    /*
-     * We fix up the offset to point to the actual data on the
-     *  first open, since we don't want to seek across the whole file on
-     *  archive open (can be SLOW on large, CD-stored files), but we
-     *  need to check the local file header...not just for corruption,
-     *  but since it stores offset info the central directory does not.
-     */
-    if (resolve_type != ZIP_RESOLVED)
-    {
-        entry->resolved = ZIP_RESOLVING;
-
-        retval = zip_parse_local(io, entry);
-        if (retval)
-        {
-            /*
-             * If it's a symlink, find the original file. This will cause
-             *  resolution of other entries (other symlinks and, eventually,
-             *  the real file) if all goes well.
-             */
-            if (resolve_type == ZIP_UNRESOLVED_SYMLINK)
-                retval = zip_resolve_symlink(io, info, entry);
-        } /* if */
-
-        if (resolve_type == ZIP_UNRESOLVED_SYMLINK)
-            entry->resolved = ((retval) ? ZIP_RESOLVED : ZIP_BROKEN_SYMLINK);
-        else if (resolve_type == ZIP_UNRESOLVED_FILE)
-            entry->resolved = ((retval) ? ZIP_RESOLVED : ZIP_BROKEN_FILE);
-    } /* if */
-
-    return retval;
-} /* zip_resolve */
-
-
-static int zip_hash_entry(ZIPinfo *info, ZIPentry *entry);
-
-/* Fill in missing parent directories. */
-static ZIPentry *zip_hash_ancestors(ZIPinfo *info, char *name)
-{
-    ZIPentry *retval = &info->root;
-    char *sep = strrchr(name, '/');
-
-    if (sep)
-    {
-        const size_t namelen = (sep - name) + 1;
-
-        *sep = '\0';  /* chop off last piece. */
-        retval = zip_find_entry(info, name);
-        *sep = '/';
-
-        if (retval != NULL)
-        {
-            if (retval->resolved != ZIP_DIRECTORY)
-                BAIL_MACRO(PHYSFS_ERR_CORRUPT, NULL);
-            return retval;  /* already hashed. */
-        } /* if */
-
-        /* okay, this is a new dir. Build and hash us. */
-        retval = (ZIPentry *) allocator.Malloc(sizeof (ZIPentry) + namelen);
-        BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-        memset(retval, '\0', sizeof (*retval));
-        retval->name = ((char *) retval) + sizeof (ZIPentry);
-        memcpy(retval->name, name, namelen - 1);
-        retval->name[namelen - 1] = '\0';
-        retval->resolved = ZIP_DIRECTORY;
-        if (!zip_hash_entry(info, retval))
-        {
-            allocator.Free(retval);
-            return NULL;
-        } /* if */
-    } /* else */
-
-    return retval;
-} /* zip_hash_ancestors */
-
-
-static int zip_hash_entry(ZIPinfo *info, ZIPentry *entry)
-{
-    PHYSFS_uint32 hashval;
-    ZIPentry *parent;
-
-    assert(!zip_find_entry(info, entry->name));  /* checked elsewhere */
-
-    parent = zip_hash_ancestors(info, entry->name);
-    if (!parent)
-        return 0;
-
-    hashval = zip_hash_string(info, entry->name);
-    entry->hashnext = info->hash[hashval];
-    info->hash[hashval] = entry;
-
-    entry->sibling = parent->children;
-    parent->children = entry;
-    return 1;
-} /* zip_hash_entry */
-
-
-static int zip_entry_is_symlink(const ZIPentry *entry)
-{
-    return ((entry->resolved == ZIP_UNRESOLVED_SYMLINK) ||
-            (entry->resolved == ZIP_BROKEN_SYMLINK) ||
-            (entry->symlink));
-} /* zip_entry_is_symlink */
-
-
-static int zip_version_does_symlinks(PHYSFS_uint32 version)
-{
-    int retval = 0;
-    PHYSFS_uint8 hosttype = (PHYSFS_uint8) ((version >> 8) & 0xFF);
-
-    switch (hosttype)
-    {
-            /*
-             * These are the platforms that can NOT build an archive with
-             *  symlinks, according to the Info-ZIP project.
-             */
-        case 0:  /* FS_FAT_  */
-        case 1:  /* AMIGA_   */
-        case 2:  /* VMS_     */
-        case 4:  /* VM_CSM_  */
-        case 6:  /* FS_HPFS_ */
-        case 11: /* FS_NTFS_ */
-        case 14: /* FS_VFAT_ */
-        case 13: /* ACORN_   */
-        case 15: /* MVS_     */
-        case 18: /* THEOS_   */
-            break;  /* do nothing. */
-
-        default:  /* assume the rest to be unix-like. */
-            retval = 1;
-            break;
-    } /* switch */
-
-    return retval;
-} /* zip_version_does_symlinks */
-
-
-static int zip_has_symlink_attr(ZIPentry *entry, PHYSFS_uint32 extern_attr)
-{
-    PHYSFS_uint16 xattr = ((extern_attr >> 16) & 0xFFFF);
-    return ( (zip_version_does_symlinks(entry->version)) &&
-             (entry->uncompressed_size > 0) &&
-             ((xattr & UNIX_FILETYPE_MASK) == UNIX_FILETYPE_SYMLINK) );
-} /* zip_has_symlink_attr */
-
-
-static PHYSFS_sint64 zip_dos_time_to_physfs_time(PHYSFS_uint32 dostime)
-{
-    PHYSFS_uint32 dosdate;
-    struct tm unixtime;
-    memset(&unixtime, '\0', sizeof (unixtime));
-
-    dosdate = (PHYSFS_uint32) ((dostime >> 16) & 0xFFFF);
-    dostime &= 0xFFFF;
-
-    /* dissect date */
-    unixtime.tm_year = ((dosdate >> 9) & 0x7F) + 80;
-    unixtime.tm_mon  = ((dosdate >> 5) & 0x0F) - 1;
-    unixtime.tm_mday = ((dosdate     ) & 0x1F);
-
-    /* dissect time */
-    unixtime.tm_hour = ((dostime >> 11) & 0x1F);
-    unixtime.tm_min  = ((dostime >>  5) & 0x3F);
-    unixtime.tm_sec  = ((dostime <<  1) & 0x3E);
-
-    /* let mktime calculate daylight savings time. */
-    unixtime.tm_isdst = -1;
-
-    return ((PHYSFS_sint64) mktime(&unixtime));
-} /* zip_dos_time_to_physfs_time */
-
-
-static ZIPentry *zip_load_entry(PHYSFS_Io *io, const int zip64,
-                                const PHYSFS_uint64 ofs_fixup)
-{
-    ZIPentry entry;
-    ZIPentry *retval = NULL;
-    PHYSFS_uint16 fnamelen, extralen, commentlen;
-    PHYSFS_uint32 external_attr;
-    PHYSFS_uint32 starting_disk;
-    PHYSFS_uint64 offset;
-    PHYSFS_uint16 ui16;
-    PHYSFS_uint32 ui32;
-    PHYSFS_sint64 si64;
-
-    memset(&entry, '\0', sizeof (entry));
-
-    /* sanity check with central directory signature... */
-    if (!readui32(io, &ui32)) return NULL;
-    BAIL_IF_MACRO(ui32 != ZIP_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, NULL);
-
-    /* Get the pertinent parts of the record... */
-    if (!readui16(io, &entry.version)) return NULL;
-    if (!readui16(io, &entry.version_needed)) return NULL;
-    if (!readui16(io, &entry.general_bits)) return NULL;  /* general bits */
-    if (!readui16(io, &entry.compression_method)) return NULL;
-    if (!readui32(io, &entry.dos_mod_time)) return NULL;
-    entry.last_mod_time = zip_dos_time_to_physfs_time(entry.dos_mod_time);
-    if (!readui32(io, &entry.crc)) return NULL;
-    if (!readui32(io, &ui32)) return NULL;
-    entry.compressed_size = (PHYSFS_uint64) ui32;
-    if (!readui32(io, &ui32)) return NULL;
-    entry.uncompressed_size = (PHYSFS_uint64) ui32;
-    if (!readui16(io, &fnamelen)) return NULL;
-    if (!readui16(io, &extralen)) return NULL;
-    if (!readui16(io, &commentlen)) return NULL;
-    if (!readui16(io, &ui16)) return NULL;
-    starting_disk = (PHYSFS_uint32) ui16;
-    if (!readui16(io, &ui16)) return NULL;  /* internal file attribs */
-    if (!readui32(io, &external_attr)) return NULL;
-    if (!readui32(io, &ui32)) return NULL;
-    offset = (PHYSFS_uint64) ui32;
-
-    retval = (ZIPentry *) allocator.Malloc(sizeof (ZIPentry) + fnamelen + 1);
-    BAIL_IF_MACRO(retval == NULL, PHYSFS_ERR_OUT_OF_MEMORY, 0);
-    memcpy(retval, &entry, sizeof (*retval));
-    retval->name = ((char *) retval) + sizeof (ZIPentry);
-
-    if (!__PHYSFS_readAll(io, retval->name, fnamelen))
-        goto zip_load_entry_puked;
-
-    retval->name[fnamelen] = '\0';  /* null-terminate the filename. */
-    zip_convert_dos_path(retval, retval->name);
-
-    retval->symlink = NULL;  /* will be resolved later, if necessary. */
-
-    if (retval->name[fnamelen - 1] == '/')
-    {
-        retval->name[fnamelen - 1] = '\0';
-        retval->resolved = ZIP_DIRECTORY;
-    } /* if */
-    else
-    {
-        retval->resolved = (zip_has_symlink_attr(&entry, external_attr)) ?
-                                ZIP_UNRESOLVED_SYMLINK : ZIP_UNRESOLVED_FILE;
-    } /* else */
-
-    si64 = io->tell(io);
-    if (si64 == -1)
-        goto zip_load_entry_puked;
-
-    /*
-     * The actual sizes didn't fit in 32-bits; look for the Zip64
-     *  extended information extra field...
-     */
-    if ( (zip64) &&
-         ((offset == 0xFFFFFFFF) ||
-          (starting_disk == 0xFFFFFFFF) ||
-          (retval->compressed_size == 0xFFFFFFFF) ||
-          (retval->uncompressed_size == 0xFFFFFFFF)) )
-    {
-        int found = 0;
-        PHYSFS_uint16 sig, len;
-        while (extralen > 4)
-        {
-            if (!readui16(io, &sig))
-                goto zip_load_entry_puked;
-            else if (!readui16(io, &len))
-                goto zip_load_entry_puked;
-
-            si64 += 4 + len;
-            extralen -= 4 + len;
-            if (sig != ZIP64_EXTENDED_INFO_EXTRA_FIELD_SIG)
-            {
-                if (!io->seek(io, si64))
-                    goto zip_load_entry_puked;
-                continue;
-            } /* if */
-
-            found = 1;
-            break;
-        } /* while */
-
-        GOTO_IF_MACRO(!found, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-
-        if (retval->uncompressed_size == 0xFFFFFFFF)
-        {
-            GOTO_IF_MACRO(len < 8, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-            if (!readui64(io, &retval->uncompressed_size))
-                goto zip_load_entry_puked;
-            len -= 8;
-        } /* if */
-
-        if (retval->compressed_size == 0xFFFFFFFF)
-        {
-            GOTO_IF_MACRO(len < 8, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-            if (!readui64(io, &retval->compressed_size))
-                goto zip_load_entry_puked;
-            len -= 8;
-        } /* if */
-
-        if (offset == 0xFFFFFFFF)
-        {
-            GOTO_IF_MACRO(len < 8, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-            if (!readui64(io, &offset))
-                goto zip_load_entry_puked;
-            len -= 8;
-        } /* if */
-
-        if (starting_disk == 0xFFFFFFFF)
-        {
-            GOTO_IF_MACRO(len < 8, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-            if (!readui32(io, &starting_disk))
-                goto zip_load_entry_puked;
-            len -= 4;
-        } /* if */
-
-        GOTO_IF_MACRO(len != 0, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-    } /* if */
-
-    GOTO_IF_MACRO(starting_disk != 0, PHYSFS_ERR_CORRUPT, zip_load_entry_puked);
-
-    retval->offset = offset + ofs_fixup;
-
-    /* seek to the start of the next entry in the central directory... */
-    if (!io->seek(io, si64 + extralen + commentlen))
-        goto zip_load_entry_puked;
-
-    return retval;  /* success. */
-
-zip_load_entry_puked:
-    allocator.Free(retval);
-    return NULL;  /* failure. */
-} /* zip_load_entry */
-
-
-/* This leaves things allocated on error; the caller will clean up the mess. */
-static int zip_load_entries(ZIPinfo *info,
-                            const PHYSFS_uint64 data_ofs,
-                            const PHYSFS_uint64 central_ofs,
-                            const PHYSFS_uint64 entry_count)
-{
-    PHYSFS_Io *io = info->io;
-    const int zip64 = info->zip64;
-    PHYSFS_uint64 i;
-
-    if (!io->seek(io, central_ofs))
-        return 0;
-
-    for (i = 0; i < entry_count; i++)
-    {
-        ZIPentry *entry = zip_load_entry(io, zip64, data_ofs);
-        ZIPentry *find;
-
-        if (!entry)
-            return 0;
-
-        find = zip_find_entry(info, entry->name);
-        if (find != NULL)  /* duplicate? */
-        {
-            if (find->last_mod_time != 0)  /* duplicate? */
-            {
-                allocator.Free(entry);
-                BAIL_MACRO(PHYSFS_ERR_CORRUPT, 0);
-            } /* if */
-            else  /* we filled this in as a placeholder. Update it. */
-            {
-                find->offset = entry->offset;
-                find->version = entry->version;
-                find->version_needed = entry->version_needed;
-                find->compression_method = entry->compression_method;
-                find->crc = entry->crc;
-                find->compressed_size = entry->compressed_size;
-                find->uncompressed_size = entry->uncompressed_size;
-                find->last_mod_time = entry->last_mod_time;
-                allocator.Free(entry);
-                continue;
-            } /* else */
-        } /* if */
-
-        if (!zip_hash_entry(info, entry))
-        {
-            allocator.Free(entry);
-            return 0;
-        } /* if */
-
-        if (zip_entry_is_tradional_crypto(entry))
-            info->has_crypto = 1;
-    } /* for */
-
-    return 1;
-} /* zip_load_entries */
-
-
-static PHYSFS_sint64 zip64_find_end_of_central_dir(PHYSFS_Io *io,
-                                                   PHYSFS_sint64 _pos,
-                                                   PHYSFS_uint64 offset)
-{
-    /*
-     * Naturally, the offset is useless to us; it is the offset from the
-     *  start of file, which is meaningless if we've appended this .zip to
-     *  a self-extracting .exe. We need to find this on our own. It should
-     *  be directly before the locator record, but the record in question,
-     *  like the original end-of-central-directory record, ends with a
-     *  variable-length field. Unlike the original, which has to store the
-     *  size of that variable-length field in a 16-bit int and thus has to be
-     *  within 64k, the new one gets 64-bits.
-     *
-     * Fortunately, the only currently-specified record for that variable
-     *  length block is some weird proprietary thing that deals with EBCDIC
-     *  and tape backups or something. So we don't seek far.
-     */
-
-    PHYSFS_uint32 ui32;
-    const PHYSFS_uint64 pos = (PHYSFS_uint64) _pos;
-
-    assert(_pos > 0);
-
-    /* Try offset specified in the Zip64 end of central directory locator. */
-    /* This works if the entire PHYSFS_Io is the zip file. */
-    BAIL_IF_MACRO(!io->seek(io, offset), ERRPASS, -1);
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, -1);
-    if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG)
-        return offset;
-
-    /* Try 56 bytes before the Zip64 end of central directory locator. */
-    /* This works if the record isn't variable length and is version 1. */
-    if (pos > 56)
-    {
-        BAIL_IF_MACRO(!io->seek(io, pos-56), ERRPASS, -1);
-        BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, -1);
-        if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG)
-            return pos-56;
-    } /* if */
-
-    /* Try 84 bytes before the Zip64 end of central directory locator. */
-    /* This works if the record isn't variable length and is version 2. */
-    if (pos > 84)
-    {
-        BAIL_IF_MACRO(!io->seek(io, pos-84), ERRPASS, -1);
-        BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, -1);
-        if (ui32 == ZIP64_END_OF_CENTRAL_DIR_SIG)
-            return pos-84;
-    } /* if */
-
-    /* Ok, brute force: we know it's between (offset) and (pos) somewhere. */
-    /*  Just try moving back at most 256k. Oh well. */
-    if ((offset < pos) && (pos > 4))
-    {
-        const PHYSFS_uint64 maxbuflen = 256 * 1024;
-        PHYSFS_uint64 len = pos - offset;
-        PHYSFS_uint8 *buf = NULL;
-        PHYSFS_sint32 i;
-
-        if (len > maxbuflen)
-            len = maxbuflen;
-
-        buf = (PHYSFS_uint8 *) __PHYSFS_smallAlloc(len);
-        BAIL_IF_MACRO(!buf, PHYSFS_ERR_OUT_OF_MEMORY, -1);
-
-        if (!io->seek(io, pos - len) || !__PHYSFS_readAll(io, buf, len))
-        {
-            __PHYSFS_smallFree(buf);
-            return -1;  /* error was set elsewhere. */
-        } /* if */
-
-        for (i = (PHYSFS_sint32) (len - 4); i >= 0; i--)
-        {
-            if ( (buf[i] == 0x50) && (buf[i+1] == 0x4b) &&
-                 (buf[i+2] == 0x06) && (buf[i+3] == 0x06) )
-            {
-                __PHYSFS_smallFree(buf);
-                return pos - (len - i);
-            } /* if */
-        } /* for */
-
-        __PHYSFS_smallFree(buf);
-    } /* if */
-
-    BAIL_MACRO(PHYSFS_ERR_CORRUPT, -1);  /* didn't find it. */
-} /* zip64_find_end_of_central_dir */
-
-
-static int zip64_parse_end_of_central_dir(ZIPinfo *info,
-                                          PHYSFS_uint64 *data_start,
-                                          PHYSFS_uint64 *dir_ofs,
-                                          PHYSFS_uint64 *entry_count,
-                                          PHYSFS_sint64 pos)
-{
-    PHYSFS_Io *io = info->io;
-    PHYSFS_uint64 ui64;
-    PHYSFS_uint32 ui32;
-    PHYSFS_uint16 ui16;
-
-    /* We should be positioned right past the locator signature. */
-
-    if ((pos < 0) || (!io->seek(io, pos)))
-        return 0;
-
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    if (ui32 != ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIG)
-        return -1;  /* it's not a Zip64 archive. Not an error, though! */
-
-    info->zip64 = 1;
-
-    /* number of the disk with the start of the central directory. */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != 0, PHYSFS_ERR_CORRUPT, 0);
-
-    /* offset of Zip64 end of central directory record. */
-    BAIL_IF_MACRO(!readui64(io, &ui64), ERRPASS, 0);
-
-    /* total number of disks */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != 1, PHYSFS_ERR_CORRUPT, 0);
-
-    pos = zip64_find_end_of_central_dir(io, pos, ui64);
-    if (pos < 0)
-        return 0;  /* oh well. */
-
-    /*
-     * For self-extracting archives, etc, there's crapola in the file
-     *  before the zipfile records; we calculate how much data there is
-     *  prepended by determining how far the zip64-end-of-central-directory
-     *  offset is from where it is supposed to be...the difference in bytes
-     *  is how much arbitrary data is at the start of the physical file.
-     */
-    assert(((PHYSFS_uint64) pos) >= ui64);
-    *data_start = ((PHYSFS_uint64) pos) - ui64;
-
-    BAIL_IF_MACRO(!io->seek(io, pos), ERRPASS, 0);
-
-    /* check signature again, just in case. */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != ZIP64_END_OF_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, 0);
-
-    /* size of Zip64 end of central directory record. */
-    BAIL_IF_MACRO(!readui64(io, &ui64), ERRPASS, 0);
-
-    /* version made by. */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-
-    /* version needed to extract. */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-
-    /* number of this disk. */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != 0, PHYSFS_ERR_CORRUPT, 0);
-
-    /* number of disk with start of central directory record. */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != 0, PHYSFS_ERR_CORRUPT, 0);
-
-    /* total number of entries in the central dir on this disk */
-    BAIL_IF_MACRO(!readui64(io, &ui64), ERRPASS, 0);
-
-    /* total number of entries in the central dir */
-    BAIL_IF_MACRO(!readui64(io, entry_count), ERRPASS, 0);
-    BAIL_IF_MACRO(ui64 != *entry_count, PHYSFS_ERR_CORRUPT, 0);
-
-    /* size of the central directory */
-    BAIL_IF_MACRO(!readui64(io, &ui64), ERRPASS, 0);
-
-    /* offset of central directory */
-    BAIL_IF_MACRO(!readui64(io, dir_ofs), ERRPASS, 0);
-
-    /* Since we know the difference, fix up the central dir offset... */
-    *dir_ofs += *data_start;
-
-    /*
-     * There are more fields here, for encryption and feature-specific things,
-     *  but we don't care about any of them at the moment.
-     */
-
-    return 1;  /* made it. */
-} /* zip64_parse_end_of_central_dir */
-
-
-static int zip_parse_end_of_central_dir(ZIPinfo *info,
-                                        PHYSFS_uint64 *data_start,
-                                        PHYSFS_uint64 *dir_ofs,
-                                        PHYSFS_uint64 *entry_count)
-{
-    PHYSFS_Io *io = info->io;
-    PHYSFS_uint16 entryCount16;
-    PHYSFS_uint32 offset32;
-    PHYSFS_uint32 ui32;
-    PHYSFS_uint16 ui16;
-    PHYSFS_sint64 len;
-    PHYSFS_sint64 pos;
-    int rc;
-
-    /* find the end-of-central-dir record, and seek to it. */
-    pos = zip_find_end_of_central_dir(io, &len);
-    BAIL_IF_MACRO(pos == -1, ERRPASS, 0);
-    BAIL_IF_MACRO(!io->seek(io, pos), ERRPASS, 0);
-
-    /* check signature again, just in case. */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-    BAIL_IF_MACRO(ui32 != ZIP_END_OF_CENTRAL_DIR_SIG, PHYSFS_ERR_CORRUPT, 0);
-
-    /* Seek back to see if "Zip64 end of central directory locator" exists. */
-    /* this record is 20 bytes before end-of-central-dir */
-    rc = zip64_parse_end_of_central_dir(info, data_start, dir_ofs,
-                                        entry_count, pos - 20);
-
-    /* Error or success? Bounce out of here. Keep going if not zip64. */
-    if ((rc == 0) || (rc == 1))
-        return rc;
-
-    assert(rc == -1);  /* no error, just not a Zip64 archive. */
-
-    /* Not Zip64? Seek back to where we were and keep processing. */
-    BAIL_IF_MACRO(!io->seek(io, pos + 4), ERRPASS, 0);
-
-    /* number of this disk */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-    BAIL_IF_MACRO(ui16 != 0, PHYSFS_ERR_CORRUPT, 0);
-
-    /* number of the disk with the start of the central directory */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-    BAIL_IF_MACRO(ui16 != 0, PHYSFS_ERR_CORRUPT, 0);
-
-    /* total number of entries in the central dir on this disk */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-
-    /* total number of entries in the central dir */
-    BAIL_IF_MACRO(!readui16(io, &entryCount16), ERRPASS, 0);
-    BAIL_IF_MACRO(ui16 != entryCount16, PHYSFS_ERR_CORRUPT, 0);
-
-    *entry_count = entryCount16;
-
-    /* size of the central directory */
-    BAIL_IF_MACRO(!readui32(io, &ui32), ERRPASS, 0);
-
-    /* offset of central directory */
-    BAIL_IF_MACRO(!readui32(io, &offset32), ERRPASS, 0);
-    *dir_ofs = (PHYSFS_uint64) offset32;
-    BAIL_IF_MACRO(pos < (*dir_ofs + ui32), PHYSFS_ERR_CORRUPT, 0);
-
-    /*
-     * For self-extracting archives, etc, there's crapola in the file
-     *  before the zipfile records; we calculate how much data there is
-     *  prepended by determining how far the central directory offset is
-     *  from where it is supposed to be (start of end-of-central-dir minus
-     *  sizeof central dir)...the difference in bytes is how much arbitrary
-     *  data is at the start of the physical file.
-     */
-    *data_start = (PHYSFS_uint64) (pos - (*dir_ofs + ui32));
-
-    /* Now that we know the difference, fix up the central dir offset... */
-    *dir_ofs += *data_start;
-
-    /* zipfile comment length */
-    BAIL_IF_MACRO(!readui16(io, &ui16), ERRPASS, 0);
-
-    /*
-     * Make sure that the comment length matches to the end of file...
-     *  If it doesn't, we're either in the wrong part of the file, or the
-     *  file is corrupted, but we give up either way.
-     */
-    BAIL_IF_MACRO((pos + 22 + ui16) != len, PHYSFS_ERR_CORRUPT, 0);
-
-    return 1;  /* made it. */
-} /* zip_parse_end_of_central_dir */
-
-
-static int zip_alloc_hashtable(ZIPinfo *info, const PHYSFS_uint64 entry_count)
-{
-    size_t alloclen;
-
-    info->hashBuckets = (size_t) (entry_count / 5);
-    if (!info->hashBuckets)
-        info->hashBuckets = 1;
-
-    alloclen = info->hashBuckets * sizeof (ZIPentry *);
-    info->hash = (ZIPentry **) allocator.Malloc(alloclen);
-    BAIL_IF_MACRO(!info->hash, PHYSFS_ERR_OUT_OF_MEMORY, 0);
-    memset(info->hash, '\0', alloclen);
-
-    return 1;
-} /* zip_alloc_hashtable */
-
-static void ZIP_closeArchive(void *opaque);
-
-static void *ZIP_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
-{
-    ZIPinfo *info = NULL;
-    PHYSFS_uint64 dstart;  /* data start */
-    PHYSFS_uint64 cdir_ofs;  /* central dir offset */
-    PHYSFS_uint64 entry_count;
-
-    assert(io != NULL);  /* shouldn't ever happen. */
-
-    BAIL_IF_MACRO(forWriting, PHYSFS_ERR_READ_ONLY, NULL);
-    BAIL_IF_MACRO(!isZip(io), ERRPASS, NULL);
-
-    info = (ZIPinfo *) allocator.Malloc(sizeof (ZIPinfo));
-    BAIL_IF_MACRO(!info, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-    memset(info, '\0', sizeof (ZIPinfo));
-    info->root.resolved = ZIP_DIRECTORY;
-    info->io = io;
-
-    if (!zip_parse_end_of_central_dir(info, &dstart, &cdir_ofs, &entry_count))
-        goto ZIP_openarchive_failed;
-    else if (!zip_alloc_hashtable(info, entry_count))
-        goto ZIP_openarchive_failed;
-    else if (!zip_load_entries(info, dstart, cdir_ofs, entry_count))
-        goto ZIP_openarchive_failed;
-
-    assert(info->root.sibling == NULL);
-    return info;
-
-ZIP_openarchive_failed:
-    info->io = NULL;  /* don't let ZIP_closeArchive destroy (io). */
-    ZIP_closeArchive(info);
-    return NULL;
-} /* ZIP_openArchive */
-
-
-static void ZIP_enumerateFiles(void *opaque, const char *dname,
-                               PHYSFS_EnumFilesCallback cb,
-                               const char *origdir, void *callbackdata)
-{
-    ZIPinfo *info = ((ZIPinfo *) opaque);
-    const ZIPentry *entry = zip_find_entry(info, dname);
-    if (entry && (entry->resolved == ZIP_DIRECTORY))
-    {
-        for (entry = entry->children; entry; entry = entry->sibling)
-        {
-            const char *ptr = strrchr(entry->name, '/');
-            cb(callbackdata, origdir, ptr ? ptr + 1 : entry->name);
-        } /* for */
-    } /* if */
-} /* ZIP_enumerateFiles */
-
-
-static PHYSFS_Io *zip_get_io(PHYSFS_Io *io, ZIPinfo *inf, ZIPentry *entry)
-{
-    int success;
-    PHYSFS_Io *retval = io->duplicate(io);
-    BAIL_IF_MACRO(!retval, ERRPASS, NULL);
-
-    /* !!! FIXME: if you open a dir here, it should bail ERR_NOT_A_FILE */
-
-    /* (inf) can be NULL if we already resolved. */
-    success = (inf == NULL) || zip_resolve(retval, inf, entry);
-    if (success)
-    {
-        PHYSFS_sint64 offset;
-        offset = ((entry->symlink) ? entry->symlink->offset : entry->offset);
-        success = retval->seek(retval, offset);
-    } /* if */
-
-    if (!success)
-    {
-        retval->destroy(retval);
-        retval = NULL;
-    } /* if */
-
-    return retval;
-} /* zip_get_io */
-
-
-static PHYSFS_Io *ZIP_openRead(void *opaque, const char *filename)
-{
-    PHYSFS_Io *retval = NULL;
-    ZIPinfo *info = (ZIPinfo *) opaque;
-    ZIPentry *entry = zip_find_entry(info, filename);
-    ZIPfileinfo *finfo = NULL;
-    PHYSFS_Io *io = NULL;
-    PHYSFS_uint8 *password = NULL;
-    int i;
-
-    /* if not found, see if maybe "$PASSWORD" is appended. */
-    if ((!entry) && (info->has_crypto))
-    {
-        const char *ptr = strrchr(filename, '$');
-        if (ptr != NULL)
-        {
-            const PHYSFS_uint64 len = (PHYSFS_uint64) (ptr - filename);
-            char *str = (char *) __PHYSFS_smallAlloc(len + 1);
-            BAIL_IF_MACRO(!str, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-            memcpy(str, filename, len);
-            str[len] = '\0';
-            entry = zip_find_entry(info, str);
-            __PHYSFS_smallFree(str);
-            password = (PHYSFS_uint8 *) (ptr + 1);
-        } /* if */
-    } /* if */
-
-    BAIL_IF_MACRO(!entry, ERRPASS, NULL);
-
-    retval = (PHYSFS_Io *) allocator.Malloc(sizeof (PHYSFS_Io));
-    GOTO_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed);
-
-    finfo = (ZIPfileinfo *) allocator.Malloc(sizeof (ZIPfileinfo));
-    GOTO_IF_MACRO(!finfo, PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed);
-    memset(finfo, '\0', sizeof (ZIPfileinfo));
-
-    io = zip_get_io(info->io, info, entry);
-    GOTO_IF_MACRO(!io, ERRPASS, ZIP_openRead_failed);
-    finfo->io = io;
-    finfo->entry = ((entry->symlink != NULL) ? entry->symlink : entry);
-    initializeZStream(&finfo->stream);
-
-    if (finfo->entry->compression_method != COMPMETH_NONE)
-    {
-        finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE);
-        if (!finfo->buffer)
-            GOTO_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, ZIP_openRead_failed);
-        else if (zlib_err(inflateInit2(&finfo->stream, -MAX_WBITS)) != Z_OK)
-            goto ZIP_openRead_failed;
-    } /* if */
-
-    if (!zip_entry_is_tradional_crypto(entry))
-        GOTO_IF_MACRO(password != NULL, PHYSFS_ERR_BAD_PASSWORD, ZIP_openRead_failed);
-    else
-    {
-        PHYSFS_uint8 crypto_header[12];
-        GOTO_IF_MACRO(password == NULL, PHYSFS_ERR_BAD_PASSWORD, ZIP_openRead_failed);
-        if (io->read(io, crypto_header, 12) != 12)
-            goto ZIP_openRead_failed;
-        else if (!zip_prep_crypto_keys(finfo, crypto_header, password))
-            goto ZIP_openRead_failed;
-    } /* if */
-
-    memcpy(retval, &ZIP_Io, sizeof (PHYSFS_Io));
-    retval->opaque = finfo;
-
-    return retval;
-
-ZIP_openRead_failed:
-    if (finfo != NULL)
-    {
-        if (finfo->io != NULL)
-            finfo->io->destroy(finfo->io);
-
-        if (finfo->buffer != NULL)
-        {
-            allocator.Free(finfo->buffer);
-            inflateEnd(&finfo->stream);
-        } /* if */
-
-        allocator.Free(finfo);
-    } /* if */
-
-    if (retval != NULL)
-        allocator.Free(retval);
-
-    return NULL;
-} /* ZIP_openRead */
-
-
-static PHYSFS_Io *ZIP_openWrite(void *opaque, const char *filename)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* ZIP_openWrite */
-
-
-static PHYSFS_Io *ZIP_openAppend(void *opaque, const char *filename)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
-} /* ZIP_openAppend */
-
-
-static void ZIP_closeArchive(void *opaque)
-{
-    ZIPinfo *info = (ZIPinfo *) (opaque);
-
-    if (!info)
-        return;
-
-    if (info->io)
-        info->io->destroy(info->io);
-
-    assert(info->root.sibling == NULL);
-    assert(info->hash || (info->root.children == NULL));
-
-    if (info->hash)
-    {
-        size_t i;
-        for (i = 0; i < info->hashBuckets; i++)
-        {
-            ZIPentry *entry;
-            ZIPentry *next;
-            for (entry = info->hash[i]; entry; entry = next)
-            {
-                next = entry->hashnext;
-                allocator.Free(entry);
-            } /* for */
-        } /* for */
-        allocator.Free(info->hash);
-    } /* if */
-
-    allocator.Free(info);
-} /* ZIP_closeArchive */
-
-
-static int ZIP_remove(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* ZIP_remove */
-
-
-static int ZIP_mkdir(void *opaque, const char *name)
-{
-    BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
-} /* ZIP_mkdir */
-
-
-static int ZIP_stat(void *opaque, const char *filename, PHYSFS_Stat *stat)
-{
-    ZIPinfo *info = (ZIPinfo *) opaque;
-    const ZIPentry *entry = zip_find_entry(info, filename);
-
-    /* !!! FIXME: does this need to resolve entries here? */
-
-    if (entry == NULL)
-        return 0;
-
-    else if (entry->resolved == ZIP_DIRECTORY)
-    {
-        stat->filesize = 0;
-        stat->filetype = PHYSFS_FILETYPE_DIRECTORY;
-    } /* if */
-
-    else if (zip_entry_is_symlink(entry))
-    {
-        stat->filesize = 0;
-        stat->filetype = PHYSFS_FILETYPE_SYMLINK;
-    } /* else if */
-
-    else
-    {
-        stat->filesize = (PHYSFS_sint64) entry->uncompressed_size;
-        stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    } /* else */
-
-    stat->modtime = ((entry) ? entry->last_mod_time : 0);
-    stat->createtime = stat->modtime;
-    stat->accesstime = 0;
-    stat->readonly = 1; /* .zip files are always read only */
-
-    return 1;
-} /* ZIP_stat */
-
-
-const PHYSFS_Archiver __PHYSFS_Archiver_ZIP =
-{
-    CURRENT_PHYSFS_ARCHIVER_API_VERSION,
-    {
-        "ZIP",
-        "PkZip/WinZip/Info-Zip compatible",
-        "Ryan C. Gordon <icculus@icculus.org>",
-        "https://icculus.org/physfs/",
-        1,  /* supportsSymlinks */
-    },
-    ZIP_openArchive,
-    ZIP_enumerateFiles,
-    ZIP_openRead,
-    ZIP_openWrite,
-    ZIP_openAppend,
-    ZIP_remove,
-    ZIP_mkdir,
-    ZIP_stat,
-    ZIP_closeArchive
-};
-
-#endif  /* defined PHYSFS_SUPPORTS_ZIP */
-
-/* end of archiver_zip.c ... */
-
--- a/misc/libphysfs/lzma/7zC.txt	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-7z ANSI-C Decoder 4.48
-----------------------
-
-7z ANSI-C Decoder 4.48 Copyright (C) 1999-2006 Igor Pavlov
-
-7z ANSI-C provides 7z/LZMA decoding.
-7z ANSI-C version is simplified version ported from C++ code.
-
-LZMA is default and general compression method of 7z format
-in 7-Zip compression program (www.7-zip.org). LZMA provides high 
-compression ratio and very fast decompression.
-
-
-LICENSE
--------
-
-Read lzma.txt for information about license.
-
-
-Files
----------------------
-
-7zAlloc.*    - Allocate and Free
-7zBuffer.*   - Buffer structure
-7zCrc.*      - CRC32 code
-7zDecode.*   - Low level memory->memory decoding
-7zExtract.*  - High level stream->memory decoding
-7zHeader.*   - .7z format constants
-7zIn.*       - .7z archive opening
-7zItem.*     - .7z structures
-7zMain.c     - Test application
-7zMethodID.* - MethodID structure
-7zTypes.h    - Base types and constants
-
-
-How To Use
-----------
-
-You must download 7-Zip program from www.7-zip.org.
-
-You can create .7z archive with 7z.exe or 7za.exe:
-
-  7za.exe a archive.7z *.htm -r -mx -m0fb=255
-
-If you have big number of files in archive, and you need fast extracting, 
-you can use partly-solid archives:
-  
-  7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K
-
-In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only 
-512KB for extracting one file from such archive.
-
-
-Limitations of current version of 7z ANSI-C Decoder
----------------------------------------------------
-
- - It reads only "FileName", "Size", "LastWriteTime" and "CRC" information for each file in archive.
- - It supports only LZMA and Copy (no compression) methods with BCJ or BCJ2 filters.
- - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.
- 
-These limitations will be fixed in future versions.
-
-
-Using 7z ANSI-C Decoder Test application:
------------------------------------------
-
-Usage: 7zDec <command> <archive_name>
-
-<Command>:
-  e: Extract files from archive
-  l: List contents of archive
-  t: Test integrity of archive
-
-Example: 
-
-  7zDec l archive.7z
-
-lists contents of archive.7z
-
-  7zDec e archive.7z
-
-extracts files from archive.7z to current folder.
-
-
-How to use .7z Decoder
-----------------------
-
-.7z Decoder can be compiled in one of two modes:
-
-1) Default mode. In that mode 7z Decoder will read full compressed 
-   block to RAM before decompressing.
-  
-2) Mode with defined _LZMA_IN_CB. In that mode 7z Decoder can read
-   compressed block by parts. And you can specify desired buffer size. 
-   So memory requirements can be reduced. But decompressing speed will 
-   be 5-10% lower and code size is slightly larger.
-
-   
-Memory allocation
-~~~~~~~~~~~~~~~~~
-
-7z Decoder uses two memory pools:
-1) Temporary pool
-2) Main pool
-Such scheme can allow you to avoid fragmentation of allocated blocks.
-
-Steps for using 7z decoder
---------------------------
-
-Use code at 7zMain.c as example.
-
-1) Declare variables:
-  inStream                     /* implements ISzInStream interface */
-  CArchiveDatabaseEx db;       /* 7z archive database structure */
-  ISzAlloc allocImp;           /* memory functions for main pool */
-  ISzAlloc allocTempImp;       /* memory functions for temporary pool */
-
-2) call InitCrcTable(); function to initialize CRC structures.
-
-3) call SzArDbExInit(&db); function to initialize db structures.
-
-4) call SzArchiveOpen(inStream, &db, &allocMain, &allocTemp) to open archive
-
-This function opens archive "inStream" and reads headers to "db".
-All items in "db" will be allocated with "allocMain" functions.
-SzArchiveOpen function allocates and frees temporary structures by "allocTemp" functions.
-
-5) List items or Extract items
-
-  Listing code:
-  ~~~~~~~~~~~~~
-    {
-      UInt32 i;
-      for (i = 0; i < db.Database.NumFiles; i++)
-      {
-        CFileItem *f = db.Database.Files + i;
-        printf("%10d  %s\n", (int)f->Size, f->Name);
-      }
-    }
-
-  Extracting code:
-  ~~~~~~~~~~~~~~~~
-
-  SZ_RESULT SzExtract(
-    ISzInStream *inStream, 
-    CArchiveDatabaseEx *db,
-    UInt32 fileIndex,         /* index of file */
-    UInt32 *blockIndex,       /* index of solid block */
-    Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */
-    size_t *outBufferSize,    /* buffer size for output buffer */
-    size_t *offset,           /* offset of stream for required file in *outBuffer */
-    size_t *outSizeProcessed, /* size of file in *outBuffer */
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp);
-
-  If you need to decompress more than one file, you can send these values from previous call:
-    blockIndex, 
-    outBuffer, 
-    outBufferSize,
-  You can consider "outBuffer" as cache of solid block. If your archive is solid, 
-  it will increase decompression speed.
-
-  After decompressing you must free "outBuffer":
-  allocImp.Free(outBuffer);
-
-6) call SzArDbExFree(&db, allocImp.Free) to free allocated items in "db".
-
-
-
-
-Memory requirements for .7z decoding 
-------------------------------------
-
-Memory usage for Archive opening:
-  - Temporary pool:
-     - Memory for compressed .7z headers (if _LZMA_IN_CB is not defined)
-     - Memory for uncompressed .7z headers
-     - some other temporary blocks
-  - Main pool:
-     - Memory for database: 
-       Estimated size of one file structures in solid archive:
-         - Size (4 or 8 Bytes)
-         - CRC32 (4 bytes)
-         - LastWriteTime (8 bytes)
-         - Some file information (4 bytes)
-         - File Name (variable length) + pointer + allocation structures
-
-Memory usage for archive Decompressing:
-  - Temporary pool:
-     - Memory for compressed solid block (if _LZMA_IN_CB is not defined)
-     - Memory for LZMA decompressing structures
-  - Main pool:
-     - Memory for decompressed solid block
-     - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these 
-       temprorary buffers can be about 15% of solid block size. 
-  
-
-If _LZMA_IN_CB is defined, 7z Decoder will not allocate memory for 
-compressed blocks. Instead of this, you must allocate buffer with desired 
-size before calling 7z Decoder. Use 7zMain.c as example.
-
-
-
-EXIT codes
------------
-
-7z Decoder functions can return one of the following codes:
-
-#define SZ_OK (0)
-#define SZE_DATA_ERROR (1)
-#define SZE_OUTOFMEMORY (2)
-#define SZE_CRC_ERROR (3)
-
-#define SZE_NOTIMPL (4)
-#define SZE_FAIL (5)
-
-#define SZE_ARCHIVE_ERROR (6)
-
-
-
-LZMA Defines
-------------
-
-_LZMA_IN_CB       - Use special callback mode for input stream to reduce memory requirements
-
-_SZ_FILE_SIZE_32  - define it if you need only support for files smaller than 4 GB
-_SZ_NO_INT_64     - define it if your compiler doesn't support long long int or __int64.
-
-_LZMA_PROB32      - it can increase LZMA decompressing speed on some 32-bit CPUs.
-
-_SZ_ALLOC_DEBUG   - define it if you want to debug alloc/free operations to stderr.
-
-
----
-
-http://www.7-zip.org
-http://www.7-zip.org/support.html
--- a/misc/libphysfs/lzma/7zFormat.txt	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-7z Format description (2.30 Beta 25)
------------------------------------
-
-This file contains description of 7z archive format. 
-7z archive can contain files compressed with any method.
-See "Methods.txt" for description for defined compressing methods.
-
-
-Format structure Overview
--------------------------
-
-Some fields can be optional.
-
-Archive structure
-~~~~~~~~~~~~~~~~~  
-SignatureHeader
-[PackedStreams]
-[PackedStreamsForHeaders]
-[
-  Header 
-  or 
-  {
-    Packed Header
-    HeaderInfo
-  }
-]
-
-
-
-Header structure
-~~~~~~~~~~~~~~~~  
-{
-  ArchiveProperties
-  AdditionalStreams
-  {
-    PackInfo
-    {
-      PackPos
-      NumPackStreams
-      Sizes[NumPackStreams]
-      CRCs[NumPackStreams]
-    }
-    CodersInfo
-    {
-      NumFolders
-      Folders[NumFolders]
-      {
-        NumCoders
-        CodersInfo[NumCoders]
-        {
-          ID
-          NumInStreams;
-          NumOutStreams;
-          PropertiesSize
-          Properties[PropertiesSize]
-        }
-        NumBindPairs
-        BindPairsInfo[NumBindPairs]
-        {
-          InIndex;
-          OutIndex;
-        }
-        PackedIndices
-      }
-      UnPackSize[Folders][Folders.NumOutstreams]
-      CRCs[NumFolders]
-    }
-    SubStreamsInfo
-    {
-      NumUnPackStreamsInFolders[NumFolders];
-      UnPackSizes[]
-      CRCs[]
-    }
-  }
-  MainStreamsInfo
-  {
-    (Same as in AdditionalStreams)
-  }
-  FilesInfo
-  {
-    NumFiles
-    Properties[]
-    {
-      ID
-      Size
-      Data
-    }
-  }
-}
-
-HeaderInfo structure
-~~~~~~~~~~~~~~~~~~~~
-{
-  (Same as in AdditionalStreams)
-}
-
-
-
-Notes about Notation and encoding
----------------------------------
-
-7z uses little endian encoding.
-
-7z archive format has optional headers that are marked as
-[]
-Header
-[]
-
-REAL_UINT64 means real UINT64.
-
-UINT64 means real UINT64 encoded with the following scheme:
-
-  Size of encoding sequence depends from first byte:
-  First_Byte  Extra_Bytes        Value
-  (binary)   
-  0xxxxxxx               : ( xxxxxxx           )
-  10xxxxxx    BYTE y[1]  : (  xxxxxx << (8 * 1)) + y
-  110xxxxx    BYTE y[2]  : (   xxxxx << (8 * 2)) + y
-  ...
-  1111110x    BYTE y[6]  : (       x << (8 * 6)) + y
-  11111110    BYTE y[7]  :                         y
-  11111111    BYTE y[8]  :                         y
-
-
-
-Property IDs
-------------
-
-0x00 = kEnd,
-
-0x01 = kHeader,
-
-0x02 = kArchiveProperties,
-    
-0x03 = kAdditionalStreamsInfo,
-0x04 = kMainStreamsInfo,
-0x05 = kFilesInfo,
-    
-0x06 = kPackInfo,
-0x07 = kUnPackInfo,
-0x08 = kSubStreamsInfo,
-
-0x09 = kSize,
-0x0A = kCRC,
-
-0x0B = kFolder,
-
-0x0C = kCodersUnPackSize,
-0x0D = kNumUnPackStream,
-
-0x0E = kEmptyStream,
-0x0F = kEmptyFile,
-0x10 = kAnti,
-
-0x11 = kName,
-0x12 = kCreationTime,
-0x13 = kLastAccessTime,
-0x14 = kLastWriteTime,
-0x15 = kWinAttributes,
-0x16 = kComment,
-
-0x17 = kEncodedHeader,
-
-
-7z format headers
------------------
-
-SignatureHeader
-~~~~~~~~~~~~~~~
-  BYTE kSignature[6] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
-
-  ArchiveVersion
-  {
-    BYTE Major;   // now = 0
-    BYTE Minor;   // now = 2
-  };
-
-  UINT32 StartHeaderCRC;
-
-  StartHeader
-  {
-    REAL_UINT64 NextHeaderOffset
-    REAL_UINT64 NextHeaderSize
-    UINT32 NextHeaderCRC
-  }
-
-
-...........................
-
-
-ArchiveProperties
-~~~~~~~~~~~~~~~~~
-BYTE NID::kArchiveProperties (0x02)
-for (;;)
-{
-  BYTE PropertyType;
-  if (aType == 0)
-    break;
-  UINT64 PropertySize;
-  BYTE PropertyData[PropertySize];
-}
-
-
-Digests (NumStreams)
-~~~~~~~~~~~~~~~~~~~~~
-  BYTE AllAreDefined
-  if (AllAreDefined == 0)
-  {
-    for(NumStreams)
-      BIT Defined
-  }
-  UINT32 CRCs[NumDefined]
-
-
-PackInfo
-~~~~~~~~~~~~
-  BYTE NID::kPackInfo  (0x06)
-  UINT64 PackPos
-  UINT64 NumPackStreams
-
-  []
-  BYTE NID::kSize    (0x09)
-  UINT64 PackSizes[NumPackStreams]
-  []
-
-  []
-  BYTE NID::kCRC      (0x0A)
-  PackStreamDigests[NumPackStreams]
-  []
-
-  BYTE NID::kEnd
-
-
-Folder
-~~~~~~
-  UINT64 NumCoders;
-  for (NumCoders)
-  {
-    BYTE 
-    {
-      0:3 DecompressionMethod.IDSize
-      4:
-        0 - IsSimple
-        1 - Is not simple
-      5:
-        0 - No Attributes
-        1 - There Are Attributes
-      7:
-        0 - Last Method in Alternative_Method_List
-        1 - There are more alternative methods
-    } 
-    BYTE DecompressionMethod.ID[DecompressionMethod.IDSize]
-    if (!IsSimple)
-    {
-      UINT64 NumInStreams;
-      UINT64 NumOutStreams;
-    }
-    if (DecompressionMethod[0] != 0)
-    {
-      UINT64 PropertiesSize
-      BYTE Properties[PropertiesSize]
-    }
-  }
-    
-  NumBindPairs = NumOutStreamsTotal - 1;
-
-  for (NumBindPairs)
-  {
-    UINT64 InIndex;
-    UINT64 OutIndex;
-  }
-
-  NumPackedStreams = NumInStreamsTotal - NumBindPairs;
-  if (NumPackedStreams > 1)
-    for(NumPackedStreams)
-    {
-      UINT64 Index;
-    };
-
-
-
-
-Coders Info
-~~~~~~~~~~~
-
-  BYTE NID::kUnPackInfo  (0x07)
-
-
-  BYTE NID::kFolder  (0x0B)
-  UINT64 NumFolders
-  BYTE External
-  switch(External)
-  {
-    case 0:
-      Folders[NumFolders]
-    case 1:
-      UINT64 DataStreamIndex
-  }
-
-
-  BYTE ID::kCodersUnPackSize  (0x0C)
-  for(Folders)
-    for(Folder.NumOutStreams)
-     UINT64 UnPackSize;
-
-
-  []
-  BYTE NID::kCRC   (0x0A)
-  UnPackDigests[NumFolders]
-  []
-
-  
-
-  BYTE NID::kEnd
-
-
-
-SubStreams Info
-~~~~~~~~~~~~~~
-  BYTE NID::kSubStreamsInfo; (0x08)
-
-  []
-  BYTE NID::kNumUnPackStream; (0x0D)
-  UINT64 NumUnPackStreamsInFolders[NumFolders];
-  []
-
-
-  []
-  BYTE NID::kSize  (0x09)
-  UINT64 UnPackSizes[]
-  []
-
-
-  []
-  BYTE NID::kCRC  (0x0A)
-  Digests[Number of streams with unknown CRC]
-  []
-
-  
-  BYTE NID::kEnd
-
-
-Streams Info
-~~~~~~~~~~~~
-
-  []
-  PackInfo
-  []
-
-
-  []
-  CodersInfo
-  []
-
-
-  []
-  SubStreamsInfo
-  []
-
-  BYTE NID::kEnd
-
-
-FilesInfo
-~~~~~~~~~
-  BYTE NID::kFilesInfo;  (0x05)
-  UINT64 NumFiles
-
-  for (;;)
-  {
-    BYTE PropertyType;
-    if (aType == 0)
-      break;
-
-    UINT64 Size;
-
-    switch(PropertyType)
-    {
-      kEmptyStream:   (0x0E)
-        for(NumFiles)
-          BIT IsEmptyStream
-
-      kEmptyFile:     (0x0F)
-        for(EmptyStreams)
-          BIT IsEmptyFile
-
-      kAnti:          (0x10)
-        for(EmptyStreams)
-          BIT IsAntiFile
-      
-      case kCreationTime:   (0x12)
-      case kLastAccessTime: (0x13)
-      case kLastWriteTime:  (0x14)
-        BYTE AllAreDefined
-        if (AllAreDefined == 0)
-        {
-          for(NumFiles)
-            BIT TimeDefined
-        }
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Definded Items)
-          UINT32 Time
-        []
-      
-      kNames:     (0x11)
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Files)
-        {
-          wchar_t Names[NameSize];
-          wchar_t 0;
-        }
-        []
-
-      kAttributes:  (0x15)
-        BYTE AllAreDefined
-        if (AllAreDefined == 0)
-        {
-          for(NumFiles)
-            BIT AttributesAreDefined
-        }
-        BYTE External;
-        if(External != 0)
-          UINT64 DataIndex
-        []
-        for(Definded Attributes)
-          UINT32 Attributes
-        []
-    }
-  }
-
-
-Header
-~~~~~~
-  BYTE NID::kHeader (0x01)
-
-  []
-  ArchiveProperties
-  []
-
-  []
-  BYTE NID::kAdditionalStreamsInfo; (0x03)
-  StreamsInfo
-  []
-
-  []
-  BYTE NID::kMainStreamsInfo;    (0x04)
-  StreamsInfo
-  []
-
-  []
-  FilesInfo
-  []
-
-  BYTE NID::kEnd
-
-
-HeaderInfo
-~~~~~~~~~~
-  []
-  BYTE NID::kEncodedHeader; (0x17)
-  StreamsInfo for Encoded Header
-  []
-
-
----
-End of document
--- a/misc/libphysfs/lzma/C/7zCrc.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/* 7zCrc.c */
-
-#include "7zCrc.h"
-
-#define kCrcPoly 0xEDB88320
-UInt32 g_CrcTable[256];
-
-void MY_FAST_CALL CrcGenerateTable(void)
-{
-  UInt32 i;
-  for (i = 0; i < 256; i++)
-  {
-    UInt32 r = i;
-    int j;
-    for (j = 0; j < 8; j++)
-      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
-    g_CrcTable[i] = r;
-  }
-}
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
-{
-  const Byte *p = (const Byte *)data;
-  for (; size > 0 ; size--, p++) 
-    v = CRC_UPDATE_BYTE(v, *p);
-  return v;
-}
-
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
-{
-  return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
-}
--- a/misc/libphysfs/lzma/C/7zCrc.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/* 7zCrc.h */
-
-#ifndef __7Z_CRC_H
-#define __7Z_CRC_H
-
-#include <stddef.h>
-
-#include "Types.h"
-
-extern UInt32 g_CrcTable[];
-
-void MY_FAST_CALL CrcGenerateTable(void);
-
-#define CRC_INIT_VAL 0xFFFFFFFF
-#define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF)
-#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
-
-#endif
--- a/misc/libphysfs/lzma/C/7zCrcT8.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* 7zCrcT8.c */
-
-#include "7zCrc.h"
-
-#define kCrcPoly 0xEDB88320
-#define CRC_NUM_TABLES 8
-
-UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
-
-void MY_FAST_CALL CrcGenerateTable()
-{
-  UInt32 i;
-  for (i = 0; i < 256; i++)
-  {
-    UInt32 r = i;
-    int j;
-    for (j = 0; j < 8; j++)
-      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
-    g_CrcTable[i] = r;
-  }
-  #if CRC_NUM_TABLES > 1
-  for (; i < 256 * CRC_NUM_TABLES; i++)
-  {
-    UInt32 r = g_CrcTable[i - 256];
-    g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
-  }
-  #endif
-}
-
-UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
-
-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
-{
-  return CrcUpdateT8(v, data, size, g_CrcTable);
-}
-
-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
-{
-  return CrcUpdateT8(CRC_INIT_VAL, data, size, g_CrcTable) ^ 0xFFFFFFFF;
-}
--- a/misc/libphysfs/lzma/C/Alloc.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* Alloc.c */
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdlib.h>
-
-#include "Alloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-#ifdef _SZ_ALLOC_DEBUG
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountMid = 0;
-int g_allocCountBig = 0;
-#endif
-
-void *MyAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount++);
-  #endif
-  return malloc(size);
-}
-
-void MyFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
-  #endif
-  free(address);
-}
-
-#ifdef _WIN32
-
-void *MidAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_Mid %10d bytes;  count = %10d", size, g_allocCountMid++);
-  #endif
-  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void MidFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
-  #endif
-  if (address == 0)
-    return;
-  VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#ifndef MEM_LARGE_PAGES
-#undef _7ZIP_LARGE_PAGES
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-SIZE_T g_LargePageSize = 0;
-typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
-#endif
-
-void SetLargePageSize()
-{
-  #ifdef _7ZIP_LARGE_PAGES
-  SIZE_T size = 0;
-  GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
-        GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
-  if (largePageMinimum == 0)
-    return;
-  size = largePageMinimum();
-  if (size == 0 || (size & (size - 1)) != 0)
-    return;
-  g_LargePageSize = size;
-  #endif
-}
-
-
-void *BigAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_Big %10d bytes;  count = %10d", size, g_allocCountBig++);
-  #endif
-  
-  #ifdef _7ZIP_LARGE_PAGES
-  if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
-  {
-    void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)), 
-        MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
-    if (res != 0)
-      return res;
-  }
-  #endif
-  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
-}
-
-void BigFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-    fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
-  #endif
-  
-  if (address == 0)
-    return;
-  VirtualFree(address, 0, MEM_RELEASE);
-}
-
-#endif
--- a/misc/libphysfs/lzma/C/Alloc.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/* Alloc.h */
-
-#ifndef __COMMON_ALLOC_H
-#define __COMMON_ALLOC_H
-
-#include <stddef.h>
-
-void *MyAlloc(size_t size);
-void MyFree(void *address);
-
-#ifdef _WIN32
-
-void SetLargePageSize();
-
-void *MidAlloc(size_t size);
-void MidFree(void *address);
-void *BigAlloc(size_t size);
-void BigFree(void *address);
-
-#else
-
-#define MidAlloc(size) MyAlloc(size)
-#define MidFree(address) MyFree(address)
-#define BigAlloc(size) MyAlloc(size)
-#define BigFree(address) MyFree(address)
-
-#endif
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zAlloc.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* 7zAlloc.c */
-
-#include <stdlib.h>
-#include "7zAlloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-
-#ifdef _SZ_ALLOC_DEBUG
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <stdio.h>
-int g_allocCount = 0;
-int g_allocCountTemp = 0;
-#endif
-
-void *SzAlloc(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
-  g_allocCount++;
-  #endif
-  return malloc(size);
-}
-
-void SzFree(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-  {
-    g_allocCount--;
-    fprintf(stderr, "\nFree; count = %10d", g_allocCount);
-  }
-  #endif
-  free(address);
-}
-
-void *SzAllocTemp(size_t size)
-{
-  if (size == 0)
-    return 0;
-  #ifdef _SZ_ALLOC_DEBUG
-  fprintf(stderr, "\nAlloc_temp %10d bytes;  count = %10d", size, g_allocCountTemp);
-  g_allocCountTemp++;
-  #ifdef _WIN32
-  return HeapAlloc(GetProcessHeap(), 0, size);
-  #endif
-  #endif
-  return malloc(size);
-}
-
-void SzFreeTemp(void *address)
-{
-  #ifdef _SZ_ALLOC_DEBUG
-  if (address != 0)
-  {
-    g_allocCountTemp--;
-    fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
-  }
-  #ifdef _WIN32
-  HeapFree(GetProcessHeap(), 0, address);
-  return;
-  #endif
-  #endif
-  free(address);
-}
--- a/misc/libphysfs/lzma/C/Archive/7z/7zAlloc.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/* 7zAlloc.h */
-
-#ifndef __7Z_ALLOC_H
-#define __7Z_ALLOC_H
-
-#include <stddef.h>
-
-typedef struct _ISzAlloc
-{
-  void *(*Alloc)(size_t size);
-  void (*Free)(void *address); /* address can be 0 */
-} ISzAlloc;
-
-void *SzAlloc(size_t size);
-void SzFree(void *address);
-
-void *SzAllocTemp(size_t size);
-void SzFreeTemp(void *address);
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zBuffer.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/* 7zBuffer.c */
-
-#include "7zBuffer.h"
-#include "7zAlloc.h"
-
-void SzByteBufferInit(CSzByteBuffer *buffer)
-{
-  buffer->Capacity = 0;
-  buffer->Items = 0;
-}
-
-int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size))
-{
-  buffer->Capacity = newCapacity;
-  if (newCapacity == 0)
-  {
-    buffer->Items = 0;
-    return 1;
-  }
-  buffer->Items = (Byte *)allocFunc(newCapacity);
-  return (buffer->Items != 0);
-}
-
-void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *))
-{
-  freeFunc(buffer->Items);
-  buffer->Items = 0;
-  buffer->Capacity = 0;
-}
--- a/misc/libphysfs/lzma/C/Archive/7z/7zBuffer.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/* 7zBuffer.h */
-
-#ifndef __7Z_BUFFER_H
-#define __7Z_BUFFER_H
-
-#include <stddef.h>
-#include "../../Types.h"
-
-typedef struct _CSzByteBuffer
-{
-  size_t Capacity;
-  Byte *Items;
-}CSzByteBuffer;
-
-void SzByteBufferInit(CSzByteBuffer *buffer);
-int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size));
-void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *));
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zDecode.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +0,0 @@
-/* 7zDecode.c */
-
-#include <memory.h>
-
-/* BEGIN PHYSFS CHANGE */
-#include <string.h>
-/* END PHYSFS CHANGE */
-
-#include "7zDecode.h"
-#ifdef _SZ_ONE_DIRECTORY
-#include "LzmaDecode.h"
-#else
-#include "../../Compress/Lzma/LzmaDecode.h"
-#include "../../Compress/Branch/BranchX86.h"
-#include "../../Compress/Branch/BranchX86_2.h"
-#endif
-
-#define k_Copy 0
-#define k_LZMA 0x30101
-#define k_BCJ 0x03030103
-#define k_BCJ2 0x0303011B
-
-#ifdef _LZMA_IN_CB
-
-typedef struct _CLzmaInCallbackImp
-{
-  ILzmaInCallback InCallback;
-  ISzInStream *InStream;
-  CFileSize Size;
-} CLzmaInCallbackImp;
-
-int LzmaReadImp(void *object, const unsigned char **buffer, SizeT *size)
-{
-  CLzmaInCallbackImp *cb = (CLzmaInCallbackImp *)object;
-  size_t processedSize;
-  SZ_RESULT res;
-  size_t curSize = (1 << 20);
-  if (curSize > cb->Size)
-    curSize = (size_t)cb->Size;
-  *size = 0;
-  res = cb->InStream->Read((void *)cb->InStream, (void **)buffer, curSize, &processedSize);
-  *size = (SizeT)processedSize;
-  if (processedSize > curSize)
-    return (int)SZE_FAIL;
-  cb->Size -= processedSize;
-  if (res == SZ_OK)
-    return 0;
-  return (int)res;
-}
-
-#endif
-
-SZ_RESULT SzDecodeLzma(CCoderInfo *coder, CFileSize inSize,
-    #ifdef _LZMA_IN_CB
-    ISzInStream *inStream,
-    #else
-    const Byte *inBuffer,
-    #endif
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
-{
-  #ifdef _LZMA_IN_CB
-  CLzmaInCallbackImp lzmaCallback;
-  #else
-  SizeT inProcessed;
-  #endif
-  
-  CLzmaDecoderState state;  /* it's about 24-80 bytes structure, if int is 32-bit */
-  int result;
-  SizeT outSizeProcessedLoc;
-  
-  #ifdef _LZMA_IN_CB
-  lzmaCallback.Size = inSize;
-  lzmaCallback.InStream = inStream;
-  lzmaCallback.InCallback.Read = LzmaReadImp;
-  #endif
-  
-  if (LzmaDecodeProperties(&state.Properties, coder->Properties.Items, 
-      (unsigned)coder->Properties.Capacity) != LZMA_RESULT_OK)
-    return SZE_FAIL;
-  
-  state.Probs = (CProb *)allocMain->Alloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
-  if (state.Probs == 0)
-    return SZE_OUTOFMEMORY;
-  
-  #ifdef _LZMA_OUT_READ
-  if (state.Properties.DictionarySize == 0)
-    state.Dictionary = 0;
-  else
-  {
-    state.Dictionary = (unsigned char *)allocMain->Alloc(state.Properties.DictionarySize);
-    if (state.Dictionary == 0)
-    {
-      allocMain->Free(state.Probs);
-      return SZE_OUTOFMEMORY;
-    }
-  }
-  LzmaDecoderInit(&state);
-  #endif
-  
-  result = LzmaDecode(&state,
-  #ifdef _LZMA_IN_CB
-    &lzmaCallback.InCallback,
-  #else
-    inBuffer, (SizeT)inSize, &inProcessed,
-  #endif
-    outBuffer, (SizeT)outSize, &outSizeProcessedLoc);
-  allocMain->Free(state.Probs);
-  #ifdef _LZMA_OUT_READ
-  allocMain->Free(state.Dictionary);
-  #endif
-  if (result == LZMA_RESULT_DATA_ERROR)
-    return SZE_DATA_ERROR;
-  if (result != LZMA_RESULT_OK)
-    return SZE_FAIL;
-  return (outSizeProcessedLoc == outSize) ? SZ_OK : SZE_DATA_ERROR;
-}
-
-#ifdef _LZMA_IN_CB
-SZ_RESULT SzDecodeCopy(CFileSize inSize, ISzInStream *inStream, Byte *outBuffer)
-{
-  while (inSize > 0)
-  {
-    void *inBuffer;
-    size_t processedSize, curSize = (1 << 18);
-    if (curSize > inSize)
-      curSize = (size_t)(inSize);
-    RINOK(inStream->Read((void *)inStream, (void **)&inBuffer, curSize, &processedSize));
-    if (processedSize == 0)
-      return SZE_DATA_ERROR;
-    if (processedSize > curSize)
-      return SZE_FAIL;
-    memcpy(outBuffer, inBuffer, processedSize);
-    outBuffer += processedSize;
-    inSize -= processedSize;
-  }
-  return SZ_OK;
-}
-#endif
-
-#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
-#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
-
-SZ_RESULT CheckSupportedFolder(const CFolder *f)
-{
-  if (f->NumCoders < 1 || f->NumCoders > 4)
-    return SZE_NOTIMPL;
-  if (IS_UNSUPPORTED_CODER(f->Coders[0]))
-    return SZE_NOTIMPL;
-  if (f->NumCoders == 1)
-  {
-    if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
-      return SZE_NOTIMPL;
-    return SZ_OK;
-  }
-  if (f->NumCoders == 2)
-  {
-    if (IS_NO_BCJ(f->Coders[1]) ||
-        f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
-        f->NumBindPairs != 1 ||
-        f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
-      return SZE_NOTIMPL;
-    return SZ_OK;
-  }
-  if (f->NumCoders == 4)
-  {
-    if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
-        IS_UNSUPPORTED_CODER(f->Coders[2]) ||
-        IS_NO_BCJ2(f->Coders[3]))
-      return SZE_NOTIMPL;
-    if (f->NumPackStreams != 4 || 
-        f->PackStreams[0] != 2 ||
-        f->PackStreams[1] != 6 ||
-        f->PackStreams[2] != 1 ||
-        f->PackStreams[3] != 0 ||
-        f->NumBindPairs != 3 ||
-        f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
-        f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
-        f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
-      return SZE_NOTIMPL;
-    return SZ_OK;
-  }
-  return SZE_NOTIMPL;
-}
-
-CFileSize GetSum(const CFileSize *values, UInt32 index)
-{
-  CFileSize sum = 0;
-  UInt32 i;
-  for (i = 0; i < index; i++)
-    sum += values[i];
-  return sum;
-}
-
-SZ_RESULT SzDecode2(const CFileSize *packSizes, const CFolder *folder,
-    #ifdef _LZMA_IN_CB
-    ISzInStream *inStream, CFileSize startPos,
-    #else
-    const Byte *inBuffer,
-    #endif
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain,
-    Byte *tempBuf[])
-{
-  UInt32 ci;
-  size_t tempSizes[3] = { 0, 0, 0};
-  size_t tempSize3 = 0;
-  Byte *tempBuf3 = 0;
-
-  RINOK(CheckSupportedFolder(folder));
-
-  for (ci = 0; ci < folder->NumCoders; ci++)
-  {
-    CCoderInfo *coder = &folder->Coders[ci];
-
-    if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
-    {
-      UInt32 si = 0;
-      CFileSize offset;
-      CFileSize inSize;
-      Byte *outBufCur = outBuffer;
-      size_t outSizeCur = outSize;
-      if (folder->NumCoders == 4)
-      {
-        UInt32 indices[] = { 3, 2, 0 };
-        CFileSize unpackSize = folder->UnPackSizes[ci];
-        si = indices[ci];
-        if (ci < 2)
-        {
-          Byte *temp;
-          outSizeCur = (size_t)unpackSize;
-          if (outSizeCur != unpackSize)
-            return SZE_OUTOFMEMORY;
-          temp = (Byte *)allocMain->Alloc(outSizeCur);
-          if (temp == 0 && outSizeCur != 0)
-            return SZE_OUTOFMEMORY;
-          outBufCur = tempBuf[1 - ci] = temp;
-          tempSizes[1 - ci] = outSizeCur;
-        }
-        else if (ci == 2)
-        {
-          if (unpackSize > outSize)
-            return SZE_OUTOFMEMORY;
-          tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
-          tempSize3 = outSizeCur = (size_t)unpackSize;
-        }
-        else
-          return SZE_NOTIMPL;
-      }
-      offset = GetSum(packSizes, si);
-      inSize = packSizes[si];
-      #ifdef _LZMA_IN_CB
-      RINOK(inStream->Seek(inStream, startPos + offset));
-      #endif
-
-      if (coder->MethodID == k_Copy)
-      {
-        if (inSize != outSizeCur)
-          return SZE_DATA_ERROR;
-        
-        #ifdef _LZMA_IN_CB
-        RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
-        #else
-        memcpy(outBufCur, inBuffer + (size_t)offset, (size_t)inSize);
-        #endif
-      }
-      else
-      {
-        SZ_RESULT res = SzDecodeLzma(coder, inSize,
-            #ifdef _LZMA_IN_CB
-            inStream,
-            #else
-            inBuffer + (size_t)offset,
-            #endif
-            outBufCur, outSizeCur, allocMain);
-        RINOK(res)
-      }
-    }
-    else if (coder->MethodID == k_BCJ)
-    {
-      UInt32 state;
-      if (ci != 1)
-        return SZE_NOTIMPL;
-      x86_Convert_Init(state);
-      x86_Convert(outBuffer, outSize, 0, &state, 0);
-    }
-    else if (coder->MethodID == k_BCJ2)
-    {
-      CFileSize offset = GetSum(packSizes, 1);
-      CFileSize s3Size = packSizes[1];
-      SZ_RESULT res;
-      if (ci != 3)
-        return SZE_NOTIMPL;
-
-      #ifdef _LZMA_IN_CB
-      RINOK(inStream->Seek(inStream, startPos + offset));
-      tempSizes[2] = (size_t)s3Size;
-      if (tempSizes[2] != s3Size)
-        return SZE_OUTOFMEMORY;
-      tempBuf[2] = (Byte *)allocMain->Alloc(tempSizes[2]);
-      if (tempBuf[2] == 0 && tempSizes[2] != 0)
-        return SZE_OUTOFMEMORY;
-      res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
-      RINOK(res)
-      #endif
-
-      res = x86_2_Decode(
-          tempBuf3, tempSize3, 
-          tempBuf[0], tempSizes[0], 
-          tempBuf[1], tempSizes[1], 
-          #ifdef _LZMA_IN_CB
-          tempBuf[2], tempSizes[2], 
-          #else
-          inBuffer + (size_t)offset, (size_t)s3Size, 
-          #endif
-          outBuffer, outSize);
-      RINOK(res)
-    }
-    else 
-      return SZE_NOTIMPL;
-  }
-  return SZ_OK;
-}
-
-SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
-    #ifdef _LZMA_IN_CB
-    ISzInStream *inStream, CFileSize startPos,
-    #else
-    const Byte *inBuffer,
-    #endif
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
-{
-  Byte *tempBuf[3] = { 0, 0, 0};
-  int i;
-  SZ_RESULT res = SzDecode2(packSizes, folder,
-      #ifdef _LZMA_IN_CB
-      inStream, startPos,
-      #else
-      inBuffer,
-      #endif
-      outBuffer, outSize, allocMain, tempBuf);
-  for (i = 0; i < 3; i++)
-    allocMain->Free(tempBuf[i]);
-  return res;
-}
--- a/misc/libphysfs/lzma/C/Archive/7z/7zDecode.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/* 7zDecode.h */
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "7zItem.h"
-#include "7zAlloc.h"
-#ifdef _LZMA_IN_CB
-#include "7zIn.h"
-#endif
-
-SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
-    #ifdef _LZMA_IN_CB
-    ISzInStream *stream, CFileSize startPos,
-    #else
-    const Byte *inBuffer,
-    #endif
-    Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zExtract.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* 7zExtract.c */
-
-#include "7zExtract.h"
-#include "7zDecode.h"
-#include "../../7zCrc.h"
-
-SZ_RESULT SzExtract(
-    ISzInStream *inStream, 
-    CArchiveDatabaseEx *db,
-    UInt32 fileIndex,
-    UInt32 *blockIndex,
-    Byte **outBuffer, 
-    size_t *outBufferSize,
-    size_t *offset, 
-    size_t *outSizeProcessed, 
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp)
-{
-  UInt32 folderIndex = db->FileIndexToFolderIndexMap[fileIndex];
-  SZ_RESULT res = SZ_OK;
-  *offset = 0;
-  *outSizeProcessed = 0;
-  if (folderIndex == (UInt32)-1)
-  {
-    allocMain->Free(*outBuffer);
-    *blockIndex = folderIndex;
-    *outBuffer = 0;
-    *outBufferSize = 0;
-    return SZ_OK;
-  }
-
-  if (*outBuffer == 0 || *blockIndex != folderIndex)
-  {
-    CFolder *folder = db->Database.Folders + folderIndex;
-    CFileSize unPackSizeSpec = SzFolderGetUnPackSize(folder);
-    size_t unPackSize = (size_t)unPackSizeSpec;
-    CFileSize startOffset = SzArDbGetFolderStreamPos(db, folderIndex, 0);
-    #ifndef _LZMA_IN_CB
-    Byte *inBuffer = 0;
-    size_t processedSize;
-    CFileSize packSizeSpec;
-    size_t packSize;
-    RINOK(SzArDbGetFolderFullPackSize(db, folderIndex, &packSizeSpec));
-    packSize = (size_t)packSizeSpec;
-    if (packSize != packSizeSpec)
-      return SZE_OUTOFMEMORY;
-    #endif
-    if (unPackSize != unPackSizeSpec)
-      return SZE_OUTOFMEMORY;
-    *blockIndex = folderIndex;
-    allocMain->Free(*outBuffer);
-    *outBuffer = 0;
-    
-    RINOK(inStream->Seek(inStream, startOffset));
-    
-    #ifndef _LZMA_IN_CB
-    if (packSize != 0)
-    {
-      inBuffer = (Byte *)allocTemp->Alloc(packSize);
-      if (inBuffer == 0)
-        return SZE_OUTOFMEMORY;
-    }
-    res = inStream->Read(inStream, inBuffer, packSize, &processedSize);
-    if (res == SZ_OK && processedSize != packSize)
-      res = SZE_FAIL;
-    #endif
-    if (res == SZ_OK)
-    {
-      *outBufferSize = unPackSize;
-      if (unPackSize != 0)
-      {
-        *outBuffer = (Byte *)allocMain->Alloc(unPackSize);
-        if (*outBuffer == 0)
-          res = SZE_OUTOFMEMORY;
-      }
-      if (res == SZ_OK)
-      {
-        res = SzDecode(db->Database.PackSizes + 
-          db->FolderStartPackStreamIndex[folderIndex], folder, 
-          #ifdef _LZMA_IN_CB
-          inStream, startOffset, 
-          #else
-          inBuffer, 
-          #endif
-          *outBuffer, unPackSize, allocTemp);
-        if (res == SZ_OK)
-        {
-          if (folder->UnPackCRCDefined)
-          {
-            if (CrcCalc(*outBuffer, unPackSize) != folder->UnPackCRC)
-              res = SZE_CRC_ERROR;
-          }
-        }
-      }
-    }
-    #ifndef _LZMA_IN_CB
-    allocTemp->Free(inBuffer);
-    #endif
-  }
-  if (res == SZ_OK)
-  {
-    UInt32 i; 
-    CFileItem *fileItem = db->Database.Files + fileIndex;
-    *offset = 0;
-    for(i = db->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
-      *offset += (UInt32)db->Database.Files[i].Size;
-    *outSizeProcessed = (size_t)fileItem->Size;
-    if (*offset + *outSizeProcessed > *outBufferSize)
-      return SZE_FAIL;
-    {
-      if (fileItem->IsFileCRCDefined)
-      {
-        if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
-          res = SZE_CRC_ERROR;
-      }
-    }
-  }
-  return res;
-}
--- a/misc/libphysfs/lzma/C/Archive/7z/7zExtract.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* 7zExtract.h */
-
-#ifndef __7Z_EXTRACT_H
-#define __7Z_EXTRACT_H
-
-#include "7zIn.h"
-
-/*
-  SzExtract extracts file from archive
-
-  *outBuffer must be 0 before first call for each new archive. 
-
-  Extracting cache:
-    If you need to decompress more than one file, you can send 
-    these values from previous call:
-      *blockIndex, 
-      *outBuffer, 
-      *outBufferSize
-    You can consider "*outBuffer" as cache of solid block. If your archive is solid, 
-    it will increase decompression speed.
-  
-    If you use external function, you can declare these 3 cache variables 
-    (blockIndex, outBuffer, outBufferSize) as static in that external function.
-    
-    Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
-*/
-
-SZ_RESULT SzExtract(
-    ISzInStream *inStream, 
-    CArchiveDatabaseEx *db,
-    UInt32 fileIndex,         /* index of file */
-    UInt32 *blockIndex,       /* index of solid block */
-    Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */
-    size_t *outBufferSize,    /* buffer size for output buffer */
-    size_t *offset,           /* offset of stream for required file in *outBuffer */
-    size_t *outSizeProcessed, /* size of file in *outBuffer */
-    ISzAlloc *allocMain,
-    ISzAlloc *allocTemp);
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zHeader.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-/*  7zHeader.c */
-
-#include "7zHeader.h"
-
-Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
--- a/misc/libphysfs/lzma/C/Archive/7z/7zHeader.h	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* 7zHeader.h */
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "../../Types.h"
-
-#define k7zSignatureSize 6
-extern Byte k7zSignature[k7zSignatureSize];
-
-#define k7zMajorVersion 0
-
-#define k7zStartHeaderSize 0x20
-
-enum EIdEnum
-{
-  k7zIdEnd,
-    
-  k7zIdHeader,
-    
-  k7zIdArchiveProperties,
-    
-  k7zIdAdditionalStreamsInfo,
-  k7zIdMainStreamsInfo,
-  k7zIdFilesInfo,
-  
-  k7zIdPackInfo,
-  k7zIdUnPackInfo,
-  k7zIdSubStreamsInfo,
-  
-  k7zIdSize,
-  k7zIdCRC,
-  
-  k7zIdFolder,
-  
-  k7zIdCodersUnPackSize,
-  k7zIdNumUnPackStream,
-  
-  k7zIdEmptyStream,
-  k7zIdEmptyFile,
-  k7zIdAnti,
-  
-  k7zIdName,
-  k7zIdCreationTime,
-  k7zIdLastAccessTime,
-  k7zIdLastWriteTime,
-  k7zIdWinAttributes,
-  k7zIdComment,
-  
-  k7zIdEncodedHeader,
-  
-  k7zIdStartPos
-};
-
-#endif
--- a/misc/libphysfs/lzma/C/Archive/7z/7zIn.c	Thu Oct 11 23:43:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1314 +0,0 @@
-/* 7zIn.c */
-
-#include "7zIn.h"
-#include "7zDecode.h"
-#include "../../7zCrc.h"
-
-#define RINOM(x) { if((x) == 0) return SZE_OUTOFMEMORY; }
-
-void SzArDbExInit(CArchiveDatabaseEx *db)
-{
-  SzArchiveDatabaseInit(&db->Database);
-  db->FolderStartPackStreamIndex = 0;
-  db->PackStreamStartPositions = 0;
-  db->FolderStartFileIndex = 0;
-  db->FileIndexToFolderIndexMap = 0;
-}
-
-void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *))
-{
-  freeFunc(db->FolderStartPackStreamIndex);
-  freeFunc(db->PackStreamStartPositions);
-  freeFunc(db->FolderStartFileIndex);
-  freeFunc(db->FileIndexToFolderIndexMap);
-  SzArchiveDatabaseFree(&db->Database, freeFunc);
-  SzArDbExInit(db);
-}
-
-/*
-CFileSize GetFolderPackStreamSize(int folderIndex, int streamIndex) const 
-{
-  return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
-}
-
-CFileSize GetFilePackSize(int fileIndex) const
-{
-  int folderIndex = FileIndexToFolderIndexMap[fileIndex];
-  if (folderIndex >= 0)
-  {
-    const CFolder &folderInfo = Folders[folderIndex];
-    if (FolderStartFileIndex[folderIndex] == fileIndex)
-    return GetFolderFullPackSize(folderIndex);
-  }
-  return 0;
-}
-*/
-
-#define MY_ALLOC(T, p, size, allocFunc) { if ((size) == 0) p = 0; else \
-  if ((p = (T *)allocFunc((size) * sizeof(T))) == 0) return SZE_OUTOFMEMORY; }
-
-SZ_RESULT SzArDbExFill(CArchiveDatabaseEx *db, void * (*allocFunc)(size_t size))
-{
-  UInt32 startPos = 0;
-  CFileSize startPosSize = 0;
-  UInt32 i;
-  UInt32 folderIndex = 0;
-  UInt32 indexInFolder = 0;
-  MY_ALLOC(UInt32, db->FolderStartPackStreamIndex, db->Database.NumFolders, allocFunc);
-  for(i = 0; i < db->Database.NumFolders; i++)
-  {
-    db->FolderStartPackStreamIndex[i] = startPos;
-    startPos += db->Database.Folders[i].NumPackStreams;
-  }
-
-  MY_ALLOC(CFileSize, db->PackStreamStartPositions, db->Database.NumPackStreams, allocFunc);
-
-  for(i = 0; i < db->Database.NumPackStreams; i++)
-  {
-    db->PackStreamStartPositions[i] = startPosSize;
-    startPosSize += db->Database.PackSizes[i];
-  }
-
-  MY_ALLOC(UInt32, db->FolderStartFileIndex, db->Database.NumFolders, allocFunc);
-  MY_ALLOC(UInt32, db->FileIndexToFolderIndexMap, db->Database.NumFiles, allocFunc);
-
-  for (i = 0; i < db->Database.NumFiles; i++)
-  {
-    CFileItem *file = db->Database.Files + i;
-    int emptyStream = !file->HasStream;
-    if (emptyStream && indexInFolder == 0)
-    {
-      db->FileIndexToFolderIndexMap[i] = (UInt32)-1;
-      continue;
-    }
-    if (indexInFolder == 0)
-    {
-      /*
-      v3.13 incorrectly worked with empty folders
-      v4.07: Loop for skipping empty folders
-      */
-      for (;;)
-      {
-        if (folderIndex >= db->Database.NumFolders)
-          return SZE_ARCHIVE_ERROR;
-        db->FolderStartFileIndex[folderIndex] = i;
-        if (db->Database.Folders[folderIndex].NumUnPackStreams != 0)
-          break;
-        folderIndex++;
-      }
-    }
-    db->FileIndexToFolderIndexMap[i] = folderIndex;
-    if (emptyStream)
-      continue;
-    indexInFolder++;
-    if (indexInFolder >= db->Database.Folders[folderIndex].NumUnPackStreams)
-    {
-      folderIndex++;
-      indexInFolder = 0;
-    }
-  }
-  return SZ_OK;
-}
-
-
-CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder)
-{
-  return db->ArchiveInfo.DataStartPosition + 
-    db->PackStreamStartPositions[db->FolderStartPackStreamIndex[folderIndex] + indexInFolder];
-}
-
-int SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex, CFileSize *resSize)
-{
-  UInt32 packStreamIndex = db->FolderStartPackStreamIndex[folderIndex];
-  CFolder *folder = db->Database.Folders + folderIndex;
-  CFileSize size = 0;
-  UInt32 i;
-  for (i = 0; i < folder->NumPackStreams; i++)
-  {
-    CFileSize t = size + db->Database.PackSizes[packStreamIndex + i];
-    if (t < size)
-      return SZE_FAIL;
-    size = t;
-  }
-  *resSize = size;
-  return SZ_OK;
-}
-
-
-/*
-SZ_RESULT SzReadTime(const CObjectVector<CSzByteBuffer> &dataVector,
-    CObjectVector<CFileItem> &files, UInt64 type)
-{
-  CBoolVector boolVector;
-  RINOK(ReadBoolVector2(files.Size(), boolVector))
-
-  CStreamSwitch streamSwitch;
-  RINOK(streamSwitch.Set(this, &dataVector));
-
-  for(int i = 0; i < files.Size(); i++)
-  {
-    CFileItem &file = files[i];
-    CArchiveFileTime fileTime;
-    bool defined = boolVector[i];
-    if (defined)
-    {
-      UInt32 low, high;
-      RINOK(SzReadUInt32(low));
-      RINOK(SzReadUInt32(high));
-      fileTime.dwLowDateTime = low;
-      fileTime.dwHighDateTime = high;
-    }
-    switch(type)
-    {
-      case k7zIdCreationTime:
-        file.IsCreationTimeDefined = defined;
-        if (defined)
-          file.CreationTime = fileTime;
-        break;
-      case k7zIdLastWriteTime:
-        file.IsLastWriteTimeDefined = defined;
-        if (defined)
-          file.LastWriteTime = fileTime;
-        break;
-      case k7zIdLastAccessTime:
-        file.IsLastAccessTimeDefined = defined;
-        if (defined)
-          file.LastAccessTime = fileTime;
-        break;
-    }
-  }
-  return SZ_OK;
-}
-*/
-
-SZ_RESULT SafeReadDirect(ISzInStream *inStream, Byte *data, size_t size)
-{
-  #ifdef _LZMA_IN_CB
-  while (size > 0)
-  {
-    void *inBufferSpec;
-    size_t processedSize;
-    const Byte *inBuffer;
-    RINOK(inStream->Read(inStream, (void **)&inBufferSpec, size, &processedSize));
-    inBuffer = (const Byte *)inBufferSpec;
-    if (processedSize == 0 || processedSize > size)
-      return SZE_FAIL;
-    size -= processedSize;
-    do
-    {
-      *data++ = *inBuffer++;
-    }
-    while (--processedSize != 0);
-  }
-  #else
-  size_t processedSize;
-  RINOK(inStream->Read(inStream, data, size, &processedSize));
-  if (processedSize != size)
-    return SZE_FAIL;
-  #endif
-  return SZ_OK;
-}
-
-SZ_RESULT SafeReadDirectByte(ISzInStream *inStream, Byte *data)
-{
-  return SafeReadDirect(inStream, data, 1);
-}
-
-SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value, UInt32 *crc)
-{
-  int i;
-  *value = 0;
-  for (i = 0; i < 4; i++)
-  {
-    Byte b;
-    RINOK(SafeReadDirectByte(inStream, &b));
-    *value |= ((UInt32)b << (8 * i));
-    *crc = CRC_UPDATE_BYTE(*crc, b);
-  }
-  return SZ_OK;
-}
-
-SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value, UInt32 *crc)
-{
-  int i;
-  *value = 0;
-  for (i = 0; i < 8; i++)
-  {
-    Byte b;
-    RINOK(SafeReadDirectByte(inStream, &b));
-    *value |= ((UInt64)b << (8 * i));
-    *crc = CRC_UPDATE_BYTE(*crc, b);
-  }
-  return SZ_OK;
-}
-
-int TestSignatureCandidate(Byte *testBytes)
-{
-  size_t i;
-  for (i = 0; i < k7zSignatureSize; i++)
-    if (testBytes[i] != k7zSignature[i])
-      return 0;
-  return 1;
-}
-
-typedef struct _CSzState
-{
-  Byte *Data;
-  size_t Size;