对不起,我又新开了个issue来提1.5的BUG,关于slay the spire 2可以之后再研究
Tested v1.5.0 and found two bugs in dllmain.cpp InitSteamClient() that cause Steam API init to fail with k_ESteamAPIInitResult_FailedGeneric:
Bug 1: Path concatenation produces an invalid path (line 370-378)
const char* steamClientPath = "C:\Program Files (x86)\Steam\steamclient64.dll";
// ...
_snprintf_s(fullPath, MAX_PATH, _TRUNCATE, "%s\%s", steamPath, steamClientPath);
steamClientPath already contains a full absolute path, so concatenating it with steamPath (e.g. C:\Program Files (x86)\Steam) produces something like:
C:\Program Files (x86)\Steam\C:\Program Files (x86)\Steam\steamclient64.dll
This always fails. The fallback LoadLibraryA(steamClientPath) works only if Steam is installed at the default path — any non-default install location will fail entirely.
Bug 2: Missing LOAD_WITH_ALTERED_SEARCH_PATH (line 389, 396)
hMod = LoadLibraryA(fullPath);
Without LOAD_WITH_ALTERED_SEARCH_PATH, Windows resolves steamclient64.dll's dependencies (tier0_s64.dll, vstdlib_s64.dll) relative to the game's exe directory instead of the Steam directory. This causes the load to fail even when steamclient64.dll itself is found.
I can confirm this — copying steamclient64.dll, tier0_s64.dll, and vstdlib_64.dll from the Steam directory to the game's exe directory makes init succeed, which aligns with the workaround you mentioned in the release notes.
Notably, LoadGameOverlay() (line 477) correctly uses LoadLibraryExA with LOAD_WITH_ALTERED_SEARCH_PATH — it seems this was accidentally dropped during the InitSteamClient rewrite.
The fixes would be:
Change steamClientPath to just the filename ("steamclient64.dll") so the concatenation produces a valid path.
Use LoadLibraryExA(fullPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH) instead of LoadLibraryA(fullPath).
对不起,我又新开了个issue来提1.5的BUG,关于slay the spire 2可以之后再研究
Tested v1.5.0 and found two bugs in dllmain.cpp InitSteamClient() that cause Steam API init to fail with k_ESteamAPIInitResult_FailedGeneric:
Bug 1: Path concatenation produces an invalid path (line 370-378)
const char* steamClientPath = "C:\Program Files (x86)\Steam\steamclient64.dll";
// ...
_snprintf_s(fullPath, MAX_PATH, _TRUNCATE, "%s\%s", steamPath, steamClientPath);
steamClientPath already contains a full absolute path, so concatenating it with steamPath (e.g. C:\Program Files (x86)\Steam) produces something like:
C:\Program Files (x86)\Steam\C:\Program Files (x86)\Steam\steamclient64.dll
This always fails. The fallback LoadLibraryA(steamClientPath) works only if Steam is installed at the default path — any non-default install location will fail entirely.
Bug 2: Missing LOAD_WITH_ALTERED_SEARCH_PATH (line 389, 396)
hMod = LoadLibraryA(fullPath);
Without LOAD_WITH_ALTERED_SEARCH_PATH, Windows resolves steamclient64.dll's dependencies (tier0_s64.dll, vstdlib_s64.dll) relative to the game's exe directory instead of the Steam directory. This causes the load to fail even when steamclient64.dll itself is found.
I can confirm this — copying steamclient64.dll, tier0_s64.dll, and vstdlib_64.dll from the Steam directory to the game's exe directory makes init succeed, which aligns with the workaround you mentioned in the release notes.
Notably, LoadGameOverlay() (line 477) correctly uses LoadLibraryExA with LOAD_WITH_ALTERED_SEARCH_PATH — it seems this was accidentally dropped during the InitSteamClient rewrite.
The fixes would be:
Change steamClientPath to just the filename ("steamclient64.dll") so the concatenation produces a valid path.
Use LoadLibraryExA(fullPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH) instead of LoadLibraryA(fullPath).