Commit Graph
318 Commits
Author SHA1 Message Date
UrQuan1 b5c2619c94 SCI: Fix broken SQ4 save game deletion
The file extension is the Virtual ID, not the slot.

(cherry picked from commit 32d53da7b11b86bb96e905b9a941497e5fc8354f)
2023-01-24 13:32:47 -08:00
athrxx 47763f7bc1 SCI: (BRAIN) - fix music pause bug
When skipping the intro via 'Esc' and 'Skip' the script
sets up a pause which it won't release later. This brings
our pause counters out of sync and triggers an assert.
This fix should work around this...
2022-11-06 14:13:48 +02:00
Le Philousophe 0b918a5352 SCI: Rename strcpy function to prepare for forbidden name
Even though strcpy in SegManager isn't a problem, our forbidden symbols
list being defined at preprocessor level, we won't be able to use this
name anymore.
2022-10-23 22:46:19 +02:00
athrxx 311b6fec1a SCI: fix sound pausing when loading via kRestoreGame
This is similar to what we recently fixed for the saving. It does concern only the loading from the SCI menu and from the SCI death dialog (that's how it got my attention).

I have written a long comment in SciMusic::resetGlobalPauseCounter()  which explains it.

I have decided to make this very obvious (you could say: more ugly), so it won't cause confusion in the future. Of course, it could be just hidden somewhere deep in SciMusic::saveLoadWithSerializer() and noone would ever notice. But the "ugly" way seemed the safer thing to do...
2022-05-20 09:55:07 +03:00
Donovan Watteau 5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +03:00
sluicebox e01775bcae SCI32: Fix SHIVERS and PHANT2 loading autosave slot
Fixes bug #13361
2022-03-21 15:33:52 -04:00
Filippos Karapetis 74fdf50a9e SCI: Improve the save/load code for saving and checking game versions 2022-01-16 18:36:26 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
sluicebox 5e725d639c SCI: SavegameDesc::name is now always terminated
`SavegameDesc::name` is now easier to understand and safer to use.
Fixes Phant2 regression from 913d943a09
Fixes Phant2 out-of-bounds read in `Console::cmdListSaves`

This was originally always a null terminated string but when SCI32
was added the terminator became optional, leading to a confusing
situation. `name` is now always terminated internally. SCI16 interfaces
continue to terminate the 36th element and SCI32 interfaces continue
to use the first 36 elements as-is.

See: 4357809ce8
2021-12-21 14:38:19 -05:00
sluicebox 91bf813e75 SCI32: Remove kFileIOReadString warning
It's normal for fewer charcters to be available than the maximum buffer
size . Confirmed that nothing depends on not zeroing out the remaining
bytes. (In fact, we've had problems before when not zeroing out buffers
in other kernel functions as scripts have been known to assume success
and use the buffer regardless of the return value.)
2021-11-06 22:31:19 -05:00
sluicebox e5951416d4 SCI: Improve MOTHERGOOSE256 save-id workaround
The existing workarounds for this game's unique way of handling saves
assumed that the player restored a game at some point before the end.
Starting a new game and playing to the end would still cause an error
in the SCI1.1 floppy version because the game's save global would
contain an SCI id instead of our virtual id; we were only patching the
global when restoring.

Now we also patch the global on kSaveGame so that it always contains a
virtual id when there is a saved game.

Note that the existing uninitialized read workaround had no effect since
the read occurred in a local procedure but the workaround entry didn't
include a local procedure signature. Updating that workaround wouldn't
fix this; there would still be scenarios where the wrong save would be
auto-deleted.

Fixes bug #5294
2021-09-08 17:02:36 -05:00
Filippos Karapetis 4241d3fae4 SCI: Fix bug #12808 - restore the behavior of seek() in SCI
With the latest changes to savegame streams, seeking to a location
past the end of a file results in an assert. Restore the previous
behavior, where the file pointer seeks to the maximum available
file location.
2021-08-16 20:20:23 +03:00
djsrv 2aa7e3e558 COMMON: Replace matchString pathMode with general wildcard exclusions
Different characters may need to be excluded for different path styles.
2021-08-09 17:43:12 -04:00
Filippos Karapetis ec20a5fe34 SCI32: Unlock GK1 easter egg at the Voodoo Hounfour
This easter egg is present in script 805. In this easter egg, Gabriel
draws a doodle of Jane Jensen in the whiteboard, if the player uses the
operate action below the whiteboard's eraser. This easter egg looks for
a file named "buster" to be present, so that it is enabled. We always
report that this file exists, to unlock the easter egg.

Special thanks to sluicebox for his awesome work on discovering this
easter egg: https://www.benshoof.org/blog/gabriel-knight-1-easter-eggs
2021-05-27 22:30:41 +03:00
Filippos Karapetis bd7e708fc3 SCI: Move resource related functionality into a separate folder 2020-11-29 14:34:55 +02:00
Zvika Haramaty 1345295bd5 SCI: Hebrew - fix save games encoding
Make sure that Hebrew save games are using UTF8 (otherwise, when saving
in Hebrew it works well from original Sierra save/restore dialogs, but
when loading from ScummVM's dialog, it looks garbled)
2020-10-28 22:17:05 +02:00
sluicebox 3edd7e2b1d SCI: Fix build when SCI32 disabled 2020-04-21 13:44:23 -07:00
sluicebox b57c205e30 SCI: Add support for QFG3 automatic saves
Fixes bug #11421
2020-04-21 12:10:09 -07:00
sluicebox 3c9b28e35d SCI32: Fix parsing digits from save filenames
Fixes KQ7 deleting the wrong save game and other bugs.
Most of these digit strings start with zero and so they've
been parsed as octal instead of decimal.
2020-04-20 22:21:38 -07:00
sluicebox 916ce02661 SCI: Factor save game code into functions
Factors some common save game code into functions and creates an
overload of GuestAdditions::runSaveRestore that doesn't rely on
SCI memory for returning the description string, all of which will
be used by the custom save/restore kMacPlatform32 subops.
2020-04-19 23:33:54 -07:00
Filippos Karapetis f25ffc2eea SCI32: Add a sanity check for array structures in kFileIOReadRaw 2020-03-17 09:36:38 +02:00
Zvika Haramaty 190e47be96 SCI32: fix bug #2053 - refresh the screen before saving the game 2020-02-13 01:09:09 +02:00
sluicebox ab8cf3d77c SCI32: Update kCheckDisc kernel signature for Mac 2020-02-07 13:15:43 -08:00
sluicebox c1fb6562ac SCI32: Add Save/Restore support for Mac games 2020-01-30 16:56:01 -08:00
Filippos Karapetis 3f53bd05f1 SCI32: Add support for raw reading of array structures
These are structures which are stored in the ARC files of the Behind
the Developer's Shield and Inside the Chest demos, included in several
editions of the King's Quest Collection.

The number of elements and element size of each array element are
stored with each array, and are read as raw bytes. We don't need these
in ScummVM, so we skip them.

This change allows the two demos to function fully and correctly now.

Special thanks to sluicebox for working on these files and their
associated game scripts, and figuring out these extra bytes, which
have remained a mystery up to now.
2020-01-21 00:58:08 +02:00
sluicebox 649c801839 SCI: Implement kFileIOCopy
Allows patching a Phantasmagoria 1 script to copy instead of rename.
Although most games can call this through their File:copy script, none
have been discovered yet that do.
2019-12-21 18:26:07 -07:00
sluicebox d43163b37c SCI32: Fix PHANT1 save file interoperability
Phantasmagoria 1 save files are uncompressed because they are small
and interoperable with the original interpreter, but the game scripts
frequently rename them. Renaming save files unconditionally compresses
the result and so only some files have been interoperable.

Phantasmagoria 1 files now remain uncompressed when renamed.
2019-12-09 22:57:46 -08:00
sluicebox b658ef31de SCI32: Fix kFileIOReadRaw when fewer bytes than requested
Fixes censorship password in Phantasmagoria 1
2019-11-25 16:41:15 -08:00
sluicebox ea01e42918 SCI: Fix more kFileIO return values
Fix a number of incorrect return values from file IO functions, continuing
the kFileIOWriteString fix from 7c1fb8bee1

One of the misconceptions was that these functions return DOS error
error codes on failure. Instead, SCI16 immediately zeros those out.
2019-10-11 14:14:15 -07:00
sluicebox 7c1fb8bee1 SCI: Return correct value from kFileIOWriteString
Fixes corrupt save games in Hoyle5, bug #11174
2019-10-02 11:35:34 -07:00
sluicebox 698ca464d7 SCI32: Fix loading autosaves (slot 0)
Fixes bugs in trac #11029:

- Slot 1 loading when user selects slot 0 in ScummVM UI
- Slot 1 loading when slot 0 specified on command line
- QFG4 slot 0 not appearing in game's original Restore UI
2019-09-12 11:58:20 -07:00
Colin Snover 88cd54c057 SCI32: Restore gameplay time in RAMA
This will cause non-linear time shifts in the system timer that
the game's custom save logic may not expect, but in initial testing
the game doesn't seem to care about this.

Fixes Trac#10259.
2017-10-03 18:56:35 -05:00
Colin Snover 128031c6a6 SCI32: Fix crash when dying in RAMA
As it turns out, autorama.sg *is* actually used sometimes.

Fixes Trac#10253.
2017-09-30 11:42:49 -05:00
Colin Snover 7de9c1682b SCI32: Allow save games to be deleted from original save/restore in RAMA 2017-09-28 14:58:18 -05:00
Colin Snover c81348e3fe SCI32: Block RAMA from creating PREF.DAT file
This file normally stores brightness, music volume, and most
recently used save game directory. Since we store the music volume
ourselves and don't use the save game directory, the only
potentially useful information is the brightness level, and that
is fine to just restore from the save games.
2017-09-28 14:58:18 -05:00
Colin Snover 817887216d SCI32: Fix RAMA auto-save game
Despite what game script disassembly lead me to believe, the game
seems to create only one auto-save, which ends up being saved as
911.sg (not autorama.sg). This save file is created just before
entering the underground Avian Lair in New York, and seems to be
designed as some emergency backup since entering the Avian Lair is
a one-way trip.
2017-09-24 22:56:58 -05:00
Colin Snover a63f516df0 SCI32: Replace magic number with kAutoSaveId in QFG4 save code 2017-09-23 20:57:00 -05:00
Colin Snover b038432952 SCI32: Support RAMA's custom save games through kFileIO 2017-09-23 20:56:48 -05:00
Colin Snover b3c27c2159 SCI: Clean-ups to file handling code
Preparations for adding support for RAMA's custom save game format.
2017-09-23 20:37:51 -05:00
Colin Snover 029eeeb803 SCI32: Fix Phant2 "auto-save"
The game has a feature where it will automatically create a save
game when you quit the game through the in-game control panel (or
when you die, for some reason).

Unfortunately, due to bad programming, this automatic save would
just overwrite whatever was in save slot 1 (slot 0 in the original
interpreter). Find this attempt to auto-save the game and redirect
it to the auto-save slot. This might not be totally correct, but
it is at least better than destroying a save game.

Fixes Trac#10201.
2017-09-14 20:45:02 -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 4357809ce8 SCI32: Fix truncated save game names in Phant2
Phant2 creates save game names that append "<PROTECTED>" at the
end of the game name, with an assumption that the game name is
always exactly 36 characters long. This seems to be OK with other
games too (tested GK1, SQ6, and Torin).
2017-07-26 22:02:37 -05:00
Colin Snover dbdbb9b5b3 SCI32: Match 4-language MGDX extra save game data 2017-07-24 19:36:36 -05:00
Filippos Karapetis a8b3b67d29 SCI32: Update some old comments related to virtual files 2017-05-27 14:33:24 +03: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 e06d4a71fb SCI32: Fix missing main menu in LSL7 2017-04-23 13:07:25 -05:00
Colin Snover 5948813169 SCI32: Fix crash when writing word to VIRTUALFILE_HANDLE_SCI32SAVE
This happens in Phant2 when trying to delete a save game from the
in-game save dialogue.
2017-04-23 13:07:25 -05:00
Colin Snover 94524633d7 SCI32: Put Lighthouse restart game in restart save slot 2017-04-23 13:07:25 -05:00
Colin Snover 205f8c4a59 SCI32: Fix call to kFileIOIsValidDirectory in RAMA 2017-04-23 13:07:25 -05:00
Colin Snover 2ccef4a476 SCI32: Implement support for QFG4 autosave 2017-04-22 19:28:35 -05:00