Writing a Pakrat replacement

Wander

L3: Member
Sep 16, 2010
148
55
I had a small issue with a custom texture, in the list it would automatically put a / at the start of the path, which caused the texture not to work in game
I tried to remove the /, but it would automatically put it back
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Can you send in a debug log? (Instructions on page, page link is also in app.) Note that the log is cleared each time you start the program, so if you've done other projects in the meantime you'll need to go back to the custom map and make it happen again.

The bug is currently in the tracker here.


________________________

An update: I've finished most of the general-level architecture changes to support slotting in different development kits than SourceSDK. Instead of asking you for "Engine" and "Game", it will also display different Development Kits.

I still need to work in the L4D2-specific bits, such as supporting vpk.exe for packing, and possibly changing the map-parser to support the newer format.

Eventually I'd like to support the Alien Swarm tools, and rewrite my tests and things to rely on that since it means anybody who need to develop PackBSP can test it against a free game instead of needing something else.
 
Last edited:

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Sort of in a bit of analysis-paralysis right now. I'm trying to figure out the best way to "ID" a game.

I don't want to rely on the title shown in the Source SDK launcher... Because some people might have "Counter-Strike: Source" or "Counterstrike Source" and other variations... The AppID doesn't really identify things... Maybe the folder "cstrike" or the folder/exe combo?
 

tyler

aa
Sep 11, 2013
5,102
4,621
So I've noticed some people can't pack the textures for custom models in the construction pack. I've never had an issue packing any of them, so I don't know what's happening at all.
 

Languid

L5: Dapper Member
Oct 9, 2009
240
256
the .fgd file could be a good way to identify the game! I don't know shit about anything though so that might not work.
 

Fruity Snacks

Creator of blackholes & memes. Destroyer of forums
aa
Sep 5, 2010
6,394
5,571
So I've noticed some people can't pack the textures for custom models in the construction pack. I've never had an issue packing any of them, so I don't know what's happening at all.

if it helps, i noticed that (I think) it is the models where there are different skins for it, but are set up like ibeam.vmf/ibeam.vtf (thats skin0) but then the next skin is just like ibeam_1.vtf, no associated .vmt and i think that might be the issue.


it also forgets prop_lightwarp
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Rewriting thigns, I'm running into some big technical complexity issues when it comes to cases where an asset (like materials/foo.vmt) is both on the disk in the game directory, and also already packed inside the map the user wants to alter. Trying to provide an uber-customizable system is proving very difficult, because very small choices can "cascade" and invalidate/enable even more choices down the line.

So, how does this sound?

When you use PackBSP, you must choose one of these two options (from a drop-down menu) for how the program should act when there's an asset on-disk which differs from one with the same name already inside the BSP.

Not fine-grained, just a very broad, consistent strategy that affects all of the maps you might be working with:

  • Always replace the BSP's copy with the version on-disk.
    • Con: The program is no longer "what you see is what you get", because running it can change how a map looks compared to how it looked when you tested it earlier.
    • Pro: You can tinker or make small fixes to your art, models, etc. without having to re-compile or keeping a pre-packing copy of the map(s).
  • Always use the BSP's copy, and prevent overwrites.
    • Pro: The packed map is much more likely to be exactly like what you just saw when playing it locally.
    • Con: You cannot "redo" something you already packed into the BSP.

And, in either case, you can choose to do last-minute manual and completely-unguarded tinkering to the packing list(s).
 
Last edited:

Empyre

L6: Sharp Member
Feb 8, 2011
309
187
How about making option B the default, and adding a way to unpack something from a bsp? Or how about a way to re-pack something? Or both. This way, the copy in the bsp would never be overwritten unless the user does it himself (from within the program). Still allowing option A would be nice, too, but as a setting in the menu somewhere, with option B as the default.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
How about making option B the default, and adding a way to unpack something from a bsp?
While I probably could write code to do that, currently I'm delegating the final packing to bspzip.exe (or in the future, vpk.exe.) Last I checked, bspzip doesn't support plain removal, only overwriting.

I may just have it automatically create a "pre-packing" backup of the map-file. (ex: foo.bsp.bak.) So if a user says: "Oh, crap, I accidentally put too much in there and it takes hours to compile", they can just replace foo.bsp with foo.bsp.bak.
 

Empyre

L6: Sharp Member
Feb 8, 2011
309
187
OK, how about this? Make option B the default, except allow the player to manually overwrite stuff. When the player overwrites stuff, pop up an "Are you sure?" box with a warning that doing so might change what you saw when you tested the map. The warning box would need a "Don't show me this again" checkbox, and it would still be nice to have an option somewhere in the menus to switch to option A.

Also, it would be a bonus to let the user restore the pre-packing backup from within your program's gui with the push of a button or selection of a menu option.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
May just use B all the same until people--ones who are used to a much more free-form non-automatic tool--complain.

Now I'm considering how that "first step" occurs. The simplistic way is to ask people to just select a series of maps, but that might not cut it. What if they're packing a L4D2 campaign and the program needs to know about the addonContent_prop setting from addoninfo.txt? Or to read the list of maps from the mission file?

By contrast, Portal 2 seems to use not-worth-it-to-analyze per-mission scripting to route you between missions, so people would need to pick a list of maps for that...

_____

Hell, maybe the saner solution is to stop trying to make everything configurable and just maintain multiple branches of the project :(
 
Last edited:

Boylee

pew pew pew
aa
Apr 29, 2008
1,068
709
Pakrat only works on some files for me these days and pakbsp seems to have the same problem, it just hangs when it gets to the crawling stage. :/

Weirdly, once the bsp has been edited by another process (in my case and old pakking program called Map ANalyst or MAN) pakrat and packbsp open it just fine. Any ideas why this is?
 
Last edited:

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Not sure. Perhaps Valve changed the format of their BSPs a bit?

Are there any warnings in the debug log when it "hangs"?
 

lana

Currently On: ?????
aa
Sep 28, 2009
3,075
2,778
This issue is still occurring. It seems to hang on
Code:
DEBUG [HlLib] Creating dynamic proxy for library access

Here's the debug info for the entire session:
Code:
16:07:40,558 DEBUG [WindowsRegistryChecker] Executing: reg.exe query HKCU\Software\Valve\Steam /v SteamPath
16:07:40,601 DEBUG [WindowsRegistryChecker] Exit val: 0
16:07:42,677 INFO  [AppModel] Creating temporary copy of registry blob to avoid read/write conflicts.
16:07:42,864 INFO  [AppModel] Attempting to parse client registry blob at: C:\Users\Nerdboy\AppData\Local\Temp\packbsp_temp_4736443645246150149.blob
16:07:42,871 DEBUG [RegParser] Beginning parse of client registry blob data
16:07:42,874 TRACE [RegParser] Populating folder TopKey
16:07:42,875 TRACE [RegParser] Populating folder SteamServerAddressCache
16:07:42,877 TRACE [RegParser] Populating folder BootStrapperVersionNum
16:07:42,878 TRACE [RegParser] Populating folder ClientAppVersionNum
16:07:42,878 TRACE [RegParser] Populating folder BootStrapperChecksums
16:07:42,878 TRACE [RegParser] Populating folder Bootstrapper
16:07:42,879 TRACE [RegParser] Populating folder ClientApp
16:07:42,881 TRACE [RegParser] Populating folder ClientBandwidthStats
16:07:42,882 TRACE [RegParser] Populating folder Data
16:07:42,883 TRACE [RegParser] Populating folder _Users
16:07:42,883 TRACE [RegParser] Populating folder nerdboy6
16:07:42,883 TRACE [RegParser] Populating folder _Apps
16:07:42,894 TRACE [RegParser] Populating folder 7
16:07:42,894 TRACE [RegParser] Populating folder 70
16:07:42,894 TRACE [RegParser] Populating folder 1200
16:07:42,894 TRACE [RegParser] Populating folder 34050
...
16:07:43,199 TRACE [RegParser] Populating folder 461
16:07:43,199 TRACE [RegParser] Populating folder SelectedConnectWithTimeout
16:07:43,251 DEBUG [ClientRegistry] Finding compressed ContentDescriptionRecord section
16:07:43,306 DEBUG [ClientRegistry] Extracting compressed CDR section
16:07:43,306 DEBUG [RegParser] Inflating a compressed binary section, initial length (including header) is 3043611
16:07:43,306 DEBUG [RegParser] Header claims payload compressed length is 3043591, deflated length is 21729106, compression level 9
16:07:43,336 DEBUG [RegParser] Beginning decompression
16:07:43,485 DEBUG [RegParser] Decompression successful
16:07:43,485 DEBUG [ClientRegistry] Creating reader for decompressed CDR data
16:07:43,539 INFO  [AppModel] Username detected as: nerdboy6
16:07:43,539 DEBUG [CdrParser] Getting app folder name for app 211
16:07:43,540 TRACE [CdrParser] Retrieving nested index-based values from content data description: [1, 211, 3]
16:07:43,580 INFO  [AppModel] SDK directory detected as: c:\program files\steam\steamapps\nerdboy6\SourceSDK
16:07:43,581 DEBUG [AppModel] Checking for games defined in in c:\program files\steam\steamapps\nerdboy6\SourceSDK\bin\orangebox\bin\gameconfig.txt
16:07:43,597 TRACE [GameConfigReader] Checking file for defined games...
16:07:43,618 TRACE [GameConfigReader] Found game: Half-Life 2
16:07:43,631 TRACE [GameConfigReader] Found game: Half-Life 2: Episode One
16:07:43,648 TRACE [GameConfigReader] Found game: Half-Life 2: Episode Two
16:07:43,659 TRACE [GameConfigReader] Found game: Portal
16:07:43,668 TRACE [GameConfigReader] Found game: Team Fortress 2
16:07:43,678 TRACE [GameConfigReader] Found game: Day of Defeat: Source
16:07:43,687 TRACE [GameConfigReader] Found game: Counter-Strike: Source
16:07:43,696 TRACE [GameConfigReader] Found game: Half Life 2 Deathmatch
16:07:43,698 DEBUG [AppModel] Checking for games defined in in c:\program files\steam\steamapps\nerdboy6\SourceSDK\bin\source2007\bin\gameconfig.txt
16:07:43,699 TRACE [GameConfigReader] Checking file for defined games...
16:07:43,699 WARN  [AppModel] No games were defined for engine: source2007
16:07:43,699 DEBUG [AppModel] Checking for games defined in in c:\program files\steam\steamapps\nerdboy6\SourceSDK\bin\ep1\bin\gameconfig.txt
16:07:43,706 TRACE [GameConfigReader] Checking file for defined games...
16:07:43,714 TRACE [GameConfigReader] Found game: Half-Life 2
16:07:43,722 TRACE [GameConfigReader] Found game: Counter-Strike: Source
16:07:43,729 TRACE [GameConfigReader] Found game: Half-Life 2: Deathmatch
16:07:43,739 TRACE [GameConfigReader] Found game: Half-Life 2: Episode One
16:07:47,352 INFO  [AppModel] Gameinfo file at: c:\program files\steam\steamapps\nerdboy6\team fortress 2\tf\gameinfo.txt
16:07:53,207 INFO  [AppModel] Source BSP specified as: C:\Program Files\Steam\steamapps\nerdboy6\team fortress 2\tf\maps\koth_moonwalker_a4.bsp
16:07:54,267 DEBUG [HlLib] Setting JNA type and function mappers
16:07:54,281 DEBUG [HlLib] Detecting architecture from property sun.arch.data.model
16:07:54,281 INFO  [HlLib] Loading native library: hllib_32
16:07:54,414 DEBUG [HlLib] Calling library initialization function
16:07:54,420 DEBUG [HlLib] Creating dynamic proxy for library access

And then it hangs. It doesn't stop, freeze, or crash. The progress bar on the "crawling" popup just scrolls constantly, and it cannot be closed.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Hmmm. The whole HLLib DLL is a bit of a black mystery box to me, unfortunately.

I think the next thing it tries to do involves the gameinfo.txt file for the game. Is it there and does it look right?
 

Freyja

aa
Jul 31, 2009
2,994
5,813
PackBSP never works for me. It always complains about clientregistry.blob. The problem is, I can't finish all the hundreds of updates I have or my internet will explode. Is there any workaround, dear Terr?
 

lana

Currently On: ?????
aa
Sep 28, 2009
3,075
2,778
Hmmm. The whole HLLib DLL is a bit of a black mystery box to me, unfortunately.

I think the next thing it tries to do involves the gameinfo.txt file for the game. Is it there and does it look right?

It's there and it's as standard as can be.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
PackBSP never works for me. It always complains about clientregistry.blob. The problem is, I can't finish all the hundreds of updates I have or my internet will explode. Is there any workaround, dear Terr?

If the complaint involves permissions, the problem is that steam.exe is telling Windows that absolutely nobody else can touch its preciousssss. And AFAIK Valve doesn't publish the information it in in any other way... I could make a dump of it, but the values might change at any time (like when they split up some of the TF2 GCFs because they hit the 4gb limit.)

I'd try stopping Steam, starting PackBSP, then starting Steam again before you hit the final packing step.
 

Dr. Spud

Grossly Incandescent
aa
Mar 23, 2009
880
854
Found a new problem.

When a map has a large amount of dependencies, scrolling through the list of assets will crash my display driver. My screen goes black and a few moments later I get the "Your video driver stopped responding and has recovered" windows message.