src/file/SDL_rwops.c
changeset 2735 204be4fc2726
parent 2185 2032348afed1
child 2859 99210400e8b9
     1.1 --- a/src/file/SDL_rwops.c	Wed Aug 27 13:37:19 2008 +0000
     1.2 +++ b/src/file/SDL_rwops.c	Wed Aug 27 15:10:03 2008 +0000
     1.3 @@ -28,6 +28,10 @@
     1.4  #include "SDL_endian.h"
     1.5  #include "SDL_rwops.h"
     1.6  
     1.7 +#ifdef __NDS__
     1.8 +/* include libfat headers for fatInitDefault(). */
     1.9 +#include <fat.h>
    1.10 +#endif /* __NDS__ */
    1.11  
    1.12  #ifdef __WIN32__
    1.13  
    1.14 @@ -132,6 +136,7 @@
    1.15  
    1.16      return 0;                   /* ok */
    1.17  }
    1.18 +
    1.19  static long SDLCALL
    1.20  win32_file_seek(SDL_RWops * context, long offset, int whence)
    1.21  {
    1.22 @@ -173,6 +178,7 @@
    1.23      SDL_Error(SDL_EFSEEK);
    1.24      return -1;                  /* error */
    1.25  }
    1.26 +
    1.27  static size_t SDLCALL
    1.28  win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
    1.29  {
    1.30 @@ -226,6 +232,7 @@
    1.31      }
    1.32      return (total_read / size);
    1.33  }
    1.34 +
    1.35  static size_t SDLCALL
    1.36  win32_file_write(SDL_RWops * context, const void *ptr, size_t size,
    1.37                   size_t num)
    1.38 @@ -265,6 +272,7 @@
    1.39      nwritten = byte_written / size;
    1.40      return nwritten;
    1.41  }
    1.42 +
    1.43  static int SDLCALL
    1.44  win32_file_close(SDL_RWops * context)
    1.45  {
    1.46 @@ -298,6 +306,7 @@
    1.47          return (-1);
    1.48      }
    1.49  }
    1.50 +
    1.51  static size_t SDLCALL
    1.52  stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
    1.53  {
    1.54 @@ -309,6 +318,7 @@
    1.55      }
    1.56      return (nread);
    1.57  }
    1.58 +
    1.59  static size_t SDLCALL
    1.60  stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
    1.61  {
    1.62 @@ -320,6 +330,7 @@
    1.63      }
    1.64      return (nwrote);
    1.65  }
    1.66 +
    1.67  static int SDLCALL
    1.68  stdio_close(SDL_RWops * context)
    1.69  {
    1.70 @@ -368,6 +379,7 @@
    1.71      context->hidden.mem.here = newpos;
    1.72      return (context->hidden.mem.here - context->hidden.mem.base);
    1.73  }
    1.74 +
    1.75  static size_t SDLCALL
    1.76  mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
    1.77  {
    1.78 @@ -390,6 +402,7 @@
    1.79  
    1.80      return (total_bytes / size);
    1.81  }
    1.82 +
    1.83  static size_t SDLCALL
    1.84  mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
    1.85  {
    1.86 @@ -400,12 +413,14 @@
    1.87      context->hidden.mem.here += num * size;
    1.88      return (num);
    1.89  }
    1.90 +
    1.91  static size_t SDLCALL
    1.92  mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num)
    1.93  {
    1.94      SDL_SetError("Can't write to read-only memory");
    1.95      return (-1);
    1.96  }
    1.97 +
    1.98  static int SDLCALL
    1.99  mem_close(SDL_RWops * context)
   1.100  {
   1.101 @@ -463,6 +478,13 @@
   1.102  {
   1.103      SDL_RWops *rwops = NULL;
   1.104  
   1.105 +#if 0
   1.106 +/*#ifdef __NDS__*/
   1.107 +    /* set it up so we can use stdio file function */
   1.108 +    fatInitDefault();
   1.109 +    printf("called fatInitDefault()");
   1.110 +#endif /* __NDS__ */
   1.111 +
   1.112      rwops = SDL_AllocRW();
   1.113      if (rwops != NULL) {
   1.114          rwops->seek = stdio_seek;