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

dreammaster noreply at scummvm.org
Fri May 30 02:44:43 UTC 2025


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

Summary:
b8ab7153a8 M4: RIDDLE: Fix 64-bit Peiping crash due to 32-bit logic in op_FLOOR


Commit: b8ab7153a8d4649aafe7631ec0f5f762cc92f91f
    https://github.com/scummvm/scummvm/commit/b8ab7153a8d4649aafe7631ec0f5f762cc92f91f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-05-29T19:44:24-07:00

Commit Message:
M4: RIDDLE: Fix 64-bit Peiping crash due to 32-bit logic in op_FLOOR

Changed paths:
    engines/m4/wscript/ws_cruncher.cpp
    engines/m4/wscript/ws_cruncher.h


diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 33e856a6930..4a144947995 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -527,7 +527,7 @@ int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8) {
 	myFormat = (opCode & OP_FORMAT2) >> 19;
 	if (myFormat) {
 		word2 = FROM_LE_32(*myPC++);
-		myData = (word2 & OP_HIGH_DATA) >> 16;
+		myData = word2 >> 16;
 		if (!ExtractArg(myAnim8, myFormat, myData, &_GWS(myArg2), &_GWS(dataArg2))) {
 			return -1;
 		}
@@ -792,9 +792,9 @@ static void op_FLOOR(Anim8 *myAnim8) {
 		ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = floor(arg2)  or  arg1 = floor(rand(arg2,arg3))");
 	}
 	if (_GWS(myArg3)) {
-		*_GWS(myArg1) = (imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3))) & 0xffff0000;
+		*_GWS(myArg1) = ((imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3))) >> 16) << 16;
 	} else {
-		*_GWS(myArg1) = (*_GWS(myArg2)) & 0xffff0000;
+		*_GWS(myArg1) = ((*_GWS(myArg2)) >> 16) << 16;
 	}
 }
 
diff --git a/engines/m4/wscript/ws_cruncher.h b/engines/m4/wscript/ws_cruncher.h
index bea400dac34..0c6d8bf9ecb 100644
--- a/engines/m4/wscript/ws_cruncher.h
+++ b/engines/m4/wscript/ws_cruncher.h
@@ -32,7 +32,6 @@ namespace M4 {
 #define OP_FORMAT1			0x01c00000
 #define OP_FORMAT2			0x00380000
 #define OP_FORMAT3			0x00070000
-#define OP_HIGH_DATA		0xffff0000
 #define OP_LOW_DATA			0x0000ffff
 #define OP_DATA_SIGN		0x8000
 #define OP_DATA_VALUE		0x7fff




More information about the Scummvm-git-logs mailing list