[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.47,1.48

Oliver Kiehl olki at users.sourceforge.net
Mon Nov 4 15:27:01 CET 2002


Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv14577

Modified Files:
	simon.cpp 
Log Message:
fixed mp3 support for simon


Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- simon.cpp	4 Nov 2002 05:09:07 -0000	1.47
+++ simon.cpp	4 Nov 2002 23:26:08 -0000	1.48
@@ -4710,12 +4710,31 @@
 #endif
 
 		if (_voice_type != FORMAT_NONE) {
-			_voice_offsets = (uint32 *)malloc(gss->NUM_VOICE_RESOURCES * sizeof(uint32));
+#ifdef USE_MAD
+			if (_voice_type == FORMAT_MP3)
+				_voice_offsets = (uint32 *)malloc((gss->NUM_VOICE_RESOURCES + 1) * sizeof(uint32));
+			else
+#else
+				_voice_offsets = (uint32 *)malloc(gss->NUM_VOICE_RESOURCES * sizeof(uint32));
+#endif
 			if (_voice_offsets == NULL)
 				error("Out of memory for voice offsets");
 	
 			if (_voice_file->read(_voice_offsets, gss->NUM_VOICE_RESOURCES * sizeof(uint32)) != gss->NUM_VOICE_RESOURCES * sizeof(uint32))
 				error("Cannot read voice offsets");
+#ifdef USE_MAD
+			if (_voice_type == FORMAT_MP3) {
+				uint8 buf[2048];
+				uint32 pos = 0;
+				_voice_file->seek(0, SEEK_SET);
+			        while ((_voice_file->read(buf, 2048)) > 0) {
+					if (pos == _voice_file->pos())
+						break;
+					pos = _voice_file->pos();
+			        }
+				_voice_offsets[gss->NUM_EFFECTS_RESOURCES] = pos;
+			}
+#endif
 		}
 
 		_effects_offsets = NULL;
@@ -4734,12 +4753,31 @@
 #endif
 		if (_effects_file->isOpen() == true)
 		{
-			_effects_offsets = (uint32 *)malloc(gss->NUM_EFFECTS_RESOURCES * sizeof(uint32));
+#ifdef USE_MAD
+			if (_effects_type == FORMAT_MP3)
+				_effects_offsets = (uint32 *)malloc((gss->NUM_EFFECTS_RESOURCES + 1) * sizeof(uint32));
+			else
+#else
+				_effects_offsets = (uint32 *)malloc(gss->NUM_EFFECTS_RESOURCES * sizeof(uint32));
+#endif
 			if (_effects_offsets == NULL)
 				error("Out of memory for effects offsets");
 
 			if (_effects_file->read(_effects_offsets, gss->NUM_EFFECTS_RESOURCES * sizeof(uint32)) != gss->NUM_EFFECTS_RESOURCES * sizeof(uint32))
 				error("Cannot read effects offsets");
+#ifdef USE_MAD
+			if (_effects_type == FORMAT_MP3) {
+				uint8 buf[2048];
+				uint32 pos = 0;
+				_effects_file->seek(0, SEEK_SET);
+			        while ((_effects_file->read(buf, 2048)) > 0) {
+					if (pos == _effects_file->pos())
+						break;
+					pos = _effects_file->pos();
+			        }
+				_effects_offsets[gss->NUM_EFFECTS_RESOURCES] = pos;
+			}
+#endif
 		} else {
 			_effects_type = FORMAT_NONE;
 		}





More information about the Scummvm-git-logs mailing list