OpenTTD Source 20241224-master-gf74b0cf984
|
Functions for handling of TTO/TTD/TTDP savegames. More...
#include "../stdafx.h"
#include "../debug.h"
#include "../strings_type.h"
#include "../string_func.h"
#include "../settings_type.h"
#include "../fileio_func.h"
#include "table/strings.h"
#include "saveload_internal.h"
#include "oldloader.h"
#include "../safeguards.h"
Go to the source code of this file.
Typedefs | |
typedef bool | LoadOldMainProc(LoadgameState *ls) |
Functions | |
static OldChunkType | GetOldChunkType (OldChunkType type) |
static OldChunkType | GetOldChunkVarType (OldChunkType type) |
static OldChunkType | GetOldChunkFileType (OldChunkType type) |
static uint8_t | CalcOldVarLen (OldChunkType type) |
Return expected size in bytes of a OldChunkType. | |
static uint8_t | ReadByteFromFile (LoadgameState *ls) |
Reads a byte from a file (do not call yourself, use ReadByte()) | |
uint8_t | ReadByte (LoadgameState *ls) |
Reads a byte from the buffer and decompress if needed. | |
bool | LoadChunk (LoadgameState *ls, void *base, const OldChunks *chunks) |
Loads a chunk from the old savegame. | |
static void | InitLoading (LoadgameState *ls) |
Initialize some data before reading. | |
static bool | VerifyOldNameChecksum (char *title, uint len) |
Verifies the title has a valid checksum. | |
static std::tuple< SavegameType, std::string > | DetermineOldSavegameTypeAndName (FileHandle &f) |
bool | LoadOldSaveGame (const std::string &file) |
std::string | GetOldSaveGameName (const std::string &file) |
Variables | |
static const int | TTO_HEADER_SIZE = 41 |
static const int | TTD_HEADER_SIZE = 49 |
static const int | HEADER_CHECKSUM_SIZE = 2 |
The size of the checksum in the name/header of the TTD/TTO savegames. | |
uint32_t | _bump_assert_value |
Functions for handling of TTO/TTD/TTDP savegames.
Definition in file oldloader.cpp.
typedef bool LoadOldMainProc(LoadgameState *ls) |
Definition at line 257 of file oldloader.cpp.
|
inlinestatic |
Return expected size in bytes of a OldChunkType.
type | OldChunkType to get size of. |
Definition at line 41 of file oldloader.cpp.
Referenced by LoadChunk().
|
static |
Definition at line 238 of file oldloader.cpp.
|
inlinestatic |
Definition at line 34 of file oldloader.cpp.
|
inlinestatic |
Definition at line 32 of file oldloader.cpp.
|
inlinestatic |
Definition at line 33 of file oldloader.cpp.
std::string GetOldSaveGameName | ( | const std::string & | file | ) |
Definition at line 309 of file oldloader.cpp.
|
static |
Initialize some data before reading.
Definition at line 199 of file oldloader.cpp.
References _settings_game, GameSettings::construction, and ConstructionSettings::freeform_edges.
bool LoadChunk | ( | LoadgameState * | ls, |
void * | base, | ||
const OldChunks * | chunks | ||
) |
Loads a chunk from the old savegame.
Definition at line 122 of file oldloader.cpp.
References _savegame_type, CalcOldVarLen(), Debug, GB(), OC_DEREFERENCE_POINTER, OC_END, OC_TTD, OC_TTO, ReadByte(), SGT_TTO, and OldChunks::type.
bool LoadOldSaveGame | ( | const std::string & | file | ) |
Definition at line 259 of file oldloader.cpp.
uint8_t ReadByte | ( | LoadgameState * | ls | ) |
Reads a byte from the buffer and decompress if needed.
Definition at line 88 of file oldloader.cpp.
References ReadByteFromFile().
Referenced by LoadChunk().
|
static |
Reads a byte from a file (do not call yourself, use ReadByte())
Definition at line 61 of file oldloader.cpp.
References Debug.
Referenced by ReadByte().
|
static |
Verifies the title has a valid checksum.
title | title and checksum |
len | the length of the title to read/checksum |
Definition at line 222 of file oldloader.cpp.
References HEADER_CHECKSUM_SIZE, and SB().
uint32_t _bump_assert_value |
Definition at line 30 of file oldloader.cpp.
|
static |
The size of the checksum in the name/header of the TTD/TTO savegames.
Definition at line 28 of file oldloader.cpp.
Referenced by VerifyOldNameChecksum().
|
static |
Definition at line 26 of file oldloader.cpp.
|
static |
Definition at line 25 of file oldloader.cpp.