Navfixer v1.0

by Rof (rof@mellish.org.uk)

http://www.geocities.com/cofrdrbob/


Navfixer is a simple little program that fixes the annoying "Navigation Mesh
was built using a different version of this map" message that appears if you
try to embed a navigation (*.nav) file into a HL2/CS:S BSP mapfile using BSPZIP.

Navfixer is a stand-alone windows console program.

To use it, build the map as normal, generate the nav file, and embed it in the
bsp using bspzip (or a better alternative program such as Pakrat).

Now, drag-and-drop you .bsp file onto navfixer.exe. If navfixer finds the
embedded .nav file, you should see a message:
"Write the corrected nav file? (Y/N)"
Press "Y" to update the file, or "N" to abort.

The corrected file should be able to be loaded without the "navigation mesh" message.




Technical details:

The navigation mesh file (*.nav) starts with a 4-byte magic number (0xFEEDFACE),
followed by an integer version number, followed by an integer giving the length
of the associated bsp file when the nav mesh was generated. This stored length
is checked against the actual length of the bsp file when the map is loaded
(see the SDK source file \dlls\nav_file.cpp).

Obviously, if you later embed the nav file into the bsp file, the bsp file size
changes and the annoying "Navigation Mesh was built using a different version of
this map" appears.

Navfixer simply finds the current bsp file size, looks for the embedded .nav file
in the bsp's Pakfile data area, and updates the stored bsp length in the nav file.
Finally, it updates the CRC (checksum) of the nav file.


