mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
SCI: Remove EngineState::game_version, it was only used for saving anyway. Also remove syncCStr()
svn-id: r44358
This commit is contained in:
parent
78d2ea9fcf
commit
2fe6b32968
@ -831,7 +831,7 @@ bool Console::cmdSaveGame(int argc, const char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: enable custom descriptions? force filename into a specific format?
|
// TODO: enable custom descriptions? force filename into a specific format?
|
||||||
if (gamestate_save(_vm->_gamestate, out, "debugging")) {
|
if (gamestate_save(_vm->_gamestate, out, "debugging", 0)) {
|
||||||
DebugPrintf("Saving the game state to '%s' failed\n", argv[1]);
|
DebugPrintf("Saving the game state to '%s' failed\n", argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,6 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) {
|
|||||||
char *version = argc > 3 ? strdup(s->segMan->derefString(argv[3])) : NULL;
|
char *version = argc > 3 ? strdup(s->segMan->derefString(argv[3])) : NULL;
|
||||||
|
|
||||||
debug(3, "kSaveGame(%s,%d,%s,%s)", game_id, savedir_nr, game_description, version);
|
debug(3, "kSaveGame(%s,%d,%s,%s)", game_id, savedir_nr, game_description, version);
|
||||||
s->game_version = version;
|
|
||||||
|
|
||||||
Common::Array<SavegameDesc> saves;
|
Common::Array<SavegameDesc> saves;
|
||||||
listSavegames(saves);
|
listSavegames(saves);
|
||||||
@ -624,7 +623,7 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) {
|
|||||||
return NULL_REG;
|
return NULL_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamestate_save(s, out, game_description)) {
|
if (gamestate_save(s, out, game_description, version)) {
|
||||||
warning("Saving the game failed.");
|
warning("Saving the game failed.");
|
||||||
s->r_acc = NULL_REG;
|
s->r_acc = NULL_REG;
|
||||||
} else {
|
} else {
|
||||||
@ -638,8 +637,6 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) {
|
|||||||
s->r_acc = make_reg(0, 1);
|
s->r_acc = make_reg(0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(s->game_version);
|
|
||||||
s->game_version = NULL;
|
|
||||||
|
|
||||||
return s->r_acc;
|
return s->r_acc;
|
||||||
}
|
}
|
||||||
|
@ -65,20 +65,6 @@ static void sync_reg_t(Common::Serializer &s, reg_t &obj) {
|
|||||||
s.syncAsUint16LE(obj.offset);
|
s.syncAsUint16LE(obj.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Sync a C string, using malloc/free storage.
|
|
||||||
// Much better to replace all of these by Common::String
|
|
||||||
static void syncCStr(Common::Serializer &s, char **str) {
|
|
||||||
Common::String tmp;
|
|
||||||
if (s.isSaving() && *str)
|
|
||||||
tmp = *str;
|
|
||||||
s.syncString(tmp);
|
|
||||||
if (s.isLoading()) {
|
|
||||||
//free(*str);
|
|
||||||
*str = strdup(tmp.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void sync_song_t(Common::Serializer &s, Song &obj) {
|
static void sync_song_t(Common::Serializer &s, Song &obj) {
|
||||||
s.syncAsSint32LE(obj._handle);
|
s.syncAsSint32LE(obj._handle);
|
||||||
s.syncAsSint32LE(obj._resourceNum);
|
s.syncAsSint32LE(obj._resourceNum);
|
||||||
@ -295,7 +281,8 @@ static void sync_SavegameMetadata(Common::Serializer &s, SavegameMetadata &obj)
|
|||||||
void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
|
void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
|
||||||
s.skip(4, VER(9), VER(9)); // OBSOLETE: Used to be savegame_version
|
s.skip(4, VER(9), VER(9)); // OBSOLETE: Used to be savegame_version
|
||||||
|
|
||||||
syncCStr(s, &game_version);
|
Common::String tmp;
|
||||||
|
s.syncString(tmp); // OBSOLETE: Used to be game_version
|
||||||
s.skip(4, VER(9), VER(9)); // OBSOLETE: Used to be version
|
s.skip(4, VER(9), VER(9)); // OBSOLETE: Used to be version
|
||||||
|
|
||||||
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
|
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
|
||||||
@ -508,14 +495,14 @@ static void sync_songlib_t(Common::Serializer &s, SongLibrary &obj) {
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename) {
|
int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) {
|
||||||
tm curTime;
|
tm curTime;
|
||||||
g_system->getTimeAndDate(curTime);
|
g_system->getTimeAndDate(curTime);
|
||||||
|
|
||||||
SavegameMetadata meta;
|
SavegameMetadata meta;
|
||||||
meta.savegame_version = CURRENT_SAVEGAME_VERSION;
|
meta.savegame_version = CURRENT_SAVEGAME_VERSION;
|
||||||
meta.savegame_name = savename;
|
meta.savegame_name = savename;
|
||||||
meta.game_version = s->game_version;
|
meta.game_version = version;
|
||||||
meta.savegame_date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
|
meta.savegame_date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
|
||||||
meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF);
|
meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ struct SavegameMetadata {
|
|||||||
* @param savename The description of the savegame
|
* @param savename The description of the savegame
|
||||||
* @return 0 on success, 1 otherwise
|
* @return 0 on success, 1 otherwise
|
||||||
*/
|
*/
|
||||||
int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename);
|
int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores a game state from a directory.
|
* Restores a game state from a directory.
|
||||||
|
@ -33,8 +33,6 @@ namespace Sci {
|
|||||||
EngineState::EngineState(ResourceManager *res, Kernel *kernel, uint32 flags)
|
EngineState::EngineState(ResourceManager *res, Kernel *kernel, uint32 flags)
|
||||||
: resMan(res), _kernel(kernel), _flags(flags), _dirseeker(this) {
|
: resMan(res), _kernel(kernel), _flags(flags), _dirseeker(this) {
|
||||||
|
|
||||||
game_version = 0;
|
|
||||||
|
|
||||||
gfx_state = 0;
|
gfx_state = 0;
|
||||||
old_screen = 0;
|
old_screen = 0;
|
||||||
|
|
||||||
|
@ -171,7 +171,6 @@ public:
|
|||||||
const uint32 _flags; /**< Specific game flags */
|
const uint32 _flags; /**< Specific game flags */
|
||||||
|
|
||||||
Common::String _gameName; /**< Designation of the primary object (which inherits from Game) */
|
Common::String _gameName; /**< Designation of the primary object (which inherits from Game) */
|
||||||
char *game_version;
|
|
||||||
|
|
||||||
/* Non-VM information */
|
/* Non-VM information */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user