aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script.h
AgeCommit message (Collapse)Author
2017-05-20SCI: Stop leaking locals segments during script reuseColin Snover
When a game deletes a script and then loads the same script again before it has been fully deallocated, SegManager::instantiateScript tries to reuse the same script & locals segments, but it was failing to reuse the old locals segment because Script::freeScript would unconditionally clear the old locals SegmentId, which meant the old locals segment would just leak. This patch does not fix old save games which may contain orphaned locals segments, but should prevent the problem from occurring going forward. (It is possible to clean up these old save games, but this is not a big leak so it doesn't seem worth the extra effort to do so.)
2017-05-20SCI: Refactor relocation codeColin Snover
This groundwork enables an object to look up its static name separately from the normal process that is used to populate Object::_variables when an object is first constructed. (The static name property needs to be able to be retrieved from objects inside of earlier save games whose name properties may have already been modified at runtime, so the code cannot simply pluck the value out of Object::_variables when they are first initialised and then persisted into the save game, as nice and easy as that would have been.) This commit also helps to clarify the situation with relocation tables in SCI1 games that start with a zero entry. Refs Trac#9780.
2017-04-30SCI: Clean up ugly syncBaseObject callColin Snover
2017-04-30SCI: Hold script data as mutable internallyColin Snover
Script buffer data is modified after a script is loaded by savegame operations, and, in SCI16, by string operations. Casting away const to allow these mutations to happen is not a very good design, so this patch just changes the privately held reference to data to be mutable. (Public accessors still return immutable data.)
2017-04-23SCI32: Exclude SCI3 code from compilation when SCI32 is disabledColin Snover
2017-04-23SCI: Fix SCI3 exportsColin Snover
Export functions may be relocated above 64k in SCI3, but exports that do not have an entry in the relocation table must be handled the same as SCI1.1-2.1.
2017-04-23SCI: Fix support for 32-bit SCI3 script offsetsColin Snover
2017-04-18SCI: Fix handling of buggy SCI0 export tablesColin Snover
The previous fix for this bug was incorrect; it only happened to work because of another bug: the number of exports was being read incorrectly (reading the byte size of the export block, not the number of exports), so the validation check for the export number always passed. Then, the "small" offsets that were seen were actually either invalid reads into the header of the next block in the script (KQ4), or reads into the bad first export table which contained an unfilled offset (Camelot). Once the incorrect number of exports was fixed, the previous "fix" broke in KQ4 because the export number validation started to work correctly and the first export table does not have enough entries (needs 2, has 1). This patch fixes the bug by using the last export table in SCI0 scripts instead of the first export table. (This does not affect most scripts, since only the buggy scripts have more than one export table.) Fixes Trac#9731.
2017-03-27SCI: Implement bounds-checked reads of game resourcesColin Snover
2016-11-20SCI: Improve disassembly outputColin Snover
1. pushi opcode now displays decimal value and selector value (if one exists) in-line 2. lofsa, lofss, and super opcodes now display resolved object/class names 3. Opcode arguments are visually aligned
2016-10-20SCI32: Fix zero-offset exportsColin Snover
Exports with a zero offset are supposed to point to the start of the code block in the script hunk, but they were being ignored. This may also apply to SCI1.1 games, but until that can be verified, this fixes the zero-offset in only SCI32 games for now.
2015-05-17SCI: identifyOffsets() counter variablesMartin Kiewitz
2015-05-14SCI: add said-details to script_said debug cmdMartin Kiewitz
2015-05-14SCI: debug commands scro, scrs and script_saidMartin Kiewitz
implement string collecting for SCI3 implement object offset collecting for SCI0-SCI2 implement said-str offset collecting for SCI0-SCI1 add new debug command scro / script_objects add new debug command script_said string without terminating NUL now a warning the latter happens in qfg2 for amiga room 84
2015-05-04SCI: Scripts: identify strings + debug commandMartin Kiewitz
debug command is called "script_strings" / "scrs"
2014-02-18SCI: Make GPL headers consistent in themselves.Johannes Schickel
2013-12-04SCI: script patcher is now a separate classMartin Kiewitz
2013-11-20SCI: script patch for laura bow 2 for audio+textMartin Kiewitz
at the same time needs indepth testing
2013-11-03SCI: improved script patcherMartin Kiewitz
Gabriel Knight + King's Quest 6 patches now also work for Mac versions of those games added support for selectors instead of using hardcoded values
2013-11-01SCI: improved patcher, inventory patch for kq6/macMartin Kiewitz
Also added new debug flag for script patcher
2012-06-26SCI: Rename a parameter in validateExportFunc()Filippos Karapetis
This ensures that it won't be confused with a function with the same name
2012-06-23SCI: Change the program counter (PC) to be a 32-bit variableFilippos Karapetis
This is needed for future support of large SCI3 scripts. The program counter is isolated and does not interfere with other parts of the VM, plus it does not get stored in saved games, so it's pretty straightforward to convert
2012-06-23SCI: Clean up validateExportFunc() and related functionsFilippos Karapetis
Also renamed some SCI3 related code to indicate when it's SCI3 specific
2012-06-15SCI: Replace RAW_IS_OBJECT with a methodFilippos Karapetis
2012-06-15Revert "SCI: Change Script::getObject() to accept a reg_t"Filippos Karapetis
This reverts commit 577d7e41c9ca2c498dc85e41c373fbdca8d2ed41.
2012-06-15SCI: Further cleanup of the script codeFilippos Karapetis
Merge the init() and load() Script methods and reset the script when necessary
2012-06-15SCI: Change Script::getObject() to accept a reg_tFilippos Karapetis
This is needed for upcoming changes to the Script class
2012-06-14SCI: Change the script buffer size to be a size_t as wellFilippos Karapetis
This will be needed in the future to load large SCI3 scripts
2011-11-11SCI: Fix const castWillem Jan Palenstijn
2011-11-05SCI: Updated Script::getObjectMap()Filippos Karapetis
It now returns a reference to the object list instead of copying it
2011-11-05SCI: Made the object map hashmap of the Script class privateFilippos Karapetis
2011-11-05SCI: Made more fields of the Script class private. Some cleanup.Filippos Karapetis
2011-05-25ALL: initialise -> initializeMatthew Hoops
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2010-11-27SCI: Fixed bug #3034713 - "ICEMAN Demo: Fails to find base object"Filippos Karapetis
This could happen because objects in scripts can be in the wrong order. Same thing happens in the French and German version of KQ5 (bug #3035396). Removed the scriptObjRemove() method, which is in fact a hack. svn-id: r54510
2010-11-18SCI3: Add proper support for the calle instructionLars Skovlund
svn-id: r54327
2010-11-17SCI3: relocate operand of the lofsa opcodeLars Skovlund
svn-id: r54301
2010-11-17SCI: More work on SCI3, based on a patch by lskovlunFilippos Karapetis
- Added SCI3 equivalents for access to object selectors - Added SCI3 implementation of object relocation - Added SCI3 implementation of Script::initialiseClasses() svn-id: r54283
2010-11-17SCI: Some more work on SCI3, based on a patch by lskovlunFilippos Karapetis
- Added a SCI3 implementation of Script::load() - Added a SCI3 implementation of Script::initialiseClasses() - Removed some duplicate code svn-id: r54282
2010-11-17SCI: Added the SCI3 equivalent of initialiseObjects(), from a patch by lskovlunFilippos Karapetis
svn-id: r54281
2010-11-08SCI: Some changes regarding the string heap in saved gamesFilippos Karapetis
- Maintain the state of the string heap space in saved games - Merged SegManager::reconstructScripts() inside SegManager::saveLoadWithSerializer() - Disabled a now unnecessary script patch for the cipher puzzle in Castle of Dr. Brain, and performed some cleanup for another disabled patch - Removed direct access to the _baseObj variable of objects svn-id: r54133
2010-11-04SCI: Renamed findBlock() to findBlockSCI0()Filippos Karapetis
svn-id: r54077
2010-09-13SCI: Proper fix for bug #3038837 - "HOYLE3: EGA/VGA Crashes" and some cleanupFilippos Karapetis
System scripts (i.e. 0 and 900-999) are now protected and never destroyed during a game svn-id: r52702
2010-08-06SCI: Split the new script patch code in a separate fileFilippos Karapetis
svn-id: r51810
2010-08-06SCI: Added support for scripts that have more than one export table. Fixes ↵Filippos Karapetis
bug #3039785 - "Conquests of Camelot: Crash in Glastonbury Tor" svn-id: r51805
2010-08-06SCI: adding script patchingMartin Kiewitz
including a patch for hoyle 4 and commenting out the workaround code inside kDisposeWindow svn-id: r51795
2010-08-06SCI: some work on the script patcherMartin Kiewitz
signature matching is working (added hoyle 4 signature) svn-id: r51787
2010-06-28SCI: Clarify docs of GC related SegmentObj methodsMax Horn
svn-id: r50440
2010-06-28SCI: get rid of Script::allocateObjectMax Horn
svn-id: r50438
2010-06-28SCI: Revise GC interface: use Common::Array<reg_t> instead of callbacksMax Horn
This means a little bit more overhead but makes the code much more readable and understandable. svn-id: r50429