thpatch / thcrap

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

Games can't be found when running in Wine - SSL_ERROR_SYSCALL #186

Open jedenastka opened 2 years ago

jedenastka commented 2 years ago

thcrap doesn't find EoSD (and probably any other game, I can't test this though) when running in Wine.

I point it to Z:\mnt\data\programy\gry\touhou\windows, which maps to /mnt/data/programy/gry/touhou/windows on my system, the directory where I have installed EoSD in a directory called th06.

image

Checking thcrap_log.txt (attached below) reveals many errors related to OpenSSL during initialization:

OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to mirrors.thpatch.net:443  (code 35)

And when selecting the option to search for games:

(JSON) Resolving versions.js... not found
ERROR: No version definition file (versions.js) found!
Seems as if base_tsa didn't download correctly.
Try deleting the thpatch directory and running this program again.

Which is probably caused by the previous error and the program being unable to contact its servers.

What I tried:

Versions and other data:

ls.txt sums.txt thcrap_log.txt

DankRank commented 2 years ago

Try a 32-bit wine prefix.

Here's my setup:

jedenastka commented 2 years ago

Try a 32-bit wine prefix.

I did try that before (seems I forgot to add it to the "What I tried" list though), and now tried again just to double check. Same problem.

Here's my setup:

  • Debain 11/bullseye/stable
  • wine from the debian repo
  • clean 32-bit wineprefix
  • old config tool (I don't have .NET installed ¯(ツ)/¯)

Might be related to some changes in Wine that happened after the Debian 11 freeze then - according to https://packages.debian.org/bullseye/wine, it's at 5.0.3. (Seems like it's at 6.0.3 in Unstable by the way, weird that the maintainers didn't pack 7.0 yet. But that's unrelated).

kabessao commented 2 years ago

just point to the specific game folder, it might take a while, but thcrap remembers the ones you selected before. I've installed thcrap on all of my games from steam this way

jedenastka commented 2 years ago

just point to the specific game folder, it might take a while, but thcrap remembers the ones you selected before. I've installed thcrap on all of my games from steam this way

Do you mean I should point directly to Z:\mnt\data\programy\gry\touhou\windows\th06? If yes, I tried that too. Same error.

kabessao commented 2 years ago

well, it worked for me using proton by executing everything through steam, I didn't use wine. That might be why it worked for me.

jedenastka commented 2 years ago

well, it worked for me using proton by executing everything through steam, I didn't use wine. That might be why it worked for me.

Proton uses highly patched Wine, and this issue is also seemingly dependent on its version (see the comment by DankRank).

brliron commented 2 years ago

I wanted to stop being lazy and actually try to debug that on my Linux machine, but it also works for me. ArchLinux, wine 6.16-1, 64-bits wine without wineprefix, tested with both the old and the new tool.

Can you try to run the thcrap configuration tool under strace? For example, strace wine bin/thcrap_configure.exe 2> strace.txt, this will run the old version of the tool under strace, and press enter to skip the 1st screen. I'm not sure I will see anything in this file because it will be huge, but I can try.

jedenastka commented 2 years ago

I wanted to stop being lazy and actually try to debug that on my Linux machine, but it also works for me. ArchLinux, wine 6.16-1, 64-bits wine without wineprefix, tested with both the old and the new tool.

You might want to try updating Wine and retesting, as it seems it's version is related to the issue.

I guess I could try some different Wine versions too.

Can you try to run the thcrap configuration tool under strace? For example, strace wine bin/thcrap_configure.exe 2> strace.txt, this will run the old version of the tool under strace, and press enter to skip the 1st screen. I'm not sure I will see anything in this file because it will be huge, but I can try.

Sure. It's ~8 MiB of text (so yeah, it is big).

strace.log.gz

brliron commented 2 years ago

It also worked for me when upgrading wine to 7.7-1.

For the strace thing, you need to run either bin/thcrap_configure.exe or bin/thcrap_configure_v3.exe. The thcrap.exe in the root directory is just a tiny program that runs bin/thcrap_configure_v3.exe, and this strace log ends with "running bin/thcrap_configure_v3.exe", while we're interested in what happens later.

jedenastka commented 2 years ago

It also worked for me when upgrading wine to 7.7-1.

Hmm, okay. I'd say it's my configuration, but somebody on Discord recently had the same problem, so I dunno.

For the strace thing, you need to run either bin/thcrap_configure.exe or bin/thcrap_configure_v3.exe. The thcrap.exe in the root directory is just a tiny program that runs bin/thcrap_configure_v3.exe, and this strace log ends with "running bin/thcrap_configure_v3.exe", while we're interested in what happens later.

I assumed this will log any child processes and didn't read your comment fully, sorry! Now it's ~139 MiB of text, and I thought 8 MiB was big. Attaching below.

strace.log.gz

brliron commented 2 years ago

I couldn't find anything in the strace file, but I want to try a different approach. Can you try with this version? thcrap_wininet.zip

jedenastka commented 2 years ago

It works. image

The log, for reference: thcrap_log.txt

It also seems to have fixed an issue I had with 100% CPU usage and inresponsiveness for the first minute or so after launch, which I was sure is another issue and wanted to report it separately.

brliron commented 2 years ago

The changes from your version have been pushed in the commit e8e778aabdb04f17f72392048757eca07526b602. This change, or another variant of it, should be included in the next version. Note that this change isn't enabled by default, you have to add "use_wininet": true to your config/config.js to enable it (if you look at the config/config.js file in the version I sent earlier, you'll see that this parameter is already set to true, this won't be the case in the releases).

hmtheboy154 commented 2 years ago

I couldn't find anything in the strace file, but I want to try a different approach. Can you try with this version? thcrap_wininet.zip

Hi, I am trying this version and also the stable 1/4 build and I've found out that when the game scan to Touhou 6, It will immediately stop due to the executable of the game is in Japanese and in order to be able to scan the whole folder I must set LANG=ja_JP.UTF-8 . Is there anyway I can be able to scan the game without having to set to Japanese locale ?


Searching games in Z:\home\hmtheboy154\Documents\2hu\... this may take a while...

(JSON) Resolving versions.js... 
+ Z:/home/hmtheboy154/Documents/2hu/thcrap/repos/nmlgc/base_tsa/versions.js
+ Z:/home/hmtheboy154/Documents/2hu/thcrap/repos/nmlgc/base_tasofro/versions.js

===
Exception E06D7363 at 0x7B012566 (Rx12566) (\kernelbase.dll)

Description:
C++ EH type: .?AVfilesystem_error@filesystem@std@@

Registers:
EIP: 0x7B012566 EFLAGS: 0x00000246
EAX: 0x0411FD70 ECX: 0x00000008 EDX: 0x0411FE04 EBX: 0x0411FE2C
ESP: 0x0411FD64 EBP: 0x0411FDD8 ESI: 0xE06D7363 EDI: 0x00860920

Stack trace:
[09] 0x7B012566 (Rx12566) (\kernelbase.dll)
[08] 0x003675B6 (Rx75B6) (\VCRUNTIME140.dll)
[07] 0x008441A7 (Rx241A7) (\thcrap.dll)
[06] 0x00844A61 (Rx24A61) (\thcrap.dll)
[05] 0x0084571D (Rx2571D) (\thcrap.dll)
[04] 0x7B6292D0 (Rx292D0) (\kernel32.dll)
[03] 0x7BC5BF07 (Rx5BF07) (\ntdll.dll)
[02] 0x7BC5C5B8 (Rx5C5B8) (\ntdll.dll)
[01] 0x00000000 (RxFFC00000) (\thcrap_configure.exe)
===

No game locations found.
No patch shortcuts will be created.
Please re-run this configuration tool after you have acquired some games
supported by the patches.

===
Exception C0000005 at 0x7BC26351 (Rx26351) (\ntdll.dll)

Description:
No error description available.

Registers:
EIP: 0x7BC26351 EFLAGS: 0x00010206
EAX: 0x0D016800 ECX: 0x01680090 EDX: 0x016800A8 EBX: 0x016800A0
ESP: 0x0051F4FC EBP: 0x0051F518 ESI: 0x10086830 EDI: 0x01680000

Stack trace:
[30] 0x7BC26542 (Rx26542) (\ntdll.dll)
[29] 0x7BC270E7 (Rx270E7) (\ntdll.dll)
[28] 0x70B73F75 (Rx33F75) (\ucrtbase.dll)
[27] 0x02943F38 (Rx3F38) (\libcurl.dll)
[26] 0x0295F3E2 (Rx1F3E2) (\libcurl.dll)
[25] 0x02955457 (Rx15457) (\libcurl.dll)
[24] 0x02943CA7 (Rx3CA7) (\libcurl.dll)
[23] 0x02943B36 (Rx3B36) (\libcurl.dll)
[22] 0x029436C8 (Rx36C8) (\libcurl.dll)
[21] 0x0296600D (Rx2600D) (\libcurl.dll)
[20] 0x0297DD3F (Rx3DD3F) (\libcurl.dll)
[19] 0x029179A7 (Rx79A7) (\thcrap_update.dll)
[18] 0x02920897 (Rx10897) (\thcrap_update.dll)
[17] 0x70B651CA (Rx251CA) (\ucrtbase.dll)
[16] 0x02927138 (Rx17138) (\thcrap_update.dll)
[15] 0x029274A8 (Rx174A8) (\thcrap_update.dll)
[14] 0x029276F8 (Rx176F8) (\thcrap_update.dll)
[13] 0x02927796 (Rx17796) (\thcrap_update.dll)
[12] 0x7BC2ADB6 (Rx2ADB6) (\ntdll.dll)
[11] 0x7BC2F689 (Rx2F689) (\ntdll.dll)
[10] 0x7BC2FC6F (Rx2FC6F) (\ntdll.dll)
[09] 0x7BC2FD46 (Rx2FD46) (\ntdll.dll)
[08] 0x7BC2FD90 (Rx2FD90) (\ntdll.dll)
[07] 0x7B6199C2 (Rx199C2) (\kernel32.dll)
[06] 0x70B64EFC (Rx24EFC) (\ucrtbase.dll)
[05] 0x0040D630 (RxD630) (\thcrap_configure.exe)
[04] 0x7B6292D0 (Rx292D0) (\kernel32.dll)
[03] 0x7BC5BF07 (Rx5BF07) (\ntdll.dll)
[02] 0x7BC5C5B8 (Rx5C5B8) (\ntdll.dll)
[01] 0x00000000 (RxFFC00000) (\thcrap_configure.exe)
===
brliron commented 2 years ago

This seems to be a different issue, and to be honest, I don't see how the language part of the locale would affect the search (also, it works on my old Linux machine, I don't remember which locale it has but it is either a French one, an English one, or it just isn't set). Can you open a new issue, and attach the entire log file for a working case and for a non-working case? Also, did you try with en_US.UTF-8?

hmtheboy154 commented 2 years ago

This seems to be a different issue, and to be honest, I don't see how the language part of the locale would affect the search (also, it works on my old Linux machine, I don't remember which locale it has but it is either a French one, an English one, or it just isn't set). Can you open a new issue, and attach the entire log file for a working case and for a non-working case? Also, did you try with en_US.UTF-8?

oh yea that did work, which made me remember that I actually set LC_ALL to C instead of en_US.UTF-8 🤦‍♂. Sorry to bother you

brliron commented 2 years ago

This change is now part of the last thcrap release.

IIRC, the version I shipped here should automatically update to the last version while keeping the wininet setting on. If it doesn't, you can download it from the releases tab and unzip the new version over the old one (yes, that's how updates work).

For anyone seeing this issue in the future, the important part is here:

Note that this change isn't enabled by default, you have to add "use_wininet": true to your config/config.js to enable it

If you're using thcrap for the 1st time, create a folder called "config", create an empty file called "config.js" inside it, open that file with a text editor, and write {"use_wininet": true} inside it.

e00E commented 1 year ago

I ran into this issue. It first manifests by the configuration program freezing while in the background it presumably waits on some failing connections. After around 30 seconds it unfreezes. Continuing in the dialogue goes to the point of adding games which it never finds. With the use_wininet setting the problem goes away.

Is there a reason this isn't enabled by default? Or detected at runtime? From my user perspective the program is broken. Luckily I knew how to navigate open source projects well enough to find this closed issue and this config change within it.

brliron commented 1 year ago

libcurl (which is what we use when we don't use wininet) is quite a lot faster on Windows, and wininet doesn't work on Windows XP. And libcurl works on my Linux machine, I have no idea how many Linux configs have the libcurl version working against how many don't. I also don't know which one is the fastest on Wine, and whether the performance gap is big.

Anyway, you have a good point. We may want to change the default on Wine. Even if we want to keep libcurl as default on Wine, in case the libcurl version is a lot faster than the wininet one, it would still be a good idea to fall back to wininet automatically in case of failure.