Page Index Toggle Pages: 1
Topic Tools
Normal Topic SFmpqapi Issues (Read 4417 times)
Zoxc
Peon
*
Offline


I love YaBB 1G - SP1!
<- false statment. vB
ftw!

Posts: 4
Joined: Aug 20th, 2006
SFmpqapi Issues
Aug 20th, 2006 at 5:43pm
Post Tools
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?
  
Back to top
 
IP Logged
 
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline


The source of all chaos

Posts: 125
Location: The Sea of Chaos
Joined: May 11th, 2002
Re: SFmpqapi Issues
Reply #1 - Aug 20th, 2006 at 9:12pm
Post Tools
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.
  

-ShadowFlare

"My mind is my power. My power is my mind.
When uncorrupted by other elements, my mind is my pure power."

"I am a darkness beyond blackest pitch, deeper than the deepest night.
I am the Sea of Chaos. The source of all chaos.
That is how you describe me...
I am... the Lord of Nightmares."
Back to top
WWW  
IP Logged
 
Zoxc
Peon
*
Offline


I love YaBB 1G - SP1!
<- false statment. vB
ftw!

Posts: 4
Joined: Aug 20th, 2006
Re: SFmpqapi Issues
Reply #2 - Aug 21st, 2006 at 10:01am
Post Tools
I tried to open the files by filename before... an error in my coding I guess.

SFileReadFile seems to exit the function.
Code
Select All
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;
 

  
Back to top
 
IP Logged
 
Zoxc
Peon
*
Offline


I love YaBB 1G - SP1!
<- false statment. vB
ftw!

Posts: 4
Joined: Aug 20th, 2006
Re: SFmpqapi Issues
Reply #3 - Aug 22nd, 2006 at 2:34pm
Post Tools
If I use version 1.0.8.1 this crash don't happen.
  
Back to top
 
IP Logged
 
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline


The source of all chaos

Posts: 125
Location: The Sea of Chaos
Joined: May 11th, 2002
Re: SFmpqapi Issues
Reply #4 - Aug 25th, 2006 at 3:32pm
Post Tools
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.
  

-ShadowFlare

"My mind is my power. My power is my mind.
When uncorrupted by other elements, my mind is my pure power."

"I am a darkness beyond blackest pitch, deeper than the deepest night.
I am the Sea of Chaos. The source of all chaos.
That is how you describe me...
I am... the Lord of Nightmares."
Back to top
WWW  
IP Logged
 
esby
Peon
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: May 10th, 2006
Re: SFmpqapi Issues
Reply #5 - Sep 30th, 2006 at 3:09pm
Post Tools
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
  
Back to top
 
IP Logged
 
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline


The source of all chaos

Posts: 125
Location: The Sea of Chaos
Joined: May 11th, 2002
Re: SFmpqapi Issues
Reply #6 - Oct 4th, 2006 at 5:19pm
Post Tools
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.
  

-ShadowFlare

"My mind is my power. My power is my mind.
When uncorrupted by other elements, my mind is my pure power."

"I am a darkness beyond blackest pitch, deeper than the deepest night.
I am the Sea of Chaos. The source of all chaos.
That is how you describe me...
I am... the Lord of Nightmares."
Back to top
WWW  
IP Logged
 
esby
Peon
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: May 10th, 2006
Re: SFmpqapi Issues
Reply #7 - Oct 4th, 2006 at 8:49pm
Post Tools
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
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools