[Scummvm-git-logs] scummvm master -> 7a1e42dd87833639bf8ee76316d6cdd4abde71c3

dreammaster noreply at scummvm.org
Sat Apr 25 11:12:17 UTC 2026


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

Summary:
4bd3ac6954 COMMON: Add syncMultiple functions to Common::Serializer
7a1e42dd87 MADS: PHANTOM: Test usage of new Serializer syncMultipleLE function


Commit: 4bd3ac6954294f0ffc593bc74df230aed2273d1e
    https://github.com/scummvm/scummvm/commit/4bd3ac6954294f0ffc593bc74df230aed2273d1e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-25T21:12:03+10:00

Commit Message:
COMMON: Add syncMultiple functions to Common::Serializer

Changed paths:
    common/serializer.h


diff --git a/common/serializer.h b/common/serializer.h
index 4458963c9fa..66d4df3d549 100644
--- a/common/serializer.h
+++ b/common/serializer.h
@@ -297,6 +297,49 @@ public:
 			serializer(*this, arr[i]);
 		}
 	}
+
+	/**
+	 * Synchronizes multiple values in the serializer using a specified data format.
+	 */
+	template<class TDataFormat, class... T>
+	void syncMultiple(const TDataFormat &dataFormat, T &...values) {
+		const TDataFormat dataFormatCopy = dataFormat;	// Copy to help compiler alias analysis, parameter is const ref to ensure TDataFormat is a concrete type
+
+		byte buffer[DataMultipleIO<TDataFormat, T...>::kMaxSize];
+		const uint actualSize = DataMultipleIO<TDataFormat, T...>::computeSize(dataFormatCopy);
+
+		if (isLoading()) {
+			syncBytes(buffer, actualSize);
+			DataMultipleIO<TDataFormat, T...>::decode(dataFormatCopy, buffer, values...);
+		} else {
+			DataMultipleIO<TDataFormat, T...>::encode(dataFormatCopy, buffer, values...);
+			syncBytes(buffer, actualSize);
+		}
+	}
+
+	/**
+	 * Synchronizes multiple values from the serializer using a specified endianness.
+	 */
+	template<class... T>
+	inline void syncMultipleEndian(bool isLittle, T &...values) {
+		this->syncMultiple<EndianStorageFormat, T...>(isLittle ? EndianStorageFormat::Little : EndianStorageFormat::Big, values...);
+	}
+
+	/**
+	 * Synchronizes multiple values to the serializer in little endian format.
+	 */
+	template<class... T>
+	inline void syncMultipleLE(T &...values) {
+		this->syncMultiple<EndianStorageFormat, T...>(EndianStorageFormat::Little, values...);
+	}
+
+	/**
+	 * Synchronizes multiple values to the serializer in big endian format.
+	 */
+	template<class... T>
+	inline void syncMultipleBE(T &...values) {
+		this->syncMultiple<EndianStorageFormat, T...>(EndianStorageFormat::Big, values...);
+	}
 };
 
 #undef SYNC_PRIMITIVE


Commit: 7a1e42dd87833639bf8ee76316d6cdd4abde71c3
    https://github.com/scummvm/scummvm/commit/7a1e42dd87833639bf8ee76316d6cdd4abde71c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-25T21:12:03+10:00

Commit Message:
MADS: PHANTOM: Test usage of new Serializer syncMultipleLE function

Changed paths:
    engines/mads/madsv2/core/kernel.cpp


diff --git a/engines/mads/madsv2/core/kernel.cpp b/engines/mads/madsv2/core/kernel.cpp
index a36222b36ad..4282135268c 100644
--- a/engines/mads/madsv2/core/kernel.cpp
+++ b/engines/mads/madsv2/core/kernel.cpp
@@ -161,8 +161,7 @@ static void kernel_animation_get_sprite(int handle, int id);
 void KernelGame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(going);
 	s.skip(1);
-	for (int i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
-		s.syncAsSint16LE(scratch[i]);
+	s.syncMultipleLE(scratch);
 	s.syncAsByte(difficulty);
 	s.skip(1);
 	s.syncAsSint16LE(last_save);




More information about the Scummvm-git-logs mailing list