1
1
forked from 0ad/0ad

Disable compression of public.zip (fixes #671).

This was SVN commit r8785.
This commit is contained in:
Ykkrosh 2010-12-04 15:57:55 +00:00
parent 4b37898ab9
commit 4575c26616
3 changed files with 16 additions and 7 deletions

View File

@ -527,10 +527,10 @@ PIArchiveReader CreateArchiveReader_Zip(const fs::wpath& archivePathname)
class ArchiveWriter_Zip : public IArchiveWriter class ArchiveWriter_Zip : public IArchiveWriter
{ {
public: public:
ArchiveWriter_Zip(const fs::wpath& archivePathname) ArchiveWriter_Zip(const fs::wpath& archivePathname, bool noDeflate)
: m_file(new File(archivePathname, 'w')), m_fileSize(0) : m_file(new File(archivePathname, 'w')), m_fileSize(0)
, m_unalignedWriter(new UnalignedWriter(m_file, 0)) , m_unalignedWriter(new UnalignedWriter(m_file, 0))
, m_numEntries(0) , m_numEntries(0), m_noDeflate(noDeflate)
{ {
THROW_ERR(pool_create(&m_cdfhPool, 10*MiB, 0)); THROW_ERR(pool_create(&m_cdfhPool, 10*MiB, 0));
} }
@ -585,7 +585,7 @@ public:
// choose method and the corresponding codec // choose method and the corresponding codec
ZipMethod method; ZipMethod method;
PICodec codec; PICodec codec;
if(IsFileTypeIncompressible(pathname)) if(m_noDeflate || IsFileTypeIncompressible(pathname))
{ {
method = ZIP_METHOD_NONE; method = ZIP_METHOD_NONE;
codec = CreateCodec_ZLibNone(); codec = CreateCodec_ZLibNone();
@ -665,9 +665,11 @@ private:
Pool m_cdfhPool; Pool m_cdfhPool;
size_t m_numEntries; size_t m_numEntries;
bool m_noDeflate;
}; };
PIArchiveWriter CreateArchiveWriter_Zip(const fs::wpath& archivePathname) PIArchiveWriter CreateArchiveWriter_Zip(const fs::wpath& archivePathname, bool noDeflate)
{ {
return PIArchiveWriter(new ArchiveWriter_Zip(archivePathname)); return PIArchiveWriter(new ArchiveWriter_Zip(archivePathname, noDeflate));
} }

View File

@ -30,6 +30,6 @@
#include "lib/file/archive/archive.h" #include "lib/file/archive/archive.h"
LIB_API PIArchiveReader CreateArchiveReader_Zip(const fs::wpath& archivePathname); LIB_API PIArchiveReader CreateArchiveReader_Zip(const fs::wpath& archivePathname);
LIB_API PIArchiveWriter CreateArchiveWriter_Zip(const fs::wpath& archivePathname); LIB_API PIArchiveWriter CreateArchiveWriter_Zip(const fs::wpath& archivePathname, bool noDeflate);
#endif // #ifndef INCLUDED_ARCHIVE_ZIP #endif // #ifndef INCLUDED_ARCHIVE_ZIP

View File

@ -65,7 +65,14 @@ void CArchiveBuilder::AddBaseMod(const fs::wpath& mod)
void CArchiveBuilder::Build(const fs::wpath& archive) void CArchiveBuilder::Build(const fs::wpath& archive)
{ {
PIArchiveWriter writer = CreateArchiveWriter_Zip(archive); // Disable zip compression because it significantly hurts download size
// for releases (which re-compress all files with better compression
// algorithms) - it's probably most important currently to optimise for
// download size rather than install size or startup performance.
// (See http://trac.wildfiregames.com/ticket/671)
const bool noDeflate = true;
PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate);
// Use CTextureManager instead of CTextureConverter directly, // Use CTextureManager instead of CTextureConverter directly,
// so it can deal with all the loading of settings.xml files // so it can deal with all the loading of settings.xml files