void lib3ds_chunk_write_end(Lib3dsChunk *c, Lib3dsIo *io) { assert(c); c->size = lib3ds_io_tell(io) - c->cur; lib3ds_io_seek(io, c->cur + 2, LIB3DS_SEEK_SET); lib3ds_io_write_dword(io, c->size); c->cur += c->size; lib3ds_io_seek(io, c->cur, LIB3DS_SEEK_SET); }
/*! * \ingroup chunk */ Lib3dsBool lib3ds_chunk_write_end(Lib3dsChunk *c, Lib3dsIo *io) { ASSERT(c); c->size=lib3ds_io_tell(io) - c->cur; lib3ds_io_seek(io, c->cur+2, LIB3DS_SEEK_SET); if (!lib3ds_io_write_dword(io, c->size)) { LIB3DS_ERROR_LOG; return(LIB3DS_FALSE); } c->cur+=c->size; lib3ds_io_seek(io, c->cur, LIB3DS_SEEK_SET); if (lib3ds_io_error(io)) { LIB3DS_ERROR_LOG; return(LIB3DS_FALSE); } return(LIB3DS_TRUE); }
/*! * \ingroup chunk */ Lib3dsWord lib3ds_chunk_read_next(Lib3dsChunk *c, Lib3dsIo *io) { Lib3dsChunk d; if (c->cur>=c->end) { ASSERT(c->cur==c->end); return(0); } lib3ds_io_seek(io, (long)c->cur, LIB3DS_SEEK_SET); d.chunk=lib3ds_io_read_word(io); d.size=lib3ds_io_read_dword(io); lib3ds_chunk_debug_dump(&d); c->cur+=d.size; return(d.chunk); }
uint16_t lib3ds_chunk_read_next(Lib3dsChunk *c, Lib3dsIo *io) { Lib3dsChunk d; if (c->cur >= c->end) { assert(c->cur == c->end); return 0; } lib3ds_io_seek(io, (long)c->cur, LIB3DS_SEEK_SET); d.chunk = lib3ds_io_read_word(io); d.size = lib3ds_io_read_dword(io); c->cur += d.size; if (io->log_func) { lib3ds_io_log(io, LIB3DS_LOG_INFO, "%s (0x%X) size=%lu", lib3ds_chunk_name(d.chunk), d.chunk, d.size); } return d.chunk; }
/*! * \ingroup chunk */ void lib3ds_chunk_read_end(Lib3dsChunk *c, Lib3dsIo *io) { lib3ds_chunk_debug_leave(c); lib3ds_io_seek(io, c->end, LIB3DS_SEEK_SET); }
/*! * \ingroup chunk */ void lib3ds_chunk_read_reset(Lib3dsChunk *c, Lib3dsIo *io) { lib3ds_io_seek(io, -6, LIB3DS_SEEK_CUR); }
void lib3ds_chunk_read_end(Lib3dsChunk *c, Lib3dsIo *io) { ((Lib3dsIoImpl*)io->impl)->log_indent--; lib3ds_io_seek(io, c->end, LIB3DS_SEEK_SET); }