diff options
author | Willem Jan Palenstijn | 2009-02-20 23:41:15 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-02-20 23:41:15 +0000 |
commit | abbca80d6190c1bd183ad3794dbb5b8103a7c833 (patch) | |
tree | 63b0dce9841ac3899947d436eb9d9a1743aa3d92 /engines/sci/include | |
parent | c5abad4deaca7f9cdc8f0dedeb656779cac3a703 (diff) | |
download | scummvm-rg350-abbca80d6190c1bd183ad3794dbb5b8103a7c833.tar.gz scummvm-rg350-abbca80d6190c1bd183ad3794dbb5b8103a7c833.tar.bz2 scummvm-rg350-abbca80d6190c1bd183ad3794dbb5b8103a7c833.zip |
Converted SCI saving to use saveFileMan. Instead of a savegame being
a directory with an id and a state file, a savegame now consists of
two consecutive CFSML-serialized structs: SavegameMetadata and state_t.
The former contains the savegame title, and is loaded when scanning saves.
svn-id: r38649
Diffstat (limited to 'engines/sci/include')
-rw-r--r-- | engines/sci/include/engine.h | 30 | ||||
-rw-r--r-- | engines/sci/include/vm.h | 12 |
2 files changed, 25 insertions, 17 deletions
diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index 5b6330587f..374572d510 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -28,6 +28,11 @@ #include "common/scummsys.h" +namespace Common { + class SeekableReadStream; + class WriteStream; +} + // FIXME. Remove after transiton to File class #include <sys/stat.h> @@ -44,8 +49,8 @@ #include "sci/include/gfx_state_internal.h" #include "sci/include/sfx_engine.h" -#define FREESCI_CURRENT_SAVEGAME_VERSION 7 -#define FREESCI_MINIMUM_SAVEGAME_VERSION 7 +#define FREESCI_CURRENT_SAVEGAME_VERSION 8 +#define FREESCI_MINIMUM_SAVEGAME_VERSION 8 #ifdef WIN32 # define FREESCI_GAMEDIR "FreeSCI" @@ -81,6 +86,16 @@ typedef struct { int palette; } drawn_pic_t; +// Savegame metadata +struct SavegameMetadata { + const char *savegame_name; + int savegame_version; + char *game_version; + sci_version_t version; + int savegame_date; + int savegame_time; +}; + typedef struct _state { int savegame_version; @@ -266,21 +281,26 @@ typedef struct _state { #define STATE_T_DEFINED int -gamestate_save(state_t *s, char *dirname); +gamestate_save(state_t *s, Common::WriteStream *save, const char *savename); /* Saves a game state to the hard disk in a portable way ** Parameters: (state_t *) s: The state to save -** (char *) dirname: The subdirectory to store it in +** (WriteStream *) save: The stream to save to +** (char *) savename: The description of the savegame ** Returns : (int) 0 on success, 1 otherwise */ state_t * -gamestate_restore(state_t *s, char *dirname); +gamestate_restore(state_t *s, Common::SeekableReadStream *save); /* Restores a game state from a directory ** Parameters: (state_t *) s: An older state from the same game ** (char *) dirname: The subdirectory to restore from ** Returns : (state_t *) NULL on failure, a pointer to a valid state_t otherwise */ +bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* meta); +/* Read the header from a savegame +*/ + gfx_pixmap_color_t * get_pic_color(state_t *s, int color); /* Retrieves the gfx_pixmap_color_t associated with a game color index diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h index 019dcd8a67..6df7723022 100644 --- a/engines/sci/include/vm.h +++ b/engines/sci/include/vm.h @@ -821,16 +821,4 @@ obj_get(struct _state *s, reg_t offset); ** Returns : (object_t *) The object in question, or NULL if there is none */ -int -test_savegame(struct _state *s, char *savegame_id, char *savegame_name, int savegame_name_length); -/* Simple savegame validity check -** Parameters: (state_t *) s: Pointer to the state_t to operate on -** (char *) savegame_id: Name of the savegame to check -** (char *) savegame_name: Pointer to a static buffer the savegame -** name string should be stored in -** (int) savegame_name_length: Max. number of bytes to write into the -** static string -** Returns : (int) 1 if it might be a savegame, 0 if not -*/ - #endif /* !_SCI_VM_H */ |