mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
eliminate name field from streams, reduces binary size by 5 KB
This commit is contained in:
parent
89c8589050
commit
c2e46744d5
@ -82,7 +82,7 @@ static ReturnCode Sound_ReadWave(STRING_PURE String* filename, struct Sound* snd
|
||||
void* file; res = File_Open(&file, &path);
|
||||
if (res) return res;
|
||||
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
res = Sound_ReadWaveData(&stream, snd);
|
||||
if (res) { stream.Close(&stream); return res; }
|
||||
@ -353,7 +353,7 @@ static void Music_RunLoop(void) {
|
||||
|
||||
void* file; res = File_Open(&file, &path);
|
||||
if (res) { Chat_LogError(res, "opening", &path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
res = Music_PlayOgg(&stream);
|
||||
if (res) { Chat_LogError(res, "playing", &path); }
|
||||
|
@ -494,9 +494,7 @@ ReturnCode Bitmap_DecodePng(struct Bitmap* bmp, struct Stream* stream) {
|
||||
if (transparentCol <= PNG_RGB_MASK) {
|
||||
Png_ComputeTransparency(bmp, transparentCol);
|
||||
}
|
||||
|
||||
if (!bmp->Scan0) ErrorHandler_Fail("Invalid PNG image");
|
||||
return 0;
|
||||
return bmp->Scan0 ? 0 : PNG_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
|
||||
@ -516,7 +514,7 @@ static ReturnCode Bitmap_Crc32StreamWrite(struct Stream* stream, UInt8* data, UI
|
||||
}
|
||||
|
||||
static void Bitmap_Crc32Stream(struct Stream* stream, struct Stream* underlying) {
|
||||
Stream_Init(stream, &underlying->Name);
|
||||
Stream_Init(stream);
|
||||
stream->Meta.CRC32.Source = underlying;
|
||||
stream->Meta.CRC32.CRC32 = 0xFFFFFFFFUL;
|
||||
stream->Write = Bitmap_Crc32StreamWrite;
|
||||
|
@ -106,7 +106,7 @@ static void Chat_OpenLog(DateTime* now) {
|
||||
}
|
||||
|
||||
if (res == ReturnCode_FileShareViolation) continue;
|
||||
Stream_FromFile(&Chat_LogStream, file, path);
|
||||
Stream_FromFile(&Chat_LogStream, file);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ static ReturnCode Inflate_StreamRead(struct Stream* stream, UInt8* data, UInt32
|
||||
}
|
||||
|
||||
void Inflate_MakeStream(struct Stream* stream, struct InflateState* state, struct Stream* underlying) {
|
||||
Stream_Init(stream, &underlying->Name);
|
||||
Stream_Init(stream);
|
||||
Inflate_Init(state, underlying);
|
||||
stream->Meta.Inflate = state;
|
||||
stream->Read = Inflate_StreamRead;
|
||||
@ -859,7 +859,7 @@ static ReturnCode Deflate_StreamClose(struct Stream* stream) {
|
||||
}
|
||||
|
||||
void Deflate_MakeStream(struct Stream* stream, struct DeflateState* state, struct Stream* underlying) {
|
||||
Stream_Init(stream, &underlying->Name);
|
||||
Stream_Init(stream);
|
||||
stream->Meta.Inflate = state;
|
||||
stream->Write = Deflate_StreamWrite;
|
||||
stream->Close = Deflate_StreamClose;
|
||||
|
@ -692,7 +692,7 @@ static void Player_CheckSkin(struct Player* player) {
|
||||
|
||||
String url = String_FromRawArray(item.URL);
|
||||
struct Stream mem; struct Bitmap bmp;
|
||||
Stream_ReadonlyMemory(&mem, item.ResultData, item.ResultSize, &url);
|
||||
Stream_ReadonlyMemory(&mem, item.ResultData, item.ResultSize);
|
||||
|
||||
ReturnCode res = Bitmap_DecodePng(&bmp, &mem);
|
||||
if (res) {
|
||||
|
@ -26,7 +26,7 @@ enum ERRORS_ALL {
|
||||
PNG_ERR_INVALID_SIG, PNG_ERR_INVALID_HEADER_SIZE, PNG_ERR_TOO_WIDE, PNG_ERR_TOO_TALL,
|
||||
PNG_ERR_INVALID_COL_BPP, PNG_ERR_COMP_METHOD, PNG_ERR_FILTER, PNG_ERR_INTERLACED,
|
||||
PNG_ERR_PAL_ENTRIES, PNG_ERR_PAL_SIZE, PNG_ERR_TRANS_COUNT, PNG_ERR_TRANS_INVALID,
|
||||
PNG_ERR_INVALID_END_SIZE,
|
||||
PNG_ERR_INVALID_END_SIZE, PNG_ERR_NO_DATA,
|
||||
/* ZIP archive decoding errors */
|
||||
ZIP_ERR_TOO_MANY_ENTRIES, ZIP_ERR_SEEK_END_OF_CENTRAL_DIR, ZIP_ERR_NO_END_OF_CENTRAL_DIR,
|
||||
ZIP_ERR_SEEK_CENTRAL_DIR, ZIP_ERR_INVALID_CENTRAL_DIR,
|
||||
@ -43,7 +43,8 @@ enum ERRORS_ALL {
|
||||
DAT_ERR_IDENTIFIER, DAT_ERR_VERSION, DAT_ERR_JIDENTIFIER, DAT_ERR_JVERSION,
|
||||
DAT_ERR_ROOT_TYPE, DAT_ERR_JSTRING_LEN, DAT_ERR_JFIELD_CLASS_NAME,
|
||||
DAT_ERR_JCLASS_TYPE, DAT_ERR_JCLASS_FIELDS, DAT_ERR_JCLASS_ANNOTATION,
|
||||
DAT_ERR_JOBJECT_TYPE, DAT_ERR_JARRAY_TYPE, DAT_ERR_JARRAY_CONTENT,
|
||||
/* CW map decoding errors */
|
||||
NBT_ERR_INT32S, NBT_ERR_UNKNOWN, CW_ERR_ROOT_TAG,
|
||||
NBT_ERR_INT32S, NBT_ERR_UNKNOWN, CW_ERR_ROOT_TAG, CW_ERR_STRING_LEN,
|
||||
};
|
||||
#endif
|
||||
|
@ -264,7 +264,7 @@ static ReturnCode Nbt_ReadString(struct Stream* stream, UChar* strBuffer, UInt32
|
||||
if (res = Stream_Read(stream, nameBuffer, 2)) return res;
|
||||
|
||||
UInt16 nameLen = Stream_GetU16_BE(nameBuffer);
|
||||
if (nameLen > NBT_SMALL_SIZE * 4) ErrorHandler_Fail("NBT String too long");
|
||||
if (nameLen > NBT_SMALL_SIZE * 4) return CW_ERR_STRING_LEN;
|
||||
if (res = Stream_Read(stream, nameBuffer, nameLen)) return res;
|
||||
|
||||
String str = String_Init(strBuffer, 0, NBT_SMALL_SIZE);
|
||||
@ -274,7 +274,7 @@ static ReturnCode Nbt_ReadString(struct Stream* stream, UChar* strBuffer, UInt32
|
||||
|
||||
typedef bool (*Nbt_Callback)(struct NbtTag* tag);
|
||||
static ReturnCode Nbt_ReadTag(UInt8 typeId, bool readTagName, struct Stream* stream, struct NbtTag* parent, Nbt_Callback callback) {
|
||||
if (typeId == NBT_END) return;
|
||||
if (typeId == NBT_END) return 0;
|
||||
|
||||
struct NbtTag tag;
|
||||
tag.TagID = typeId; tag.Parent = parent;
|
||||
@ -708,18 +708,18 @@ static ReturnCode Dat_ReadFieldData(struct Stream* stream, struct JFieldDesc* fi
|
||||
if (res = Stream_Skip(stream, 152)) return res;
|
||||
} else if (typeCode != TC_NULL) {
|
||||
/* WoM maps have this field as null, which makes things easier for us */
|
||||
ErrorHandler_Fail("Unsupported type code in Object field");
|
||||
return DAT_ERR_JOBJECT_TYPE;
|
||||
}
|
||||
} break;
|
||||
|
||||
case JFIELD_ARRAY: {
|
||||
if (res = stream->ReadU8(stream, &typeCode)) return res;
|
||||
if (typeCode == TC_NULL) break;
|
||||
if (typeCode != TC_ARRAY) ErrorHandler_Fail("Unsupported type code in Array field");
|
||||
if (typeCode != TC_ARRAY) return DAT_ERR_JARRAY_TYPE;
|
||||
|
||||
struct JClassDesc arrayClassDesc;
|
||||
if (res = Dat_ReadClassDesc(stream, &arrayClassDesc)) return res;
|
||||
if (arrayClassDesc.ClassName[1] != JFIELD_INT8) ErrorHandler_Fail("Only byte array fields supported");
|
||||
if (arrayClassDesc.ClassName[1] != JFIELD_INT8) return DAT_ERR_JARRAY_CONTENT;
|
||||
|
||||
if (res = Stream_ReadU32_BE(stream, &count)) return res;
|
||||
field->Value_Size = count;
|
||||
|
@ -636,7 +636,7 @@ void Game_TakeScreenshot(void) {
|
||||
void* file; res = File_Create(&file, &path);
|
||||
if (res) { Chat_LogError(res, "creating", &path); return; }
|
||||
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
res = Gfx_TakeScreenshot(&stream, Game_Width, Game_Height);
|
||||
if (res) {
|
||||
|
@ -1333,7 +1333,7 @@ static void SaveLevelScreen_SaveMap(struct SaveLevelScreen* screen) {
|
||||
|
||||
void* file; res = File_Create(&file, &path);
|
||||
if (res) { Chat_LogError(res, "creating", &path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
String cw = String_FromConst(".cw");
|
||||
struct GZipState state;
|
||||
@ -1634,7 +1634,7 @@ void LoadLevelScreen_LoadMap(STRING_PURE String* path) {
|
||||
|
||||
void* file; res = File_Open(&file, path);
|
||||
if (res) { Chat_LogError(res, "opening", path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
String cw = String_FromConst(".cw"); String lvl = String_FromConst(".lvl");
|
||||
String fcm = String_FromConst(".fcm"); String dat = String_FromConst(".dat");
|
||||
|
@ -174,7 +174,7 @@ void Options_Load(void) {
|
||||
|
||||
UChar lineBuffer[String_BufferSize(768)];
|
||||
String line = String_InitAndClearArray(lineBuffer);
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
|
||||
/* ReadLine reads single byte at a time */
|
||||
UInt8 buffer[2048]; struct Stream buffered;
|
||||
@ -212,7 +212,7 @@ void Options_Save(void) {
|
||||
|
||||
UChar lineBuffer[String_BufferSize(1024)];
|
||||
String line = String_InitAndClearArray(lineBuffer);
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
Int32 i;
|
||||
|
||||
for (i = 0; i < Options_Keys.Count; i++) {
|
||||
|
@ -390,8 +390,7 @@ static void Classic_Ping(UInt8* data) { }
|
||||
static void Classic_StartLoading(void) {
|
||||
World_Reset();
|
||||
Event_RaiseVoid(&WorldEvents_NewMap);
|
||||
String name = String_FromConst("Map chunk");
|
||||
Stream_ReadonlyMemory(&mapPartStream, NULL, 0, &name);
|
||||
Stream_ReadonlyMemory(&mapPartStream, NULL, 0);
|
||||
|
||||
prevScreen = Gui_Active;
|
||||
if (prevScreen == LoadingScreen_UNSAFE_RawPointer) {
|
||||
|
@ -66,7 +66,7 @@ static ReturnCode Stream_DefaultGet(struct Stream* stream, UInt32* value) {
|
||||
*value = 0; return ReturnCode_NotSupported;
|
||||
}
|
||||
|
||||
void Stream_Init(struct Stream* stream, STRING_PURE String* name) {
|
||||
void Stream_Init(struct Stream* stream) {
|
||||
stream->Read = Stream_DefaultIO;
|
||||
stream->ReadU8 = Stream_DefaultReadU8;
|
||||
stream->Write = Stream_DefaultIO;
|
||||
@ -74,8 +74,6 @@ void Stream_Init(struct Stream* stream, STRING_PURE String* name) {
|
||||
stream->Seek = Stream_DefaultSeek;
|
||||
stream->Position = Stream_DefaultGet;
|
||||
stream->Length = Stream_DefaultGet;
|
||||
stream->Name = String_InitAndClearArray(stream->NameBuffer);
|
||||
String_AppendString(&stream->Name, name);
|
||||
}
|
||||
|
||||
|
||||
@ -103,8 +101,8 @@ static ReturnCode Stream_FileLength(struct Stream* stream, UInt32* length) {
|
||||
return File_Length(stream->Meta.File, length);
|
||||
}
|
||||
|
||||
void Stream_FromFile(struct Stream* stream, void* file, STRING_PURE String* name) {
|
||||
Stream_Init(stream, name);
|
||||
void Stream_FromFile(struct Stream* stream, void* file) {
|
||||
Stream_Init(stream);
|
||||
stream->Meta.File = file;
|
||||
|
||||
stream->Read = Stream_FileRead;
|
||||
@ -142,7 +140,6 @@ static ReturnCode Stream_PortionLength(struct Stream* stream, UInt32* length) {
|
||||
}
|
||||
|
||||
void Stream_ReadonlyPortion(struct Stream* stream, struct Stream* source, UInt32 len) {
|
||||
Stream_Init(stream, &source->Name);
|
||||
stream->Read = Stream_PortionRead;
|
||||
stream->ReadU8 = Stream_PortionReadU8;
|
||||
stream->Position = Stream_PortionPosition;
|
||||
@ -204,8 +201,8 @@ static ReturnCode Stream_MemorySeek(struct Stream* stream, Int32 offset, Int32 s
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Stream_CommonMemory(struct Stream* stream, void* data, UInt32 len, STRING_PURE String* name) {
|
||||
Stream_Init(stream, name);
|
||||
static void Stream_CommonMemory(struct Stream* stream, void* data, UInt32 len) {
|
||||
Stream_Init(stream);
|
||||
stream->Seek = Stream_MemorySeek;
|
||||
/* TODO: Should we use separate Stream_MemoryPosition functions? */
|
||||
stream->Position = Stream_PortionPosition;
|
||||
@ -217,14 +214,14 @@ static void Stream_CommonMemory(struct Stream* stream, void* data, UInt32 len, S
|
||||
stream->Meta.Mem.Base = data;
|
||||
}
|
||||
|
||||
void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len, STRING_PURE String* name) {
|
||||
Stream_CommonMemory(stream, data, len, name);
|
||||
void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len) {
|
||||
Stream_CommonMemory(stream, data, len);
|
||||
stream->Read = Stream_MemoryRead;
|
||||
stream->ReadU8 = Stream_MemoryReadU8;
|
||||
}
|
||||
|
||||
void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len, STRING_PURE String* name) {
|
||||
Stream_CommonMemory(stream, data, len, name);
|
||||
void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len) {
|
||||
Stream_CommonMemory(stream, data, len);
|
||||
stream->Write = Stream_MemoryWrite;
|
||||
}
|
||||
|
||||
@ -251,7 +248,6 @@ static ReturnCode Stream_BufferedReadU8(struct Stream* stream, UInt8* data) {
|
||||
}
|
||||
|
||||
void Stream_ReadonlyBuffered(struct Stream* stream, struct Stream* source, void* data, UInt32 size) {
|
||||
Stream_Init(stream, &source->Name);
|
||||
stream->Read = Stream_BufferedRead;
|
||||
stream->ReadU8 = Stream_BufferedReadU8;
|
||||
|
||||
|
@ -29,21 +29,19 @@ struct Stream {
|
||||
struct { UInt8* Cur; UInt32 Left, Last; UInt8* Base; struct Stream* Source; } Ogg;
|
||||
struct { struct Stream* Source; UInt32 CRC32; } CRC32;
|
||||
} Meta;
|
||||
UChar NameBuffer[String_BufferSize(FILENAME_SIZE)];
|
||||
String Name;
|
||||
};
|
||||
|
||||
ReturnCode Stream_Read(struct Stream* stream, UInt8* buffer, UInt32 count);
|
||||
ReturnCode Stream_Write(struct Stream* stream, UInt8* buffer, UInt32 count);
|
||||
void Stream_Init(struct Stream* stream, STRING_PURE String* name);
|
||||
void Stream_Init(struct Stream* stream);
|
||||
ReturnCode Stream_Skip(struct Stream* stream, UInt32 count);
|
||||
ReturnCode Stream_DefaultReadU8(struct Stream* stream, UInt8* data);
|
||||
|
||||
void Stream_FromFile(struct Stream* stream, void* file, STRING_PURE String* name);
|
||||
void Stream_FromFile(struct Stream* stream, void* file);
|
||||
/* 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);
|
||||
void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len, STRING_PURE String* name);
|
||||
void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len, STRING_PURE String* name);
|
||||
void Stream_ReadonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
||||
void Stream_WriteonlyMemory(struct Stream* stream, void* data, UInt32 len);
|
||||
void Stream_ReadonlyBuffered(struct Stream* stream, struct Stream* source, void* data, UInt32 size);
|
||||
|
||||
UInt16 Stream_GetU16_LE(UInt8* data);
|
||||
@ -54,10 +52,8 @@ UInt32 Stream_GetU32_BE(UInt8* data);
|
||||
void Stream_SetU16_BE(UInt8* data, UInt16 value);
|
||||
void Stream_SetU32_LE(UInt8* data, UInt32 value);
|
||||
void Stream_SetU32_BE(UInt8* data, UInt32 value);
|
||||
|
||||
ReturnCode Stream_ReadU32_LE(struct Stream* stream, UInt32* value);
|
||||
ReturnCode Stream_ReadU32_BE(struct Stream* stream, UInt32* value);
|
||||
UInt8 Stream_ReadU8OrFail(struct Stream* stream);
|
||||
|
||||
ReturnCode Stream_ReadUtf8Char(struct Stream* stream, UInt16* codepoint);
|
||||
ReturnCode Stream_ReadLine(struct Stream* stream, STRING_TRANSIENT String* text);
|
||||
|
@ -518,8 +518,7 @@ bool Convert_TryUnicodeToCP437(UInt16 c, UChar* value) {
|
||||
}
|
||||
|
||||
void String_DecodeUtf8(STRING_TRANSIENT String* str, UInt8* data, UInt32 len) {
|
||||
String name = String_FromConst("Decoding UTF8");
|
||||
struct Stream mem; Stream_ReadonlyMemory(&mem, data, len, &name);
|
||||
struct Stream mem; Stream_ReadonlyMemory(&mem, data, len);
|
||||
UInt16 codepoint;
|
||||
|
||||
while (mem.Meta.Mem.Left) {
|
||||
|
@ -47,7 +47,7 @@ static ReturnCode Zip_ReadLocalFileHeader(struct ZipState* state, struct ZipEntr
|
||||
if (res = Stream_Read(stream, filenameBuffer, filenameLen)) return res;
|
||||
filenameBuffer[filenameLen] = '\0';
|
||||
|
||||
if (!state->SelectEntry(&filename)) return;
|
||||
if (!state->SelectEntry(&filename)) return 0;
|
||||
if (res = Stream_Skip(stream, extraFieldLen)) return res;
|
||||
struct Stream portion, compStream;
|
||||
|
||||
@ -207,7 +207,7 @@ static void EntryList_Load(struct EntryList* list) {
|
||||
void* file; res = File_Open(&file, &path);
|
||||
if (res == ReturnCode_FileNotFound) return;
|
||||
if (res) { Chat_LogError(res, "opening", &path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
/* ReadLine reads single byte at a time */
|
||||
UInt8 buffer[2048]; struct Stream buffered;
|
||||
@ -245,7 +245,7 @@ static void EntryList_Save(struct EntryList* list) {
|
||||
|
||||
void* file; res = File_Create(&file, &path);
|
||||
if (res) { Chat_LogError(res, "creating", &path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
Int32 i;
|
||||
for (i = 0; i < list->Entries.Count; i++) {
|
||||
@ -331,7 +331,7 @@ bool TextureCache_GetStream(STRING_PURE String* url, struct Stream* stream) {
|
||||
if (res == ReturnCode_FileNotFound) return false;
|
||||
|
||||
if (res) { Chat_LogError(res, "opening cache for", url); return false; }
|
||||
Stream_FromFile(stream, file, &path);
|
||||
Stream_FromFile(stream, file);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ void TextureCache_AddData(STRING_PURE String* url, UInt8* data, UInt32 length) {
|
||||
|
||||
void* file; res = File_Create(&file, &path);
|
||||
if (res) { Chat_LogError(res, "creating cache for", url); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
res = Stream_Write(&stream, data, length);
|
||||
if (res) { Chat_LogError(res, "saving data for", url); }
|
||||
@ -428,7 +428,6 @@ void TextureCache_AddLastModified(STRING_PURE String* url, DateTime* lastModifie
|
||||
static void TexturePack_ProcessZipEntry(STRING_TRANSIENT String* path, struct Stream* stream, struct ZipEntry* entry) {
|
||||
String_MakeLowercase(path);
|
||||
String name = *path; Utils_UNSAFE_GetFilename(&name);
|
||||
String_Set(&stream->Name, &name);
|
||||
Event_RaiseEntry(&TextureEvents_FileChanged, stream, &name);
|
||||
}
|
||||
|
||||
@ -450,7 +449,7 @@ void TexturePack_ExtractZip_File(STRING_PURE String* filename) {
|
||||
|
||||
void* file; res = File_Open(&file, &path);
|
||||
if (res) { Chat_LogError(res, "opening", &path); return; }
|
||||
struct Stream stream; Stream_FromFile(&stream, file, &path);
|
||||
struct Stream stream; Stream_FromFile(&stream, file);
|
||||
{
|
||||
res = TexturePack_ExtractZip(&stream);
|
||||
if (res) { Chat_LogError(res, "extracting", &path); }
|
||||
@ -519,9 +518,7 @@ void TexturePack_Extract_Req(struct AsyncRequest* item) {
|
||||
TextureCache_AddETag(&url, &etag);
|
||||
TextureCache_AddLastModified(&url, &item->LastModified);
|
||||
|
||||
String id = String_FromRawArray(item->ID);
|
||||
struct Stream mem; Stream_ReadonlyMemory(&mem, data, len, &id);
|
||||
|
||||
struct Stream mem; Stream_ReadonlyMemory(&mem, data, len);
|
||||
bool png = Bitmap_DetectPng(data, len);
|
||||
ReturnCode res = png ? TexturePack_ExtractTerrainPng(&mem) : TexturePack_ExtractZip(&mem);
|
||||
const UChar* operation = png ? "decoding" : "extracting";
|
||||
|
@ -71,7 +71,7 @@ static ReturnCode Ogg_ReadU8(struct Stream* stream, UInt8* data) {
|
||||
}
|
||||
|
||||
void Ogg_MakeStream(struct Stream* stream, UInt8* buffer, struct Stream* source) {
|
||||
Stream_Init(stream, &source->Name);
|
||||
Stream_Init(stream);
|
||||
stream->Read = Ogg_Read;
|
||||
stream->ReadU8 = Ogg_ReadU8;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user