thpatch / thcrap

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

"Find games automatically" doesn't work with most Steam games #260

Closed TheGoomba98 closed 3 weeks ago

TheGoomba98 commented 3 weeks ago

Exactly as it says on the tin - I've looked at the code for thcrap to see some comments that imply it should be able to find Touhou games installed by Steam, but when I try using the "Find games automatically" button, the only Steaminstalled game it could find is Antinomy of Common Flowers, despite the fact that I've bought a bunch of other Touhou games through Steam.

This is what my Steam games folder looks like right now. As you can see, I expect it to recognize all of the Steam-available games through TH9.5 through 18.5 (except for TH16, which I have physically, and 17.5, which I don't have at all yet):

thcrap bug steam folder

This is what the config looks like when I've set it up for testing this bug, by removing all the games I own through Steam:

thcrap bug before

However, after I click "Find games automatically", only AoCF shows up:

thcrap bug after

In case it's relevant, here are my Windows specs: Edition Windows 10 Pro Version 22H2 Installed on ‎3/‎7/‎2023 OS build 19045.4529 Experience Windows Feature Experience Pack 1000.19058.1000.0

And my device specs: Device name DESKTOP-F11RMFL Processor Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz 4.00 GHz Installed RAM 32.0 GB Device ID 1F503CF2-5DEA-4FE1-A593-47AF76EFCC2E Product ID 00330-80948-95862-AA151 System type 64-bit operating system, x64-based processor Pen and touch No pen or touch input is available for this display

brliron commented 3 weeks ago

We use the registry uninstall keys to detect Steam games. Can you run regedit (either by typing regedit in the Start menu or by using Windows+R), enter HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall on the address bar, scroll in the left window until you see things like Steam App 1566410 (which are games installed by Steam), and send a screenshot of an entry for a game that thcrap didn't find? (Steam App 1566410 is for Touhou 18, you can use that one for example). If you can't find your Touhou games in there, can you check again by entering HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\ into the address bar instead?

And if you can't find your Touhou games in any of them, can you go to Settings -> Applications and see if you find your Touhou games in that list? Japanese characters are sorted after Latin characters so they should be around the bottom of the list.

TheGoomba98 commented 3 weeks ago

Shit, how do I unclose this? I'm completely new to github.

TheGoomba98 commented 3 weeks ago

Okay, I guess that works.

TheGoomba98 commented 3 weeks ago

Anyway, as I was saying, in case it wasn't clear from my screenshots, I don't have the full version of Touhou 18, only the demo (which is why the folder is called th18tr and not th18), so I can't use that as an example. What's the uninstall registry key for something I do own, like Touhou 10?

(Remember, the "close with comment" thing is an action button, not a checkbox!!!)

TheGoomba98 commented 3 weeks ago

Another thing about your response - of all the official Touhou games available on Steam, 15.5 and 17.5 are the only ones which have their titles written in Japanese characters - all others have their names written in Latin characters, including for the "Touhou Nancharakanchara" parts before the tilde, so I wouldn't recommend looking just at the bottom of the application list next time. That said, I do have all my Steam-installed Touhou games on my app list, but the thing about 15.5 being the only one I own which both has a Japanese title and could be detected by thcrap makes me wonder if you're not accounting for Latin-named games.

brliron commented 3 weeks ago

I have 16, 18, 18.5, 19, 15.5 and 17.5 on Steam, and they all have a Japanese name in both the Steam UI and the uninstall menu.

The thing is, my native language is French, and all my stuff is set to use French by default. But, after some testing, it seems like Steam uses Latin characters for English, and only for English, and Japanese character for every other language. For example, when I look for Touhou 10 on Steam, I get to this page: https://store.steampowered.com/app/1100140/__Mountain_of_Faith/ - look at the game name in the URL - and the title is 東方風神録 〜 Mountain of Faith. If I go to my browser settings and set it to provide pages in English instead of French, and then press F5 on the Steam page, the URL becomes https://store.steampowered.com/app/1100140/Touhou_Fuujinroku__Mountain_of_Faith/ - with "Touhou_Fuujinroku" being included in the URL - and the displayed title is Touhou Fuujinroku ~ Mountain of Faith (the Japanese title is still displayed in "Buy 東方風神録 〜 Mountain of Faith.", but there are places with the English title).

If you want to send a screenshot of your registry for Touhou 10, its Steam ID is 1100140, but with what you told me and what I tested with the Steam website, I can guess the source of the problem and its solution: I didn't know that Steam uses the Latin version of the game names if (and only if) your computer is set to English, so I didn't take those into account.

Here's the part of the source code that chooses which folders to include based on their displayed name:

return displayName.compare(0, wcslen(L"東方"), L"東方") == 0
    || displayName.compare(0, wcslen(L"弾幕アマノジャク"), L"弾幕アマノジャク") == 0;

This makes me notice that we don't detect Touhou 18.5 either because its name doesn't start with "東方". We should probably switch to using the developer name instead. When I set my language to English on the Steam website, the developer for Touhou 10 is still listed in Japanese as 上海アリス幻樂団, would you mind checking on your computer whether it's in Latin or in Japanese in the registry?

TheGoomba98 commented 3 weeks ago

Huh, the developer is still in Japanese even when Steam is set to English:

th10 reg

TheGoomba98 commented 3 weeks ago

Of course, if you switch to the developer name, it should also account for other official Touhou developers, like 黄昏フロンティア for the non-shmup spinoffs.

brliron commented 3 weeks ago

Can you try with this build?

brliron commented 3 weeks ago

I forgot to actually link the build: https://ci.appveyor.com/api/buildjobs/3hbpkuaxjul1jxbw/artifacts/thcrap.zip

TheGoomba98 commented 3 weeks ago

Oh hey, that build actually worked! Or at least, it found all my Steam games (including AoCF and 100BM!) automatically. There's two problems with that build:

  1. It couldn't automatically find the games that I installed from physical disks (i.e. EoSD, PCB, IN, PoFV, and HSiFS in my case).
  2. Some of the configs are ordered weirdly - the configs for UFO, DDC, and UM are listed after both files for DS, ISC, and 100BM respectively, even though the mainline games themselves are listed before the spinoffs.
brliron commented 3 weeks ago

The 1st one already has open issues in #111 and #234.

For the 2nd one, I didn't change anything about that either so I think it was already existing. If you think this is a problem worth fixing, please create a new issue with a screenshot.

The fix included in the build above have been committed in cf68fc927881764da2a537bad9f70ceff4f6419b and will be in the next release, so I'll close this issue.