aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/savegame.cpp
AgeCommit message (Collapse)Author
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
2016-09-29SCI32: Start implementing kSave for SCI32Colin Snover
2016-09-29SCI32: Rewrite kArray & kStringColin Snover
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-08-28SCI32: Fix incorrect/missing cursor after restoring a save gameColin Snover
2016-08-19SCI32: Implement SCI32 cursor supportColin Snover
2016-08-13SCI: Fix sign comparison warningColin Snover
2016-08-13SCI: Fix pointer invalidation caused by array storage movesColin Snover
When objects are added to a SegmentObjTable, it may cause the internal storage for the table to expand and move to a new region of memory. When this happens, all pointers to objects held by a SegmentObjTable of the same type would be invalidated, due to an implementation detail that should not be exposed. To prevent this, objects are now allocated separately on the heap, so even if the table's storage moves due to insertions, the objects owned by the table will not, so references remain valid for the lifetime of the object.
2016-08-06SCI32: Actually save and load remapsColin Snover
2016-08-01SCI32: Implement bitmap save routineColin Snover
2016-08-01SCI32: Fix invalid memory access after BitmapTable is extendedColin Snover
When new bitmaps are added and the underlying Common::Array needs to move to expand, this invalidates all pointers to bitmaps, which makes it basically impossible to use the bitmap segment since you never know if a reference is going to be invalidated due to an array move. To solve this, BitmapTable is changed to hold pointers to SciBitmaps that are allocated separately on the heap instead, so when those bitmaps are looked up, the resulting pointers are valid for the lifetime of the bitmap, instead of the lifetime of the Common::Array used internally by BitmapTable.
2016-08-01SCI32: Add bitmap segment and remove GC option from hunk segmentColin Snover
2016-07-11SCI32: Split GfxPalette and GfxPalette32 + HunkPaletteColin Snover
2016-06-26SCI32: Fix broken Remap implementationColin Snover
Remap would crash SCI2.1early games with 19 remap slots, and did not actually work in most cases in SCI2.1mid+ games. The SCI16 implementation was moved to its own separate file but was otherwise touched as little as possible, so may still have similar problems to the SCI32 code. 1. Split SCI16 and SCI32 code into separate files 2. Use -32 prefixes for SCI32 code and no prefix for SCI16 code, where possible, to match other existing code 3. Avoid accidental corruption of values from the VM that may be valid when signed or larger than 8 bits 4. Added documentation 5. Add missing remap CelObj calls 6. Inline where possible in performance-critical code paths 7. Fix bad `matchColor` function, and move it from GfxPalette to GfxRemap32 since it is only used by GfxRemap32 8. Fix bad capitalisation in getCycleMap 9. Remove unnecessary initialisation of SingleRemaps 10. Update architecture to more closely mirror how SSCI worked 11. Clarify the purpose of each type of remap type (and associated variable names) 12. Split large `apply` function into smaller units 13. Fix buffer overrun when loading a SCI2.1early game with remap 14. Remove use of `#define` constants 15. Warn instead of crashing with an error on invalid input (to match SSCI more closely) 16. Change the collision avoidance mechanism between the RemapType enum and remap kernel functions 17. Add save/load function
2016-05-28SCI32: Remove invalid TODO about CLUT for 16-bit graphicsColin Snover
The CLUT for 16-bit graphics is not saved in SSCI (nor is it normally even part of the palette manager).
2016-04-06SCI: Fix compilation for C++98.Johannes Schickel
2016-03-25SCI: Remove commented out code line.Johannes Schickel
2016-03-25SCI: Use aggregation to store objects in SegmentObjTable.Johannes Schickel
This allows to store pointers and fundamental types in a SegmentObjTable.
2016-03-25SCI: Get rid of template hack for serialization.Johannes Schickel
The former template hack relied on specialized functions for various types. We use a hand crafted set of functions for serialization functionality now.
2016-03-16SCI: Add workaround for restoring kq6 saved games (lowres/hires)Martin Kiewitz
KQ6 CD sets a global depending on lowres/hires state right at the start and some scripts are using it instead of calling kPlatform. This causes some graphics to be incorrect (well lowres) in case the user saves in lowres mode, then switches to hires mode and restores the previously saved game. We now set that global directly after restoring saved games, so that this issue does not happen anymore. KQ6 CD demo did the same.
2016-03-02SCI32: Don't do a syncWithScripts on restore from launcherMartin Kiewitz
Causes issues in at least gk1 (option + inventory plane are shown) Game::restore is not called, when doing restores from launcher, so in the original interpreter this script code wasn't called either. Fixes option + inventory planes etc. being shown right after restoring via launcher, when original save/load dialogs were disabled.
2016-02-22SCI32: Do not clear screen when restoring for SCI32Martin Kiewitz
Fixes graphical issues, when restoring saved games. SCI32 did not clear the screen and also did not even redraw the screen on restore. It only redraws elements that have changed. Behavior verified using TSR in DOSBox (see comments). Also added comment about clearing the screen for SCI16.
2016-02-21SCI32: Fix save patching for ScummVM dialogMartin Kiewitz
- Patch game super object for saving instead of game object - Remove re-adding planes+screen items, game::replay does that We would only have to do that for soft-failing on restore - Change debug levels of kNumLoops/kNumCels to 9 - Add special comment about -info- selector in syncWithScripts() This should now make ScummVM menu saving work properly at least in SQ6.
2016-02-21SCI32: Implement syncing planes+screen items from VM for restoreMartin Kiewitz
Fixes restoring saved games, when ScummVM dialogs are patched in Removing clearing planes+screen items as well, because the scripts actually did that, but did not clear everything. Fixes "Invalid screen item" message when entering options menu, after restoring in SQ6.
2016-02-09SCI: Script patch for Mixed Up Mother Goose SCI1Martin Kiewitz
+ Mother Goose SCI1.1 Fixes graphic issues when restoring from GMM Also make the fix ups for Mixed Up Mother Goose, Jones + PQ2 get applied all the time (debugger command not included)
2016-02-05SCI: Silence false positive warning in MSVCFilippos Karapetis
2016-01-14SCI: Use tick-based timing more consistentlyColin Snover
This means tick-based times are saved to save games, as in SCI32 engine, instead of seconds, which are not accurate enough. It also means places in SCI engine that need to access game ticks should do so through g_sci instead of g_system or g_engine.
2016-01-14SCI: Implement SCI32 kPalVary and kPalette setFadeColin Snover
This also fixes kPalCycle signatures to be more accurate.
2016-01-07SCI32: Add initial support for palette cycling (kPalCycle) and fading (kPalFade)Colin Snover
Graphics palette code was rewritten between SCI1 and SCI2, so SCI32 palette engine code has been moved to a separate GfxPalette32 class.
2015-12-29SCI32: split up SCI2.1 into EARLY/MIDDLE/LATEMartin Kiewitz
- Detection works via signatures (couldn't find a better way) - new kString subcalls were introduced SCI2.1 LATE - kString now has signatures and is split via subcall table - kString fix, so that KQ7 doesn't crash, when starting a chapter - Sci2StringFunctionType removed, because no longer needed
2015-05-03SCI: Clarify function nameWillem Jan Palenstijn
2015-04-27SCI: move SCI32 plane clear to gamestate_restore()Martin Kiewitz
2015-04-26SCI: restore: clear screen when restoringMartin Kiewitz
primarily to clear kPortrait graphics in kq6 when restoring during portrait animation
2015-04-26SCI: restore: reset ports before loading memoryMartin Kiewitz
otherwise we could free hunk space of the loaded saved game
2015-04-26SCI: implement delayed restore via ScummVM menuMartin Kiewitz
will delay restoring a saved game until the next kGetEvent or kWait also implement aborting playback for kPortrait and kShowMovie
2015-04-23SCI: fix Camelot save on map screen bug #6744Martin Kiewitz
don't put restored script windows into _windowList[]
2015-02-15SCI: Use sound resource priority by default for songsWillem Jan Palenstijn
SCI1 sound resources can have an embedded priority. We now use that by default, unless an explicit DoSound/SetPriority call overrides it. Thanks waltervn. This fixes relative priority of songs in at least PQ3 room 29. Also increase savegame version to 33.
2015-02-15SCI: Always re-sort playlist in soundPlayWillem Jan Palenstijn
Previously, it would only sort if a song wasn't already in the playlist. Since initSound already adds it, this effectively prevented the list from being sorted.
2015-02-14SCI: Register and save playBed option to PlaySoundWillem Jan Palenstijn
The playBed option is not handled yet, only stored. This increases the savegame format version.
2014-12-13SCI: Fix comment for workaround.Willem Jan Palenstijn
The previous explanation just wasn't true.
2014-10-19SCI: Add notesWillem Jan Palenstijn