diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-23 02:27:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:15 +0300 |
commit | d80453b5cbf958084a21e624b1dcd2798f19659a (patch) | |
tree | cfba137838d9d3fb51f1b329bc028053b71449a2 /src/utils/physfsrwops.cpp | |
parent | ae63e2860fe413649090bcaa4fb5cd322c6f852a (diff) | |
download | manaverse-d80453b5cbf958084a21e624b1dcd2798f19659a.tar.gz manaverse-d80453b5cbf958084a21e624b1dcd2798f19659a.tar.bz2 manaverse-d80453b5cbf958084a21e624b1dcd2798f19659a.tar.xz manaverse-d80453b5cbf958084a21e624b1dcd2798f19659a.zip |
add support for size attribute in physfsrwops for SDL2.
Diffstat (limited to 'src/utils/physfsrwops.cpp')
-rw-r--r-- | src/utils/physfsrwops.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index 62330f33a..d0560fb1e 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -151,6 +151,15 @@ static int physfsrwops_close(SDL_RWops *const rw) return 0; } /* physfsrwops_close */ +#ifdef USE_SDL2 +static PHYSFSINT physfsrwops_size(SDL_RWops *const rw) +{ + PHYSFS_file *const handle = static_cast<PHYSFS_file*>( + rw->hidden.unknown.data1); + return PHYSFS_fileLength(handle); +} /* physfsrwops_size */ +#endif + static SDL_RWops *create_rwops(PHYSFS_file *const handle) { SDL_RWops *retval = nullptr; @@ -164,6 +173,9 @@ static SDL_RWops *create_rwops(PHYSFS_file *const handle) retval = SDL_AllocRW(); if (retval) { +#ifdef USE_SDL2 + retval->size = physfsrwops_size; +#endif retval->seek = physfsrwops_seek; retval->read = physfsrwops_read; retval->write = physfsrwops_write; |