ShadowFlare's Realm
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl
ShadowFlare's Realm Forums >> Program Development >> SFmpqapi Issues
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl?num=1156099433

Message started by Zoxc on Aug 20th, 2006, 6:43pm

Title: SFmpqapi Issues
Post by Zoxc on Aug 20th, 2006, 6:43pm

I'm using SFileListFiles to get all the files in a MPQ archive. I'm wondering how to read the unknown files using the Block Table Index since that is all SFileListFiles gives me except filename.

Also shouldn't it be possible to add a unknown file to another archive by hash?

Title: Re: SFmpqapi Issues
Post by ShadowFlare on Aug 20th, 2006, 10:12pm

Use the generated filename to extract the unknown file.  This should work with future versions as well and is probably the best way to retain compatibility with any future versions.

As for adding unknown files to archives, SFmpqapi doesn't support it, and it isn't really very practical, since you wouldn't know the position the file would need to have in the hash table in the other archive.

However, I did just barely think of a workaround, though.  By marking all unused entries as deleted files, it will be forced to search the entire hash table if the entry wasn't found at the expected location.  Unfortunately, this will cause a performance penalty, especially if the hash table is large.  I still don't find this very practical, though, since if a file is used, its name can be found.

Title: Re: SFmpqapi Issues
Post by Zoxc on Aug 21st, 2006, 11:01am

I tried to open the files by filename before... an error in my coding I guess.

SFileReadFile seems to exit the function.

Code:

if SFileOpenFileEx(Mpq, @FileData.szFileName, 0, @FH) then
 begin
 MPQFile.Ext := '';

 GetMem(Header, 4);

 SFileReadFile(FH, Header, 4, nil, nil);


 if StrLComp(Header, 'BLP1!', 4) = 0 then
    MPQFile.Ext := '.blp'
 else if StrLComp(Header, 'MDLX', 4) = 0 then
    MPQFile.Ext := '.mdx'
 else if StrLComp(Header, 'ID3'#3, 4) = 0 then
    MPQFile.Ext := '.mp3'
 else if StrLComp(Header, #255#251#146#4, 4) = 0 then
    MPQFile.Ext := '.mp3';

 if Length(MPQFile.Ext) > 0 then
    MPQFile.DisplayName := MPQFile.DisplayName + MPQFile.Ext;

 FreeMem(Header);
 SFileCloseFile(FH);
 end;

Title: Re: SFmpqapi Issues
Post by Zoxc on Aug 22nd, 2006, 3:34pm

If I use version 1.0.8.1 this crash don't happen.

Title: Re: SFmpqapi Issues
Post by ShadowFlare on Aug 25th, 2006, 4:32pm

That's because there was a bug in the reading function that made it so you could only read in multiples of the block size in the mpq archive.  Actually, more just an unhandled case in the function.  I just didn't think of it for some reason. lol  So, with 1.0.7.4 you need to read in multiples of the block size (default is 4096) or just read the whole file.

Title: Re: SFmpqapi Issues
Post by esby on Sep 30th, 2006, 4:09pm

I've been trying to use the sfmpqapi.dll with Delphi.

So far it works more or less, except I've encountered a crash when trying to load some files from the last dota map.

( Dota being a warcraft III - TFT - custom map - protected - www.getdota.com )

I've reproduced the same crash with winmpq when trying to load the ~unknowns\unknown_0000002b file.

Using 1.0.8.1 does not show the problem, but is much slower, performance wise.

Any suggestion?
I am actually trying to parse the item and hero string from the map directly, supposing I can isolate or detect where they are defined, once I extracted the files.

esby

Title: Re: SFmpqapi Issues
Post by ShadowFlare on Oct 4th, 2006, 6:19pm

The 1.0.8.1 version is slower?  Hmm, I'm not sure why it would be.

BTW, you could find the name of the unknown file possibly by using my file list generating MPQDraft plugin.  There is a possibility that I may need to update it for it to work, though, but I'm not really sure.

Title: Re: SFmpqapi Issues
Post by esby on Oct 4th, 2006, 9:49pm

Well, maybe it is not slower, but 15-25 minutes to extract all the files on an an athlon 64 - 3500 with winmpq seems very slow imo.

esby

ShadowFlare's Realm » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.