mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-02-14 09:48:30 +01:00
Added implementation of Srarctaft I BETA ADPCM decompression
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Local functions
|
||||
|
||||
static MTYPE CheckMapType(LPCTSTR szFileName, LPBYTE pbHeaderBuffer, size_t cbHeaderBuffer)
|
||||
static MTYPE CheckMapType(ULONGLONG FileSize, LPCTSTR szFileName, LPBYTE pbHeaderBuffer, size_t cbHeaderBuffer)
|
||||
{
|
||||
LPDWORD HeaderInt32 = (LPDWORD)pbHeaderBuffer;
|
||||
LPCTSTR szExtension;
|
||||
@@ -35,6 +35,15 @@ static MTYPE CheckMapType(LPCTSTR szFileName, LPBYTE pbHeaderBuffer, size_t cbHe
|
||||
DWORD DwordValue2 = BSWAP_INT32_UNSIGNED(HeaderInt32[2]);
|
||||
DWORD DwordValue3 = BSWAP_INT32_UNSIGNED(HeaderInt32[3]);
|
||||
|
||||
// Check possible MPQs from Starcraft I BETA. We recognize them by checking the file size.
|
||||
// 167 859: patch_rt.mpq (doesn't contain any WAVE files)
|
||||
// 55 674 173: StarDat.mpq
|
||||
// 183 519 584: Install.exe
|
||||
if(FileSize == 55674173 && DwordValue1 == MPQ_HEADER_SIZE_V1 && DwordValue3 == 0x00030000)
|
||||
return MapTypeStarcraftBeta;
|
||||
if(FileSize == 183519584 && DwordValue0 == 0x00905a4D && DwordValue1 == 3 && DwordValue2 == 4)
|
||||
return MapTypeStarcraftBeta;
|
||||
|
||||
// Check maps by extension (Starcraft, Starcraft II). We must do this before
|
||||
// checking actual data, because the "NP_Protect" protector places
|
||||
// fake Warcraft III header into the Starcraft II maps
|
||||
@@ -321,7 +330,7 @@ bool WINAPI SFileOpenArchive(
|
||||
if(MapType == MapTypeNotChecked)
|
||||
{
|
||||
// Do nothing if the file is an AVI file
|
||||
if((MapType = CheckMapType(szMpqName, pbHeaderBuffer, dwBytesAvailable)) == MapTypeAviFile)
|
||||
if((MapType = CheckMapType(FileSize, szMpqName, pbHeaderBuffer, dwBytesAvailable)) == MapTypeAviFile)
|
||||
{
|
||||
dwErrCode = ERROR_AVI_FILE;
|
||||
break;
|
||||
@@ -446,6 +455,12 @@ bool WINAPI SFileOpenArchive(
|
||||
if(dwFlags & MPQ_OPEN_FORCE_LISTFILE)
|
||||
ha->dwFlags |= MPQ_FLAG_LISTFILE_FORCE;
|
||||
|
||||
// StarDat.mpq from Starcraft I BETA: Enable special compression types
|
||||
if(MapType == MapTypeStarcraftBeta)
|
||||
{
|
||||
ha->dwFlags |= MPQ_FLAG_STARCRAFT_BETA;
|
||||
}
|
||||
|
||||
// Remember whether whis is a map for Warcraft III
|
||||
if(MapType == MapTypeWarcraft3)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user