.NET MpqLib updated for Cataclysm menu

User Tag List

Results 1 to 15 of 15
  1. #1
    caytchen's Avatar Contributor
    Reputation
    138
    Join Date
    Apr 2007
    Posts
    162
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .NET MpqLib updated for Cataclysm

    Original version can be found at MpqLib
    As required by GPL v3, I'm releasing the code including the changes I've made to it. Also included are the StormLib libraries needed (MPQ Archives - StormLib) and binaries.

    Note: This isn't a "complete" update; I've merely fixed some API breakage, not implemented new features. I have verified this to successfully read files from 4.0.1.13205 MPQ archives.

    Filebeam - Beam up that File Scottie!

    .NET MpqLib updated for Cataclysm
  2. #2
    st0724's Avatar Member
    Reputation
    2
    Join Date
    Feb 2007
    Posts
    60
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the build. I was actually just building this with the new StormLib as well =D

  3. #3
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry to necrobump this. Is anyone else using MpqLib? How do you deal with StormLib opening files with exclusive read access?

  4. #4
    namreeb's Avatar Legendary

    Reputation
    658
    Join Date
    Sep 2008
    Posts
    1,023
    Thanks G/R
    7/215
    Trade Feedback
    0 (0%)
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Well personally, I modified StormLib.

  5. #5
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by namreeb View Post
    Well personally, I modified StormLib.
    Care to explain how? Not really that good with C++ - I nailed it down to the CreateFile wrapper, but I have no idea what flags I should and shouldn't be using. Was looking into http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx but still can't tell why it won't let me open it while WoW uses them as well.

    Originally Posted by Bananenbrot View Post
    Nice... I'll look into this.

  7. #7
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by miceiken View Post
    Care to explain how? Not really that good with C++ - I nailed it down to the CreateFile wrapper, but I have no idea what flags I should and shouldn't be using. Was looking into CreateFile function but still can't tell why it won't let me open it while WoW uses them as well.
    Well as far as I know is there no way to open them as long as WoW is opened. The MPQ files are locked since Cataclysm and in my opinion is there no real need to open them while WoW is opened. Just close it or copy the files

  8. #8
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    Well as far as I know is there no way to open them as long as WoW is opened. The MPQ files are locked since Cataclysm and in my opinion is there no real need to open them while WoW is opened. Just close it or copy the files
    I need them for the minimap files. Suppose I could use WoW's internal functions but I have the feeling this will go smoother. And yes, it's possible to open them while WoW is open, how else would you be able to run multiple instances of WoW?

  9. #9
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by miceiken View Post
    I need them for the minimap files. Suppose I could use WoW's internal functions but I have the feeling this will go smoother. And yes, it's possible to open them while WoW is open, how else would you be able to run multiple instances of WoW?
    Well why don't you just extract them and pass them to the user inside a dll?

    And yes, there's always a way, but the Windows API blocks it if you try to open a locked file. I can't tell you which way Blizzard is using, but the StormLib and librarys like this don't support it.


    I recomment you to use the dll-way and stop breaking your head on that topic

  10. #10
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    Well why don't you just extract them and pass them to the user inside a dll?

    And yes, there's always a way, but the Windows API blocks it if you try to open a locked file. I can't tell you which way Blizzard is using, but the StormLib and librarys like this don't support it.


    I recomment you to use the dll-way and stop breaking your head on that topic
    Why do you keep suggesting a solution that is out of the question? I KNOW it's possible, and extracting the data is just retarded when the data already is there.

  11. #11
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by miceiken View Post
    Why do you keep suggesting a solution that is out of the question? I KNOW it's possible, and extracting the data is just retarded when the data already is there.
    Because it's it regard of performance much more worse. You would have to open ~10 MPQs and in general are IO-Actions not the fastest, but reading a single is much faster.

    But okay, I'll leave you alone with you problem, if you want to FORCE such exactly that solution. I just told you a workaround...

  12. #12
    Sacred's Avatar Contributor
    Reputation
    207
    Join Date
    Dec 2007
    Posts
    152
    Thanks G/R
    3/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by miceiken View Post
    I need them for the minimap files. Suppose I could use WoW's internal functions but I have the feeling this will go smoother. And yes, it's possible to open them while WoW is open, how else would you be able to run multiple instances of WoW?
    Yes it's possible and i'm using CrystalMpq, there's no need to open 10 MPQ archives, you just need to open one - art.MPQ, this is how i'm doing:
    Code:
    public class Mpq
    {
            private static BlpLib.BlpFile _exampleBlp;
            private static readonly MpqArchive Archive = new MpqArchive(Helpers.WowInstallPath + "\\Data\\art.MPQ", false);
            private static MpqFile _file;
            private static MpqFileStream _stream;
            public static readonly Dictionary<string, Image> Images = new Dictionary<string, Image>();
    
            public static Image GetImage(string mapName, string continent)
            {
                try
                {
                    string str = "World\\Minimaps\\" + continent + "\\" + mapName;
                    if (!Images.ContainsKey(str))
                    {
                          _file = Archive.FindFile(str);
                          _stream = _file.Open();
                          _exampleBlp = new BlpLib.BlpFile(_stream);
                           var bmp = _exampleBlp.GetBitmap(0);
                           Images.Add(str, bmp);
                          _stream.Close();
                          _exampleBlp.Close();
    
                    }
                    return Images[str];
                }
                catch
                {
                }
                return null;
            }
    }
    Using:
    Code:
    Image minimap = Mpq.GetImage("map31_31.blp", "Azeroth");

  13. #13
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still looking for a solution with StormLib, as it's incorporated into my framework.

  14. #14
    _Mike's Avatar Contributor
    Reputation
    310
    Join Date
    Apr 2008
    Posts
    531
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by miceiken View Post
    Still looking for a solution with StormLib, as it's incorporated into my framework.
    In FileStream.cpp, change the CreateFile call in BaseFile_Open() to use
    FILE_SHARE_READ | FILE_SHARE_WRITE
    for the share flags. And then call SFileOpenArchive() with STREAM_FLAG_READ_ONLY.

    If you want write access you also need to change
    Code:
    DWORD dwDesiredAccess = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? GENERIC_READ : GENERIC_ALL;
    to
    Code:
    DWORD dwDesiredAccess = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE;
    but wow doesn't react very well if you write to the mpqs while they are opened And iirc you can't use patch archives unless you open the base as read only anyways.

    Since it's just a change to the flags you could even do a simple binary patch if you don't feel like recompiling the whole thing.
    Last edited by _Mike; 07-31-2012 at 01:17 PM.

  15. #15
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet, just what I was looking for. Thank you very much,

Similar Threads

  1. [Cataclysm][Video] This patch update for Tol Barad
    By thomasden2 in forum World of Warcraft General
    Replies: 1
    Last Post: 06-07-2010, 03:57 AM
  2. [Release] Project Silvermoon Fundatabase, Update for NCDB 0.2.3
    By latruwski in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 02-18-2008, 11:49 AM
  3. SQL UPDATES for 2.1-2.3
    By sadgonewild in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 11-23-2007, 07:05 AM
  4. [Release] Project Silvermoon Fundatabase, Update for NCDB 0.2.2
    By latruwski in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 11-04-2007, 01:06 PM
  5. Update for Free WoW exploit users..
    By Tokolosi in forum World of Warcraft General
    Replies: 8
    Last Post: 06-22-2007, 07:25 PM
All times are GMT -5. The time now is 09:15 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search