From 62e8c34a88019ff408113d13a700e3fd6842b451 Mon Sep 17 00:00:00 2001 From: pelya Date: Fri, 12 Nov 2010 15:17:14 +0200 Subject: [PATCH] Option for main() commandline parameters in ChangeAppSettings.sh, fixed UQM translation packs --- ChangeAppSettings.sh | 14 +- project/java/Globals.java | 2 + project/java/Video.java | 4 +- .../application/sc2/AndroidAppSettings.cfg | 9 +- project/jni/application/sc2/sc2-android.diff | 1039 ----------------- project/jni/application/sc2/src/config_unix.h | 6 +- project/jni/sdl_main/sdl_main.c | 47 +- 7 files changed, 67 insertions(+), 1054 deletions(-) delete mode 100644 project/jni/application/sc2/sc2-android.diff diff --git a/ChangeAppSettings.sh b/ChangeAppSettings.sh index f28678977..bbcf99d04 100755 --- a/ChangeAppSettings.sh +++ b/ChangeAppSettings.sh @@ -1,6 +1,6 @@ #!/bin/sh -CHANGE_APP_SETTINGS_VERSION=14 +CHANGE_APP_SETTINGS_VERSION=15 AUTO= if [ "X$1" = "X-a" ]; then @@ -254,7 +254,7 @@ fi fi if [ -z "$AUTO" ]; then -echo -n "\nAditional LDFLAGS for application ($AppLdflags): " +echo -n "\nAdditional LDFLAGS for application ($AppLdflags): " read var if [ -n "$var" ] ; then AppLdflags="$var" @@ -278,6 +278,14 @@ if [ -n "$var" ] ; then fi fi +if [ -z "$AUTO" ]; then +echo -n "\nApplication command line parameters, including app name as 0-th param ($AppCmdline): " +read var +if [ -n "$var" ] ; then + AppCmdline="$var" +fi +fi + if [ -z "$ReadmeText" -o -z "$AUTO" ]; then echo -n "\nHere you may type some short readme text that will be shown when app data is downloaded." echo -n "\nCurrent text:\n" @@ -332,6 +340,7 @@ echo AppCflags=\'$AppCflags\' >> AndroidAppSettings.cfg echo AppLdflags=\'$AppLdflags\' >> AndroidAppSettings.cfg echo AppSubdirsBuild=\'$AppSubdirsBuild\' >> AndroidAppSettings.cfg echo AppUseCrystaXToolchain=$AppUseCrystaXToolchain >> AndroidAppSettings.cfg +echo AppCmdline=\'$AppCmdline\' >> AndroidAppSettings.cfg echo ReadmeText=\'$ReadmeText\' >> AndroidAppSettings.cfg AppShortName=`echo $AppName | sed 's/ //g'` @@ -486,6 +495,7 @@ cat project/src/Globals.java | \ sed "s/public static int AppTouchscreenKeyboardKeysAmount = .*;/public static int AppTouchscreenKeyboardKeysAmount = $AppTouchscreenKeyboardKeysAmount;/" | \ sed "s/public static int AppTouchscreenKeyboardKeysAmountAutoFire = .*;/public static int AppTouchscreenKeyboardKeysAmountAutoFire = $AppTouchscreenKeyboardKeysAmountAutoFire;/" | \ sed "s%public static String ReadmeText = .*%public static String ReadmeText = \"$ReadmeText\".replace(\"^\",\"\\\n\");%" | \ + sed "s%public static String CommandLine = .*%public static String CommandLine = \"$AppCmdline\";%" | \ sed "s/public LoadLibrary() .*/public LoadLibrary() { $LibrariesToLoad };/" > \ project/src/Globals.java.1 mv -f project/src/Globals.java.1 project/src/Globals.java diff --git a/project/java/Globals.java b/project/java/Globals.java index 6adb25e8f..7adf59542 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -22,6 +22,8 @@ class Globals { // Readme text to be shown on download page public static String ReadmeText = "^You may press \"Home\" now - the data will be downloaded in background".replace("^","\n"); + public static String CommandLine = ""; + public static boolean AppUsesMouse = false; public static boolean AppNeedsTwoButtonMouse = false; diff --git a/project/java/Video.java b/project/java/Video.java index ce4905f4b..872f9d99b 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -210,7 +210,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer { // Tweak video thread priority, if user selected big audio buffer if(Globals.AudioBufferConfig >= 2) Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal - nativeInit(); // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code + nativeInit(Globals.CommandLine); // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process } @@ -249,7 +249,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer { }; private native void nativeInitJavaCallbacks(); - private native void nativeInit(); + private native void nativeInit(String CommandLine); private native void nativeResize(int w, int h); private native void nativeDone(); private native void nativeGlContextLost(); diff --git a/project/jni/application/sc2/AndroidAppSettings.cfg b/project/jni/application/sc2/AndroidAppSettings.cfg index 1f35007d7..dc6a65c0e 100644 --- a/project/jni/application/sc2/AndroidAppSettings.cfg +++ b/project/jni/application/sc2/AndroidAppSettings.cfg @@ -1,11 +1,11 @@ # The application settings for Android libSDL port -AppSettingVersion=14 +AppSettingVersion=15 LibSdlVersion=1.2 AppName="Ur-Quan Masters" AppFullName=com.sourceforge.sc2 ScreenOrientation=h InhibitSuspend=n -AppDataDownloadUrl="Game data is 14 Mb|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/sc2-data.zip/download|https://sites.google.com/site/xpelyax/Home/sc2-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/sc2-data.zip^3DO remixed music (19 Mb) - enable it in Setup->Sound Options->3DO Remixes|:addons/3domusic/3domusic.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3domusic.zip/download|:addons/3domusic/3domusic.zip:https://sites.google.com/site/xpelyax/Home/3domusic.zip?attredirects=0&d=1|:addons/3domusic/3domusic.zip:http://sitesproxy.goapk.com/site/xpelyax/Home/3domusic.zip^UQM music remix pack (150 Mb) - enable it in Setup->Sound Options->UQM Remixes|:addons/remix/remix.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/remix.zip/download^3DO voice (115 Mb) - go to Setup->Sound Options and increase Voice volume from zero|:addons/3dovoice/3dovoice.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovoice.zip/download^Russian translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/russian.zip/download^Deutsch translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/deutsch.zip/download^Spanish translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/spanish.zip/download^Slovak translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/slovak.zip/download^Finnish translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/finnish.zip/download^3DO video support - after installing this pack copy all files from|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^your 3DO Star Control II game CD from 'duckart' dir to the SD card to dir|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'app-data/com.sourceforge.sc2/addons/3dovideo', to extract files from 3DO disk use|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'3DO Commander' or 'uncd-rom' apps from http://madroms.free.fr/3do/|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^Then from the game change 'Setup->PC/3DO compat->Cutscenes' to Movies, and restart game|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download" +AppDataDownloadUrl="Game data is 14 Mb|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/sc2-data.zip/download|https://sites.google.com/site/xpelyax/Home/sc2-data.zip?attredirects=0&d=1|http:// sitesproxy.goapk.com/site/xpelyax/Home/sc2-data.zip^3DO remixed music (19 Mb) - enable it in Setup->Sound Options->3DO Remixes|:addons/3domusic/3domusic.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3domusic.zip/download|:addons/3domusic/3domusic.zip:https://sites. google.com/site/xpelyax/Home/3domusic.zip?attredirects=0&d=1|:addons/3domusic/3domusic.zip:http://sitesproxy.goapk.com/site/xpelyax/Home/3domusic.zip^UQM music remix pack (150 Mb) - enable it in Setup->Sound Options->UQM Remixes|:addons/remix/remix.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/remix.zip/download^3DO voice (115 Mb) - go to Setup->Sound Options and increase Voice volume from zero|:addons/3dovoice/3dovoice.zip:https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovoice.zip/download^Russian translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/russian.zip/download^Deutsch translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/deutsch.zip/download^Spanish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/spanish.zip/download^Slovak translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/slovak.zip/download^Finnish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/finnish.zip/download^3DO video support - after installing this pack copy all files from|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^your 3DO Star Control II game CD from 'duckart' dir to the SD card to dir|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'app-data/com.sourceforge.sc2/addons/3dovideo', to extract files from 3DO disk use|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'3DO Commander' or 'uncd-rom' apps from http://madroms.free.fr/3do/|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^Then from the game change 'Setup->PC/3DO compat->Cutscenes' to Movies, and restart game|https://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download" SdlVideoResize=y SdlVideoResizeKeepAspect=n NeedDepthBuffer=n @@ -21,12 +21,13 @@ RedefinedKeys="RETURN RSHIFT KP_PLUS KP_MINUS RCTRL F10" AppTouchscreenKeyboardKeysAmount=2 AppTouchscreenKeyboardKeysAmountAutoFire=0 MultiABI=n -AppVersionCode=06917 -AppVersionName="0.6.9.17 - Added Russian, Deutsch, Spanish, Slovak and Finnish translations for game dialogs" +AppVersionCode=06918 +AppVersionName="0.6.9.18 - translation packages work for real now" CompiledLibraries="sdl_image tremor ogg" CustomBuildScript=n AppCflags='-O3 -DTHREADLIB_SDL=1 -DTIMELIB=SDL -DOVCODEC_TREMOR=1 -DNETPLAY=1 -DHAVE_REGEX=1 -DHAVE_GETOPT_LONG=1 -DHAVE_ZIP=1 -DHAVE_JOYSTICK=1 -DDIRECTIONAL_JOYSTICK_MELEE=1' AppLdflags='' AppSubdirsBuild='' AppUseCrystaXToolchain=n +AppCmdline='uqm --addon lang' ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/application/sc2/sc2-android.diff b/project/jni/application/sc2/sc2-android.diff deleted file mode 100644 index d1aac40f4..000000000 --- a/project/jni/application/sc2/sc2-android.diff +++ /dev/null @@ -1,1039 +0,0 @@ -Only in /home/pelya/src/endless_space/sc2/sc2/src: abxadec -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/config_unix.h ./config_unix.h ---- /home/pelya/src/endless_space/sc2/sc2/src/config_unix.h 1970-01-01 03:00:00.000000000 +0300 -+++ ./config_unix.h 2010-09-02 19:10:04.000000000 +0300 -@@ -0,0 +1,67 @@ -+/* This file contains some compile-time configuration options for *nix -+ * systems. -+ * config_unix.h is generated from config_unix.h.in by build.sh -+ * When building on MS Windows using build.sh (MinGW, Cygwin), -+ * config_win.h is generated from src/config_win.h.in. -+ * When using MSVC on MS Windows, you'll have to edit src/msvc++/config.h -+ * manually if you want anything else than the defaults. -+ */ -+ -+#ifndef _CONFIG_UNIX_H -+#define _CONFIG_UNIX_H -+ -+/* Directory where the UQM game data is located */ -+#define CONTENTDIR "./" -+ -+/* Directory where game data will be stored */ -+#define USERDIR "./config/" -+ -+/* Directory where config files will be stored */ -+#define CONFIGDIR USERDIR -+ -+/* Directory where supermelee teams will be stored */ -+#define MELEEDIR "./teams/" -+ -+/* Directory where save games will be stored */ -+#define SAVEDIR "./save/" -+ -+/* Defined if words are stored with the most significant byte first */ -+#ifdef __ARMEL__ -+#undef WORDS_BIGENDIAN -+#endif -+ -+/* Defined if your system has readdir_r of its own */ -+#define HAVE_READDIR_R 1 -+ -+/* Defined if your system has setenv of its own */ -+#ifndef HAVE_SETENV -+#define HAVE_SETENV 1 -+#endif -+ -+/* Defined if your system has strupr of its own */ -+#undef HAVE_STRUPR -+ -+/* Defined if your system has strcasecmp of its own */ -+#define HAVE_STRCASECMP_UQM 1 -+ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. -+ -+/* Defined if your system has stricmp of its own */ -+#undef HAVE_STRICMP -+ -+/* Defined if your system has getopt_long */ -+#define HAVE_GETOPT_LONG 1 -+ -+/* Defined if your system has iswgraph of its own*/ -+#define HAVE_ISWGRAPH 1 -+ -+/* Defined if your system has wchar_t of its own */ -+#define HAVE_WCHAR_T 1 -+ -+/* Defined if your system has wint_t of its own */ -+#define HAVE_WINT_T 1 -+ -+/* Defined if your system has _Bool of its own */ -+#define HAVE__BOOL 1 -+ -+#endif /* _CONFIG_UNIX_H */ -+ -Only in /home/pelya/src/endless_space/sc2/sc2/src: darwin -Only in /home/pelya/src/endless_space/sc2/sc2/src: getopt -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs: cdp -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/graphics/sdl/pure.c ./libs/graphics/sdl/pure.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/graphics/sdl/pure.c 2010-08-21 19:18:16.000000000 +0300 -+++ ./libs/graphics/sdl/pure.c 2010-08-20 13:51:25.000000000 +0300 -@@ -128,6 +128,7 @@ - { - int i, videomode_flags; - SDL_PixelFormat conv_fmt; -+ int BPP = 32; - - GraphicsDriver = driver; - -@@ -152,10 +153,13 @@ - "under pure SDL, using 640x480", width, height); - } - -+#ifdef ANDROID - videomode_flags = SDL_SWSURFACE; - ScreenWidthActual = 320; - ScreenHeightActual = 240; - graphics_backend = &pure_unscaled_backend; -+ BPP = 16; -+#endif - - videomode_flags |= SDL_ANYFORMAT; - if (flags & TFB_GFXFLAGS_FULLSCREEN) -@@ -164,7 +168,7 @@ - /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set - SDL_ANYFORMAT */ - SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, -- 16, videomode_flags); -+ BPP, videomode_flags); - - if (SDL_Video == NULL) - { -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/graphics/sdl/sdl_common.c ./libs/graphics/sdl/sdl_common.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/graphics/sdl/sdl_common.c 2010-07-16 17:28:00.000000000 +0300 -+++ ./libs/graphics/sdl/sdl_common.c 2010-09-29 18:52:20.775196911 +0300 -@@ -52,6 +52,25 @@ - volatile int QuitPosted = 0; - volatile int GameActive = 1; // Track the SDL_ACTIVEEVENT state SDL_APPACTIVE - -+#ifdef ANDROID -+extern void ResumeMusic (void); -+extern void PauseMusic (void); -+ -+void AndroidGamePaused() -+{ -+ GameActive = 0; -+ SDL_ANDROID_PauseAudioPlayback(); -+ PauseMusic(); -+} -+ -+void AndroidGameResumed() -+{ -+ GameActive = 1; -+ SDL_ANDROID_ResumeAudioPlayback(); -+ ResumeMusic(); -+} -+#endif -+ - void - TFB_PreInit (void) - { -@@ -76,6 +95,9 @@ - log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError ()); - exit (EXIT_FAILURE); - } -+#ifdef ANDROID -+ SDL_ANDROID_SetApplicationPutToBackgroundCallback(&AndroidGamePaused, &AndroidGameResumed); -+#endif - } - - int -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/log: msgbox_macosx.m -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/log/msgbox_stub.c ./libs/log/msgbox_stub.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/log/msgbox_stub.c 2010-07-16 17:27:59.000000000 +0300 -+++ ./libs/log/msgbox_stub.c 2010-08-20 13:41:34.000000000 +0300 -@@ -16,6 +16,9 @@ - - #include "msgbox.h" - #include "loginternal.h" -+#ifdef ANDROID -+#include -+#endif - - void - log_displayBox (const /*UTF-8*/char *title, int isError, -@@ -26,6 +29,9 @@ - // So just inform the user of our predicament - fprintf (streamOut, "Do not know how to display %s box\n", - isError ? "an error" : "a"); -+#ifdef ANDROID -+ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); -+#endif - - // Suppress the compiler warnings in any case. - (void)title; -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/log: msgbox_win.c -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/log/uqmlog.c ./libs/log/uqmlog.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/log/uqmlog.c 2010-07-16 17:27:59.000000000 +0300 -+++ ./libs/log/uqmlog.c 2010-08-21 19:23:44.000000000 +0300 -@@ -23,6 +23,9 @@ - #include - #include - #include -+#ifdef ANDROID -+#include -+#endif - #include "libs/threadlib.h" - - #ifndef MAX_LOG_ENTRY_SIZE -@@ -190,6 +193,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -@@ -226,6 +232,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network/netmanager: netmanager_win.c -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network/netmanager: netmanager_win.h -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network: network_win.c -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network/socket: socket_win.c -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network/socket: socket_win.h -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network: wspiapiwrap.c -Only in /home/pelya/src/endless_space/sc2/sc2/src/libs/network: wspiapiwrap.h -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/resource/filecntl.c ./libs/resource/filecntl.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/resource/filecntl.c 2010-07-16 17:27:54.000000000 +0300 -+++ ./libs/resource/filecntl.c 2010-09-02 19:12:03.000000000 +0300 -@@ -26,6 +26,7 @@ - #include "port.h" - #include "resintrn.h" - #include "libs/uio.h" -+#include "libs/log.h" - - uio_Stream * - res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) -@@ -34,7 +35,10 @@ - struct stat sb; - - if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) -+ { -+ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); - return ((uio_Stream *) ~0); -+ } - - fp = uio_fopen (dir, filename, mode); - -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/io.c ./libs/uio/io.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/io.c 2010-07-16 17:27:59.000000000 +0300 -+++ ./libs/uio/io.c 2010-09-02 19:09:17.768130602 +0300 -@@ -35,6 +35,7 @@ - #include "mem.h" - #include "uioutils.h" - #include "uioport.h" -+#include "../log.h" - #ifdef uio_MEM_DEBUG - # include "memdebug.h" - #endif -@@ -193,6 +194,7 @@ - errno = EINVAL; - return NULL; - } -+ log_add (log_Info, "uio_open %s", sourcePath); - handle = uio_open(sourceDir, sourcePath, - ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? - O_RDONLY : O_RDWR) -@@ -201,12 +203,14 @@ - #endif - , 0); - if (handle == NULL) { -+ log_add (log_Info, "uio_open failed for %s", sourcePath); - // errno is set - return NULL; - } - } - - handler = uio_getFileSystemHandler(fsType); -+ log_add (log_Info, "uio_getFileSystemHandler %p", handler); - if (handler == NULL) { - if (handle) - uio_close(handle); -@@ -703,6 +707,7 @@ - &readMountInfo, &readPDirHandle, NULL, - &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { - // errno is set -+ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); - return NULL; - } - -@@ -729,6 +734,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = EEXIST; -+ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); - return NULL; - } - if ((flags & O_TRUNC) == O_TRUNC) { -@@ -745,6 +751,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = savedErrno; -+ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); - return NULL; - } - } -@@ -766,6 +773,7 @@ - handle = (pDirHandle->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 -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/match.c ./libs/uio/match.c ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/match.c 2010-07-16 17:27:59.678123153 +0300 -+++ ./libs/uio/match.c 2010-08-21 18:42:42.000000000 +0300 -@@ -506,7 +506,7 @@ - return match_ENOTINIT; - } - if (context->errorString) { -- uio_free(context->errorString); -+ uio_free(context->errorString); //TODO: why does it crash here on Android? - context->errorString = NULL; - } - retval = regexec(&context->native, string, 0, NULL, 0); -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/match.h ./libs/uio/match.h ---- /home/pelya/src/endless_space/sc2/sc2/src/libs/uio/match.h 2010-07-16 17:27:59.000000000 +0300 -+++ ./libs/uio/match.h 2010-08-21 18:42:56.000000000 +0300 -@@ -27,7 +27,7 @@ - - // TODO: make this into a configurable option - //#define HAVE_GLOB --#define HAVE_REGEX -+//#define HAVE_REGEX - - - typedef enum { -@@ -79,7 +79,7 @@ - - #include - #ifdef HAVE_REGEX --# include -+# include "uqm_regex.h" - #endif - - #include "uioport.h" -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/options.c ./options.c ---- /home/pelya/src/endless_space/sc2/sc2/src/options.c 2010-08-25 13:39:02.000000000 +0300 -+++ ./options.c 2010-08-25 16:16:32.000000000 +0300 -@@ -322,8 +322,6 @@ - static uio_AutoMount *autoMount[] = { NULL }; - uio_MountHandle *contentMountHandle; - -- -- log_add (log_Info, "Content dir: %s", contentPath); - contentMountHandle = uio_mountDir (repository, "/", - uio_FSTYPE_STDIO, NULL, NULL, contentPath, autoMount, - uio_MOUNT_TOP | uio_MOUNT_RDONLY, NULL); -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/regex/regex.c ./regex/regex.c ---- /home/pelya/src/endless_space/sc2/sc2/src/regex/regex.c 2010-07-16 17:28:13.000000000 +0300 -+++ ./regex/regex.c 2010-08-21 18:42:07.000000000 +0300 -@@ -50,6 +50,7 @@ - - #ifdef _LIBC - /* We have to keep the namespace clean. */ -+/* - # define regfree(preg) __regfree (preg) - # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef) - # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) -@@ -69,6 +70,7 @@ - # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ - __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) - # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) -+*/ - - # include "../locale/localeinfo.h" - #endif -@@ -82,7 +84,7 @@ - #undefs RE_DUP_MAX and sets it to the right value. */ - #include - --#include -+#include "uqm_regex.h" - #include "regex_internal.h" - - #include "regex_internal.ci" -Only in /home/pelya/src/endless_space/sc2/sc2/src/regex: regex.h -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/regex/uqm_regex.h ./regex/uqm_regex.h ---- /home/pelya/src/endless_space/sc2/sc2/src/regex/uqm_regex.h 1970-01-01 03:00:00.000000000 +0300 -+++ ./regex/uqm_regex.h 2010-08-21 18:41:32.000000000 +0300 -@@ -0,0 +1,616 @@ -+/* Definitions for data structures and routines for the regular -+ expression library. -+ Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003 -+ Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, write to the Free -+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -+ 02111-1307 USA. */ -+ -+#ifndef _REGEX_H -+#define _REGEX_H 1 -+ -+#include -+ -+/* Allow the use in C++ code. */ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* POSIX says that must be included (by the caller) before -+ . */ -+ -+#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS -+/* VMS doesn't have `size_t' in , even though POSIX says it -+ should be there. */ -+# include -+#endif -+ -+ -+# define regfree(preg) UQM__regfree (preg) -+# define regexec(pr, st, nm, pm, ef) UQM__regexec (pr, st, nm, pm, ef) -+# define regcomp(preg, pattern, cflags) UQM__regcomp (preg, pattern, cflags) -+# define regerror(errcode, preg, errbuf, errbuf_size) \ -+ UQM__regerror(errcode, preg, errbuf, errbuf_size) -+# define re_set_registers(bu, re, nu, st, en) \ -+ UQM__re_set_registers (bu, re, nu, st, en) -+# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ -+ UQM__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) -+# define re_match(bufp, string, size, pos, regs) \ -+ UQM__re_match (bufp, string, size, pos, regs) -+# define re_search(bufp, string, size, startpos, range, regs) \ -+ UQM__re_search (bufp, string, size, startpos, range, regs) -+# define re_compile_pattern(pattern, length, bufp) \ -+ UQM__re_compile_pattern (pattern, length, bufp) -+# define re_set_syntax(syntax) UQM__re_set_syntax (syntax) -+# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ -+ UQM__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) -+# define re_compile_fastmap(bufp) UQM__re_compile_fastmap (bufp) -+ -+ -+ -+/* The following two types have to be signed and unsigned integer type -+ wide enough to hold a value of a pointer. For most ANSI compilers -+ ptrdiff_t and size_t should be likely OK. Still size of these two -+ types is 2 for Microsoft C. Ugh... */ -+typedef long int s_reg_t; -+typedef unsigned long int active_reg_t; -+ -+/* The following bits are used to determine the regexp syntax we -+ recognize. The set/not-set meanings are chosen so that Emacs syntax -+ remains the value 0. The bits are given in alphabetical order, and -+ the definitions shifted by one from the previous bit; thus, when we -+ add or remove a bit, only one other definition need change. */ -+typedef unsigned long int reg_syntax_t; -+ -+/* If this bit is not set, then \ inside a bracket expression is literal. -+ If set, then such a \ quotes the following character. */ -+#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) -+ -+/* If this bit is not set, then + and ? are operators, and \+ and \? are -+ literals. -+ If set, then \+ and \? are operators and + and ? are literals. */ -+#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) -+ -+/* If this bit is set, then character classes are supported. They are: -+ [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], -+ [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. -+ If not set, then character classes are not supported. */ -+#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) -+ -+/* If this bit is set, then ^ and $ are always anchors (outside bracket -+ expressions, of course). -+ If this bit is not set, then it depends: -+ ^ is an anchor if it is at the beginning of a regular -+ expression or after an open-group or an alternation operator; -+ $ is an anchor if it is at the end of a regular expression, or -+ before a close-group or an alternation operator. -+ -+ This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because -+ POSIX draft 11.2 says that * etc. in leading positions is undefined. -+ We already implemented a previous draft which made those constructs -+ invalid, though, so we haven't changed the code back. */ -+#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) -+ -+/* If this bit is set, then special characters are always special -+ regardless of where they are in the pattern. -+ If this bit is not set, then special characters are special only in -+ some contexts; otherwise they are ordinary. Specifically, -+ * + ? and intervals are only special when not after the beginning, -+ open-group, or alternation operator. */ -+#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) -+ -+/* If this bit is set, then *, +, ?, and { cannot be first in an re or -+ immediately after an alternation or begin-group operator. */ -+#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) -+ -+/* If this bit is set, then . matches newline. -+ If not set, then it doesn't. */ -+#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) -+ -+/* If this bit is set, then . doesn't match NUL. -+ If not set, then it does. */ -+#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) -+ -+/* If this bit is set, nonmatching lists [^...] do not match newline. -+ If not set, they do. */ -+#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) -+ -+/* If this bit is set, either \{...\} or {...} defines an -+ interval, depending on RE_NO_BK_BRACES. -+ If not set, \{, \}, {, and } are literals. */ -+#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) -+ -+/* If this bit is set, +, ? and | aren't recognized as operators. -+ If not set, they are. */ -+#define RE_LIMITED_OPS (RE_INTERVALS << 1) -+ -+/* If this bit is set, newline is an alternation operator. -+ If not set, newline is literal. */ -+#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) -+ -+/* If this bit is set, then `{...}' defines an interval, and \{ and \} -+ are literals. -+ If not set, then `\{...\}' defines an interval. */ -+#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) -+ -+/* If this bit is set, (...) defines a group, and \( and \) are literals. -+ If not set, \(...\) defines a group, and ( and ) are literals. */ -+#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) -+ -+/* If this bit is set, then \ matches . -+ If not set, then \ is a back-reference. */ -+#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) -+ -+/* If this bit is set, then | is an alternation operator, and \| is literal. -+ If not set, then \| is an alternation operator, and | is literal. */ -+#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) -+ -+/* If this bit is set, then an ending range point collating higher -+ than the starting range point, as in [z-a], is invalid. -+ If not set, then when ending range point collates higher than the -+ starting range point, the range is ignored. */ -+#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) -+ -+/* If this bit is set, then an unmatched ) is ordinary. -+ If not set, then an unmatched ) is invalid. */ -+#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) -+ -+/* If this bit is set, succeed as soon as we match the whole pattern, -+ without further backtracking. */ -+#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) -+ -+/* If this bit is set, do not process the GNU regex operators. -+ If not set, then the GNU regex operators are recognized. */ -+#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) -+ -+/* If this bit is set, turn on internal regex debugging. -+ If not set, and debugging was on, turn it off. -+ This only works if regex.c is compiled -DDEBUG. -+ We define this bit always, so that all that's needed to turn on -+ debugging is to recompile regex.c; the calling code can always have -+ this bit set, and it won't affect anything in the normal case. */ -+#define RE_DEBUG (RE_NO_GNU_OPS << 1) -+ -+/* If this bit is set, a syntactically invalid interval is treated as -+ a string of ordinary characters. For example, the ERE 'a{1' is -+ treated as 'a\{1'. */ -+#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) -+ -+/* If this bit is set, then ignore case when matching. -+ If not set, then case is significant. */ -+#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) -+ -+/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only -+ for ^, because it is difficult to scan the regex backwards to find -+ whether ^ should be special. */ -+#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) -+ -+/* If this bit is set, then \{ cannot be first in an bre or -+ immediately after an alternation or begin-group operator. */ -+#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) -+ -+/* If this bit is set, then no_sub will be set to 1 during -+ re_compile_pattern. */ -+#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) -+ -+/* This global variable defines the particular regexp syntax to use (for -+ some interfaces). When a regexp is compiled, the syntax used is -+ stored in the pattern buffer, so changing this does not affect -+ already-compiled regexps. */ -+extern reg_syntax_t re_syntax_options; -+ -+/* Define combinations of the above bits for the standard possibilities. -+ (The [[[ comments delimit what gets put into the Texinfo file, so -+ don't delete them!) */ -+/* [[[begin syntaxes]]] */ -+#define RE_SYNTAX_EMACS 0 -+ -+#define RE_SYNTAX_AWK \ -+ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ -+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ -+ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ -+ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ -+ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) -+ -+#define RE_SYNTAX_GNU_AWK \ -+ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ -+ & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \ -+ | RE_CONTEXT_INVALID_OPS )) -+ -+#define RE_SYNTAX_POSIX_AWK \ -+ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ -+ | RE_INTERVALS | RE_NO_GNU_OPS) -+ -+#define RE_SYNTAX_GREP \ -+ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ -+ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ -+ | RE_NEWLINE_ALT) -+ -+#define RE_SYNTAX_EGREP \ -+ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ -+ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ -+ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ -+ | RE_NO_BK_VBAR) -+ -+#define RE_SYNTAX_POSIX_EGREP \ -+ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ -+ | RE_INVALID_INTERVAL_ORD) -+ -+/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ -+#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC -+ -+#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC -+ -+/* Syntax bits common to both basic and extended POSIX regex syntax. */ -+#define _RE_SYNTAX_POSIX_COMMON \ -+ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ -+ | RE_INTERVALS | RE_NO_EMPTY_RANGES) -+ -+#define RE_SYNTAX_POSIX_BASIC \ -+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) -+ -+/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes -+ RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this -+ isn't minimal, since other operators, such as \`, aren't disabled. */ -+#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ -+ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) -+ -+#define RE_SYNTAX_POSIX_EXTENDED \ -+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ -+ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ -+ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ -+ | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) -+ -+/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is -+ removed and RE_NO_BK_REFS is added. */ -+#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ -+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ -+ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ -+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ -+ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) -+/* [[[end syntaxes]]] */ -+ -+/* Maximum number of duplicates an interval can allow. Some systems -+ (erroneously) define this in other header files, but we want our -+ value, so remove any previous define. */ -+#ifdef RE_DUP_MAX -+# undef RE_DUP_MAX -+#endif -+/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ -+#define RE_DUP_MAX (0x7fff) -+ -+ -+/* POSIX `cflags' bits (i.e., information for `regcomp'). */ -+ -+/* If this bit is set, then use extended regular expression syntax. -+ If not set, then use basic regular expression syntax. */ -+#define REG_EXTENDED 1 -+ -+/* If this bit is set, then ignore case when matching. -+ If not set, then case is significant. */ -+#define REG_ICASE (REG_EXTENDED << 1) -+ -+/* If this bit is set, then anchors do not match at newline -+ characters in the string. -+ If not set, then anchors do match at newlines. */ -+#define REG_NEWLINE (REG_ICASE << 1) -+ -+/* If this bit is set, then report only success or fail in regexec. -+ If not set, then returns differ between not matching and errors. */ -+#define REG_NOSUB (REG_NEWLINE << 1) -+ -+ -+/* POSIX `eflags' bits (i.e., information for regexec). */ -+ -+/* If this bit is set, then the beginning-of-line operator doesn't match -+ the beginning of the string (presumably because it's not the -+ beginning of a line). -+ If not set, then the beginning-of-line operator does match the -+ beginning of the string. */ -+#define REG_NOTBOL 1 -+ -+/* Like REG_NOTBOL, except for the end-of-line. */ -+#define REG_NOTEOL (1 << 1) -+ -+/* Use PMATCH[0] to delimit the start and end of the search in the -+ buffer. */ -+#define REG_STARTEND (1 << 2) -+ -+ -+/* If any error codes are removed, changed, or added, update the -+ `re_error_msg' table in regex.c. */ -+typedef enum -+{ -+#ifdef _XOPEN_SOURCE -+ REG_ENOSYS = -1, /* This will never happen for this implementation. */ -+#endif -+ -+ REG_NOERROR = 0, /* Success. */ -+ REG_NOMATCH, /* Didn't find a match (for regexec). */ -+ -+ /* POSIX regcomp return error codes. (In the order listed in the -+ standard.) */ -+ REG_BADPAT, /* Invalid pattern. */ -+ REG_ECOLLATE, /* Inalid collating element. */ -+ REG_ECTYPE, /* Invalid character class name. */ -+ REG_EESCAPE, /* Trailing backslash. */ -+ REG_ESUBREG, /* Invalid back reference. */ -+ REG_EBRACK, /* Unmatched left bracket. */ -+ REG_EPAREN, /* Parenthesis imbalance. */ -+ REG_EBRACE, /* Unmatched \{. */ -+ REG_BADBR, /* Invalid contents of \{\}. */ -+ REG_ERANGE, /* Invalid range end. */ -+ REG_ESPACE, /* Ran out of memory. */ -+ REG_BADRPT, /* No preceding re for repetition op. */ -+ -+ /* Error codes we've added. */ -+ REG_EEND, /* Premature end. */ -+ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ -+ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ -+} reg_errcode_t; -+ -+/* This data structure represents a compiled pattern. Before calling -+ the pattern compiler, the fields `buffer', `allocated', `fastmap', -+ `translate', and `no_sub' can be set. After the pattern has been -+ compiled, the `re_nsub' field is available. All other fields are -+ private to the regex routines. */ -+ -+#ifndef RE_TRANSLATE_TYPE -+# define RE_TRANSLATE_TYPE char * -+#endif -+ -+struct re_pattern_buffer -+{ -+/* [[[begin pattern_buffer]]] */ -+ /* Space that holds the compiled pattern. It is declared as -+ `unsigned char *' because its elements are -+ sometimes used as array indexes. */ -+ unsigned char *buffer; -+ -+ /* Number of bytes to which `buffer' points. */ -+ unsigned long int allocated; -+ -+ /* Number of bytes actually used in `buffer'. */ -+ unsigned long int used; -+ -+ /* Syntax setting with which the pattern was compiled. */ -+ reg_syntax_t syntax; -+ -+ /* Pointer to a fastmap, if any, otherwise zero. re_search uses -+ the fastmap, if there is one, to skip over impossible -+ starting points for matches. */ -+ char *fastmap; -+ -+ /* Either a translate table to apply to all characters before -+ comparing them, or zero for no translation. The translation -+ is applied to a pattern when it is compiled and to a string -+ when it is matched. */ -+ RE_TRANSLATE_TYPE translate; -+ -+ /* Number of subexpressions found by the compiler. */ -+ size_t re_nsub; -+ -+ /* Zero if this pattern cannot match the empty string, one else. -+ Well, in truth it's used only in `re_search_2', to see -+ whether or not we should use the fastmap, so we don't set -+ this absolutely perfectly; see `re_compile_fastmap' (the -+ `duplicate' case). */ -+ unsigned can_be_null : 1; -+ -+ /* If REGS_UNALLOCATED, allocate space in the `regs' structure -+ for `max (RE_NREGS, re_nsub + 1)' groups. -+ If REGS_REALLOCATE, reallocate space if necessary. -+ If REGS_FIXED, use what's there. */ -+#define REGS_UNALLOCATED 0 -+#define REGS_REALLOCATE 1 -+#define REGS_FIXED 2 -+ unsigned regs_allocated : 2; -+ -+ /* Set to zero when `regex_compile' compiles a pattern; set to one -+ by `re_compile_fastmap' if it updates the fastmap. */ -+ unsigned fastmap_accurate : 1; -+ -+ /* If set, `re_match_2' does not return information about -+ subexpressions. */ -+ unsigned no_sub : 1; -+ -+ /* If set, a beginning-of-line anchor doesn't match at the -+ beginning of the string. */ -+ unsigned not_bol : 1; -+ -+ /* Similarly for an end-of-line anchor. */ -+ unsigned not_eol : 1; -+ -+ /* If true, an anchor at a newline matches. */ -+ unsigned newline_anchor : 1; -+ -+/* [[[end pattern_buffer]]] */ -+}; -+ -+typedef struct re_pattern_buffer regex_t; -+ -+/* Type for byte offsets within the string. POSIX mandates this. */ -+typedef int regoff_t; -+ -+ -+/* This is the structure we store register match data in. See -+ regex.texinfo for a full description of what registers match. */ -+struct re_registers -+{ -+ unsigned num_regs; -+ regoff_t *start; -+ regoff_t *end; -+}; -+ -+ -+/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, -+ `re_match_2' returns information about at least this many registers -+ the first time a `regs' structure is passed. */ -+#ifndef RE_NREGS -+# define RE_NREGS 30 -+#endif -+ -+ -+/* POSIX specification for registers. Aside from the different names than -+ `re_registers', POSIX uses an array of structures, instead of a -+ structure of arrays. */ -+typedef struct -+{ -+ regoff_t rm_so; /* Byte offset from string's start to substring's start. */ -+ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ -+} regmatch_t; -+ -+/* Declarations for routines. */ -+ -+/* To avoid duplicating every routine declaration -- once with a -+ prototype (if we are ANSI), and once without (if we aren't) -- we -+ use the following macro to declare argument types. This -+ unfortunately clutters up the declarations a bit, but I think it's -+ worth it. */ -+ -+#if __STDC__ -+ -+# define _RE_ARGS(args) args -+ -+#else /* not __STDC__ */ -+ -+# define _RE_ARGS(args) () -+ -+#endif /* not __STDC__ */ -+ -+/* Sets the current default syntax to SYNTAX, and return the old syntax. -+ You can also simply assign to the `re_syntax_options' variable. */ -+extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); -+ -+/* Compile the regular expression PATTERN, with length LENGTH -+ and syntax given by the global `re_syntax_options', into the buffer -+ BUFFER. Return NULL if successful, and an error string if not. */ -+extern const char *re_compile_pattern -+ _RE_ARGS ((const char *pattern, size_t length, -+ struct re_pattern_buffer *buffer)); -+ -+ -+/* Compile a fastmap for the compiled pattern in BUFFER; used to -+ accelerate searches. Return 0 if successful and -2 if was an -+ internal error. */ -+extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); -+ -+ -+/* Search in the string STRING (with length LENGTH) for the pattern -+ compiled into BUFFER. Start searching at position START, for RANGE -+ characters. Return the starting position of the match, -1 for no -+ match, or -2 for an internal error. Also return register -+ information in REGS (if REGS and BUFFER->no_sub are nonzero). */ -+extern int re_search -+ _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, -+ int length, int start, int range, struct re_registers *regs)); -+ -+ -+/* Like `re_search', but search in the concatenation of STRING1 and -+ STRING2. Also, stop searching at index START + STOP. */ -+extern int re_search_2 -+ _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, -+ int length1, const char *string2, int length2, -+ int start, int range, struct re_registers *regs, int stop)); -+ -+ -+/* Like `re_search', but return how many characters in STRING the regexp -+ in BUFFER matched, starting at position START. */ -+extern int re_match -+ _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, -+ int length, int start, struct re_registers *regs)); -+ -+ -+/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -+extern int re_match_2 -+ _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, -+ int length1, const char *string2, int length2, -+ int start, struct re_registers *regs, int stop)); -+ -+ -+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and -+ ENDS. Subsequent matches using BUFFER and REGS will use this memory -+ for recording register information. STARTS and ENDS must be -+ allocated with malloc, and must each be at least `NUM_REGS * sizeof -+ (regoff_t)' bytes long. -+ -+ If NUM_REGS == 0, then subsequent matches should allocate their own -+ register data. -+ -+ Unless this function is called, the first search or match using -+ PATTERN_BUFFER will allocate its own register data, without -+ freeing the old data. */ -+extern void re_set_registers -+ _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, -+ unsigned num_regs, regoff_t *starts, regoff_t *ends)); -+ -+#if defined _REGEX_RE_COMP || defined _LIBC -+# ifndef _CRAY -+/* 4.2 bsd compatibility. */ -+extern char *re_comp _RE_ARGS ((const char *)); -+extern int re_exec _RE_ARGS ((const char *)); -+# endif -+#endif -+ -+/* GCC 2.95 and later have "__restrict"; C99 compilers have -+ "restrict", and "configure" may have defined "restrict". */ -+#ifndef __restrict -+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) -+# if defined restrict || 199901L <= __STDC_VERSION__ -+# define __restrict restrict -+# else -+# define __restrict -+# endif -+# endif -+#endif -+/* gcc 3.1 and up support the [restrict] syntax. */ -+#ifndef __restrict_arr -+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) -+# define __restrict_arr __restrict -+# else -+# define __restrict_arr -+# endif -+#endif -+ -+/* POSIX compatibility. */ -+extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, -+ const char *__restrict __pattern, -+ int __cflags)); -+ -+extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, -+ const char *__restrict __string, size_t __nmatch, -+ regmatch_t __pmatch[__restrict_arr], -+ int __eflags)); -+ -+extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, -+ char *__errbuf, size_t __errbuf_size)); -+ -+extern void regfree _RE_ARGS ((regex_t *__preg)); -+ -+ -+#ifdef __cplusplus -+} -+#endif /* C++ */ -+ -+#endif /* regex.h */ -+ -+/* -+Local variables: -+make-backup-files: t -+version-control: t -+trim-versions-without-asking: nil -+End: -+*/ -Only in /home/pelya/src/endless_space/sc2/sc2/src: res -Only in /home/pelya/src/endless_space/sc2/sc2/src: symbian -diff -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/uqm/gameinp.c ./uqm/gameinp.c ---- /home/pelya/src/endless_space/sc2/sc2/src/uqm/gameinp.c 2010-07-16 17:28:12.000000000 +0300 -+++ ./uqm/gameinp.c 2010-09-02 18:20:37.000000000 +0300 -@@ -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 -u -r --unidirectional-new-file -x .svn /home/pelya/src/endless_space/sc2/sc2/src/uqm.c ./uqm.c ---- /home/pelya/src/endless_space/sc2/sc2/src/uqm.c 2010-07-16 17:28:13.000000000 +0300 -+++ ./uqm.c 2010-09-24 13:48:49.000000000 +0300 -@@ -267,6 +267,20 @@ - int gfxFlags; - int i; - -+#ifdef ANDROID -+ // Remove save and config files from my previous Andorid releases, where I've messed up save paths, so users will be able to overwrite saves -+ unlink("melee.cfg"); -+ unlink("uqm.cfg"); -+ unlink("flight.cfg"); -+ -+ for(i = 0; i < 50; i++) -+ { -+ char buf[64]; -+ sprintf(buf, "save/starcon2.%02d", i); -+ unlink(buf); -+ }; -+#endif -+ - // NOTE: we cannot use the logging facility yet because we may have to - // log to a file, and we'll only get the log file name after parsing - // the options. diff --git a/project/jni/application/sc2/src/config_unix.h b/project/jni/application/sc2/src/config_unix.h index 2392afb85..f9aa7e9a1 100644 --- a/project/jni/application/sc2/src/config_unix.h +++ b/project/jni/application/sc2/src/config_unix.h @@ -14,16 +14,16 @@ #define CONTENTDIR "" /* Directory where game data will be stored */ -#define USERDIR "/data/data/com.sourceforge.sc2/files/config/" +#define USERDIR "config/" /* Directory where config files will be stored */ #define CONFIGDIR USERDIR /* Directory where supermelee teams will be stored */ -#define MELEEDIR "${UQM_CONFIG_DIR}/teams/" +#define MELEEDIR "teams/" /* Directory where save games will be stored */ -#define SAVEDIR "${UQM_CONFIG_DIR}/save/" +#define SAVEDIR "save/" /* Defined if words are stored with the most significant byte first */ #ifdef __ARMEL__ diff --git a/project/jni/sdl_main/sdl_main.c b/project/jni/sdl_main/sdl_main.c index 253cddef3..43fdc8825 100644 --- a/project/jni/sdl_main/sdl_main.c +++ b/project/jni/sdl_main/sdl_main.c @@ -27,11 +27,13 @@ static int isSdcardUsed = 0; extern C_LINKAGE void -JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) +JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring cmdline ) { - int argc = 1; - char * argv[] = { "sdl" }; char curdir[512]; + const jbyte *str; + int argc = 1; + char ** argv = { "sdl" }; + if( isSdcardUsed ) { strcpy(curdir, "/sdcard/app-data/"); @@ -46,8 +48,45 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) chdir(curdir); setenv("HOME", curdir, 1); - __android_log_print(ANDROID_LOG_INFO, "libSDL", "Calling SDL_main()" ); + str = (*env)->GetStringUTFChars(env, cmdline, NULL); + + if (str != NULL && strlen(str) > 0) + { + char * str1, * str2; + argc = 0; + str1 = strdup(str); + str2 = str1; + int i = 0; + while(str2) + { + argc++; + str2 = strchr(str2, ' '); + if(!str2) + break; + str2++; + } + + argv = (char **)malloc(argc*sizeof(char *)); + str2 = str1; + while(str2) + { + argv[i] = str2; + i++; + str2 = strchr(str2, ' '); + if(str2) + *str2 = 0; + else + break; + str2++; + } + } + + __android_log_print(ANDROID_LOG_INFO, "libSDL", "Calling SDL_main(\"%s\")", str); + + (*env)->ReleaseStringUTFChars(env, cmdline, str); + main( argc, argv ); + }; extern C_LINKAGE void