• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

MacMoPaQ

Status
Not open for further replies.
Hey guys, this is a simple command line utility to export files from an MPQ on OS X. I don't really expect you to use this for actually MPQ editing though, I may make a GUI-based MPQ editor later. This is intended for tools that use an external exe to handle mpq handling. Let me know if there are any bugs; or if you want any extra commands. Check out the source on github:
https://github.com/PurgeGit/MacMoPaQ

The file is attached at the end of this post. I'll probably submit it to the tools section once I've gotten some feedback.

MacMoPaQ v.1.0.0

Command line utility for file injection, file extraction, and file removal for Blizzard's MPQ archives. Supports OS X.

Primarily intended for Warcraft III, but theoretically should be able to export from any StormLib-supported game.

Feel free to package this with other apps, use, share, etc. If you use it, hopefully you can shoot me a message with
feedback, comments, etc. :)

Use

[File Extraction]

JASS:
exec <path_to_MacMoPaQ> extract <path_to_archive> <path_of_file_in_archive> <path_on_disk>

  • Extracts a file from an archive and saves it on the disk. This will not remove the file from the archive.
  • Paths can be enclosed in quotes "" to support spaces, parentheses, etc. Use forward slashes for directories.
  • Example of extraction:
JASS:
exec /Applications/MacMoPaQ/MacMoPaQ extract "/Applications/Warcraft III/Maps/Scenario/(4)WarChasers.w3m" "war3map.j" "/Applications/Warcraft III/Maps/Scenario/war3map.j"

[File Injection]

JASS:
exec <path_to_MacMoPaQ> inject <path_to_archive> <path_of_file_in_archive> <path_on_disk>
exec <path_to_MacMoPaQ> replace <path_to_archive> <path_of_file_in_archive> <path_on_disk>
  • Injects the file located at <path_on_disk> into the archive at <path_to_archive>.
  • Paths can be enclosed in quotes "" to support spaces, parentheses, etc. Use forward slashes for directories.
  • The keywords "inject" and "replace" do the same thing; they're interchangeable.
  • Example of injection:

JASS:
exec /Applications/MacMoPaQ/MacMoPaQ inject "/Applications/Warcraft III/Maps/Scenario/(4)WarChasers.w3m" "war3map.j" "/Applications/Warcraft III/Maps/Scenario/war3map.j"

[File Deletion]

JASS:
exec <path_to_MacMoPaQ> delete <path_to_archive> <path_of_file_in_archive> <(optional) compact>

  • Deletes a file from the archive. Paths can be enclosed in quotes.
  • If you have "compact" written at the end, it will compact the archive after deleting the file.
  • If you have anything else written, or nothing there, it will not compact the archive (soft delete).

JASS:
exec /Applications/MacMoPaQ/MacMoPaQ delete "/Applications/Warcraft III/Maps/Scenario/(4)WarChasers.w3m" "war3map.j" compact

Extras

As a simple shortcut, you can use archivedir for extraction and injection <path_on_disk>.
For extraction, it will extract the path to the directory of the archive with the <path_of_file> appended.
For injection, it will inject the file located at the directory of the archive with <path_of_file> appended.

JASS:
exec /Applications/MacMoPaQ/MacMoPaQ extract "/Applications/Warcraft III/Maps/Scenario/(4)WarChasers.w3m" "war3map.j" "/Applications/Warcraft III/Maps/Scenario/war3map.j"

Is the same as:

JASS:
exec /Applications/MacMoPaQ/MacMoPaQ extract "/Applications/Warcraft III/Maps/Scenario/(4)WarChasers.w3m" "war3map.j" archivedir

Credits

- "Ladik" Ladislav Zezula - StormLib
http://www.zezula.net/en/mpq/stormlib.html
- Sam Wilkins - StormLib OS X Port

Notes

- Compiled with StormLib v.8.21
- Written in Objective-C through XCode
 

Attachments

  • MacMoPaQ.zip
    159.8 KB · Views: 86
Last edited:
Yep, it is only for Mac. I could write one for Windows too, but there are already tons of those. :) The only command-line-based OS-X friendly MPQ tool I could find was Kanma's MPQExtractor, but that only extracts and is mostly intended for WoW.

Perhaps BahamutZERO's mpq tools have command line options, but I haven't checked. I was going to use his library at first, but I couldn't find a method for compaction so I switched to Ladik's StormLib.

Thanks for the praise. :)
 
Status
Not open for further replies.
Top