Commit graph

425 commits

Author SHA1 Message Date
Willem Jan Palenstijn
cbcd53f1f3 Fix cppcheck issue reported by salty-horse
svn-id: r44541
2009-10-02 15:02:57 +00:00
Willem Jan Palenstijn
0fe40b5053 SCI: Use String::printf instead of temporary buffer
svn-id: r44532
2009-10-02 12:44:12 +00:00
Max Horn
292640b14e SCI: Make NULL_REG & SIGNAL_REG const; change validate_property so that its callers cannot modify NULL_REG accidentally anymore
svn-id: r44531
2009-10-02 11:04:36 +00:00
Filippos Karapetis
6e462c9002 Removed the STRICT_SEND, STRICT_READ and ASSERT_ARITHMETIC defines
svn-id: r44519
2009-10-01 12:41:21 +00:00
Filippos Karapetis
7d40dde96f - Removed the toggle for "weak" validations, as there are cases where they fail (e.g. in Longbow), so there is no point in having strict validations
- Removed the invalid toggle from kernel signatures - we now never error out on invalid object references, but throw a warning instead
- Simplified determine_reg_type()

svn-id: r44511
2009-10-01 10:57:59 +00:00
Willem Jan Palenstijn
168257df24 SCI: Remove outdated debugging hack.
In the past, a negative selector value was used to identify a callk
stack frame. Currently a type of EXEC_STACK_TYPE_KERNEL already does that.

svn-id: r44510
2009-10-01 08:53:10 +00:00
Filippos Karapetis
9efc90c8af Fixed the warning message shown when dummy functions are invoked
svn-id: r44506
2009-09-30 23:13:46 +00:00
Filippos Karapetis
30084d72a5 Added a new special reg_t, SIGNAL_REG, for signaling when an error occurs (usually), or to signal success in some special occasions
svn-id: r44505
2009-09-30 23:00:03 +00:00
Max Horn
8ba75fc522 Fix code formatting (esp. 'if(' -> 'if (' etc., but also indention and other things)
svn-id: r44495
2009-09-30 16:16:53 +00:00
Max Horn
27026f6565 SCI: Replace magic '-42' by an enum
svn-id: r44492
2009-09-30 16:00:44 +00:00
Willem Jan Palenstijn
77bd8d0bfb SCI: Add callk stackframe directly in run_vm
svn-id: r44473
2009-09-30 00:13:59 +00:00
Filippos Karapetis
f9296a6445 - Changed the unimplemented debug SCI kernel functions (InspectObj, ShowSends, ShowObjs, ShowFree, StackUsage and Profiler) to be dummy functions - we have our own debugger, and don't use these functions for debugging
- Removed the function number parameter from all kernel functions, as it's no longer needed, and removed the FAKE_FUNCT_NR hack
- Removed kUnknown() and kStub()
- Dummy/unknown kernel functions are no longer invoked, and a warning is shown instead, with the paremeters passed to them

Note: there is an evil hack used for debugging scripts in invoke_selector(), which probably no longer works now

svn-id: r44461
2009-09-29 14:24:07 +00:00
Willem Jan Palenstijn
88a9099949 SCI: Remove unsafe unmarkDeleted function.
It did not undo all effects of a script being deleted (specifically its
superclasses remain unlocked), causing an inconsistent
state. Also removed EcoQuest CD hack that worked around a specific
instance of this problem.

svn-id: r44449
2009-09-28 20:21:09 +00:00
Willem Jan Palenstijn
77751a0455 SCI: change segment offsets in reg segments to be in half reg_t.
This makes offsets in raw and reg segments consistent, which
fixes string addressing in savegame dialogs.

svn-id: r44396
2009-09-27 12:23:14 +00:00
Filippos Karapetis
13ad217cdd - Moved the SCI version in a global variable
- Changed all the SCI version checks to use getSciVersion()
- Also made getSciVersionDesc a global function (removes some ugly accessing of the SCI engine)

The fallback detector should work correctly now

svn-id: r44269
2009-09-23 10:55:35 +00:00
Filippos Karapetis
5184f86e15 - Merged scriptObjInit0() and scriptObjInit11()
- Replaced some cases where getSciVersion() is used with _resMan->sciVersion(), as getSciVersion() will fail with the fallback detector (as the engine is not initialized). Object property accessors still crash currently, when used with the fallback detector

svn-id: r44261
2009-09-22 14:33:46 +00:00
Max Horn
996b9cc74b SCI: cleanup
svn-id: r44241
2009-09-21 21:39:00 +00:00
Max Horn
d2a6713a8e SCI: Replace IntMapper Script::_objIndices and Common::Array Script::_objects by a HashMap -- goodbye, class IntMapper
svn-id: r44240
2009-09-21 21:38:43 +00:00
Max Horn
5f440854b7 SCI: Add EngineState::_kernel member for convenience
svn-id: r44173
2009-09-17 17:00:36 +00:00
Max Horn
c2455aad87 SCI: Move CallsStruct into vm.cpp, the only place it is being used
svn-id: r44172
2009-09-17 16:56:36 +00:00
Max Horn
f2d2276c4a SCI: Move some selector related function into a new file selector.cpp
svn-id: r44171
2009-09-17 16:53:58 +00:00
Max Horn
eb77efda78 SCI: Add a global getSciVersion() function and make use of it
svn-id: r44170
2009-09-17 16:50:53 +00:00
Max Horn
364640cfd5 SCI: Rename selector_map_t -> SelectorCache and _selectorMap -> _selectorCache
svn-id: r44152
2009-09-17 13:21:42 +00:00
Max Horn
b2c386ed00 SCI: Move parts of struct ScriptState into a new struct DebugState
svn-id: r44151
2009-09-17 13:21:19 +00:00
Max Horn
d861f5c854 SCI: cleanup
svn-id: r44150
2009-09-17 13:20:58 +00:00
Filippos Karapetis
dce185ba8b Made script_lookup_export() a method of SegManager
svn-id: r44140
2009-09-17 09:36:52 +00:00
Filippos Karapetis
f890a69428 Changed the way object selectors are accessed, by removing the relevant defines and adding appropriate methods to the Object structure
svn-id: r44138
2009-09-17 08:51:38 +00:00
Max Horn
280bee663e SCI: Change SegmentId from int to uint16; consistently use segment 0 to indicate an invalid segment
svn-id: r44131
2009-09-17 00:46:01 +00:00
Max Horn
10f898c90e SCI: Rename MemObject -> SegmentObj
svn-id: r44130
2009-09-17 00:45:12 +00:00
Max Horn
68dfdce043 SCI: Turn some SegManager methods into Script methods
svn-id: r44127
2009-09-16 23:32:48 +00:00
Max Horn
a277123f54 SCI: Rename Script class members, change Script from struct to class
svn-id: r44126
2009-09-16 23:32:27 +00:00
Filippos Karapetis
358b5649ce Removed the unused ASSERT()-related code and changed a warning where BREAKPOINT() was used to an error
svn-id: r44041
2009-09-12 17:31:29 +00:00
Filippos Karapetis
90ae20c3ea - Made obj_get and obj_get_name methods of SegManager (getObject and getObjectName, respectively)
- Renamed alloc_List -> allocateList, alloc_Node->allocateNode, alloc_hunk_entry->allocateHunkEntry, free_hunk_entry->freeHunkEntry, for consistency

svn-id: r44039
2009-09-12 00:10:07 +00:00
Max Horn
44b60d2750 SCI: Replace GET_SEGMENT_ANY and GET_OBJECT_SEGMENT macros by new segman methods
svn-id: r43999
2009-09-07 06:07:18 +00:00
Max Horn
fdaa3d423c SCI: Script::obj_indices is now protected
Add new methods init, allocateObject and getObject to class Script, and use them instead of directly accessing Script::obj_indices. Replace RAW_GET_CLASS_INDEX with Script::getObject()

svn-id: r43987
2009-09-06 13:01:00 +00:00
Max Horn
029e3a5703 SCI: cleanup
svn-id: r43984
2009-09-06 12:59:34 +00:00
Max Horn
fdbb167ea3 SCI: Cleanup for some SegManager internals
- rename segGet and getSegment to getScriptSegment; the two can be
  distinguished by the parameter count.
- rename type SCRIPT_GET to ScriptLoadType to conform with our code
  formatting conventions
- rename get_class_address to getClassAddress
- some cleanup

svn-id: r43981
2009-09-06 12:58:16 +00:00
Max Horn
d04b5d2c9b SCI: Rename resManager -> resMan; segManager -> segMan
svn-id: r43980
2009-09-06 12:57:42 +00:00
Max Horn
cd7a32eed0 SCI: Change script_lookup_export to use SegManager::validateExportFunc
svn-id: r43978
2009-09-06 12:56:28 +00:00
Filippos Karapetis
1bbab8f191 Some renaming:
getresourceManager -> getResourceManger
resourceManager -> resMan
segmentManager ->segMan

svn-id: r43908
2009-09-02 12:02:37 +00:00
Walter van Niftrik
53380a2cbf SCI: Fix bug in SCI1.1 varselector search.
svn-id: r43872
2009-09-01 02:50:40 +00:00
Walter van Niftrik
3e543d2518 SCI: Add lofs detection.
svn-id: r43824
2009-08-30 14:53:58 +00:00
Filippos Karapetis
205aa58cf9 Added a safeguard to avoid getting stuck in an endless loop when initializing some problematic scripts in certain demos (e.g. the EcoQuest 1 demo), and fixed the return values of script_instantiate_sci0() in the process
svn-id: r43759
2009-08-26 16:50:22 +00:00
Filippos Karapetis
6e469002dd Formatting
svn-id: r43754
2009-08-26 09:36:54 +00:00
Filippos Karapetis
ac025f4294 - Replaced more cases of EngineState parameters
- Made some version comparisons for old SCI0 versions easier to read
- Removed the GET_SEL32SV macro

svn-id: r43729
2009-08-25 15:14:29 +00:00
Filippos Karapetis
eb83ca267d Silenced warnings (thanks wjp)
svn-id: r43725
2009-08-25 09:02:00 +00:00
Filippos Karapetis
ed66cad677 - Simplified the parameters of some functions
- Replaced some EngineState parameters
- The SCI version is now obtained from the resource manager or the segment manager, thereby simplifying several functions
- Plugged 2 leaks in the fallback detector
- Renamed the segment manager and resource manager to "segmentManager" and "resourceManager" in all places, for consistency

svn-id: r43722
2009-08-25 08:38:14 +00:00
Walter van Niftrik
7359c8f968 SCI: Read class table from vocab resource instead of scanning. This fixes
several "invalid selector" VM crashes caused by duplicate classes.

svn-id: r43680
2009-08-24 01:59:58 +00:00
Filippos Karapetis
60af2db2fd - Added more mappings from Sierra's internal IDs to our own ones. Hopefully, all SCI0-SCI11 games can now be detected correctly from the fallback detector
- Simplified some checks for old script types

svn-id: r43678
2009-08-23 21:57:30 +00:00
Joost Peters
6a3c595b01 remove \n's from error() calls
svn-id: r43571
2009-08-20 21:03:03 +00:00