Kanma / MPQExtractor

A command-line tool to extract files from MPQ archives
Other
127 stars 39 forks source link

Failed to extract list of files #8

Closed hanetzer closed 10 years ago

hanetzer commented 10 years ago

Hey, just ran into this repo while researching StarCraft/BroodWar tools on linux, compiled fine, but when running ./MPQExtractor -l brood.txt BroodWar.mpq (where BroodWar.mpq is INSTALL.EXE copied from the install disk for cd-less play) I get:

Opening 'BroodWar.mpq'...
Failed to extract the list of files
Kanma commented 10 years ago

Hello

I don't have StarCraft 1, but it seems that the MPQ files of Diablo I & II and StarCraft didn't include a list of files. More specifically (quoted from http://www.angelfire.com/sc/mpq/):

MPQ archives don't store file names inside them instead archives contain table
of hashed names, so if you don't know name of the file you want to access you
can't access it. It's not stupid as you may think - table of hashed names acts like
index table for fast access to file and of course developers of the game know all
of the file names. Because of this problem MPQ viewers introduced so-called
"game filelist" with file names stored in it and viewers can access file only if its
name is listed in that filelist.

This site provides one "game filelist" for "Diablo I, Hellfire, StarCraft, BroodWar" at http://www.angelfire.com/sc/mpq/list.zip.

According to my tests (on a Diablo II file on my Mac), if you want to extract only one file (and you know its name), you can directly specify it:

./MPQExtractor -e "data\global\excel\armor.txt" /Applications/Diablo\ II/Diablo\ II\ Game\ Data 
Opening '/Applications/Diablo II/Diablo II Game Data'...

Extracting files...

But if you want to extract a bunch of them, you have to "apply" the downloaded listfile to the archive first, using the -a flag:

./MPQExtractor -a ~/Downloads/d2list.txt -e "data\global\excel\*" /Applications/Diablo\ II/Diablo\ II\ Game\ Data 
Opening '/Applications/Diablo II/Diablo II Game Data'...

Searching for 'data\global\excel\*'...

Found files:
  - data\global\excel\Aiparms.txt
  - data\global\excel\Arena.txt
  - data\global\excel\armor.txt
  - data\global\excel\ArmType.txt
  - data\global\excel\AutoMap.txt
  - data\global\excel\belts.txt
  - data\global\excel\books.txt
  ...
  - data\global\excel\UniqueSuffix.txt
  - data\global\excel\UniqueTitle.txt
  - data\global\excel\weapons.txt

Extracting files...

Not that since the filelist also contains the name of the Diablo/Hellfire files, you might have some error messages during the extraction of several files.

hanetzer commented 10 years ago

Ah, thank you. the -a flag is exactly what I needed. Mayhaps you should update the README to reflect this need with these mpq files.