I happened to get interested in pak files before i started my own package format a year ago(i found .pak's pretty useless for my purpose) Here's a class i made for reading pak contents, there should be enough .pak editors out there if you search...
This was coded when i had no service packs installed but the type hearders seems ok. If you have any problems let me know
Code:Option Explicit Option Compare Text Private Type FileInPAK named As String * 56 filepos As Long filelen As Long End Type Private Type PAKFileHeader ident As Long dirofs As Long dirlen As Long End Type Private PakHeader As PAKFileHeader Private PakFiles() As FileInPAK Private Pfilename$ Property Get Filename$() Filename = Pfilename End Property Property Let Filename(newvalue$) If newvalue = Pfilename Then Exit Property Dim ff% ff = FreeFile Open newvalue For Binary Access Read As ff Get #ff, , PakHeader ReDim PakFiles(FileCount - 1) Get #ff, PakHeader.dirofs + 1, PakFiles() Close ff End Property Property Get FileCount() As Integer FileCount = Int(PakHeader.dirlen / 64) + 1 End Property Property Get Data(ByRef indexOrFilename, Optional ByVal output) As Byte(): Dim index&, ff1%, ff2%, buffer() As Byte Select Case VarType(indexOrFilename) Case Is < vbInteger Exit Property Case Is < vbDate index = indexOrFilename Case vbString For index = 0 To FileCount - 1 If PakFiles(n).named Like "*" & indexOrFilename & "*" Then Exit For Next index If index = FileCount Then Exit Property Case Else Exit Property End Select If output = "" Then output = index & ".tmp" ff1 = FreeFile Open Pfilename For Binary Access Read As ff1 ReDim buffer(PakFiles(index).filelen - 1) Get #ff1, PakFiles(index).filepos + 1, buffer If IsMissing(output) Then Data = buffer Else ff2 = FreeFile Open output For Binary As ff2 Put #ff2, , Data Close ff2 End If Close ff1 End Property





Reply With Quote