2018-08-19 09:46:58 +02:00
|
|
|
#pragma once
|
2018-09-03 21:08:40 +02:00
|
|
|
|
2018-10-01 22:22:11 +02:00
|
|
|
#include "..\Global\global.h"
|
|
|
|
#include "..\Specific\IO\ChunkId.h"
|
|
|
|
#include "..\Specific\IO\ChunkReader.h"
|
|
|
|
#include "..\Specific\IO\ChunkWriter.h"
|
|
|
|
#include "..\Specific\IO\LEB128.h"
|
|
|
|
#include "..\Specific\IO\Streams.h"
|
|
|
|
#include "..\Scripting\GameFlowScript.h"
|
|
|
|
#include "..\Scripting\GameLogicScript.h"
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
#define RestoreGame ((__int32 (__cdecl*)()) 0x00472060)
|
|
|
|
#define ReadSavegame ((__int32 (__cdecl*)(__int32)) 0x004A8E10)
|
|
|
|
#define CreateSavegame ((void (__cdecl*)()) 0x00470FA0)
|
|
|
|
#define WriteSavegame ((__int32 (__cdecl*)(__int32)) 0x004A8BC0)
|
|
|
|
|
2018-10-01 22:22:11 +02:00
|
|
|
#define SAVEGAME_BUFFER_SIZE 1048576
|
|
|
|
|
|
|
|
extern GameFlow* g_GameFlow;
|
|
|
|
extern GameScript* g_GameScript;
|
|
|
|
|
|
|
|
class SaveGame {
|
|
|
|
private:
|
|
|
|
static FileStream* m_stream;
|
|
|
|
static ChunkReader* m_reader;
|
|
|
|
static ChunkWriter* m_writer;
|
2018-10-09 00:02:14 +02:00
|
|
|
static vector<LuaVariable> m_luaVariables;
|
2018-10-01 22:22:11 +02:00
|
|
|
|
|
|
|
static ChunkId* m_chunkHeader;
|
|
|
|
static ChunkId* m_chunkGameStatus;
|
|
|
|
static ChunkId* m_chunkItems;
|
|
|
|
static ChunkId* m_chunkItem;
|
|
|
|
static ChunkId* m_chunkLara;
|
2018-10-10 22:29:40 +02:00
|
|
|
static ChunkId* m_chunkLuaVariable;
|
|
|
|
|
|
|
|
static void saveHeader(__int32 param);
|
|
|
|
static void saveGameStatus(__int32 param);
|
|
|
|
static void saveLara(__int32 param);
|
|
|
|
static void saveItem(__int32 param);
|
|
|
|
static void saveItems(__int32 param);
|
|
|
|
static void saveVariables(__int32 param);
|
|
|
|
static void saveVariable(__int32 param);
|
|
|
|
|
|
|
|
static bool readHeader();
|
|
|
|
static bool readGameStatus();
|
|
|
|
static bool readLara();
|
|
|
|
static bool readItem();
|
|
|
|
static bool readVariable();
|
|
|
|
static bool readSavegameChunks(ChunkId* chunkId, __int32 maxSize);
|
2018-09-03 21:08:40 +02:00
|
|
|
|
2018-10-01 22:22:11 +02:00
|
|
|
public:
|
2018-10-09 00:02:14 +02:00
|
|
|
static void Start();
|
|
|
|
static void End();
|
|
|
|
|
2018-10-10 22:29:40 +02:00
|
|
|
static bool Load(char* fileName);
|
2018-10-09 00:02:14 +02:00
|
|
|
static bool Save(char* fileName);
|
2018-10-01 22:22:11 +02:00
|
|
|
};
|