Welcome, Guest. Please Login
Back to main page
  News:
Welcome to the ShadowFlare's Realm Forums.  New registrations are by request only.  To be considered for a new forum account, send an e-mail with the user name and display name you want and the reason you want to register.
  Home SFRealm HelpSearchLogin  
 
Pages: 1
Send Topic Print
SFmpqapi Issues (Read 3690 times)
Zoxc
Peon
*
Offline

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

Posts: 4

SFmpqapi Issues
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?
Back to top
 
 
  IP Logged
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline

The source of all
chaos

Posts: 125
The Sea of Chaos
Re: SFmpqapi Issues
Reply #1 - 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.
Back to top
 
 

-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."
WWW 46431561 ShadowFlareSFR   IP Logged
Zoxc
Peon
*
Offline

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

Posts: 4

Re: SFmpqapi Issues
Reply #2 - 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;
 

Back to top
 
 
  IP Logged
Zoxc
Peon
*
Offline

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

Posts: 4

Re: SFmpqapi Issues
Reply #3 - Aug 22nd, 2006, 3:34pm
 
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
The Sea of Chaos
Re: SFmpqapi Issues
Reply #4 - 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.
Back to top
 
 

-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."
WWW 46431561 ShadowFlareSFR   IP Logged
esby
Peon
*
Offline

I love YaBB 1G -
SP1!

Posts: 23

Re: SFmpqapi Issues
Reply #5 - 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
Back to top
 
 
  IP Logged
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline

The source of all
chaos

Posts: 125
The Sea of Chaos
Re: SFmpqapi Issues
Reply #6 - 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.
Back to top
 
 

-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."
WWW 46431561 ShadowFlareSFR   IP Logged
esby
Peon
*
Offline

I love YaBB 1G -
SP1!

Posts: 23

Re: SFmpqapi Issues
Reply #7 - 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
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print