aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMax Horn2011-03-31 13:35:43 +0200
committerMax Horn2011-04-04 09:53:26 +0200
commitb188e60f4415e7a2d7dc08ce5471edc818e94076 (patch)
tree47e3fe821358a123a55ad9160f330d90b833c910 /engines/agi
parentc4ae3b90db9fe28130c00e9736fdc388088e7a35 (diff)
downloadscummvm-rg350-b188e60f4415e7a2d7dc08ce5471edc818e94076.tar.gz
scummvm-rg350-b188e60f4415e7a2d7dc08ce5471edc818e94076.tar.bz2
scummvm-rg350-b188e60f4415e7a2d7dc08ce5471edc818e94076.zip
AGI: Avoid global constructors (due to global refs)
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/sound_2gs.cpp52
-rw-r--r--engines/agi/sound_2gs.h4
2 files changed, 28 insertions, 28 deletions
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index 4ed4fb7bab..11bf5a9034 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -766,7 +766,7 @@ bool SoundGen2GS::loadInstruments() {
// load the instrument headers and their sample data.
// None of the tested SIERRASTANDARD-files have zeroes in them so
// there's no need to check for prematurely ending samples here.
- setProgramChangeMapping(&exeInfo->instSet.progToInst);
+ setProgramChangeMapping(exeInfo->instSet->progToInst);
return loadWaveFile(*waveFsnode, *exeInfo) && loadInstrumentHeaders(*exeFsnode, *exeInfo);
}
@@ -792,29 +792,29 @@ static const MidiProgramChangeMapping progToInstMappingV2 = {
/** Older Apple IIGS AGI instrument set. Used only by Space Quest I (AGI v1.002). */
static const InstrumentSetInfo instSetV1 = {
- 1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18", progToInstMappingV1
+ 1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18", &progToInstMappingV1
};
/** Newer Apple IIGS AGI instrument set (AGI v1.003+). Used by all others than Space Quest I. */
static const InstrumentSetInfo instSetV2 = {
- 1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07", progToInstMappingV2
+ 1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07", &progToInstMappingV2
};
/** Information about different Apple IIGS AGI executables. */
static const IIgsExeInfo IIgsExeInfos[] = {
- {GID_SQ1, "SQ", 0x1002, 138496, 0x80AD, instSetV1},
- {GID_LSL1, "LL", 0x1003, 141003, 0x844E, instSetV2},
- {GID_AGIDEMO, "DEMO", 0x1005, 141884, 0x8469, instSetV2},
- {GID_KQ1, "KQ", 0x1006, 141894, 0x8469, instSetV2},
- {GID_PQ1, "PQ", 0x1007, 141882, 0x8469, instSetV2},
- {GID_MIXEDUP, "MG", 0x1013, 142552, 0x84B7, instSetV2},
- {GID_KQ2, "KQ2", 0x1013, 143775, 0x84B7, instSetV2},
- {GID_KQ3, "KQ3", 0x1014, 144312, 0x84B7, instSetV2},
- {GID_SQ2, "SQ2", 0x1014, 107882, 0x6563, instSetV2},
- {GID_MH1, "MH", 0x2004, 147678, 0x8979, instSetV2},
- {GID_KQ4, "KQ4", 0x2006, 147652, 0x8979, instSetV2},
- {GID_BC, "BC", 0x3001, 148192, 0x8979, instSetV2},
- {GID_GOLDRUSH, "GR", 0x3003, 148268, 0x8979, instSetV2}
+ {GID_SQ1, "SQ", 0x1002, 138496, 0x80AD, &instSetV1},
+ {GID_LSL1, "LL", 0x1003, 141003, 0x844E, &instSetV2},
+ {GID_AGIDEMO, "DEMO", 0x1005, 141884, 0x8469, &instSetV2},
+ {GID_KQ1, "KQ", 0x1006, 141894, 0x8469, &instSetV2},
+ {GID_PQ1, "PQ", 0x1007, 141882, 0x8469, &instSetV2},
+ {GID_MIXEDUP, "MG", 0x1013, 142552, 0x84B7, &instSetV2},
+ {GID_KQ2, "KQ2", 0x1013, 143775, 0x84B7, &instSetV2},
+ {GID_KQ3, "KQ3", 0x1014, 144312, 0x84B7, &instSetV2},
+ {GID_SQ2, "SQ2", 0x1014, 107882, 0x6563, &instSetV2},
+ {GID_MH1, "MH", 0x2004, 147678, 0x8979, &instSetV2},
+ {GID_KQ4, "KQ4", 0x2006, 147652, 0x8979, &instSetV2},
+ {GID_BC, "BC", 0x3001, 148192, 0x8979, &instSetV2},
+ {GID_GOLDRUSH, "GR", 0x3003, 148268, 0x8979, &instSetV2}
};
/**
@@ -844,20 +844,20 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg
file.close();
// Check that we got enough data to be able to parse the instruments
- if (data && data->size() >= (int32)(exeInfo.instSetStart + exeInfo.instSet.byteCount)) {
+ if (data && data->size() >= (int32)(exeInfo.instSetStart + exeInfo.instSet->byteCount)) {
// Check instrument set's length (The info's saved in the executable)
data->seek(exeInfo.instSetStart - 4);
uint16 instSetByteCount = data->readUint16LE();
- if (instSetByteCount != exeInfo.instSet.byteCount) {
+ if (instSetByteCount != exeInfo.instSet->byteCount) {
debugC(3, kDebugLevelSound, "Wrong instrument set size (Is %d, should be %d) in Apple IIGS executable (%s)",
- instSetByteCount, exeInfo.instSet.byteCount, exePath.getPath().c_str());
+ instSetByteCount, exeInfo.instSet->byteCount, exePath.getPath().c_str());
}
// Check instrument set's md5sum
data->seek(exeInfo.instSetStart);
- Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet.byteCount);
- if (md5str != exeInfo.instSet.md5) {
+ Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet->byteCount);
+ if (md5str != exeInfo.instSet->md5) {
warning("Unknown Apple IIGS instrument set (md5: %s) in %s, trying to use it nonetheless",
md5str.c_str(), exePath.getPath().c_str());
}
@@ -867,20 +867,20 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg
// Load the instruments
_instruments.clear();
- _instruments.reserve(exeInfo.instSet.instCount);
+ _instruments.reserve(exeInfo.instSet->instCount);
IIgsInstrumentHeader instrument;
- for (uint i = 0; i < exeInfo.instSet.instCount; i++) {
+ for (uint i = 0; i < exeInfo.instSet->instCount; i++) {
if (!instrument.read(*data)) {
warning("Error loading Apple IIGS instrument (%d. of %d) from %s, not loading more instruments",
- i + 1, exeInfo.instSet.instCount, exePath.getPath().c_str());
+ i + 1, exeInfo.instSet->instCount, exePath.getPath().c_str());
break;
}
_instruments.push_back(instrument); // Add the successfully loaded instrument to the instruments array
}
// Loading was successful only if all instruments were loaded successfully
- loadedOk = (_instruments.size() == exeInfo.instSet.instCount);
+ loadedOk = (_instruments.size() == exeInfo.instSet->instCount);
} else // Couldn't read enough data from the executable file
warning("Error loading instruments from Apple IIGS executable (%s)", exePath.getPath().c_str());
@@ -899,7 +899,7 @@ bool SoundGen2GS::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo
if (uint8Wave && uint8Wave->size() == SIERRASTANDARD_SIZE) {
// Check wave file's md5sum
Common::String md5str = Common::computeStreamMD5AsString(*uint8Wave, SIERRASTANDARD_SIZE);
- if (md5str != exeInfo.instSet.waveFileMd5) {
+ if (md5str != exeInfo.instSet->waveFileMd5) {
warning("Unknown Apple IIGS wave file (md5: %s, game: %s).\n" \
"Please report the information on the previous line to the ScummVM team.\n" \
"Using the wave file as it is - music may sound weird", md5str.c_str(), exeInfo.exePrefix);
diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h
index 391646d6ce..76f0642b7b 100644
--- a/engines/agi/sound_2gs.h
+++ b/engines/agi/sound_2gs.h
@@ -238,7 +238,7 @@ struct InstrumentSetInfo {
uint instCount; ///< Amount of instrument in the set
const char *md5; ///< MD5 hex digest of the whole instrument set
const char *waveFileMd5; ///< MD5 hex digest of the wave file (i.e. the sample data used by the instruments)
- const MidiProgramChangeMapping &progToInst; ///< Program change to instrument number mapping
+ const MidiProgramChangeMapping *progToInst; ///< Program change to instrument number mapping
};
/** Apple IIGS AGI executable file information. */
@@ -248,7 +248,7 @@ struct IIgsExeInfo {
uint agiVer; ///< Apple IIGS AGI version number, not strictly needed
uint exeSize; ///< Size of the Apple IIGS AGI executable file in bytes
uint instSetStart; ///< Starting offset of the instrument set inside the executable file
- const InstrumentSetInfo &instSet; ///< Information about the used instrument set
+ const InstrumentSetInfo *instSet; ///< Information about the used instrument set
};
class IIgsMidiChannel {