[Scummvm-git-logs] scummvm master -> e0c7ee1a9c3feebb3a0ccb0de4f27026309951dc
csnover
csnover at users.noreply.github.com
Sat Dec 3 19:22:52 CET 2016
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
68023904a4 SCI32: Fix LSL6hires text speed slider
bf293fface SCI: Fix non-responsive application warning during sysex transfers
d03508e8ce SCI: Fix buffer overflow in AmigaMac sound driver
3e7f08834d SCI: Clean up some comments
472a43695a SCI: Remove unnecessary indirection in Resource::loadPatch
9e1bf888b8 SCI: Deduplicate text-reading code in kGetFarText
273695a11e SCI: Remove use of snprintf
12b2bc408f SCI: Remove unnecessary lock in SegManager
770bd66cbc SCI: Update engine status comment
1337e82b0b SCI: Fix invalid read of LB2 audio map 448
e0c7ee1a9c SCI: Remove unnecessary duplicate shadowing variable
Commit: 68023904a4c4138cdd87e8f86ebddb19be802309
https://github.com/scummvm/scummvm/commit/68023904a4c4138cdd87e8f86ebddb19be802309
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:00:58-06:00
Commit Message:
SCI32: Fix LSL6hires text speed slider
For whatever reason, this game uses a different global for
specifying the text speed.
Changed paths:
engines/sci/engine/vm.cpp
engines/sci/engine/vm.h
engines/sci/sci.cpp
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 01051eb..92228fd 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -199,6 +199,23 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
s->variables[type][index] = value;
+#ifdef ENABLE_SCI32
+ if (type == VAR_GLOBAL && getSciVersion() >= SCI_VERSION_2 && g_sci->getEngineState()->_syncedAudioOptions) {
+
+ switch (g_sci->getGameId()) {
+ case GID_LSL6HIRES:
+ if (index == kGlobalVarLSL6HiresTextSpeed) {
+ ConfMan.setInt("talkspeed", (14 - value.toSint16()) * 255 / 13);
+ }
+ break;
+ default:
+ if (index == kGlobalVarTextSpeed) {
+ ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8);
+ }
+ }
+ }
+#endif
+
if (type == VAR_GLOBAL && index == kGlobalVarMessageType) {
// The game is trying to change its speech/subtitle settings
if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][kGlobalVarQuit] == TRUE_REG) {
@@ -212,12 +229,6 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
g_sci->updateScummVMAudioOptions();
}
}
-
-#ifdef ENABLE_SCI32
- if (type == VAR_GLOBAL && index == kGlobalVarTextSpeed && getSciVersion() >= SCI_VERSION_2) {
- ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8);
- }
-#endif
}
}
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index cec9e15..13f60fd 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -150,6 +150,7 @@ enum GlobalVar {
kGlobalVarFastCast = 84, // SCI16
kGlobalVarMessageType = 90,
kGlobalVarTextSpeed = 94, // SCI32; 0 is fastest, 8 is slowest
+ kGlobalVarLSL6HiresTextSpeed = 167, // 1 is fastest, 14 is slowest
kGlobalVarShivers1Score = 349
};
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index e89d052..1e3ab2a 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -1123,7 +1123,20 @@ void SciEngine::syncIngameAudioOptions() {
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- _gamestate->variables[VAR_GLOBAL][kGlobalVarTextSpeed] = make_reg(0, 8 - ConfMan.getInt("talkspeed") * 8 / 255);
+ GlobalVar index;
+ uint16 textSpeed;
+
+ switch (g_sci->getGameId()) {
+ case GID_LSL6HIRES:
+ index = kGlobalVarLSL6HiresTextSpeed;
+ textSpeed = 14 - ConfMan.getInt("talkspeed") * 14 / 255 + 1;
+ break;
+ default:
+ index = kGlobalVarTextSpeed;
+ textSpeed = 8 - ConfMan.getInt("talkspeed") * 8 / 255;
+ }
+
+ _gamestate->variables[VAR_GLOBAL][index] = make_reg(0, textSpeed);
}
#endif
Commit: bf293fface3d2eaf62466dca675c65118f347248
https://github.com/scummvm/scummvm/commit/bf293fface3d2eaf62466dca675c65118f347248
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:54-06:00
Commit Message:
SCI: Fix non-responsive application warning during sysex transfers
This also fixes the display of the startup LCD message, which had
been delayed until after the sysex transfer was finished.
Changed paths:
engines/sci/sci.cpp
engines/sci/sound/drivers/midi.cpp
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 1e3ab2a..d725e36 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -317,10 +317,6 @@ Common::Error SciEngine::run() {
// Must be called after game_init(), as they use _features
_kernel->loadKernelNames(_features);
- _soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType());
-
- syncSoundSettings();
- syncIngameAudioOptions();
// Load our Mac executable here for icon bar palettes and high-res fonts
loadMacExecutable();
@@ -328,6 +324,15 @@ Common::Error SciEngine::run() {
// Initialize all graphics related subsystems
initGraphics();
+ // Sound must be initialized after graphics because SysEx transfers at the
+ // start of the game must pump the event loop to avoid making the OS think
+ // that ScummVM is hanged, and pumping the event loop requires GfxCursor to
+ // be initialized
+ _soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType());
+
+ syncSoundSettings();
+ syncIngameAudioOptions();
+
// Patch in our save/restore code, so that dialogs are replaced
patchGameSaveRestore();
setLauncherLanguage();
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 5e82e4a..badbe66 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -1053,7 +1053,7 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) {
void MidiPlayer_Midi::close() {
if (_isMt32) {
// Send goodbye message
- sendMt32SysEx(0x200000, _goodbyeMsg, 20);
+ sendMt32SysEx(0x200000, _goodbyeMsg, 20, true);
}
_driver->close();
@@ -1069,8 +1069,8 @@ void MidiPlayer_Midi::sysEx(const byte *msg, uint16 length) {
if (_isMt32)
delay += 40;
- g_system->delayMillis(delay);
g_system->updateScreen();
+ g_sci->sleep(delay);
}
byte MidiPlayer_Midi::getPlayId() const {
Commit: d03508e8ce7eebc2b122e62f35acd4d6033c4b36
https://github.com/scummvm/scummvm/commit/d03508e8ce7eebc2b122e62f35acd4d6033c4b36
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Fix buffer overflow in AmigaMac sound driver
Changed paths:
engines/sci/sound/drivers/amigamac.cpp
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index 031fd321..f5daab7 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -144,7 +144,7 @@ private:
void setEnvelope(Voice *channel, Envelope *envelope, int phase);
void setOutputFrac(int voice);
- int interpolate(int8 *samples, frac_t offset, bool isUnsigned);
+ int interpolate(int8 *samples, frac_t offset, uint32 maxOffset, bool isUnsigned);
void playInstrument(int16 *dest, Voice *channel, int count);
void changeInstrument(int channel, int instrument);
void stopChannel(int ch);
@@ -169,17 +169,18 @@ void MidiDriver_AmigaMac::setEnvelope(Voice *channel, Envelope *envelope, int ph
channel->velocity = envelope[phase - 1].target;
}
-int MidiDriver_AmigaMac::interpolate(int8 *samples, frac_t offset, bool isUnsigned) {
- int x = fracToInt(offset);
+int MidiDriver_AmigaMac::interpolate(int8 *samples, frac_t offset, uint32 maxOffset, bool isUnsigned) {
+ uint x = fracToInt(offset);
+ uint x2 = x == maxOffset ? 0 : x + 1;
if (isUnsigned) {
int s1 = (byte)samples[x] - 0x80;
- int s2 = (byte)samples[x + 1] - 0x80;
+ int s2 = (byte)samples[x2] - 0x80;
int diff = (s2 - s1) << 8;
return (s1 << 8) + fracToInt(diff * (offset & FRAC_LO_MASK));
}
- int diff = (samples[x + 1] - samples[x]) << 8;
+ int diff = (samples[x2] - samples[x]) << 8;
return (samples[x] << 8) + fracToInt(diff * (offset & FRAC_LO_MASK));
}
@@ -220,7 +221,7 @@ void MidiDriver_AmigaMac::playInstrument(int16 *dest, Voice *channel, int count)
amount = channel->envelope_samples;
for (i = 0; i < amount; i++) {
- dest[index++] = interpolate(samples, channel->offset, instrument->isUnsigned) * channel->velocity / 64 * channel->note_velocity * vol / (127 * 127);
+ dest[index++] = interpolate(samples, channel->offset, seg_end, instrument->isUnsigned) * channel->velocity / 64 * channel->note_velocity * vol / (127 * 127);
channel->offset += channel->rate;
}
Commit: 3e7f08834dd01b43fb73ad62f6b7ea6c16b03d47
https://github.com/scummvm/scummvm/commit/3e7f08834dd01b43fb73ad62f6b7ea6c16b03d47
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Clean up some comments
Changed paths:
engines/sci/engine/object.h
diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h
index a7be170..74a908a 100644
--- a/engines/sci/engine/object.h
+++ b/engines/sci/engine/object.h
@@ -47,10 +47,10 @@ enum infoSelectorFlags {
* When set, indicates to game scripts that a screen
* item can be updated.
*/
- kInfoFlagViewVisible = 0x0008, // TODO: "dirty" ?
+ kInfoFlagViewVisible = 0x0008,
/**
- * When set, the object has an associated screen item in
+ * When set, the VM object has an associated ScreenItem in
* the rendering tree.
*/
kInfoFlagViewInserted = 0x0010,
Commit: 472a43695a5be556f4b11544b4dbf7ff70d894fb
https://github.com/scummvm/scummvm/commit/472a43695a5be556f4b11544b4dbf7ff70d894fb
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Remove unnecessary indirection in Resource::loadPatch
Changed paths:
engines/sci/resource.cpp
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 31ceb68..364ea2a 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -301,32 +301,30 @@ ResourceSource *ResourceManager::findVolume(ResourceSource *map, int volume_nr)
// Resource manager constructors and operations
bool Resource::loadPatch(Common::SeekableReadStream *file) {
- Resource *res = this;
-
- // We assume that the resource type matches res->type
+ // We assume that the resource type matches `type`
// We also assume that the current file position is right at the actual data (behind resourceid/headersize byte)
- res->data = new byte[res->size];
+ data = new byte[size];
- if (res->_headerSize > 0)
- res->_header = new byte[res->_headerSize];
+ if (_headerSize > 0)
+ _header = new byte[_headerSize];
- if ((res->data == NULL) || ((res->_headerSize > 0) && (res->_header == NULL))) {
- error("Can't allocate %d bytes needed for loading %s", res->size + res->_headerSize, res->_id.toString().c_str());
+ if (data == nullptr || (_headerSize > 0 && _header == nullptr)) {
+ error("Can't allocate %d bytes needed for loading %s", size + _headerSize, _id.toString().c_str());
}
uint32 really_read;
- if (res->_headerSize > 0) {
- really_read = file->read(res->_header, res->_headerSize);
- if (really_read != res->_headerSize)
- error("Read %d bytes from %s but expected %d", really_read, res->_id.toString().c_str(), res->_headerSize);
+ if (_headerSize > 0) {
+ really_read = file->read(_header, _headerSize);
+ if (really_read != _headerSize)
+ error("Read %d bytes from %s but expected %d", really_read, _id.toString().c_str(), _headerSize);
}
- really_read = file->read(res->data, res->size);
- if (really_read != res->size)
- error("Read %d bytes from %s but expected %d", really_read, res->_id.toString().c_str(), res->size);
+ really_read = file->read(data, size);
+ if (really_read != size)
+ error("Read %d bytes from %s but expected %d", really_read, _id.toString().c_str(), size);
- res->_status = kResStatusAllocated;
+ _status = kResStatusAllocated;
return true;
}
Commit: 9e1bf888b8b3095a844c636e78b0bf35708878a9
https://github.com/scummvm/scummvm/commit/9e1bf888b8b3095a844c636e78b0bf35708878a9
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Deduplicate text-reading code in kGetFarText
Changed paths:
engines/sci/engine/kstring.cpp
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 74c1f99..ab1f021 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -438,31 +438,15 @@ reg_t kStrLen(EngineState *s, int argc, reg_t *argv) {
reg_t kGetFarText(EngineState *s, int argc, reg_t *argv) {
- Resource *textres = g_sci->getResMan()->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0);
- char *seeker;
- int counter = argv[1].toUint16();
-
- if (!textres) {
- error("text.%d does not exist", argv[0].toUint16());
- return NULL_REG;
- }
-
- seeker = (char *)textres->data;
-
- // The second parameter (counter) determines the number of the string
- // inside the text resource.
- while (counter--) {
- while (*seeker++)
- ;
- }
+ const Common::String text = g_sci->getKernel()->lookupText(make_reg(0, argv[0].toUint16()), argv[1].toUint16());
// If the third argument is NULL, allocate memory for the destination. This
// occurs in SCI1 Mac games. The memory will later be freed by the game's
// scripts.
if (argv[2] == NULL_REG)
- s->_segMan->allocDynmem(strlen(seeker) + 1, "Mac FarText", &argv[2]);
+ s->_segMan->allocDynmem(text.size() + 1, "Mac FarText", &argv[2]);
- s->_segMan->strcpy(argv[2], seeker); // Copy the string and get return value
+ s->_segMan->strcpy(argv[2], text.c_str()); // Copy the string and get return value
return argv[2];
}
Commit: 273695a11ec03d9dbd5916b89966fe55936d8394
https://github.com/scummvm/scummvm/commit/273695a11ec03d9dbd5916b89966fe55936d8394
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Remove use of snprintf
Changed paths:
engines/sci/resource.h
engines/sci/resource_audio.cpp
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 928d571..e601a1c 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -174,14 +174,10 @@ public:
}
Common::String toString() const {
- char buf[32];
-
- snprintf(buf, 32, "%s.%d", getResourceTypeName(_type), _number);
- Common::String retStr = buf;
+ Common::String retStr = Common::String::format("%s.%d", getResourceTypeName(_type), _number);
if (_tuple != 0) {
- snprintf(buf, 32, "(%d, %d, %d, %d)", _tuple >> 24, (_tuple >> 16) & 0xff, (_tuple >> 8) & 0xff, _tuple & 0xff);
- retStr += buf;
+ retStr += Common::String::format("(%d, %d, %d, %d)", _tuple >> 24, (_tuple >> 16) & 0xff, (_tuple >> 8) & 0xff, _tuple & 0xff);
}
return retStr;
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 4b3a13c..72096ff 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -511,10 +511,8 @@ void ResourceManager::setAudioLanguage(int language) {
_audioMapSCI1 = NULL;
}
- char filename[9];
- snprintf(filename, 9, "AUDIO%03d", language);
-
- Common::String fullname = Common::String(filename) + ".MAP";
+ Common::String filename = Common::String::format("AUDIO%03d", language);
+ Common::String fullname = filename + ".MAP";
if (!Common::File::exists(fullname)) {
warning("No audio map found for language %i", language);
return;
@@ -524,7 +522,7 @@ void ResourceManager::setAudioLanguage(int language) {
// Search for audio volumes for this language and add them to the source list
Common::ArchiveMemberList files;
- SearchMan.listMatchingMembers(files, Common::String(filename) + ".0??");
+ SearchMan.listMatchingMembers(files, filename + ".0??");
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
const Common::String name = (*x)->getName();
const char *dot = strrchr(name.c_str(), '.');
Commit: 12b2bc408f3b482132c4d6bf713ebc674c22f183
https://github.com/scummvm/scummvm/commit/12b2bc408f3b482132c4d6bf713ebc674c22f183
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:55-06:00
Commit Message:
SCI: Remove unnecessary lock in SegManager
Changed paths:
engines/sci/engine/seg_manager.cpp
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 83e7495..35a655f 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -962,7 +962,7 @@ void SegManager::freeBitmap(const reg_t addr) {
#endif
void SegManager::createClassTable() {
- Resource *vocab996 = _resMan->findResource(ResourceId(kResourceTypeVocab, 996), 1);
+ Resource *vocab996 = _resMan->findResource(ResourceId(kResourceTypeVocab, 996), false);
if (!vocab996)
error("SegManager: failed to open vocab 996");
@@ -976,8 +976,6 @@ void SegManager::createClassTable() {
_classTable[classNr].reg = NULL_REG;
_classTable[classNr].script = scriptNr;
}
-
- _resMan->unlockResource(vocab996);
}
reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, uint16 callerSegment) {
Commit: 770bd66cbc71e0702418ba40d94402a1572f3290
https://github.com/scummvm/scummvm/commit/770bd66cbc71e0702418ba40d94402a1572f3290
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:56-06:00
Commit Message:
SCI: Update engine status comment
Changed paths:
engines/sci/sci.h
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 7d24890..a36ae00 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -35,7 +35,7 @@ struct ADGameDescription;
/**
* This is the namespace of the SCI engine.
*
- * Status of this engine: ???
+ * Status of this engine: Awesome
*
* Games using this engine:
* - Newer Sierra adventure games (based on FreeSCI)
Commit: 1337e82b0bdaa76a7c78554cd8316e0aa9628dac
https://github.com/scummvm/scummvm/commit/1337e82b0bdaa76a7c78554cd8316e0aa9628dac
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:56-06:00
Commit Message:
SCI: Fix invalid read of LB2 audio map 448
Changed paths:
engines/sci/resource_audio.cpp
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 72096ff..7757445 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -405,7 +405,9 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
addResource(ResourceId(kResourceTypeSync36, map->_mapNumber, n & 0xffffff3f), src, offset, syncSize);
}
- if (n & 0x40) {
+ // Checking for this 0x40 flag breaks at least Laura Bow 2 CD 1.1
+ // map 448
+ if (g_sci->getGameId() == GID_KQ6 && (n & 0x40)) {
// This seems to define the size of raw lipsync data (at least
// in KQ6 CD Windows).
int kq6HiresSyncSize = READ_LE_UINT16(ptr);
Commit: e0c7ee1a9c3feebb3a0ccb0de4f27026309951dc
https://github.com/scummvm/scummvm/commit/e0c7ee1a9c3feebb3a0ccb0de4f27026309951dc
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-03T12:21:56-06:00
Commit Message:
SCI: Remove unnecessary duplicate shadowing variable
Changed paths:
engines/sci/engine/vm.cpp
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 92228fd..8e407a6 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1207,7 +1207,6 @@ void run_vm(EngineState *s) {
case op_lofsa: // 0x39 (57)
case op_lofss: { // 0x3a (58)
// Load offset to accumulator or push to stack
- Script *local_script = s->_segMan->getScriptIfLoaded(s->xs->local_segment);
r_temp.setSegment(s->xs->addr.pc.getSegment());
r_temp.setOffset(findOffset(opparams[0], local_script, s->xs->addr.pc.getOffset()));
More information about the Scummvm-git-logs
mailing list