[Scummvm-cvs-logs] scummvm master -> 218d82c62b8078e82dd5dabc165e35563c464600

wjp wjp at usecode.org
Wed May 25 22:47:18 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
218d82c62b AGI: Fix compilation on 64 bit platforms


Commit: 218d82c62b8078e82dd5dabc165e35563c464600
    https://github.com/scummvm/scummvm/commit/218d82c62b8078e82dd5dabc165e35563c464600
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-05-25T13:45:21-07:00

Commit Message:
AGI: Fix compilation on 64 bit platforms

I'm unable to test this change, but it avoids using a pointer to store
an int temporarily.

Changed paths:
    engines/agi/sound_2gs.cpp
    engines/agi/sound_2gs.h



diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index af7214f..6d64c29 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -396,7 +396,7 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) {
 		wb++;
 
 	// Prepare the generator.
-	g->osc[0].base	= i->wave[0][wa].base;
+	g->osc[0].base	= i->base + i->wave[0][wa].offset;
 	g->osc[0].size	= i->wave[0][wa].size;
 	g->osc[0].pd	= doubleToFrac(midiKeyToFreq(note, (double)i->wave[0][wa].tune / 256.0) / (double)_sampleRate);
 	g->osc[0].p		= 0;
@@ -405,7 +405,7 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) {
 	g->osc[0].swap	= i->wave[0][wa].swap;
 	g->osc[0].chn	= i->wave[0][wa].chn;
 
-	g->osc[1].base	= i->wave[1][wb].base;
+	g->osc[1].base	= i->base + i->wave[1][wb].offset;
 	g->osc[1].size	= i->wave[1][wb].size;
 	g->osc[1].pd	= doubleToFrac(midiKeyToFreq(note, (double)i->wave[1][wb].tune / 256.0) / (double)_sampleRate);
 	g->osc[1].p		= 0;
@@ -528,19 +528,19 @@ bool IIgsInstrumentHeader::read(Common::SeekableReadStream &stream, bool ignoreA
 	for (int i = 0; i < 2; i++)
 	for (int k = 0; k < waveCount[i]; k++) {
 		wave[i][k].key = stream.readByte();
-		wave[i][k].base = (int8*)(stream.readByte() << 8);
+		wave[i][k].offset = stream.readByte() << 8;
 		wave[i][k].size = 0x100 << (stream.readByte() & 7);
 		uint8 b = stream.readByte();
 		wave[i][k].tune = stream.readUint16LE();
 
 		// For sample resources we ignore the address.
 		if (ignoreAddr)
-			wave[i][k].base = 0;
+			wave[i][k].offset = 0;
 
 		// Check for samples that extend out of the wavetable.
-		if ((int)wave[i][k].base + wave[i][k].size >= SIERRASTANDARD_SIZE) {
+		if (wave[i][k].offset + wave[i][k].size >= SIERRASTANDARD_SIZE) {
 			warning("Invalid data detected in the instrument set of Apple IIGS AGI. Continuing anyway...");
-			wave[i][k].size = SIERRASTANDARD_SIZE - (int)wave[i][k].base;
+			wave[i][k].size = SIERRASTANDARD_SIZE - wave[i][k].offset;
 		}
 
 		// Parse the generator mode byte to separate fields.
@@ -558,9 +558,8 @@ bool IIgsInstrumentHeader::finalize(int8 *wavetable) {
 	// in case the sample ends prematurely.
 	for (int i = 0; i < 2; i++)
 	for (int k = 0; k < waveCount[i]; k++) {
-		wave[i][k].base += (uint)wavetable;
-
-		int8 *p = wave[i][k].base;
+		base = wavetable;
+		int8 *p = base + wave[i][k].offset;
 		uint trueSize;
 		for (trueSize = 0; trueSize < wave[i][k].size; trueSize++)
 			if (p[trueSize] == -ZERO_OFFSET)
diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h
index 732d3cd..1a22530 100644
--- a/engines/agi/sound_2gs.h
+++ b/engines/agi/sound_2gs.h
@@ -80,7 +80,7 @@ struct IIgsInstrumentHeader {
 	uint8 waveCount[2];	///< Wave count for both generators
 	struct {
 		uint8 key;		///< Highest MIDI key to use this wave
-		int8* base;		///< Pointer to wave data
+		int offset;		///< Offset of wave data, relative to base
 		uint size;		///< Wave size
 		bool halt;		///< Oscillator halted?
 		bool loop;		///< Loop mode?
@@ -89,6 +89,8 @@ struct IIgsInstrumentHeader {
 		int16 tune;		///< Fine tune in semitones (8.8 fixed point)
 	} wave[2][MAX_OSCILLATOR_WAVES];
 
+	int8* base; ///< Base of wave data
+
 	/**
 	 * Read an Apple IIGS instrument header from the given stream.
 	 * @param stream The source stream from which to read the data.






More information about the Scummvm-git-logs mailing list