[physfs] priorities with Descent2 HOG files

Dennis Schridde devurandom at gmx.net
Sat Mar 31 06:39:50 EDT 2007

Am Samstag, 31. März 2007 schrieb Christian:
> Hello
> I am working with the modified Descent2 source D2X and I am pretty new
> to PhysFS so I need to ask this here.
> I am currently fighting with the priorities of the HOG files when custom
> content should be loaded.
> Example:
> The main file of Descent2 - descent2.hog is loaded at init or Program
> and as far as I see it mustn't be closed until the whole game quits.
> In this example this file has a Music track within called game01.mid
> Now I load a addon mission, with custom content (by adding to search path).
> This file ALSO has a (modified) game01.mid which is not used, the
> game01.mid from descent2.hog is used for this.
> I had the approach to remove descent2.hog from Search path, adding the
> custom file and then adding descent2.hog again to switch the priority
> for this files.
> But this wasn't very reliable since while this happens, there could be
> opened files within the descent2.hog which fails removing it from search
> path.
> I have digged through the PhysFS doc very closely but I haven't found
> anything yet.

When you add a directory to the PhysFS search path via PHYSFS_addToSearchPath 
you supply a parameter appendToPath, which specifies whether the directory 
shall appear at the end or at the start of the search path.
The search path works like %PATH% or $PATH:
It is searched from the start to the end for the requested file.

From the mainpage of the physfs docs:

 Once the search path is defined, you may open files for reading. If you've 
got the following search path defined (to use a win32 example again):
 Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory 
separator, lack of drive letter, and lack of dir separator at the start of 
the string; this is platform-independent notation) will check for C:
\mygame\textfiles\myfile.txt, then C:
\mygame\myuserfiles\textfiles\myfile.txt, then D:
\mygamescdromdatafiles\textfiles\myfile.txt, then, finally, for 
textfiles\myfile.txt inside of C:\mygame\installeddatafiles.zip. Remember 
that most archive types and platform filesystems store their filenames in a 
case-sensitive manner, so you should be careful to specify it correctly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/physfs/attachments/20070331/6dbda023/attachment.pgp>

More information about the physfs mailing list