[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.441,2.442 resource_v7he.cpp,1.31,1.32 script_v100he.cpp,2.124,2.125 script_v72he.cpp,2.255,2.256 script_v80he.cpp,2.92,2.93 script_v90he.cpp,2.227,2.228
kirben
kirben at users.sourceforge.net
Wed Apr 13 23:08:41 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7096/scumm
Modified Files:
intern.h resource_v7he.cpp script_v100he.cpp script_v72he.cpp
script_v80he.cpp script_v90he.cpp
Log Message:
Add HE7.2 difference in o_getResourceSize().
Add support for checking size of music resource.
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.441
retrieving revision 2.442
diff -u -d -r2.441 -r2.442
--- intern.h 13 Apr 2005 19:48:48 -0000 2.441
+++ intern.h 14 Apr 2005 06:06:57 -0000 2.442
@@ -808,6 +808,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 getMusicResourceSize(int id);
/* HE version 72 script opcodes */
void o72_pushDWord();
@@ -895,6 +896,7 @@
void o80_drawWizPolygon();
void o80_unknownE0();
void o80_pickVarRandom();
+ void o80_getResourceSize();
};
struct SpriteInfo;
Index: resource_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v7he.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- resource_v7he.cpp 10 Apr 2005 12:58:57 -0000 1.31
+++ resource_v7he.cpp 14 Apr 2005 06:06:57 -0000 1.32
@@ -1753,4 +1753,58 @@
return ((ScummEngine_v72he::ArrayHeader *)addr)->data;
}
+int ScummEngine_v72he::getMusicResourceSize(int id) {
+ int size, total_size;
+ uint tracks, skip;
+ char buf[32], buf1[128];
+ File musicFile;
+
+ sprintf(buf, "%s.he4", getGameName());
+
+ if (_substResFileNameIndex > 0) {
+ generateSubstResFileName(buf, buf1, sizeof(buf1));
+ strcpy(buf, buf1);
+ }
+ if (musicFile.open(buf) == false) {
+ warning("getMusicResourceSize: Music file is not open");
+ return 0;
+ }
+ musicFile.seek(4, SEEK_SET);
+ total_size = musicFile.readUint32BE();
+ musicFile.seek(+8, SEEK_CUR);
+ tracks = musicFile.readUint32LE();
+
+ skip = 0;
+ if (id >= 8500)
+ skip = (id - 8500);
+ else if (id >= 8000)
+ skip = (id - 8000);
+ else if (id >= 4000)
+ skip = (id - 4000);
+
+ if (skip > tracks - 1)
+ skip = 0;
+
+ if (_heversion >= 80) {
+ // Skip to offsets
+ musicFile.seek(+40, SEEK_CUR);
+
+ // Skip to correct music header
+ skip *= 21;
+ } else {
+ // Skip to offsets
+ musicFile.seek(+4, SEEK_CUR);
+
+ // Skip to correct music header
+ skip *= 25;
+ }
+
+ musicFile.seek(+skip, SEEK_CUR);
+ musicFile.readUint32LE();
+ size = musicFile.readUint32LE();
+ musicFile.close();
+
+ return size;
+}
+
} // End of namespace Scumm
Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.124
retrieving revision 2.125
diff -u -d -r2.124 -r2.125
--- script_v100he.cpp 13 Apr 2005 19:48:49 -0000 2.124
+++ script_v100he.cpp 14 Apr 2005 06:06:58 -0000 2.125
@@ -2191,9 +2191,9 @@
}
void ScummEngine_v100he::o100_getResourceSize() {
- int size = 0, type;
+ int size, type;
- int idx = pop();
+ int resid = pop();
byte subOp = fetchScriptByte();
switch (subOp) {
@@ -2210,9 +2210,8 @@
type = rtScript;
break;
case 72:
- if (idx > _numSounds) {
- // TODO Music resource size
- push(100);
+ if (resid > _numSounds) {
+ push(getMusicResourceSize(resid));
return;
}
type = rtSound;
@@ -2221,9 +2220,9 @@
error("o100_getResourceSize: default type %d", subOp);
}
- const byte *ptr = getResourceAddress(type, idx);
- if (ptr)
- size = READ_BE_UINT32(ptr + 4) - 8;
+ const byte *ptr = getResourceAddress(type, resid);
+ assert(ptr);
+ size = READ_BE_UINT32(ptr + 4) - 8;
push(size);
}
Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.255
retrieving revision 2.256
diff -u -d -r2.255 -r2.256
--- script_v72he.cpp 13 Apr 2005 11:03:22 -0000 2.255
+++ script_v72he.cpp 14 Apr 2005 06:06:58 -0000 2.256
@@ -2151,41 +2151,17 @@
}
void ScummEngine_v72he::o72_getResourceSize() {
- int size = 0, type;
-
- int idx = pop();
- byte subOp = fetchScriptByte();
+ int resid, size;
- switch (subOp) {
- case 13:
- if (idx > _numSounds) {
- // TODO Music resource size
- push(100);
- return;
- }
- type = rtSound;
- break;
- case 14:
- type = rtRoomImage;
- break;
- case 15:
- type = rtImage;
- break;
- case 16:
- type = rtCostume;
- break;
- case 17:
- type = rtScript;
- break;
- default:
- warning("o72_getResourceSize: default type %d", subOp);
- push(0);
+ resid = pop();
+ if (resid > _numSounds) {
+ push(getMusicResourceSize(resid));
return;
}
- const byte *ptr = getResourceAddress(type, idx);
- if (ptr)
- size = READ_BE_UINT32(ptr + 4) - 8;
+ const byte *ptr = getResourceAddress(rtSound, resid);
+ assert(ptr);
+ size = READ_BE_UINT32(ptr + 4) - 8;
push(size);
}
Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.92
retrieving revision 2.93
diff -u -d -r2.92 -r2.93
--- script_v80he.cpp 13 Apr 2005 10:34:35 -0000 2.92
+++ script_v80he.cpp 14 Apr 2005 06:06:58 -0000 2.93
@@ -352,7 +352,7 @@
OPCODE(o70_getCharIndexInString),
OPCODE(o6_invalid),
/* F8 */
- OPCODE(o72_getResourceSize),
+ OPCODE(o80_getResourceSize),
OPCODE(o72_setFilePath),
OPCODE(o72_setWindowCaption),
OPCODE(o70_polygonOps),
@@ -808,4 +808,40 @@
push(readArray(value, 0, num));
}
+void ScummEngine_v80he::o80_getResourceSize() {
+ int size, type;
+
+ int resid = pop();
+ byte subOp = fetchScriptByte();
+
+ switch (subOp) {
+ case 13:
+ if (resid > _numSounds) {
+ push(getMusicResourceSize(resid));
+ return;
+ }
+ type = rtSound;
+ break;
+ case 14:
+ type = rtRoomImage;
+ break;
+ case 15:
+ type = rtImage;
+ break;
+ case 16:
+ type = rtCostume;
+ break;
+ case 17:
+ type = rtScript;
+ break;
+ default:
+ error("o80_getResourceSize: default type %d", subOp);
+ }
+
+ const byte *ptr = getResourceAddress(type, resid);
+ assert(ptr);
+ size = READ_BE_UINT32(ptr + 4) - 8;
+ push(size);
+}
+
} // End of namespace Scumm
Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.227
retrieving revision 2.228
diff -u -d -r2.227 -r2.228
--- script_v90he.cpp 14 Apr 2005 03:26:23 -0000 2.227
+++ script_v90he.cpp 14 Apr 2005 06:06:59 -0000 2.228
@@ -352,7 +352,7 @@
OPCODE(o70_getCharIndexInString),
OPCODE(o6_invalid),
/* F8 */
- OPCODE(o72_getResourceSize),
+ OPCODE(o80_getResourceSize),
OPCODE(o72_setFilePath),
OPCODE(o72_setWindowCaption),
OPCODE(o70_polygonOps),
More information about the Scummvm-git-logs
mailing list