On Mon, Jul 9, 2012 at 2:06 PM, Emmanuel Anne emmanuel.anne@gmail.com wrote:
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 : http://bugs.winehq.org/show_bug.cgi?id=17956
So after reading the page about case insensitive filesystems there http://wiki.winehq.org/CaseInsensitiveFilenames 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 directory). 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.
It would be great to document this patch at http://wiki.winehq.org/InterestingPatches.