Core/Tools: Replaced libmpq with StormLib and made map extractor use it, you can now extract 4.2.2 dbcs with it (still not maps)

TODO: Update ADT structure
This commit is contained in:
Shauren committed 2012-02-20 19:12:05 +01:00
1 parent 39f96656ab
commit b1e4a1b14f
386 files changed
+79984 -9530

No files matched your search

+12 -13
View File
@@ -1,11 +1,8 @@
#define _CRT_SECURE_NO_DEPRECATE
#include "loadlib.h"
#include "mpq_libmpq04.h"
#include <cstdio>
class MPQFile;
FileLoader::FileLoader()
{
data = 0;
@@ -18,29 +15,31 @@ FileLoader::~FileLoader()
free();
}
bool FileLoader::loadFile(char *filename, bool log)
bool FileLoader::loadFile(HANDLE mpq, char* filename, bool log)
{
free();
MPQFile mf(filename);
if(mf.isEof())
HANDLE file;
if (!SFileOpenFileEx(mpq, filename, SFILE_OPEN_PATCHED_FILE, &file))
{
if (log)
printf("No such file %s\n", filename);
return false;
}
data_size = mf.getSize();
data = new uint8 [data_size];
data_size = SFileGetFileSize(file, NULL);
data = new uint8[data_size];
if (data)
{
mf.read(data, data_size);
mf.close();
SFileReadFile(file, data, data_size, NULL/*bytesRead*/, NULL);
if (prepareLoadedData())
{
SFileCloseFile(file);
return true;
}
}
printf("Error loading %s", filename);
mf.close();
printf("Error loading %s\n", filename);
SFileCloseFile(file);
free();
return false;
}