aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/savegame.cpp
AgeCommit message (Collapse)Author
2018-09-01SCI32: Add a game option to double the videos in KQ7 by defaultFilippos Karapetis
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-08-27SCI32: Fix broken palette when loading a game in Shivers from the GMMFilippos Karapetis
2018-01-31COMMON: Move VER macro for serializer into common codeColin Snover
2017-10-06SCI32: Clean up scriptWidth/scriptHeight/screenWidth/screenHeightColin Snover
This removes the unnecessary Buffer subclass and stops most places where the output buffer was being interrogated about dimensions instead of GfxFrameout.
2017-10-06SCI32: Clean up GfxPalette32Colin Snover
* Replace raw pointers with smart pointers * Use references instead of const pointers where appropriate * Tweak initialisation * Tweak palette copies to the stack
2017-09-24SCI: Fix generation of save gamesColin Snover
2017-09-23SCI: Split save game metadata writing to separate functionColin Snover
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-23SCI: Use reference instead of pointer for required out-data in metadata save ↵Colin Snover
function
2017-09-08SCI32: Add missing include for ConfManColin Snover
2017-09-08SCI32: Toggle Phant2 content censoring from game optionsColin Snover
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-07-15SCI: Stop double-initialization of SCI0/1 objectsColin Snover
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-06-18SCI: Switch SCI2 games to use Audio32Colin Snover
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-09SCI32: Implement kLock & kDoAudio(1) for SCI32Colin Snover
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-09SCI: Remove unhelpful commentColin Snover
2017-06-09SCI: Add serialization for ResourceIdColin Snover
2017-06-09SCI: Implement Serializable for ObjectColin Snover
2017-05-20SCI: Fix warning about missing base object when loading save gamesColin Snover
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-20SCI: Nitpicky cleanup of some magic numbers and what-not-why commentsColin Snover
2017-05-20SCI: Stop making copies of ObjMap and remove related dead codeColin Snover
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 58190c36b4cc84b3200239211d91b0291301db56 because it has been operating on copies.
2017-05-13SCI32: Make sure all save game validity checks are in kCheckSaveGame32Colin Snover
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-08SCI: Translate messages passed to dialoguesColin Snover
2017-04-30SCI: Clean up ugly syncBaseObject callColin Snover
2017-04-30SCI: Hold script data as mutable internallyColin Snover
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-23SCI32: Fix missing mustSetViewVisible data in cloned objectsColin Snover
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-23SCI32: Serialize Robots in SCI3Colin Snover
This is necessary for at least Lighthouse, which maintains the state of Robots across save games.
2017-04-23SCI: Replace mostly-unused flags property with a single booleanColin Snover
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-23SCI: Convert Object to use Common::Array for SCI3Colin Snover
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-23SCI32: Implement SCI3 Script::syncStringHeapColin Snover
2017-04-22SCI32: Add palette code for late SCI2.1mid+ gamesColin Snover
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-22SCI: Fix compilation when SCI32 is disabledColin Snover
2017-04-22SCI: Do not sync objects when saving gamesColin Snover
Commit 5de2668939a6735da2b3438b7c586fc185791ef8 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-22SCI: Implement delayed restore for SCI32 and move implementations to ↵Colin Snover
GuestAdditions
2017-04-22SCI32: Remove original save/load option from games without ScummVM save ↵Colin Snover
integration
2017-04-22SCI: Clean up unnecessary delayed restore flagsColin Snover
_delayedRestoreGame is always set and cleared at the same time as _delayedRestoreGameId, and _delayedRestoreFromLauncher is written but never read.
2017-04-22SCI: Move ScummVM save/restore to GuestAdditions and reimplement for SCI32Colin Snover
2017-03-27SCI: Implement bounds-checked reads of game resourcesColin Snover
2017-02-18SCI: Remove check that is never triggeredWillem Jan Palenstijn
Since blockSize is asserted to be positive, buf can never be equal to _buf.
2017-01-16SCI: Fix Possible Uninitialized Variable Usages.D G Turner
2017-01-06SCI: Unconditionally save palvary stateWillem Jan Palenstijn
Additionally, add workaround to fix up old QfG3 saves with broken _palVaryPaused state. Fixes bug #9674.
2016-11-02SCI32: Fix missing digital audio playback on save game restoreColin Snover
Fixes Trac#9581.
2016-10-09SCI32: Change storage type of int16 arrays to hold reg_ts insteadColin Snover
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-08SCI: Release SCI music mutex earlier in reconstructPlayListWillem Jan Palenstijn
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-09-30SCI: Bump save game number to fix save game compatibilityColin Snover
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-30SCI32: Give savegame-only methods internal linkageColin Snover
2016-09-30SCI32: Reset saved parts of GfxPalette32 when loading save gamesColin Snover
2016-09-30SCI32: Fix some buildbot compiler warningsColin Snover
2016-09-29SCI: Add prefix to global variable constantsColin Snover
2016-09-29SCI32: Fix warnings and incompatible save games when built without SCI32Colin Snover
2016-09-29SCI32: Emulate MGDX ego view metadataColin Snover
2016-09-29SCI32: Emulate Shivers 1 game score metadataColin Snover