|
|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
DWORD sgdwMpqOffset; |
|
|
|
|
char mpq_buf[4096]; |
|
|
|
|
_HASHENTRY *sgpHashTbl; |
|
|
|
|
BOOL save_archive_modified; // weak
|
|
|
|
|
BOOL save_archive_modified; |
|
|
|
|
_BLOCKENTRY *sgpBlockTbl; |
|
|
|
|
BOOLEAN save_archive_open; // weak
|
|
|
|
|
|
|
|
|
|
@ -457,7 +457,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar)
|
|
|
|
|
if (sghArchive == INVALID_HANDLE_VALUE) |
|
|
|
|
return 0; |
|
|
|
|
save_archive_open = 1; |
|
|
|
|
save_archive_modified = 1; |
|
|
|
|
save_archive_modified = TRUE; |
|
|
|
|
} |
|
|
|
|
if (!sgpBlockTbl || !sgpHashTbl) { |
|
|
|
|
memset(&fhdr, 0, sizeof(fhdr)); |
|
|
|
|
@ -489,7 +489,6 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar)
|
|
|
|
|
} |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
// 65AB0C: using guessed type int save_archive_modified;
|
|
|
|
|
// 65AB14: using guessed type char save_archive_open;
|
|
|
|
|
// 679660: using guessed type char gbMaxPlayers;
|
|
|
|
|
|
|
|
|
|
@ -526,7 +525,7 @@ BOOL ParseMPQHeader(_FILEHEADER *pHdr, DWORD *pdwNextFileStart)
|
|
|
|
|
pHdr->sectorsizeid = 3; |
|
|
|
|
pHdr->version = 0; |
|
|
|
|
*pdwNextFileStart = 0x10068; |
|
|
|
|
save_archive_modified = 1; |
|
|
|
|
save_archive_modified = TRUE; |
|
|
|
|
save_archive_open = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -564,7 +563,7 @@ void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar)
|
|
|
|
|
handle = FindFirstFile(pszArchive, &FindFileData); |
|
|
|
|
if (handle != INVALID_HANDLE_VALUE) { |
|
|
|
|
FindClose(handle); |
|
|
|
|
*((FILETIME*) (dst) + dwChar * 2 + 1) = FindFileData.ftLastWriteTime; |
|
|
|
|
*((FILETIME *)(dst) + dwChar * 2 + 1) = FindFileData.ftLastWriteTime; |
|
|
|
|
mpqapi_reg_store_modification_time(dst, 160); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -572,22 +571,22 @@ void mpqapi_store_modified_time(const char *pszArchive, DWORD dwChar)
|
|
|
|
|
|
|
|
|
|
BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, DWORD dwChar) |
|
|
|
|
{ |
|
|
|
|
BOOL ret = FALSE; |
|
|
|
|
if (sghArchive == INVALID_HANDLE_VALUE) |
|
|
|
|
BOOL ret = FALSE; |
|
|
|
|
if (sghArchive == INVALID_HANDLE_VALUE) |
|
|
|
|
ret = TRUE; |
|
|
|
|
else { |
|
|
|
|
ret = FALSE; |
|
|
|
|
if (!save_archive_modified) |
|
|
|
|
ret = TRUE; |
|
|
|
|
else if (mpqapi_can_seek() && WriteMPQHeader() && mpqapi_write_block_table()) { |
|
|
|
|
if (mpqapi_write_hash_table()) |
|
|
|
|
ret = FALSE; |
|
|
|
|
if (!save_archive_modified) |
|
|
|
|
ret = TRUE; |
|
|
|
|
else if (mpqapi_can_seek() && WriteMPQHeader() && mpqapi_write_block_table()) { |
|
|
|
|
if (mpqapi_write_hash_table()) |
|
|
|
|
ret = TRUE; |
|
|
|
|
else |
|
|
|
|
ret = FALSE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
CloseMPQ(pszArchive, bFree, dwChar); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
CloseMPQ(pszArchive, bFree, dwChar); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BOOL WriteMPQHeader() |
|
|
|
|
|