inwc3 / JMPQ3

Native Java mpq archive library
Apache License 2.0
38 stars 17 forks source link

java.lang.IllegalArgumentException: Size exceeds Integer.MAX_VALUE at extractAllFiles #4

Closed meltzow closed 8 years ago

meltzow commented 8 years ago

I want to extract all files from StarCraft II/Campaigns/Liberty.SC2Campaign/base.SC2Assets ( Wings of liberty) size 3,5G. I got the following Exception:

Exception in thread "main" java.lang.IllegalArgumentException: Size exceeds Integer.MAX_VALUE at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:869) at systems.crigges.jmpq3.JMpqEditor.searchHeader(JMpqEditor.java:166) at systems.crigges.jmpq3.JMpqEditor.(JMpqEditor.java:126) at systems.crigges.jmpq3test.Main.main(Main.java:30)

Crigges commented 8 years ago

Wow I never thought someone would use this libary for starcraft 2 mpqs. JMPQ won't be able to open sc2 archives since the file format differs from wc3 ones. Maybe sc2 support will be added but this will need time and I would need some archive for testing, which is missing right now.

So there are some currently only two options for you: If you have no problems to use JNI you can use jMpq which uses the StormLib. However it sometimes shows strange bugs. You can also try to use Ladiks Edtior via cmd. For more info checkout: http://www.zezula.net/en/mpq/download.html

meltzow commented 8 years ago

Thx for the alternatives. Your JMPQ-v3 is working very well with sc2 files. It operates with filesize < 1GB, the problems is only when the filesize are really big. May you explain or to do have a docu for the differences between wc3 and sc2 files?

Crigges commented 8 years ago

I didn't expect it would work with small files so maybe the difference isn't that big. However there is no offical documentation for the MoPaQ format. This is what i use: https://web.archive.org/web/20111025061432/http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format#Extended_Block_Table

The extended block table was added to support archives larger than 4 gigabytes (2^32 bytes). The table contains the upper bits of the archive offsets for each block in the block table. It is simply an array of int16s, which become bits 32-47 of the archive offsets for each block, with bits 48-63 being zero. Individual blocks in the archive are still limited to 4 gigabytes in size. This table is only present in Burning Crusade format archives that exceed 4 gigabytes size.

Unlike the hash and block tables, the extended block table is not encrypted nor compressed.

Readonly mode for this stuff seems to be not that much work. Or do you need to rebuild the archive?

Crigges commented 8 years ago

You archive is just 3.5GB size so it may actual help if i just fix that bug with the buffer. Gonna try to fix that soon.

Crigges commented 8 years ago

It was not as easy as i thought. Not going to implement support for 2.1+GB archives srry. However if you realy need it make a pullrequest pls