Mercurial > hg > early-roguelike
changeset 81:0e212d46b68f
rogue4: don't put savefile metadata into the savefile.
The save_file() function in save.c stored the savefile's device number,
inode number, creation time, and modification time in the file. The
restore() function read them back, and apparently used to compare them
to protect against cheaters.
Unfortunately, the types and sizes of these numbers differ from system
to system, which ruins the Roguelike Restoration Project's fine
portability work. So they have been removed from the savefile.
This BREAKS SAVEFILE COMPATIBILITY, but old files can be converted by
excising the chunk starting at offset 0x22 with length sizeof(ino_t) +
sizeof(dev_t) + 2 * sizeof(time_t). That's 0x14 on i686 and 0x20 on
x86_64, at least with current versions of Linux and glibc.
author | John "Elwin" Edwards |
---|---|
date | Mon, 05 Aug 2013 20:49:41 -0700 |
parents | c8726c9fec82 |
children | f11eeafc6568 |
files | rogue4/save.c |
diffstat | 1 files changed, 0 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/rogue4/save.c Mon Jul 01 07:58:55 2013 -0700 +++ b/rogue4/save.c Mon Aug 05 20:49:41 2013 -0700 @@ -173,10 +173,6 @@ fseek(savef, 0L, 0); encwrite(version,strlen(version)+1,savef); - encwrite(&sbuf.st_ino,sizeof(sbuf.st_ino),savef); - encwrite(&sbuf.st_dev,sizeof(sbuf.st_dev),savef); - encwrite(&sbuf.st_ctime,sizeof(sbuf.st_ctime),savef); - encwrite(&sbuf.st_mtime,sizeof(sbuf.st_mtime),savef); encwrite(&slines,sizeof(slines),savef); encwrite(&scols,sizeof(scols),savef); msg(""); @@ -246,10 +242,6 @@ fflush(stdout); - encread(&sbuf.st_ino,sizeof(sbuf.st_ino), inf); - encread(&sbuf.st_dev,sizeof(sbuf.st_dev), inf); - encread(&sbuf.st_ctime,sizeof(sbuf.st_ctime), inf); - encread(&sbuf.st_mtime,sizeof(sbuf.st_mtime), inf); encread(&slines,sizeof(slines),inf); encread(&scols,sizeof(scols),inf);