mirror of
https://github.com/libretro/RetroArch
synced 2025-04-25 00:02:31 +00:00
(libretro-common) Add intfstream_open
This commit is contained in:
parent
5eb3bb05f7
commit
554ca4f087
@ -53,4 +53,7 @@ void *intfstream_init(intfstream_info_t *info);
|
|||||||
bool intfstream_resize(intfstream_internal_t *intf,
|
bool intfstream_resize(intfstream_internal_t *intf,
|
||||||
intfstream_info_t *info);
|
intfstream_info_t *info);
|
||||||
|
|
||||||
|
bool intfstream_open(intfstream_internal_t *intf,
|
||||||
|
const char *path, unsigned mode, ssize_t len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,6 +8,11 @@ struct intfstream_internal
|
|||||||
{
|
{
|
||||||
enum intfstream_type type;
|
enum intfstream_type type;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
RFILE *fp;
|
||||||
|
} file;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
@ -15,6 +20,7 @@ struct intfstream_internal
|
|||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
} buf;
|
} buf;
|
||||||
|
memstream_t *fp;
|
||||||
} memory;
|
} memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,6 +45,28 @@ bool intfstream_resize(intfstream_internal_t *intf, intfstream_info_t *info)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool intfstream_open(intfstream_internal_t *intf, const char *path, unsigned mode, ssize_t len)
|
||||||
|
{
|
||||||
|
if (!intf)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (intf->type)
|
||||||
|
{
|
||||||
|
case INTFSTREAM_FILE:
|
||||||
|
intf->file.fp = filestream_open(path, mode, len);
|
||||||
|
if (!intf->file.fp)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case INTFSTREAM_MEMORY:
|
||||||
|
intf->memory.fp = memstream_open();
|
||||||
|
if (!intf->memory.fp)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void *intfstream_init(intfstream_info_t *info)
|
void *intfstream_init(intfstream_info_t *info)
|
||||||
{
|
{
|
||||||
intfstream_internal_t *intf = NULL;
|
intfstream_internal_t *intf = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user