Ticket #7910: midi_resource_patch

File midi_resource_patch, 1.5 KB (added by SF/japj, 22 years ago)

midi resource support patch

Line 
1Index: resource.cpp
2===================================================================
3RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
4retrieving revision 1.16
5diff -u -r1.16 resource.cpp
6--- resource.cpp 2001/11/09 22:45:19 1.16
7+++ resource.cpp 2001/11/10 21:08:56
8@@ -495,14 +495,27 @@
9 uint32 resStart, size, tag, size2;
10 byte *ptr;
11 int i;
12+
13+ const uint32 midi_tag=MKID('MIDI');
14
15 debug(9, "readSoundResource(%d,%d)", type, index);
16
17 resStart = 0;
18
19- fileReadDwordLE();
20+ tag=fileReadDwordLE();
21 size = fileReadDwordBE();
22
23+ if (tag==midi_tag)
24+ {
25+ debug(1,"loading %c%c%c%c soundResource %d (size %d)",tag,tag>>8,tag>>16,tag>>24,index,size);
26+ fileSeek(_fileHandle, -8, SEEK_CUR);
27+ fileRead(_fileHandle,createResource(type, index, size), size);
28+ return 1;
29+ }
30+ else
31+ {
32+
33+
34 while (size>resStart) {
35 tag = fileReadDword();
36 size2 = fileReadDwordBE();
37@@ -512,13 +525,17 @@
38 for (i=0,ptr=_soundTagTable; i<_numSoundTags; i++,ptr+=4) {
39 /* endian OK, tags are in native format */
40 if (READ_UINT32_UNALIGNED(ptr) == tag) {
41+ debug(1,"loading %c%c%c%c soundResource %d (size %d)",tag,tag>>8,tag>>16,tag>>24,index,size);
42 fileSeek(_fileHandle, -8, SEEK_CUR);
43 fileRead(_fileHandle,createResource(type, index, size2+8), size2+8);
44 return 1;
45 }
46 }
47-
48+
49+ debug(1,"could not load %c%c%c%c soundResource %d",tag,tag>>8,tag>>16,tag>>24,index);
50+
51 fileSeek(_fileHandle, size2, SEEK_CUR);
52+ }
53 }
54
55 res.roomoffs[type][index] = 0xFFFFFFFF;