@@ -73,11 +73,6 @@ bool ActivityMan::ForceAbortSave() {
73
73
return SaveCurrentGame (" AbortSave" );
74
74
}
75
75
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
-
81
76
bool ActivityMan::SaveCurrentGame (const std::string& fileName) {
82
77
m_SaveGameTask.wait ();
83
78
m_SaveGameTask = BS::multi_future<void >();
@@ -108,14 +103,21 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
108
103
// 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
109
104
// 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
110
105
modifiableScene->GetTerrain ()->GetContentFile ().SetIsMemoryFile (true );
111
- modifiableScene->GetTerrain ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save Mat.png" );
112
-
113
106
modifiableScene->GetTerrain ()->GetFGSceneLayer ()->GetContentFile ().SetIsMemoryFile (true );
114
- modifiableScene->GetTerrain ()->GetFGSceneLayer ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save FG.png" );
115
-
116
107
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" );
117
111
modifiableScene->GetTerrain ()->GetBGSceneLayer ()->GetContentFile ().SetDataPath (g_PresetMan.GetFullModulePath (c_UserScriptedSavesModuleName) + " /Save BG.png" );
118
112
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
+
119
121
std::unique_ptr<std::stringstream> iniStream = std::make_unique<std::stringstream>();
120
122
121
123
// 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) {
173
175
zipWriteInFileInZip (zippedSaveFile, indexStreamAsString.data (), indexStreamAsString.size ());
174
176
zipCloseFileInZip (zippedSaveFile);
175
177
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);
177
179
zipWriteInFileInZip (zippedSaveFile, mainStreamAsString.data (), mainStreamAsString.size ());
178
180
zipCloseFileInZip (zippedSaveFile);
179
181
@@ -298,8 +300,8 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) {
298
300
}
299
301
300
302
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 ));
303
305
}
304
306
}
305
307
0 commit comments