Commit Graph
7940 Commits
Author SHA1 Message Date
Colin Snover 9e839775b6 SCI: Add "patch" directory to search paths
Refs Trac#9776.
2017-05-10 12:04:56 -05:00
Colin Snover 200adb99cf SCI: Add example of KQ6 game with incorrect patches directory 2017-05-10 11:53:26 -05:00
Colin Snover 67b72cc5a8 SCI: Remove unused Robot code from SCI16 audio code 2017-05-10 10:55:00 -05:00
Colin Snover dd13c3be43 SCI: Fix support for ScummVM compressed audio volumes
The runtime code for this had previously relied on hot patching
volume file offsets at the moment that a resource was loaded,
instead of correcting file offsets when reading audio maps. The
code added for sanity checking audio volumes started to report
warnings because the offsets being received were for the original
uncompressed audio volume, which (naturally) is larger than the
compressed audio volume.

This commit also deduplicates code between addResource and
updateResource, and tweaks a validation-related error message for
improved clarity.

Fixes Trac#9764.
2017-05-10 10:55:00 -05:00
Colin Snover c788642b72 SCI: Add ifdef for SCI32 types in processPatch 2017-05-09 00:26:23 -05:00
Colin Snover eb6e179169 SCI: Fix SCI1.1 patch resources
While earlier commits had fixed handling of audio resources in
audio bundles to match SSCI, audio *patches* in SCI16 were still
being treated like standard resource patches. They are now
special-cased in the resource manager, just like SCI32.

Incidentally, while fixing the problem with audio patches, I also
noticed that the patch resource fixes for SQ5/German were very
similar to the special-case operations for resources in SCI32,
though using an odd heuristic. After investigating, it appears
that Sierra SCI1.1 works mostly like SCI32, and not like what
was there from SCI View. So, the old special-case code is deleted
and the special-case code for SCI32 has been expanded to cover
SCI1.1. (SSCI prior to 1.1 do not appear to do this
special-casing.)

Fixes Trac#9773.
2017-05-08 23:59:28 -05:00
Colin Snover ae628c18d4 SCI32: Add workaround for KQ7
Fixes Trac#9763.
2017-05-08 19:45:07 -05:00
Thierry Crozat 916cdd58cd SCI: Add missing files in POTFILES 2017-05-08 19:19:14 +01:00
Colin Snover 13925065cb SCI: Fix unnecessary copy of Common::String 2017-05-08 11:26:47 -05:00
Colin Snover f8d4ffa8ed SCI: Fix Audio36 patch suffix matching against lowercase extensions
The Lighthouse glider demo comes with a file named SDirectX.dll
which was failing to match the case-sensitive suffix search for
.DLL.
2017-05-08 11:26:47 -05:00
Colin Snover 130c9ecbb8 SCI: Fix some issues with ChunkResourceSource
1. The chunk number was hard-coded to zero and inaccessible.
2. Running ResourceManager::getVolumeFile for a chunk resource
   would always return nullptr instead of a stream of the chunk,
   which made it impossible to generically validate that resources
   being added were within bounds of the container file (or, in
   this case, container chunk).
2017-05-08 11:26:46 -05:00
Colin Snover c9cbb8e31c SCI: Translate messages passed to dialogues 2017-05-08 11:26:46 -05:00
Colin Snover 554a73e012 SCI: Improve detection and reporting of resource errors
Simple assertions in the resource manager are not sufficient to
track down resource corruption issues, and some error conditions
that were being checked already were either ignored or only raised
as warnings that casual users would be unlikely to see.

Ideally, error handling in ResourceManager would be improved to
the point where errors would correctly propagate out of it (so the
warning dialogue could be displayed from outside), but right now
error codes are dropped all over the place, and it would take more
effort to fix that without much benefit for the current situation.
If/until someone has the energy to fix that, the warning dialogue
is simply shown from ResourceManager::scanNewSources.

Refs Trac#9764.
2017-05-08 11:26:46 -05:00
Colin Snover a403523faf SCI32: Add workaround for KQ7
Fixes Trac#9759.
2017-05-06 21:45:41 -05:00
Colin Snover c9f22eb1aa SCI32: Add missing ifdef for EngineState::_eventCounter 2017-05-06 21:23:23 -05:00
Colin Snover 8e933b79ec SCI32: Add Spanish Windows KQ7 to detection table
(The DOS version was already listed.)
2017-05-06 20:58:06 -05:00
Colin Snover 57dd79d4dc SCI32: Detect and handle tight loops around kGetEvent
In SSCI, mouse events are received through a hardware interrupt
and the cursor is drawn directly to the graphics card by the
interrupt handler. This allows game scripts to omit calls to
kFrameOut without stopping the mouse cursor from being redrawn
in response to mouse movement.

ScummVM, in contrast, needs to poll for events and submit screen
updates explicitly from the main thread. Submitting screen updates
may block on vsync, which means that this call should really only
be made once per frame, just after the game has finished updating
its back buffer. The closest signal in SCI32 for having completed
drawing a frame is the kFrameOut call, so this is where the
update is submitted (by calling OSystem::updateScreen).

The problem with the approach in ScummVM is that, even though the
mouse position is being updated (by calls to kGetEvent) and drawn
to the backend's back buffer (by GfxCursor32::drawToHardware),
OSystem::updateScreen is never called during game loops that omit
calls to kFrameOut.

This commit introduces a workaround that looks at the number of
times kGetEvent is called between calls to kFrameOut. If the
number of kGetEvent calls is higher than usual (where "usual"
seems to be 0 or 1), we assume that the game is running one of
these tight event loops, and kGetEvent starts calling
OSystem::updateScreen until the next kFrameOut call. We also
then start throttling the calls to kGetEvent to keep CPU usage
down. This fixes at least two such known loops:

1. When interacting with the menu bar at the top of the screen
   in LSL6hires;
2. When restoring a game in Phant2 and sitting on the "click mouse"
   screen.

A similar workaround may also be needed for kGetTime, though loops
around kGetTime should preferably be replaced using a script patch
to call kWait instead.
2017-05-06 19:03:54 -05:00
Colin Snover 604ac1a375 SCI32: Update cursor even when position appears unchanged
This may be masking another bug, but at least what happens in
Phant1 is that the mouse does not get redrawn after being moved
programmatically to the fast-forward button when deviceMoved
returns early.
2017-05-06 19:00:04 -05:00
Colin Snover 85105294f2 SCI32: Add some missing onFrame hooks for the debugger 2017-05-06 10:38:59 -05:00
Colin Snover 8a590e600f SCI32: Disable VMD kPlayFlagBlackPalette flag
Videos in GK2 use this flag (e.g. the chapter 6 intro).

Now that GfxPalette32::updateHardware no longer calls
OSystem::updateScreen (only GfxFrameout::frameOut does this now),
every time a palette swap occurs during playback, there is a frame
of blackness that should not exist. This is because the order of
operation is:

1. Send black palette
2. Call frameOut (which updates the screen)
3. Send new, correct palette
4. No frameOut (so the screen is not updated with the correct
   palette)

OSystem::updateScreen cannot be called multiple times for the same
frame due to vsync, but also, there does not appear to be any
reason to send a black palette, since it seems to be intended to
avoid temporarily rendering video frames with the wrong palette on
a hardware device that cannot guarantee simultaneous application
of a new palette and new pixel data. ScummVM does not have such
a problem, so this feature appears to be unnecessary for us.

For the moment, this 'feature' remains hidden behind an ifdef,
instead of being removed entirely, to avoid potential confusion
when comparing VMD code from SSCI.
2017-05-06 10:38:58 -05:00
Colin Snover 8b49313af3 SCI32: Fix terrible rendering performance when vsync is enabled
More than one call to OSystem::updateScreen per frame on systems
with vsync ruins performance because the call is blocked until
the next vsync interval.

This also fixes bad rendering performance with the OpenGL backend.
2017-05-06 10:38:58 -05:00
Colin Snover 91df45c6c5 SCI32: Fix missing/incorrect game features detection 2017-05-06 10:38:58 -05:00
Colin Snover 575ed98da1 SCI32: Centralize handling of pixel format switches 2017-05-06 10:38:58 -05:00
Colin Snover b73e275b42 SCI32: Micro-optimize speedRoom comparison 2017-05-06 10:38:58 -05:00
Tarek Soliman f30f34cbde SCI32: Set a savegame description if none was entered
This fixes the the SCI32 incarnation of Trac#5343
(defect#3061964): Savegames with no name can't be restored
2017-05-05 12:38:04 -05:00
Colin Snover 8d94a04605 SCI32: Disable game script video benchmarking
The approach to video benchmarking used by SCI engine does not
translate very well to modern video devices -- it will either be
so slow that the games think the system is not capable of showing
normal visual effects, or so fast that the benchmarks overflow
their counters. So, game scripts that perform video benchmarking
are now patched to unconditionally return the highest speed value.

A pleasant but subtle side-effect of this change is that the extra
time sitting at a blank screen before the start of a game (while
benchmarks ran) is now gone.

Fixes Trac#9741.
2017-05-04 23:00:53 -05:00
Martin Kiewitz c057f00eab SCI32: Fix comment about Phantasmagoria 2 changes between EN+DE/FR 2017-05-04 22:17:03 +02:00
Colin Snover db17478d1a SCI32: Add Italian KQ7 detection entry
Fixes Trac#9739.
2017-05-03 16:05:50 -05:00
Martin Kiewitz 73b6f4dc40 SCI32: Fix Japanese Phantasmagoria 2 detection entry 2017-05-03 22:40:15 +02:00
Martin Kiewitz afa2c7bd2b SCI32: Add Japanese Phantasmagoria 2 detection data
Also add a bit of info to the German detection entry of
Phantasmagoria 2. Also add URL to censorship information on our wiki.
2017-05-03 21:45:04 +02:00
Bastien Bouclet e25d472aa9 SCI32: Add detecton for KQ7 1.65c French 2017-05-03 18:53:55 +02:00
Colin Snover ffdfa317f1 SCI32: Add detection entry for French Shivers
Fixes Trac#9742.
2017-05-02 20:35:07 -05:00
Colin Snover 68218d15f2 SCI32: Fix incorrect arguments to readPixel in kCelInfo
Fixes Trac#9750.
2017-05-02 11:00:45 -05:00
Colin Snover bb40889a60 Revert "SCI32: Add debugging calls to GfxCursor32"
This reverts commit c02f2674ad.

Two minutes after committing this, the author of the ticket
resolved the problem, which was caused by missing VMDs.
2017-05-01 21:16:20 -05:00
Colin Snover c02f2674ad SCI32: Add debugging calls to GfxCursor32
Refs Trac#9740.
2017-05-01 20:44:25 -05:00
Colin Snover b208c82494 SCI32: Add support for Shivers interactive demo
Closes Trac#9745.
2017-05-01 12:31:21 -05:00
Colin Snover 6da5a175cb SCI32: Add detection for KQ7 German 1.65c
Closes Trac#9738.
2017-05-01 12:30:57 -05:00
Colin Snover 00168003fe SCI: Clean up ugly syncBaseObject call 2017-04-30 13:44:34 -05:00
Colin Snover 94dc6ae052 SCI: Hold script data as mutable internally
Script buffer data is modified after a script is loaded by
savegame operations, and, in SCI16, by string operations. Casting
away const to allow these mutations to happen is not a very good
design, so this patch just changes the privately held reference
to data to be mutable. (Public accessors still return immutable
data.)
2017-04-30 12:47:32 -05:00
Martin Kiewitz 0560a1d041 SCI32: add detection for GK2 German 2017-04-30 18:46:44 +02:00
Colin Snover 5dd9618842 SCI32: Remove unnecessary GfxFrameout::_frameNowVisible
This flag was used in SSCI to read from VRAM instead of from the
back buffer when a mouse interrupt was received in the middle of
a back buffer update. Since ScummVM controls when mouse events
are received via polling, it is not possible to receive a mouse
event in the middle of back buffer updates, so this code is
unnecessary for the engine to work properly.

This also fixes Valgrind warnings about use of uninitialized
memory at the start of the game, caused by not filling the cursor
memory buffers because `_frameNowVisible` was false until the first
frame was rendered.
2017-04-29 14:31:01 -05:00
Colin Snover 75c6b1fd3b SCI32: Promote GK2 and Torin demos to AGDF_TESTING 2017-04-29 14:30:09 -05:00
Colin Snover 519719db49 SCI: Add var count sanity checking to object initialization 2017-04-24 21:45:49 -05:00
Colin Snover e15a4c806a SCI: Use the var count from the instance's class in SCI1.1-2.1 when looking up selectors
At least some versions of Island of Dr Brain have a bMessager
instance in script 0 with a var count greater than that of its
class. This probably should never happen since it means the
object has a variable with no corresponding selector.

The next commit adds some extra sanity checking code to object
initialization, to warn on any other games where this happens.
2017-04-24 21:39:30 -05:00
Colin Snover 89ec9e6762 SCI32: Remove SCI3 TODO
SCI3 resources appear to already be properly handled.
2017-04-23 22:13:53 -05:00
Colin Snover 82d9cacba0 SCI32: Allow resource maps with missing corresponding volumes
GK2 on Steam comes with an extra bogus resource map file which
would previously cause ScummVM to refuse to load the game due to
a mismatch in the number of map & volume files. This does not
cause any harm, but is a pain for users (since it requires them to
manually delete the file, and it will be recreated if a user runs
the Steam game file integrity check), so allow the game to load
with a warning instead.
2017-04-23 22:11:05 -05:00
Colin Snover 28a06656af SCI: Improve error messages in Script::validateExportFunc 2017-04-23 13:07:25 -05:00
Colin Snover d53f3f6095 SCI32: Exclude SCI3 code from compilation when SCI32 is disabled 2017-04-23 13:07:25 -05:00
Colin Snover 6f95b1a440 SCI32: Fix missing mustSetViewVisible data in cloned objects
This information comes directly from script data and is not
modified at runtime, so it does not need to be persisted in save
games, but does need to be set when reconstructing clones.
2017-04-23 13:07:25 -05:00
Colin Snover a2d7851e4d SCI32: Improve disassembly output of SCI3 property opcodes
Since SCI3 scripts use selectors instead of offsets as operands
to property-related opcodes, the disassembler can look up and
display property names everywhere (unlike SCI2.1 and earlier,
which need to know the object being operated on to look up the
correct selector for a given offset).
2017-04-23 13:07:25 -05:00