Giter Site home page Giter Site logo

jmpq3's Introduction

Build Status Jit Coverage Status codebeat badge

JMPQ3

What?

JMPQ3 is a small java library for accessing and modifying mpq (MoPaQ) archives. Common file endings are .mpq, .w3m, .w3x.

MoPaQ is Blizzard's old, proprietary archive format for storing gamedata (replaced with CASC).

You can find more info and an excellent graphical editor here http://www.zezula.net/en/mpq/main.html

Get it

currently only warcraft 3 maps and mpqs are confirmed supported. Mpqs from other games (WoW, starcraft) might cause problems.

It is recommended to use jitpack with a dependency manager like gradle.

See https://jitpack.io/#inwc3/JMPQ3/

Gradle Example:

dependencies {
    compile 'com.github.inwc3:JMPQ3:1.7.14'
}
allprojects {
    repositories {
	maven { url 'https://jitpack.io' }
    }
}

You can still download the jar directly if you prefer https://github.com/inwc3/JMPQ3/releases

How to use

Quick API Overview:

Jmpq provides the OpenOptions READ_ONLY which should be selfexplanatory and FORCE_V0 which forces the mpq to be opened like warcraft3 would open it, ignoring optional data from later specifications for compatability.

// Automatically rebuilds mpq after use if not in readonly mode
try (JMpqEditor e = new JMpqEditor(new File("my.mpq"), MPQOpenOption.FORCE_V0)){
        e.hasFile("filename"); //Checks if the file exists
        e.extractFile("filename", new File("target location")); //Extracts a specific file out of the mpq to the target location
        if (e.isCanWrite()) {
            e.deleteFile("filename"); //Deletes a specific file out of the mpq
            e.insertFile("filename", new File("file to add"), true); //Inserts a specific into the mpq from the target location
            e.extractAllFiles(new File("target folder")); //Extracts all files inside the mpq to the target folder. If a proper listfile exists,
            e.getFileNames(); //Get the listfile as java HashSet<String>
        }
    }

}

Known issues:

  • To work around https://bugs.openjdk.java.net/browse/JDK-4724038 jmpq creates tempfiles for every object in the mpq
  • Unsupported decompression algorithms: sparse and bzip2
  • Only supported compression is zlib/zopfli
  • JMPQ doesn't build a valid (attributes) file for now. (which seems to be fine for warcraft3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.