private void LoadGame(string name) { if (name.EndsWith(".sfs")) { name = name.Substring(0, name.Length - 4); } if (HighLogic.CurrentGame.Parameters.Flight.CanQuickLoad) { string filename = name + ".sfs"; string path = KSPUtil.GetOrCreatePath("saves/" + HighLogic.SaveFolder); if (!File.Exists(Path.Combine(path, filename))) { throw new KOSException("Error loading the quicksave file, the save file does not exist."); } shared.Cpu.GetCurrentOpcode().AbortProgram = true; try { SaveGame("kos-backup-quicksave"); var game = GamePersistence.LoadGame(name, HighLogic.SaveFolder, true, false); if (game.flightState != null) { if (game.compatible) { GamePersistence.UpdateScenarioModules(game); if (game.startScene != GameScenes.FLIGHT) { if (KSPUtil.CheckVersion(game.file_version_major, game.file_version_minor, game.file_version_revision, 0, 24, 0) != VersionCompareResult.INCOMPATIBLE_TOO_EARLY) { GamePersistence.SaveGame(game, name, HighLogic.SaveFolder, SaveMode.OVERWRITE); HighLogic.LoadScene(GameScenes.SPACECENTER); return; } } FlightDriver.StartAndFocusVessel(game, game.flightState.activeVesselIdx); } } } catch (Exception ex) { SafeHouse.Logger.Log(ex.Message); throw new KOSException("Error loading the quicksave file"); } } else { throw new KOSException("KSP prevents using quickload currently."); } }