touchscreen controls
[drnoksnes] / platform / statef.c
1 #include <stdio.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include <zlib.h>
5
6 #include "port.h"
7
8 static gzFile gfd;
9
10 static int zlib_open(const char *fname, const char *mode)
11 {
12         gfd = gzopen(fname, mode);
13         if (!gfd) return 0;
14
15         return 1;
16 }
17
18 static int zlib_read(void *p, int l)
19 {
20         return gzread(gfd, p, l);
21 }
22
23 static int zlib_write(void *p, int l)
24 {
25         return gzwrite(gfd, p, l);
26 }
27
28 static void zlib_close()
29 {
30         gzclose(gfd);
31 }
32
33 int  (*statef_open)(const char *fname, const char *mode) = zlib_open;
34 int  (*statef_read)(void *p, int l) = zlib_read;
35 int  (*statef_write)(void *p, int l) = zlib_write;
36 void (*statef_close)() = zlib_close;
37