diff --git a/project/AndroidManifest.xml b/project/AndroidManifest.xml index bef3c83e7..9c08786ae 100644 --- a/project/AndroidManifest.xml +++ b/project/AndroidManifest.xml @@ -1,8 +1,8 @@ pRoot->handler->open)(pDirHandle, name, flags, mode); // Also adds a new entry to the physical dir if appropriate. if (handle == NULL) { + log_add (log_Info, "uio_open: open file failed '%s'", name); int savedErrno = errno; uio_free(name); uio_PDirHandle_unref(pDirHandle); diff --git a/project/jni/application/sc2/src/uqm/gameinp.c b/project/jni/application/sc2/src/uqm/gameinp.c index cd2745599..d3633cc44 100644 --- a/project/jni/application/sc2/src/uqm/gameinp.c +++ b/project/jni/application/sc2/src/uqm/gameinp.c @@ -33,9 +33,13 @@ #include "libs/threadlib.h" +#ifdef ANDROID +#define ACCELERATION_INCREMENT (ONE_SECOND) +#define MENU_REPEAT_DELAY (ONE_SECOND) +#else #define ACCELERATION_INCREMENT (ONE_SECOND / 12) #define MENU_REPEAT_DELAY (ONE_SECOND / 2) - +#endif typedef struct { diff --git a/project/jni/application/src b/project/jni/application/src index 7fa7b8f4e..299033683 120000 --- a/project/jni/application/src +++ b/project/jni/application/src @@ -1 +1 @@ -opentyrian \ No newline at end of file +teeworlds \ No newline at end of file diff --git a/project/jni/sdl_main/sdl_main.c b/project/jni/sdl_main/sdl_main.c index b0cb627c1..6930bdd52 100644 --- a/project/jni/sdl_main/sdl_main.c +++ b/project/jni/sdl_main/sdl_main.c @@ -44,11 +44,8 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) strcat(curdir, "/files"); } chdir(curdir); - /* - __android_log_print(ANDROID_LOG_INFO, "libSDL", "Waiting 30s for debugger"); - sleep(30); // Wait for debugger to attach - __android_log_print(ANDROID_LOG_INFO, "libSDL", "Starting main()"); - */ + setenv("HOME", curdir, 1); + main( argc, argv ); }; diff --git a/project/res/values/strings.xml b/project/res/values/strings.xml index bdeb1e31a..6a74a6572 100644 --- a/project/res/values/strings.xml +++ b/project/res/values/strings.xml @@ -1,4 +1,4 @@ - OpenTyrian + TeeWorlds diff --git a/project/src/Accelerometer.java b/project/src/Accelerometer.java index b46b829e0..a6a1efd6d 100644 --- a/project/src/Accelerometer.java +++ b/project/src/Accelerometer.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; import android.content.Context; diff --git a/project/src/Audio.java b/project/src/Audio.java index 8e2da1863..4e601c64f 100644 --- a/project/src/Audio.java +++ b/project/src/Audio.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; diff --git a/project/src/DataDownloader.java b/project/src/DataDownloader.java index 13c2dafe4..9e13aa72f 100644 --- a/project/src/DataDownloader.java +++ b/project/src/DataDownloader.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; import android.content.Context; diff --git a/project/src/GLSurfaceView_SDL.java b/project/src/GLSurfaceView_SDL.java index b37c5722a..aa2c30c3a 100644 --- a/project/src/GLSurfaceView_SDL.java +++ b/project/src/GLSurfaceView_SDL.java @@ -18,7 +18,7 @@ fixed with a hammer and rasp to work with libSDL port */ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import java.io.Writer; import java.util.ArrayList; @@ -749,6 +749,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call * @param configSpec */ public void start(){ + + Log.v("SDL", "GLSurfaceView_SDL::EglHelper::start(): creating GL context"); /* * Get an EGL instance */ @@ -781,6 +783,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call * OpenGL interface that renders to that surface. */ public GL createSurface(SurfaceHolder holder) { + Log.v("SDL", "GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context"); /* * The window size has changed, so we need to create a new * surface. @@ -835,6 +838,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call } public void finish() { + Log.v("SDL", "GLSurfaceView_SDL::EglHelper::finish(): destroying GL context"); if (mEglSurface != null) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, @@ -929,6 +933,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call /* * Update the asynchronous state (window size) */ + while(true) { // Loop until we're re-created GL context and successfully called swap() + int w, h; boolean changed; synchronized (this) { @@ -941,6 +947,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call mNeedStart = true; } while (needToWait()) { + //Log.v("SDL", "GLSurfaceView_SDL::run(): paused"); wait(); } if (mDone) { @@ -974,7 +981,12 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call * Once we're done with GL, we need to call swapBuffers() * to instruct the system to display the rendered frame */ - return mEglHelper.swap(); + if( mEglHelper.swap() ) + return true; + // We've lost GL context - recreate it + mEglHelper.finish(); + mNeedStart = true; + } } catch (java.lang.InterruptedException e) { return false; @@ -1037,12 +1049,14 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call } public void onPause() { + Log.v("SDL", "GLSurfaceView_SDL::onPause()"); synchronized (this) { mPaused = true; } } public void onResume() { + Log.v("SDL", "GLSurfaceView_SDL::onResume()"); synchronized (this) { mPaused = false; notify(); diff --git a/project/src/Globals.java b/project/src/Globals.java index 57eb31bdd..7601e6cc3 100644 --- a/project/src/Globals.java +++ b/project/src/Globals.java @@ -1,14 +1,14 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; import android.content.Context; class Globals { - public static String ApplicationName = "OpenTyrian"; + public static String ApplicationName = "TeeWorlds"; // Should be zip file - public static String DataDownloadUrl = "Data files size is 11 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"; + public static String DataDownloadUrl = "Game data is 5 Mb|http://sourceforge.net/projects/libsdl-android/files/TeeWorlds/teeworlds.zip/download"; // Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D public static boolean NeedDepthBuffer = false; @@ -27,7 +27,7 @@ class Globals { public static boolean AppUsesMultitouch = false; - public static int AppTouchscreenKeyboardKeysAmount = 4; + public static int AppTouchscreenKeyboardKeysAmount = 2; public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1; @@ -48,5 +48,5 @@ class Globals { } class LoadLibrary { - public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_net"); }; + public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_image"); System.loadLibrary("sdl_mixer"); }; } diff --git a/project/src/MainActivity.java b/project/src/MainActivity.java index 8af915268..86a9341ee 100644 --- a/project/src/MainActivity.java +++ b/project/src/MainActivity.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; import android.content.Context; diff --git a/project/src/Settings.java b/project/src/Settings.java index 655a44976..363a9db58 100644 --- a/project/src/Settings.java +++ b/project/src/Settings.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import android.app.Activity; import android.content.Context; diff --git a/project/src/Video.java b/project/src/Video.java index 01411d628..c600aae45 100644 --- a/project/src/Video.java +++ b/project/src/Video.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package com.googlecode.opentyrian; +package com.teeworlds; import javax.microedition.khronos.opengles.GL10;