Search Unity

[RELEASED] zip / gzip native multiplatfrom plugin

Discussion in 'Assets and Asset Store' started by elias_t, Jul 8, 2015.

  1. s0phist

    s0phist

    Joined:
    Mar 30, 2011
    Posts:
    40
    This has been working great for me on iOS but when I moved to tvOS I'm running into problems when I build:

    Assets/Plugins/lzip.cs(509,15): error CS0103: The name 'zipValidateFile' does not exist in the current context

    MacOS 10.15
    Unity 2019.3.0b10 (Unity 2019.2 latest exhibits this, too)
    .Net 4.0

    Any ideas appreciated!
     

    Attached Files:

    Last edited: Dec 11, 2019
  2. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Edit: It seems that the UNITY_TVOS preproccessor is not working ...

    Edit2: ok. The issue is that from a unity version and on UNITY_IOS is not working for TVOS. I will send a fixed script to you in a few minutes.
     
    Last edited: Dec 11, 2019
  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Please check your pm. I sent you a fixed lzip.cs script with preprocessor directives that should fix your issue.
     
  4. s0phist

    s0phist

    Joined:
    Mar 30, 2011
    Posts:
    40
    Thank you, this worked great.
     
  5. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update version1.61 [Major update]

    Released: Jan 13, 2020

    - WebGL has now full zip support. Obviously not on the file system but on memory buffers. (bz2 method not supported yet.)
    - Webgl got zlib buffer support again. (Was misplaced in a previous update.)
    - Added the ability to find merged/hidden zip/gzip archives in files or buffers and extract/get info from them.
    - tvOS: fixed preprocessor issues on newer versions of Unity.
    - iOS/tvOS: fixed potential issues with admob/facebook/google sdk.
    - Windows/Android: fixed bz2 issue.
    - bz2 method support for inmemory compression. (not for macos/ios/tvos/webgl.)
    - plugin binary sizes got smaller.
     
    Last edited: Jan 13, 2020
  6. Legend_Bacon

    Legend_Bacon

    Joined:
    Jan 19, 2016
    Posts:
    3
    Hello there,

    I've been using this plugin for a while, and it has always worked wonderfully until now.

    I'm having some trouble specifically on MacOS while trying to upload to the MAC app store.
    While the plugin works in an AdHoc build, when I try to upload via the Transporter app it gives me the following error:

    ERROR ITMS-90511: "CFBundleIdentifier Collision. The Info.plist CFBundleIdentifier value 'com.zipw.libzipw' of 'MyAppName.app/Contents/Plugins/libzipw.bundle' is already in use by another application."


    Do you know what could be causing this?

    MacOS version: Catalina 10.15.2
    Plugin version: 1.61
    Unity version: 2018.3.6f1
     
  7. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    According to this:
    Show the contents of the bundle, find info.plist and change the bundle identifier from com.zip.libzipw to something unique. It seems that someone used this identifier to publish on the store.
     
  8. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.62

    - Critical fix for the inMemory zip creation functions. All users that use these functions should update to this version.
    - Added a public function to the inMemory struct for getting the byte[] buffer of the inMemory created zip.
     
  9. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.63

    - Using compress_File/compress_File_List/compressDir to append multiple files to a zip were very slow. Now compress_File_List and compressDir work very fast.
    - For the same reason the inMemory class got some low level functions to allow much faster appending of multiple entries. See examples and docs.


    If you are publishing for MacOS on the AppStore please do the following to codesign the bundle:

    1. Remove all the meta files from inside the .bundle.
    2. Remove (if any) folder named CodeSignature.
    3. Find the Info.plist file and change the bundleID to one of your own.
     
    Legend_Bacon likes this.
  10. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.64

    - Hotfix for the compressDir/compress_File_List functions. The plugin could crash when thousands of files were going to get compressed.
     
  11. cloudyddd

    cloudyddd

    Joined:
    Feb 8, 2020
    Posts:
    1
    upload_2020-2-10_10-48-53.png
    The proc parameter will overflow when use lzip.decompress_File API to decompress large files (larger than 2G).
     
  12. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Thanks for the heads-up. Will upload a fix shortly.
     
  13. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.65

    - Process of decompression in bytes now returned as ulong.
    - Fixed an issue with ios/tvOS caused by the 1.64 update.
     
  14. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.66

    - fixed WebGL issues on Unity 2019.x
    - fixed ios/tvos issue with bitcode plugins on xcode 11.x

    Now bitcode versions of the plugin are available compiled by xcode 10.3 and xcode 11.4.
     
  15. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update version 1.7 (Important feature and maintenance update)

    - Setting level of compression to zero will now use the STORE method.

    - Added the setCancel() function to cancel the compress_File, compressDir, compress_File_List, decompress_File, extract_entry, entry2Buffer functions.

    - Added the ability to get byte level progress when compressing files.

    - Android arm64-v8a plugin should decompress files larger then 2GB now.

    - Windows: compression with unicode characters in path should work correct now.

    - The getEntrySize function returns a ulong value now.

    - The getFileInfo function filled Lists for uncompressed, compressed and localOffset are filled with UInt64 values now.

    - The getFileInfo function fills a new list localOffset. Useful for archives with the STORE method to find the position in the zip. (you should add + 30 bytes + name.length to get the final offset)

    - Demo script updated to reflect the new changes.
     
  16. egorovsa2

    egorovsa2

    Joined:
    Apr 14, 2019
    Posts:
    6
    Hi I am trying to run my project with xCode, to check is everything ok.
    I compiled this as IOS Simulator, opened in xCode and tried to run
    Build filed with error below

    .../Unity-iPhone.xcodeproj Building for iOS Simulator, but the linked library 'libzipw.a' was built for iOS.

    Any idea
     
  17. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    For running the plugin in the simulator a special compiled plugin is needed.
    It was included in the past but I removed it since not many people were using it.
    However I will compile one and send it to you.
     
  18. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Check your mail.
    I sent the simulator plugin.
    It will be included in the next update.
     
  19. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.7.1

    - Hot fix for zips that contain the __MACOSX folder.
    - Added simulator plugin for iOS.
     
  20. chicken412

    chicken412

    Joined:
    Jul 24, 2017
    Posts:
    3
    Seem the latest version is not working (or unstable, i only can decompress the demo zip file) with Windows Editor. I reverted to the older one. its working normally.
    the latest version always response -2.
    demo zip file attached below.
    Thanks
     

    Attached Files:

  21. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Thanks.

    I will look at it and get back to you.
     
  22. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. I found the bug.
    It was introduced in the previous update by adding one extra error check.

    I will compile all plugins and upload a hot fix asap.
    Thanks for the report!
     
  23. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update version 1.7.2

    - Hotfix: the previous update broke the decompression of zip files. It is now fixed!
    (If you updated to the previous 2 versions, it is mandatory to update to this one now!)

    - Added 2 new functions to gzip and ungzip archives on the File System.
     
    chicken412 likes this.
  24. chicken412

    chicken412

    Joined:
    Jul 24, 2017
    Posts:
    3
    The bug is fixed. Thanks for your quick response. :D:D
     
  25. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    can you add rar support? SharpCompress supports rar and its free but slow
     
  26. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello. It is planned.
     
  27. DMCwildcard

    DMCwildcard

    Joined:
    Oct 18, 2017
    Posts:
    7
    Hello, we receive notifications that some of our clients are blocked by Antivir.
    plugins/libzipw.dll -> HEUR/APC (Cloud)

    Any idea?
     
  28. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    It must be a false positive, since the lib does contain code for sha and aes password support.

    I will investigate more and reply again.
     
  29. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok.

    I did some scans on the virustotal site and the 64bit dll does not give any positives. Only the 32bit one gives 3.
     
  30. DMCwildcard

    DMCwildcard

    Joined:
    Oct 18, 2017
    Posts:
    7
    mhhhh,

    upload_2020-6-17_9-2-21.png

    i cant remove any 32bit options....
    It looks like the hits currently only occur on Windows Systems...
    we only build the windows standalone with the x86_64 Architecture option.
     
  31. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I tested on Virustoal. Let me install Antivir and try.
     
  32. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I downloaded Antivir, and I get a false positive only on the 32bit variant. The 64bit one gives no hit.

    I have contacted them to review the 32bit dll as false positive.

    Please make sure that you are using the 64bit dll. This one has a a size of 400 kb while the 32bit one 308kb.
     
  33. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update verion 1.8 [Major update]

    - Added support for tar/untar.
    - Added support for tar.gz, tar.bz2 creation.
    - Added ability to create and decompress bz2 files.
    - Protection against illegal characters in zip entries.
    - Faster reaction to the cancel command.
    - Fixed gzip file decompression issues.
    - gzip uncompress progress relies on the compressed files size now.
    - tvOS uses the same functions as WebGL now, since it does not allow access to the file system.
    (WebGL sample scene renamed to reflect the above changes.)
    - Combined tvOS and WebGL in one demo scene.
    - Updated and refactored the demo scene and scripts to reflect the new changes.
    - Removed StreamingAssets demo files. Now they will be downloaded.
    - Only one glibc version of Linux plugins now provided (glibc2.17)
     
  34. DMCwildcard

    DMCwildcard

    Joined:
    Oct 18, 2017
    Posts:
    7
    ok,
    due to a mistake on our site the 32bit dll was in the project...
    we add the 64bit dll in the project and no false positive anymore...

    thx for the fast help :D
     
    elias_t likes this.
  35. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. Good to know!
     
  36. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    I am looking for someone who is willing to test the plugin for Nintendo Switch or PS4 with a clang5.0/llvm compiled version.
     
  37. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    @elias_t : Hey Elias, I'm making a .GLTF model viewer for WebGL, and our .glft models come in an .zip archive, but .GLTFUtility plugin for Unity requires a file path.

    So if I decompress the .zip file to a byte buffer, is it possible to then write all the contents of the byte buffer to the persistent data path in WebGL? If so can you show me how it would be done?

    The .gltf format contains several files...

    - 'textures' folder containing .png images
    - 'scene.bin'
    - 'scene.gltf'

    So once I've decompressed the bytes into the buffer, what would be the next step? I don't think I can use File.WriteAllBytes(), as that method expects that we're writing a single file at a time. And I don't know the contents of the archive before hand.
     
  38. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    WebGL does not allow to save files locally.

    The webgl usage of the plugin is to allow creating inMemory zip files and decompress entries of a downloaded zip to memory.

    From a first glimpse at the gltf uitility, I saw that it has also LoadFromBytes functions, so you could import your data from a byte buffer.
     
  39. aBaoTsai

    aBaoTsai

    Joined:
    Dec 22, 2016
    Posts:
    1
    Hello elias:

    When I decompress_file() with password in iphone , it work.

    But when I use GVRSDK (XRSetting->Virtual Reality Supported->Cardboard SDK)
    and decompress_file() with password in iphone ,it fail (return -2) ,but Android is ok.

    And I got some duplicate warning as below:

    warning: duplicate symbol '_unzOpenCurrentFilePassword' in:
    /Users/Shared/Unity/testzipp/testzipp/Libraries/libiPhone-lib.a(External_zlib_src_0.o) /Users/Shared/Unity/testzipp/testzipp/Pods/GVRSDK/Libraries/libGVRSDK.a(unzip_0f696acd050fa179881757320cfac766.o)

    What can I do ?

    MacOS version: Catalina 10.15.3
    Plugin version: 1.8
    XCode: 11.5
    Unity version: 2018.4.19f1
     

    Attached Files:

  40. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    Let me check this and I get back to you with a hotfix.

    edit: Although as I see now your error log there might a conflict with libiPhone-lib.a and libGVRSDK.a.
     
  41. marcoantap

    marcoantap

    Joined:
    Sep 23, 2012
    Posts:
    231
    Hi!

    I'm having a problem with latest version 1.8, in Unity 2019.4.4 (Windows 10). lzip.compressDir always returns -2 and the .zip file is truncated (126 bytes, including only 1 file of 3). I placed a breakpoint and debugged step by step, then it gets to line 1284:

    res = zipCDList(levelOfCompression, @zipArchive, faBuf.AddrOfPinnedObject(), inFilePath.Length, prog.AddrOfPinnedObject(), naBuf.AddrOfPinnedObject(), password, useBz2, diskSize, bProg.AddrOfPinnedObject());

    After that line res = 1, and the zip file is complete (20.5kb). Trying to understand why it only works when debugging but not at runtime. I tried calling it from a coroutine and waiting 10 seconds, but still truncates the zip and returns -2.
     
  42. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Thx for the report.
    Will check and report back.
     
  43. marcoantap

    marcoantap

    Joined:
    Sep 23, 2012
    Posts:
    231
    Hey, never mind, it was my fault after all. A file was being downloaded in a coroutine while compressing its parent folder. Tried a different zip library that throws a file access conflict exception when this happens, your lib failed silently. Still its a great lib and I replaced it back in the project, thanks for your quick support.
     
    elias_t likes this.
  44. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.8.1

    - Fixed Unicode issues with the windows plugins.
    - Restrucured the project folders so they reside in the ADL-Plugins folder now.
     
  45. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    version 1.8.2 [important update]

    - Windows: Resolved all issues with Unicode paths (reading and writing)
    - All platforms: All file paths/names will be treated as utf-8
    - Gzip file decompression got 4 times faster.
     
  46. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    update version 1.8.3

    - Windows: reintroduced the lzip.setEncoding function, since some applications do not use utf8 encoding for filenames.
     
  47. Jovaan

    Jovaan

    Joined:
    Aug 1, 2014
    Posts:
    12
    I am facing very weird problem with libzipw.a for iOS builds. Unity includes the file in Xcode project as it should and file is visible in Xcode. It is also included in Frameworks and Libraries for UnityFrameWork. The code compiles, links fine. But when I try to use it from the code, it fails, does not find library. BUT: when I manually add the same file to root of Xcode project "Plugins", everything works. I don't want to add it manually every time I make a build from Unity. Any comments? (Note: All my other .a libraries (there are many) behave correctly and I don't have to add them manually).
     
  48. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.
    Strange. I never faced this before.
    Please report your Unity and xcode version so I can check here also.
     
  49. Jovaan

    Jovaan

    Joined:
    Aug 1, 2014
    Posts:
    12
    Unity 2019.4.14 lts, last xcode as of yesterday fro'm apple store.
     
  50. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Now on sale at 30% off.
    After this there will be a $5 price increase.