notaz.gp2x.de
/
fceu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
release r2, update credits
[fceu.git]
/
drivers
/
common
/
config.c
diff --git
a/drivers/common/config.c
b/drivers/common/config.c
index
6f87f55
..
5c72317
100644
(file)
--- a/
drivers/common/config.c
+++ b/
drivers/common/config.c
@@
-29,6
+29,9
@@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef GP2X
+#include <unistd.h>
+#endif
#include "../../types.h"
#include "config.h"
#include "../../types.h"
#include "config.h"
@@
-40,7
+43,7
@@
static int FReadString(FILE *fp, char *str, int n)
{
z=fgetc(fp);
str[x]=z;
{
z=fgetc(fp);
str[x]=z;
- x++;
+ x++;
if(z<=0) break;
if(x>=n) return 0;
}
if(z<=0) break;
if(x>=n) return 0;
}
@@
-112,16
+115,20
@@
static void SaveParse(CFGSTRUCT *cfgst, FILE *fp)
} while(cfgst[x].ptr);
}
} while(cfgst[x].ptr);
}
-
void
SaveFCEUConfig(char *filename, CFGSTRUCT *cfgst)
+
int
SaveFCEUConfig(char *filename, CFGSTRUCT *cfgst)
{
FILE *fp;
fp=fopen(filename,"wb");
{
FILE *fp;
fp=fopen(filename,"wb");
- if(fp==NULL) return;
+ if(fp==NULL) return
-1
;
SaveParse(cfgst,fp);
fclose(fp);
SaveParse(cfgst,fp);
fclose(fp);
+#ifdef GP2X
+ sync();
+#endif
+ return 0;
}
static void LoadParse(CFGSTRUCT *cfgst, FILE *fp)
}
static void LoadParse(CFGSTRUCT *cfgst, FILE *fp)
@@
-140,12
+147,13
@@
static void LoadParse(CFGSTRUCT *cfgst, FILE *fp)
} while(cfgst[x].ptr);
}
} while(cfgst[x].ptr);
}
-
void
LoadFCEUConfig(char *filename, CFGSTRUCT *cfgst)
+
int
LoadFCEUConfig(char *filename, CFGSTRUCT *cfgst)
{
FILE *fp;
fp=fopen(filename,"rb");
{
FILE *fp;
fp=fopen(filename,"rb");
- if(fp==NULL) return;
+ if(fp==NULL) return
-1
;
LoadParse(cfgst,fp);
fclose(fp);
LoadParse(cfgst,fp);
fclose(fp);
+ return 0;
}
}