Skip to content

Instantly share code, notes, and snippets.

@alx3apps
Created March 11, 2012 11:57
Show Gist options
  • Save alx3apps/2016179 to your computer and use it in GitHub Desktop.
Save alx3apps/2016179 to your computer and use it in GitHub Desktop.
Android patch for GemRB (http://www.gemrb.org/), target GemRB version specified in VERSION_GEMRB
diff --git a/gemrb/GemRB.cpp b/gemrb/GemRB.cpp
index 8e240f8..ae7098f 100644
--- a/gemrb/GemRB.cpp
+++ b/gemrb/GemRB.cpp
@@ -39,6 +39,8 @@
#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(1,3,0)
#include "Audio.h"
+using namespace GemRB;
+
// pause audio playing if app goes in background
static void appPutToBackground()
{
@@ -68,7 +70,6 @@ int main(int argc, char* argv[])
#endif
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
#endif
- using namespace GemRB;
Interface::SanityCheck(VERSION_GEMRB);
InitializeLogging();
diff --git a/gemrb/core/System/Logger/File.cpp b/gemrb/core/System/Logger/File.cpp
index 2e6cba8..24cdd7e 100644
--- a/gemrb/core/System/Logger/File.cpp
+++ b/gemrb/core/System/Logger/File.cpp
@@ -23,6 +23,15 @@
#include <cstdio>
+#ifdef ANDROID
+#include "Interface.h"
+#include "System/FileStream.h"
+#ifndef STATIC_LINK
+# define STATIC_LINK
+#endif
+#include "plugindef.h"
+#endif
+
namespace GemRB {
FileLogger::FileLogger(DataStream* log_file)
@@ -44,4 +53,21 @@ Logger* createFileLogger(DataStream* log_file)
return new FileLogger(log_file);
}
+#ifdef ANDROID
+
+static void addLogger()
+{
+ char log_path[_MAX_PATH];
+ FileStream* log_file = new FileStream();
+ PathJoin( log_path, core->GamePath, "GemRB.log", NULL );
+ if (log_file->Create(log_path)) {
+ AddLogger(createFileLogger(log_file));
+ }
+}
+
+GEMRB_PLUGIN(unused, "tmp/file logger")
+PLUGIN_INITIALIZER(addLogger)
+END_PLUGIN()
+#endif
+
}
diff --git a/gemrb/core/System/Logger/Win32Console.cpp b/gemrb/core/System/Logger/Win32Console.cpp
index 6bd9295..eaaa55c 100644
--- a/gemrb/core/System/Logger/Win32Console.cpp
+++ b/gemrb/core/System/Logger/Win32Console.cpp
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#ifndef ANDROID
+
#include "System/Logger/Win32Console.h"
#include "System/Logging.h"
@@ -77,3 +79,4 @@ Logger* createWin32ConsoleLogger()
}
}
+#endif
diff --git a/gemrb/includes/globals.h b/gemrb/includes/globals.h
index 6ca60b7..db46d01 100644
--- a/gemrb/includes/globals.h
+++ b/gemrb/includes/globals.h
@@ -34,7 +34,7 @@
#include "ie_types.h"
-#define VERSION_GEMRB "0.7.0-git"
+#define VERSION_GEMRB "0.7.0-b15159f"
#define GEMRB_STRING "GemRB v" VERSION_GEMRB
diff --git a/gemrb/plugins/SDLVideo/SDL20Video.cpp b/gemrb/plugins/SDLVideo/SDL20Video.cpp
index b1e2887..0eb6808 100644
--- a/gemrb/plugins/SDLVideo/SDL20Video.cpp
+++ b/gemrb/plugins/SDLVideo/SDL20Video.cpp
@@ -18,6 +18,7 @@
*
*/
+#ifndef ANDROID
#include "SDL20Video.h"
#include "Interface.h"
@@ -575,3 +576,4 @@ bool SDL20VideoDriver::SetSurfaceAlpha(SDL_Surface* surface, unsigned short alph
GEMRB_PLUGIN(0xDBAAB50, "SDL Video Driver")
PLUGIN_DRIVER(SDL20VideoDriver, "sdl")
END_PLUGIN()
+#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment