aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-27 21:18:45 +0100
committerMartin Kiewitz2016-01-27 21:18:45 +0100
commit2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a (patch)
tree6009c7b75bd5e3b952a95a4bad80be83239efc66 /engines
parenta85350aa3fc12e330e556668006def114c625978 (diff)
downloadscummvm-rg350-2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a.tar.gz
scummvm-rg350-2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a.tar.bz2
scummvm-rg350-2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a.zip
AGI: Apple IIgs: remove warning about bad sample size
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/sound_2gs.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index 6495d221d0..176ac5612f 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -577,17 +577,16 @@ bool IIgsInstrumentHeader::finalize(int8 *wavetable, uint32 wavetableSize) {
}
if ((waveOffset + waveSize) > wavetableSize) {
- // size seems to be incorrect
- // actually happens for at least Manhunter 1, when looking at corpse at the start
- warning("Apple IIgs sound: sample exceeds size of wavetable. sample got cut");
+ // fix up size, it's actually saved in a way in the header, that it can't be correct
+ // if we don't fix it here, we would do invalid memory access, which results in potential crashes
wave[i][k].size = wavetableSize - waveOffset;
}
- // Detect true sample size in case the sample ends prematurely.
- int8 *p = wavetableBase + wave[i][k].offset;
+ // Detect true sample size
+ int8 *sample = wavetableBase + wave[i][k].offset;
uint32 trueSize;
for (trueSize = 0; trueSize < wave[i][k].size; trueSize++) {
- if (p[trueSize] == -ZERO_OFFSET)
+ if (sample[trueSize] == -ZERO_OFFSET)
break;
}
wave[i][k].size = trueSize;