Forum

The filename case issue with Linux, etc.

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

The filename case issue with Linux, etc.

Postby Baker » Mon Mar 28, 2011 2:37 pm

Is there an existing Quake engine that has a file system method for dealing with uppercase/lowercase named pak files, map names and so forth?

Really, it wouldn't even need to be a Quake engine as long as it is open source and written in C or C++ with Linux as the platform.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Spike » Mon Mar 28, 2011 3:23 pm

fte does some interesting tricks
1: pak files are loaded by scanning for *.pak, which means it gets more than just pak0.pak, but also pAk0.pak and stuff.
2: fopen uses a case-insensitive hash table. files are found by name, and those cached names are used to fopen the file. (so foo.mdl -> fOo.MdL).

combined, those make the internal filesystem case-insensitive in linux and significantly faster in windows if you want 1000s of different possible files at load times.

the contents of q3's paks have always been case insensitive.
but yes, the main problem is 'PAK0.PAK' in the gamedir, as well as the gamedir itself.
the gamedir case is still an issue in FTE, admittedly. -game ID1 will 'fix' it, but hey.
If you want it truely insensitive, you need to opendir/readdir/closedir to find camelback filenames. I have yet to do that for gamedirs myself. But then I explicitly copy the files over.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Mon Mar 28, 2011 3:52 pm

Yeah a large part is this is simply killing the annoying PAK0.PAK/PAK1.PAK + thing in Linux, although I could do it a lazy way and check for both upper and lower case or terminate with a "Rename your pak files to lowercase otherwise most engines won't find this data. Restart after you have renamed."

Spike wrote:2: fopen uses a case-insensitive hash table. files are found by name, and those cached names are used to fopen the file. (so foo.mdl -> fOo.MdL).


Did not know!
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Spirit » Mon Mar 28, 2011 5:21 pm

jdhack's stilll unreleased engine has "host_matchfilecase 1/0" which is just fantastic.

God, I wish he would finally release it. The engine was/is a small revolution to me.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest