commit aca2f4b0
PhysFS reads blockattack.data again. Puzzle files are read using physfs. iostream now supports physfs.
git-svn-id: https://blockattack.svn.sourceforge.net/svnroot/blockattack/trunk@87 9d7177f8-192b-0410-8f35-a16a89829b06
Changed files
| A | Game/puzzles/copy |
| A | Game/puzzles/puzzle.levels |
| A | Game/puzzles/testPuzzles |
| D | Game/res/copy before |
| D | Game/res/puzzle.levels before |
| D | Game/res/testPuzzles before |
| M | source/code/block.make before |
| M | source/code/main.cpp before |
| A | source/code/physfs_stream.hpp |
diff --git a/Game/puzzles/copy b/Game/puzzles/copy
new file mode 100755
index 0000000..9617703
--- /dev/null
+++ b/Game/puzzles/copy
@@ -0,0 +1,339 @@
+26
+1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 1 1 -1 -1
+-1 1 0 0 -1 0
+1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 0 -1 4 -1 -1
+-1 3 4 2 -1 -1
+-1 3 0 0 -1 -1
+-1 0 2 2 -1 -1
+-1 3 0 0 4 -1
+2
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 0 1 -1 -1
+-1 -1 0 1 -1 -1
+-1 -1 1 0 -1 -1
+-1 -1 1 0 -1 -1
+-1 -1 0 1 -1 -1
+2
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4 -1 -1
+2
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1
+-1 -1 -1 3 -1 -1
+-1 -1 -1 1 -1 -1
+-1 -1 1 1 -1 -1
+-1 -1 4 4 -1 -1
+-1 4 0 0 -1 -1
+-1 0 3 3 -1 -1
diff --git a/Game/res/copy b/Game/res/copy
deleted file mode 100755
index 9617703..0000000
--- a/Game/res/copy
+++ /dev/null
@@ -1,339 +0,0 @@
-26
-1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 1 1 -1 -1
--1 1 0 0 -1 0
-1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 0 -1 4 -1 -1
--1 3 4 2 -1 -1
--1 3 0 0 -1 -1
--1 0 2 2 -1 -1
--1 3 0 0 4 -1
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 0 1 -1 -1
--1 -1 0 1 -1 -1
--1 -1 1 0 -1 -1
--1 -1 1 0 -1 -1
--1 -1 0 1 -1 -1
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -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-1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
-2 -1 2 -1 2 -1
-0 -1 3 -1 0 -1
-1 -1 3 -1 1 -1
-0 -1 4 -1 0 -1
-1 -1 4 -1 4 -1
-0 2 3 2 0 -1
-3
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 2 -1 -1 -1
--1 -1 3 -1 -1 -1
--1 3 1 -1 -1 -1
--1 0 0 -1 -1 -1
--1 1 2 3 -1 -1
--1 0 1 2 -1 -1
-3
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 0 1 0 -1
-1 1 0 1 1 0
-0 2 2 0 2 1
diff --git a/Game/res/puzzle.levels b/Game/res/puzzle.levels
deleted file mode 100755
index c53240d..0000000
--- a/Game/res/puzzle.levels
+++ /dev/null
@@ -1,352 +0,0 @@
-27
-1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 1 1 -1 -1
--1 1 0 0 -1 0
-1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 0 -1 4 -1 -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 4 0 5 3 1
-3 5 1 2 0 4
-3 5 1 2 0 4
-0 2 4 3 1 5
-0 2 4 3 1 5
diff --git a/Game/res/testPuzzles b/Game/res/testPuzzles
deleted file mode 100644
index 807500f..0000000
--- a/Game/res/testPuzzles
+++ /dev/null
@@ -1,92 +0,0 @@
-7
-1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
-0 0 3 4 0 0
-0 0 3 4 0 0
-3 3 4 3 4 4
-0 0 3 4 0 0
-0 0 3 4 0 0
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 3 -1 -1
--1 -1 -1 0 -1 -1
--1 2 0 1 -1 -1
--1 3 3 0 -1 -1
--1 2 1 3 -1 -1
--1 2 3 1 -1 -1
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 4 0 -1 -1
--1 -1 0 4 3 3
--1 -1 4 0 4 4
--1 -1 0 4 3 3
--1 -1 0 4 3 3
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 5 -1 -1
--1 -1 -1 5 -1 -1
--1 -1 5 3 -1 -1
--1 -1 4 4 -1 -1
--1 -1 3 3 4 -1
-3
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 2 -1 -1 -1 -1
--1 3 -1 -1 -1 -1
--1 2 0 2 -1 -1
--1 2 3 3 -1 -1
--1 0 1 0 -1 -1
--1 0 2 2 -1 -1
--1 3 1 1 -1 -1
--1 3 0 0 -1 -1
-3 0 3 3 -1 -1
-3
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 1 -1 -1 -1 -1
--1 1 4 -1 -1 -1
--1 3 3 1 -1 -1
--1 3 4 4 -1 -1
-2
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 -1 -1 -1
--1 -1 -1 3 -1 -1
--1 -1 -1 1 -1 -1
--1 -1 1 1 -1 -1
--1 -1 4 4 -1 -1
--1 4 0 0 -1 -1
--1 0 3 3 -1 -1
diff --git a/source/code/block.make b/source/code/block.make
index e26ba91..d43e3d9 100644
--- a/source/code/block.make
+++ b/source/code/block.make
@@ -14,7 +14,7 @@ BASE_LIBS=$(shell sdl-config --libs) -lSDL_image -lSDL_mixer
#For developement only
ifndef DEBUG
-DEBUG=0
+DEBUG=1
endif
ifndef NETWORK
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 13e8f35..09bf223 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -57,7 +57,7 @@ Copyright (C) 2008 Poul Sander
#define LEVELEDITOR 0
#endif
-//Macros to convert surfaces (for faster drawing)
+//Macros to convert surfaces (ffor faster drawing)
#define CONVERT(n) tmp = SDL_DisplayFormat(n); SDL_FreeSurface(n); n = tmp
#define CONVERTA(n) tmp = SDL_DisplayFormatAlpha(n); SDL_FreeSurface(n); n = tmp
@@ -71,6 +71,7 @@ Copyright (C) 2008 Poul Sander
#include <SDL_image.h> //To load PNG images!
#if USE_ABSTRACT_FS
#include <physfs.h> //Abstract file system. To use containers
+ #include "physfs_stream.hpp" //To use C++ style file streams
#endif
//#include "ttfont.h" //To use True Type Fonts in SDL
//#include "config.h"
@@ -984,13 +985,21 @@ int LoadPuzzleStages()
{
//if(puzzleLoaded)
// return 1;
+#if USE_ABSTRACT_FS
+ if (!PHYSFS_exists(("puzzles/"+puzzleName).c_str()))
+ {
+ cout << "File not in blockattack.data: " << ("puzzles/"+puzzleName) << endl;
+ return -1; //file doesn't exist
+ }
+ PhysFS::ifstream inFile(("puzzles/"+puzzleName).c_str());
+#else
#ifdef __unix__
string filename0 = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles/";
filename0 = filename0+puzzleName;
if (singlePuzzle)
filename0 = singlePuzzleFile;
#endif //__unix__
- string filename = (string)SHAREDIR+(string)"/res/";
+ string filename = (string)SHAREDIR+(string)"/puzzles/";
filename = filename+puzzleName;
#ifdef __unix__
ifstream inFile(filename0.c_str());
@@ -999,10 +1008,12 @@ int LoadPuzzleStages()
#else
ifstream inFile(filename.c_str());
#endif
+#endif
+
inFile >> nrOfPuzzles;
if (nrOfPuzzles>maxNrOfPuzzleStages)
nrOfPuzzles=maxNrOfPuzzleStages;
- for (int k=0; (k<nrOfPuzzles)&&(!inFile.eof()); k++)
+ for (int k=0; (k<nrOfPuzzles) /*&&(!inFile.eof())*/ ; k++)
{
inFile >> nrOfMovesAllowed[k];
for (int i=11;i>=0;i--)
@@ -2268,7 +2279,7 @@ bool OpenFileDialogbox(int x, int y, char *name)
bool done = false; //We are done!
int mousex, mousey;
ListFiles lf = ListFiles();
- string folder = (string)SHAREDIR+(string)"/res";
+ string folder = (string)SHAREDIR+(string)"/puzzles";
cout << "Looking in " << folder << endl;
lf.setDirectory(folder.c_str());
#ifdef __unix__
@@ -3603,12 +3614,12 @@ int main(int argc, char *argv[])
//Init the file system abstraction layer
PHYSFS_init(argv[0]);
//Look in blockattack.data
- PHYSFS_addToSearchPath(((string)SHAREDIR+"blockattack.data").c_str(), 1);
+ PHYSFS_addToSearchPath(((string)SHAREDIR+"/blockattack.data").c_str(), 1);
//Look in folder
PHYSFS_addToSearchPath(SHAREDIR, 1);
//Look in home folder
#if defined(__unix__)
- PHYSFS_addToSearchPath(home+"/.gamesaves/blockattack", 1);
+ PHYSFS_addToSearchPath((home+"/.gamesaves/blockattack").c_str(), 1);
#elif defined(_WIN32)
if (&home!=NULL)
PHYSFS_addToSearchPath((home+"/My Games/blockattack").c_str(), 1);
diff --git a/source/code/physfs_stream.hpp b/source/code/physfs_stream.hpp
new file mode 100644
index 0000000..d0bb3c0
--- /dev/null
+++ b/source/code/physfs_stream.hpp
@@ -0,0 +1,437 @@
+/*
+physfs_stream.hpp
+ Copyright (C) 2009 Poul Sander
+ Copied from Warzone 2100
+ http://svn.gna.org/viewcvs/warzone/branches/sound/lib/sound/general/physfs_stream.hpp?rev=3623
+ Copyright (C) 2007 Warzone Resurrection Project
+ Copyright (C) 2007 Giel van Schijndel <me@mortis.eu>
+ Originally part of SuperTux:
+ http://svn.berlios.de/svnroot/repos/supertux/trunk/supertux/src/physfs/physfs_stream.cpp revision 4176
+ Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Poul Sander
+ R�veh�jvej 36, V. 1111
+ 2800 Kgs. Lyngby
+ DENMARK
+ blockattack@poulsander.com
+*/
+
+#ifndef __INCLUDED_PHYSFS_STREAM_HPP__
+#define __INCLUDED_PHYSFS_STREAM_HPP__
+
+#define BUF_SIZE 1024
+
+#include <physfs.h>
+#include <streambuf>
+#include <istream>
+#include <ostream>
+/*Compared to Warzone 2100 boost:array has been replaced by vector to limit
+ the compile requirements*/
+#include <vector>
+
+/** This an implementation of "File-based streams" as described in the
+ * ISO/IEC 14882:1998(E) C++ Standard in chapter 27 "Input/output library",
+ * section 8 "File-based streams". This implementation however uses PhysicsFS
+ * instead of the C-library's FILE functions. Also this implementation lacks
+ * an implementation of basic_fstream because PhysicsFS does not support
+ * opening a file both for reading as well as writing.
+ *
+ * This header contains similar classes and typedefs as <fstream> does. Both
+ * similar in names as well as operation, the main difference is that these
+ * classes do _not_ reside in namespace std.
+ */
+namespace PhysFS
+{
+ /** Typedefinitions mandated by the C++ standard in section 27.8.1
+ */
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
+ class physfs_filebuf;
+ typedef physfs_filebuf<char> filebuf;
+ typedef physfs_filebuf<wchar_t> wfilebuf;
+
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
+ class physfs_ifstream;
+ typedef physfs_ifstream<char> ifstream;
+ typedef physfs_ifstream<wchar_t> wifstream;
+
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
+ class physfs_ofstream;
+ typedef physfs_ofstream<char> ofstream;
+ typedef physfs_ofstream<wchar_t> wofstream;
+
+ /** This class implements a C++ streambuf object for physfs files.
+ * So that you can use normal istream and ostream operations on them.
+ * This class is similar to std::basic_filebuf as defined in
+ * section 27.8.1.1, except in name.
+ */
+ template<typename _CharT, typename _Traits>
+ class physfs_filebuf : public std::basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ typedef std::basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef physfs_filebuf<_CharT, _Traits> __filebuf_type;
+
+ physfs_filebuf() :
+ _file(0)
+ {
+ _buf.resize(BUF_SIZE);
+ }
+
+ virtual ~physfs_filebuf()
+ {
+ close();
+ }
+
+ bool is_open() const throw()
+ {
+ return (_file != 0);
+ }
+
+ __filebuf_type* open(const char* fileName, std::ios_base::openmode mode)
+ {
+ // Return failure if this file buf is open already
+ if (is_open() != false)
+ return 0;
+
+ // Return failure if we are requested to open a file in an unsupported mode
+ if (!(mode & std::ios_base::binary) ||
+ (mode & std::ios_base::in &&
+ mode & std::ios_base::out))
+ return 0;
+
+ // Open the file
+ if (mode & std::ios_base::out &&
+ mode & std::ios_base::app)
+ {
+ _file = PHYSFS_openAppend(fileName);
+ _writeStream = true;
+ }
+ else if (mode & std::ios_base::out)
+ {
+ _file = PHYSFS_openWrite(fileName);
+ _writeStream = true;
+ }
+ else if (mode & std::ios_base::in)
+ {
+ _file = PHYSFS_openRead(fileName);
+ _writeStream = false;
+ }
+ else
+ {
+ return 0;
+ }
+
+ if (!_file)
+ return 0;
+
+ if (mode & std::ios_base::ate &&
+ mode & std::ios_base::in)
+ {
+ if (!PHYSFS_seek(_file, PHYSFS_fileLength(_file)))
+ {
+ close();
+ return 0;
+ }
+ }
+
+ return this;
+ }
+
+ __filebuf_type* close()
+ {
+ // Return failure if this file buf is closed already
+ if (is_open() == false)
+ return 0;
+
+ sync();
+
+ if (!PHYSFS_close(_file))
+ {
+ return 0;
+ }
+
+ _file = 0;
+
+ return this;
+ }
+
+ protected:
+ // Read stuff:
+ virtual int_type underflow()
+ {
+ if (!is_open() || _writeStream)
+ return traits_type::eof();
+
+ if(PHYSFS_eof(_file))
+ {
+ return traits_type::eof();
+ }
+
+ PHYSFS_sint64 objectsRead = PHYSFS_read(_file, &*_buf.begin(), sizeof(char_type), BUF_SIZE);
+
+ if(objectsRead <= 0)
+ {
+ return traits_type::eof();
+ }
+
+ char_type* xend = (static_cast<size_t> (objectsRead) == BUF_SIZE) ? &*_buf.end() : &_buf[objectsRead];
+ setg(&*_buf.begin(), &*_buf.begin(), xend);
+
+ return traits_type::to_int_type(_buf.front());
+ }
+
+ virtual pos_type seekpos(pos_type pos, std::ios_base::openmode)
+ {
+ if (!is_open() || _writeStream)
+ return pos_type(off_type(-1));
+
+ if(PHYSFS_seek(_file, static_cast<PHYSFS_uint64> (pos)) == 0)
+ {
+ return pos_type(off_type(-1));
+ }
+
+ // the seek invalidated the buffer
+ setg(&*_buf.begin(), &*_buf.begin(), &*_buf.begin());
+ return pos;
+ }
+
+ virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode mode)
+ {
+ if (!is_open() || _writeStream)
+ return pos_type(off_type(-1));
+
+ off_type pos = off;
+
+ switch (dir)
+ {
+ case std::ios_base::beg:
+ break;
+
+ case std::ios_base::cur:
+ {
+ PHYSFS_sint64 ptell = PHYSFS_tell(_file);
+ pos_type buf_tell = static_cast<pos_type> (ptell) - static_cast<pos_type> (__streambuf_type::egptr() - __streambuf_type::gptr());
+ if(off == 0)
+ {
+ return buf_tell;
+ }
+
+ pos += static_cast<off_type> (buf_tell);
+ break;
+ }
+
+ case std::ios_base::end:
+ pos = static_cast<off_type> (PHYSFS_fileLength(_file)) - pos;
+ break;
+
+ default:
+ //assert(!"invalid seekdirection");
+ return pos_type(off_type(-1));
+ }
+
+ return seekpos(static_cast<pos_type> (pos), mode);
+ }
+
+ // Write stuff:
+ virtual int_type overflow(int_type c = traits_type::eof())
+ {
+ if (!is_open() || !_writeStream)
+ return traits_type::eof();
+
+ size_t size = __streambuf_type::pptr() - __streambuf_type::pbase();
+ if(size == 0)
+ return 0;
+
+ PHYSFS_sint64 res = PHYSFS_write(_file, __streambuf_type::pbase(), sizeof(char_type), size);
+
+ if(res <= 0)
+ return traits_type::eof();
+
+ if(!traits_type::eq_int_type(c, traits_type::eof()))
+ {
+ PHYSFS_sint64 res = PHYSFS_write(_file, &c, sizeof(char_type), 1);
+
+ if(res <= 0)
+ return traits_type::eof();
+ }
+
+ char_type* xend = (static_cast<size_t> (res) == BUF_SIZE) ? &*_buf.end() : &_buf[res];
+ setp(&*_buf.begin(), xend);
+ return 0;
+ }
+
+ virtual int sync()
+ {
+ if (!is_open() || !_writeStream)
+ return -1;
+
+ return overflow(traits_type::eof());
+ }
+
+ virtual std::streamsize showmanyc()
+ {
+ if (!is_open() || _writeStream)
+ return -1;
+
+ PHYSFS_sint64 fileSize = PHYSFS_fileLength(_file);
+
+ return static_cast<int> (fileSize);
+ }
+
+ private:
+ PHYSFS_file* _file;
+ bool _writeStream;
+ vector<char_type> _buf;
+ };
+
+ /** This class implements a C++ istream object for physfs files.
+ * This class is similar to std::basic_ifstream as defined in
+ * section 27.8.1.5, except in name.
+ */
+ template<typename _CharT, typename _Traits>
+ class physfs_ifstream : public std::basic_istream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ typedef physfs_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+
+ physfs_ifstream() throw() :
+ __istream_type(&_sb)
+ {
+ }
+
+ explicit physfs_ifstream(const char* fileName, std::ios_base::openmode mode = std::ios_base::binary) :
+ __istream_type(&_sb)
+ {
+ open(fileName, mode);
+ }
+
+ const __filebuf_type* rdbuf() const throw()
+ {
+ return &_sb;
+ }
+
+ __filebuf_type* rdbuf() throw()
+ {
+ return &_sb;
+ }
+
+ bool is_open() const throw()
+ {
+ return rdbuf()->is_open();
+ }
+
+ void open(const char* fileName, std::ios_base::openmode mode = std::ios_base::binary)
+ {
+ if (!rdbuf()->open(fileName, mode | std::ios_base::in))
+ {
+ __istream_type::setstate(std::ios_base::failbit);
+ }
+ }
+
+ void close()
+ {
+ if (!rdbuf()->close())
+ {
+ __istream_type::setstate(std::ios_base::failbit);
+ }
+ }
+
+ private:
+ __filebuf_type _sb;
+ };
+
+ /** This class implements a C++ ostream object for physfs files.
+ * This class is similar to std::basic_ofstream as defined in
+ * section 27.8.1.8, except in name.
+ */
+ template<typename _CharT, typename _Traits>
+ class physfs_ofstream : public std::basic_ostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ typedef physfs_filebuf<_CharT, _Traits> __filebuf_type;
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+
+ physfs_ofstream() throw() :
+ __ostream_type(&_sb)
+ {
+ }
+
+ explicit physfs_ofstream(const char* fileName, std::ios_base::openmode mode = std::ios_base::binary) :
+ __ostream_type(&_sb)
+ {
+ open(fileName, mode);
+ }
+
+ const __filebuf_type* rdbuf() const throw()
+ {
+ return &_sb;
+ }
+
+ __filebuf_type* rdbuf() throw()
+ {
+ return &_sb;
+ }
+
+ bool is_open() const throw()
+ {
+ return rdbuf()->is_open();
+ }
+
+ void open(const char* fileName, std::ios_base::openmode mode = std::ios_base::binary)
+ {
+ if (!rdbuf()->open(fileName, mode | std::ios_base::out))
+ {
+ __ostream_type::setstate(std::ios_base::failbit);
+ }
+ }
+
+ void close()
+ {
+ if (!rdbuf()->close())
+ {
+ __ostream_type::setstate(std::ios_base::failbit);
+ }
+ }
+
+ private:
+ __filebuf_type _sb;
+ };
+}
+
+#endif // __INCLUDED_PHYSFS_STREAM_HPP__