aboutsummaryrefslogtreecommitdiff
path: root/Src/nde/android/vfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/nde/android/vfs.h')
-rw-r--r--Src/nde/android/vfs.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/Src/nde/android/vfs.h b/Src/nde/android/vfs.h
new file mode 100644
index 00000000..25d06d8f
--- /dev/null
+++ b/Src/nde/android/vfs.h
@@ -0,0 +1,67 @@
+#ifndef __NDE_VFS_H
+#define __NDE_VFS_H
+
+#include <foundation/types.h>
+#include <stdio.h>
+
+//#define NDE_ALLOW_NONCACHED
+
+/*
+#ifdef NDE_ALLOW_NONCACHED
+ #ifndef NDE_NOWIN32FILEIO
+ #error NDE_ALLOW_NONCACHED at least for now requires NDE_NOWIN32FILEIO
+ #endif
+#endif
+*/
+
+#define VFILE_INC 65536
+
+#define VFS_READ 1
+#define VFS_WRITE 2
+#define VFS_SEEKEOF 4
+#define VFS_CREATE 8
+#define VFS_NEWCONTENT 16
+#define VFS_MUSTEXIST 32
+
+typedef struct {
+ uint8_t *data;
+ unsigned long ptr;
+ unsigned long filesize;
+ unsigned long maxsize;
+ char *filename;
+ char mode;
+ int cached;
+ int dirty;
+
+#ifdef NDE_ALLOW_NONCACHED
+ FILE *rfile;
+#endif
+ FILE *lockFile;
+ char lockname[1024];
+
+ int locks;
+} VFILE;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+VFILE *Vfnew(const char *fl, const char *mode, int Cached);
+VFILE *Vfopen(VFILE *f, const char *fl, const char *mode, int Cached);
+size_t Vfread(void *ptr, size_t size, VFILE *buf);
+void Vfseek(VFILE *fl, long i, int whence);
+unsigned long Vftell(VFILE *fl);
+void Vfclose(VFILE *fl);
+void Vfdestroy(VFILE *fl); // benski> TODO:
+void Vfwrite(const void *ptr, size_t size, VFILE *f);
+int Vfeof(VFILE *fl);
+int Vsync(VFILE *fl); // 1 on error updating
+int Vflock(VFILE *fl, bool is_sync=true); // returns 0 on failure
+void Vfunlock(VFILE *fl, bool is_sync=true);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+