Commit Graph
513 Commits
Author SHA1 Message Date
Willem Jan Palenstijn e2e3f7c4c5 SCI: Move bpk/logkernel to main breakpoint infrastructure
This changes the syntax for bpk and logkernel:

Enable breakpoint on kernel call:

bpk FrameOut

Enable logging for kernel call:

bpk FrameOut log
For backward compatibility this has an alias: logkernel FrameOut

Removing a kernel call breakpoint is done with bp_del/bc now.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn 0f0ecff0b8 SCI: Print breakpoint info on creation 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn 4d34d586a6 SCI: Allow setting bp action directly on creation 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn be84cfdb59 SCI: Add inspect, none breakpoint actions 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn 423ecde8e0 SCI: Move printObject from console to scriptdebug 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn 8e683db72b SCI: Add break/log/backtrace actions for triggered breakpoints
The action can be set using the new console command bp_action/bpact.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn cb69d10e96 SCI: Add underscores to Breakpoint member variables 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn b56a49c53e SCI: Move backtrace output to scriptdebug.cpp 2017-06-10 21:32:35 +02:00
Colin Snover c73bf1c0ce SCI: Add resource hash to resource_info debugger command
Bad resources that need to be blacklisted sometimes seem to have
the same size as good resources. In such cases, the bad resources
can be identified by hash instead. Adding a hash output to
resource_info will make it easy for users to provide the hash of
questionable resources inside of resource bundles that we do not
have access to.

Refs Trac#9797.
2017-05-20 21:52:00 -05:00
Colin Snover bc9835ba5e SCI: Always use SegManager::getObjectName to get object names
This ensures that all object name reading code works the same and
is in one place in the codebase.
2017-05-20 21:14:18 -05:00
Colin Snover 881be25fcd SCI: Stop making copies of ObjMap and remove related dead code
ObjMap owns Objects, so every time this map gets copied instead of
referenced, it creates a copy of every single object in the
associated script. This is expensive, and it breaks things like
the `Object::syncBaseObject` call in savegame.cpp, which hasn't
actually been doing anything since
58190c36b4 because it has been
operating on copies.
2017-05-20 21:14:18 -05:00
Colin Snover 66efb750a0 SCI: Add more support for >16-bit SCI3 offsets
Basically just grepped for getOffset calls being assigned to
uint16s and expanded those to uint32 when they looked trivial.

While some of these changes seem superfluous, at least for the
US/English SCI3 games where potentially impacted game scripts are
not large enough to have a problem with 16-bit offsets (e.g. when
feature detecting the sound type), at least some of these changes
are necessary for correct operation of the find_callk debugger
command in SCI3 games. There should not be a reason why any of
these variables need to be kept as uint16, in any case.
2017-05-20 21:14:18 -05:00
Colin Snover 8bdfb78895 SCI32: Add debugger command to list digital audio samples 2017-04-23 13:07:25 -05:00
Colin Snover 5c5e485ff0 SCI32: Improve debugging output of object metadata in SCI3 2017-04-23 13:07:25 -05:00
Colin Snover fcaf15aa50 SCI: Add alloc_list command to debugger
This command lists all resources that are currently loaded into
memory, plus the number of locks that exist on each loaded
resource.
2017-04-22 19:38:13 -05:00
Colin Snover 4946f149b4 SCI: Improve MidiParser_SCI robustness against bad sound resources
1. KQ4 sound 104 has an extra 0xFC (MIDI Stop command/kEndOfTrack)
   at the end of the resource, which causes an out-of-bounds read
   because the filtering loop continues after the first 0xFC and
   unconditionally attempts to read 2 bytes (expecting there to
   always be a delta value + a command, whereas in this file there
   is only another kEndOfTrack command). This is corrected by
   exiting the filtering loop when a kEndOfTrack is encountered
   and there is not enough data remaining in the resource to
   continue reading.

2. KQ5 sound 699 is truncated, which causes the parser to attempt
   to read past the end of the resource. This is addressed by
   adding bounds checks that exit the mix loop early if there is
   no more data available to read. This allows truncated sounds
   to be played as far as possible (previously, trying to read
   truncated resources would result in a fatal error).

3. midiMixChannels allocates an arbitrary amount of raw memory
   for the mixed MIDI sequence, without performing any bounds
   checking when writing to this memory, potentially leading to
   a crash or silent corruption of adjacent memory. This is
   mitigated by using SciSpan instead of a raw pointer for the
   mixed data.

Fixes Trac#9727.
2017-04-16 12:23:35 -05:00
Colin Snover bd7a62e996 SCI: Fix typo in comment 2017-03-30 19:46:27 -05:00
Colin Snover ceacf7df12 SCI: Handle >64KiB offsets in parse_reg_t 2017-03-30 19:46:27 -05:00
Colin Snover a233696212 SCI: Update formatting strings to match updated Span API 2017-03-30 14:23:41 -05:00
Colin Snover 31daa956d6 SCI: Implement bounds-checked reads of game resources 2017-03-27 19:42:31 -05:00
Colin Snover 10d97ce379 SCI: Fix more unsafe C-string usage 2017-02-05 12:38:21 -06:00
Colin Snover a238f720db SCI32: Fix nitpicky output errors in SCI32 bitmap debugging 2016-12-19 13:56:37 -06:00
Colin Snover 20c211192d SCI32: Add segment table debugging info for SCI32 arrays 2016-12-19 12:47:48 -06:00
Colin Snover 07919b79ba SCI32: Improve SciBitmap segment table debugging output 2016-12-17 18:55:22 -06:00
Colin Snover 4814682d5f SCI: Improve disassembly output
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-11-20 12:31:44 -06:00
Colin Snover 9380b54120 SCI: Add code-address breakpoints to debugger 2016-11-20 12:31:43 -06:00
Colin Snover faaa1a6b1f SCI: Add missing newline in debugger output 2016-11-10 10:49:59 -06:00
Colin Snover a605a891bb SCI: Add reference dump to disk in debugger
This allows references in memory to be dumped to disk for
examination by other tools. In the case of SCI32 bitmaps, data
is output in 8-bit TGA format without transparency, which allows
the current palette to also be examined. (The alternative would
be to use 32-bit TGA to display transparency, and lose the
palette, or dump to a more complicated format that supports 1-bit
transparency.)
2016-11-02 11:27:22 -05:00
Colin Snover d0ec919fb7 SCI: Fix crash when attempting to view invalid list, array, bitmap references 2016-10-09 13:52:04 -05:00
Colin Snover 8c555200d9 SCI32: Change storage type of int16 arrays to hold reg_ts instead
Memory references and integers in SSCI are both 16-bit numbers,
so game scripts frequently (incorrectly) use an IntArray instead
of an IDArray for holding references. Since references in ScummVM
are 32-bit reg_ts, IntArray entries must be large enough to hold
reg_ts in order to be compatible with game scripts that store
references in integer arrays.

The alternative solution is to find and patch all incorrect use of
IntArray across all games. This is possible, but a bit risky from
a save game stability perspective, since incorrect IntArray usage
is sometimes not apparent until well after the array is
instantiated (like GK1's global interview array).

This change invalidates existing SCI32 save games.
2016-10-09 11:21:13 -05:00
Eugene Sandulenko dead4aa014 JANITORIAL: Remove trailing spaces 2016-10-09 14:59:58 +02:00
Colin Snover 4d73736d1f SCI32: Fix compilation warnings 2016-09-29 19:39:16 -05:00
Colin Snover 25c874b9cd SCI32: Add more debugger support for dumping SCI32 arrays 2016-09-29 19:39:16 -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 3cc5e55201 SCI: Fix typo in debugger help 2016-09-29 19:39:16 -05:00
Colin Snover 0f2748b15a SCI32: Implement kRobot 2016-08-19 14:08:22 -05:00
Martin Kiewitz c270b30a79 SCI: Fix pseudo mouse in various SCI1 games like e.g. Larry5
Pseudo mouse was functionality in SCI1+ games, that allowed the
user to control the mouse via keyboard cursor keys.

This new class only worked, when a tiny difference inside
the keyboard driver happened on kMapKeyToDir calls. We previously
tried to enable this behavior depending on cursor type, but
this didn't work correctly (Larry 5 for example was not detected
as such, but had PseudoMouse support).
2016-08-13 14:58:07 +02: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
Colin Snover 4cfc387602 SCI32: Split GfxPalette and GfxPalette32 + HunkPalette 2016-07-11 10:39:50 -05:00
Willem Jan Palenstijn 08f1727b08 SCI: Improve kernel subfunction logging
ExecStack now stores the kernel call number as well as the subfunction.
This allows kStub and backtraces to log the actual subfunction called.

The kernel call number in ExecStack used to be stored in the
debugSelector field. It now has its own field, to avoid confusion.
2016-07-02 21:25:53 +02:00
Colin Snover a613a27b44 SCI32: Implement line drawing (kAddLine/kUpdateLine/kRemoveLine)
This line drawing code lives in a remodelled GfxPaint32 class
that is totally separate from GfxPaint16.
2016-06-21 08:14:12 -05:00
Colin Snover 79ddb9e605 SCI: Allow debugging output of all VM variables in one shot 2016-05-25 12:36:53 -05:00
Johannes Schickel 1c6112e121 SCI: Introduce accessors for SegmentObjTable entries.
This makes code not use _table directly whenever possible. An exception is the
save game code which is not easy to adapt due to design deficiencies.
2016-03-25 01:15:26 +01:00
Colin Snover 13f2a2c3bd SCI32: Add debugger command to view screen items in the visible plane list 2016-03-07 16:46:25 -06:00
Filippos Karapetis cdbd7c8add SCI: Use uint32 instead of unsigned int 2016-03-01 01:12:58 +02:00
Lars Skovlund ca623ff490 SCI: Fix compilation on amigaos4 2016-02-29 20:16:37 +01:00
Lars Skovlund 98878d69b8 SCI: Add vocab994 console command
This is intended for early SCI2, but should work with older SCI too,
not that we need it.
2016-02-29 16:00:13 +01:00
Martin Kiewitz 82165bb6f6 SCI: Improve kAnimate fastcast detection, Remove EQ1 hack
- Add "kAnimate fast cast state" to "version" debug command
- Make it possible for script patcher signatures to get fully
used outside of the regular script patcher
- Remove previous fastcast detections and replace them with
a signature heuristic
- Remove object name checking, when fastcast global is set
- Heuristic detects "fast cast" support incorrectly for multilingual
KQ5, but it seems the game never sets the global, so it won't
matter. KQ5 CD (also SCI1 late) has fastcast support.
- Remove hack in GfxView::draw
- Add lots of comments to ScriptPatcher class

This fixes EcoQuest 1 Floppy showing the anemone on top of the
message box (see bug #5170)
2016-02-23 20:17:18 +01:00
Willem Jan Palenstijn ddcf204bd0 SCI: Add help for debuglevel command 2016-02-21 20:42:06 +01:00