[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.445,2.446 resource_v7he.cpp,1.33,1.34 script_v100he.cpp,2.129,2.130 script_v72he.cpp,2.265,2.266 script_v80he.cpp,2.97,2.98

kirben kirben at users.sourceforge.net
Mon Apr 18 04:44:44 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23058/scumm

Modified Files:
	intern.h resource_v7he.cpp script_v100he.cpp script_v72he.cpp 
	script_v80he.cpp 
Log Message:

Adjust again, for sound header differences.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.445
retrieving revision 2.446
diff -u -d -r2.445 -r2.446
--- intern.h	18 Apr 2005 07:18:31 -0000	2.445
+++ intern.h	18 Apr 2005 11:44:00 -0000	2.446
@@ -812,6 +812,7 @@
 	byte *heFindResource(uint32 tag, byte *ptr);
 	byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
 	int findObject(int x, int y, int num, int *args);
+	int getSoundResourceSize(int id);
 
 	/* HE version 72 script opcodes */
 	void o72_pushDWord();

Index: resource_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v7he.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- resource_v7he.cpp	18 Apr 2005 07:18:32 -0000	1.33
+++ resource_v7he.cpp	18 Apr 2005 11:44:01 -0000	1.34
@@ -28,6 +28,7 @@
 #include "scumm/intern.h"
 #include "scumm/resource.h"
 #include "scumm/resource_v7he.h"
+#include "scumm/sound.h"
 #include "scumm/util.h"
 
 #include "common/stream.h"
@@ -1753,4 +1754,32 @@
 	return ((ScummEngine_v72he::ArrayHeader *)addr)->data;
 }
 
+int ScummEngine_v72he::getSoundResourceSize(int id) {
+	const byte *ptr;
+	int offs, size;
+
+	if (id > _numSounds) {
+		_sound->getHEMusicDetails(id, offs, size);
+	} else {
+		ptr = getResourceAddress(rtSound, id);
+		if (!ptr)
+			return 0;
+
+		if (READ_UINT32(ptr) == MKID('HSHD')) {
+			ptr += READ_BE_UINT32(ptr + 4);
+		} else {
+			ptr += 8 + READ_BE_UINT32(ptr + 12);
+		}
+
+		if (READ_UINT32(ptr) == MKID('SBNG')) {
+			ptr += READ_BE_UINT32(ptr + 4);
+		}
+
+		assert(READ_UINT32(ptr) == MKID('SDAT'));
+		size = READ_BE_UINT32(ptr + 4) - 8;
+	}
+
+	return size;
+}
+
 } // End of namespace Scumm

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.129
retrieving revision 2.130
diff -u -d -r2.129 -r2.130
--- script_v100he.cpp	18 Apr 2005 11:19:54 -0000	2.129
+++ script_v100he.cpp	18 Apr 2005 11:44:01 -0000	2.130
@@ -2211,16 +2211,7 @@
 		type = rtScript;
 		break;
 	case 72:
-		if (resid > _numSounds) {
-			int offs;
-			_sound->getHEMusicDetails(resid, offs, size);
-			push(size);
-		} else {
-			ptr = getResourceAddress(rtSound, resid);
-			assert(ptr);
-			size = READ_BE_UINT32(ptr + 4) - 40;
-			push(size);
-		}
+		push (getSoundResourceSize(resid));
 		return;
 	default:
 		error("o100_getResourceSize: default type %d", subOp);

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.265
retrieving revision 2.266
diff -u -d -r2.265 -r2.266
--- script_v72he.cpp	18 Apr 2005 11:19:54 -0000	2.265
+++ script_v72he.cpp	18 Apr 2005 11:44:01 -0000	2.266
@@ -2156,19 +2156,8 @@
 }
 
 void ScummEngine_v72he::o72_getResourceSize() {
-	int resid, size;
-
-	resid = pop();
-	if (resid > _numSounds) {
-		int offs;
-		_sound->getHEMusicDetails(resid, offs, size);
-		push(size);
-	} else {
-		const byte *ptr = getResourceAddress(rtSound, resid);
-		assert(ptr);
-		size = READ_BE_UINT32(ptr + 4) - 40;
-		push(size);
-	}
+	int resid = pop();
+	push(getSoundResourceSize(resid));
 }
 
 void ScummEngine_v72he::o72_setFilePath() {

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.97
retrieving revision 2.98
diff -u -d -r2.97 -r2.98
--- script_v80he.cpp	18 Apr 2005 11:19:54 -0000	2.97
+++ script_v80he.cpp	18 Apr 2005 11:44:01 -0000	2.98
@@ -814,16 +814,7 @@
 
 	switch (subOp) {
 	case 13:
-		if (resid > _numSounds) {
-			int offs;
-			_sound->getHEMusicDetails(resid, offs, size);
-			push(size);
-		} else {
-			ptr = getResourceAddress(rtSound, resid);
-			assert(ptr);
-			size = READ_BE_UINT32(ptr + 4) - 40;
-			push(size);
-		}
+		push (getSoundResourceSize(resid));
 		return;
 	case 14:
 		type = rtRoomImage;





More information about the Scummvm-git-logs mailing list