| 1237 | } |
| 1238 | |
| 1239 | bool VMManager::AutoDetectSource(const std::string& filename, Error* error) |
| 1240 | { |
| 1241 | if (!filename.empty()) |
| 1242 | { |
| 1243 | if (!FileSystem::FileExists(filename.c_str())) |
| 1244 | { |
| 1245 | Error::SetStringFmt(error, TRANSLATE_FS("VMManager", "Requested filename '{}' does not exist."), filename); |
| 1246 | return false; |
| 1247 | } |
| 1248 | |
| 1249 | if (IsGSDumpFileName(filename)) |
| 1250 | { |
| 1251 | CDVDsys_ChangeSource(CDVD_SourceType::NoDisc); |
| 1252 | return GSDumpReplayer::Initialize(filename.c_str(), error); |
| 1253 | } |
| 1254 | else if (IsElfFileName(filename)) |
| 1255 | { |
| 1256 | // alternative way of booting an elf, change the elf override, and (optionally) use the disc |
| 1257 | // specified in the game settings. |
| 1258 | std::string disc_path = GetDiscOverrideFromGameSettings(filename); |
| 1259 | if (!disc_path.empty()) |
| 1260 | { |
| 1261 | CDVDsys_SetFile(CDVD_SourceType::Iso, std::move(disc_path)); |
| 1262 | CDVDsys_ChangeSource(CDVD_SourceType::Iso); |
| 1263 | } |
| 1264 | else |
| 1265 | { |
| 1266 | CDVDsys_ChangeSource(CDVD_SourceType::NoDisc); |
| 1267 | } |
| 1268 | |
| 1269 | s_elf_override = filename; |
| 1270 | return true; |
| 1271 | } |
| 1272 | else |
| 1273 | { |
| 1274 | // TODO: Maybe we should check if it's a valid iso here... |
| 1275 | CDVDsys_SetFile(CDVD_SourceType::Iso, filename); |
| 1276 | CDVDsys_ChangeSource(CDVD_SourceType::Iso); |
| 1277 | return true; |
| 1278 | } |
| 1279 | } |
| 1280 | else |
| 1281 | { |
| 1282 | // make sure we're not fast booting when we have no filename |
| 1283 | CDVDsys_ChangeSource(CDVD_SourceType::NoDisc); |
| 1284 | return true; |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | void VMManager::PrecacheCDVDFile() |
| 1289 | { |
nothing calls this directly
no test coverage detected