diff --git a/menu/drivers/zr_common.c b/menu/drivers/zr_common.c index a89077105e..5be514a702 100644 --- a/menu/drivers/zr_common.c +++ b/menu/drivers/zr_common.c @@ -15,6 +15,8 @@ * If not, see . */ +#include + #include "zr_common.h" #include "../menu_display.h" @@ -43,15 +45,9 @@ struct zr_image zr_common_image_load(const char *filename) char* zr_common_file_load(const char* path, size_t* size) { - char *buf; - FILE *fd = fopen(path, "rb"); - - fseek(fd, 0, SEEK_END); - *size = (size_t)ftell(fd); - fseek(fd, 0, SEEK_SET); - buf = (char*)calloc(*size, 1); - fread(buf, *size, 1, fd); - fclose(fd); + void *buf; + ssize_t *length = (ssize_t*)size; + retro_read_file(path, &buf, length); return buf; }