Commit graph

138 commits

Author SHA1 Message Date
Colin Snover
ad05bfedd8 SCI: Expose API for retrieving multiple objects with the same name
This is needed by Phant2 guest additions to find the correct
slider for the music volume, since the sliders have no unique name.
2017-07-30 19:10:50 -05:00
Colin Snover
70d1edf615 SCI32: Add validity checks to kList iteration methods
In GK2, restoring a save game causes the segment manager to reset
in the middle of a kListFirstTrue call, which invalidates all
pointers and reg_ts to stored data. This means that when
kListFirstTrue tries to decrement the list recursion counter at
the end of iteration, it is writing to freed memory, potentially
resulting in heap corruption.

SCI3 added checks to prevent this from happening, but these checks
seem like they should have also been applied to some SCI2.1 games
as well (like GK2).

Since there should be no negative side-effect to this check, it
is applied universally to all SCI32 games.
2017-01-05 16:00:59 -06:00
Colin Snover
b011af9485 SCI: Remove unused second parameter to SegManager::getString 2016-12-18 19:02:41 -06:00
Colin Snover
40444b0aeb SCI32: Clarify some identifiers
transparentColor -> skipColor
displace -> origin
scaledWidth -> xResolution
scaledHeight -> yResolution
2016-10-09 11:21:46 -05:00
Colin Snover
3f91726765 SCI32: Rewrite kArray & kString
This change invalidates earlier SCI32 save games, which separated
arrays and strings in an incompatible manner. Old save games
contain invalid references to a string segment which no longer
exists, and contain incompatible array structures that lack
critical type information.
2016-09-29 19:39:16 -05:00
Colin Snover
79d9e0af68 SCI32: Address TODO in seg_manager.h 2016-08-19 13:57:40 -05:00
Colin Snover
2071196f42 SCI32: Add bitmap segment and remove GC option from hunk segment 2016-08-01 10:37:14 -05:00
Colin Snover
4a637d65c3 SCI32: Enable optional explicit memory management of hunk entries
Bitmaps in ScrollWindow and Robot code are managed by the kernel
and not by game scripts, although they must be able to be
referenced through a reg_t. To prevent incorrect GC of bitmaps
that are in use but not referenced by any game script, explicit
memory management of hunk entries can be enabled.
2016-08-01 10:37:14 -05:00
Johannes Schickel
71b665b617 SCI: Indent comment properly. 2016-01-15 15:50:38 +01:00
Lars Skovlund
9e672dab60 SCI3: Add comment re new function 2016-01-15 03:14:34 +01:00
Filippos Karapetis
a5a531ec9f SCI: Use the actual segment in the segment manager for SCI3 games 2016-01-15 02:48:37 +02:00
Johannes Schickel
8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Martin Kiewitz
eaf6367bb2 Merge branch 'master' of github.com:scummvm/scummvm 2013-12-04 20:42:50 +01:00
Martin Kiewitz
8bdffcb2fb SCI: script patcher is now a separate class 2013-12-04 20:42:16 +01:00
Strangerke
6795fdf639 SCI: Janitorial - Fix spacing errors 2013-11-23 11:02:24 +01:00
Filippos Karapetis
f6e4312665 SCI: Add a hack for a bug in the script handling code
When resetting the segment manager, sometimes the locals block for a
script is placed in a segment smaller than the script itself. This
shouldn't be happening, but it isn't fatal, however it should be resolved
in a proper manner
2012-07-02 12:49:10 +03:00
Filippos Karapetis
a0add53c60 SCI: Change getClassAddress() to only require the caller segment
The caller offset is never actually used inside the function
2012-06-15 22:32:17 +03:00
Filippos Karapetis
267c6f1756 SCI: Made more fields of the Script class private. Some cleanup. 2011-11-05 03:00:42 +02:00
Matthew Hoops
9539017ee3 ALL: initialise -> initialize 2011-05-25 11:17:11 -04:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
md5
ca1f9a075f SCI: Got rid of VERIFY() and removed some newlines in error messages 2011-03-14 20:00:26 +02:00
md5
5c504739bd SCI: Removed unnecessary parameter from deallocate() 2011-03-09 23:33:26 +02:00
Filippos Karapetis
aa15235858 SCI: Slight cleanup
svn-id: r54925
2010-12-15 23:35:21 +00:00
Filippos Karapetis
de2ef2edc0 SCI: Removed the system strings code and replaced it with a much more simplified version, thus greatly simplifying handling of system strings
svn-id: r54805
2010-12-07 00:47:05 +00:00
Filippos Karapetis
5de2668939 SCI: Some changes regarding the string heap in saved games
- 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-08 00:18:34 +00:00
Filippos Karapetis
9699f8291d SCI: Ignoring non-critical script bug in QFG1VGA, when closing any conversation dialog with esc (doesn't affect gameplay in any manner)
svn-id: r51572
2010-08-01 11:10:14 +00:00
Filippos Karapetis
634d959897 SCI: Fixed the crash in LSL2, room 42 (when arriving at the island). kAnimate may refer to unfrozen objects which have been deleted, thus handle that case accordingly.
svn-id: r51152
2010-07-22 17:25:21 +00:00
Max Horn
b8904a48ed SCI: Make SegManager::_heap private
svn-id: r50552
2010-07-01 16:05:29 +00:00
Max Horn
c822cd67cb SCI: Make SegManager::_classTable private.
This require a small tweak to the save/load code: I moved the syncing
logic for _classtable from EngineState::saveLoadWithSerializer to
SegManager::saveLoadWithSerializer, which in theory should have no
effect (luckily, _classtable was being synced right after the
segment manager).

svn-id: r50551
2010-07-01 16:05:10 +00:00
Max Horn
36799dc83f SCI: Add SegManager::getSystemString() method
svn-id: r50550
2010-07-01 16:04:48 +00:00
Max Horn
3f429d64a2 SCI: Rename some variables to match our naming conventions
svn-id: r50549
2010-07-01 16:04:29 +00:00
Max Horn
b3011faaef SCI: Make various SegManager const
svn-id: r50439
2010-06-28 12:28:12 +00:00
Filippos Karapetis
4a60ff4090 Made the script initialization/uninitialization methods part of the segment manager
svn-id: r50402
2010-06-27 21:18:19 +00:00
Filippos Karapetis
2843feeb9a SCI: Made the code for initializing script classes, objects and locals part of the Script class
svn-id: r50398
2010-06-27 21:00:34 +00:00
Filippos Karapetis
bb992b0b93 SCI: Moved all the script-related code inside script.cpp/.h, and all script opcode-related code inside vm.cpp/.h
svn-id: r50396
2010-06-27 20:38:43 +00:00
Filippos Karapetis
aa9b9dd08f SCI: Separated the code for initializing script classes from the code for initializing script objects
svn-id: r50390
2010-06-27 20:09:51 +00:00
Filippos Karapetis
3cf0114164 Moved script_instantiate_sci0() inside the segment manager, and renamed it to scriptInitialiseObjectsSci0()
svn-id: r50357
2010-06-26 23:13:05 +00:00
Max Horn
651e2760a3 Fix spelling, cleanup
svn-id: r49843
2010-06-15 12:33:20 +00:00
Filippos Karapetis
cd77cb96fc Some cleanup of the script locals code
svn-id: r49649
2010-06-14 12:44:57 +00:00
Filippos Karapetis
b5ebd40d61 The offset of script local variables is now calculated when the script is loaded, thus we no longer need to save it. Merged scriptInitialiseLocals() with scriptInitialiseLocalsZero()
svn-id: r49640
2010-06-13 22:15:30 +00:00
Filippos Karapetis
5ba761a687 Made reconstruct_stack() a member of SegManager
svn-id: r49503
2010-06-08 13:16:30 +00:00
Filippos Karapetis
e083c20da1 The system strings segment is a fixed segment of the segment manager, which doesn't change during the game, thus move all the system strings code and variables inside the segment manager
svn-id: r49372
2010-06-01 14:41:48 +00:00
Filippos Karapetis
5f2ff0b1e7 Limit access to the _classTable array (now it's directly accessible only inside saveLoadWithSerializer()
svn-id: r49318
2010-05-29 23:56:37 +00:00
Filippos Karapetis
d3bcb10861 Cleanup
svn-id: r49312
2010-05-29 15:47:28 +00:00
Filippos Karapetis
6f056c6c98 Added a method to the resource manager, to limit the places where script exports are accessed, since for SCI11 and newer exports can be functions and objects (first step in removing scriptRelocateExportsSci11(), which is a gross hack and it fails in QFG1VGA)
svn-id: r49308
2010-05-29 14:03:08 +00:00
Filippos Karapetis
2c2a1fa1ba Made _k_new_node() a method of the segment manager, and fixed a bug with the rarely used SCI0 kernel function kSort in the process (_k_new_node was called with key, value instead of value, key inside kSort)
svn-id: r49251
2010-05-26 22:05:51 +00:00
Filippos Karapetis
174a043aa7 Removed the exportsAreWide variable from the segment manager and save games, and moved validateExportFunc() in the Script class, thus resolving a TODO
svn-id: r49093
2010-05-19 08:50:24 +00:00
Filippos Karapetis
f3892a506b - Removed the wrapper kalloc, kmem and kfree functions. Now, the associated Segment manager functions allocateHunkEntry, getHunkPointer and freeHunkEntry are used directly (which are more descriptive, anyway)
- Replaced the GET_SEGMENT macro by a method of the segment manager
- Removed the unused reference to the created hunk in allocateHunkEntry(), only the reg_t reference to it is returned now

svn-id: r49078
2010-05-18 13:05:09 +00:00
Max Horn
bca7c6eef3 SCI: Move more stuff around
svn-id: r47836
2010-02-03 01:34:15 +00:00
Johannes Schickel
aed02365ec Strip trailing spaces/tabs.
svn-id: r47541
2010-01-25 01:39:44 +00:00