[Scummvm-git-logs] scummvm master -> 4defcb7677a30504f079525a24a0a8d49f66e6c0

dreammaster noreply at scummvm.org
Wed Jan 29 15:57:32 UTC 2025


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

Summary:
c1ee870335 M4: RIDDLE: Fix for room 608 Twelvetrees cutscene
4defcb7677 M4: RIDDLE: Fix memory overruns


Commit: c1ee87033531adde998999c2baa5a5de293a8a96
    https://github.com/scummvm/scummvm/commit/c1ee87033531adde998999c2baa5a5de293a8a96
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-01-29T07:57:14-08:00

Commit Message:
M4: RIDDLE: Fix for room 608 Twelvetrees cutscene

Changed paths:
    engines/m4/riddle/rooms/section6/room608.cpp


diff --git a/engines/m4/riddle/rooms/section6/room608.cpp b/engines/m4/riddle/rooms/section6/room608.cpp
index 18276aa6948..c3bdda81860 100644
--- a/engines/m4/riddle/rooms/section6/room608.cpp
+++ b/engines/m4/riddle/rooms/section6/room608.cpp
@@ -1129,7 +1129,7 @@ void Room608::daemon() {
 
 	case 700:
 		player_update_info(_tt, &_G(player_info));
-		ws_hide_walker();
+		ws_hide_walker(_tt);
 		_ttShadow = series_show("tt walker shadow 3", 0xf00, 0, -1, -1, 0,
 			_G(player_info).scale, _G(player_info).x, _G(player_info).y);
 		_ttTalker = TriggerMachineByHash(1, 1, 0, 0, 0, 0, 0, 0, 100, 0x100, 0,
@@ -1316,7 +1316,7 @@ void Room608::daemon() {
 		break;
 
 	case 758:
-		sendWSMessage_10000(1, _ttTalker, _all5a, 760, 7, -1, _all5a, 1, 12, 4);
+		sendWSMessage_10000(1, _ttTalker, _all5a, 7, 7, -1, _all5a, 7, 12, 4);
 		digi_play("608t11", 2, 255, 760);
 		break;
 
@@ -1371,7 +1371,7 @@ void Room608::daemon() {
 		break;
 
 	case 770:
-		sendWSMessage_10000(1, _ttTalker, _all5a, 23, 1, 773, _all5a, 1, 1, 1);
+		sendWSMessage_10000(1, _ttTalker, _tt05, 23, 1, 773, _tt05, 1, 1, 1);
 		break;
 
 	case 771:


Commit: 4defcb7677a30504f079525a24a0a8d49f66e6c0
    https://github.com/scummvm/scummvm/commit/4defcb7677a30504f079525a24a0a8d49f66e6c0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-01-29T07:57:14-08:00

Commit Message:
M4: RIDDLE: Fix memory overruns

Changed paths:
    engines/m4/adv_r/adv_walk.cpp
    engines/m4/graphics/krn_pal.cpp


diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 3a9c930cb70..f14a8a49a7b 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -488,6 +488,11 @@ void adv_get_walker_destination(machine *my_walker, int32 *x, int32 *y, int32 *f
 
 	// Get final facing from l.v.6 = myRegs[6 + IDX_COUNT]
 	face = my_walker->myAnim8->myRegs[6 + IDX_COUNT] >> 16;
+
+	// FIXME: Riddle room 608 Twelvetrees cutscene has face -1. Not sure if happens in original
+	if (face == -1)
+		face = 0;
+
 	*final_facing = directions[face];
 }
 
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 2e57d888c9b..207ac5c4f84 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -387,20 +387,27 @@ void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
 void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2) {
 	uint8 *ptr;
 	int32 x, y;
+
 	if ((!src) || (!src->data)) return;
-	if ((x2 - x1 < 0) || (y2 - y1 < 0)) return;
-	if (x2 - x1 + 1 > src->w) x2 = src->w - 1;
-	if (y2 - y1 + 1 > src->h) y2 = src->h - 1;
+
+	// WORKAROUND: Fix original bounding that could result in buffer overruns on final y2 line
+	if (x1 < 0) x1 = 0;
+	if (y1 < 0) y1 = 0;
+	if (x2 >= src->w) x2 = src->w - 1;
+	if (y2 >= src->h) y2 = src->h - 1;
+	if (x2 <= x1 || y2 <= y1)
+		return;
 
 	x2 -= x1;
 	y2 -= y1;
+
 	for (y = 0; y <= y2; y++) {
 		ptr = &src->data[(y + y1) * src->stride + x1];
-		for (x = 0; x <= x2; x++)								  // for each pixel in row
-
-			// remap the greyed out pixel to the closest grey in GREY_START to GREY_END range
+		for (x = 0; x <= x2; x++) {
+			// Remap the greyed out pixel to the closest grey in GREY_START to GREY_END range
 			// shift right 3, takes a 255 value and makes it out of 32 (the number of greys in reduced grey ramp)
 			ptr[x] = (uint8)(GREY_START + (_GP(fadeToMe)[ptr[x]].g >> 3));	 // Use green instead of red cause we're having a green screen 
+		}
 
 		if (!(y & 0xff)) {
 			_G(digi).task();




More information about the Scummvm-git-logs mailing list