Commit Graph
501 Commits
Author SHA1 Message Date
Filippos Karapetis 7f83640894 SCI32: Add a game option to double the videos in KQ7 by default
Scaling works correctly with the Windows variant, which uses AVI files,
but the DOS variant uses Robot videos, and the way scaling is done
there is different, and is not working yet with KQ7 DOS. Nonetheless,
both versions are included in the game, so it's not a major issue.
2018-09-01 13:14:38 +03:00
Filippos Karapetis c978139f10 SCI32: Fix broken palette when loading a game in Shivers from the GMM 2018-08-27 01:50:32 +03:00
Colin Snover 2e061d95c5 COMMON: Move VER macro for serializer into common code 2018-01-31 17:58:01 +01:00
Colin Snover c7c5f28bdb SCI32: Clean up scriptWidth/scriptHeight/screenWidth/screenHeight
This removes the unnecessary Buffer subclass and stops most places
where the output buffer was being interrogated about dimensions
instead of GfxFrameout.
2017-10-06 22:56:26 -05:00
Colin Snover 5cffa3891f SCI32: Clean up GfxPalette32
* Replace raw pointers with smart pointers
* Use references instead of const pointers where appropriate
* Tweak initialisation
* Tweak palette copies to the stack
2017-10-06 22:10:50 -05:00
Colin Snover d73ada9088 SCI: Fix generation of save games 2017-09-24 11:12:45 -05:00
Colin Snover 9298f6a81e SCI: Split save game metadata writing to separate function
RAMA has its own custom save game format that game scripts write,
but we still want to be able to use these save game files from the
ScummVM launcher, so the metadata has to be able to be written
separately from the rest of the game saving.
2017-09-23 20:56:48 -05:00
Colin Snover d17ae077dd SCI: Use reference instead of pointer for required out-data in metadata save function 2017-09-23 20:56:48 -05:00
Colin Snover a447664373 SCI32: Add missing include for ConfMan 2017-09-08 19:10:21 -05:00
Colin Snover f11b0a4ff5 SCI32: Toggle Phant2 content censoring from game options
To enable the optional content censoring mode, Phant2 looks
for a RESDUK.PAT file, which is normally placed by the game's
installer if the user chose to enable censorship. If the file
exists, the game reads an unlock password out of the file and
asks the user to enter the password when starting a new game to
create an uncensored game, or to click a "less intense" button
to start the game with censoring. The censorship state of the
game is then persisted in the save game file, and installations
with the RESDUK.PAT file need to enter the password again in
order to restore any of the uncensored saves.

Since we do not have an installer that can enable this feature,
add a game option toggle to enable/disable censoring (for the
releases that have the optional censorship mode) instead so the
censored content feature is available for anyone that wants to use
it. This flag is restored from ScummVM whenever a save game is
loaded, so it can be toggled on or off at any point without
needing a separate save game, unlike in the original interpreter.
2017-09-08 16:03:24 -05:00
Colin Snover 3bc00e6633 SCI: Stop double-initialization of SCI0/1 objects
These objects should have been initialized only during the first
pass. Double-initialization does not cause any visible problem
problem during normal operation (mostly it just causes memory
waste by making Object::_baseVars/_baseMethod double up their
data), but could have silently allowed games to receive bogus data
for an out-of-bounds property or method index, instead of raising
an error.
2017-07-15 20:29:36 -05:00
Colin Snover d556dcc57b SCI: Switch SCI2 games to use Audio32
Upon investigation of Sound code across SCI32 games, it was
determined that there are actually (at least) 3 different
revisions, not just a single SCI2.1 version. This patch only
changes the parts of Sound code that are relevant to the correct
use of Audio32.

Fixes Trac#9736, Trac#9756, Trac#9767, Trac#9791.
2017-06-18 21:42:58 -05:00
Colin Snover 85e35943fe SCI32: Implement kLock & kDoAudio(1) for SCI32
1. Unlocking all resources of a type using a resource ID of -1 is
   gone in SCI32;
2. Audio locks need to be serialized starting in GK2 for the game's
   modified kDoAudio(1) call;
3. Audio locks in SCI3 must work more like SSCI, since at least
   Lighthouse's `BackMusic::fade` method will attempt to unlock
   audio that was never locked by a script. In SSCI (and now in
   ScummVM too) this is a no-op; previously in ScummVM, it would
   remove Audio32's own lock on the audio resource, resulting in a
   use-after-free;
4. kDoAudio(1) starting in GK2 returns the number of active
   *not-in-memory* channels being played, not the total number of
   active channels.

Fixes Trac#9675.
2017-06-09 23:00:14 -05:00
Colin Snover ddc00e4211 SCI: Remove unhelpful comment 2017-06-09 22:48:14 -05:00
Colin Snover cf98e16d90 SCI: Add serialization for ResourceId 2017-06-09 22:48:14 -05:00
Colin Snover 06e82211ee SCI: Implement Serializable for Object 2017-06-09 22:47:54 -05:00
Colin Snover bc728a1c93 SCI: Fix warning about missing base object when loading save games
This situation occurs rarely, but normally, when unreachable but
not yet GC'd objects use a superclass which has already been GC'd.

Thanks to @wjp for looking at this with me and clarifying what
was going on.
2017-05-20 21:14:18 -05:00
Colin Snover eda836f21a SCI: Nitpicky cleanup of some magic numbers and what-not-why comments 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 1911b19e15 SCI32: Make sure all save game validity checks are in kCheckSaveGame32
Save game metadata validity checks in SCI32 should all exist within
kCheckSaveGame32 since this allows most games to recover
successfully from an attempt to load an invalid save game. If
gamestate_restore fails, the game will usually crash because the
engine is left in an inconsistent state (game scripts have cleaned
up objects in preparation for a game load that is no longer
happening).
2017-05-13 22:46:25 -05:00
Colin Snover c9cbb8e31c SCI: Translate messages passed to dialogues 2017-05-08 11:26:46 -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
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 f3db412d6f SCI32: Serialize Robots in SCI3
This is necessary for at least Lighthouse, which maintains the
state of Robots across save games.
2017-04-23 13:07:25 -05:00
Colin Snover 2906ca9947 SCI: Replace mostly-unused flags property with a single boolean
There does not appear to be any reason to use a bit field instead
of a simple boolean for this one flag, since there are no other
flags that need to be set on Object like this.
2017-04-23 13:07:25 -05:00
Colin Snover 90c6c0580e SCI: Convert Object to use Common::Array for SCI3
In SCI3, index-to-selector tables no longer exist in compiled
object data (instead, the SCI3 VM uses selectors directly and
object data contains a bit map of valid selectors). In ScummVM,
the table is generated by Object::initSelectorsSci3 for
compatibility with the design of the ScummVM SCI VM. For
consistency, _baseVars is converted to use a standard container,
which works for all SCI versions.

The table for SCI3 property offsets is also changed to use a
standard container instead of manually managing the memory with
malloc/free.
2017-04-23 13:07:25 -05:00
Colin Snover d24f5537be SCI32: Implement SCI3 Script::syncStringHeap 2017-04-23 13:07:25 -05:00
Colin Snover e504efe4da SCI32: Add palette code for late SCI2.1mid+ games
Sometime during SCI2.1mid, the palette manager was changed to
save and restore the source palette, and to add in-game gamma
correction. Previously, only the vary start and target palettes
were saved, and gamma correction was only configurable in SSCI by
editing RESOURCE.CFG.
2017-04-22 13:01:37 -05:00
Colin Snover 399551af09 SCI: Fix compilation when SCI32 is disabled 2017-04-22 13:01:37 -05:00
Colin Snover 93b337b833 SCI: Do not sync objects when saving games
Commit 5de2668939 silently changed
behaviour from running this code only when restoring a game, to
running all the time, in an apparent copy-paste error.
2017-04-22 13:01:37 -05:00
Colin Snover 1ed185bbbb SCI: Implement delayed restore for SCI32 and move implementations to GuestAdditions 2017-04-22 13:01:35 -05:00
Colin Snover 6f75bed90c SCI32: Remove original save/load option from games without ScummVM save integration 2017-04-22 13:01:35 -05:00
Colin Snover c8486395fa SCI: Clean up unnecessary delayed restore flags
_delayedRestoreGame is always set and cleared at the same time as
_delayedRestoreGameId, and _delayedRestoreFromLauncher is written
but never read.
2017-04-22 13:01:35 -05:00
Colin Snover ec12c5a342 SCI: Move ScummVM save/restore to GuestAdditions and reimplement for SCI32 2017-04-22 13:01:16 -05:00
Colin Snover 31daa956d6 SCI: Implement bounds-checked reads of game resources 2017-03-27 19:42:31 -05:00
Willem Jan Palenstijn cdfe5a3107 SCI: Remove check that is never triggered
Since blockSize is asserted to be positive, buf can never be equal to _buf.
2017-02-18 15:20:57 +01:00
D G Turner 657e5414fe SCI: Fix Possible Uninitialized Variable Usages. 2017-01-16 07:22:32 +00:00
Willem Jan Palenstijn 740b0bb0ca SCI: Unconditionally save palvary state
Additionally, add workaround to fix up old QfG3 saves with broken
_palVaryPaused state. Fixes bug #9674.
2017-01-06 19:03:50 +01:00
Colin Snover aa0836816d SCI32: Fix missing digital audio playback on save game restore
Fixes Trac#9581.
2016-11-02 15:43:07 -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
Willem Jan Palenstijn 379e3b80da SCI: Release SCI music mutex earlier in reconstructPlayList
This avoids a deadlock where the main thread (via reconstructPlayList)
tries to acquire the mixer lock (in soundPlay) while holding the SCI
music lock, and the audio thread is holding the mixer lock and tries to
acquire the SCI music lock (in miditimerCallback). Bug #6691.
2016-10-08 22:32:13 +02:00
Colin Snover 60be24d973 SCI: Bump save game number to fix save game compatibility
Version 38 save games were added to the 1.9 release branch with
only changes to SCI32 cursor support; shortly thereafter, changes
to the general (SCI16+SCI32) save game metadata were committed to
master -- without bumping the save game version number. This
prevented SCI16 save games from loading correctly in 1.10pre, since
the engine expected that version 38 games would have this extra
metadata, but they don't.
2016-09-30 19:05:14 -05:00
Colin Snover b6b9e2fce4 SCI32: Give savegame-only methods internal linkage 2016-09-30 13:54:10 -05:00
Colin Snover 988865cdc7 SCI32: Reset saved parts of GfxPalette32 when loading save games 2016-09-30 13:54:10 -05:00
Colin Snover 5baff4a1e5 SCI32: Fix some buildbot compiler warnings 2016-09-30 13:54:06 -05:00
Colin Snover 6290f1e5fc SCI: Add prefix to global variable constants 2016-09-29 19:39:16 -05:00
Colin Snover 1847b0f705 SCI32: Fix warnings and incompatible save games when built without SCI32 2016-09-29 19:39:16 -05:00
Colin Snover 0c9d423497 SCI32: Emulate MGDX ego view metadata 2016-09-29 19:39:16 -05:00
Colin Snover 2629269212 SCI32: Emulate Shivers 1 game score metadata 2016-09-29 19:39:16 -05:00