Resource icon

ResGen 1.10

Welcome to a nice and extremely useful Half-Life utility for parsing .bsp map files and building .res files. This utility was written by ShadowLord

ResGen has the following command line parameters:
-h This command will display the RESGen help screen.

-v Puts RESGen in silent mode. This means that RESGen will not
produce any signicficant output with the exception of error
messages. Also, RESGen will not wait for a kepress
before it exits.

-i *LINUX ONLY* RESGen will not display what directory its
searching for BSP files.

-s RESGen will not to display it's statuslines. These lines
are the yellow and red bars that appear on top of the console
(Windows), or at the bottom of you screen (Linux).
Use this command if you are running RESGen on a remote console
and you don't have a VERY fast connection (cable and better!).

-l *LINUX ONLY* RESGen will NOT convert the res file entries to
lowercase. Sadly some mappers did not pay attention to the
case of the names they used for files.
On linux this can cause the failure of Half-Life to locate
the files specified in the res file. That is why RESGen
converts all entries to lowercase (which is the standard unix
file naming convention).
This command will not matter on Win32 servers since
Win32 opens and closes files case-insensitive.

-f [mapname] Process the map named [mapname]. You can use -f more then once
to specify multiple maps.

-d [dir] Processes a entire directory. It will process the current
directory if you do not specify one.

-r [dir] Does the same as -d but RESGen will process subdirectories too.

-o Make RESGen overwrite existing RES files.

-u [dd-mm-yyyy] Only overwrites res-files older then [dd-mm-yyyy].
Notice that the date is in DAY-MONTH-YEAR format and NOT
in MONTH-DAY-YEAR format!!!
Also if you do not specify a date -u will behave as -o.
If the date you specify is not correct update behaviour
will be undefined! (It could update res files you didn't want
it to update).
If the res file doesn't contain the date information RESGen
add's to res files the file will get overwritten.
If there is no res file for a map yet a res file will be created.
RESGen stores the GMT date (which means it could seem it's a day
off). This has been done to 'internationalize' your res files.

-a [filename] Adds the contents of the file with the name [filename] to generated
res files. The file needs to have the extension .rfa! When specifying
the rfa file the .rfa extension is optional (RESGen will add the .rfa).

-w *WINDOWS ONLY* This will make RESGen exit without waiting for a keypress.

-c Displays RESGen credits.

resgen -r -u 06-11-2000 -a shadowlord.rfa

This will make RESGen generate .res files for maps that are in the current folder or any subdirs. It will only overwrite resfiles older then 6 november 2000 (GMT timezone). Also it will add the contents of the file shadowlord.rfa to all generated res files.

RESGen will ALWAYS only create new res files for the bsp files you specified or the bsp files it found when you use -r or -d.
So using -u or -a when you only have .res files will NOT work. You need to have the bsp file in the same directory as the res file you want to generate!

Advanced command guide & hints:
It is possible to add multiple commands in one command string like:
resgen -aru 06-11-2000 shadowlord.rfa

This will do the same as the command described in the example in the "usage" section.
HOWEVER. If you use this method the order of read command arguments ([filename] [dir] etc.) MUST be the following:
1) -u (a date)
2) -a (a rfa file)
3) -d/-r (a directory)

If you ommit one of the command arguments (except directory), or switch them, RESGen will mis-interprit the arguments!

Examples RESGen will fail:
resgen -aru shadowlord.rfa
resgen -aru shadowlord.rfa 06-11-2000

Examples RESGen will work:
resgen -ar shadowlord.rfa
resgen -ur 06-11-2000

It's safest to just seperate all commands (-a [filename] -r [dir-optional] -u [date]). That way nothing can go wrong.

The order of any command line parameters never matters.
The location/order of the argument that go with them do!

Hints for usage commands:
The -a command allows you to add your own file to the end of the res files you generate! This allows for some very interesting fucntions.
First off all you can add your credits to the res file. (Use // in front of any comment line. Else HL will see them as files.)

Another really interesting function are custom file packs. For example, the next version of the AdminMOD ( allows you to play sounds on the Clients computer. As a server admin you could add the sounds you want to be playable to the res file and have a really cool server that has it's own custom sounds!!!

And there are many more things you can do with this function (custom models, custom sprites, etc.)!

-u allows you to efficiently re-generate old res files without overwriting newer resfiles that don't need re-generation.
This can be handy in at least two occasions:
1) A older version of RESGen had a bug so that it created faulty res files.
2) You have updated your custom-files pack, but you only want to add it to res files that were created before a certain date.

Somehow all your resfiles are faulty or you just want to add a new rfa file to them.
Just use -o and all resfiles will be overwritten.

Contact/dl info:

Resgen return list - useable for batch scripts (if errorlevel x goto label)
0 = All OK
1 = BSP-file error
2 = Parse error, something went really wrong!
3 = mod error: unknown mod
4 = RES-file error

ToDo (priority from top to bottom):
- Wait for people to submit bugs (if any exist) so I can fix them :)

Please Note:
You might notice the new E-Mail adress ( Don't worry, the old one is still valid.
I'm working on a Half-Life tools site (, and what is a better place to start with then
with your own tools? :)
However, the URL for RESGen is still pointing to because isn't finished
yet. I will point it to the site as soon as it's done and I have another update for RESGen.

BTW. I know my English isn't 100%. 90% of the time it are typo's or I just wasn't paying attention to
what I was writing... The other 10% is because I really don't know how to write it correctly :)

Version Information (directly from the source. See the source for more info):
// Version info
// v1.10
// - Fixed a bug with very long directory names. The windows functions used to read files have a limit
// on how long a path string can be (260 characters). This has been corrected by making
// RESGen switch working directories as soon as it seems the path will get too long. The only
// limit now is the file system (but it's impossible to create files outside the limits of the file
// system, so no worries there :)
// - Also fixed another bug with the path length. When searching for maps, RESGen displays the current
// directory its searching in the status bar. If it exceeded 80 characters,
// it resulted in unexpected behaviour and might even crash. This has been corrected.
// v1.10_l
// - Added a display of the current directory being searched for .bsp files. Can be disabled with -i switch.
// -s also disables this.
// v1.10 & v1.10_l
// - I upgraded VString and VArray for some other project I have been working on. I ported the changes
// back to RESGen. You should see a HUGE speed increase!!!
// v1.00 & v1.00_l
// - Made a huge improvement to BSP file loading. The continual use of memory is much lower,
// And the memory usage spike when loading the BSP file is gone.
// RESGen used to load the entire BSP file to mem, copy the stuff it wanted to another
// memory locattion and then unloaded the BSP file from memory.
// Now RESGen only loads the part of the BSP header it needs, gets the location of the
// data it needs and then only loads that data into mem.
// This will also greatly reduce the loading time of the BSP files.
// v0.76 & v0.76_l
// - Made a few changes that will speed things up a bit (not much).
// - If this version contains no bugs the next one will probably be v1.00!!!
// - Added protection against corrupted BSP file headers.
// v0.76_l
// - Fixed problem with statbar showing up in non-verbal mode.
// - Added -t option. -t stops resgen from tracing symbolic links when searching directories
// for bsp files (the symbolic links will be ignored). To be used with -r or -d.
// - RESGen now checks for dirs the way it should... By 'file' properties. And not by trying to open it.
// - Fixed minor bug with displaying statbar. It should display more consistent now.

// v0.75_l
// - Added directory support to the linux version.
// - Linux now has a statusbar substitute. It also prints the number of the BSP file that is being
// processed when it starts with the BSP file.
// v0.71_l
// - This version is linux capable... There are no changes to the Win32 version.
// Some things were changed to the code (mostly usaged if #ifdef _WIN32 en #ifndef _WIN32).
// v0.71 & v0.71_l
// - Made some small speed increases regarding the allocation of memory for strings (tnx mjr!)
// v0.70
// - A test on a linux Half-Life server revealed that all file entries in the res file need
// to have the same case as the files and folders on the server.
// However, some mappers make a mess of their file cases and thus the .res file will be unusable.
// To prevent this all res entries will be made lower case, since that is the 'official' *nix
// file naming convention. This behaviour can be overridden with the commnd-line option -l.
// - ResGen will now add comment lines to .res files.
// - ResGen will now not overwrite .res files unless you specify -o or -u
// - The -u command allows you to update your older resfiles from the specified creation date
// - It is now possible to add a custom file to the end of a .res file that has been generated.
// - ResGen will not wait for any keypresses if you run it with -w.
// v0.65
// - Made a huge speed increase. ResGen will only check 50% of all 'strings' in the entity data.
// This can be done because all strings are pairs... A name and a corresponding argument.
// Only the arguments will contain files.
// The only thing that gets checked in the name is the word 'skyname'.
// - Made some small speed increases.
// - Got rid of the Valve source files... They used way to much mem ResGen didn't need. I copied all
// vars and functions ResGen needs to bspent.cpp and bspent.h
// Memory usage has decreased dramaticly!
// - Removed a bug that only shows up sometimes in multiple file mode. The BSP reading functions
// from Valve did not place a string terminator (NULL) at the end of the string.
// It's kinda complicated to explain, but the result is that ResGen ends up reading map data
// from previous maps. Somtimes this will cause no problems, sometimes it will generate file entries
// in a resource file that aren't supposed to be there and sometimes RESGen will crash or exit with
// an error message.
// v0.60
// - Improved commandline parameters even more. You can now do something like "resgen -dv half-life"
// - Directory support added. Dropped -drive command (you can do "-r C:\", which has teh same effect)
// - Fixed another problem with wad files. The problem was that if there is only 1 wad file,
// not terminated by a ";", ResGen would crash (it couldn't find the ";", which made it do a
// 'Mid ' with a negative string size... Ouch!
// - Improved statusbar. Now there are 2 bars. They will give you all the info you need.
// The best new thing is that there is a 'total progress' bar. And it displays resgen version.
// v0.55
// - Added much better command line support.
// - Added support for multiple files.
// - Added a status bar similar to the HL status bar. It displays the progress of the res
// generation for the current map.
// v0.51
// - As I suspected v0.50 was one big black hole for memory.. It went inside, but didn't come out.
// All memory 'holes' should have been 'plugged' now.
// v0.50
// - The fixed arrays have been replaced with linked lists. Now there can be as many unique files
// in the BSP as you have memory!
// - Notes: Yes this is v0.50! I consider the BSP parsing engine as done, unless I get any bug
// reports. v0.50 will parse any BSP file correctly and can be seen as a semi-final version of
// resgen. After this version I will be concentrating on possible bugfixes and the items found
// in the todo list (see above).
// v0.14
// - CString is a goner. And with it, the MFC too!
// I'm doing a lot with the memory in this code. As far as I know there are no bugs with the
// memory management. But IF you experience strange lockups with resgen, please tell me and
// include what map you were working on!
// - The only 'bug' that should be left is the fact that there can be only 100 unique files of
// a type in a map. If there are more resgen will exit with an error.
// This should be adressed in the next version. That version will probably be v0.50
// - A 'feature' of this version is that it will overwrite your resfile with a new one.
// This wil be changed after v0.50, when I start on directory browsing & file management.
// v0.13MFC
// - Fixed stupid bug with the skynames. resgen only generated the up-sky and didn't do the others.
// v0.12MFC
// - Bugfix: wad files without folder specification were ignored. This has been fixed.
// In relation to this bugfix there is also NO need anymore to specify the MOD!
// - Bugfix: the wad file string was still too long for the string-arrays.
// All strings are converted to CString... Becasue of this the MFC libraries had to be added.
// The MFC libraries will be removed once I write my own CString class.
// A side-effect of the MFC libraries is the inability to use fstream.h
// Output file streaming options have been replaced with stdio functions.
// v0.11
// - Bugfix: Maps made with zoner's half life tools could overflow some data arrays in bspfile.cpp
// The values have been increased to match those of zoners and the faulty maps now will load.
// - Bugfix: Some entries have a leading / or *. These will be removed.
// This fix should be upgraded to the removal of all leading non ascii chars.
// - Bugfix: The array chosen for strings was too small, so the list of wads would get turncated.
// The size is still potentially too small, but this can only be fixed with a linked list.
// That will be done in a future version, using multiple linked lists.
// v0.10
// - Major changes! The BSP reading routines have been completely replaced by the BSP file
// reading routines by Valve. The files used are C++ ports of their orriginal, Valve made,
// counterparts.
// The way it works now, is that it lets the files by Valve open the BSP and parse it into mem.
// From there ResGen takes over and reads the entity-data.
// - Preformance is still not too good, but much better.
// - ResGen should parse any wad file correctly, unless it's corrupted.
// - This release will be distributed to the public.
// v0.03
// - Minor fix. The last wad file will now be added, even if there is no terminating ";"
// v0.02
// - First test release.
// - Has much problems with skipping the binary part of the BSP, due to EOF chars inside that part.
// A fix would be to find a function that will binary read the file.
// - Has a small bug with the wad files. If the string of files isn't terminated by a ";", the program
// will refuse to read the last wad file.
// - Preformance is really lousy. Especially the storage arrays for the files that have been added to
// the res file. These should be linked lists.

coding this app, putting up with our bs

testing, the intro to this readme, and giving this app a nice little home on

testing, the assembling of this readme, help on the BSP and RES file format

helping me with MSVC++

helping me with MSVC++, some speed increases and RESGen linux!

the guy with the kickass bsp comile set.. some of his code was used for reference material

Valve Software
the guys who invented the game that made this app useful.. some of their code was used in this app..

The program is "as is".
Which means, if it breaks anything, or something goes wrong, anyone associated with this project is not responsible.

Some parts of the source are copyrighted by Valve.
File Bot
First release
Last update
0.00 star(s) 0 ratings

Share this resource