MCPcopy Create free account
hub / github.com/DFHack/dfhack / init

Method init

library/modules/DFSteam.cpp:78–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool 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
106void DFSteam::cleanup(color_ostream& out) {
107 if (!g_steam_handle)

Callers

nothing calls this directly

Calls 4

OpenPluginFunction · 0.85
bind_allFunction · 0.85
c_strMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected