thcrap icon indicating copy to clipboard operation
thcrap copied to clipboard

Some Chinese characters missing in th155

Open xitieshiz2 opened this issue 2 years ago • 2 comments

Note : I do not have this issue on my own machine , but someone asked me about this.

It seems that someone would have character missing problem in th155 Chinese patch (With tpZHCNex/taso installed) There're two different people having this problem for now , so this should be a bug. image image log file here : https://gist.github.com/xitieshiz2/b7c1305f9b8306f1a66d4c7198c63f02 log file and file tree of the second person : https://gist.github.com/xitieshiz2/f11ba04dc11f799fcccd0f629b9f950b We already asked brliron about this , and got this answer : image But this does not work , the problem still exist (And those file just appear again when the game launch). We tried using th155 1.19_beta4 , using old thcrap command line configure tool , and even send my thcrap files , but none of them works.

xitieshiz2 avatar Mar 04 '22 09:03 xitieshiz2

Sorry for taking so much time to come back to you.

Can you tell your friend to put that file in the bin directory of their thcrap installation (replacing the existing one), run the game, and send me the log file? A few notes and warnings:

  • This won't fix the problem, this will only generate a log file. They don't need to enter a fight, they only need to go to the title screen.
  • The log file will be huge. Like, around 5 or 6 GB. But it also compresses extremely well, down to 5 or 6 MB.
  • The game will be stuck on a black window for a while. This is normal (writing so many logs takes some time). https://cdn.discordapp.com/attachments/253873278689607680/986502844834275338/thcrap_tasofro.dll

brliron avatar Jun 17 '22 16:06 brliron

here's the log file https://1drv.ms/u/s!AhNysW5VU31jiieuoPF7eTdL63gg?e=sNJMbT

xitieshiz2 avatar Aug 19 '22 12:08 xitieshiz2

@brliron We found that this issue seems only happens when the game directory includes non-ASCII characters (like Chinese, Japnese etc.), can this information help you to solve this? Or is this issue from tpZHCNex/taso?

xitieshiz2 avatar Aug 28 '23 08:08 xitieshiz2

Hmm...

I don't really see how the game directory having non-ASCII characters would cause this issue (the game either loads the entire th155.dat, or doesn't load it at all). On the other hand, if the thcrap directory also has non-ASCII characters, we read files from many places and in many different ways, and one of them could have a bug.

If the thcrap directory contains non-ASCII characters, we call add_files_in_directory at https://github.com/thpatch/thcrap/blob/e3895c2ec8ec35f6b7d894fd9030f8da144073e5/thcrap_tasofro/src/th155_bmp_font.cpp#L185 with patch->archive, which should be a full UTF-8 path. This path is used to generate the filename passed to json_load_file in https://github.com/thpatch/thcrap/blob/e3895c2ec8ec35f6b7d894fd9030f8da144073e5/thcrap_tasofro/src/th155_bmp_font.cpp#L110C11-L110C11 . And in https://github.com/akheron/jansson/blob/60097f0096f337393b42d0ad13d403294ff4e782/src/load.c#L1042 , json_load_file will try to use this UTF-8 path as a parameter to fopen, which expects a path in the current locale. add_json_file would then receive a NULL file, which won't crash but won't do anything useful either.

And both log files attached with this issue have Chinese characters in the thcrap path as well.

Yeah, I think that's where this bug comes from. I'll have to test it this evening.

brliron avatar Aug 28 '23 09:08 brliron

Fixed in ffda608 (which will be included in the next thcrap release)

brliron avatar Aug 28 '23 17:08 brliron

And the next thcrap release have been released.

@xitieshiz2 Can you ask your friends if it works with the new thcrap version?

brliron avatar Aug 29 '23 23:08 brliron