Commit 216a0dc
fix(window-title): stop mojibake when setting GW window title to char name
GetPlayerName() fell back to CharContext::player_name, a fixed-size
buffer that isn't always null-terminated yet (e.g. still on the login
screen), and read it unbounded via wcslen — running off into unrelated
memory and rendering as garbled/CJK-looking text. Bound the read and
return empty instead of garbage.
Also send WM_SETTEXT via DefWindowProcW instead of SetWindowTextW when
setting the title on GW's own HWND, since that window may be an ANSI
window class, which would otherwise thunk the string through the
system codepage. Same trick already used for our own windows in
imgui_impl_win32.cpp.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 76758db commit 216a0dc
2 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
1007 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1008 | 1012 | | |
1009 | | - | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
1010 | 1019 | | |
1011 | 1020 | | |
1012 | 1021 | | |
| |||
0 commit comments