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
Filippos Karapetis
ca9bbce9b3
- Added game ID detection to the fallback detector. We still need to map some of Sierra's internal IDs to our own ones
...
- The class table is now created in the segment manager constructor
svn-id: r43504
2009-08-18 10:01:18 +00:00
Filippos Karapetis
c38f58598b
- Simplified some functions to accept only the parts of the EngineState they need as parameters, instead of the whole EngineState
...
- Moved the class table in the Segment manager - it's the only class using it directly
- Removed the sci11 flag from save games (we already know this, we don't need to store it)
- Moved script_get_segment() and get_class_address() inside the segment manager class
- Removed the script_locate_by_segment wrapper
- Simplified script_lookup_export() a lot by removing some paranoia checks
- Added some WIP code for automatically determining the game id in the fallback detector (still not working)
- General cleanup
svn-id: r43458
2009-08-17 05:55:21 +00:00
Walter van Niftrik
65e9ae163f
SCI: Added a crude speed throttler.
...
svn-id: r43289
2009-08-11 20:18:15 +00:00
Walter van Niftrik
867b1c2b4d
SCI: Fix warnings.
...
svn-id: r43218
2009-08-10 18:43:15 +00:00
Willem Jan Palenstijn
3c8e328e5c
SCI: check shouldQuit() in main loop
...
svn-id: r42609
2009-07-19 10:50:14 +00:00
Willem Jan Palenstijn
8cb1cbfa7a
SCI: Fix breakpoints
...
svn-id: r42599
2009-07-18 22:46:07 +00:00
Willem Jan Palenstijn
a1bb715611
SCI: Fix stepping in debugger
...
svn-id: r42587
2009-07-18 12:51:12 +00:00
Filippos Karapetis
31a0c80905
Moved the kernel and the vocabulary outside of the engine state (they're static data, which never changes during a game)
...
svn-id: r42398
2009-07-11 23:45:54 +00:00
Filippos Karapetis
763c6c8ca1
Fixed regression in the script parser from commit 42260
...
svn-id: r42371
2009-07-11 06:19:29 +00:00
Filippos Karapetis
5ca94c5cce
- Moved printObject inside the Console class
...
- Enabled the parts where disassemble() is called
svn-id: r42263
2009-07-08 13:08:51 +00:00
Filippos Karapetis
62499054a0
Some cleanup for the script debugger code:
...
- Renamed struct DebugState to ScriptState and r_amp_rest to restAdjust inside EngineState. Changed restAdjust to be a uint16 (actually it is a uint16, but it was being casted back and forth from an unsigned integer, so this clears up its type and size)
- Moved the script state variables from inside the run_vm() into the ScriptState struct, so that they can be accessed by the console commands and the script debugger all the time, and removed the weird isValid code
svn-id: r42260
2009-07-08 10:25:37 +00:00
Filippos Karapetis
d55f7e72d0
Added auto-detection for games with older headers for script blocks, and removed game flag GF_SCI0_OLD
...
svn-id: r42211
2009-07-07 10:28:05 +00:00
Filippos Karapetis
e4f6330418
Added a SCI1.1 case in the lofss opcode, like in the lofsa opcode (essentially, lofss and lofsa both load an offset, with lofsa loading it in the accumulator and lofss in the stack). lofss is rarely used in SCI1.1 games, which explains why no lofss-related crashes have been observed in SCI1.1
...
svn-id: r42209
2009-07-07 07:51:26 +00:00
Filippos Karapetis
522b161bec
Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls
...
svn-id: r42167
2009-07-06 10:39:22 +00:00
Filippos Karapetis
5c60d94725
SCI1 games with absolute parameters to lofs instructions are automatically detected now. Removed the GF_SCI1_LOFSABSOLUTE game flag
...
svn-id: r42118
2009-07-05 11:08:53 +00:00