Saveload: Adjust flags for saving using upstream chunks

This commit is contained in:
Jonathan G Rennison
2023-11-17 21:39:59 +00:00
parent 4187b8cc62
commit 181eb6b6fe
2 changed files with 31 additions and 20 deletions

View File

@@ -83,12 +83,14 @@ void SlUnreachablePlaceholder();
enum ChunkSaveLoadSpecialOp {
CSLSO_PRE_LOAD,
CSLSO_PRE_LOADCHECK,
CSLSO_PRE_PTRS,
CSLSO_SHOULD_SAVE_CHUNK,
};
enum ChunkSaveLoadSpecialOpResult {
CSLSOR_NONE,
CSLSOR_LOAD_CHUNK_CONSUMED,
CSLSOR_DONT_SAVE_CHUNK,
CSLSOR_UPSTREAM_SAVE_CHUNK,
};
typedef ChunkSaveLoadSpecialOpResult ChunkSaveLoadSpecialProc(uint32, ChunkSaveLoadSpecialOp);
@@ -99,7 +101,7 @@ enum ChunkType {
CH_SPARSE_ARRAY = 2,
CH_EXT_HDR = 15, ///< Extended chunk header
CH_UPSTREAM_SAVE = 0x80,
CH_UNUSED = 0x80,
};
/** Handlers and description of chunk. */
@@ -135,15 +137,11 @@ namespace upstream_sl {
ChunkHandler ch = {
id,
nullptr,
SlUnreachablePlaceholder,
[]() {
SlExecWithSlVersion(F::GetLoadVersion(), []() {
SlFixPointerChunkByID(id);
});
},
SlUnreachablePlaceholder,
CH_UPSTREAM_SAVE
SlUnreachablePlaceholder,
SlUnreachablePlaceholder,
CH_UNUSED
};
ch.special_proc = [](uint32 chunk_id, ChunkSaveLoadSpecialOp op) -> ChunkSaveLoadSpecialOpResult {
assert(id == chunk_id);
@@ -158,6 +156,13 @@ namespace upstream_sl {
SlLoadCheckChunkByID(id);
});
return CSLSOR_LOAD_CHUNK_CONSUMED;
case CSLSO_PRE_PTRS:
SlExecWithSlVersion(F::GetLoadVersion(), []() {
SlFixPointerChunkByID(id);
});
return CSLSOR_LOAD_CHUNK_CONSUMED;
case CSLSO_SHOULD_SAVE_CHUNK:
return CSLSOR_UPSTREAM_SAVE_CHUNK;
default:
return CSLSOR_NONE;
}