diff --git a/libretro-common/include/streams/memory_stream.h b/libretro-common/include/streams/memory_stream.h index 3609d6f0fe..b4041e4b81 100644 --- a/libretro-common/include/streams/memory_stream.h +++ b/libretro-common/include/streams/memory_stream.h @@ -42,6 +42,8 @@ char *memstream_gets(memstream_t *stream, char *buffer, size_t len); size_t memstream_pos(memstream_t *stream); +void memstream_rewind(memstream_t *stream); + int memstream_seek(memstream_t *stream, int offset, int whence); void memstream_set_buffer(uint8_t *buffer, size_t size); diff --git a/libretro-common/streams/memory_stream.c b/libretro-common/streams/memory_stream.c index 396f388d0f..ffeb4a3191 100644 --- a/libretro-common/streams/memory_stream.c +++ b/libretro-common/streams/memory_stream.c @@ -142,6 +142,11 @@ int memstream_seek(memstream_t *stream, int offset, int whence) return -1; } +void memstream_rewind(memstream_t *stream) +{ + memstream_seek(stream, 0L, SEEK_SET); +} + size_t memstream_pos(memstream_t *stream) { return stream->ptr;