savefile changes - part 1
This is the first of several savefile-related changes to follow later. This one is groundwork for those later changes. Remove internal compression schemes (RLECOMP and ZEROCOMP) and discard the savefile_info struct that was primarily used to convey which internal compression schemes had been in use. Relocate some struct definitions into appropriate header files for use by code to come in later changes. Remove the two struct size-related fields from version_info and from the nmakedefs_s. Instead, include a series of bytes near the beginning of the savefile, representing the size of each struct or base data type that impacts the historical savefile content. Those are referred to as the "critical bytes". (Related note: the "you" struct required two bytes, low and high, due to its size). Compare those critical bytes in a savefile against the NetHack build that is reading the savefile. This allows mismatch detection early in the savefile-reading process, and a clean exit, rather than proceeding to read nonsensical values from the file. Include some feedback on what the first mismatch was when encountering one. For arrays stored in the savefile, use loop-logic in the core to write/read the array elements one at a time, rather than in a single blob. This will be required for changes to follow later. (impacts artiexist[], artidisco[], svd.dungeons[], svl.level_info[], svl.level.locations[][], msrooms[] field of mapseen, svb.bases[], svb.disco[] objects[], svm.mvitals[], svs.spl_book[], svd.doors[], go.oracle_loc[], utrack[], wgrowtime[]) This also adds data model to the long version information. This invalidates existing save and bones files due to the changes in the information at the start of the file.
This commit is contained in:
@@ -397,38 +397,6 @@
|
||||
/* # define ZLIB_COMP */ /* ZLIB for compression */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Internal Compression Options
|
||||
*
|
||||
* Internal compression options RLECOMP and ZEROCOMP alter the data
|
||||
* that gets written to the save file by NetHack, in contrast
|
||||
* to COMPRESS or ZLIB_COMP which compress the entire file after
|
||||
* the NetHack data is written out.
|
||||
*
|
||||
* Defining RLECOMP builds in support for internal run-length
|
||||
* compression of level structures. If RLECOMP support is included
|
||||
* it can be toggled on/off at runtime via the config file option
|
||||
* rlecomp.
|
||||
*
|
||||
* Defining ZEROCOMP builds in support for internal zero-comp
|
||||
* compression of data. If ZEROCOMP support is included it can still
|
||||
* be toggled on/off at runtime via the config file option zerocomp.
|
||||
*
|
||||
* RLECOMP and ZEROCOMP support can be included even if
|
||||
* COMPRESS or ZLIB_COMP support is included. One reason for doing
|
||||
* so would be to provide savefile read compatibility with a savefile
|
||||
* where those options were in effect. With RLECOMP and/or ZEROCOMP
|
||||
* defined, NetHack can read an rlecomp or zerocomp savefile in, yet
|
||||
* re-save without them.
|
||||
*
|
||||
* Using any compression option will create smaller bones/level/save
|
||||
* files at the cost of additional code and time.
|
||||
*/
|
||||
|
||||
/* # define INTERNAL_COMP */ /* defines both ZEROCOMP and RLECOMP */
|
||||
/* # define ZEROCOMP */ /* Support ZEROCOMP compression */
|
||||
/* # define RLECOMP */ /* Support RLECOMP compression */
|
||||
|
||||
/*
|
||||
* Data librarian. Defining DLB places most of the support files into
|
||||
* a tar-like file, thus making a neater installation. See *conf.h
|
||||
|
||||
Reference in New Issue
Block a user