Mercurial > hg > early-roguelike
comparison rogue4/save.c @ 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 | 09da55b986ca |
children | a0d4caead33b |
comparison
equal
deleted
inserted
replaced
80:c8726c9fec82 | 81:0e212d46b68f |
---|---|
171 fwrite("junk", 1, 5, savef); | 171 fwrite("junk", 1, 5, savef); |
172 | 172 |
173 fseek(savef, 0L, 0); | 173 fseek(savef, 0L, 0); |
174 | 174 |
175 encwrite(version,strlen(version)+1,savef); | 175 encwrite(version,strlen(version)+1,savef); |
176 encwrite(&sbuf.st_ino,sizeof(sbuf.st_ino),savef); | |
177 encwrite(&sbuf.st_dev,sizeof(sbuf.st_dev),savef); | |
178 encwrite(&sbuf.st_ctime,sizeof(sbuf.st_ctime),savef); | |
179 encwrite(&sbuf.st_mtime,sizeof(sbuf.st_mtime),savef); | |
180 encwrite(&slines,sizeof(slines),savef); | 176 encwrite(&slines,sizeof(slines),savef); |
181 encwrite(&scols,sizeof(scols),savef); | 177 encwrite(&scols,sizeof(scols),savef); |
182 msg(""); | 178 msg(""); |
183 rs_save_file(savef); | 179 rs_save_file(savef); |
184 | 180 |
244 return FALSE; | 240 return FALSE; |
245 } | 241 } |
246 | 242 |
247 fflush(stdout); | 243 fflush(stdout); |
248 | 244 |
249 encread(&sbuf.st_ino,sizeof(sbuf.st_ino), inf); | |
250 encread(&sbuf.st_dev,sizeof(sbuf.st_dev), inf); | |
251 encread(&sbuf.st_ctime,sizeof(sbuf.st_ctime), inf); | |
252 encread(&sbuf.st_mtime,sizeof(sbuf.st_mtime), inf); | |
253 encread(&slines,sizeof(slines),inf); | 245 encread(&slines,sizeof(slines),inf); |
254 encread(&scols,sizeof(scols),inf); | 246 encread(&scols,sizeof(scols),inf); |
255 | 247 |
256 /* | 248 /* |
257 * we do not close the file so that we will have a hold of the | 249 * we do not close the file so that we will have a hold of the |