VPK Search Paths

Today I fixed the VPK search paths issue.

The issue was that when you were opening folders to show the game content in the spawnmenu.. previously all VPK content showed in each folder. That was obviously wrong.

This was happening because the VPK stuff internally has no sense of search paths. They get searched all the time no matter what search path we’re specifying.

So we add this code to the VPK class..

ss (2013-03-05 at 02.07.06)

Then we can set what search path it’s meant to be on. In GMod we set up a new search path for each mounted content ( called “tf”, “dods”, “portal2” etc) so we can search only that mounted content. But the path is also added to “GAME” so that the content will actually get loaded. The code above isn’t really flexible but it serves our purposes.

The anywhere that VPK files are actually accessed we do a quick check using the provided PathID.

ss (2013-03-05 at 02.11.12)

And now we have searchable VPKs working properly!

Portal 2 content is back and all working. Although there are some crashes due to them all being a newer model format and me having hacked the shit out of stuff to get them working in the first place.. but I’ve fixed a couple of crashes so hopefully 99% of them will work without crashing.

cp_degrootkeep0001

cp_degrootkeep0003

arena_offblast_final0000

cp_degrootkeep0002

14 thoughts on “VPK Search Paths

    1. Why not leave it how it is?

      You guys see 5 lines of code and try to find a better way to write it. You don’t seem to realize that this isn’t my code – and the file that contains it is 1,740 lines long.

    2. The “alternative” you suggest is not even equivalent.
      If stuff==0 your code would break, the original wouldn’t.

  1. Awesome, nice job! Looks like we won’t have such a big problem when SteamPipe arrives. Also any hope that other content like CSGO will be able to be mounted in the future?

  2. So whens this update? I made a spawnlist for it since I did the VPK moving. BTW I replied to you on the maps thing.

  3. I dont think my game updated. when i go to the portal 2 content to get p-body its gone the + is replaced wih a – wih not thing in it! please help me!

  4. Well, and what about l4d2 problem? And that “needs to be re-compiled” error on all l4d and l4d2 models?
    It’s not really comfortable for me to store that much files in one folder (5000+ and all in one same folder in legacy addons)
    Or is it the time for me to re-install garry’s mod? :(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s