Tools/Extractors: Use FileDataID whenever possible
This commit is contained in:
@@ -61,6 +61,33 @@ bool ChunkedFile::loadFile(CASC::StorageHandle const& mpq, std::string const& fi
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChunkedFile::loadFile(CASC::StorageHandle const& mpq, uint32 fileDataId, std::string const& description, bool log)
|
||||
{
|
||||
free();
|
||||
CASC::FileHandle file = CASC::OpenFile(mpq, fileDataId, CASC_LOCALE_ALL, log);
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
DWORD fileSize = CASC::GetFileSize(file, nullptr);
|
||||
if (fileSize == CASC_INVALID_SIZE)
|
||||
return false;
|
||||
|
||||
data_size = fileSize;
|
||||
data = new uint8[data_size];
|
||||
DWORD bytesRead = 0;
|
||||
if (!CASC::ReadFile(file, data, data_size, &bytesRead) || bytesRead != data_size)
|
||||
return false;
|
||||
|
||||
parseChunks();
|
||||
if (prepareLoadedData())
|
||||
return true;
|
||||
|
||||
printf("Error loading %s\n", description.c_str());
|
||||
free();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChunkedFile::prepareLoadedData()
|
||||
{
|
||||
FileChunk* chunk = GetChunk("MVER");
|
||||
|
||||
Reference in New Issue
Block a user