diff --git a/libretro-common/include/streams/interface_stream.h b/libretro-common/include/streams/interface_stream.h index dc9a55981e..2fc6ca0b6f 100644 --- a/libretro-common/include/streams/interface_stream.h +++ b/libretro-common/include/streams/interface_stream.h @@ -72,6 +72,8 @@ int intfstream_seek(intfstream_internal_t *intf, void intfstream_rewind(intfstream_internal_t *intf); +size_t intfstream_tell(intfstream_internal_t *intf); + int intfstream_close(intfstream_internal_t *intf); #endif diff --git a/libretro-common/streams/interface_stream.c b/libretro-common/streams/interface_stream.c index 5bdc397de7..e4235724ae 100644 --- a/libretro-common/streams/interface_stream.c +++ b/libretro-common/streams/interface_stream.c @@ -222,6 +222,22 @@ int intfstream_getc(intfstream_internal_t *intf) return 0; } +size_t intfstream_tell(intfstream_internal_t *intf) +{ + if (!intf) + return -1; + + switch (intf->type) + { + case INTFSTREAM_FILE: + return filestream_tell(intf->file.fp); + case INTFSTREAM_MEMORY: + return memstream_pos(intf->memory.fp); + } + + return -1; +} + void intfstream_rewind(intfstream_internal_t *intf) { switch (intf->type)