[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.69,1.70

Max Horn fingolfin at users.sourceforge.net
Mon Nov 11 07:26:05 CET 2002


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

Modified Files:
	simon.cpp 
Log Message:
fixed endian bug that prevented Simon2 SFX from playing on big endian machinese

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- simon.cpp	11 Nov 2002 13:55:29 -0000	1.69
+++ simon.cpp	11 Nov 2002 15:25:30 -0000	1.70
@@ -3312,6 +3312,10 @@
 		_effects_file->seek(0, SEEK_SET);
 		_effects_file->read(_effects_offsets, size);
 
+#if defined(SCUMM_BIG_ENDIAN)
+		for (uint r = 0; r < num; r++)
+			_effects_offsets[r] = FROM_LE_32(_effects_offsets[r]);
+#endif
 	} else if (_game & GAME_SIMON2) { 			/* simon 2 */
 		int num_per_set[] = {0, 188, 223, 217, 209, 179, 187, 189, 116, 174, 203,
 				173, 176, 38, 205, 134, 213, 212, 167, 141};
@@ -3338,16 +3342,12 @@
 		_game_file->read(_effects_offsets, num * sizeof(uint32));
 
 		for (i = 0; i < num; i++) {
+#if defined(SCUMM_BIG_ENDIAN)
+			_effects_offsets[i] = FROM_LE_32(_effects_offsets[i]);
+#endif
 			_effects_offsets[i] += offs;
 		}
 	}
-#if defined(SCUMM_BIG_ENDIAN)
-	uint r;
-	if (_effects_offsets) {
-		for (r = 0; r < num; r++)
-			_effects_offsets[r] = READ_LE_UINT32(&_effects_offsets[r]);
-	}
-#endif
 }
 
 void SimonState::video_putchar(FillOrCopyStruct *fcs, byte c)
@@ -4140,7 +4140,7 @@
 		resfile_read(_game_offsets_ptr, 0, gss->NUM_GAME_OFFSETS * sizeof(uint32));
 #if defined(SCUMM_BIG_ENDIAN)
 		for (uint r = 0; r < gss->NUM_GAME_OFFSETS; r++)
-			_game_offsets_ptr[r] = READ_LE_UINT32(&_game_offsets_ptr[r]);
+			_game_offsets_ptr[r] = FROM_LE_32(_game_offsets_ptr[r]);
 #endif
 	}
 
@@ -4793,12 +4793,12 @@
 		uint r;
 		if (_voice_offsets) {
 			for (r = 0; r < gss->NUM_VOICE_RESOURCES; r++)
-				_voice_offsets[r] = READ_LE_UINT32(&_voice_offsets[r]);
+				_voice_offsets[r] = FROM_LE_32(_voice_offsets[r]);
 		}
 
 		if (_effects_offsets) {
 			for (r = 0; r < gss->NUM_EFFECTS_RESOURCES; r++)
-				_effects_offsets[r] = READ_LE_UINT32(&_effects_offsets[r]);
+				_effects_offsets[r] = FROM_LE_32(_effects_offsets[r]);
 		}
 #endif
 	}
@@ -4910,7 +4910,7 @@
 		return;
 	}
 
-	sound_file->seek(READ_LE_UINT32(&wave_hdr.size) - sizeof(wave_hdr) + 20, SEEK_CUR);
+	sound_file->seek(FROM_LE_32(wave_hdr.size) - sizeof(wave_hdr) + 20, SEEK_CUR);
 
 	data[0] = sound_file->readUint32LE();
 	data[1] = sound_file->readUint32LE();
@@ -4923,7 +4923,7 @@
 	byte *buffer = (byte *)malloc(data[1]);
 	sound_file->read(buffer, data[1]);
 
-	_mixer->playRaw(sound_handle, buffer, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec), flags);
+	_mixer->playRaw(sound_handle, buffer, data[1], FROM_LE_32(wave_hdr.samples_per_sec), flags);
 }
 
 void SimonState::playVoice(uint voice)





More information about the Scummvm-git-logs mailing list