Merge pull request #3451 from myk002/myk_be_less_steamy

only initialize steam if launched from steam
develop
Myk 2023-06-05 17:25:06 -07:00 committed by GitHub
commit c07e95e93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## New Plugins
## Fixes
- Fix crash for some players when they launch DF outside of the Steam client
## Misc Improvements

@ -52,6 +52,12 @@ static void bind_all(color_ostream& out, DFLibrary* handle) {
}
bool DFSteam::init(color_ostream& out) {
char *steam_client_launch = getenv("SteamClientLaunch");
if (!steam_client_launch || strncmp(steam_client_launch, "1", 2) != 0) {
DEBUG(dfsteam, out).print("not launched from Steam client; not initializing steam\n");
return false;
}
for (auto& lib_str : STEAM_LIBS) {
if ((g_steam_handle = OpenPlugin(lib_str.c_str())))
break;
@ -168,11 +174,6 @@ void DFSteam::launchSteamDFHackIfNecessary(color_ostream& out) {
return;
}
if (strncmp(getenv("SteamClientLaunch"), "1", 2)) {
DEBUG(dfsteam, out).print("not launched from Steam client\n");
return;
}
void* iSteamApps = g_SteamInternal_FindOrCreateUserInterface(g_SteamAPI_GetHSteamUser(), "STEAMAPPS_INTERFACE_VERSION008");
if (!iSteamApps) {
DEBUG(dfsteam, out).print("cannot obtain iSteamApps interface\n");