mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
C client: Fix schematic converter
This commit is contained in:
parent
5f8254eb8a
commit
a3a4143baa
@ -67,7 +67,7 @@ struct InflateState {
|
|||||||
|
|
||||||
void Inflate_Init(struct InflateState* state, struct Stream* source);
|
void Inflate_Init(struct InflateState* state, struct Stream* source);
|
||||||
void Inflate_Process(struct InflateState* state);
|
void Inflate_Process(struct InflateState* state);
|
||||||
void Inflate_MakeStream(struct Stream* stream, struct InflateState* state, struct Stream* underlying);
|
NOINLINE_ void Inflate_MakeStream(struct Stream* stream, struct InflateState* state, struct Stream* underlying);
|
||||||
|
|
||||||
|
|
||||||
#define DEFLATE_BUFFER_SIZE 16384
|
#define DEFLATE_BUFFER_SIZE 16384
|
||||||
@ -89,10 +89,10 @@ struct DeflateState {
|
|||||||
UInt16 Prev[DEFLATE_BUFFER_SIZE];
|
UInt16 Prev[DEFLATE_BUFFER_SIZE];
|
||||||
bool WroteHeader;
|
bool WroteHeader;
|
||||||
};
|
};
|
||||||
void Deflate_MakeStream(struct Stream* stream, struct DeflateState* state, struct Stream* underlying);
|
NOINLINE_ void Deflate_MakeStream(struct Stream* stream, struct DeflateState* state, struct Stream* underlying);
|
||||||
|
|
||||||
struct GZipState { struct DeflateState Base; UInt32 Crc32, Size; };
|
struct GZipState { struct DeflateState Base; UInt32 Crc32, Size; };
|
||||||
void GZip_MakeStream(struct Stream* stream, struct GZipState* state, struct Stream* underlying);
|
NOINLINE_ void GZip_MakeStream(struct Stream* stream, struct GZipState* state, struct Stream* underlying);
|
||||||
struct ZLibState { struct DeflateState Base; UInt32 Adler32; };
|
struct ZLibState { struct DeflateState Base; UInt32 Adler32; };
|
||||||
void ZLib_MakeStream(struct Stream* stream, struct ZLibState* state, struct Stream* underlying);
|
NOINLINE_ void ZLib_MakeStream(struct Stream* stream, struct ZLibState* state, struct Stream* underlying);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1002,14 +1002,14 @@ ReturnCode Schematic_Save(struct Stream* stream) {
|
|||||||
Stream_SetU16_BE(&tmp[63], World_Length);
|
Stream_SetU16_BE(&tmp[63], World_Length);
|
||||||
Stream_SetU32_BE(&tmp[74], World_BlocksSize);
|
Stream_SetU32_BE(&tmp[74], World_BlocksSize);
|
||||||
}
|
}
|
||||||
if ((res = Stream_Write(stream, sc_begin, sizeof(sc_begin)))) return res;
|
if ((res = Stream_Write(stream, tmp, sizeof(sc_begin)))) return res;
|
||||||
if ((res = Stream_Write(stream, World_Blocks, World_BlocksSize))) return res;
|
if ((res = Stream_Write(stream, World_Blocks, World_BlocksSize))) return res;
|
||||||
|
|
||||||
Mem_Copy(tmp, sc_data, sizeof(sc_data));
|
Mem_Copy(tmp, sc_data, sizeof(sc_data));
|
||||||
{
|
{
|
||||||
Stream_SetU32_BE(&tmp[7], World_BlocksSize);
|
Stream_SetU32_BE(&tmp[7], World_BlocksSize);
|
||||||
}
|
}
|
||||||
if ((res = Stream_Write(stream, sc_data, sizeof(sc_data)))) return res;
|
if ((res = Stream_Write(stream, tmp, sizeof(sc_data)))) return res;
|
||||||
|
|
||||||
UInt8 chunk[8192] = { 0 };
|
UInt8 chunk[8192] = { 0 };
|
||||||
Int32 i;
|
Int32 i;
|
||||||
|
10
src/Stream.h
10
src/Stream.h
@ -37,12 +37,12 @@ void Stream_Init(struct Stream* stream);
|
|||||||
ReturnCode Stream_Skip(struct Stream* stream, UInt32 count);
|
ReturnCode Stream_Skip(struct Stream* stream, UInt32 count);
|
||||||
ReturnCode Stream_DefaultReadU8(struct Stream* stream, UInt8* data);
|
ReturnCode Stream_DefaultReadU8(struct Stream* stream, UInt8* data);
|
||||||
|
|
||||||
void Stream_FromFile(struct Stream* stream, void* file);
|
NOINLINE_ void Stream_FromFile(struct Stream* stream, void* file);
|
||||||
/* Readonly Stream wrapping another Stream, only allows reading up to 'len' bytes from the wrapped stream. */
|
/* Readonly Stream wrapping another Stream, only allows reading up to 'len' bytes from the wrapped stream. */
|
||||||
void Stream_ReadonlyPortion(struct Stream* stream, struct Stream* source, UInt32 len);
|
NOINLINE_ void Stream_ReadonlyPortion(struct Stream* stream, struct Stream* source, UInt32 len);
|
||||||
void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
NOINLINE_ void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
||||||
void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
NOINLINE_ void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
||||||
void Stream_ReadonlyBuffered(struct Stream* stream, struct Stream* source, void* data, UInt32 size);
|
NOINLINE_ void Stream_ReadonlyBuffered(struct Stream* stream, struct Stream* source, void* data, UInt32 size);
|
||||||
|
|
||||||
UInt16 Stream_GetU16_LE(UInt8* data);
|
UInt16 Stream_GetU16_LE(UInt8* data);
|
||||||
UInt16 Stream_GetU16_BE(UInt8* data);
|
UInt16 Stream_GetU16_BE(UInt8* data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user