ValvePython / vpk

📦 Open, Search, Extract and Create VPKs in python
MIT License
162 stars 13 forks source link

Opening underlords vpk files raises error #12

Closed ARudiuk closed 5 years ago

ARudiuk commented 5 years ago

When trying to open an underlords vpk file I get the following error

ValueError: File is not VPK (invalid magic)

Code to reproduce

import vpk
import pathlib

path = pathlib.Path("Path/To/Underlords/Folder/game/dac")

path1 = path / 'pak01_001.vpk'

pak1 = vpk.open(path1)

Specifically, this check raises the error

if self.signature != 0x55aa1234:

rossengeorgiev commented 5 years ago

You need top open pak01_dir.vpk. All other vpk are partitions.

From the command line:

$ vpk /d/steam/steamapps/common/Underlords/game/dac/pak01_dir.vpk
           VPK File: /d/steam/steamapps/common/Underlords/game/dac/pak01_dir.vpk
            Version: 2
               Size: 701,276
        Header size: 28
         Index size: 701,200
Embedded chunk size: 0
           Tree MD5: c979966850491f56dcb2e2b405aeddc5 (OK)
   Chunk hashes MD5: d41d8cd98f00b204e9800998ecf8427e (OK)
           File MD5: 04cd642b34aad1793573b37130f81dbb (OK)
      Has signature: No
    Number of files: 15,985

$ vpk /d/steam/steamapps/common/Underlords/game/dac/pak01_001.vpk
Error: File is not VPK (invalid magic)
ARudiuk commented 5 years ago

That works! Thank you.

Sorry for my ignorance of how vpk worked.

Do you think it might be helpful in the future to specify _dir as the only readable files in the readme?

rossengeorgiev commented 5 years ago

VPK can also be just one files where the filelist and content are in the same. Or like here, filelist in _dir and everything else is content partitions. Technically, it could even use both at the same time.