| 89 | } |
| 90 | |
| 91 | void Scene_File::PopulateSaveWindow(Window_SaveFile& win, int id) { |
| 92 | // Try to access file |
| 93 | std::stringstream ss; |
| 94 | ss << "Save" << (id <= 8 ? "0" : "") << (id + 1) << ".lsd"; |
| 95 | |
| 96 | std::string file = fs.FindFile(ss.str()); |
| 97 | |
| 98 | if (!file.empty()) { |
| 99 | // File found |
| 100 | auto save_stream = FileFinder::Save().OpenInputStream(file); |
| 101 | if (!save_stream) { |
| 102 | Output::Debug("Save {} read error", file); |
| 103 | win.SetCorrupted(true); |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | std::unique_ptr<lcf::rpg::Save> savegame = lcf::LSD_Reader::Load(save_stream, Player::encoding); |
| 108 | |
| 109 | if (savegame) { |
| 110 | PopulatePartyFaces(win, id, *savegame); |
| 111 | UpdateLatestTimestamp(id, *savegame); |
| 112 | } else { |
| 113 | Output::Debug("Save {} corrupted", file); |
| 114 | win.SetCorrupted(true); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | void Scene_File::Start() { |
| 120 | CreateHelpWindow(); |
nothing calls this directly
no test coverage detected