diff options
author | Matthew Hoops | 2010-07-28 19:03:49 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-07-28 19:03:49 +0000 |
commit | 07b67fe44b20f8f1c9dcdf659f5e2666d69834f4 (patch) | |
tree | 60d2c4ff90a13499324b86b6c3377d72607b1d72 /engines/sci | |
parent | 9a1afc5a2473b29a288a808917ed522ac3fac531 (diff) | |
download | scummvm-rg350-07b67fe44b20f8f1c9dcdf659f5e2666d69834f4.tar.gz scummvm-rg350-07b67fe44b20f8f1c9dcdf659f5e2666d69834f4.tar.bz2 scummvm-rg350-07b67fe44b20f8f1c9dcdf659f5e2666d69834f4.zip |
SCI: Fix using the parser in SCI Fan Games
Get a pointer to the said spec instead of copying to a buffer. The fan games use a said spec with size < 64. Also, make said() take a const pointer as the spec cannot change. Thanks to waltervn and wjp.
svn-id: r51432
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/menu.cpp | 10 | ||||
-rw-r--r-- | engines/sci/parser/said.cpp | 4 | ||||
-rw-r--r-- | engines/sci/parser/vocabulary.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 92c0e92f48..120c43f379 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -397,7 +397,6 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) { GuiMenuItemEntry *itemEntry = NULL; bool forceClaimed = false; EngineState *s; - byte saidSpec[64]; switch (eventType) { case SCI_EVENT_KEYBOARD: @@ -437,8 +436,13 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) { itemEntry = *itemIterator; if (!itemEntry->saidVmPtr.isNull()) { - // TODO: get a pointer to saidVmPtr or make said() work on VmPtrs - _segMan->memcpy(saidSpec, itemEntry->saidVmPtr, 64); + byte *saidSpec = _segMan->derefBulkPtr(itemEntry->saidVmPtr, 0); + + if (!saidSpec) { + warning("Could not dereference saidSpec"); + continue; + } + if (said(s, saidSpec, 0) != SAID_NO_MATCH) break; } diff --git a/engines/sci/parser/said.cpp b/engines/sci/parser/said.cpp index 0411952f2a..9c07be2dff 100644 --- a/engines/sci/parser/said.cpp +++ b/engines/sci/parser/said.cpp @@ -657,7 +657,7 @@ static bool buildSaidTree() { return true; } -static int said_parse_spec(byte *spec) { +static int said_parse_spec(const byte *spec) { int nextitem; said_token = 0; @@ -996,7 +996,7 @@ static int augment_parse_nodes(ParseTreeNode *parseT, ParseTreeNode *saidT) { /**** Main code ****/ /*******************/ -int said(EngineState *s, byte *spec, bool verbose) { +int said(EngineState *s, const byte *spec, bool verbose) { int retval; Vocabulary *voc = g_sci->getVocabulary(); diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h index a20508e191..d4df8af715 100644 --- a/engines/sci/parser/vocabulary.h +++ b/engines/sci/parser/vocabulary.h @@ -345,7 +345,7 @@ void vocab_dump_parse_tree(const char *tree_name, ParseTreeNode *nodes); * @param verbose Whether to display the parse tree after building it * @return 1 on a match, 0 otherwise */ -int said(EngineState *s, byte *spec, bool verbose); +int said(EngineState *s, const byte *spec, bool verbose); } // End of namespace Sci |