diff --git a/mednafen/file.c b/mednafen/file.c index 83bf31d..6fde969 100644 --- a/mednafen/file.c +++ b/mednafen/file.c @@ -67,76 +67,3 @@ int file_close(struct MDFNFILE *file) return 1; } - -uint64_t file_read(struct MDFNFILE *file, void *ptr, - size_t element_size, size_t nmemb) -{ - uint32_t total = element_size * nmemb; - - if (file->location >= file->size) - return 0; - - if ((file->location + total) > file->size) - { - int64_t ak = file->size - file->location; - - memcpy((uint8_t*)ptr, file->data + file->location, ak); - - file->location = file->size; - - return(ak / element_size); - } - - memcpy((uint8_t*)ptr, file->data + file->location, total); - - file->location += total; - - return nmemb; -} - -int file_seek(struct MDFNFILE *file, int64_t offset, int whence) -{ - switch(whence) - { - case SEEK_SET: - if (offset >= file->size) - return -1; - - file->location = offset; - break; - case SEEK_CUR: - if ((offset + file->location) > file->size) - return -1; - - file->location += offset; - break; - } - - return 0; -} - -char *file_fgets(struct MDFNFILE *file, char *s, int len) -{ - int pos = 0; - - if (!len) - return(NULL); - - if (file->location >= len) - return(NULL); - - while(pos < (len - 1) && file->location < len) - { - int v = file->data[file->location]; - s[pos] = v; - file->location++; - pos++; - if (v == '\n') - break; - } - - if (len) - s[pos] = 0; - - return s; -} diff --git a/mednafen/file.h b/mednafen/file.h index f035e4a..65392e3 100644 --- a/mednafen/file.h +++ b/mednafen/file.h @@ -22,13 +22,6 @@ struct MDFNFILE *file_open(const char *path); int file_close(struct MDFNFILE *file); -uint64_t file_read(struct MDFNFILE *file, void *ptr, - size_t element_size, size_t nmemb); - -int file_seek(struct MDFNFILE *file, int64_t offset, int whence); - -char *file_fgets(struct MDFNFILE *file, char *s, int buffer_size); - #ifdef __cplusplus } #endif