Change functions

This commit is contained in:
twinaphex 2017-12-11 12:31:14 +01:00
parent fde596fae4
commit 38e6d2443f
3 changed files with 32 additions and 20 deletions

View File

@ -91,13 +91,13 @@ void intfstream_putc(intfstream_internal_t *intf, int c);
int intfstream_close(intfstream_internal_t *intf); int intfstream_close(intfstream_internal_t *intf);
intfstream_t* intfstream_open_file(const char *path, intfstream_t* intfstream_open_file(const char *path,
unsigned hints); unsigned mode, unsigned hints);
intfstream_t *intfstream_open_memory(void *data, intfstream_t *intfstream_open_memory(void *data,
size_t size, unsigned hints); unsigned mode, unsigned hints, size_t size);
intfstream_t *intfstream_open_chd_track(const char *path, intfstream_t *intfstream_open_chd_track(const char *path,
int32_t track, unsigned hints); unsigned mode, unsigned hints, int32_t track);
RETRO_END_DECLS RETRO_END_DECLS

View File

@ -341,7 +341,8 @@ void intfstream_putc(intfstream_internal_t *intf, int c)
} }
} }
intfstream_t* intfstream_open_file(const char *path, unsigned hints) intfstream_t* intfstream_open_file(const char *path,
unsigned mode, unsigned hints)
{ {
intfstream_info_t info; intfstream_info_t info;
intfstream_t *fd = NULL; intfstream_t *fd = NULL;
@ -352,7 +353,7 @@ intfstream_t* intfstream_open_file(const char *path, unsigned hints)
if (!fd) if (!fd)
return NULL; return NULL;
if (!intfstream_open(fd, path, RETRO_VFS_FILE_ACCESS_READ, hints)) if (!intfstream_open(fd, path, mode, hints))
goto error; goto error;
return fd; return fd;
@ -366,7 +367,8 @@ error:
return NULL; return NULL;
} }
intfstream_t *intfstream_open_memory(void *data, size_t size, unsigned hints) intfstream_t *intfstream_open_memory(void *data,
unsigned mode, unsigned hints, size_t size)
{ {
intfstream_info_t info; intfstream_info_t info;
intfstream_t *fd = NULL; intfstream_t *fd = NULL;
@ -381,7 +383,7 @@ intfstream_t *intfstream_open_memory(void *data, size_t size, unsigned hints)
if (!fd) if (!fd)
return NULL; return NULL;
if (!intfstream_open(fd, NULL, RETRO_VFS_FILE_ACCESS_READ, hints)) if (!intfstream_open(fd, NULL, mode, hints))
goto error; goto error;
return fd; return fd;
@ -396,7 +398,7 @@ error:
} }
intfstream_t *intfstream_open_chd_track(const char *path, intfstream_t *intfstream_open_chd_track(const char *path,
int32_t track, unsigned hints) unsigned mode, unsigned hints, int32_t track)
{ {
intfstream_info_t info; intfstream_info_t info;
intfstream_t *fd = NULL; intfstream_t *fd = NULL;
@ -409,8 +411,7 @@ intfstream_t *intfstream_open_chd_track(const char *path,
if (!fd) if (!fd)
return NULL; return NULL;
if (!intfstream_open(fd, path, if (!intfstream_open(fd, path, mode, hints))
RETRO_VFS_FILE_ACCESS_READ, RFILE_HINT_NONE))
goto error; goto error;
return fd; return fd;

View File

@ -206,7 +206,8 @@ static bool intfstream_file_get_serial(const char *name,
int rv; int rv;
uint8_t *data = NULL; uint8_t *data = NULL;
ssize_t file_size = -1; ssize_t file_size = -1;
intfstream_t *fd = intfstream_open_file(name, RFILE_HINT_NONE); intfstream_t *fd = intfstream_open_file(name,
RETRO_VFS_FILE_ACCESS_READ, RFILE_HINT_NONE);
if (!fd) if (!fd)
return 0; return 0;
@ -237,7 +238,9 @@ static bool intfstream_file_get_serial(const char *name,
intfstream_close(fd); intfstream_close(fd);
free(fd); free(fd);
fd = intfstream_open_memory(data, size, RFILE_HINT_NONE); fd = intfstream_open_memory(data, RETRO_VFS_FILE_ACCESS_READ,
RFILE_HINT_NONE,
size);
if (!fd) if (!fd)
{ {
free(data); free(data);
@ -319,8 +322,10 @@ static int task_database_chd_get_serial(const char *name, char* serial)
{ {
int result; int result;
intfstream_t *fd = intfstream_open_chd_track( intfstream_t *fd = intfstream_open_chd_track(
name, CHDSTREAM_TRACK_FIRST_DATA, name,
RFILE_HINT_NONE); RETRO_VFS_FILE_ACCESS_READ,
RFILE_HINT_NONE,
CHDSTREAM_TRACK_FIRST_DATA);
if (!fd) if (!fd)
return 0; return 0;
@ -351,7 +356,8 @@ static bool intfstream_file_get_crc(const char *name,
size_t offset, size_t size, uint32_t *crc) size_t offset, size_t size, uint32_t *crc)
{ {
int rv; int rv;
intfstream_t *fd = intfstream_open_file(name, RFILE_HINT_NONE); intfstream_t *fd = intfstream_open_file(name,
RETRO_VFS_FILE_ACCESS_READ, RFILE_HINT_NONE);
uint8_t *data = NULL; uint8_t *data = NULL;
ssize_t file_size = -1; ssize_t file_size = -1;
@ -381,7 +387,8 @@ static bool intfstream_file_get_crc(const char *name,
intfstream_close(fd); intfstream_close(fd);
free(fd); free(fd);
fd = intfstream_open_memory(data, size, RFILE_HINT_NONE); fd = intfstream_open_memory(data, RETRO_VFS_FILE_ACCESS_READ,
RFILE_HINT_NONE, size);
if (!fd) if (!fd)
goto error; goto error;
@ -472,8 +479,10 @@ static bool task_database_chd_get_crc(const char *name, uint32_t *crc)
{ {
int rv; int rv;
intfstream_t *fd = intfstream_open_chd_track( intfstream_t *fd = intfstream_open_chd_track(
name, CHDSTREAM_TRACK_PRIMARY, name,
RFILE_HINT_NONE); RETRO_VFS_FILE_ACCESS_READ,
RFILE_HINT_NONE,
CHDSTREAM_TRACK_PRIMARY);
if (!fd) if (!fd)
return 0; return 0;
@ -495,7 +504,8 @@ static void task_database_cue_prune(database_info_handle_t *db,
{ {
size_t i; size_t i;
char *path = (char *)malloc(PATH_MAX_LENGTH + 1); char *path = (char *)malloc(PATH_MAX_LENGTH + 1);
intfstream_t *fd = intfstream_open_file(name, RFILE_HINT_NONE); intfstream_t *fd = intfstream_open_file(name,
RETRO_VFS_FILE_ACCESS_READ, RFILE_HINT_NONE);
if (!fd) if (!fd)
goto end; goto end;
@ -527,7 +537,8 @@ static void gdi_prune(database_info_handle_t *db, const char *name)
{ {
size_t i; size_t i;
char *path = (char *)malloc(PATH_MAX_LENGTH + 1); char *path = (char *)malloc(PATH_MAX_LENGTH + 1);
intfstream_t *fd = intfstream_open_file(name, RFILE_HINT_NONE); intfstream_t *fd = intfstream_open_file(name,
RETRO_VFS_FILE_ACCESS_READ, RFILE_HINT_NONE);
if (!fd) if (!fd)
goto end; goto end;