Commit Graph
45 Commits
Author SHA1 Message Date
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
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
Eugene Sandulenko 913d943a09 SCI: Use safer string copying 2021-12-21 00:21:53 +01:00
Orgad Shaneh 940c7bfc14 SCI: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
sluicebox 0983cf9263 SCI32: Fix SaveFileRewriteStream
Fixes Phantasmagoria 1 infinite loop when loading save games

SaveFileRewriteStream depended on MemoryWriteStreamDynamic::_size being
set by MemoryWriteStreamDynamic::ensureCapacity(), but this recently
changed in e83fed6c60
2021-08-18 02:41:28 -05:00
Orgad Shaneh a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Eugene Sandulenko 5e7fe2dc57 JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
sluicebox 89c67944f4 SCI: Always initialize kFileIOReadString output
Addresses bug #12060
2021-02-02 12:44:45 -08: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 b57c205e30 SCI: Add support for QFG3 automatic saves
Fixes bug #11421
2020-04-21 12:10:09 -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
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
sluicebox e36a4be7ce SCI: Fix addAsVirtualFiles creating titles with no files
Fixes QFG game titles appearing on import screens when no character
files exist but save files exist that match fileMask
2019-08-30 18:00:25 -07:00
Colin Snover 24c8a26c75 SCI32: Remove unnecessary negative assertion check on unsigned integer
Fixes CID 1381416.
2017-09-24 22:56:59 -05:00
Colin Snover b038432952 SCI32: Support RAMA's custom save games through kFileIO 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 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 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 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 10d97ce379 SCI: Fix more unsafe C-string usage 2017-02-05 12:38:21 -06:00
Colin Snover 8859c3ccae SCI32: Disable compression on Hoyle5 options files
Compression overhead takes up more space than uncompressed files,
plus the uncompressed files it creates are marginally quicker and
easier to debug with external tools.
2017-01-16 12:16:13 -06:00
Colin Snover b895b4b075 SCI32: Disable compression for Phantasmagoria save files 2017-01-09 19:34:54 -06:00
Colin Snover df38f24c77 SCI32: Fix handling of rewritable files opened with mode 1
In SSCI, all files opened through kFileIO are writable. Most of
the time this does not matter and the engine can get away with
using read-only streams, but when chase.dat is opened by Phant1
from the retry dialogue during the chase, it needs to be writable
because game code puts a '98' marker in the chase data. If this
write does not occur, the game gets stuck in a loop looking for
the marker.
2016-12-18 19:03:30 -06:00
Colin Snover e828deaa46 SCI32: Fix overwriting of file content when opened in append mode
Fixes Trac#9586, Trac#9587.
2016-12-18 19:02:40 -06: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 fba8568484 SCI32: Fix multiple bugs in kSave
1. Shift save numbers up/down for game scripts that rely on save
   game numbers starting from 0 to work correctly
2. Add fake file operations to support KQ7 save games
3. Hide autosave games from native save/load list to match SSCI.
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
Colin Snover 90ee2d799d SCI: Split savegame descriptor fill code from savegame list code
The descriptor is used to check the validity of single savegames
in SCI32.
2016-09-29 19:39:16 -05:00
Colin Snover 64dc37cfe2 SCI32: Start implementing kSave for SCI32 2016-09-29 19:39:16 -05:00
Filippos Karapetis 429759b481 SCI32: Also handle chase.dat in Phantasmagoria like phantsg.dir
This file is used during the chase sequence, and needs the same
read/write logic as phantsg.dir
2016-08-25 21:56:22 +03:00
Willem Jan Palenstijn d832a23241 SCI32: Add SaveFileRewriteStream for read/write access to files
At least Phantasmagoria and PQ:SWAT require this.

This adds a ReadStream/WriteStream to support this. It replaces
the previous VirtualIndexFile which required reimplementation of
most read/write functions.
2016-07-06 21:06:12 +02:00
Martin Kiewitz c61c89dd35 SCI: QfG1/2/3/4 character file detection changed
No longer checking for .sav file suffix, but instead checking
room number instead. The user is able to change the suffix,
which would have resulted in a compressed character file.
2016-02-05 18:40:14 +01:00
Martin Kiewitz 7b1df2174d SCI: fix compatibility issue in kFileIO
Allow 0xFFFF as invalid file handle again for kFileIO calls
Fan game "Dating Pool" opens a non-existant file at the start
and tries to read it, even though it shouldn't do the latter.
The sciAudio adjustments changed our behavior to error() out in
such a case. This commit changes it back to our old behavior to
only print out a warning.
2016-01-05 19:44:45 +01:00
Martin Kiewitz 9d5ee9cba0 SCI: fix sciAudio support on some platforms
The old code expected sciAudio FOpen calls to fail, because they
contained a directory name. On AmigaOS those calls succeeded.
Because of that at least on AmigaOS, sciAudio support didn't
work at all.

We now detect sciAudio FOpen calls and return a proper virtual file
handle. This should fix it on all platforms.

Also moved the SCI32 virtual save file handle from 200 to 32100.
2016-01-02 21:50:35 +01:00
Martin Kiewitz e75367ab3b SCI: sort qfg import files alphabetically 2015-04-17 23:48:18 +02:00
Johannes Schickel 8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Johannes Schickel 89abab97e3 JANITORIAL: Remove trailing whitespaces.
Powered by:
git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//'
2012-09-26 04:17:55 +02:00
Filippos Karapetis eb8230988a SCI: Don't compress exported heroes in the Quest for Glory games
This allows them to be used by other games in the series not supported
by ScummVM (i.e. QFG4, QFG5 and the fanmade AGS version of QFG2)
2012-06-21 12:15:25 +03:00
Filippos Karapetis 2b50824133 SCI: Add setter/getter methods to reg_t's
No functionality change has been made with this commit. This avoids
setting and getting the reg_t members directly, and is the basis of any
future work on large SCI3 scripts (larger than 64KB)
2012-06-18 05:24:06 +03:00
Filippos Karapetis 5ca22a1104 SCI: Fix warnings
Thanks to DrMcCoy for reporting them
2012-06-15 22:32:15 +03:00
Filippos Karapetis e4f08a4644 SCI: Fix the loading screen and the loading functionality in Shivers
Shivers uses extra special hardcoded save files together with the normal
ones that are used to store slot names and spot descriptions. The scheme
is a bit odd, and since the names of the extra save files are hardcoded,
this scheme is problematic to use. We skip the creation of these files
altogether and use virtual files instead, which means that the
(broken) spot descriptions won't be visible next to each save
description. This isn't a major issue for now, and it's left as a future
TODO to implement this feature in a cleaner way, and not with extra save
files. This scheme fixes the slot descriptions in the loading screen.
Also, kCD(1) has been implemented, which fixes loading of the save
states themselves
2012-06-13 22:56:43 +03:00
Filippos Karapetis 5a17ea0585 SCI: Move all file-related functions in file.*
This way, there is a clear separation of the actual SCI kernel file
functions and the file classes and wrappers of ScummVM
2012-06-13 12:26:53 +03:00
Filippos Karapetis aeac51d726 SCI: Implement the file operations needed for the save dialog in Phantasmagoria
Phantasmagoria's scripts keep polling for the existence of the savegame
index file and request to read and write it using the same parameters
when opening it. The index file is closed and reopened for every save
slot, which is slow and can be much slower on non-desktop devices.
Also, the game scripts request seeking in writable streams and request
to expand the existing index file.

To provide this functionality and to reduce constant slow file opening
and closing, this virtual class has been introduced
2012-06-13 12:26:49 +03:00