some patches to read files faster (especially for baldur's gate and infinity engine games)

Emmanuel Anne emmanuel.anne at
Mon Jul 9 14:06:19 CDT 2012

Hello, I installed baldur's gate lately and noticed it was still slow in
wine, especially if I install a few mods.
See the description of the bug here :

So after reading the page about case insensitive filesystems there
I decided that one possible solution was to have everything in lower case.
So I made a 1st patch (see attachement).
After this, installing a weidu mod in baldur's gate becomes faster, but
loading a savegame is still very slow compared to windows.

After some more investigation using strace, it's because the program
uses NtQueryDirectoryFile to check if a file is present in the override
directory instead of trying to open it directly, which produces a getdents
call in linux, which is extremely unefficient. So I just added a short cut
for this function : if the filename argument has no wildcard, then just use
stat to return wether the file exists or not. This is in the 2nd patch.
After this, loading savegames was extremely fast, comparable to windows
speed, finally, and there are no more slowdowns in game, it runs smoothly
all the time !

Well I am sure you'll find I didn't make them the right way, but I hope the
ideas will be useful to you and that you'll merge them in one form or
another into wine.
Oh yes, after applying them, all the new files created by wine will be in
lower case, but you'll eventually have to convert all the files to lower
case in the wine directories (it's required at least in the baldur's gate 2
Also having a wineprefix with mixed lower and upper case characters would
create problems.
But except that, it works excessively well ! :)
So maybe you'll want this enabled only if the user explecitely chooses to
enable it.
For me I know I'll keep it !
I attach the simple perl script I used to convert everything to lower case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lower-case-filenames-makes-weidu-incomparably-faster.patch
Type: application/octet-stream
Size: 3391 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-NtQueryDirectoryFile-acceleration-for-single-files.patch
Type: application/octet-stream
Size: 1828 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/octet-stream
Size: 322 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list