mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Make it possible to initialize memory stream interface in
writable mode
This commit is contained in:
parent
9b4bb51c2e
commit
175d601a4e
@ -42,9 +42,13 @@ typedef struct intfstream_info
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t *data;
|
||||
unsigned size;
|
||||
} buf;
|
||||
struct
|
||||
{
|
||||
uint8_t *data;
|
||||
unsigned size;
|
||||
} buf;
|
||||
bool writable;
|
||||
} memory;
|
||||
enum intfstream_type type;
|
||||
} intfstream_info_t;
|
||||
|
||||
|
@ -43,6 +43,7 @@ struct intfstream_internal
|
||||
unsigned size;
|
||||
} buf;
|
||||
memstream_t *fp;
|
||||
bool writable;
|
||||
} memory;
|
||||
};
|
||||
|
||||
@ -56,8 +57,8 @@ bool intfstream_resize(intfstream_internal_t *intf, intfstream_info_t *info)
|
||||
case INTFSTREAM_FILE:
|
||||
break;
|
||||
case INTFSTREAM_MEMORY:
|
||||
intf->memory.buf.data = info->buf.data;
|
||||
intf->memory.buf.size = info->buf.size;
|
||||
intf->memory.buf.data = info->memory.buf.data;
|
||||
intf->memory.buf.size = info->memory.buf.size;
|
||||
|
||||
memstream_set_buffer(intf->memory.buf.data,
|
||||
intf->memory.buf.size);
|
||||
@ -81,7 +82,7 @@ bool intfstream_open(intfstream_internal_t *intf, const char *path,
|
||||
return false;
|
||||
break;
|
||||
case INTFSTREAM_MEMORY:
|
||||
intf->memory.fp = memstream_open(0);
|
||||
intf->memory.fp = memstream_open(intf->memory.writable);
|
||||
if (!intf->memory.fp)
|
||||
return false;
|
||||
break;
|
||||
@ -125,6 +126,7 @@ void *intfstream_init(intfstream_info_t *info)
|
||||
case INTFSTREAM_FILE:
|
||||
break;
|
||||
case INTFSTREAM_MEMORY:
|
||||
intf->memory.writable = info->memory.writable;
|
||||
if (!intfstream_resize(intf, info))
|
||||
goto error;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user