Permalink
Browse files

Maemo/MeeGo Compatibility Fixes

  • Loading branch information...
1 parent d2b3ea0 commit d9dcbf64a98c86603d9b505ea6228269d07feafd @thp committed Jan 28, 2013
Showing with 38 additions and 20 deletions.
  1. +3 −3 apkenv.c
  2. +1 −1 compat/gles_wrappers.c
  3. +1 −1 imagelib/imagelib.h
  4. +10 −1 makefile
  5. +9 −8 modules/cuttherope.c
  6. +14 −6 modules/unity.c
View
@@ -467,12 +467,12 @@ int main(int argc, char **argv)
SDL_Event e;
while (SDL_PollEvent(&e)) {
+#ifdef PANDORA
if (e.type == SDL_KEYDOWN) {
if (e.key.keysym.sym==SDLK_ESCAPE) {
module->deinit(module);
goto finish;
}
-#ifdef PANDORA
else if (e.key.keysym.sym==SDLK_RSHIFT) {
//emulate_multitouch = 1;
module->input(module,ACTION_DOWN, platform_getscreenwidth()>>1, platform_getscreenheight()>>1,emulate_finger_id);
@@ -483,9 +483,9 @@ int main(int argc, char **argv)
//emulate_multitouch = 0;
module->input(module,ACTION_UP, platform_getscreenwidth()>>1, platform_getscreenheight()>>1,emulate_finger_id);
}
- }
+ } else
#endif
- else if (e.type == SDL_MOUSEBUTTONDOWN) {
+ if (e.type == SDL_MOUSEBUTTONDOWN) {
module->input(module, ACTION_DOWN, e.button.x, e.button.y, e.button.which);
if (emulate_multitouch) {
module->input(module,ACTION_DOWN, platform_getscreenwidth()-e.button.x, platform_getscreenheight()-e.button.y,emulate_finger_id);
View
@@ -215,7 +215,7 @@ my_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zN
{
WRAPPERS_DEBUG_PRINTF("glOrthof(%f, %f, %f, %f)\n", left, right, bottom, top, zNear, zFar);
if (global_module_hacks.gles_landscape_to_portrait!=0) {
- glRotatef(-90,0,0,1);
+ glRotatef(90, 0, 0, 1);
}
glOrthof(left, right, bottom, top, zNear, zFar);
}
View
@@ -1,5 +1,5 @@
#ifndef IMAGELIB_H
-#define IMAGELIB_h
+#define IMAGELIB_H
/// image lib, (c) crow_riot 2013
View
@@ -14,9 +14,15 @@ JNIENV_SOURCES=$(wildcard jni/*.c)
# Support modules for specific applications
MODULES_SOURCES=$(wildcard modules/*.c)
+# Maemo/MeeGo-specific stuff
+MAEMO_SOURCES=$(wildcard n9xx/*.c)
+
# Pandora specific stuff
PANDORA_SOURCES=$(wildcard pandora/*.c)
+# JPEG and PNG loaders
+IMAGELIB_SOURCES=$(wildcard imagelib/*.c)
+
# segfault catch
DEBUG_SOURCES=$(wildcard debug/*.c)
@@ -31,17 +37,20 @@ SOURCES += $(LINKER_SOURCES)
SOURCES += $(COMPAT_SOURCES)
SOURCES += $(APKLIB_SOURCES)
SOURCES += $(JNIENV_SOURCES)
+SOURCES += $(IMAGELIB_SOURCES)
SOURCES += $(DEBUG_SOURCES)
PANDORA ?= 0
ifeq ($(PANDORA),1)
SOURCES += $(PANDORA_SOURCES)
+else
+SOURCES += $(MAEMO_SOURCES)
endif
OBJS = $(patsubst %.c,%.o,$(SOURCES))
MODULES = $(patsubst modules/%.c,%.apkenv.so,$(MODULES_SOURCES))
-LDFLAGS = -fPIC -ldl -lz -lSDL -lSDL_mixer -pthread
+LDFLAGS = -fPIC -ldl -lz -lSDL -lSDL_mixer -pthread -lpng -ljpeg
ifeq ($(PANDORA),1)
LDFLAGS += -lrt
View
@@ -34,6 +34,8 @@
#include "common.h"
#include "../imagelib/imagelib.h"
+#include "../imagelib/loadjpeg.c"
+#include "../imagelib/loadpng.c"
#include <linux/limits.h>
#include <sys/stat.h>
@@ -613,7 +615,9 @@ cuttherope_init(struct SupportModule *self, int width, int height, const char *h
self->priv->home = strdup(home);
// init sound stuff
+#ifdef PANDORA
Mix_Init(MIX_INIT_OGG);
+#endif
int audio_rate = 22050;
uint16_t audio_format = AUDIO_S16SYS;
@@ -651,13 +655,12 @@ cuttherope_init(struct SupportModule *self, int width, int height, const char *h
self->priv->JNI_OnLoad(VM_M, NULL);
+ self->priv->nativeResize(ENV_M, GLOBAL_M, width, height);
+ self->priv->global->module_hacks->gles_landscape_to_portrait = 1;
+
#ifdef PANDORA
- self->priv->nativeResize(ENV_M, GLOBAL_M, height, width);
self->priv->global->module_hacks->gles_downscale_images = 1;
- self->priv->global->module_hacks->gles_landscape_to_portrait = 1;
self->priv->global->module_hacks->gles_no_readpixels = 1;
-#else
- self->priv->nativeResize(ENV_M, GLOBAL_M, width, height);
#endif
self->priv->nativeInit(ENV_M, GLOBAL_M, resourceLoader, soundManager, preferences,
@@ -670,14 +673,12 @@ cuttherope_init(struct SupportModule *self, int width, int height, const char *h
static void
cuttherope_input(struct SupportModule *self, int event, int x, int y, int finger)
{
-#ifdef PANDORA
if(self->global->module_hacks->gles_landscape_to_portrait)
{
int tmpx = x;
- x = y;
- y = 800-tmpx;
+ x = 480-y;
+ y = tmpx;
}
-#endif
if (event==ACTION_MOVE) {
self->priv->nativeTouchAdd(ENV_M,GLOBAL_M,0,2,x,y);
View
@@ -60,7 +60,15 @@ typedef struct
/* -------- */
-jfieldID JNIEnv_GetStaticFieldID(JNIEnv *p0, jclass p1, const char *p2, const char *p3) SOFTFP
+jfieldID JNIEnv_GetStaticFieldID(JNIEnv *p0, jclass p1, const char *p2, const char *p3) SOFTFP;
+jobject JNIEnv_GetStaticObjectField(JNIEnv *p0, jclass p1, jfieldID p2) SOFTFP;
+jclass JNIEnv_GetObjectClass(JNIEnv *p0, jobject p1) SOFTFP;
+jobject JNIEnv_CallObjectMethod(JNIEnv* env, jobject p1, jmethodID p2, ...) SOFTFP;
+jobject JNIEnv_CallStaticObjectMethod(JNIEnv* env, jclass p1, jmethodID p2, ...) SOFTFP;
+const char * JNIEnv_GetStringUTFChars(JNIEnv *env, jstring string, jboolean *isCopy) SOFTFP;
+
+
+jfieldID JNIEnv_GetStaticFieldID(JNIEnv *p0, jclass p1, const char *p2, const char *p3)
{
struct dummy_jclass* cls = (struct dummy_jclass*)p1;
MODULE_DEBUG_PRINTF("GetStaticFieldID %s %s %s\n", cls->name, p2, p3);
@@ -74,7 +82,7 @@ jfieldID JNIEnv_GetStaticFieldID(JNIEnv *p0, jclass p1, const char *p2, const ch
return (jfieldID)field;
}
-jobject JNIEnv_GetStaticObjectField(JNIEnv *p0, jclass p1, jfieldID p2) SOFTFP
+jobject JNIEnv_GetStaticObjectField(JNIEnv *p0, jclass p1, jfieldID p2)
{
struct dummy_jclass* cls = p1;
struct _jfieldID* fld = p2;
@@ -88,7 +96,7 @@ jobject JNIEnv_GetStaticObjectField(JNIEnv *p0, jclass p1, jfieldID p2) SOFTFP
return obj;
}
-jclass JNIEnv_GetObjectClass(JNIEnv *p0, jobject p1) SOFTFP
+jclass JNIEnv_GetObjectClass(JNIEnv *p0, jobject p1)
{
MODULE_DEBUG_PRINTF("GetObjectClass %x\n",p1);
if (p1!=NULL)
@@ -100,7 +108,7 @@ jclass JNIEnv_GetObjectClass(JNIEnv *p0, jobject p1) SOFTFP
}
-jobject JNIEnv_CallObjectMethod(JNIEnv* env, jobject p1, jmethodID p2, ...) SOFTFP
+jobject JNIEnv_CallObjectMethod(JNIEnv* env, jobject p1, jmethodID p2, ...)
{
MODULE_DEBUG_PRINTF("CallObjectMethod %x %x\n",p1,p2);
@@ -114,7 +122,7 @@ jobject JNIEnv_CallObjectMethod(JNIEnv* env, jobject p1, jmethodID p2, ...) SOFT
}
jobject
-JNIEnv_CallStaticObjectMethod(JNIEnv* env, jclass p1, jmethodID p2, ...) SOFTFP
+JNIEnv_CallStaticObjectMethod(JNIEnv* env, jclass p1, jmethodID p2, ...)
{
struct dummy_jclass* clazz = p1;
jmethodID method = p2;
@@ -248,7 +256,7 @@ JNIEnv_RegisterNatives(JNIEnv* p0, jclass p1, const JNINativeMethod* p2, jint p3
}
const char *
-JNIEnv_GetStringUTFChars(JNIEnv *env, jstring string, jboolean *isCopy) SOFTFP
+JNIEnv_GetStringUTFChars(JNIEnv *env, jstring string, jboolean *isCopy)
{
MODULE_DEBUG_PRINTF("JNIEnv_GetStringUTFChars(%x)\n", string);
if (string == GLOBAL_J(env)) {

0 comments on commit d9dcbf6

Please sign in to comment.