| 76 | } |
| 77 | |
| 78 | bool DFSteam::init(color_ostream& out) { |
| 79 | char *steam_client_launch = getenv("SteamClientLaunch"); |
| 80 | if (!steam_client_launch || strncmp(steam_client_launch, "1", 2) != 0) { |
| 81 | DEBUG(dfsteam, out).print("not launched from Steam client; not initializing steam\n"); |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | for (auto& lib_str : STEAM_LIBS) { |
| 86 | if ((g_steam_handle = OpenPlugin(lib_str.c_str()))) |
| 87 | break; |
| 88 | } |
| 89 | if (!g_steam_handle) { |
| 90 | DEBUG(dfsteam, out).print("steam library not found; stubbing calls\n"); |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | bind_all(out, g_steam_handle); |
| 95 | |
| 96 | if (!g_SteamAPI_Init || !g_SteamAPI_Shutdown || !g_SteamAPI_Init()) { |
| 97 | DEBUG(dfsteam, out).print("steam detected but cannot be initialized\n"); |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | DEBUG(dfsteam, out).print("steam library linked\n"); |
| 102 | g_steam_initialized = true; |
| 103 | return true; |
| 104 | } |
| 105 | |
| 106 | void DFSteam::cleanup(color_ostream& out) { |
| 107 | if (!g_steam_handle) |
nothing calls this directly
no test coverage detected