hkrn / nanoem

nanoem is an MMD (MikuMikuDance) compatible implementation and its like cross-platform application mainly built for macOS.
https://nanoem.rtfd.io
Other
281 stars 41 forks source link

[BUG] Japanese language models don't load correctly on Linux #382

Closed kouta-kun closed 8 months ago

kouta-kun commented 10 months ago

Describe the bug Models with japanese language text don't load correctly on Linux (texture paths load incorrectly, titles stop after first character, etc). The same models load correctly on Wine.

To Reproduce Steps to reproduce the behavior:

  1. Download this model: https://www.deviantart.com/mmd-francis-co/art/Haruhi-Suzumiya-DL-562804437
  2. Load on Linux
  3. Load on Wine
  4. Compare both models, one has no textures and bone names are broken, on the other everything displays correctly.

Expected behavior Titles load correctly on linux.

Screenshots winemodel linuxmodel

Desktop (please complete the following information):

Additional context Checking with GDB, the model title string seems to start being incorrect at nanoemModelGetStringPMX, where after conversion string "H a r" becomes corrupt:

Thread 1 "nanoem" hit Breakpoint 1, nanoemModelGetStringPMX (model=0x555556fa23d0, buffer=0x555557028fb0, status=0x7fffffff2b0c)
    at /home/kouta/nanoem/nanoem/nanoem.c:737
737         nanoem_free(src);
(gdb) p ((char*)dst)[0]
$3 = 72 'H'
(gdb) p ((char*)dst)[1]
$4 = 0 '\000'
(gdb) p ((char*)dst)[2]
$5 = 107 'k'
(gdb) p ((char*)dst)[3]
$6 = 3 '\003'
(gdb) p ((char*)dst)[4]
$7 = 80 'P'
(gdb) p ((char*)src)[0]
$8 = 72 'H'
(gdb) p ((char*)src)[1]
$9 = 0 '\000'
(gdb) p ((char*)src)[2]
$10 = 97 'a'
(gdb) p ((char*)src)[3]
$11 = 0 '\000'
(gdb) p ((char*)src)[4]
$12 = 114 'r'
hkrn commented 10 months ago

Are you building with NANOEM_ENABLE_BUILD_ICU4C? If not, this is most likely the cause of the problem.

Although nanoem itself uses UTF-8 internally, the character encoding used in the model is effectively ShiftJIS or UTF-16, so ICU is needed for the conversion process.

stale[bot] commented 8 months ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

kouta-kun commented 8 months ago

Hi, sorry! I didn't manage to build it with ICU4C enabled and I just resigned myself to using wine. I'll be opening an issue some time later to find out what's wrong with ICU4C.