mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7910] Resolve problems with vmaps extractor support 3.1.2 archives.
Binary in contrib/vmap_extract_assembler_bin also updated.
This commit is contained in:
parent
f84fdc6757
commit
ec1d6a3b56
8 changed files with 105 additions and 60 deletions
|
|
@ -3,23 +3,16 @@
|
|||
#include "Stormlib.h"
|
||||
#define __STORMLIB_SELF__
|
||||
|
||||
typedef std::vector<MPQArchive*> ArchiveSet;
|
||||
ArchiveSet gOpenArchives;
|
||||
MPQArchiveSet gOpenArchives;
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
MPQArchive::MPQArchive(const char* filename)
|
||||
{
|
||||
BOOL succ = SFileOpenArchive(filename, 0, 0,&hMPQ);
|
||||
if (succ)
|
||||
{
|
||||
MPQArchive*ar = (MPQArchive*)(hMPQ);
|
||||
printf("Opening %s\n", filename);
|
||||
gOpenArchives.push_back(ar);
|
||||
succ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error!!!Not open archive %s\n", filename);
|
||||
}
|
||||
}
|
||||
|
||||
void MPQArchive::close()
|
||||
|
|
@ -27,16 +20,36 @@ void MPQArchive::close()
|
|||
SFileCloseArchive(hMPQ);
|
||||
}
|
||||
|
||||
bool MPQArchiveSet::Open( std::vector<std::string> const& archiveNames )
|
||||
{
|
||||
for (size_t i=0; i < archiveNames.size(); ++i)
|
||||
{
|
||||
MPQArchive mpqarch(archiveNames[i].c_str());
|
||||
if(mpqarch.isOpen())
|
||||
archives.push_back(mpqarch);
|
||||
}
|
||||
|
||||
return !archives.empty();
|
||||
}
|
||||
|
||||
MPQArchiveSet::~MPQArchiveSet()
|
||||
{
|
||||
// close archives
|
||||
for (ArchiveSet::iterator ar_itr = archives.begin(); ar_itr != archives.end(); ++ar_itr)
|
||||
ar_itr->close();
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
MPQFile::MPQFile(const char* filename):
|
||||
eof(false),
|
||||
buffer(0),
|
||||
pointer(0),
|
||||
size(0)
|
||||
{
|
||||
for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i)
|
||||
for(ArchiveSet::const_iterator i=gOpenArchives.archives.begin(); i!=gOpenArchives.archives.end();++i)
|
||||
{
|
||||
HANDLE hFile = "";
|
||||
MPQArchive*(hMPQ) = *i;
|
||||
hMPQ = i->hMPQ;
|
||||
BOOL succ = SFileOpenFileEx(hMPQ,filename,0, &hFile);
|
||||
if (succ)
|
||||
{
|
||||
|
|
@ -54,11 +67,12 @@ MPQFile::MPQFile(const char* filename):
|
|||
|
||||
eof = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eof = true;
|
||||
buffer = 0;
|
||||
|
||||
}
|
||||
|
||||
MPQFile::~MPQFile()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue