thpatch / thcrap

Touhou Community Reliant Automatic Patcher
https://www.thpatch.net
The Unlicense
561 stars 41 forks source link

Danmakufu support #56

Closed Zrrg closed 4 years ago

Zrrg commented 7 years ago

Danmakufu scripts are written in Shift-JIS plain text, I wonder is it possible to apply UTF-8 support to the executable.

nmlgc commented 7 years ago

This has worked for years, the only issue there is that th_dnh.exe needs to be unpacked using UPX before it can be patched by simply using thcrap's core functionality without any specific patch:

echo {"fontrules": {"*": "'MS Gothic' * * 400"}} > dnh.js
del thcrap_tasofro.dll thcrap_tsa.dll
thcrap_loader dnh.js C:\path\to\th_dnh_uncompressed.exe

The run configuration should also set a font that contains the desired characters. Unfortunately, Danmakufu comes with an even worse font filter than the ZUN games, and boldens nearly every font I tried to look unreadable. MS Gothic is the only one I've tried that looks halfway decent. In the end, we'll probably have to remove that crappy filter with binary hacks if we were serious about translation patching this game, which is why I'm leaving this issue open.

thcrap's base functionality should then be enough to give you Unicode text rendering and paths. However, the script files still need to be encoded in Shift-JIS for Danmakufu to recognize them. (Probably just the #東方弾幕風 comment at the top of the file, haven't tested this further.) But with a lenient editor that allows you to put UTF-8 characters into an otherwise Shift-JIS file and then doesn't corrupt it on saving (I used wxMEdit for this), you can still do it:

danmakufu unicode