diff --git a/binaries/system/readme.txt b/binaries/system/readme.txt index e49744327e..b971defd84 100644 --- a/binaries/system/readme.txt +++ b/binaries/system/readme.txt @@ -61,5 +61,7 @@ Windows-specific: Archive builder: -archivebuild=PATH system PATH of the base directory containing mod data to be archived/precached -archivebuild-output=PATH system PATH to output of the resulting .zip archive (use with archivebuild) +-archivebuild-compress enable deflate compression in the .zip + (no zip compression by default since it hurts compression of release packages) -buildarchive (disabled) diff --git a/source/main.cpp b/source/main.cpp index c2587129c2..5421d5c719 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -509,7 +509,7 @@ static void RunGameOrAtlas(int argc, const char* argv[]) zip = mod.Filename().ChangeExtension(L".zip"); CArchiveBuilder builder(mod, paths.Cache()); - builder.Build(zip); + builder.Build(zip, args.Has("archivebuild-compress")); CXeromyces::Terminate(); return; diff --git a/source/ps/ArchiveBuilder.cpp b/source/ps/ArchiveBuilder.cpp index 1d6b439f3f..3315075039 100644 --- a/source/ps/ArchiveBuilder.cpp +++ b/source/ps/ArchiveBuilder.cpp @@ -64,14 +64,14 @@ void CArchiveBuilder::AddBaseMod(const OsPath& mod) m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST); } -void CArchiveBuilder::Build(const OsPath& archive) +void CArchiveBuilder::Build(const OsPath& archive, bool compress) { - // Disable zip compression because it significantly hurts download size - // for releases (which re-compress all files with better compression + // By default we 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; + const bool noDeflate = !compress; PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate); diff --git a/source/ps/ArchiveBuilder.h b/source/ps/ArchiveBuilder.h index 81dc405987..ad1ba4ad79 100644 --- a/source/ps/ArchiveBuilder.h +++ b/source/ps/ArchiveBuilder.h @@ -52,8 +52,9 @@ public: /** * Do all the processing and packing of files into the archive. * @param archive path of .zip file to generate (will be overwritten if it exists) + * @param compress whether to compress the contents of the .zip file */ - void Build(const OsPath& archive); + void Build(const OsPath& archive, bool compress); private: static Status CollectFileCB(const VfsPath& pathname, const FileInfo& fileInfo, const uintptr_t cbData);