Saveload: Change result type of ChunkSaveLoadSpecialProc
This commit is contained in:
@@ -2139,7 +2139,7 @@ inline void SlRIFFSpringPPCheck(size_t len)
|
|||||||
static void SlLoadChunk(const ChunkHandler &ch)
|
static void SlLoadChunk(const ChunkHandler &ch)
|
||||||
{
|
{
|
||||||
if (ch.special_proc != nullptr) {
|
if (ch.special_proc != nullptr) {
|
||||||
if (ch.special_proc(ch.id, CSLSO_PRE_LOAD)) return;
|
if (ch.special_proc(ch.id, CSLSO_PRE_LOAD) == CSLSOR_LOAD_CHUNK_CONSUMED) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte m = SlReadByte();
|
byte m = SlReadByte();
|
||||||
@@ -2206,7 +2206,7 @@ static void SlLoadChunk(const ChunkHandler &ch)
|
|||||||
static void SlLoadCheckChunk(const ChunkHandler *ch)
|
static void SlLoadCheckChunk(const ChunkHandler *ch)
|
||||||
{
|
{
|
||||||
if (ch && ch->special_proc != nullptr) {
|
if (ch && ch->special_proc != nullptr) {
|
||||||
if (ch->special_proc(ch->id, CSLSO_PRE_LOADCHECK)) return;
|
if (ch->special_proc(ch->id, CSLSO_PRE_LOADCHECK) == CSLSOR_LOAD_CHUNK_CONSUMED) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte m = SlReadByte();
|
byte m = SlReadByte();
|
||||||
|
@@ -86,7 +86,11 @@ enum ChunkSaveLoadSpecialOp {
|
|||||||
CSLSO_PRE_LOAD,
|
CSLSO_PRE_LOAD,
|
||||||
CSLSO_PRE_LOADCHECK,
|
CSLSO_PRE_LOADCHECK,
|
||||||
};
|
};
|
||||||
typedef bool ChunkSaveLoadSpecialProc(uint32, ChunkSaveLoadSpecialOp);
|
enum ChunkSaveLoadSpecialOpResult {
|
||||||
|
CSLSOR_NONE,
|
||||||
|
CSLSOR_LOAD_CHUNK_CONSUMED,
|
||||||
|
};
|
||||||
|
typedef ChunkSaveLoadSpecialOpResult ChunkSaveLoadSpecialProc(uint32, ChunkSaveLoadSpecialOp);
|
||||||
|
|
||||||
/** Type of a chunk. */
|
/** Type of a chunk. */
|
||||||
enum ChunkType {
|
enum ChunkType {
|
||||||
@@ -141,22 +145,22 @@ namespace upstream_sl {
|
|||||||
SlUnreachablePlaceholder,
|
SlUnreachablePlaceholder,
|
||||||
CH_UPSTREAM_SAVE
|
CH_UPSTREAM_SAVE
|
||||||
};
|
};
|
||||||
ch.special_proc = [](uint32 chunk_id, ChunkSaveLoadSpecialOp op) -> bool {
|
ch.special_proc = [](uint32 chunk_id, ChunkSaveLoadSpecialOp op) -> ChunkSaveLoadSpecialOpResult {
|
||||||
assert(id == chunk_id);
|
assert(id == chunk_id);
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case CSLSO_PRE_LOAD:
|
case CSLSO_PRE_LOAD:
|
||||||
SlExecWithSlVersion(F::GetLoadVersion(), []() {
|
SlExecWithSlVersion(F::GetLoadVersion(), []() {
|
||||||
SlLoadChunkByID(id);
|
SlLoadChunkByID(id);
|
||||||
});
|
});
|
||||||
break;
|
return CSLSOR_LOAD_CHUNK_CONSUMED;
|
||||||
case CSLSO_PRE_LOADCHECK:
|
case CSLSO_PRE_LOADCHECK:
|
||||||
SlExecWithSlVersion(F::GetLoadVersion(), []() {
|
SlExecWithSlVersion(F::GetLoadVersion(), []() {
|
||||||
SlLoadCheckChunkByID(id);
|
SlLoadCheckChunkByID(id);
|
||||||
});
|
});
|
||||||
break;
|
return CSLSOR_LOAD_CHUNK_CONSUMED;
|
||||||
|
default:
|
||||||
|
return CSLSOR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // chunk has been consumed
|
|
||||||
};
|
};
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user