| 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 |
no test coverage detected