mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Rewrite zr_common_file_load to use file_stream.h
This commit is contained in:
parent
79008d4fd6
commit
e9fd6863ce
@ -15,6 +15,8 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <streams/file_stream.h>
|
||||||
|
|
||||||
#include "zr_common.h"
|
#include "zr_common.h"
|
||||||
|
|
||||||
#include "../menu_display.h"
|
#include "../menu_display.h"
|
||||||
@ -35,16 +37,10 @@ struct zr_image zr_common_image_load(const char *filename)
|
|||||||
|
|
||||||
char* zr_common_file_load(const char* path, size_t* size)
|
char* zr_common_file_load(const char* path, size_t* size)
|
||||||
{
|
{
|
||||||
char *buf;
|
void *buf;
|
||||||
FILE *fd = fopen(path, "rb");
|
ssize_t *length = (ssize_t*)size;
|
||||||
|
retro_read_file(path, &buf, length);
|
||||||
fseek(fd, 0, SEEK_END);
|
return (char*)buf;
|
||||||
*size = (size_t)ftell(fd);
|
|
||||||
fseek(fd, 0, SEEK_SET);
|
|
||||||
buf = (char*)calloc(*size, 1);
|
|
||||||
fread(buf, *size, 1, fd);
|
|
||||||
fclose(fd);
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void zr_common_device_init(struct zr_device *dev)
|
void zr_common_device_init(struct zr_device *dev)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user