https://www.17buddies.rocks/index.html

17's Buddies Maps HL1 Maps HL2 Wads Plan des Maps
17 Buddies
Only for stats

Welcome Guest ( Log In | Register )

 
New
Find Out Which Wads Are In Effective Use By A Bsp, How to find out which WAD files are in effective use by a BSP file?
eduardolucioac
post 07/10/2022 - 04:06:55 |   Post #1
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


With the following command...

CODE
HLExtract.exe -p "fy_office.bsp" -e "root\fy_office.ent"


... is possible to find out which WAD files (textures) are listed as in use by a BSP (map) file as this output example ("fy_office.ent" file content extracted in the above command)...

CODE
{
"wad" "\programme\valve\valve\thwc_hl.wad;\programme\valve\cstrike\sourcebuero.wad;\programme\valve\cstrike\villaggio.wad;"
"mapversion" "220"
"MaxRange" "4096"
"skyname" "tornsky"
"classname" "worldspawn"
"classname" "worldspawn"
}
[...]


Notice that in the item "wad" several WAD files (textures) are listed. It turns out that none of these WAD files are needed even though they are listed. This happens with many BSP (map) files.

I've already tried several utilities and haven't found any that allow me to set this information correctly. I needed a utility that can be used via command line, as I need this output in text.

Is there any utility or strategy (via the command line) that I can use to correctly define this information, ie which WAD files (textures) are actually in use by a BSP (map) file?

Thanks! (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)
Post PM
Website
Go to the top of the page
LiveWire
post 07/10/2022 - 18:03:12 |   Post #2
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


I can`t think of any, it might be worth asking on https://twhl.info/ in case someone there knows. Have a search though github as there`s lots of half-life / goldsrc tools on there.

Whats the reason to you need to do this?



Found this on https://github.com/kriswema/resgen

Do not ignore unused WAD files. Necessary if the client insists on receiving all WADs referenced by the BSP, even if unused. Only works if used with the -u option.

Parses relevant resource files to make sure they are actually used (such as WAD files) or to check if they have dependencies (such as MDL files with seperate textures). Only works with -e option.

This post has been edited by LiveWire: 07/10/2022 - 18:17:20
Post PM
Go to the top of the page
eduardolucioac
post 08/10/2022 - 02:09:45 |   Post #3
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


This is an old question and the answer is simple, NO.

WHY? Because the BSP file does not have this information.

In reality, BSP files only have the list of WAD files it uses and the names of the textures, but it does not have information to which WAD file a particular texture belongs. The names of these textures are unique within a BSP.

---------------------------------------------------------------------------

The way GoldSrc (CS 1.6) works gives the false impression that it "knows" which WAD files are needed. But not quite...

To understand how GoldSrc (CS 1.6) works, let's imagine the following scenario: You have loaded a BSP file, but you have not made any of the referenced WAD files available...

CODE
[...]
"wad" "\programme\valve\valve\thwc_hl.wad;\programme\valve\cstrike\sourcebuero.wad;\programme\valve\cstrike\villaggio.wad;"
[...]


... in the "cstrike" or "valve" folders.

So, still within this scenario, let's imagine some more situations to demonstrate how GoldSrc (CS 1.6) would act when trying to load each of the textures pointed at in the BSP file:

  • Attempts to load all referenced WAD files that are in the "cstrike" or "valve" folders. Cannot load any;
  • Tries to load each of the referenced textures. Can't find the first one;
  • Search the list of WAD files and notice that the first one is not loaded. Then it warns that this file is missing (message box);
  • The user makes this WAD file available in the "cstrike" folder and tries to load the BSP again;
  • Loads all the referenced textures that are in the available WAD file, but realizes that there are still unavailable textures;
  • Asks for the next WAD file in the list;
  • And so on...


---------------------------------------------------------------------------

PLUS: POSSIBLE SOLUTION (A LINUX APPROACH)

The only possible solution to programmatically determine (via BASH script, for example) which WAD files are needed is to export the list of textures from a WAD file with a utility like "HLExtract.exe"...

EXAMPLE

CODE
WINEDEBUG=-all wine "<PATH>/HLExtract.exe" -p "<PATH>\SOME_WAD.wad" -l | grep -i ".bmp" | cut -d\\ -f2 | cut -d. -f1 > "SOME_WAD_TEXTURES_LIST.txt"


... and based on the obtained list check each of the textures inside the BSP using a utility like "strings"...

EXAMPLE

CODE
strings "<PATH>/SOME_BSP.bsp" | grep -iw -- "SOME_TEXTURE_NAME" >> "SOME_BSP_TEXTURES_IN_USE.txt" 2>&1


... so that if located, then this WAD file is in use by the BSP file.

NOTES:

  • The first command lists all textures in the "SOME_WAD.wad" file and outputs to the "SOME_WAD_TEXTURES_LIST.txt" file. The second command checks if the texture name is in the file "SOME_BSP.bsp" and outputs to the file "SOME_BSP_TEXTURES_IN_USE.txt" making an append if it already exists - useful for executing the same command in sequence;
  • A BSP file can have its textures embedded in it so that it will not need the referenced WAD files;
  • A WAD file can have textures that have the same name as textures in another WAD file. The precedence of loaded textures is always by the last loaded WAD - the order followed is the same as the "wad" attribute which has the list of referenced WAD files. This can give the false impression that a WAD is not needed if a previous one already has textures with the same name, however this can result in the wrong textures being loaded.


Thanks! (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)

This post has been edited by eduardolucioac: 08/10/2022 - 02:10:57
Post PM
Website
Go to the top of the page
eduardolucioac
post 08/10/2022 - 02:13:30 |   Post #4
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


QUOTE (LiveWire @ 07/10/2022 - 14:03:12) *
I can`t think of any, it might be worth asking on https://twhl.info/ in case someone there knows. Have a search though github as there`s lots of half-life / goldsrc tools on there.

Whats the reason to you need to do this?



Found this on https://github.com/kriswema/resgen

Do not ignore unused WAD files. Necessary if the client insists on receiving all WADs referenced by the BSP, even if unused. Only works if used with the -u option.

Parses relevant resource files to make sure they are actually used (such as WAD files) or to check if they have dependencies (such as MDL files with seperate textures). Only works with -e option.



RESGen does not work this way. This option gives us the false feeling that it has this ability.

Thanks! (IMG:style_emoticons/default/thank_you2.gif) Thanks!
Post PM
Website
Go to the top of the page
rUsHnUt
post 08/10/2022 - 16:20:27 |   Post #5
+Reply

Group: Member
Posts: 11
Joined: 05/03/2016

be 


I don't know if this is of any use but you can try by typing "developer 1" in console.
Then launch a map and check the console for the text "Using WAD File:".
Post PM
Website
Go to the top of the page
LiveWire
post 10/10/2022 - 23:22:33 |   Post #6
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


QUOTE (eduardolucioac @ 08/10/2022 - 02:13:30) *
RESGen does not work this way. This option gives us the false feeling that it has this ability.

Thanks! (IMG:style_emoticons/default/thank_you2.gif) Thanks!



Hi, did you try that linked version of resgen? from the comments I would of thought it checks the wads.

https://hlbsp.sourceforge.net/index.php?content=bspdef


I used above link to make a bsp loader for unity, if you look at the texture lump string names are in BSPMIPTEX with the texture width and height, if the mipmap offsets are zero then it searches though the wad list in the bsp for them, if it can`t find the texture it uses a puple/black checkerboard.

As you said the wads in hammers list seem to be included even if they are not used, I`m not sure if this is still the case with recent compilers like vhlt umhlt.


Most of the c# coded needed to make a tool to check textures is in here

https://github.com/thelivewire/unityHalf-life
Post PM
Go to the top of the page
mikado
post 11/10/2022 - 05:07:28 |   Post #7
+Reply

Group: Advanced
Posts: 502
Joined: 24/07/2005

be 


installe wally et tu pourras voir ce wad avec leur fichier
Post PM
Website
Go to the top of the page
LiveWire
post 11/10/2022 - 18:36:45 |   Post #8
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


Looking at the code in resgenclass.cpp of that version of resgen it looks like it does check if wads are used.


QUOTE (eduardolucioac @ 08/10/2022 - 02:13:30) *
RESGen does not work this way. This option gives us the false feeling that it has this ability.

Thanks! (IMG:style_emoticons/default/thank_you2.gif) Thanks!

Post PM
Go to the top of the page
LiveWire
post 11/10/2022 - 18:39:55 |   Post #9
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


I think they want an easy way to do this to lots of BSP

QUOTE (mikado @ 11/10/2022 - 05:07:28) *
installe wally et tu pourras voir ce wad avec leur fichier

Post PM
Go to the top of the page
eduardolucioac
post 11/10/2022 - 23:34:50 |   Post #10
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


QUOTE (LiveWire @ 10/10/2022 - 19:22:33) *
Hi, did you try that linked version of resgen? from the comments I would of thought it checks the wads.

https://hlbsp.sourceforge.net/index.php?content=bspdef


I used above link to make a bsp loader for unity, if you look at the texture lump string names are in BSPMIPTEX with the texture width and height, if the mipmap offsets are zero then it searches though the wad list in the bsp for them, if it can`t find the texture it uses a puple/black checkerboard.

As you said the wads in hammers list seem to be included even if they are not used, I`m not sure if this is still the case with recent compilers like vhlt umhlt.


Most of the c# coded needed to make a tool to check textures is in here

https://github.com/thelivewire/unityHalf-life


QUOTE
I`m not sure if this is still the case


I can't say if you're right, but I can say with certainty what I wrote in these excerpts...

QUOTE
A BSP file can have its textures embedded in it so that it will not need the referenced WAD files;
A WAD file can have textures that have the same name as textures in another WAD file. The precedence of loaded textures is always by the last loaded WAD - the order followed is the same as the "wad" attribute which has the list of referenced WAD files. This can give the false impression that a WAD is not needed if a previous one already has textures with the same name, however this can result in the wrong textures being loaded.


QUOTE
Most of the c# coded needed to make a tool to check textures is in here


I found this information very useful, but unfortunately the code I am writing is not in C#. Thank you anyway. (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)
Post PM
Website
Go to the top of the page
eduardolucioac
post 11/10/2022 - 23:36:45 |   Post #11
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


QUOTE (mikado @ 11/10/2022 - 01:07:28) *
installe wally et tu pourras voir ce wad avec leur fichier


QUOTE
Install wally and you can see this wad with their file.


Plase, write in English. (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)
Post PM
Website
Go to the top of the page
LiveWire
post 12/10/2022 - 12:05:10 |   Post #12
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


https://github.com/kriswema/resgen


eduardolucioa looking at its source code the above version of resgen looks to do exacly what you need.



QUOTE (eduardolucioac @ 11/10/2022 - 23:34:50) *
I can't say if you're right, but I can say with certainty what I wrote in these excerpts...


I found this information very useful, but unfortunately the code I am writing is not in C#. Thank you anyway. (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)

Post PM
Go to the top of the page
eduardolucioac
post 12/10/2022 - 20:21:14 |   Post #13
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


QUOTE (LiveWire @ 12/10/2022 - 08:05:10) *
https://github.com/kriswema/resgen


eduardolucioa looking at its source code the above version of resgen looks to do exacly what you need.


I believe this is the option...

QUOTE
Added WAD file parsing. RESGen will now check if a WAD file actually contains textures used by the map. It also reports any missing textures. Use the -u switch to activate the checking.


... it basically does the same process (via "brute force") that I described. That is, a given WAD will be in use if the texture(s) has its name referenced within the WAD (as well as the WAD name itself). The determination of who is being used or not (WAD) is done through a cross-referencing of information.

IMPORTANT: The version that has this feature is 2.0.3 . We were unable to test this version.

Thanks! (IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)
Post PM
Website
Go to the top of the page
LiveWire
post 12/10/2022 - 22:06:36 |   Post #14
+Reply

Group: Advanced
Posts: 127
Joined: 28/07/2013

gb 


Just to muddy the water a little more (IMG:style_emoticons/default/wink.gif)

A texture might already be in memory from previous maps and won`t be loaded at all.

There was a trend of retexturing maps by making new wads but keeping the old texure names, this caused textures to bleed from map to map with some weired results.


https://www.17buddies.rocks/17b2/View/Map/9...che_remake.html
https://www.17buddies.rocks/17b2/View/Map/8...nche_urban.html
https://www.17buddies.rocks/17b2/View/Map/9...che_orange.html
https://www.17buddies.rocks/17b2/View/Map/8...nche_aztec.html
https://www.17buddies.rocks/17b2/View/Map/3..._avalanche.html



Post PM
Go to the top of the page
eduardolucioac
post 13/10/2022 - 02:42:50 |   Post #15
+Reply

Group: Member
Posts: 7
Joined: 02/10/2017

br 


QUOTE (LiveWire @ 12/10/2022 - 18:06:36) *
[...]
A texture might already be in memory from previous maps and won`t be loaded at all.

There was a trend of retexturing maps by making new wads but keeping the old texure names, this caused textures to bleed from map to map with some weired results.
[...]


Man, this is "loco"... It's true! These textures and other things tend to behave weirdly when we load several maps in sequence, including some referring to the "good" old "512 Precache Limit"... (IMG:style_emoticons/default/to_pick_ones_nose2.gif)
Post PM
Website
Go to the top of the page
Chapo
post 14/10/2022 - 15:26:03 |   Post #16
+Reply

Group: 17 Buddies
Posts: 18 535
Joined: 27/12/2003

fr 

Team:
Dev. 17b


(IMG:style_emoticons/default/old.gif)

Perhaps should you take a look at BSPFile class in HLBox17b source code ;-)

(IMG:style_emoticons/default/smiley-ipb-421-60dce7.gif)
Post PM
Website
Go to the top of the page
4 User(s) are reading this topic (4 Guests and 0 Anonymous Users)
0 Members:

New
 


RSS Lo-Fi Version
 
Skin © Chapo