Commit Graph
549 Commits
Author SHA1 Message Date
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
Filippos Karapetis 9a96b20cd0 Replaced script_error and CORE_ERROR with error()
svn-id: r42079
2009-07-03 21:59:07 +00:00
Filippos Karapetis 6fa8541aed - Pushed debugstate into debug.h
- When an error occurs, manipulate the execution stack before error() opens the console inside getDebugger(), like FreeSCI did. Added another method for obtaining the SCI console for use by the engine itself.

svn-id: r42062
2009-07-03 14:22:50 +00:00
Filippos Karapetis c3403ac739 Moved some more debug state related variables in the DebugState struct
svn-id: r42044
2009-07-02 23:58:05 +00:00
Max Horn 42de7a1573 Patch
svn-id: r41647
2009-06-18 22:09:57 +00:00
Max Horn 0dcb1fa84f SCI: Got rid of g_EngineState
svn-id: r41359
2009-06-07 23:04:34 +00:00
Walter van Niftrik a6ed05740f SCI: Moved resource36 handling into resource manager.
svn-id: r41349
2009-06-07 19:15:55 +00:00
Max Horn ee21d82948 SCI: Fixed the broken SciEngine::pauseEngineIntern code by ensuring that SciEngine::_gamestate is updated whenever the EngineState gets changed (due to loading a savestate)
svn-id: r41346
2009-06-07 17:18:11 +00:00
Willem Jan Palenstijn 60e02ad6a8 Store long-term pointers to object variables in a new ObjVarRef struct.
Storing them as reg_t* could cause the pointers to become invalid
when they pointed into CloneTable since CloneTable can be re-allocated.

svn-id: r41220
2009-06-06 11:38:20 +00:00
Filippos Karapetis 7c84cca81d Moved some more debug commands to ScummVM's coneole and removed some unused code
svn-id: r41198
2009-06-05 19:04:14 +00:00
Max Horn 10c54394bd SCI: Renamed EngineState::flags and version to _flags and _version (following our conventions); also slightly changed the EngineState constructor to init _version & _flags, and used this to make them constant
svn-id: r41177
2009-06-04 21:44:39 +00:00
Max Horn 870db34cd1 SCI: Renamed _kfuncTable -> _kernelFuncs; and simplified/streamlined the kernel func map in kernel.cpp a bit
svn-id: r41176
2009-06-04 21:42:24 +00:00