Skip to content
Browse files

git-svn-id: http://ghostplusplus.googlecode.com/svn/trunk@488 a7494f7…

…2-a4b0-11dd-a887-7ffe1a420f8d
  • Loading branch information...
1 parent 9a58a68 commit 3e83bbfe9e63efff40ff32da9f03484ee0cc8a0c emmeran@gmx.net committed May 9, 2010
Showing with 18 additions and 8 deletions.
  1. +5 −2 StormLib/stormlib/SCommon.cpp
  2. +7 −3 StormLib/stormlib/SFileOpenFileEx.cpp
  3. +6 −3 StormLib/stormlib/SFileReadFile.cpp
View
7 StormLib/stormlib/SCommon.cpp
@@ -373,14 +373,16 @@ DWORD DecryptName1(const char * szFileName)
DWORD dwSeed1 = 0x7FED7FED;
DWORD dwSeed2 = 0xEEEEEEEE;
DWORD ch;
+
while(*pbKey != 0)
{
ch = toupper(*pbKey++);
dwSeed1 = StormBuffer[0x100 + ch] ^ (dwSeed1 + dwSeed2);
dwSeed2 = ch + dwSeed1 + dwSeed2 + (dwSeed2 << 5) + 3;
- }
+ }
+
return dwSeed1;
}
@@ -443,7 +445,8 @@ TMPQHash * GetHashEntry(TMPQArchive * ha, const char * szFileName)
dwIndex = DecryptHashIndex(ha, szFileName);
dwName1 = DecryptName1(szFileName);
dwName2 = DecryptName2(szFileName);
- pHash = pHash0 = ha->pHashTable + dwIndex;
+ pHash = pHash0 = ha->pHashTable + dwIndex;
+ printf("gethashentryex: %s %u %u %u\n", szFileName, dwIndex, ha->pHeader->dwHashTableSize, dwName2);
// Look for hash index
while(pHash->dwBlockIndex != HASH_ENTRY_FREE)
View
10 StormLib/stormlib/SFileOpenFileEx.cpp
@@ -281,7 +281,7 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch
if(dwSearchScope != SFILE_OPEN_BY_INDEX && (szFileName == NULL || *szFileName == 0))
nError = ERROR_INVALID_PARAMETER;
}
-
+
// Prepare the file opening
if(nError == ERROR_SUCCESS)
{
@@ -304,16 +304,20 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch
}
else
{
+printf("looking for %s, %u\n", szFileName, lcLocale);
// If we have to open a disk file
if(dwSearchScope == SFILE_OPEN_LOCAL_FILE)
return OpenLocalFile(szFileName, phFile);
nHandleSize = sizeof(TMPQFile) + strlen(szFileName);
if((pHash = GetHashEntryEx(ha, szFileName, lcLocale)) != NULL)
- {
+ {
+ printf("%s: %u\n", szFileName, pHash->dwBlockIndex);
dwHashIndex = (DWORD)(pHash - ha->pHashTable);
dwBlockIndex = pHash->dwBlockIndex;
- }
+ }
+ else
+ printf("%s: handle is NULL\n", szFileName);
}
}
View
9 StormLib/stormlib/SFileReadFile.cpp
@@ -130,6 +130,8 @@ static DWORD WINAPI ReadMPQBlocks(TMPQFile * hf, DWORD dwBlockPos, BYTE * buffer
return 0;
}
}
+
+printf("%s, %u %u %u %u\n", hf->szFileName, dwToRead, hf->pBlock->dwFilePos, hf->pdwBlockPos[0], hf->pdwBlockPos[1]);
// Update hf's variables
hf->bBlockPosLoaded = TRUE;
@@ -185,6 +187,7 @@ static DWORD WINAPI ReadMPQBlocks(TMPQFile * hf, DWORD dwBlockPos, BYTE * buffer
if(hf->pBlock->dwFlags & MPQ_FILE_COMPRESSED)
blockSize = hf->pdwBlockPos[index+1] - hf->pdwBlockPos[index];
+ printf("%X: %X %X %X %X\n", index, inputBuffer[0], inputBuffer[1], inputBuffer[2], inputBuffer[3]);
// If block is encrypted, we have to decrypt it.
if(hf->pBlock->dwFlags & MPQ_FILE_ENCRYPTED)
{
@@ -214,14 +217,14 @@ static DWORD WINAPI ReadMPQBlocks(TMPQFile * hf, DWORD dwBlockPos, BYTE * buffer
if(blockSize < (DWORD)outLength)
{
// Is the file compressed with PKWARE Data Compression Library ?
- if(hf->pBlock->dwFlags & MPQ_FILE_IMPLODE)
- Decompress_pklib((char *)buffer, &outLength, (char *)inputBuffer, (int)blockSize);
+ if(hf->pBlock->dwFlags & MPQ_FILE_IMPLODE)
+ Decompress_pklib((char *)buffer, &outLength, (char *)inputBuffer, (int)blockSize);
// Is it a file compressed by Blizzard's multiple compression ?
// Note that Storm.dll v 1.0.9 distributed with Warcraft III
// passes the full path name of the opened archive as the new last parameter
if(hf->pBlock->dwFlags & MPQ_FILE_COMPRESS)
- {
+ {
if(!SCompDecompress((char *)buffer, &outLength, (char *)inputBuffer, (int)blockSize))
{
dwBytesRead = 0;

0 comments on commit 3e83bbf

Please sign in to comment.
Something went wrong with that request. Please try again.