diff options
Diffstat (limited to 'engines/sci/engine')
26 files changed, 490 insertions, 239 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index 315c86c56c..f99d412c64 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -216,9 +216,9 @@ SciVersion GameFeatures::detectSetCursorType() { return _setCursorType; } -bool GameFeatures::autoDetectLofsType(int methodNum) { +bool GameFeatures::autoDetectLofsType(Common::String gameSuperClassName, int methodNum) { // Look up the script address - reg_t addr = getDetectionAddr("Game", -1, methodNum); + reg_t addr = getDetectionAddr(gameSuperClassName.c_str(), -1, methodNum); if (!addr.segment) return false; @@ -275,20 +275,35 @@ SciVersion GameFeatures::detectLofsType() { return _lofsType; } + // Find the "Game" object, super class of the actual game-object + const reg_t game = g_sci->getGameObject(); + const Object *gameObject = _segMan->getObject(game); + reg_t gameSuperClass = NULL_REG; + if (gameObject) { + gameSuperClass = gameObject->getSuperClassSelector(); + } + // Find a function of the game object which invokes lofsa/lofss - reg_t gameClass = _segMan->findObjectByName("Game"); - const Object *obj = _segMan->getObject(gameClass); bool found = false; + if (!gameSuperClass.isNull()) { + Common::String gameSuperClassName = _segMan->getObjectName(gameSuperClass); + const Object *gameSuperObject = _segMan->getObject(gameSuperClass); - for (uint m = 0; m < obj->getMethodCount(); m++) { - found = autoDetectLofsType(m); - - if (found) - break; + if (gameSuperObject) { + for (uint m = 0; m < gameSuperObject->getMethodCount(); m++) { + found = autoDetectLofsType(gameSuperClassName, m); + if (found) + break; + } + } else { + warning("detectLofsType(): Could not get superclass object"); + } + } else { + warning("detectLofsType(): Could not find superclass of game object"); } if (!found) { - warning("Lofs detection failed, taking an educated guess"); + warning("detectLofsType(): failed, taking an educated guess"); if (getSciVersion() >= SCI_VERSION_1_MIDDLE) _lofsType = SCI_VERSION_1_MIDDLE; @@ -423,6 +438,8 @@ SciVersion GameFeatures::detectMessageFunctionType() { Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1); if (resources->empty()) { + delete resources; + // No messages found, so this doesn't really matter anyway... _messageFunctionType = SCI_VERSION_1_1; return _messageFunctionType; @@ -430,6 +447,7 @@ SciVersion GameFeatures::detectMessageFunctionType() { Resource *res = g_sci->getResMan()->findResource(*resources->begin(), false); assert(res); + delete resources; // Only v2 Message resources use the kGetMessage kernel function. // v3-v5 use the kMessage kernel function. diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h index 167c207437..755054fb25 100644 --- a/engines/sci/engine/features.h +++ b/engines/sci/engine/features.h @@ -103,7 +103,7 @@ public: private: reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1); - bool autoDetectLofsType(int methodNum); + bool autoDetectLofsType(Common::String gameSuperClassName, int methodNum); bool autoDetectGfxFunctionsType(int methodNum = -1); bool autoDetectSoundType(); bool autoDetectMoveCountType(); diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index d76199c794..157884fac3 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -43,8 +43,17 @@ Kernel::Kernel(ResourceManager *resMan, SegManager *segMan) } Kernel::~Kernel() { - for (KernelFunctionArray::iterator i = _kernelFuncs.begin(); i != _kernelFuncs.end(); ++i) - delete[] i->signature; + for (KernelFunctionArray::iterator it = _kernelFuncs.begin(); it != _kernelFuncs.end(); ++it) { + if (it->subFunctionCount) { + uint16 subFunctionNr = 0; + while (subFunctionNr < it->subFunctionCount) { + delete[] it->subFunctions[subFunctionNr].signature; + subFunctionNr++; + } + delete[] it->subFunctions; + } + delete[] it->signature; + } } uint Kernel::getSelectorNamesSize() const { @@ -56,12 +65,14 @@ const Common::String &Kernel::getSelectorName(uint selector) { // This should only occur in games w/o a selector-table // We need this for proper workaround tables // TODO: maybe check, if there is a fixed selector-table and error() out in that case - for (uint loopSelector = _selectorNames.size(); loopSelector <= selector; loopSelector++) { - Common::String newSelectorName; - newSelectorName = newSelectorName.printf("<noname %d>", loopSelector); - _selectorNames.push_back(newSelectorName); - } + for (uint loopSelector = _selectorNames.size(); loopSelector <= selector; ++loopSelector) + _selectorNames.push_back(Common::String::printf("<noname%d>", loopSelector)); } + + // Ensure that the selector has a name + if (_selectorNames[selector].empty()) + _selectorNames[selector] = Common::String::printf("<noname%d>", selector); + return _selectorNames[selector]; } @@ -650,7 +661,7 @@ void Kernel::mapFunctions() { return; } -bool Kernel::debugSetFunctionLogging(const char *kernelName, bool logging) { +bool Kernel::debugSetFunction(const char *kernelName, int logging, int breakpoint) { if (strcmp(kernelName, "*")) { for (uint id = 0; id < _kernelFuncs.size(); id++) { if (_kernelFuncs[id].name) { @@ -660,14 +671,21 @@ bool Kernel::debugSetFunctionLogging(const char *kernelName, bool logging) { KernelSubFunction *kernelSubCall = _kernelFuncs[id].subFunctions; uint kernelSubCallCount = _kernelFuncs[id].subFunctionCount; for (uint subId = 0; subId < kernelSubCallCount; subId++) { - if (kernelSubCall->function) - kernelSubCall->debugLogging = logging; + if (kernelSubCall->function) { + if (logging != -1) + kernelSubCall->debugLogging = logging == 1 ? true : false; + if (breakpoint != -1) + kernelSubCall->debugBreakpoint = breakpoint == 1 ? true : false; + } kernelSubCall++; } return true; } // function name matched, set for this one and exit - _kernelFuncs[id].debugLogging = logging; + if (logging != -1) + _kernelFuncs[id].debugLogging = logging == 1 ? true : false; + if (breakpoint != -1) + _kernelFuncs[id].debugBreakpoint = breakpoint == 1 ? true : false; return true; } else { // main name was not matched @@ -679,7 +697,10 @@ bool Kernel::debugSetFunctionLogging(const char *kernelName, bool logging) { if (kernelSubCall->function) { if (strcmp(kernelName, kernelSubCall->name) == 0) { // sub-function name matched, set for this one and exit - kernelSubCall->debugLogging = logging; + if (logging != -1) + kernelSubCall->debugLogging = logging == 1 ? true : false; + if (breakpoint != -1) + kernelSubCall->debugBreakpoint = breakpoint == 1 ? true : false; return true; } } @@ -696,14 +717,21 @@ bool Kernel::debugSetFunctionLogging(const char *kernelName, bool logging) { if (_kernelFuncs[id].name) { if (!_kernelFuncs[id].subFunctions) { // No sub-functions, enable actual kernel function - _kernelFuncs[id].debugLogging = logging; + if (logging != -1) + _kernelFuncs[id].debugLogging = logging == 1 ? true : false; + if (breakpoint != -1) + _kernelFuncs[id].debugBreakpoint = breakpoint == 1 ? true : false; } else { // Sub-Functions available, enable those too KernelSubFunction *kernelSubCall = _kernelFuncs[id].subFunctions; uint kernelSubCallCount = _kernelFuncs[id].subFunctionCount; for (uint subId = 0; subId < kernelSubCallCount; subId++) { - if (kernelSubCall->function) - kernelSubCall->debugLogging = logging; + if (kernelSubCall->function) { + if (logging != -1) + kernelSubCall->debugLogging = logging == 1 ? true : false; + if (breakpoint != -1) + kernelSubCall->debugBreakpoint = breakpoint == 1 ? true : false; + } kernelSubCall++; } } diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 285e746349..b6247b46f1 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -127,6 +127,7 @@ struct KernelSubFunction { uint16 *signature; const SciWorkaroundEntry *workarounds; bool debugLogging; + bool debugBreakpoint; }; struct KernelFunction { @@ -137,6 +138,7 @@ struct KernelFunction { KernelSubFunction *subFunctions; uint16 subFunctionCount; bool debugLogging; + bool debugBreakpoint; }; class Kernel { @@ -218,9 +220,9 @@ public: void loadKernelNames(GameFeatures *features); /** - * Sets debugCalls flag for a kernel function + * Sets debug flags for a kernel function */ - bool debugSetFunctionLogging(const char *kernelName, bool debugCalls); + bool debugSetFunction(const char *kernelName, int logging, int breakpoint); private: /** @@ -467,7 +469,7 @@ reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundPlay(EngineState *s, int argc, reg_t *argv); -reg_t kDoSoundDummy(EngineState *s, int argc, reg_t *argv); +reg_t kDoSoundRestore(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundDispose(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundMute(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundStop(EngineState *s, int argc, reg_t *argv); @@ -482,6 +484,7 @@ reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundReverb(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv); +reg_t kDoSoundDummy(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundSuspend(EngineState *s, int argc, reg_t *argv); reg_t kDoSoundSetVolume(EngineState *s, int argc, reg_t *argv); diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 886e918fd8..b2b8eb593e 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -86,7 +86,7 @@ struct SciKernelMapSubEntry { static const SciKernelMapSubEntry kDoSound_subops[] = { { SIG_SOUNDSCI0, 0, MAP_CALL(DoSoundInit), "o", NULL }, { SIG_SOUNDSCI0, 1, MAP_CALL(DoSoundPlay), "o", NULL }, - { SIG_SOUNDSCI0, 2, MAP_CALL(DoSoundDummy), "(o)", NULL }, + { SIG_SOUNDSCI0, 2, MAP_CALL(DoSoundRestore), "(o)", NULL }, { SIG_SOUNDSCI0, 3, MAP_CALL(DoSoundDispose), "o", NULL }, { SIG_SOUNDSCI0, 4, MAP_CALL(DoSoundMute), "(i)", NULL }, { SIG_SOUNDSCI0, 5, MAP_CALL(DoSoundStop), "o", NULL }, @@ -99,7 +99,7 @@ static const SciKernelMapSubEntry kDoSound_subops[] = { { SIG_SOUNDSCI0, 12, MAP_CALL(DoSoundStopAll), "", NULL }, { SIG_SOUNDSCI1EARLY, 0, MAP_CALL(DoSoundMasterVolume), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 1, MAP_CALL(DoSoundMute), NULL, NULL }, - { SIG_SOUNDSCI1EARLY, 2, MAP_CALL(DoSoundDummy), NULL, NULL }, + { SIG_SOUNDSCI1EARLY, 2, MAP_CALL(DoSoundRestore), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 3, MAP_CALL(DoSoundGetPolyphony), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 4, MAP_CALL(DoSoundUpdate), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 5, MAP_CALL(DoSoundInit), NULL, NULL }, @@ -111,7 +111,7 @@ static const SciKernelMapSubEntry kDoSound_subops[] = { // it actually does internally { SIG_SOUNDSCI1EARLY, 8, MAP_CALL(DoSoundStop), NULL, NULL }, { SIG_SOUNDSCI1EARLY, 9, MAP_CALL(DoSoundPause), "[o0]i", NULL }, - { SIG_SOUNDSCI1EARLY, 10, MAP_CALL(DoSoundFade), "oiiii", NULL }, + { SIG_SOUNDSCI1EARLY, 10, MAP_CALL(DoSoundFade), "oiiii", kDoSoundFade_workarounds }, { SIG_SOUNDSCI1EARLY, 11, MAP_CALL(DoSoundUpdateCues), "o", NULL }, { SIG_SOUNDSCI1EARLY, 12, MAP_CALL(DoSoundSendMidi), "oiii", NULL }, { SIG_SOUNDSCI1EARLY, 13, MAP_CALL(DoSoundReverb), "i", NULL }, @@ -120,7 +120,7 @@ static const SciKernelMapSubEntry kDoSound_subops[] = { // ^^ Longbow demo { SIG_SOUNDSCI1LATE, 0, MAP_CALL(DoSoundMasterVolume), NULL, NULL }, { SIG_SOUNDSCI1LATE, 1, MAP_CALL(DoSoundMute), NULL, NULL }, - { SIG_SOUNDSCI1LATE, 2, MAP_CALL(DoSoundDummy), "", NULL }, + { SIG_SOUNDSCI1LATE, 2, MAP_CALL(DoSoundRestore), "", NULL }, { SIG_SOUNDSCI1LATE, 3, MAP_CALL(DoSoundGetPolyphony), NULL, NULL }, { SIG_SOUNDSCI1LATE, 4, MAP_CALL(DoSoundGetAudioCapability), "", NULL }, { SIG_SOUNDSCI1LATE, 5, MAP_CALL(DoSoundSuspend), "i", NULL }, @@ -142,7 +142,7 @@ static const SciKernelMapSubEntry kDoSound_subops[] = { #ifdef ENABLE_SCI32 { SIG_SOUNDSCI21, 0, MAP_CALL(DoSoundMasterVolume), NULL, NULL }, { SIG_SOUNDSCI21, 1, MAP_CALL(DoSoundMute), NULL, NULL }, - { SIG_SOUNDSCI21, 2, MAP_CALL(DoSoundDummy), NULL, NULL }, + { SIG_SOUNDSCI21, 2, MAP_CALL(DoSoundRestore), NULL, NULL }, { SIG_SOUNDSCI21, 3, MAP_CALL(DoSoundGetPolyphony), NULL, NULL }, { SIG_SOUNDSCI21, 4, MAP_CALL(DoSoundGetAudioCapability), NULL, NULL }, { SIG_SOUNDSCI21, 5, MAP_CALL(DoSoundSuspend), NULL, NULL }, @@ -184,8 +184,8 @@ static const SciKernelMapSubEntry kGraph_subops[] = { { SIG_SCIALL, 9, MAP_CALL(GraphFillBoxBackground), "iiii", NULL }, { SIG_SCIALL, 10, MAP_CALL(GraphFillBoxForeground), "iiii", kGraphFillBoxForeground_workarounds }, { SIG_SCIALL, 11, MAP_CALL(GraphFillBoxAny), "iiiiii(i)(i)", kGraphFillBoxAny_workarounds }, - { SIG_SCI11, 12, MAP_CALL(GraphUpdateBox), "iiii(i)(r0)", NULL }, // kq6 hires - { SIG_SCIALL, 12, MAP_CALL(GraphUpdateBox), "iiii(i)", NULL }, + { SIG_SCI11, 12, MAP_CALL(GraphUpdateBox), "iiii(i)(r0)", kGraphUpdateBox_workarounds }, // kq6 hires + { SIG_SCIALL, 12, MAP_CALL(GraphUpdateBox), "iiii(i)", kGraphUpdateBox_workarounds }, { SIG_SCIALL, 13, MAP_CALL(GraphRedrawBox), "iiii", kGraphRedrawBox_workarounds }, { SIG_SCIALL, 14, MAP_CALL(GraphAdjustPriority), "ii", NULL }, { SIG_SCI11, 15, MAP_CALL(GraphSaveUpscaledHiresBox), "iiii", NULL }, // kq6 hires @@ -319,7 +319,7 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(CoordPri), SIG_EVERYWHERE, "i(i)", NULL, NULL }, { MAP_CALL(CosDiv), SIG_EVERYWHERE, "ii", NULL, NULL }, { MAP_CALL(DeleteKey), SIG_EVERYWHERE, "l.", NULL, NULL }, - { MAP_CALL(DeviceInfo), SIG_EVERYWHERE, "i(r)(r)(i)", NULL, NULL }, // subop + { MAP_CALL(DeviceInfo), SIG_EVERYWHERE, "i(r)(r)(i)", NULL, kDeviceInfo_workarounds }, // subop { MAP_CALL(Display), SIG_EVERYWHERE, "[ir]([ir!]*)", NULL, NULL }, // ^ we allow invalid references here, because kDisplay gets called with those in e.g. pq3 during intro // restoreBits() checks and skips invalid handles, so that's fine. Sierra SCI behaved the same @@ -418,7 +418,8 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(ScriptID), SIG_EVERYWHERE, "[io](i)", NULL, NULL }, { MAP_CALL(SetCursor), SIG_SCI21, SIGFOR_ALL, "i(i)([io])(i*)", NULL, NULL }, // TODO: SCI2.1 may supply an object optionally (mother goose sci21 right on startup) - find out why - { MAP_CALL(SetCursor), SIG_EVERYWHERE, "i(i*)", NULL, NULL }, + { MAP_CALL(SetCursor), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(iiiiii)", NULL, NULL }, + { MAP_CALL(SetCursor), SIG_EVERYWHERE, "i(i)(i)(i)(i)", NULL, kSetCursor_workarounds }, { MAP_CALL(SetDebug), SIG_EVERYWHERE, "(i*)", NULL, NULL }, { MAP_CALL(SetJump), SIG_EVERYWHERE, "oiii", NULL, NULL }, { MAP_CALL(SetMenu), SIG_EVERYWHERE, "i(.*)", NULL, NULL }, @@ -432,7 +433,7 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(SinDiv), SIG_EVERYWHERE, "ii", NULL, NULL }, { MAP_CALL(Sort), SIG_EVERYWHERE, "ooo", NULL, NULL }, { MAP_CALL(Sqrt), SIG_EVERYWHERE, "i", NULL, NULL }, - { MAP_CALL(StrAt), SIG_EVERYWHERE, "ri(i)", NULL, NULL }, + { MAP_CALL(StrAt), SIG_EVERYWHERE, "ri(i)", NULL, kStrAt_workarounds }, { MAP_CALL(StrCat), SIG_EVERYWHERE, "rr", NULL, NULL }, { MAP_CALL(StrCmp), SIG_EVERYWHERE, "rr(i)", NULL, NULL }, { MAP_CALL(StrCpy), SIG_EVERYWHERE, "r[r0](i)", NULL, NULL }, diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index d4ba467b25..39c32ccc68 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -282,6 +282,14 @@ enum { }; reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) { + if (g_sci->getGameId() == GID_FANMADE && argc == 1) { + // WORKAROUND: The fan game script library calls kDeviceInfo with one parameter. + // According to the scripts, it wants to call CurDevice. However, it fails to + // provide the subop to the function. + s->_segMan->strcpy(argv[0], "/"); + return s->r_acc; + } + int mode = argv[0].toUint16(); switch (mode) { @@ -480,6 +488,10 @@ reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) { Common::Array<SavegameDesc> saves; listSavegames(saves); + // we allow 0 (happens in QfG2 when trying to restore from an empty saved game list) and return false in that case + if (virtualId == 0) + return NULL_REG; + // Find saved-game if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END)) error("kCheckSaveGame: called with invalid savegameId!"); @@ -494,7 +506,7 @@ reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) { return NULL_REG; // Otherwise we assume the savegame is OK - return make_reg(0, 1); + return TRUE_REG; } reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) { diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 56518f10bf..e1e92b1cf9 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -29,6 +29,8 @@ #include "graphics/cursorman.h" #include "graphics/surface.h" +#include "gui/message.h" + #include "sci/sci.h" #include "sci/debug.h" // for g_debug_sleeptime_factor #include "sci/resource.h" @@ -172,8 +174,8 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { } break; } + case 9: // case for kq5cd, we are getting calling with 4 additional 900d parameters case 5: - case 9: hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16()); // Fallthrough case 3: @@ -182,6 +184,18 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { else g_sci->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); break; + case 10: + // Freddy pharkas, when using the whiskey glass to read the prescription (bug #3034973) + // magnifier support, disabled using argc == 1, argv == -1 + warning("kSetCursor: unsupported magnifier"); + // we just set the view cursor currently + g_sci->_gfxCursor->kernelSetView(argv[5].toUint16(), argv[6].toUint16(), argv[7].toUint16(), hotspot); + // argv[0] -> 1, 2, 4 -> maybe magnification multiplier + // argv[1-4] -> rect for magnification + // argv[5, 6, 7] -> view resource for cursor + // argv[8] -> picture resource for mag + // argv[9] -> color for magnifier replacement + break; default : error("kSetCursor: Unhandled case: %d arguments given", argc); break; @@ -739,8 +753,10 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } -// Original top-left must stay on kControl rects, we adjust accordingly because sierra sci actually wont draw rects that -// are upside down (example: jones, when challenging jones - one button is a duplicate and also has lower-right which is 0, 0) +// Original top-left must stay on kControl rects, we adjust accordingly because +// sierra sci actually wont draw rects that are upside down (example: jones, +// when challenging jones - one button is a duplicate and also has lower-right +// which is 0, 0) Common::Rect kControlCreateRect(int16 x, int16 y, int16 x1, int16 y1) { if (x > x1) x1 = x; if (y > y1) y1 = y; @@ -882,7 +898,8 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { // Disable the "Change Directory" button, as we don't allow the game engine to // change the directory where saved games are placed - if (objName == "changeDirI") { + // "changeDirItem" is used in the import windows of QFG2&3 + if ((objName == "changeDirI") || (objName == "changeDirItem")) { int state = readSelectorValue(s->_segMan, controlObject, SELECTOR(state)); writeSelectorValue(s->_segMan, controlObject, SELECTOR(state), (state | SCI_CONTROLS_STYLE_DISABLED) & ~SCI_CONTROLS_STYLE_ENABLED); } @@ -898,6 +915,24 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { } } } + if (objName == "savedHeros") { + // Import of QfG character files dialog is shown + // display additional popup information before letting user use it + reg_t changeDirButton = s->_segMan->findObjectByName("changeDirItem"); + if (!changeDirButton.isNull()) { + // check if checkDirButton is still enabled, in that case we are called the first time during that room + if (!(readSelectorValue(s->_segMan, changeDirButton, SELECTOR(state)) & SCI_CONTROLS_STYLE_DISABLED)) { + GUI::MessageDialog dialog("Characters saved inside ScummVM are shown " + "automatically. Character files saved in the original " + "interpreter need to be put inside ScummVM's saved games " + "directory and a prefix needs to be added depending on which " + "game it was saved in: 'qfg1-' for Quest for Glory 1, 'qfg2-' " + "for Quest for Glory 2. Example: 'qfg2-thief.sav'.", + "OK"); + dialog.runModal(); + } + } + } _k_GenericDrawControl(s, controlObject, false); return NULL_REG; @@ -1070,7 +1105,7 @@ reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv) { int16 shakeCount = (argc > 0) ? argv[0].toUint16() : 1; int16 directions = (argc > 1) ? argv[1].toUint16() : 1; - g_sci->_gfxPaint->kernelShakeScreen(shakeCount, directions); + g_sci->_gfxScreen->kernelShakeScreen(shakeCount, directions); return s->r_acc; } diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index bdc705cae3..f3769b653b 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -37,8 +37,18 @@ reg_t kRandom(EngineState *s, int argc, reg_t *argv) { case 2: { // get random number int fromNumber = argv[0].toUint16(); int toNumber = argv[1].toUint16(); - double randomNumber = fromNumber + ((toNumber + 1.0 - fromNumber) * (rand() / (RAND_MAX + 1.0))); - return make_reg(0, (int)randomNumber); + + // TODO/CHECKME: It is propbably not required to check whether + // toNumber is greater than fromNumber, at least not when one + // goes by their names, but let us be on the safe side and + // allow toNumber to be smaller than fromNumber too. + if (fromNumber > toNumber) + SWAP(fromNumber, toNumber); + + const uint diff = (uint)(toNumber - fromNumber); + + const int randomNumber = fromNumber + (int)g_sci->getRNG().getRandomNumber(diff); + return make_reg(0, randomNumber); } case 3: // get seed diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 305e202ae9..fbe20410de 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -46,25 +46,37 @@ reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) { ** Returns the restarting_flag in acc */ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) { - s->r_acc = make_reg(0, s->gameWasRestarted); + s->r_acc = make_reg(0, s->gameIsRestarting); if (argc) { // Only happens during replay if (!argv[0].toUint16()) // Set restarting flag - s->gameWasRestarted = false; + s->gameIsRestarting = GAMEISRESTARTING_NONE; } uint32 neededSleep = 30; - // WORKAROUND: LSL3 calculates a machinespeed variable during game startup - // (right after the filthy questions). This one would go through w/o - // throttling resulting in having to do 1000 pushups or something. Another - // way of handling this would be delaying incrementing of "machineSpeed" - // selector. - if (g_sci->getGameId() == GID_LSL3 && s->currentRoomNumber() == 290) - s->_throttleTrigger = true; - else if (g_sci->getGameId() == GID_ICEMAN && s->currentRoomNumber() == 27) { - s->_throttleTrigger = true; - neededSleep = 60; + // WORKAROUNDS: + switch (g_sci->getGameId()) { + case GID_LSL3: + // LSL3 calculates a machinespeed variable during game startup + // (right after the filthy questions). This one would go through w/o + // throttling resulting in having to do 1000 pushups or something. Another + // way of handling this would be delaying incrementing of "machineSpeed" + // selector. + if (s->currentRoomNumber() == 290) + s->_throttleTrigger = true; + break; + case GID_ICEMAN: + // In ICEMAN the submarine control room is not animating much, so it runs way too fast + // we calm it down even more otherwise especially fighting against other submarines + // is almost impossible + if (s->currentRoomNumber() == 27) { + s->_throttleTrigger = true; + neededSleep = 60; + } + break; + default: + break; } s->speedThrottler(neededSleep); @@ -160,10 +172,10 @@ reg_t kSetDebug(EngineState *s, int argc, reg_t *argv) { } enum { - K_NEW_GETTIME_TICKS = 0, - K_NEW_GETTIME_TIME_12HOUR = 1, - K_NEW_GETTIME_TIME_24HOUR = 2, - K_NEW_GETTIME_DATE = 3 + KGETTIME_TICKS = 0, + KGETTIME_TIME_12HOUR = 1, + KGETTIME_TIME_24HOUR = 2, + KGETTIME_DATE = 3 }; reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { @@ -180,19 +192,19 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { error("kGetTime called in SCI0 with mode %d (expected 0 or 1)", mode); switch (mode) { - case K_NEW_GETTIME_TICKS : + case KGETTIME_TICKS : retval = elapsedTime * 60 / 1000; debugC(2, kDebugLevelTime, "GetTime(elapsed) returns %d", retval); break; - case K_NEW_GETTIME_TIME_12HOUR : + case KGETTIME_TIME_12HOUR : retval = ((loc_time.tm_hour % 12) << 12) | (loc_time.tm_min << 6) | (loc_time.tm_sec); debugC(2, kDebugLevelTime, "GetTime(12h) returns %d", retval); break; - case K_NEW_GETTIME_TIME_24HOUR : + case KGETTIME_TIME_24HOUR : retval = (loc_time.tm_hour << 11) | (loc_time.tm_min << 5) | (loc_time.tm_sec >> 1); debugC(2, kDebugLevelTime, "GetTime(24h) returns %d", retval); break; - case K_NEW_GETTIME_DATE : + case KGETTIME_DATE : retval = loc_time.tm_mday | ((loc_time.tm_mon + 1) << 5) | (((loc_time.tm_year + 1900) & 0x7f) << 9); debugC(2, kDebugLevelTime, "GetTime(date) returns %d", retval); break; @@ -215,17 +227,32 @@ enum { reg_t kMemory(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { - case K_MEMORY_ALLOCATE_CRITICAL : - if (!s->_segMan->allocDynmem(argv[1].toUint16(), "kMemory() critical", &s->r_acc)) { + case K_MEMORY_ALLOCATE_CRITICAL: { + int byteCount = argv[1].toUint16(); + // WORKAROUND: pq3 (multilingual) when plotting crimes - allocates the + // returned bytes from kStrLen on "W" and "E" and wants to put a + // string in there, which doesn't fit of course. That's why we allocate + // one byte more all the time inside that room + if (g_sci->getGameId() == GID_PQ3) { + if (s->currentRoomNumber() == 202) + byteCount++; + } + if (!s->_segMan->allocDynmem(byteCount, "kMemory() critical", &s->r_acc)) { error("Critical heap allocation failed"); } break; - case K_MEMORY_ALLOCATE_NONCRITICAL : + } + case K_MEMORY_ALLOCATE_NONCRITICAL: s->_segMan->allocDynmem(argv[1].toUint16(), "kMemory() non-critical", &s->r_acc); break; case K_MEMORY_FREE : - if (s->_segMan->freeDynmem(argv[1])) { - error("Attempt to kMemory::free() non-dynmem pointer %04x:%04x", PRINT_REG(argv[1])); + if (!s->_segMan->freeDynmem(argv[1])) { + if (g_sci->getGameId() == GID_QFG1VGA) { + // Ignore script bug in QFG1VGA, when closing any conversation dialog with esc + } else { + // Usually, the result of a script bug. Non-critical + warning("Attempt to kMemory::free() non-dynmem pointer %04x:%04x", PRINT_REG(argv[1])); + } } break; case K_MEMORY_MEMCPY : { diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 114b6eb755..dfd1aa699e 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -30,6 +30,7 @@ #include "sci/engine/selector.h" #include "sci/engine/kernel.h" #include "sci/graphics/animate.h" +#include "sci/graphics/screen.h" namespace Sci { @@ -313,8 +314,15 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { || ((y == desty) && (abs(dy) >= abs(dx))) /* Moving fast, reached? */ ))) { // Whew... in short: If we have reached or passed our target position - x = destx; - y = desty; + + // Sanity check: make sure that destx, desty are inside the screen coordinates. + // They can go off screen in some cases, e.g. in SQ5 while scrubbing the floor (bug #3037351) + if (destx < g_sci->_gfxScreen->getWidth() && desty < g_sci->_gfxScreen->getHeight()) { + x = destx; + y = desty; + } else { + warning("kDoBresen: destination x, y would be off-screen(%d, %d)", destx, desty); + } completed = 1; debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x", PRINT_REG(mover)); @@ -437,7 +445,7 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked", dx, dy, angle, (s->r_acc.offset) ? " " : "not "); if (s->r_acc.offset) { // isBlocked() returned non-zero - int rotation = (rand() & 1) ? 45 : (360 - 45); // Clockwise/counterclockwise + int rotation = (g_sci->getRNG().getRandomBit() == 1) ? 45 : (360 - 45); // Clockwise/counterclockwise int oldx = readSelectorValue(segMan, client, SELECTOR(x)); int oldy = readSelectorValue(segMan, client, SELECTOR(y)); int xstep = readSelectorValue(segMan, client, SELECTOR(xStep)); diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index e211867ef9..a5501c160f 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -95,6 +95,7 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) { ++itr; } + delete resources; } else { which = g_sci->getResMan()->findResource(id, 0); diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 4e5ddc5e96..2f00cd7da2 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -48,7 +48,7 @@ reg_t kDoSound(EngineState *s, int argc, reg_t *argv) { CREATE_DOSOUND_FORWARD(DoSoundInit) CREATE_DOSOUND_FORWARD(DoSoundPlay) -CREATE_DOSOUND_FORWARD(DoSoundDummy) +CREATE_DOSOUND_FORWARD(DoSoundRestore) CREATE_DOSOUND_FORWARD(DoSoundDispose) CREATE_DOSOUND_FORWARD(DoSoundMute) CREATE_DOSOUND_FORWARD(DoSoundStop) @@ -63,6 +63,7 @@ CREATE_DOSOUND_FORWARD(DoSoundUpdateCues) CREATE_DOSOUND_FORWARD(DoSoundSendMidi) CREATE_DOSOUND_FORWARD(DoSoundReverb) CREATE_DOSOUND_FORWARD(DoSoundSetHold) +CREATE_DOSOUND_FORWARD(DoSoundDummy) CREATE_DOSOUND_FORWARD(DoSoundGetAudioCapability) CREATE_DOSOUND_FORWARD(DoSoundSuspend) CREATE_DOSOUND_FORWARD(DoSoundSetVolume) @@ -222,16 +223,17 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { // 3 new subops in Pharkas. kDoAudio in Pharkas sits at seg026:038C case 11: + // Not sure where this is used yet warning("kDoAudio: Unhandled case 11, %d extra arguments passed", argc - 1); break; case 12: - // Seems to be audio sync, used in Pharkas. Silenced the warning due to - // the high level of spam it produces. + // Seems to be some sort of audio sync, used in Pharkas. Silenced the + // warning due to the high level of spam it produces. (takes no params) //warning("kDoAudio: Unhandled case 12, %d extra arguments passed", argc - 1); break; case 13: - // Used in Pharkas whenever a speech sample starts - warning("kDoAudio: Unhandled case 13, %d extra arguments passed", argc - 1); + // Used in Pharkas whenever a speech sample starts (takes no params) + //warning("kDoAudio: Unhandled case 13, %d extra arguments passed", argc - 1); break; default: warning("kDoAudio: Unhandled case %d, %d extra arguments passed", argv[0].toUint16(), argc - 1); diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index cd103dade7..3ad2d95f58 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -205,11 +205,15 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { videoDecoder = new VMDDecoder(g_system->getMixer()); + if (!videoDecoder->loadFile(fileName)) { + warning("Could not open VMD %s", fileName.c_str()); + break; + } + if (reshowCursor) g_sci->_gfxCursor->kernelHide(); - if (videoDecoder && videoDecoder->loadFile(fileName)) - playVideo(videoDecoder); + playVideo(videoDecoder); if (reshowCursor) g_sci->_gfxCursor->kernelShow(); @@ -280,8 +284,7 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { // Looks to be setting the video size and position. Called with 4 extra integer // parameters (e.g. 86, 41, 235, 106) default: - warningMsg = "PlayVMD - unsupported subop. Params: " + - Common::String::printf("%d", argc) + " ("; + warningMsg = Common::String::printf("PlayVMD - unsupported subop %d. Params: %d (", operation, argc); for (int i = 0; i < argc; i++) { warningMsg += Common::String::printf("%04x:%04x", PRINT_REG(argv[i])); diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index cdecc556e8..6e1b326c4f 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -166,6 +166,8 @@ bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &re } if (!reader->init()) { + delete reader; + warning("Message: failed to read resource header"); return false; } @@ -180,6 +182,7 @@ bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &re continue; } + delete reader; return false; } @@ -193,6 +196,7 @@ bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &re } } + delete reader; return true; } } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 806c8893b4..a7716516e7 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -53,42 +53,8 @@ namespace Sci { #define VER(x) Common::Serializer::Version(x) -// OBSOLETE: This const is used for backward compatibility only. -const uint32 INTMAPPER_MAGIC_KEY = 0xDEADBEEF; - - #pragma mark - -// TODO: Many of the following sync_*() methods should be turned into member funcs -// of the classes they are syncing. - -#define DEFROBNICATE_HANDLE(handle) (make_reg((handle >> 16) & 0xffff, handle & 0xffff)) - -void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) { - soundObj.saveLoadWithSerializer(s); - s.syncAsSint16LE(resourceId); - s.syncAsSint16LE(dataInc); - s.syncAsSint16LE(ticker); - s.syncAsSint16LE(signal, VER(17)); - s.syncAsByte(priority); - s.syncAsSint16LE(loop, VER(17)); - s.syncAsByte(volume); - s.syncAsByte(hold, VER(17)); - s.syncAsByte(fadeTo); - s.syncAsSint16LE(fadeStep); - s.syncAsSint32LE(fadeTicker); - s.syncAsSint32LE(fadeTickerStep); - s.syncAsByte(status); - - // pMidiParser and pStreamAud will be initialized when the - // sound list is reconstructed in gamestate_restore() - if (s.isLoading()) { - soundRes = 0; - pMidiParser = 0; - pStreamAud = 0; - } -} - // Experimental hack: Use syncWithSerializer to sync. By default, this assume // the object to be synced is a subclass of Serializable and thus tries to invoke // the saveLoadWithSerializer() method. But it is possible to specialize this @@ -148,7 +114,8 @@ void syncArray(Common::Serializer &s, Common::Array<T> &arr) { template <> void syncWithSerializer(Common::Serializer &s, reg_t &obj) { - obj.saveLoadWithSerializer(s); + s.syncAsUint16LE(obj.segment); + s.syncAsUint16LE(obj.offset); } void SegManager::saveLoadWithSerializer(Common::Serializer &s) { @@ -206,7 +173,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) { template <> void syncWithSerializer(Common::Serializer &s, Class &obj) { s.syncAsSint32LE(obj.script); - obj.reg.saveLoadWithSerializer(s); + syncWithSerializer(s, obj.reg); } static void sync_SavegameMetadata(Common::Serializer &s, SavegameMetadata &obj) { @@ -266,7 +233,7 @@ void LocalVariables::saveLoadWithSerializer(Common::Serializer &s) { void Object::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsSint32LE(_flags); - _pos.saveLoadWithSerializer(s); + syncWithSerializer(s, _pos); s.syncAsSint32LE(_methodCount); // that's actually a uint16 syncArray<reg_t>(s, _variables); @@ -283,18 +250,18 @@ template <> void syncWithSerializer(Common::Serializer &s, Table<List>::Entry &obj) { s.syncAsSint32LE(obj.next_free); - obj.first.saveLoadWithSerializer(s); - obj.last.saveLoadWithSerializer(s); + syncWithSerializer(s, obj.first); + syncWithSerializer(s, obj.last); } template <> void syncWithSerializer(Common::Serializer &s, Table<Node>::Entry &obj) { s.syncAsSint32LE(obj.next_free); - obj.pred.saveLoadWithSerializer(s); - obj.succ.saveLoadWithSerializer(s); - obj.key.saveLoadWithSerializer(s); - obj.value.saveLoadWithSerializer(s); + syncWithSerializer(s, obj.pred); + syncWithSerializer(s, obj.succ); + syncWithSerializer(s, obj.key); + syncWithSerializer(s, obj.value); } #ifdef ENABLE_SCI32 @@ -328,7 +295,7 @@ void syncWithSerializer(Common::Serializer &s, Table<SciArray<reg_t> >::Entry &o if (s.isSaving()) value = obj.getValue(i); - value.saveLoadWithSerializer(s); + syncWithSerializer(s, value); if (s.isLoading()) obj.setValue(i, value); @@ -414,14 +381,14 @@ void Script::saveLoadWithSerializer(Common::Serializer &s) { _objects.clear(); Object tmp; for (uint i = 0; i < numObjs; ++i) { - syncWithSerializer<Object>(s, tmp); + syncWithSerializer(s, tmp); _objects[tmp.getPos().offset] = tmp; } } else { ObjMap::iterator it; const ObjMap::iterator end = _objects.end(); for (it = _objects.begin(); it != end; ++it) { - syncWithSerializer<Object>(s, it->_value); + syncWithSerializer(s, it->_value); } } @@ -526,6 +493,31 @@ void SciMusic::saveLoadWithSerializer(Common::Serializer &s) { } } +void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) { + syncWithSerializer(s, soundObj); + s.syncAsSint16LE(resourceId); + s.syncAsSint16LE(dataInc); + s.syncAsSint16LE(ticker); + s.syncAsSint16LE(signal, VER(17)); + s.syncAsByte(priority); + s.syncAsSint16LE(loop, VER(17)); + s.syncAsByte(volume); + s.syncAsByte(hold, VER(17)); + s.syncAsByte(fadeTo); + s.syncAsSint16LE(fadeStep); + s.syncAsSint32LE(fadeTicker); + s.syncAsSint32LE(fadeTickerStep); + s.syncAsByte(status); + + // pMidiParser and pStreamAud will be initialized when the + // sound list is reconstructed in gamestate_restore() + if (s.isLoading()) { + soundRes = 0; + pMidiParser = 0; + pStreamAud = 0; + } +} + void SoundCommandParser::syncPlayList(Common::Serializer &s) { _music->saveLoadWithSerializer(s); } @@ -748,11 +740,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { } // We don't need the thumbnail here, so just read it and discard it - Graphics::Surface *thumbnail = new Graphics::Surface(); - assert(thumbnail); - Graphics::loadThumbnail(*fh, *thumbnail); - delete thumbnail; - thumbnail = 0; + Graphics::skipThumbnail(*fh); s->reset(true); s->saveLoadWithSerializer(ser); // FIXME: Error handling? @@ -770,12 +758,19 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { s->gameStartTime = g_system->getMillis(); s->_screenUpdateTime = g_system->getMillis(); + if (g_sci->_gfxPorts) + g_sci->_gfxPorts->reset(); + g_sci->_soundCmd->reconstructPlayList(meta.savegame_version); // Message state: + delete s->_msgState; s->_msgState = new MessageState(s->_segMan); s->abortScriptProcessing = kAbortLoadGame; + + // signal restored game to game scripts + s->gameIsRestarting = GAMEISRESTARTING_RESTORE; } bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata *meta) { diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 25cf1d069f..1fb37f458d 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -851,13 +851,13 @@ byte *SegManager::allocDynmem(int size, const char *descr, reg_t *addr) { return (byte *)(d._buf); } -int SegManager::freeDynmem(reg_t addr) { +bool SegManager::freeDynmem(reg_t addr) { if (addr.segment < 1 || addr.segment >= _heap.size() || !_heap[addr.segment] || _heap[addr.segment]->getType() != SEG_TYPE_DYNMEM) - return 1; // error + return false; // error deallocate(addr.segment, true); - return 0; // OK + return true; // OK } #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index e0808dbb1b..59ac6f39b6 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -274,7 +274,7 @@ public: * Deallocates a piece of dynamic memory * @param[in] addr Offset of the dynmem chunk to free */ - int freeDynmem(reg_t addr); + bool freeDynmem(reg_t addr); // Generic Operations on Segments and Addresses diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index 2465576302..c8cb4cd203 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -143,9 +143,6 @@ public: } }; - -struct IntMapper; - enum { SYS_STRINGS_MAX = 4, diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index f5eb9eb73a..f99a41e088 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -164,6 +164,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(vanishingX); FIND_SELECTOR(vanishingY); FIND_SELECTOR(iconIndex); + FIND_SELECTOR(port); #ifdef ENABLE_SCI32 FIND_SELECTOR(data); diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index 661290f58c..00e795c1b9 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -127,6 +127,8 @@ struct SelectorCache { // SCI1.1 Mac icon bar selectors Selector iconIndex; ///< Used to index icon bar objects + Selector port; // used by a hoyle 4 workaround + #ifdef ENABLE_SCI32 Selector data; // Used by Array()/String() Selector picture; // Used to hold the picture ID for SCI32 pictures diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 243a460645..4f1d686b17 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -87,6 +87,12 @@ enum { SAVEGAMEID_OFFICIALRANGE_END = 1999 }; +enum { + GAMEISRESTARTING_NONE = 0, + GAMEISRESTARTING_RESTART = 1, + GAMEISRESTARTING_RESTORE = 2 +}; + class FileHandle { public: Common::String _name; @@ -159,7 +165,7 @@ public: int variablesMax[4]; ///< Max. values for all variables AbortGameState abortScriptProcessing; - bool gameWasRestarted; + int16 gameIsRestarting; // is set when restarting (=1) or restoring the game (=2) int scriptStepCounter; // Counts the number of steps executed int scriptGCInterval; // Number of steps in between gcs diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index 55e18613e0..aae6de01f1 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -38,66 +38,66 @@ struct SelectorRemap { }; static const char * const sci0Selectors[] = { - "y", "x", "view", "loop", "cel", // 0 - 4 - "underBits", "nsTop", "nsLeft", "nsBottom", "nsRight", // 5 - 9 - "lsTop", "lsLeft", "lsBottom", "lsRight", "signal", // 10 - 14 - "illegalBits", "brTop", "brLeft", "brBottom", "brRight", // 15 - 19 - "name", "key", "time", "text", "elements", // 20 - 25 - "color", "back", "mode", "style", "state", // 25 - 29 - "font", "type", "window", "cursor", "max", // 30 - 34 - "mark", "who", "message", "edit", "play", // 35 - 39 - "number", "handle", "client", "dx", "dy", // 40 - 44 - "b-moveCnt", "b-i1", "b-i2", "b-di", "b-xAxis", // 45 - 49 - "b-incr", "xStep", "yStep", "moveSpeed", "canBeHere", // 50 - 54 - "heading", "mover", "doit", "isBlocked", "looper", // 55 - 59 - "priority", "modifiers", "replay", "setPri", "at", // 60 - 64 - "next", "done", "width", "wordFail", "syntaxFail", // 65 - 69 - "semanticFail", "pragmaFail", "said", "claimed", "value", // 70 - 74 - "save", "restore", "title", "button", "icon", // 75 - 79 - "draw", "delete", "z" // 80 - 82 + "y", "x", "view", "loop", "cel", // 0 - 4 + "underBits", "nsTop", "nsLeft", "nsBottom", "nsRight", // 5 - 9 + "lsTop", "lsLeft", "lsBottom", "lsRight", "signal", // 10 - 14 + "illegalBits", "brTop", "brLeft", "brBottom", "brRight", // 15 - 19 + "name", "key", "time", "text", "elements", // 20 - 25 + "color", "back", "mode", "style", "state", // 25 - 29 + "font", "type", "window", "cursor", "max", // 30 - 34 + "mark", "who", "message", "edit", "play", // 35 - 39 + "number", "handle", "client", "dx", "dy", // 40 - 44 + "b-moveCnt", "b-i1", "b-i2", "b-di", "b-xAxis", // 45 - 49 + "b-incr", "xStep", "yStep", "moveSpeed", "canBeHere", // 50 - 54 + "heading", "mover", "doit", "isBlocked", "looper", // 55 - 59 + "priority", "modifiers", "replay", "setPri", "at", // 60 - 64 + "next", "done", "width", "wordFail", "syntaxFail", // 65 - 69 + "semanticFail", "pragmaFail", "said", "claimed", "value", // 70 - 74 + "save", "restore", "title", "button", "icon", // 75 - 79 + "draw", "delete", "z" // 80 - 82 }; static const char * const sci1Selectors[] = { - "parseLang", "printLang", "subtitleLang", "size", "points", // 83 - 87 - "palette", "dataInc", "handle", "min", "sec", // 88 - 92 - "frame", "vol", "pri", "perform", "moveDone" // 93 - 97 + "parseLang", "printLang", "subtitleLang", "size", "points", // 83 - 87 + "palette", "dataInc", "handle", "min", "sec", // 88 - 92 + "frame", "vol", "pri", "perform", "moveDone" // 93 - 97 }; #ifdef ENABLE_SCI32 static const char * const sci2Selectors[] = { - "plane", "x", "y", "z", "scaleX", // 0 - 4 - "scaleY", "maxScale", "priority", "fixPriority", "inLeft", // 5 - 9 - "inTop", "inRight", "inBottom", "useInsetRect", "view", // 10 - 14 - "loop", "cel", "bitmap", "nsLeft", "nsTop", // 15 - 19 - "nsRight", "nsBottom", "lsLeft", "lsTop", "lsRight", // 20 - 25 - "lsBottom", "signal", "illegalBits", "brLeft", "brTop", // 25 - 29 - "brRight", "brBottom", "name", "key", "time", // 30 - 34 - "text", "elements", "fore", "back", "mode", // 35 - 39 - "style", "state", "font", "type", "window", // 40 - 44 - "cursor", "max", "mark", "who", "message", // 45 - 49 - "edit", "play", "number", "nodePtr", "client", // 50 - 54 - "dx", "dy", "b-moveCnt", "b-i1", "b-i2", // 55 - 59 - "b-di", "b-xAxis", "b-incr", "xStep", "yStep", // 60 - 64 - "moveSpeed", "cantBeHere", "heading", "mover", "doit", // 65 - 69 - "isBlocked", "looper", "modifiers", "replay", "setPri", // 70 - 74 - "at", "next", "done", "width", "pragmaFail", // 75 - 79 - "claimed", "value", "save", "restore", "title", // 80 - 84 - "button", "icon", "draw", "delete", "printLang", // 85 - 89 - "size", "points", "palette", "dataInc", "handle", // 90 - 94 - "min", "sec", "frame", "vol", "perform", // 95 - 99 - "moveDone", "topString", "flags", "quitGame", "restart", // 100 - 104 - "hide", "scaleSignal", "vanishingX", "vanishingY", "picture", // 105 - 109 - "resX", "resY", "coordType", "data", "skip", // 110 - 104 - "center", "all", "show", "textLeft", "textTop", // 115 - 119 - "textRight", "textBottom", "borderColor", "titleFore", "titleBack", // 120 - 124 - "titleFont", "dimmed", "frameOut", "lastKey", "magnifier", // 125 - 129 - "magPower", "mirrored", "pitch", "roll", "yaw", // 130 - 134 - "left", "right", "top", "bottom", "numLines" // 135 - 139 + "plane", "x", "y", "z", "scaleX", // 0 - 4 + "scaleY", "maxScale", "priority", "fixPriority", "inLeft", // 5 - 9 + "inTop", "inRight", "inBottom", "useInsetRect", "view", // 10 - 14 + "loop", "cel", "bitmap", "nsLeft", "nsTop", // 15 - 19 + "nsRight", "nsBottom", "lsLeft", "lsTop", "lsRight", // 20 - 25 + "lsBottom", "signal", "illegalBits", "brLeft", "brTop", // 25 - 29 + "brRight", "brBottom", "name", "key", "time", // 30 - 34 + "text", "elements", "fore", "back", "mode", // 35 - 39 + "style", "state", "font", "type", "window", // 40 - 44 + "cursor", "max", "mark", "who", "message", // 45 - 49 + "edit", "play", "number", "nodePtr", "client", // 50 - 54 + "dx", "dy", "b-moveCnt", "b-i1", "b-i2", // 55 - 59 + "b-di", "b-xAxis", "b-incr", "xStep", "yStep", // 60 - 64 + "moveSpeed", "cantBeHere", "heading", "mover", "doit", // 65 - 69 + "isBlocked", "looper", "modifiers", "replay", "setPri", // 70 - 74 + "at", "next", "done", "width", "pragmaFail", // 75 - 79 + "claimed", "value", "save", "restore", "title", // 80 - 84 + "button", "icon", "draw", "delete", "printLang", // 85 - 89 + "size", "points", "palette", "dataInc", "handle", // 90 - 94 + "min", "sec", "frame", "vol", "perform", // 95 - 99 + "moveDone", "topString", "flags", "quitGame", "restart", // 100 - 104 + "hide", "scaleSignal", "vanishingX", "vanishingY", "picture", // 105 - 109 + "resX", "resY", "coordType", "data", "skip", // 110 - 104 + "center", "all", "show", "textLeft", "textTop", // 115 - 119 + "textRight", "textBottom", "borderColor", "titleFore", "titleBack", // 120 - 124 + "titleFont", "dimmed", "frameOut", "lastKey", "magnifier", // 125 - 129 + "magPower", "mirrored", "pitch", "roll", "yaw", // 130 - 134 + "left", "right", "top", "bottom", "numLines" // 135 - 139 }; #endif static const SelectorRemap sciSelectorRemap[] = { - { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 }, + { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 }, { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "points", 316 }, { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "flags", 368 }, { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "nodePtr", 44 }, @@ -176,11 +176,12 @@ Common::StringArray Kernel::checkStaticSelectorNames() { names[110] = "init"; } else if (g_sci->getGameId() == GID_LAURABOW2) { - // The floppy of version needs the open selector set to match up with the CD version's - // workaround - bug #3035694 + // The floppy of version needs the open and changeState selectors set to match up with the + // CD version's workarounds - bugs #3035694 and #3036291 if (names.size() < 190) names.resize(190); + names[144] = "changeState"; names[189] = "open"; } diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index b7f6896a48..7bcc5b43a3 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -135,9 +135,13 @@ static StackPtr validate_stack_addr(EngineState *s, StackPtr sp) { static int validate_arithmetic(reg_t reg) { if (reg.segment) { // The results of this are likely unpredictable... It most likely means that a kernel function is returning something wrong. - // If such an error occurs, we usually need to find the last kernel function called and check its return value. Check - // callKernelFunc() below - error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]. Address: %04x:%04x", reg.segment, PRINT_REG(reg)); + // If such an error occurs, we usually need to find the last kernel function called and check its return value. + if (g_sci->getGameId() == GID_QFG2 && g_sci->getEngineState()->currentRoomNumber() == 200) { + // WORKAROUND: This happens in QFG2, room 200, when talking to the astrologer (bug #3039879) - script bug. + // Returning 0 in this case. + } else { + error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]. Address: %04x:%04x", reg.segment, PRINT_REG(reg)); + } return 0; } @@ -231,7 +235,7 @@ static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, i case VAR_PARAM: // Out-of-bounds read for a parameter that goes onto stack and hits an uninitialized temp // We return 0 currently in that case - warning("Read for a parameter goes out-of-bounds, onto the stack and gets uninitialized temp"); + debugC(2, kDebugLevelVM, "[VM] Read for a parameter goes out-of-bounds, onto the stack and gets uninitialized temp"); return NULL_REG; default: break; @@ -743,6 +747,11 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { if (kernelCall.debugLogging) logKernelCall(&kernelCall, NULL, s, argc, argv, s->r_acc); + if (kernelCall.debugBreakpoint) { + printf("Break on k%s\n", kernelCall.name); + g_sci->_debugState.debugging = true; + g_sci->_debugState.breakpointWasHit = true; + } } else { // Sub-functions available, check signature and call that one directly if (argc < 1) @@ -793,6 +802,11 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { if (kernelSubCall.debugLogging) logKernelCall(&kernelCall, &kernelSubCall, s, argc, argv, s->r_acc); + if (kernelSubCall.debugBreakpoint) { + printf("Break on k%s\n", kernelSubCall.name); + g_sci->_debugState.debugging = true; + g_sci->_debugState.breakpointWasHit = true; + } } // Remove callk stack frame again, if there's still an execution stack @@ -923,11 +937,7 @@ void run_vm(EngineState *s) { obj = s->_segMan->getObject(s->xs->objp); local_script = s->_segMan->getScriptIfLoaded(s->xs->local_segment); if (!local_script) { - // FIXME: Why does this happen? Is the script not loaded yet at this point? - warning("Could not find local script from segment %x", s->xs->local_segment); - local_script = NULL; - s->variablesBase[VAR_LOCAL] = s->variables[VAR_LOCAL] = NULL; - s->variablesMax[VAR_LOCAL] = 0; + error("Could not find local script from segment %x", s->xs->local_segment); } else { s->variablesSegment[VAR_LOCAL] = local_script->_localsSegment; if (local_script->_localsBlock) @@ -1053,7 +1063,7 @@ void run_vm(EngineState *s) { if (validate_signedInteger(s->r_acc, value1) && validate_signedInteger(r_temp, value2)) s->r_acc = make_reg(0, value1 * value2); else - s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp); + s->r_acc = arithmetic_lookForWorkaround(opcode, opcodeMulWorkarounds, s->r_acc, r_temp); break; } @@ -1069,11 +1079,30 @@ void run_vm(EngineState *s) { case op_mod: { // 0x05 (05) r_temp = POP32(); - int16 modulo, value; - if (validate_signedInteger(s->r_acc, modulo) && validate_signedInteger(r_temp, value)) - s->r_acc = make_reg(0, (modulo != 0 ? value % modulo : 0)); - else - s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp); + + if (getSciVersion() <= SCI_VERSION_0_LATE) { + uint16 modulo, value; + if (validate_unsignedInteger(s->r_acc, modulo) && validate_unsignedInteger(r_temp, value)) + s->r_acc = make_reg(0, (modulo != 0 ? value % modulo : 0)); + else + s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp); + } else { + // In Iceman (and perhaps from SCI0 0.000.685 onwards in general), + // handling for negative numbers was added. Since Iceman doesn't + // seem to have issues with the older code, we exclude it for now + // for simplicity's sake and use the new code for SCI01 and newer + // games. Fixes the battlecruiser mini game in SQ5 (room 850), + // bug #3035755 + int16 modulo, value, result; + if (validate_signedInteger(s->r_acc, modulo) && validate_signedInteger(r_temp, value)) { + modulo = ABS(modulo); + result = (modulo != 0 ? value % modulo : 0); + if (result < 0) + result += modulo; + s->r_acc = make_reg(0, result); + } else + s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp); + } break; } @@ -1196,7 +1225,7 @@ void run_vm(EngineState *s) { if (validate_signedInteger(r_temp, compare1) && validate_signedInteger(s->r_acc, compare2)) s->r_acc = make_reg(0, compare1 >= compare2); else - s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, r_temp, s->r_acc); + s->r_acc = arithmetic_lookForWorkaround(opcode, opcodeGeWorkarounds, r_temp, s->r_acc); } break; diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h index 828fba3d7d..edf35a122a 100644 --- a/engines/sci/engine/vm_types.h +++ b/engines/sci/engine/vm_types.h @@ -27,7 +27,6 @@ #define SCI_ENGINE_VM_TYPES_H #include "common/scummsys.h" -#include "common/serializer.h" namespace Sci { @@ -57,11 +56,6 @@ struct reg_t { int16 toSint16() const { return (int16) offset; } - - void saveLoadWithSerializer(Common::Serializer &s) { - s.syncAsUint16LE(segment); - s.syncAsUint16LE(offset); - } }; static inline reg_t make_reg(SegmentId segment, uint16 offset) { diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index 0db73e34d5..bc6d457f7f 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -38,12 +38,6 @@ const SciWorkaroundEntry opcodeDivWorkarounds[] = { SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, room,script,lvl, object-name, method-name, call,index, workaround -const SciWorkaroundEntry opcodeOrWorkarounds[] = { - { GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xcc6, 0, { WORKAROUND_FAKE, 0 } }, // when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464 - SCI_WORKAROUNDENTRY_TERMINATOR -}; - // gameID, room,script,lvl, object-name, method-name, call, index, workaround const SciWorkaroundEntry opcodeDptoaWorkarounds[] = { { GID_LSL6, 360, 938, 0, "ROsc", "cycleDone", -1, 0, { WORKAROUND_FAKE, 1 } }, // when looking through tile in the shower room initial cycles get set to an object instead of 2, we fix this by setting 1 after decrease @@ -52,16 +46,37 @@ const SciWorkaroundEntry opcodeDptoaWorkarounds[] = { SCI_WORKAROUNDENTRY_TERMINATOR }; +// gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry opcodeGeWorkarounds[] = { + { GID_PQ3, 31, 31, 0, "rm031", "init", -1, 0, { WORKAROUND_FAKE, 1 } }, // pq3 english: when exiting the car, while morales is making phonecalls - bug #3037565 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry opcodeMulWorkarounds[] = { + { GID_FANMADE, 516, 983, 0, "Wander", "setTarget", -1, 0, { WORKAROUND_FAKE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry opcodeOrWorkarounds[] = { + { GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xcc6, 0, { WORKAROUND_FAKE, 0 } }, // when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry uninitializedReadWorkarounds[] = { - { GID_CNICK_KQ, 200, 0, 1, "Character", "<noname 446>", -1, 504, { WORKAROUND_FAKE, 0 } }, // checkers, like in hoyle 3 - { GID_CNICK_KQ, 200, 0, 1, "Character", "<noname 446>", -1, 505, { WORKAROUND_FAKE, 0 } }, // checkers, like in hoyle 3 - { GID_CNICK_KQ, -1, 700, 0, "gcWindow", "<noname 183>", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering control menu, like in hoyle 3 - { GID_CNICK_LONGBOW, 0, 0, 0, "RH Budget", "<noname 110>", -1, 1, { WORKAROUND_FAKE, 0 } }, // when starting the game + { GID_CASTLEBRAIN, 280, 280, 0, "programmer", "dispatchEvent", -1, 0, { WORKAROUND_FAKE, 0xf } }, // pressing 'q' on the computer screen in the robot room, and closing the help dialog that pops up (bug #3039656). Moves the cursor to the view with the ID returned (in this case, the robot hand) + { GID_CNICK_KQ, 200, 0, 1, "Character", "<noname446>", -1, 504, { WORKAROUND_FAKE, 0 } }, // checkers, like in hoyle 3 + { GID_CNICK_KQ, 200, 0, 1, "Character", "<noname446>", -1, 505, { WORKAROUND_FAKE, 0 } }, // checkers, like in hoyle 3 + { GID_CNICK_KQ, -1, 700, 0, "gcWindow", "<noname183>", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering control menu, like in hoyle 3 + { GID_CNICK_LONGBOW, 0, 0, 0, "RH Budget", "<noname110>", -1, 1, { WORKAROUND_FAKE, 0 } }, // when starting the game { GID_ECOQUEST, -1, -1, 0, NULL, "doVerb", -1, 0, { WORKAROUND_FAKE, 0 } }, // almost clicking anywhere triggers this in almost all rooms + { GID_FANMADE, 516, 979, 0, "", "export 0", -1, 20, { WORKAROUND_FAKE, 0 } }, // Happens in Grotesteing after the logos + { GID_FANMADE, 528, 990, 0, "GDialog", "doit", -1, 4, { WORKAROUND_FAKE, 0 } }, // Happens in Cascade Quest when closing the glossary - bug #3038757 { GID_FREDDYPHARKAS, -1, 24, 0, "gcWin", "open", -1, 5, { WORKAROUND_FAKE, 0xf } }, // is used as priority for game menu { GID_FREDDYPHARKAS, -1, 31, 0, "quitWin", "open", -1, 5, { WORKAROUND_FAKE, 0xf } }, // is used as priority for game menu - { GID_GK1, -1, 64950, 1, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // sometimes when walk-clicking + { GID_GK1, -1, 64950, -1, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // sometimes when walk-clicking { GID_GK2, -1, 11, 0, "", "export 10", -1, 3, { WORKAROUND_FAKE, 0 } }, // called when the game starts { GID_GK2, -1, 11, 0, "", "export 10", -1, 4, { WORKAROUND_FAKE, 0 } }, // called during the game { GID_HOYLE1, 4, 104, 0, "GinRummyCardList", "calcRuns", -1, 4, { WORKAROUND_FAKE, 0 } }, // Gin Rummy / right when the game starts @@ -69,6 +84,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_HOYLE3, -1, 0, 1, "Character", "say", -1, 504, { WORKAROUND_FAKE, 0 } }, // when starting checkers or dominoes, first time a character says something { GID_HOYLE3, -1, 0, 1, "Character", "say", -1, 505, { WORKAROUND_FAKE, 0 } }, // when starting checkers or dominoes, first time a character says something { GID_HOYLE3, -1, 700, 0, "gcWindow", "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering control menu + { GID_HOYLE4, -1, 0, 0, "gcWindow", "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when selecting "Control" from the menu (temp vars 0-3) - bug #3039294 + { GID_HOYLE4, 910, 910, 0, "IconBarList", "setup", -1, 3, { WORKAROUND_FAKE, 0 } }, // when selecting "Tutorial" from the main menu - bug #3039294 { GID_ISLANDBRAIN, 140, 140, 0, "piece", "init", -1, 3, { WORKAROUND_FAKE, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0 { GID_ISLANDBRAIN, 200, 268, 0, "anElement", "select", -1, 0, { WORKAROUND_FAKE, 0 } }, // elements puzzle, gets used before super TextIcon { GID_JONES, 1, 232, 0, "weekendText", "draw", 0x3d3, 0, { WORKAROUND_FAKE, 0 } }, // jones/cd only - gets called during the game @@ -84,17 +101,19 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_KQ6, 520, 520, 0, "rm520", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // going to boiling water trap on beast isle { GID_KQ6, -1, 903, 0, "controlWin", "open", -1, 4, { WORKAROUND_FAKE, 0 } }, // when opening the controls window (save, load etc) { GID_KQ7, 30, 64996, 0, "User", "handleEvent", -1, 1, { WORKAROUND_FAKE, 0 } }, // called when pushing a keyboard key - { GID_LAURABOW, 44, 967, 0, "myIcon", "cycle", -1, 1, { WORKAROUND_FAKE, 0 } }, // second dialog box after the intro, when talking with Lillian - bug #3034985 + { GID_LAURABOW, 37, 0, 0, "CB1", "doit", -1, 1, { WORKAROUND_FAKE, 0 } }, // when going up the stairs (bug #3037694) + { GID_LAURABOW, -1, 967, 0, "myIcon", "cycle", -1, 1, { WORKAROUND_FAKE, 0 } }, // having any portrait conversation coming up (initial bug #3034985) { GID_LAURABOW2, -1, 24, 0, "gcWin", "open", -1, 5, { WORKAROUND_FAKE, 0xf } }, // is used as priority for game menu - { GID_LAURABOW2, -1, 21, 0, "dropCluesCode", "doit", -1, 1, { WORKAROUND_FAKE, 0 } }, // when asking some questions (e.g. the reporter about the burglary, or the policeman about Ziggy) - bugs #3035068, #3036274 + { GID_LAURABOW2, -1, 21, 0, "dropCluesCode", "doit", -1, 1, { WORKAROUND_FAKE, 0x7fff } }, // when asking some questions (e.g. the reporter about the burglary, or the policeman about Ziggy). Must be big, as the game scripts perform lt on it and start deleting journal entries - bugs #3035068, #3036274 { GID_LAURABOW2, 240, 240, 0, "sSteveAnimates", "changeState", -1, 0, { WORKAROUND_FAKE, 0 } }, // Steve Dorian's idle animation at the docks - bug #3036291 - { GID_LONGBOW, -1, 213, 0, "clear", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When giving an aswer using the druid hand sign code in any room + { GID_LONGBOW, -1, 213, 0, "clear", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When giving an answer using the druid hand sign code in any room { GID_LONGBOW, -1, 213, 0, "letter", "handleEvent", 0xa8, 1, { WORKAROUND_FAKE, 0 } }, // When using the druid hand sign code in any room - bug #3036601 { GID_LSL1, 250, 250, 0, "increase", "handleEvent", -1, 2, { WORKAROUND_FAKE, 0 } }, // casino, playing game, increasing bet { GID_LSL1, 720, 720, 0, "rm720", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // age check room { GID_LSL2, 38, 38, 0, "cloudScript", "changeState", -1, 1, { WORKAROUND_FAKE, 0 } }, // entering the room in the middle deck of the ship - bug #3036483 { GID_LSL3, 340, 340, 0, "ComicScript", "changeState", -1, -1, { WORKAROUND_FAKE, 0 } }, // right after entering the 3 ethnic groups inside comedy club (temps 200, 201, 202, 203) { GID_LSL3, -1, 997, 0, "TheMenuBar", "handleEvent", -1, 1, { WORKAROUND_FAKE, 0xf } }, // when setting volume the first time, this temp is used to set volume on entry (normally it would have been initialized to 's') + { GID_LSL6, 820, 82, 0, "", "export 0", -1, -1, { WORKAROUND_FAKE, 0 } }, // when touching the electric fence - bug #3038326 { GID_LSL6, -1, 85, 0, "washcloth", "doVerb", -1, 0, { WORKAROUND_FAKE, 0 } }, // washcloth in inventory { GID_LSL6, -1, 928, -1, "Narrator", "startText", -1, 0, { WORKAROUND_FAKE, 0 } }, // used by various objects that are even translated in foreign versions, that's why we use the base-class { GID_LSL6HIRES, 0, 85, 0, "LL6Inv", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // on startup @@ -103,16 +122,22 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_MOTHERGOOSE, 18, 992, 0, "AIPath", "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // DEMO: Called when walking north from mother goose's house two screens { GID_MOTHERGOOSEHIRES,-1,64950, 1, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // right when clicking on a child at the start and probably also later { GID_MOTHERGOOSEHIRES,-1,64950, 1, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // see above + { GID_QFG1, -1, 210, 0, "Encounter", "init", 0xbd0, 0, { WORKAROUND_FAKE, 0 } }, // hq1: going to the brigands hideout + { GID_QFG1, -1, 210, 0, "Encounter", "init", 0xbe4, 0, { WORKAROUND_FAKE, 0 } }, // qfg1: going to the brigands hideout { GID_QFG2, -1, 71, 0, "theInvSheet", "doit", -1, 1, { WORKAROUND_FAKE, 0 } }, // accessing the inventory - { GID_QFG2, -1, 701, 0, "Alley", "at", -1, 0, { WORKAROUND_FAKE, 0 } }, // when walking inside the alleys in the town - bug #3035835 - { GID_QFG3, 330, 330, 0, "rajahTeller", "doChild", -1, 0, { WORKAROUND_FAKE, 0 } }, // when talking to King Rajah about "Tarna" - { GID_QFG3, 330, 330, 0, "rajahTeller", "doChild", -1, 1, { WORKAROUND_FAKE, 0 } }, // when talking to King Rajah about "Rajah" - bug #3036390 - { GID_SQ1, 103, 103, 0, "hand", "internalEvent", -1, 1, { WORKAROUND_FAKE, 0 } }, // spanish (and maybe early versions?) only: when moving cursor over input pad - { GID_SQ1, 103, 103, 0, "hand", "internalEvent", -1, 2, { WORKAROUND_FAKE, 0 } }, // spanish (and maybe early versions?) only: when moving cursor over input pad + { GID_QFG2, -1, 701, -1, "Alley", "at", -1, 0, { WORKAROUND_FAKE, 0 } }, // when walking inside the alleys in the town - bug #3035835 & #3038367 + { GID_QFG2, -1, 990, 0, "Restore", "doit", -1, 364, { WORKAROUND_FAKE, 0 } }, // when pressing enter in restore dialog w/o any saved games present + { GID_QFG2, 260, 260, 0, "abdulS", "changeState",0x2d22, -1, { WORKAROUND_FAKE, 0 } }, // During the thief's first mission (in the house), just before the second brother is about to enter the house (where you have to hide in the wardrobe), bug #3039891, temps 1 and 2 + { GID_QFG3, 330, 330, -1, "Teller", "doChild", -1, -1, { WORKAROUND_FAKE, 0 } }, // when talking to King Rajah about "Rajah" (bug #3036390, temp 1) or "Tarna" (temp 0), or when clicking on yourself and saying "Greet" (bug #3039774, temp 1) + { GID_QFG4, -1, 15, -1, "charInitScreen", "dispatchEvent", -1, 5, { WORKAROUND_FAKE, 0 } }, // floppy version, when viewing the character screen + { GID_QFG4, -1, 64917, -1, "controlPlane", "setBitmap", -1, 3, { WORKAROUND_FAKE, 0 } }, // floppy version, when entering the game menu + { GID_QFG4, -1, 64917, -1, "Plane", "setBitmap", -1, 3, { WORKAROUND_FAKE, 0 } }, // floppy version, happen sometimes in fights + { GID_SQ1, 103, 103, 0, "hand", "internalEvent", -1, -1, { WORKAROUND_FAKE, 0 } }, // Spanish (and maybe early versions?) only: when moving cursor over input pad, temps 1 and 2 { GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { WORKAROUND_FAKE, 0 } }, // sub that's called from several objects while on sarien battle cruiser { GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { WORKAROUND_FAKE, 0 } }, // export 1, but called locally (when shooting at aliens) { GID_SQ4, -1, 398, 0, "showBox", "changeState", -1, 0, { WORKAROUND_FAKE, 0 } }, // sq4cd: called when rummaging in Software Excess bargain bin { GID_SQ4, -1, 928, 0, "Narrator", "startText", -1, 1000, { WORKAROUND_FAKE, 1 } }, // sq4cd: method returns this to the caller + { GID_SQ5, 201, 201, 0, "buttonPanel", "doVerb", -1, 0, { WORKAROUND_FAKE, 1 } }, // when looking at the orange or red button - bug #3038563 { GID_SQ6, 100, 0, 0, "SQ6", "init", -1, 2, { WORKAROUND_FAKE, 0 } }, // called when the game starts { GID_SQ6, 100, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu { GID_SQ6, -1, 64964, 0, "DPath", "init", -1, 1, { WORKAROUND_FAKE, 0 } }, // during the game @@ -129,19 +154,38 @@ const SciWorkaroundEntry kAbs_workarounds[] = { // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kCelHigh_workarounds[] = { - { GID_SQ1, 1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // DEMO: Called with 2nd/3rd parameters as objects when clicking on the menu + { GID_KQ5, -1, 255, 0, "deathIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // english floppy: when getting beaten up in the inn and probably more, called with 2nd parameter as object - bug #3037003 + { GID_PQ2, -1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when showing picture within windows, called with 2nd/3rd parameters as objects + { GID_SQ1, 1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // DEMO: Called with 2nd/3rd parameters as objects when clicking on the menu - bug #3035720 SCI_WORKAROUNDENTRY_TERMINATOR }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kCelWide_workarounds[] = { + { GID_KQ5, -1, 255, 0, "deathIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // english floppy: when getting beaten up in the inn and probably more, called with 2nd parameter as object - bug #3037003 + { GID_PQ2, -1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when showing picture within windows, called with 2nd/3rd parameters as objects { GID_SQ1, 1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // DEMO: Called with 2nd/3rd parameters as objects when clicking on the menu - bug #3035720 SCI_WORKAROUNDENTRY_TERMINATOR }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry kDeviceInfo_workarounds[] = { + { GID_FANMADE, -1, 994, 1, "Game", "save", 0xd1c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest) + { GID_FANMADE, -1, 994, 1, "Game", "save", 0xe55, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest) + { GID_FANMADE, -1, 994, 1, "Game", "save", 0xe57, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (I Want My C64 Back) + { GID_FANMADE, -1, 994, 1, "Game", "save", 0xe5c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Most of them) + { GID_FANMADE, -1, 994, 1, "Game", "restore", 0xd1c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest) + { GID_FANMADE, -1, 994, 1, "Game", "restore", 0xe55, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest) + { GID_FANMADE, -1, 994, 1, "Game", "restore", 0xe57, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (I Want My C64 Back) + { GID_FANMADE, -1, 994, 1, "Game", "restore", 0xe5c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Most of them) + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kDisplay_workarounds[] = { { GID_ISLANDBRAIN, 300, 300, 0, "geneDude", "show", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the gene explanation chart - a parameter is an object + { GID_PQ2, 23, 23, 0, "rm23Script", "elements", 0x4ae, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the 2nd page of pate's file - 0x75 as id + { GID_QFG1, 11, 11, 0, "battle", "<noname90>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: When entering battle, 0x75 as id { GID_SQ4, 391, 391, 0, "doCatalog", "mode", 0x84, 0, { WORKAROUND_IGNORE, 0 } }, // clicking on catalog in roboter sale - a parameter is an object { GID_SQ4, 391, 391, 0, "choosePlug", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // ordering connector in roboter sale - a parameter is an object SCI_WORKAROUNDENTRY_TERMINATOR @@ -160,6 +204,8 @@ const SciWorkaroundEntry kDisposeScript_workarounds[] = { const SciWorkaroundEntry kDoSoundFade_workarounds[] = { { GID_CAMELOT, -1, 989, 0, "rmMusic", "fade", -1, 0, { WORKAROUND_IGNORE, 0 } }, // gets called frequently with a NULL reference (i.e. 0:0) - bug #3035149 { GID_KQ1, -1, 989, 0, "gameSound", "fade", -1, 0, { WORKAROUND_IGNORE, 0 } }, // gets called in several scenes (e.g. graham cracker) with 0:0 + { GID_KQ4, -1, 989, 0, "mySound", "", -1, 0, { WORKAROUND_IGNORE, 0 } }, // gets called in the demo when trying to open the non-existent menu with 0:0 - bug #3036942 + { GID_KQ5, 213, 989, 0, "globalSound3", "fade", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // english floppy: when bandits leave the secret temple, parameter 4 is an object - bug #3037594 { GID_KQ6, 105, 989, 0, "globalSound", "fade", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // floppy: during intro, parameter 4 is an object { GID_KQ6, 460, 989, 0, "globalSound2", "fade", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // after pulling the black widow's web on the isle of wonder, parameter 4 is an object - bug #3034567 SCI_WORKAROUNDENTRY_TERMINATOR @@ -167,6 +213,7 @@ const SciWorkaroundEntry kDoSoundFade_workarounds[] = { // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kGetAngle_workarounds[] = { + { GID_FANMADE, 516, 992, 0, "Motion", "init", -1, 0, { WORKAROUND_IGNORE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with third/fourth parameters as objects { GID_KQ6, 740, 752, 0, "throwDazzle", "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // after the Genie is exposed in the Palace (short and long ending), it starts shooting lightning bolts around. An extra 5th parameter is passed - bug #3034610 SCI_WORKAROUNDENTRY_TERMINATOR }; @@ -190,6 +237,7 @@ const SciWorkaroundEntry kGraphSaveBox_workarounds[] = { { GID_ISLANDBRAIN, 290, 291, 0, "upElevator", "changeState",0x201f, 0, { WORKAROUND_STILLCALL, 0 } }, // when testing in the elevator puzzle, gets called with 1 argument less - 15 is on stack - bug #3034485 { GID_ISLANDBRAIN, 290, 291, 0, "downElevator", "changeState",0x201f, 0, { WORKAROUND_STILLCALL, 0 } }, // see above { GID_ISLANDBRAIN, 290, 291, 0, "correctElevator", "changeState",0x201f, 0, { WORKAROUND_STILLCALL, 0 } }, // see above (when testing the correct solution) + { GID_PQ3, 202, 202, 0, "MapEdit", "movePt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077 SCI_WORKAROUNDENTRY_TERMINATOR }; @@ -228,6 +276,13 @@ const SciWorkaroundEntry kGraphRedrawBox_workarounds[] = { }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry kGraphUpdateBox_workarounds[] = { + { GID_PQ3, 202, 202, 0, "MapEdit", "movePt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077 + { GID_PQ3, 202, 202, 0, "MapEdit", "addPt", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when plotting crimes, gets called with 2 extra parameters - bug #3038077 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kIsObject_workarounds[] = { { GID_GK1, 50, 999, 0, "List", "eachElementDo", -1, 0, { WORKAROUND_FAKE, 0 } }, // GK1 demo, when asking Grace for messages it gets called with an invalid parameter (type "error") - bug #3034519 { GID_ISLANDBRAIN, -1, 999, 0, "List", "eachElementDo", -1, 0, { WORKAROUND_FAKE, 0 } }, // when going to the game options, choosing "Info" and selecting anything from the list, gets called with an invalid parameter (type "error") - bug #3035262 @@ -243,13 +298,19 @@ const SciWorkaroundEntry kMemory_workarounds[] = { // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kNewWindow_workarounds[] = { - { GID_ECOQUEST, -1, 981, 0, "SysWindow", "<noname 178>", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // EcoQuest 1 demo uses an in-between interpreter from SCI1 to SCI1.1. It's SCI1.1, but uses the SCI1 semantics for this call - bug #3035057 + { GID_ECOQUEST, -1, 981, 0, "SysWindow", "<noname178>", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // EcoQuest 1 demo uses an in-between interpreter from SCI1 to SCI1.1. It's SCI1.1, but uses the SCI1 semantics for this call - bug #3035057 SCI_WORKAROUNDENTRY_TERMINATOR }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[] = { - { GID_QFG4, 100, 100, 0, "doMovie", "<noname 144>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // after the Sierra logo, no flags are passed, thus the call is meaningless - bug #3034506 + { GID_QFG4, 100, 100, 0, "doMovie", "<noname144>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // after the Sierra logo, no flags are passed, thus the call is meaningless - bug #3034506 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry kSetCursor_workarounds[] = { + { GID_KQ5, -1, 768, 0, "KQCursor", "init", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // CD: gets called with 4 additional "900d" parameters SCI_WORKAROUNDENTRY_TERMINATOR }; @@ -260,6 +321,12 @@ const SciWorkaroundEntry kSetPort_workarounds[] = { }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry kStrAt_workarounds[] = { + { GID_ISLANDBRAIN, 300, 310, 0, "childBreed", "changeState",0x1c7c, 0, { WORKAROUND_FAKE, 0 } }, // when clicking Breed to get the second-generation cyborg hybrid (Standard difficulty), the two parameters are swapped - bug #3037835 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kUnLoad_workarounds[] = { { GID_CAMELOT, 921, 921, 1, "Script", "changeState", 0x36, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: While showing Camelot (and other places), the reference is invalid - bug #3035000 { GID_CAMELOT, 921, 921, 1, "Script", "init", 0x36, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: When being attacked by the boar (and other places), the reference is invalid - bug #3035000 @@ -274,6 +341,7 @@ const SciWorkaroundEntry kUnLoad_workarounds[] = { { GID_LSL6, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident { GID_LSL6, 740, 740, 0, "showCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during ending, 4 additional parameters are passed by accident { GID_LSL6HIRES, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident + { GID_PQ3, 877, 998, 0, "View", "delete", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when getting run over on the freeway, the reference is invalid { GID_SQ1, 43, 303, 0, "slotGuy", "dispose", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when leaving ulence flats bar, parameter 1 is not passed - script error SCI_WORKAROUNDENTRY_TERMINATOR }; diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h index d509d300d7..8a3edb6246 100644 --- a/engines/sci/engine/workarounds.h +++ b/engines/sci/engine/workarounds.h @@ -69,12 +69,15 @@ struct SciWorkaroundEntry { }; extern const SciWorkaroundEntry opcodeDivWorkarounds[]; -extern const SciWorkaroundEntry opcodeOrWorkarounds[]; extern const SciWorkaroundEntry opcodeDptoaWorkarounds[]; +extern const SciWorkaroundEntry opcodeGeWorkarounds[]; +extern const SciWorkaroundEntry opcodeMulWorkarounds[]; +extern const SciWorkaroundEntry opcodeOrWorkarounds[]; extern const SciWorkaroundEntry uninitializedReadWorkarounds[]; extern const SciWorkaroundEntry kAbs_workarounds[]; extern const SciWorkaroundEntry kCelHigh_workarounds[]; extern const SciWorkaroundEntry kCelWide_workarounds[]; +extern const SciWorkaroundEntry kDeviceInfo_workarounds[]; extern const SciWorkaroundEntry kDisplay_workarounds[]; extern const SciWorkaroundEntry kDisposeScript_workarounds[]; extern const SciWorkaroundEntry kDoSoundFade_workarounds[]; @@ -83,6 +86,7 @@ extern const SciWorkaroundEntry kGetAngle_workarounds[]; extern const SciWorkaroundEntry kGraphDrawLine_workarounds[]; extern const SciWorkaroundEntry kGraphSaveBox_workarounds[]; extern const SciWorkaroundEntry kGraphRestoreBox_workarounds[]; +extern const SciWorkaroundEntry kGraphUpdateBox_workarounds[]; extern const SciWorkaroundEntry kGraphFillBoxForeground_workarounds[]; extern const SciWorkaroundEntry kGraphFillBoxAny_workarounds[]; extern const SciWorkaroundEntry kGraphRedrawBox_workarounds[]; @@ -90,7 +94,9 @@ extern const SciWorkaroundEntry kIsObject_workarounds[]; extern const SciWorkaroundEntry kMemory_workarounds[]; extern const SciWorkaroundEntry kNewWindow_workarounds[]; extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[]; +extern const SciWorkaroundEntry kSetCursor_workarounds[]; extern const SciWorkaroundEntry kSetPort_workarounds[]; +extern const SciWorkaroundEntry kStrAt_workarounds[]; extern const SciWorkaroundEntry kUnLoad_workarounds[]; extern SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciTrackOriginReply *trackOrigin); |