summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Iooss2015-05-24 11:14:24 +0800
committerNicolas Iooss2015-05-24 11:14:24 +0800
commit4f1ba6bbd688961f6890d4ad48cf48adafaf3911 (patch)
tree54156bf2c95df8419ee30fcaed680c76c12da31a
downloadaur-4f1ba6bbd688961f6890d4ad48cf48adafaf3911.tar.gz
Migrate funguloids 1.06.4-7 to AUR4
-rw-r--r--.SRCINFO47
-rw-r--r--PKGBUILD93
-rw-r--r--funguloids-alc_error.patch21
-rw-r--r--funguloids-boost-system.patch12
-rw-r--r--funguloids-compilation.patch208
-rw-r--r--funguloids-gcc44.patch11
-rw-r--r--funguloids-lua.patch37
-rw-r--r--funguloids-ogre-1.7.0.patch112
-rw-r--r--funguloids-ogre-1.9.0.patch173
-rw-r--r--funguloids-ogre_1.6.patch36
-rw-r--r--funguloids-strcmp.patch11
-rw-r--r--funguloids.desktop9
-rwxr-xr-xmpak.py355
-rw-r--r--openalsoundsystem.cpp.diff68
-rw-r--r--size_chunks_reverse.patch11
15 files changed, 1204 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..f14dc3feb039
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,47 @@
+pkgbase = funguloids
+ pkgdesc = 3D game about collecting mushrooms in outerspace
+ pkgver = 1.06.4
+ pkgrel = 7
+ url = http://funguloids.sourceforge.net/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = boost
+ depends = ogre
+ depends = ois
+ depends = freealut
+ depends = lua51
+ depends = libogg
+ depends = libvorbis
+ depends = libmad
+ source = http://downloads.sourceforge.net/funguloids/funguloids-linux-1.06-4.tar.bz2
+ source = funguloids.desktop
+ source = funguloids-alc_error.patch
+ source = funguloids-gcc44.patch
+ source = funguloids-ogre_1.6.patch
+ source = funguloids-strcmp.patch
+ source = size_chunks_reverse.patch
+ source = mpak.py
+ source = funguloids-lua.patch
+ source = openalsoundsystem.cpp.diff
+ source = funguloids-ogre-1.7.0.patch
+ source = funguloids-compilation.patch
+ source = funguloids-boost-system.patch
+ source = funguloids-ogre-1.9.0.patch
+ sha256sums = e9c9074a5d2de11690484a7e8eef7de9dd7d360ea72185ea35c54976646ef5cf
+ sha256sums = ceaf1c19d5ed694ff3832320ef6b6b268f73cbf16bc5998c15de47c77298885a
+ sha256sums = 753a8ac858ff21e81f2a3466092e297703d081689ceaa1159fe6cb42d97d06a6
+ sha256sums = b2b7767da01529ef6944eba3dd6c14c0883e723d6c2658838f186f6809da9695
+ sha256sums = 345c0b54e6ca28a7b243ec9e86a6310062d973f8c35236856b7d66cefc7f9f97
+ sha256sums = 107a0eec5efb2eea99c86d7dad91e28a20ca1f35d4f5eda067ae64c88c9d0304
+ sha256sums = eb5c821adbc9e6d93f6a78cb40a661e97ffa67eb6ab346913318cbcf3bc66083
+ sha256sums = 12a8cd48b299d9a7de74a9bdae429a4a2489ee8357e9af935e89bf5f417ff157
+ sha256sums = 2f184587b549315b5a76c77253366d6b4154bf25b8804056ec67736531d813a3
+ sha256sums = a70e2a40b19f3e0e3c44aa8fa41d866854ce21d111decce1d43f8fba04f7a16c
+ sha256sums = 334831c41160457a4b0162bab349ba77570bbcc0b8e8c63a8e01e8a50c40bd48
+ sha256sums = 4ed88c6502601d684fd7e85dbe33684e36669bdf65583f782b24ddd596dcaf3c
+ sha256sums = e17a559558d49e493f3f19ae6baa147c64fb37497fb384d31e0d3bc7ae484df1
+ sha256sums = a007990ef35c249fe4440938553737d14f2dd8377407ee97fecdc6f17b1136ec
+
+pkgname = funguloids
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ed65ea080704
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,93 @@
+# Maintainer: Nicolas Iooss <nicolas.iooss_aur at m4x.org
+# Contributor: Dany Martineau <dany.luc.martineau at gmail.com>
+
+pkgname=funguloids
+pkgver=1.06.4
+_realver=1.06-4
+pkgrel=7
+pkgdesc="3D game about collecting mushrooms in outerspace"
+arch=('i686' 'x86_64')
+url="http://funguloids.sourceforge.net/"
+license=('GPL')
+depends=('boost' 'ogre' 'ois' 'freealut' 'lua51' 'libogg' 'libvorbis' 'libmad')
+source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-linux-${_realver}.tar.bz2
+ funguloids.desktop
+ funguloids-alc_error.patch
+ funguloids-gcc44.patch
+ funguloids-ogre_1.6.patch funguloids-strcmp.patch
+ size_chunks_reverse.patch
+ mpak.py
+ funguloids-lua.patch
+ openalsoundsystem.cpp.diff
+ funguloids-ogre-1.7.0.patch
+ funguloids-compilation.patch
+ funguloids-boost-system.patch
+ funguloids-ogre-1.9.0.patch)
+sha256sums=('e9c9074a5d2de11690484a7e8eef7de9dd7d360ea72185ea35c54976646ef5cf'
+ 'ceaf1c19d5ed694ff3832320ef6b6b268f73cbf16bc5998c15de47c77298885a'
+ '753a8ac858ff21e81f2a3466092e297703d081689ceaa1159fe6cb42d97d06a6'
+ 'b2b7767da01529ef6944eba3dd6c14c0883e723d6c2658838f186f6809da9695'
+ '345c0b54e6ca28a7b243ec9e86a6310062d973f8c35236856b7d66cefc7f9f97'
+ '107a0eec5efb2eea99c86d7dad91e28a20ca1f35d4f5eda067ae64c88c9d0304'
+ 'eb5c821adbc9e6d93f6a78cb40a661e97ffa67eb6ab346913318cbcf3bc66083'
+ '12a8cd48b299d9a7de74a9bdae429a4a2489ee8357e9af935e89bf5f417ff157'
+ '2f184587b549315b5a76c77253366d6b4154bf25b8804056ec67736531d813a3'
+ 'a70e2a40b19f3e0e3c44aa8fa41d866854ce21d111decce1d43f8fba04f7a16c'
+ '334831c41160457a4b0162bab349ba77570bbcc0b8e8c63a8e01e8a50c40bd48'
+ '4ed88c6502601d684fd7e85dbe33684e36669bdf65583f782b24ddd596dcaf3c'
+ 'e17a559558d49e493f3f19ae6baa147c64fb37497fb384d31e0d3bc7ae484df1'
+ 'a007990ef35c249fe4440938553737d14f2dd8377407ee97fecdc6f17b1136ec')
+
+prepare() {
+ cd "${srcdir}/${pkgname}"
+
+ # Convert DOS line ending to Unix by removing every CR character
+ find . \( -name '*.h' -o -name '*.cpp' -o -name '*.in' -o -name '*.am' \) \
+ -exec sed 's/\r//' -i {} \;
+
+ patch -p0 < ../openalsoundsystem.cpp.diff
+ patch -p1 < ../funguloids-gcc44.patch
+ patch -p0 < ../funguloids-ogre_1.6.patch
+ patch -p0 < ../funguloids-strcmp.patch
+ patch -p0 < ../size_chunks_reverse.patch
+ patch -p0 < ../funguloids-lua.patch
+ patch -p1 < ../funguloids-ogre-1.7.0.patch
+ patch -p1 < ../funguloids-compilation.patch
+ patch -p1 < ../funguloids-boost-system.patch
+ patch -p1 < ../funguloids-ogre-1.9.0.patch
+
+ sed -i -e 's;cp bootstrap.mpk "@gameinstalldir@";cp bootstrap.mpk "$(DESTDIR)@gameinstalldir@";' -e 's;funguloids.mpk "@gameinstalldir@";funguloids.mpk "$(DESTDIR)@gameinstalldir@";' bin/Makefile.in
+ sed -i -e 's;cp MarylandInMay.ogg "@musicinstalldir@";cp MarylandInMay.ogg "$(DESTDIR)@musicinstalldir@";' bin/music/Makefile.in
+ sed -i -e 's;-llua5.1;-llua;' -e 's;share/games/funguloids;share/funguloids;' \
+ -e 's;bininstalldir="${prefix}/games;bininstalldir="${prefix}/bin;' configure.ac
+ chmod +x ../mpak.py
+ ../mpak.py -e -f bin/bootstrap.mpk -p _bootstrap
+ ../mpak.py -e -f bin/funguloids.mpk -p _gamedata
+ sed -ri '/^[A-Z]/ s/(.*)/overlay \1/' _bootstrap/*.overlay _gamedata/*.overlay
+ sed -ri '/^[A-Z]/ s/(.*)/particle_system \1/' _gamedata/*.particle
+ sed -ri 's/^(\t\t\t)(texture_unit) 1/\1\2\n\1{\n\1}\n\1\2/' _gamedata/materials.material
+ ../mpak.py -c -f bin/bootstrap.mpk _bootstrap/*
+ ../mpak.py -c -f bin/funguloids.mpk _gamedata/*
+ rm -rf _bootstrap _gamedata
+
+ rm -f build-aux/*
+ aclocal
+ autoheader
+ autoconf
+ automake --add-missing
+ ./configure --prefix=/usr
+}
+
+build() {
+ cd "${srcdir}/${pkgname}"
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+ make DESTDIR="${pkgdir}" install
+
+ # install desktop file
+ install -Dm644 "${srcdir}/funguloids.desktop" \
+ "${pkgdir}/usr/share/applications/funguloids.desktop"
+}
diff --git a/funguloids-alc_error.patch b/funguloids-alc_error.patch
new file mode 100644
index 000000000000..707d857c3972
--- /dev/null
+++ b/funguloids-alc_error.patch
@@ -0,0 +1,21 @@
+Check ALC errors instead of AL errors.
+=====================================================================
+--- src/openalsoundsystem.cpp.bak 2008-05-04 16:41:32.000000000 -0400
++++ src/openalsoundsystem.cpp 2008-05-04 16:20:52.000000000 -0400
+@@ -266,14 +266,14 @@
+
+ int attributes[] = { 0 };
+ mContext = alcCreateContext(mDevice, attributes);
+- if ( (err = alGetError()) != AL_NO_ERROR) {
++ if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ LogManager::getSingleton().logMessage("OpanAL: error creating context: " + lastALError(err) );
+ return 1;
+ }
+ // check_alc_error("Couldn't create audio context: ");
+ alcMakeContextCurrent(mContext);
+ // check_alc_error("Couldn't select audio context: ");
+- if ( (err = alGetError()) != AL_NO_ERROR) {
++ if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ LogManager::getSingleton().logMessage("OpanAL: error making context current: " + lastALError(err) );
+ return 2;
+ }
diff --git a/funguloids-boost-system.patch b/funguloids-boost-system.patch
new file mode 100644
index 000000000000..d9945251e088
--- /dev/null
+++ b/funguloids-boost-system.patch
@@ -0,0 +1,12 @@
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -286,6 +267,8 @@ if test "x${shared_hs}" != "x"; then
+ AC_MSG_NOTICE([Using system-wide highscore file in ${highscoredir}])
+ fi
+
++# Add boost
++AC_CHECK_LIB([boost_system], [main])
+
+ AC_CONFIG_FILES([Makefile src/Makefile include/Makefile bin/Makefile bin/docs/Makefile bin/music/Makefile bin/icon/Makefile ])
+ AC_OUTPUT
diff --git a/funguloids-compilation.patch b/funguloids-compilation.patch
new file mode 100644
index 000000000000..d3efff5f3349
--- /dev/null
+++ b/funguloids-compilation.patch
@@ -0,0 +1,208 @@
+--- a/bin/Makefile.am
++++ b/bin/Makefile.am
+@@ -18,16 +18,16 @@ all:
+
+ install-data-hook:
+ if test "x@highscoredir@" != "x"; then \
+- mkdir -p "@highscoredir@"; \
+- if test ! -e "@highscoredir@/hiscore.lst"; then cp hiscore.lst.in "@highscoredir@/hiscore.lst"; fi; \
+- chgrp -R @highscoregroup@ "@highscoredir@"; \
+- chmod -R g+w "@highscoredir@"; \
++ mkdir -p "$(DESTDIR)@highscoredir@"; \
++ if test ! -e "(DESTDIR)@highscoredir@/hiscore.lst"; then cp hiscore.lst.in "(DESTDIR)@highscoredir@/hiscore.lst"; fi; \
++ chgrp -R @highscoregroup@ "(DESTDIR)@highscoredir@"; \
++ chmod -R g+w "(DESTDIR)@highscoredir@"; \
+ fi; \
+- if test -r bootstrap.mpk; then cp bootstrap.mpk "@gameinstalldir@"; fi; \
+- if test -r funguloids.mpk; then cp funguloids.mpk "@gameinstalldir@"; fi
++ if test -r bootstrap.mpk; then cp bootstrap.mpk "$(DESTDIR)@gameinstalldir@"; fi; \
++ if test -r funguloids.mpk; then cp funguloids.mpk "$(DESTDIR)@gameinstalldir@"; fi
+
+ uninstall-hook:
+- rm -rf "@docinstalldir@"
++ rm -rf "$(DESTDIR)@docinstalldir@"
+
+ distclean: clean
+
+--- a/bin/music/Makefile.am
++++ b/bin/music/Makefile.am
+@@ -6,7 +6,7 @@ playlist.lua: playlist.lua.in
+ cat playlist.lua.in | sed 's,%%musicinstalldir%%,@musicinstalldir@,' > playlist.lua
+
+ install-data-hook:
+- if test -r MarylandInMay.ogg; then cp MarylandInMay.ogg "@musicinstalldir@"; fi;
++ if test -r MarylandInMay.ogg; then cp MarylandInMay.ogg "$(DESTDIR)@musicinstalldir@"; fi;
+
+
+ distclean: clean
+--- a/include/hiscore.h
++++ b/include/hiscore.h
+@@ -50,7 +50,7 @@ public:
+
+ void clear(); // Clear the list
+ void sort(); // Sort the list
+- int addName(char *name, long score); // Add a record
++ int addName(const char *name, long score); // Add a record
+ void save(const String &file); // Save the list
+ void load(const String &file); // Load the list
+ void updateOverlay(); // Update the overlay
+--- a/include/mpakogre.h
++++ b/include/mpakogre.h
+@@ -54,7 +54,7 @@
+ FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+ StringVectorPtr find(const String &pattern, bool recursive = true, bool dirs = false);
+- FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false);
++ FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false) const;
+
+ bool exists(const String &filename);
+
+--- a/include/SimpleIni/SimpleIni.h
++++ b/include/SimpleIni/SimpleIni.h
+@@ -407,7 +407,7 @@
+ return *this;
+ }
+ bool ConvertToStore(const SI_CHAR * a_pszString) {
+- size_t uLen = SizeToStore(a_pszString);
++ size_t uLen = this->SizeToStore(a_pszString);
+ if (uLen == (size_t)(-1)) {
+ return false;
+ }
+--- a/src/fmodexsoundsystem.cpp
++++ b/src/fmodexsoundsystem.cpp
+@@ -32,7 +32,7 @@
+ #include "playlist.h"
+ #include "mpakogre.h"
+
+-template<> FMODExSoundSystem* Singleton<FMODExSoundSystem>::ms_Singleton = 0;
++template<> FMODExSoundSystem* Singleton<FMODExSoundSystem>::msSingleton = 0;
+
+
+ // Checks for FMOD error and prints an error message
+@@ -332,12 +332,12 @@ void FMODExSoundSystem::update() {
+ }
+ }
+ FMODExSoundSystem *FMODExSoundSystem::getSingletonPtr() {
+- return ms_Singleton;
++ return msSingleton;
+ }
+
+ FMODExSoundSystem &FMODExSoundSystem::getSingleton() {
+- assert(ms_Singleton);
+- return *ms_Singleton;
++ assert(msSingleton);
++ return *msSingleton;
+ }
+
+ #endif
+--- a/src/hiscore.cpp
++++ b/src/hiscore.cpp
+@@ -171,7 +171,7 @@ void HiscoreList::load(const String &file) {
+
+
+ // Add a name to the list. Returns the place.
+-int HiscoreList::addName(char *name, long score) {
++int HiscoreList::addName(const char *name, long score) {
+ // Check if we qualify
+ if(mList[NUM_NAMES-1].score >= score)
+ return -1;
+--- a/src/mpakogre.cpp
++++ b/src/mpakogre.cpp
+@@ -180,10 +180,10 @@ StringVectorPtr MPakArchive::find(const
+ return ret;
+ }
+
+-FileInfoListPtr MPakArchive::findFileInfo(const String &pattern, bool recursive, bool dirs) {
++FileInfoListPtr MPakArchive::findFileInfo(const String &pattern, bool recursive, bool dirs) const {
+ FileInfoListPtr ret = FileInfoListPtr(new FileInfoList());
+
+- FileInfoList::iterator i, iend;
++ FileInfoList::const_iterator i, iend;
+ iend = mFileList.end();
+ for(i = mFileList.begin(); i != iend; ++i) {
+ if(StringUtil::match(i->filename, pattern, true))
+--- a/src/objectsystem.cpp
++++ b/src/objectsystem.cpp
+@@ -26,7 +26,7 @@
+ #include "objectsystem.h"
+ #include "game.h"
+
+-template<> ObjectSystem* Singleton<ObjectSystem>::ms_Singleton = 0;
++template<> ObjectSystem* Singleton<ObjectSystem>::msSingleton = 0;
+
+
+ // ObjectSystem constructor
+@@ -135,11 +135,11 @@ void ObjectSystem::findFreePosition(Vect
+
+
+ ObjectSystem *ObjectSystem::getSingletonPtr() {
+- return ms_Singleton;
++ return msSingleton;
+ }
+
+ ObjectSystem &ObjectSystem::getSingleton() {
+- assert(ms_Singleton);
+- return *ms_Singleton;
++ assert(msSingleton);
++ return *msSingleton;
+ }
+
+--- a/src/openalsoundsystem.cpp
++++ b/src/openalsoundsystem.cpp
+@@ -35,16 +35,16 @@
+ #include "playlist.h"
+ #include "mpakogre.h"
+
+-template<> OpenALSoundSystem* Singleton<OpenALSoundSystem>::ms_Singleton = 0;
++template<> OpenALSoundSystem* Singleton<OpenALSoundSystem>::msSingleton = 0;
+
+ OpenALSoundSystem* OpenALSoundSystem::getSingletonPtr() {
+- return ms_Singleton;
++ return msSingleton;
+ }
+
+
+ OpenALSoundSystem& OpenALSoundSystem::getSingleton() {
+- assert(ms_Singleton);
+- return *ms_Singleton;
++ assert(msSingleton);
++ return *msSingleton;
+ }
+
+
+--- a/src/scriptsystem.cpp
++++ b/src/scriptsystem.cpp
+@@ -38,7 +38,7 @@
+ #include "mpakogre.h"
+ #include <vector>
+
+-template<> ScriptSystem* Singleton<ScriptSystem>::ms_Singleton = 0;
++template<> ScriptSystem* Singleton<ScriptSystem>::msSingleton = 0;
+
+
+ // Log error messages
+@@ -439,7 +439,7 @@ ScriptSystem::ScriptSystem(SceneManager
+
+ LogManager::getSingleton().logMessage("Using " + String(LUA_VERSION));
+ // Create the script engine
+- mLuaVM = lua_open();
++ mLuaVM = luaL_newstate();
+ if(!mLuaVM)
+ LogManager::getSingleton().logMessage(LML_CRITICAL, "Unable to create the script engine!");
+
+@@ -564,12 +564,12 @@ bool ScriptSystem::executeScript(const c
+
+
+ ScriptSystem *ScriptSystem::getSingletonPtr() {
+- return ms_Singleton;
++ return msSingleton;
+ }
+
+ ScriptSystem &ScriptSystem::getSingleton() {
+- assert(ms_Singleton);
+- return *ms_Singleton;
++ assert(msSingleton);
++ return *msSingleton;
+ }
+
+
diff --git a/funguloids-gcc44.patch b/funguloids-gcc44.patch
new file mode 100644
index 000000000000..e4b000553d30
--- /dev/null
+++ b/funguloids-gcc44.patch
@@ -0,0 +1,11 @@
+diff -Nur funguloids.old/src/mp3stream.cpp funguloids/src/mp3stream.cpp
+--- funguloids.old/src/mp3stream.cpp 2007-05-22 15:27:40.000000000 +0200
++++ funguloids/src/mp3stream.cpp 2009-06-02 21:22:57.808497421 +0200
+@@ -34,6 +34,7 @@
+
+ #include <sys/stat.h>
+ #include <sstream>
++#include <climits>
+ #include "Ogre.h"
+
+ #include "mp3stream.h"
diff --git a/funguloids-lua.patch b/funguloids-lua.patch
new file mode 100644
index 000000000000..7762533e6eab
--- /dev/null
+++ b/funguloids-lua.patch
@@ -0,0 +1,37 @@
+--- configure.ac
++++ configure.ac
+@@ -47,30 +47,11 @@
+
+
+ # LUA ----------------------------------------------------
+-AC_LANG_PUSH(C)
+-AC_ARG_WITH(lua,
+-[ --with-lua[[=DIR]] specify the path to the Lua 5.1 include files [[autodetect]]],
+-[
+- if test "x$withval" != "x"; then
+- lua_dir="$withval"
+- fi
+-],[
+- lua_dir=
+-])
+-
+-FUNGU_SEARCH_HEADER( [lua.h], [$lua_dir /usr/local /usr], [ include/lua5.1 include/lua / ] )
+-if test "x$FUNGU_FOUND_HEADER" = "xno"; then
+- PKG_CHECK_MODULES(LUA, [lua >= 5.1],[],[
+- PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1],[],[
+- AC_MSG_ERROR(Lua 5.1 not found. You can specify its location with [[--with-lua=/path/to/include/lua51]])
+- ])
++PKG_CHECK_MODULES(LUA, [lua >= 5.1, lua < 5.2],[],[
++ PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1],[],[
++ AC_MSG_ERROR(Lua 5.1 not found)
+ ])
+-else
+- CFLAGS="$CFLAGS $FUNGU_FOUND_HEADER"
+- CPPFLAGS="$CPPFLAGS $FUNGU_FOUND_HEADER"
+- LDFLAGS="$LDFLAGS -llua5.1"
+-fi
+-AC_LANG_POP
++])
+
+ AC_SUBST(LUA_CFLAGS)
+ AC_SUBST(LUA_LIBS)
diff --git a/funguloids-ogre-1.7.0.patch b/funguloids-ogre-1.7.0.patch
new file mode 100644
index 000000000000..25087003f924
--- /dev/null
+++ b/funguloids-ogre-1.7.0.patch
@@ -0,0 +1,112 @@
+diff -Naur funguloids-org/include/mpakogre.h funguloids/include/mpakogre.h
+--- funguloids-org/include/mpakogre.h 2007-03-11 16:53:04.000000000 +0100
++++ funguloids/include/mpakogre.h 2010-03-03 16:17:43.000000000 +0100
+@@ -49,6 +49,7 @@
+ void unload();
+
+ DataStreamPtr open(const String &filename) const;
++ DataStreamPtr open(const String &filename, bool) const { return open(filename); };
+ StringVectorPtr list(bool recursive = true, bool dirs = false);
+ FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+diff -Naur funguloids-org/include/objectsystem.h funguloids/include/objectsystem.h
+--- funguloids-org/include/objectsystem.h 2007-02-26 19:43:56.000000000 +0100
++++ funguloids/include/objectsystem.h 2010-03-03 16:17:59.000000000 +0100
+@@ -34,7 +34,7 @@
+ using namespace std;
+ using namespace Ogre;
+
+-typedef map<String, MovingObject*> ObjectMapType;
++typedef std::map<String, MovingObject*> ObjectMapType;
+
+ // ObjectSystem
+ class ObjectSystem : public Singleton<ObjectSystem> {
+diff -Naur funguloids-org/include/openalsoundsystem.h funguloids/include/openalsoundsystem.h
+--- funguloids-org/include/openalsoundsystem.h 2007-05-22 15:47:31.000000000 +0200
++++ funguloids/include/openalsoundsystem.h 2010-03-03 16:18:13.000000000 +0100
+@@ -47,7 +47,7 @@
+ using namespace std;
+
+
+-typedef map<String, ALuint> SoundMapType;
++typedef std::map<String, ALuint> SoundMapType;
+
+ // Number of independent channels for sound fx
+ const int NUM_SOUND_CHANNELS = 32;
+diff -Naur funguloids-org/src/mp3stream.cpp funguloids/src/mp3stream.cpp
+--- funguloids-org/src/mp3stream.cpp 2007-05-22 15:27:40.000000000 +0200
++++ funguloids/src/mp3stream.cpp 2010-03-03 17:38:08.000000000 +0100
+@@ -1,4 +1,4 @@
+-//****************************************************************************
++/****************************************************************************
+ // "Those Funny Funguloids!"
+ // http://funguloids.sourceforge.net
+ // Copyright (c) 2006-2007, Mika Halttunen
+@@ -31,7 +31,9 @@
+ #endif
+
+ #ifdef SOUND_STREAM_MP3
+-
++#include <unistd.h>
++#include <cstdlib>
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sstream>
+ #include <climits>
+@@ -233,7 +235,7 @@
+ //----------------------------------------------------------------------------
+ void MP3Stream::logInfo( struct mad_header *Header )
+ {
+- stringstream ss;
++ std::stringstream ss;
+
+ /* Convert the layer number to it's printed representation. */
+ ss << "mpeg 1 layer ";
+diff -Naur funguloids-org/src/oggstream.cpp funguloids/src/oggstream.cpp
+--- funguloids-org/src/oggstream.cpp 2007-05-22 15:27:56.000000000 +0200
++++ funguloids/src/oggstream.cpp 2010-03-03 17:35:07.000000000 +0100
+@@ -269,7 +269,7 @@
+ //----------------------------------------------------------------------------
+ void OggStream::logInfo()
+ {
+- stringstream ss;
++ std::stringstream ss;
+ ss << "version " << mVorbisInfo->version << "\n"
+ << "channels " << mVorbisInfo->channels << "\n"
+ << "rate (hz) " << mVorbisInfo->rate << "\n"
+diff -Naur funguloids-org/src/openalsoundsystem.cpp funguloids/src/openalsoundsystem.cpp
+--- funguloids-org/src/openalsoundsystem.cpp 2007-05-22 17:11:46.000000000 +0200
++++ funguloids/src/openalsoundsystem.cpp 2010-03-03 17:37:49.000000000 +0100
+@@ -287,7 +287,7 @@
+ LogManager::getSingleton().logMessage("OpenALSoundSystem(): initialised OpenAL" );
+ }
+
+- stringstream ss;
++ std::stringstream ss;
+ ss << "OpenAL Vendor: " << alGetString(AL_VENDOR) << std::endl;
+ ss << "OpenAL Version: " << alGetString(AL_VERSION) << std::endl;
+ ss << "OpenAL Renderer: " << alGetString(AL_RENDERER) << std::endl;
+diff -Naur funguloids-org/src/playlist.cpp funguloids/src/playlist.cpp
+--- funguloids-org/src/playlist.cpp 2007-05-22 15:17:41.000000000 +0200
++++ funguloids/src/playlist.cpp 2010-03-03 17:41:12.000000000 +0100
+@@ -42,7 +42,7 @@
+ using namespace std;
+
+ // Play list files
+-static vector<String> playList;
++static std::vector<String> playList;
+ static unsigned int currentSong = -1;
+
+
+diff -Naur funguloids-org/src/scriptsystem.cpp funguloids/src/scriptsystem.cpp
+--- funguloids-org/src/scriptsystem.cpp 2007-05-04 12:28:10.000000000 +0200
++++ funguloids/src/scriptsystem.cpp 2010-03-03 17:43:52.000000000 +0100
+@@ -48,7 +48,7 @@
+
+
+ // This keeps track of the lights created in script
+-static vector<Light*> scriptLights;
++static std::vector<Light*> scriptLights;
+
+
+ // File locator for script files
diff --git a/funguloids-ogre-1.9.0.patch b/funguloids-ogre-1.9.0.patch
new file mode 100644
index 000000000000..d37df7ba4cd7
--- /dev/null
+++ b/funguloids-ogre-1.9.0.patch
@@ -0,0 +1,173 @@
+From: Nicolas Iooss
+Date: Sat, 2 Aug 2014 19:12:11 +0200
+Subject: Fix compilation issues with OGRE 1.9.0
+
+* Add OGRE-Overlay to configure.ac and src/Makefile.am
+* Add missing semicolons after OGRE_LOCK_MUTEX
+* Include OgreOverlayManager.h
+* Initialize the newly-separated Overlay System with doc from
+ http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Manual+Resource+Loading#Overlay_2
+---
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -31,10 +31,14 @@ AC_HEADER_STDC
+ AC_CHECK_HEADERS([stdlib.h string.h sys/param.h wchar.h])
+
+ # OGRE ----------------------------------------------------
+-PKG_CHECK_MODULES(OGRE, [OGRE >= 1.4])
++PKG_CHECK_MODULES(OGRE, [OGRE >= 1.9.0])
+ AC_SUBST(OGRE_CFLAGS)
+ AC_SUBST(OGRE_LIBS)
+
++PKG_CHECK_MODULES(OGRE_OVERLAY, [OGRE-Overlay >= 1.9.0])
++AC_SUBST([OGRE_OVERLAY_CFLAGS])
++AC_SUBST([OGRE_OVERLAY_LIBS])
++
+ # Ogre plugin directory for bin/plugins.cfg
+ ogreplugindir=`pkg-config --variable=plugindir OGRE`
+ AC_SUBST(ogreplugindir)
+diff --git a/src/Makefile.am b/src/Makefile.am
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,7 +1,7 @@
+ bininstall_PROGRAMS = funguloids
+ funguloids_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/SimpleIni
+-funguloids_LDADD = @OIS_LIBS@ @OGRE_LIBS@ @LUA_LIBS@
+-funguloids_CXXFLAGS = @OIS_CFLAGS@ @OGRE_CFLAGS@ @LUA_CFLAGS@
++funguloids_LDADD = @OIS_LIBS@ @OGRE_LIBS@ @OGRE_OVERLAY_LIBS@ @LUA_LIBS@
++funguloids_CXXFLAGS = @OIS_CFLAGS@ @OGRE_CFLAGS@ @OGRE_OVERLAY_CFLAGS@ @LUA_CFLAGS@
+
+ funguloids_SOURCES = asteroid.cpp \
+ ballworm.cpp \
+diff --git a/include/mpakogre.h b/include/mpakogre.h
+--- a/include/mpakogre.h
++++ b/include/mpakogre.h
+@@ -83,7 +83,7 @@ public:
+ virtual ~MPakArchiveFactory() {}
+ const String &getType(void) const;
+
+- Archive *createInstance(const String &name) {
++ Archive *createInstance(const String &name, bool readOnly) {
+ return new MPakArchive(name, "MPK");
+ }
+
+diff --git a/include/ogrelistener.h b/include/ogrelistener.h
+--- a/include/ogrelistener.h
++++ b/include/ogrelistener.h
+@@ -29,6 +29,7 @@
+ #include <Ogre.h>
+ #include <OgreStringConverter.h>
+ #include <OgreException.h>
++#include <OgreOverlay.h>
+
+ #include "input.h"
+
+diff --git a/include/soundsystem.h b/include/soundsystem.h
+--- a/include/soundsystem.h
++++ b/include/soundsystem.h
+@@ -66,7 +66,7 @@ public:
+ if(!grp)
+ OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Cannot locate a resource group called 'General'", "ResourceGroupManager::openResource");
+
+- OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
++ OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME); // lock group mutex
+ ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(filename);
+ if(rit != grp->resourceIndexCaseSensitive.end()) {
+ // Found in the index
+diff --git a/src/game.cpp b/src/game.cpp
+--- a/src/game.cpp
++++ b/src/game.cpp
+@@ -33,6 +33,7 @@
+ #include "scriptsystem.h"
+ #include "soundsystem.h"
+ #include "hiscore.h"
++#include <OgreOverlayManager.h>
+
+
+ // Playfield size (which is really read from the level script..)
+diff --git a/src/hiscore.cpp b/src/hiscore.cpp
+--- a/src/hiscore.cpp
++++ b/src/hiscore.cpp
+@@ -29,6 +29,7 @@
+ #include "game.h"
+ #include "hiscore.h"
+ #include <OgreTextAreaOverlayElement.h>
++#include <OgreOverlayManager.h>
+
+ // Global high score list
+ HiscoreList hiscoreList;
+diff --git a/src/menu.cpp b/src/menu.cpp
+--- a/src/menu.cpp
++++ b/src/menu.cpp
+@@ -29,6 +29,7 @@
+ #include "soundsystem.h"
+ #include "hiscore.h"
+ #include <OgreTextAreaOverlayElement.h>
++#include <OgreOverlayManager.h>
+
+
+ // Version string
+diff --git a/src/ogreapp.cpp b/src/ogreapp.cpp
+--- a/src/ogreapp.cpp
++++ b/src/ogreapp.cpp
+@@ -29,6 +29,7 @@
+ #include "scriptsystem.h"
+ #include "soundsystem.h"
+ #include "mpakogre.h"
++#include <OgreOverlaySystem.h>
+
+ #if(OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
+ #define WIN32_LEAN_AND_MEAN
+@@ -74,6 +75,9 @@ bool OgreApplication::setup() {
+ // Random seed
+ srand(time(NULL));
+
++ // Initialize the overlay system
++ OverlaySystem *overlaySys = new OverlaySystem();
++
+ // Add the MPK archive support
+ mMPakFactory = new MPakArchiveFactory();
+ ArchiveManager::getSingleton().addArchiveFactory(mMPakFactory);
+@@ -115,6 +119,7 @@ bool OgreApplication::setup() {
+
+ // Create the SceneManager
+ createSceneManager();
++ mSceneMgr->addRenderQueueListener(overlaySys);
+
+ // Set up the scene
+ createCamera();
+diff --git a/src/ogrelistener.cpp b/src/ogrelistener.cpp
+--- a/src/ogrelistener.cpp
++++ b/src/ogrelistener.cpp
+@@ -27,6 +27,7 @@
+ #include "ogreapp.h"
+ #include "objectsystem.h"
+ #include "game.h"
++#include <OgreOverlayManager.h>
+
+
+ // After a rendered frame
+diff --git a/src/player.cpp b/src/player.cpp
+--- a/src/player.cpp
++++ b/src/player.cpp
+@@ -33,6 +33,7 @@
+ #include "effects.h"
+ #include "scriptsystem.h"
+ #include "base.h"
++#include <OgreOverlayManager.h>
+
+
+ // Player constructor
+diff --git a/src/scriptsystem.cpp b/src/scriptsystem.cpp
+--- a/src/scriptsystem.cpp
++++ b/src/scriptsystem.cpp
+@@ -63,7 +63,7 @@ public:
+ if(!grp)
+ OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Cannot locate a resource group called 'General'", "ResourceGroupManager::openResource");
+
+- OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
++ OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME); // lock group mutex
+ ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(filename);
+ if(rit != grp->resourceIndexCaseSensitive.end()) {
+ // Found in the index
diff --git a/funguloids-ogre_1.6.patch b/funguloids-ogre_1.6.patch
new file mode 100644
index 000000000000..4c5f1e254574
--- /dev/null
+++ b/funguloids-ogre_1.6.patch
@@ -0,0 +1,36 @@
+--- include/mpakogre.h
++++ include/mpakogre.h
+@@ -56,6 +56,22 @@
+ FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false);
+
+ bool exists(const String &filename);
++
++ time_t getModifiedTime(const String& filename)
++ {
++ struct stat tagStat;
++ bool ret = (stat(mName.c_str(), &tagStat) == 0);
++
++ if (ret)
++ {
++ return tagStat.st_mtime;
++ }
++ else
++ {
++ return 0;
++ }
++
++ }
+ };
+
+
+--- src/scriptsystem.cpp
++++ src/scriptsystem.cpp
+@@ -137,7 +137,7 @@
+ Asteroid *roid = new Asteroid(String(name), ScriptSystem::getSingleton().getSceneMgr(), String(mesh), String(mat), pos);
+ roid->setScale(scale, scale, scale);
+ roid->setMass(scale * 10.0f);
+- roid->getEntity()->setNormaliseNormals(true);
++ //roid->getEntity()->setNormaliseNormals(true);
+ return 0;
+ }
+
diff --git a/funguloids-strcmp.patch b/funguloids-strcmp.patch
new file mode 100644
index 000000000000..2c425caf2da3
--- /dev/null
+++ b/funguloids-strcmp.patch
@@ -0,0 +1,11 @@
+--- src/ogrelistener.cpp
++++ src/ogrelistener.cpp
+@@ -130,7 +130,7 @@
+
+
+ // Show debug info?
+- if(GameApplication::mGameConfig->GetValue("graphics", "debug_info", "off") == "on") {
++ if(strcmp(GameApplication::mGameConfig->GetValue("graphics", "debug_info", "off"),"on") == 0) {
+ showDebugOverlay(true);
+ mStatsOn = true;
+ }
diff --git a/funguloids.desktop b/funguloids.desktop
new file mode 100644
index 000000000000..2b566dfbc481
--- /dev/null
+++ b/funguloids.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Funguloids
+Comment=Those Funny Funguloids!
+Exec=funguloids
+Icon=funguloids
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=Game;
diff --git a/mpak.py b/mpak.py
new file mode 100755
index 000000000000..5445336b3cc2
--- /dev/null
+++ b/mpak.py
@@ -0,0 +1,355 @@
+#!/usr/bin/env python
+"""
+ MPAK package handling utility
+ Version 1.4 (Python-implementation)
+ Copyright (c) 2008, Mika Halttunen. <http://www.mhgames.co.nr>
+
+ This command line tool allows creation and extraction of MPAK (.mpk) packages used
+ in several of my games. MPAK is a simple WAD-like file format of mine, that allows storing
+ the game data in one single .mpk file. I originally had a very crude command line program
+ bit like this one (written in C++), and decided to write this Python-implementation as
+ an Python-programming excercise. So, it's my first Python program. :)
+
+ Version history:
+ v1.4: The first Python version
+ v1.0 -- v1.31: The original C++ implementation
+"""
+import getopt, sys
+import os
+import traceback
+import struct
+import binascii
+import fnmatch
+import shutil
+from ctypes import c_uint32
+
+def usage():
+ """
+ Prints the program usage.
+ """
+ print("MPAK package handling utility")
+ print("Version 1.4 (Python-implementation)")
+ print("Copyright (c) 2008, Mika Halttunen.")
+ print("")
+ print("Usage:", sys.argv[0],"[switch]","-f pakfile.mpk","[file1]","[file2]", "[...]", "[fileN]")
+ print("where [switch] is one of the following:")
+ print(" -f, --file=FILE Use package FILE")
+ print(" -c, --create Create a new package with files 'file1' to 'fileN'")
+ print(" -l, --list List the files from given package")
+ print(" -e, --extract Extract all files (by default) from given package. If you")
+ print(" want to only extract some specific files, you can name")
+ print(" them individually, and/or use wildcards (i.e. *.png).")
+ print(" You can supply path where to extract with -p.")
+ print(" -p, --path=PATH Extract to PATH (created if doesn't exist)")
+ print(" -h, --help Print this usage text")
+ print("")
+
+
+def errorMsg(msg):
+ """
+ Prints an error message and exits.
+ """
+ try:
+ pos = traceback.extract_stack(limit=2)
+ if pos:
+ print("ERROR: In %s:%s, line %d:" % (pos[0][0], pos[0][2], pos[0][1]))
+ else:
+ print("ERROR:")
+ print("\t",msg)
+ except:
+ if __debug__:
+ traceback.print_exc()
+ pass
+ sys.exit(2)
+
+
+def separator():
+ """
+ Prints the separator line.
+ """
+ print("-"*75)
+
+
+def computeCRC(file, offset):
+ """
+ Computes the CRC32 for the file, starting at given offset.
+ """
+ f = open(file, "rb")
+ f.seek(offset)
+ crc = 0
+
+ # Compute a running CRC32 for the file in 16kb chunks
+ while True:
+ buffer = f.read(16384)
+ if not buffer: break # End of file
+
+ crc = binascii.crc32(buffer, crc)
+
+ f.close()
+ return crc
+
+
+def createPackage(pakFile, files):
+ """
+ Creates a new MPAK package.
+
+ This copies the given files into the new package file, writes the file table
+ and closes the package. MPAK doesn't support adding new files to an existing
+ package.
+ """
+ print("Creating '%s'.." % pakFile)
+ if len(files) < 1: errorMsg("No input files specified!")
+ separator()
+
+ # Open the package file for writing
+ out = open(pakFile, "wb")
+
+ # Write the header and reserve 4+4 bytes for CRC32 and file table offset
+ out.write(b"MPK1")
+ out.write(b"."*8)
+
+ # Write each file
+ package = { "fileNames": [], "fileOffsets": [] }
+ count = 0
+ for file in files:
+ # Get the basename
+ filename = os.path.basename(file)
+ print(" <%s..." % filename, end=' ')
+ package["fileNames"].append(filename)
+
+ # Get the file size in bytes
+ stats = os.stat(file)
+
+ # Store the current offset
+ package["fileOffsets"].append(out.tell())
+
+ # Open the file and copy its contents
+ f = open(file, "rb")
+ shutil.copyfileobj(f, out, 16384)
+ f.close()
+
+ print("OK. (%.1f KB)" % (stats.st_size / 1024.0))
+ count = count + 1
+
+ separator()
+
+ # Grab the file table offset and write the table
+ ftOffset = out.tell()
+
+ # Write the number of files
+ out.write(struct.pack("<L", count))
+
+ # Write the file information
+ for i in range(count):
+ # File name length
+ length = len(package["fileNames"][i]) + 1
+ out.write(struct.pack("B", length))
+ # File name, plus one zero for the C++ implementation
+ out.write(package["fileNames"][i].encode('ascii'))
+ out.write(struct.pack("B", 0))
+ # File offset
+ out.write(struct.pack("<L", package["fileOffsets"][i]))
+
+ # Update the header to have the correct file table offset
+ out.seek(8)
+ out.write(struct.pack("<L", ftOffset))
+
+ # Compute the CRC32 and write it to the header
+ out.flush()
+ crc32 = c_uint32(0)
+ crc32.value = computeCRC(pakFile, 8)
+ out.seek(4)
+ out.write(struct.pack("<L", crc32.value))
+
+ print("Added %d files to %s" % (count, pakFile))
+ print("Package '%s' created successfully. CRC32 checksum is %s." % (pakFile, hex(crc32.value)))
+ out.close()
+
+
+def readPackage(pakFile):
+ """
+ Opens the given MPAK package, reads its information and stores it to a
+ package dictionary. Returns the dictionary.
+ """
+ packageInfo = { "filename": pakFile }
+
+ f = open(pakFile, 'rb')
+ if f.read(4) != b"MPK1": errorMsg("Unsupported file format!")
+
+ # Read the CRC32 checksum and the file table header offset
+ buffer = f.read(8)
+ crc32, headerOffset = struct.unpack("<LL", buffer)
+ crc32 = int(crc32)
+ packageInfo["crc"] = crc32
+
+ # Check that the CRC32 matches
+ checksum = c_uint32(0)
+ checksum.value = computeCRC(pakFile, 8)
+ if checksum.value != crc32:
+ f.close()
+ errorMsg("Checksum doesn't match; perhaps a corrupted package?")
+
+ # Seek to the file table, and read the number of files
+ f.seek(headerOffset)
+ numFiles = struct.unpack("<L", f.read(4))[0]
+ packageInfo["numFiles"] = numFiles
+
+ # Read the file information
+ fileNames = []
+ fileOffsets = []
+ for i in range(numFiles):
+ namelen = struct.unpack("B", f.read(1))[0]
+ file = f.read(namelen)
+ offset = struct.unpack("<L", f.read(4))[0]
+ fileNames.append(file[:-1].decode('ascii')) # Remove the trailing null character
+ fileOffsets.append(offset)
+
+ # Compute the file sizes from the offsets
+ fileSizes = []
+ for i in range(numFiles-1):
+ fileSizes.append(fileOffsets[i+1] - fileOffsets[i])
+ fileSizes.append(headerOffset - fileOffsets[numFiles-1])
+
+ # Store the information
+ packageInfo["fileNames"] = fileNames
+ packageInfo["fileOffsets"] = fileOffsets
+ packageInfo["fileSizes"] = fileSizes
+ f.close()
+ return packageInfo
+
+
+def listPackage(pakFile):
+ """
+ Lists the contents of a MPAK package.
+ """
+ print("Listing '%s'.." % pakFile)
+ package = readPackage(pakFile)
+
+ # Print the listing
+ numFiles = package["numFiles"]
+ print("'%s' (CRC32: %s) contains %d files:" % (pakFile, hex(package["crc"]), numFiles))
+ print("")
+ print(" NUM : FILE : SIZE(KB) : OFFSET")
+ separator()
+ for i in range(numFiles):
+ print(" %3d : %30s : %-10.1f : (at %s)" % (i+1, package["fileNames"][i], package["fileSizes"][i] / 1024.0, hex(package["fileOffsets"][i])))
+
+ separator()
+ print(" NUM : FILE : SIZE(KB) : OFFSET")
+
+
+def extractPackage(pakFile, path, filters):
+ """
+ Extracts files from a package to given path.
+
+ By default extracts all the files. Can be given list of wildcards (i.e. *.png) to
+ extract only the files that match given wildcards. Wildcards can also be file names
+ from the package.
+
+ The given path is created if it doesn't exist.
+ If the path is just a single directory name, it's assumed to exist in the current
+ working directory.
+ """
+ print("Extracting files from '%s' to %s.." % (pakFile, path))
+ package = readPackage(pakFile)
+
+ # Try to create the path if it doesn't exist
+ path = os.path.abspath(path)
+ if not os.path.exists(path):
+ print("Path",path,"doesn't exist, creating it..")
+ try:
+ os.makedirs(path)
+ except:
+ errorMsg("Unable to create directory " + path + "!");
+
+ separator()
+
+ # Open the file, and extract all the individual files from it
+ count = 0
+ f = open(pakFile, "rb")
+ for i in range(package["numFiles"]):
+ # Test if the file name matches the given wildcard
+ if len(filters) > 0:
+ for filter in filters:
+ if fnmatch.fnmatch(package["fileNames"][i], filter):
+ break
+ else: continue
+
+ print(" >%s..." % package["fileNames"][i], end=' ')
+ # Seek to the correct offset
+ f.seek(package["fileOffsets"][i])
+
+ # Open a new file for writing, and write the file out in 16kb chunks
+ out = open(os.path.join(path, package["fileNames"][i]), "wb")
+ bytesWritten = 0
+ bytesTotal = package["fileSizes"][i];
+ while True:
+ # We have to watch not to write too much
+ bytesLeft = bytesTotal - bytesWritten
+ if bytesLeft > 16384: bytesLeft = 16384
+
+ buffer = f.read(bytesLeft)
+ out.write(buffer)
+ bytesWritten = bytesWritten + bytesLeft
+
+ if bytesWritten == bytesTotal:
+ break
+
+ out.close()
+ print("OK.")
+ count = count + 1
+
+ f.close()
+ separator()
+ print("%d (of %d) files extracted to %s." % (count, package["numFiles"], path))
+
+
+def main():
+ """
+ Main method.
+ """
+ try:
+ # Get the optiosn
+ opts, args = getopt.getopt(sys.argv[1:], "f:clep:h", ["file=", "create", "list", "extract", "path=", "help"])
+ except getopt.GetoptError as err:
+ # Print the program usage and exit
+ print("ERROR: " + str(err))
+ usage()
+ sys.exit(2)
+
+ extractPath = os.getcwd()
+ pakFile = None
+ action = None
+
+ # Handle the options
+ for o, a in opts:
+ if o in ("-f", "--file"):
+ pakFile = a # Grab the pakfile
+ elif o in ("-c", "--create"):
+ action = "create"
+ elif o in ("-l", "--list"):
+ action = "list"
+ elif o in ("-e", "--extract"):
+ action = "extract"
+ elif o in ("-p", "--path"):
+ extractPath = a # Grab the path
+ elif o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ else:
+ assert False, "Unhandled option"
+
+ # Check that we got a pakfile
+ if pakFile == None:
+ usage()
+ sys.exit(2)
+
+ if action == "create": createPackage(pakFile, args)
+ elif action == "list": listPackage(pakFile)
+ elif action == "extract": extractPackage(pakFile, extractPath, args)
+ else: usage()
+ sys.exit()
+
+if __name__ == "__main__":
+ main()
+
diff --git a/openalsoundsystem.cpp.diff b/openalsoundsystem.cpp.diff
new file mode 100644
index 000000000000..852598609a1a
--- /dev/null
+++ b/openalsoundsystem.cpp.diff
@@ -0,0 +1,68 @@
+--- src/openalsoundsystem.cpp 2007-05-22 11:11:46.000000000 -0400
++++ src/openalsoundsystem.cpp.ok 2009-12-12 03:56:37.341800903 -0500
+@@ -21,9 +21,9 @@
+ //
+ // 3. This notice may not be removed or altered from any source distribution.
+ //
+-//***************************************************************************/
+-
+-// NOTICE: This file is written by Piet (thanks! :), <funguloids@superpiet.de>,
++//***************************************************************************/
++
++// NOTICE: This file is written by Piet (thanks! :), <funguloids@superpiet.de>,
+ // for the Linux version of Funguloids.
+
+ #include "soundsystem.h"
+@@ -266,14 +266,14 @@
+
+ int attributes[] = { 0 };
+ mContext = alcCreateContext(mDevice, attributes);
+- if ( (err = alGetError()) != AL_NO_ERROR) {
++ if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ LogManager::getSingleton().logMessage("OpanAL: error creating context: " + lastALError(err) );
+ return 1;
+ }
+ // check_alc_error("Couldn't create audio context: ");
+ alcMakeContextCurrent(mContext);
+ // check_alc_error("Couldn't select audio context: ");
+- if ( (err = alGetError()) != AL_NO_ERROR) {
++ if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ LogManager::getSingleton().logMessage("OpanAL: error making context current: " + lastALError(err) );
+ return 2;
+ }
+@@ -312,12 +312,12 @@
+ mSoundChannels->setVolume(vol);
+
+ // add a music player
+- mStreamPlayer = new StreamPlayer();
+-
+- // Set the music volume
++ mStreamPlayer = new StreamPlayer();
++
++ // Set the music volume
+ svol = GameApplication::mGameConfig->GetValue("audio", "music_volume", "1.0");
+ vol = StringConverter::parseReal(svol);
+- mStreamPlayer->setVolume(vol);
++ mStreamPlayer->setVolume(vol);
+
+ return 0;
+ }
+@@ -480,14 +480,14 @@
+ if(mSoundDisabled) return;
+ if(file.empty()) return;
+ LogManager::getSingleton().logMessage("Going to play '" + file + "'..");
+- assert(mStreamPlayer);
+-
+- // Set the volume
++ assert(mStreamPlayer);
++
++ // Set the volume
+ String svol = GameApplication::mGameConfig->GetValue("audio", "music_volume", "1.0");
+ Real vol = StringConverter::parseReal(svol);
+
+ mStreamPlayer->play(file);
+- mStreamPlayer->setVolume(vol);
++ mStreamPlayer->setVolume(vol);
+ }
+
+
diff --git a/size_chunks_reverse.patch b/size_chunks_reverse.patch
new file mode 100644
index 000000000000..4b6624fb41b3
--- /dev/null
+++ b/size_chunks_reverse.patch
@@ -0,0 +1,11 @@
+--- src/mpakogre.cpp
++++ src/mpakogre.cpp
+@@ -219,7 +219,7 @@
+ }
+
+ size_t MPakDataStream::read(void *buf, size_t count) {
+- return fread(buf, count, 1, mFileHandle);
++ return fread(buf, 1, count, mFileHandle);
+ }
+
+ void MPakDataStream::skip(long count) {