thpatch / thcrap

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

thcrap_loader hangs on Wine #251

Open tactikauan opened 6 months ago

tactikauan commented 6 months ago

The thcrap_loader process keeps running after closing the game on Wine. The issue is present since the 2023-08-17 release and affects all versions of Wine/Proton.

From my debugging, this thread seems to get stuck:

https://github.com/thpatch/thcrap/blob/bc6d09f301ed7da20336b7974911a7b03fee4ae5/thcrap_update/src/loader_update.cpp#L712

Looking at the function, it gets blocked on this call to ReadFile: https://github.com/thpatch/thcrap/blob/bc6d09f301ed7da20336b7974911a7b03fee4ae5/thcrap_update/src/loader_update.cpp#L600-L604

Apparently Wine doesn't support async reads on mailslots.

32th-System commented 6 months ago

Damn. A developer suggested having one single shared buffer to keep all the data shared between multiple processes, and signaling the update_wrapper_patch using an event, rather than relying on the mailslot system. I guess we'll have to do this after all