Skip to content
Browse files

added another hack variable for cut the rope

  • Loading branch information...
1 parent a254188 commit 420f5193fe0b86ca4e6a7a00c876534d20e93a27 @crowriot committed Jan 27, 2013
Showing with 15 additions and 14 deletions.
  1. +1 −0 apkenv.h
  2. +8 −8 compat/gles_wrappers.c
  3. +6 −6 modules/cuttherope.c
View
1 apkenv.h
@@ -45,6 +45,7 @@ struct SupportModulePriv;
struct ModuleHacks {
int gles_landscape_to_portrait;
int gles_downscale_images;
+ int gles_no_readpixels;
};
struct SupportModule {
View
16 compat/gles_wrappers.c
@@ -215,7 +215,6 @@ 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) {
- glLoadIdentity();
glRotatef(-90,0,0,1);
}
glOrthof(left, right, bottom, top, zNear, zFar);
@@ -247,7 +246,7 @@ my_glPolygonOffset(GLfloat factor, GLfloat units)
void
my_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
- WRAPPERS_DEBUG_PRINTF("glRotatef()\n", angle, x, y, z);
+ WRAPPERS_DEBUG_PRINTF("glRotatef(%f,%f,%f,%f)\n", angle, x, y, z);
glRotatef(angle, x, y, z);
}
void
@@ -781,8 +780,9 @@ my_glPushMatrix()
void
my_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
{
- WRAPPERS_DEBUG_PRINTF("glReadPixels()\n", x, y, width, height, format, type, pixels);
- glReadPixels(x, y, width, height, format, type, pixels);
+ WRAPPERS_DEBUG_PRINTF("glReadPixels(%d,%d,%d,%d,0x%x,0x%x,0x%x)\n", x, y, width, height, format, type, pixels);
+ if (global_module_hacks.gles_no_readpixels==0)
+ glReadPixels(x, y, width, height, format, type, pixels);
}
void
my_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
@@ -876,7 +876,7 @@ my_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
int downscale = global_module_hacks.gles_downscale_images && (width>=maxsize || height>=maxsize);
- if ( downscale && format==GL_RGBA && type==GL_UNSIGNED_SHORT_4_4_4_4 )
+ if ( downscale && format==GL_RGBA && (type==GL_UNSIGNED_SHORT_4_4_4_4 || type==GL_UNSIGNED_SHORT_5_6_5) )
{
int x,y;
GLushort* src = (GLushort*)pixels;
@@ -922,7 +922,7 @@ my_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
else
{
if (downscale)
- WRAPPERS_DEBUG_PRINTF("downlscale unsupported/glTexImage2D(0x%x,%d,%d,%d,%d,%d,0x%x,0x%x,0x%x)\n", target, level, internalformat, width, height, border, format, type, pixels);
+ WRAPPERS_DEBUG_PRINTF("downscale unsupported/glTexImage2D(0x%x,%d,%d,%d,%d,%d,0x%x,0x%x,0x%x)\n", target, level, internalformat, width, height, border, format, type, pixels);
else
WRAPPERS_DEBUG_PRINTF("glTexImage2D(0x%x,%d,%d,%d,%d,%d,0x%x,0x%x,0x%x)\n", target, level, internalformat, width, height, border, format, type, pixels);
@@ -974,9 +974,9 @@ my_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointe
void
my_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
- WRAPPERS_DEBUG_PRINTF("glViewport()\n", x, y, width, height);
+ WRAPPERS_DEBUG_PRINTF("glViewport(%d, %d, %d, %d)\n", x, y, width, height);
if (global_module_hacks.gles_landscape_to_portrait!=0) {
- glViewport(x, y, height, width);
+ glViewport(y, x, height, width);
} else {
glViewport(x, y, width, height);
}
View
12 modules/cuttherope.c
@@ -278,9 +278,11 @@ cuttherope_loadImage(JNIEnv *env, const char *filename )
}
}
+ Image nocache;
if (i>=MAX_IMAGES) {
MODULE_DEBUG_PRINTF("cuttherope_loadImage: Images exceeding limits: %s\n",filename);
- return NULL;
+ //return NULL;
+ img = &nocache; //dont cache
}
strcpy(img->filename,filename);
@@ -650,12 +652,10 @@ cuttherope_init(struct SupportModule *self, int width, int height, const char *h
self->priv->JNI_OnLoad(VM_M, NULL);
#ifdef PANDORA
- self->priv->global->module_hacks->gles_landscape_to_portrait = 1;
- if (self->priv->global->module_hacks->gles_landscape_to_portrait)
- self->priv->nativeResize(ENV_M, GLOBAL_M, height, width);
- else
- self->priv->nativeResize(ENV_M, GLOBAL_M, width, height);
+ 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

0 comments on commit 420f519

Please sign in to comment.
Something went wrong with that request. Please try again.