--- a/extras/physfsrwops.c Tue Jul 28 15:13:35 2015 -0400 +++ b/extras/physfsrwops.c Fri Jul 31 02:26:35 2015 +0200 @@ -160,13 +160,15 @@ PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1; const PHYSFS_uint64 writelen = (PHYSFS_uint64) (num * size); const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen); - if (rc != ((PHYSFS_sint64) writelen)) + if (rc != ((PHYSFS_sint64) writelen)) { SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); + return 0; + } #if TARGET_SDL2 - return (size_t) rc; + return (size_t) rc / size; #else - return (int) rc; + return (int) rc / size; #endif } /* physfsrwops_write */