misc/libphyslayer/physfsrwops.c
changeset 9378 2be457289e60
parent 9309 7e8f91634f80
child 10017 de822cd3df3a
--- a/misc/libphyslayer/physfsrwops.c	Fri Jul 26 23:02:25 2013 +0200
+++ b/misc/libphyslayer/physfsrwops.c	Sat Jul 27 01:06:47 2013 +0200
@@ -32,6 +32,14 @@
 #endif
 
 #if TARGET_SDL13
+static SDLCALL Sint64 physfsrwops_size(struct SDL_RWops *rw)
+{
+    PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
+    return PHYSFS_fileLength(handle);
+}
+#endif
+
+#if TARGET_SDL13
 static SDLCALL Sint64 physfsrwops_seek(struct SDL_RWops *rw, Sint64 offset, int whence)
 #else
 static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
@@ -42,7 +50,6 @@
 
     if (whence == SEEK_SET)
         pos = (PHYSFS_sint64) offset;
-
     else if (whence == SEEK_CUR)
     {
         const PHYSFS_sint64 current = PHYSFS_tell(handle);
@@ -173,6 +180,9 @@
         retval = SDL_AllocRW();
         if (retval != NULL)
         {
+#if TARGET_SDL13
+            retval->size  = physfsrwops_size;
+#endif
             retval->seek  = physfsrwops_seek;
             retval->read  = physfsrwops_read;
             retval->write = physfsrwops_write;