@@ -73,11 +73,6 @@ bool ActivityMan::ForceAbortSave() {
7373 return SaveCurrentGame (" AbortSave" );
7474}
7575
76- // Not sure why this isn't in the minizip header, but we save some of the files without compression
77- // (index, because it's so small, and pngs, because they're already compressed)
78- #define MZ_COMPRESS_METHOD_STORE 0
79- #define MZ_COMPRESS_LEVEL_FAST 2
80-
8176bool ActivityMan::SaveCurrentGame (const std::string& fileName) {
8277 m_SaveGameTask.wait ();
8378 m_SaveGameTask = BS::multi_future<void >();
@@ -108,14 +103,21 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
108103 // See our content files to point to our save game location. This won't actually save a file here- but it allows us to set these up as in-memory ContentFiles on load
109104 // Meaning that our loading code doesn't need to care about whether it's loading a savegame or a file- it just sees it as an already loaded, cached bitmap
110105 modifiableScene->GetTerrain ()->GetContentFile ().SetIsMemoryFile (true );
111- modifiableScene->GetTerrain ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save Mat.png" );
112-
113106 modifiableScene->GetTerrain ()->GetFGSceneLayer ()->GetContentFile ().SetIsMemoryFile (true );
114- modifiableScene->GetTerrain ()->GetFGSceneLayer ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save FG.png" );
115-
116107 modifiableScene->GetTerrain ()->GetBGSceneLayer ()->GetContentFile ().SetIsMemoryFile (true );
108+
109+ modifiableScene->GetTerrain ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save Mat.png" );
110+ modifiableScene->GetTerrain ()->GetFGSceneLayer ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save FG.png" );
117111 modifiableScene->GetTerrain ()->GetBGSceneLayer ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save BG.png" );
118112
113+ for (int i = 0 ; i < Activity::MaxTeamCount; ++i) {
114+ SceneLayer* unseenLayer = modifiableScene->GetUnseenLayer (i);
115+ if (unseenLayer) {
116+ unseenLayer->GetContentFile ().SetIsMemoryFile (true );
117+ unseenLayer->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + std::format (" /Save UST{}.png" , i));
118+ }
119+ }
120+
119121 std::unique_ptr<std::stringstream> iniStream = std::make_unique<std::stringstream>();
120122
121123 // Block the main thread for a bit to let the Writer access the relevant data.
@@ -173,7 +175,7 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
173175 zipWriteInFileInZip (zippedSaveFile, indexStreamAsString.data (), indexStreamAsString.size ());
174176 zipCloseFileInZip (zippedSaveFile);
175177
176- zipOpenNewFileInZip (zippedSaveFile, " Save.ini" , &zfi, nullptr , 0 , nullptr , 0 , nullptr , Z_DEFLATED , MZ_COMPRESS_LEVEL_FAST);
178+ zipOpenNewFileInZip (zippedSaveFile, " Save.ini" , &zfi, nullptr , 0 , nullptr , 0 , nullptr , MZ_COMPRESS_METHOD_DEFLATE , MZ_COMPRESS_LEVEL_FAST);
177179 zipWriteInFileInZip (zippedSaveFile, mainStreamAsString.data (), mainStreamAsString.size ());
178180 zipCloseFileInZip (zippedSaveFile);
179181
@@ -298,8 +300,8 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) {
298300 }
299301
300302 for (int i = 0 ; i < Activity::MaxTeamCount; ++i) {
301- if (unzipFileIntoBuffer (std::format (" Save UST%i .png" , i))) {
302- ContentFile::ManuallyLoadDataPNG (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + std::format (" /Save UST%i " , i), loadMemPng (buffer, info.uncompressed_size ));
303+ if (unzipFileIntoBuffer (std::format (" Save UST{} .png" , i))) {
304+ ContentFile::ManuallyLoadDataPNG (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + std::format (" /Save UST{}.png " , i), loadMemPng (buffer, info.uncompressed_size ));
303305 }
304306 }
305307
0 commit comments