1 #ifndef __CORETYPES_H__
2 #define __CORETYPES_H__
7 #ifdef USE_LIBRETRO_VFS
8 #include <streams/file_stream_transforms.h>
11 #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))
13 #if defined(__PS3__) || defined(__PSL1GHT__)
22 typedef uint64_t UINT64;
23 typedef uint32_t UINT32;
24 typedef uint16_t UINT16;
25 typedef uint8_t UINT8;
27 typedef int64_t INT64;
28 typedef int32_t INT32;
29 typedef int16_t INT16;
32 typedef struct chd_core_file {
34 * arbitrary pointer to data the implementation uses to implement the below functions
39 * return the size of a given file as a 64-bit unsigned integer.
40 * the position of the file pointer after calling this function is
41 * undefined because many implementations will seek to the end of the
42 * file and call ftell.
44 * on error, (UINT64)-1 is returned.
46 UINT64(*fsize)(struct chd_core_file*);
49 * should match the behavior of fread, except the FILE* argument at the end
50 * will be replaced with a struct chd_core_file*.
52 size_t(*fread)(void*,size_t,size_t,struct chd_core_file*);
54 // closes the given file.
55 int (*fclose)(struct chd_core_file*);
58 int (*fseek)(struct chd_core_file*, INT64, int);
61 static inline int core_fclose(core_file *fp) {
62 return fp->fclose(fp);
65 static inline size_t core_fread(core_file *fp, void *ptr, size_t len) {
66 return fp->fread(ptr, 1, len, fp);
69 static inline int core_fseek(core_file* fp, INT64 offset, int whence) {
70 return fp->fseek(fp, offset, whence);
73 static inline UINT64 core_fsize(core_file *fp)