From fdc346deb1e8e8de1ed838f553d72c6acefb303a Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Mon, 5 Aug 2013 20:49:41 -0700 Subject: [PATCH] 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. --- rogue4/save.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/rogue4/save.c b/rogue4/save.c index 024eb35..6bd6634 100644 --- a/rogue4/save.c +++ b/rogue4/save.c @@ -173,10 +173,6 @@ register FILE *savef; 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 @@ char **envp; 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);