| 10-22-2004, 05:11 PM | #1 |
Does anyone have any experience with this API? I'm currently having a bit of problems extracting what files are in an MPQ. You can use SFileGetFileInfo() to retrieve the nr of files in the MPQ, but this will give the nr of existing files. When using SFileListFiles() to retrieve info about the files you also get info about non-existing files. My problem lies in that I don't know how big the FILELISTENTRY buffer must be. You can't use the value you get from SFileGetFileInfo() since it will (most likely) be too small. Using the flag SFILE_LIST_ONLY_KNOWN in SFileListFiles() doesn't help either, you still get the unkown files. Any ideas? I'm using C++ btw. |
| 10-22-2004, 08:03 PM | #2 |
first get the hashtable size by calling SFileGetFileInfo(HMPQ, SFILE_INFO_HASH_TABLE_SIZE) this will give you the max nr of files for this archive (which would be the size of your array) then to filter out the unknowns you'd just have to check for the dwFileExists flag of each file entry BTW what are you working on? |
| 10-23-2004, 11:46 AM | #3 |
Thanks, works fine now! The project I'm working on is top secret, but part of it contains an MPQ browser. I didn't want to be dependent on listfiles for the contents (some MPQ's miss them) so I'm going to extract the file data myself. |
| 10-23-2004, 01:06 PM | #4 |
Hm, another quick question. Most MPQ's can be listed fine using this method, however if I try to list War3Patch.mpq the names only shows up like ~unknowns\unknown_0000050a. Why? |
| 10-23-2004, 01:54 PM | #5 | |
Quote:
|
| 10-23-2004, 02:32 PM | #6 | |
Quote:
You'll always somehow depend on listfiles because as Lord Vexorian stated you can't guess the names of unknown files. the file names are one-way-hashed and only the hash-value is stored in the hashtable entry of each file. There's no way to get the file name out of the hash value. Of course there are ways to find the names out by parsing files that must be there (fex. war3map.j for maps), which is the way i handle unknowns. |
