MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / triggerSteamDownload

Function triggerSteamDownload

src/openrct2/platform/Platform.Common.cpp:271–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 }
270
271 bool triggerSteamDownload()
272 {
273 const auto steamPaths = GetSteamPaths();
274 if (!steamPaths.isSteamPresent() || steamPaths.manifests.empty())
275 return false;
276
277 const auto manifestsDir = Path::Combine(steamPaths.roots[0], steamPaths.manifests);
278 const std::array<SteamGameData, 3> gamesToTrigger = { kSteamRCT2Data, kSteamRCTCData, kSteamRCT1Data };
279 for (const auto& game : gamesToTrigger)
280 {
281 auto fullFilename = Path::Combine(manifestsDir, "appmanifest_" + std::to_string(game.appId) + ".acf");
282 // If the file exists, we assume a download has been triggered already.
283 if (File::Exists(fullFilename))
284 continue;
285
286 // clang-format off
287 auto buffer = u8string("\"AppState\"\r\n") + u8string("{\r\n")
288 + u8string(" \"AppID\" \"" + std::to_string(game.appId) + "\"\r\n")
289 + u8string(" \"Universe\" \"1\"\r\n")
290 + u8string(" \"installdir\" \"" + game.nativeFolder + "\"\r\n")
291 + u8string(" \"StateFlags\" \"1026\"\r\n") + u8string("}\r\n");
292 // clang-format on
293 File::WriteAllBytes(fullFilename, buffer.data(), buffer.size());
294 }
295
296 return true;
297 }
298
299} // namespace OpenRCT2::Platform

Calls 8

ExistsFunction · 0.85
WriteAllBytesFunction · 0.85
isSteamPresentMethod · 0.80
GetSteamPathsFunction · 0.70
CombineFunction · 0.50
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected