[Scummvm-git-logs] scummvm master -> f9906e1567998d1fa96a7ba92d32cd7ba1085c9a

dreammaster dreammaster at scummvm.org
Fri Jun 18 02:39:18 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f9906e1567 AGS: Workaround to load old ScummVM savegames


Commit: f9906e1567998d1fa96a7ba92d32cd7ba1085c9a
    https://github.com/scummvm/scummvm/commit/f9906e1567998d1fa96a7ba92d32cd7ba1085c9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-17T19:37:32-07:00

Commit Message:
AGS: Workaround to load old ScummVM savegames

The original codebase imported to ScummVM had two issues with it
1) The component "Dynamic Surfaces" had been incorrectly named
"Drawing Surfaces" for a while, and was only corrected later on
2) The Managed Pool component was set as version 1, but later
changed back to version 0.

This commit allows these old savegames to still be loaded
under the new, corrected codebase

Changed paths:
    engines/ags/engine/game/savegame_components.cpp


diff --git a/engines/ags/engine/game/savegame_components.cpp b/engines/ags/engine/game/savegame_components.cpp
index 2ceef6e8c5..33876b636a 100644
--- a/engines/ags/engine/game/savegame_components.cpp
+++ b/engines/ags/engine/game/savegame_components.cpp
@@ -1167,11 +1167,23 @@ HSaveError ReadComponent(Stream *in, SvgCmpReadHelper &hlp, ComponentInfo &info)
 	info.DataSize = hlp.Version >= kSvgVersion_Cmp_64bit ? in->ReadInt64() : in->ReadInt32();
 	info.DataOffset = in->GetPosition();
 
+	// WORKAROUND: For some period, the component "Dynamic Surfaces"
+	// was mis-named as "Drawing Surfaces"
+	String componentName = info.Name;
+	if (componentName == "Drawing Surfaces")
+		componentName = "Dynamic Surfaces";
+
 	const ComponentHandler *handler = nullptr;
-	std::map<String, ComponentHandler>::const_iterator it_hdr = hlp.Handlers.find(info.Name);
+	std::map<String, ComponentHandler>::const_iterator it_hdr = hlp.Handlers.find(componentName);
 	if (it_hdr != hlp.Handlers.end())
 		handler = &it_hdr->_value;
 
+	// WORKAROUND: Managed Pool was incorrectly set as version 1
+	// in the codebase originally imported to ScummVM
+	if (componentName == "Managed Pool" && info.Version == 1
+		&& handler && handler->Version == 0)
+		info.Version = 0;
+
 	if (!handler || !handler->Unserialize)
 		return new SavegameError(kSvgErr_UnsupportedComponent);
 	if (info.Version > handler->Version || info.Version < handler->LowestVersion)




More information about the Scummvm-git-logs mailing list