https://bugs.winehq.org/show_bug.cgi?id=50351
Bug ID: 50351 Summary: Slow text rendering in dofus linked to fnIMLangFontLink2_GetCharCodePages calling WideCharToMultiByte with CP_UNICODE Product: Wine Version: 6.0-rc2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: mlang Assignee: wine-bugs@winehq.org Reporter: eijebong+wine@bananium.fr Distribution: ---
Created attachment 68941 --> https://bugs.winehq.org/attachment.cgi?id=68941 Patch that fixes the text rendering slowness (probably wrong)
Dofus is very slow to render text and changing communication channels can hang the game for a few seconds.
Profiling shows that it's spending lots of time opening files. Tracing shows it's trying to open c_1200.nls a *lot*. That file doesn't exist.
Discussion on IRC:
``` 22:45:27 nsivov> so that comes from mlang 22:45:47 gofman> mind umbstowcs and friends... what if it really ends up searchign / opening locale file each time due to some reason (which can be fixed) 22:46:37 gofman> or maybe it doesn't find some locale and tries again on each character 22:48:07 zf> no such code page on Windows either 22:48:33 zf> we should probably cache failed attempts there 22:48:45 nsivov> in mlang it goes 1 char at a time * mlang_data size 22:49:30 gofman> cache missing is strange, but maybe some cached list of which locale exist is possible
[...]
22:55:15 julliard> that's an mlang bug, CP_UNICODE is not a real codepage 22:57:01 nsivov> yes, for that particular loop it should be excluded
[...]
23:38:04 zf> just judging from the diagnosis above, it seems like fnIMLangFontLink2_GetCharCodePages() is using CP_UNICODE in WideCharToMultiByte() when it shouldn't ```
The attached diff fixes the slowness but is probably not correct and I certainly don't understand enough about the cause to either write a meaningful commit message or a test.