aboutsummaryrefslogtreecommitdiff
path: root/backends/fs
diff options
context:
space:
mode:
Diffstat (limited to 'backends/fs')
-rw-r--r--backends/fs/ds/ds-fs.cpp26
-rw-r--r--backends/fs/ds/ds-fs.h40
2 files changed, 34 insertions, 32 deletions
diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp
index 26a95976e6..40d160bbc8 100644
--- a/backends/fs/ds/ds-fs.cpp
+++ b/backends/fs/ds/ds-fs.cpp
@@ -22,7 +22,7 @@
#include "str.h"
#include "fs.h"
#include "common/util.h"
-#include <NDS/ARM9/console.h> //basic print funcionality
+//#include <NDS/ARM9/console.h> //basic print funcionality
#include "ds-fs.h"
#include "dsmain.h"
#include "gba_nds_fat.h"
@@ -30,29 +30,7 @@
namespace DS {
-struct fileHandle {
- int pos;
- bool used;
- char* data;
- int size;
-
- DSSaveFile* sramFile;
-};
-
-#define FILE DS::fileHandle
-
-// FIXME: The following definition for stdin etc. are duplicated in common/util.cpp.
-// This should be fixed, e.g. by moving this (and the declarations of fileHandle,
-// the various functions etc.) into a separate header file which includes by util.cpp,
-// file.cpp and ds-fs.cpp
-
-#undef stderr
-#undef stdout
-#undef stdin
-#define stdout ((DS::fileHandle*) -1)
-#define stderr ((DS::fileHandle*) -2)
-#define stdin ((DS::fileHandle*) -3)
//////////////////////////////////////////////////////////////
@@ -751,7 +729,7 @@ char* std_fgets(char* str, int size, FILE* file) {
p++;
file->sramFile->read((char *) &str[p], 1);
// consolePrintf("%d,", str[p]);
- } while ((str[p] >= 32) && (!feof(file)) && (p < size));
+ } while ((str[p] >= 32) && (!std_feof(file)) && (p < size));
str[p + 1] = 0;
file->pos++;
// consolePrintf("Read:%s\n", str);
diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h
index bd14f5c795..2830ff61ae 100644
--- a/backends/fs/ds/ds-fs.h
+++ b/backends/fs/ds/ds-fs.h
@@ -21,9 +21,6 @@
#define _DS_FS_H
-#include "stdafx.h"
-#include "common/array.h"
-#include "common/str.h"
//#include <NDS/ARM9/console.h>
#include "fs.h"
@@ -105,13 +102,40 @@ public:
};
-// FIXME: Why is assert redefined ? And why here (this is definitely the wrong place).
-#ifdef assert
-#undef assert
-#endif
-#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
+struct fileHandle {
+ int pos;
+ bool used;
+ char* data;
+ int size;
+
+ DSSaveFile* sramFile;
+};
+
+
+#undef stderr
+#undef stdout
+#undef stdin
+
+#define stdout ((DS::fileHandle*) -1)
+#define stderr ((DS::fileHandle*) -2)
+#define stdin ((DS::fileHandle*) -3)
+
+#define FILE DS::fileHandle
+
+// Please do not remove any of these prototypes that appear not to be required.
+FILE* std_fopen(const char* name, const char* mode);
+void std_fclose(FILE* handle);
+int std_getc(FILE* handle);
+size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle);
+size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle);
+bool std_feof(FILE* handle);
+long int std_ftell(FILE* handle);
+int std_fseek(FILE* handle, long int offset, int whence);
+void std_clearerr(FILE* handle);
+void std_cwd(char* dir);
+void std_fflush(FILE* handle);
}