Commit Graph

484 Commits

Author SHA1 Message Date
D G Turner
d11c61db14 SCI: Fix Missing Default Switch Cases
These are flagged by GCC if -Wswitch-default is enabled.
2019-12-01 05:06:31 +00:00
Filippos Karapetis
9da3d22703 SCI: Fix MSVC warnings
- Remove unused parameters
- Initialize potentially uninitialized variables
- Use Common::String instead of a fixed buffer
- Remove redundant parentheses
- Change float suffix to be uppercase
- Fix spacing
- Fix integer left shifts with boolean variables
- Fix potential division by zero
- Fix missing breaks
2019-05-27 14:53:41 +03:00
Vhati
75daa49d11 SCI: Fix inconsistent debugger breakpoint messages
Fixes bp_function and bp_address not printing the created breakpoint, as
happens with the other bp_ commands.
2019-02-03 10:51:10 +02:00
Vhati
ff45b1da20 SCI: Fix debugger bp_action help message
Fixes the help for bp_action: 'none' arg should be 'ignore'
2019-01-17 14:03:49 +02:00
Lars Skovlund
ff7e490593 SCI32: Display plane id base in version console command 2018-12-28 11:55:32 +02:00
D G Turner
9173223999 SCI: Fix Segfault When Using Console "show_map" Command on SCI32 games.
The _gfxScreen instance is nullptr for SCI32 games, thus this console
command previously caused a segfault.
2018-10-18 22:25:21 +01:00
Filippos Karapetis
941869c466 SCI32: Remove reg32_t and use reg_t in all cases
reg32_t was a transitive solution, before reg_t's were
adapted to use 32-bit addresses internally, and before
support for SCI3 was added. It was introduced as another
way to handle large script offsets in SCI3, and was only
used for the program counter (PC). It's no longer
needed, as we now support SCI3 script offsets using
reg_t's, so we can use make_reg32 in all cases where
we need to access offsets over 64KB
2018-08-25 12:39:12 +03:00
Willem Jan Palenstijn
2e74fd8f22 SCI: Avoid (false positive) uninitialized use warning 2018-02-01 20:19:27 +01:00
Colin Snover
57db3f7535 SCI: Partially clean up SCI16 video playback code 2017-12-01 18:48:35 -06:00
Colin Snover
432fd522d2 ENGINES: Remove default1x scaler flag
This flag is removed for a few reasons:

* Engines universally set this flag to true for widths > 320,
  which made it redundant everywhere;
* This flag functioned primarily as a "force 1x scaler" flag,
  since its behaviour was almost completely undocumented and users
  would need to figure out that they'd need an explicit non-default
  scaler set to get a scaler to operate at widths > 320;
* (Most importantly) engines should not be in the business of
  deciding how the backend may choose to render its virtual screen.
  The choice of rendering behaviour belongs to the user, and the
  backend, in that order.

A nearby future commit restores the default1x scaler behaviour in
the SDL backend code for the moment, but in the future it is my
hope that there will be a better configuration UI to allow users
to specify how they want scaling to work for high resolutions.
2017-10-07 12:30:29 -05:00
Colin Snover
60bdb7936f SCI: Fix disassembly of 32-bit addresses 2017-10-04 00:27:18 -05:00
Colin Snover
2203386ce6 SCI32: Fix audio dumper decompressed size calculation for 16-bit audio 2017-10-03 18:56:35 -05:00
Colin Snover
682b8790fd SCI: Allow multi-step tracing with step-over in debugger 2017-09-19 19:54:30 -05:00
Colin Snover
836f1bdf44 SCI32: Add audio dump debugger command 2017-09-19 19:54:29 -05:00
Colin Snover
29b338fff7 SCI: Add resource integrity dump command to debugger 2017-09-08 16:02:32 -05:00
Colin Snover
109d870990 SCI: Remove already-finished TODO 2017-09-04 15:19:59 -05:00
Colin Snover
67fcb0bdaf SCI: Allow deep inspection of objects in debugger 2017-09-04 15:19:59 -05:00
Colin Snover
8bab5a3467 SCI: Resolve offset names when disassembling object methods 2017-07-23 10:35:13 -05:00
Colin Snover
f6dd8ad290 SCI: Fix audio_list debug command engine version info 2017-07-07 13:25:02 -05:00
Willem Jan Palenstijn
c7d631cb66 SCI: Expand kernel breakpoint pattern matching for negative matches
See matchKernelBreakpointPattern() for samples. The main envisioned use is

DoSound*,!DoSoundUpdateCues

to match all DoSound sub-functions except DoSoundUpdateCues.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
e7b6a257b9 SCI: Change 'none' breakpoint action to 'ignore' for consistency 2017-06-10 21:32:35 +02:00
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