Current News Archived News Search News Discussion Forum Old Forum Install Programs More Downloads... Troubleshooting Source Code Format Specs. Misc. Information Non-SF Stuff Links Small banner for links to this site: |
diff --git a/MpqStuff.bas b/MpqStuff.bas
--- a/MpqStuff.bas
+++ b/MpqStuff.bas
ChDir OldPath\r
End Sub\r
Function FindMpqHeader(MpqFile As String) As Long\r
+ FindMpqHeader = -1\r
If FileExists(MpqFile) = False Then\r
- FindMpqHeader = -1\r
Exit Function\r
End If\r
- Dim hFile\r
- hFile = FreeFile\r
- Open MpqFile For Binary As #hFile\r
- Dim FileLen As Long\r
- FileLen = LOF(hFile)\r
- Dim pbuf As String\r
- pbuf = String(32, Chr(0))\r
- Dim i As Long\r
- For i = 0 To FileLen - 1 Step 512\r
- Get #hFile, 1 + i, pbuf\r
- If Left(pbuf, 4) = "MPQ" + Chr(26) Or Left(pbuf, 4) = "BN3" + Chr(26) Then\r
- ' Storm no longer does this, so this shouldn't either\r
- 'FileLen = FileLen - i\r
- 'If JBytes(pbuf, 9, 4) = FileLen\r
- ' FileMpqHeader = i\r
- ' Close #hFile\r
- ' Exit Function\r
- 'Else\r
- ' FileLen = FileLen + i\r
- 'End If\r
- FindMpqHeader = i\r
- Close #hFile\r
- Exit Function\r
- End If\r
- Next i\r
- FindMpqHeader = -1\r
- Close #hFile\r
+ Dim hMPQ As Long, hFile As Long\r
+ If SFileOpenArchive(MpqFile, 0, 0, hMPQ) Then\r
+ CopyMemory hFile, ByVal hMPQ + 268, 4\r
+ FindMpqHeader = SFileFindMpqHeader(hFile)\r
+ SFileCloseArchive hMPQ\r
+ End If\r
End Function\r
Function GetNumMpqFiles(MpqFile As String) As Long\r
-Dim fNum As Long, Text As String, MpqHeader As Long\r
-fNum = FreeFile\r
-Text = String(4, Chr(0))\r
-MpqHeader = FindMpqHeader(MpqFile)\r
-If MpqHeader > -1 Then\r
- Open MpqFile For Binary As #fNum\r
- Get #fNum, MpqHeader + 29, GetNumMpqFiles\r
- Close #fNum\r
-End If\r
+ GetNumMpqFiles = 0\r
+ If FileExists(MpqFile) = False Then\r
+ Exit Function\r
+ End If\r
+ Dim hMPQ As Long\r
+ If SFileOpenArchive(MpqFile, 0, 0, hMPQ) Then\r
+ GetNumMpqFiles = SFileGetFileInfo(hMPQ, SFILE_INFO_NUM_FILES)\r
+ SFileCloseArchive hMPQ\r
+ End If\r
End Function\r
diff --git a/WinMPQ.vbp b/WinMPQ.vbp
--- a/WinMPQ.vbp
+++ b/WinMPQ.vbp
StartMode=0\r
VersionCompatible32="0"\r
MajorVer=1\r
-MinorVer=65\r
+MinorVer=66\r
RevisionVer=0\r
AutoIncrementVer=0\r
ServerSupportFiles=0\r
VersionCompanyName="ShadowFlare Software"\r
VersionFileDescription="ShadowFlare MPQ Archiver"\r
-VersionLegalCopyright="Copyright © ShadowFlare Software 2001-2009"\r
+VersionLegalCopyright="Copyright © ShadowFlare Software 2001-2010"\r
VersionProductName="WinMPQ"\r
|