diff --git a/project/jni/application/openarena/AndroidAppSettings.cfg b/project/jni/application/openarena/AndroidAppSettings.cfg index feac03cad..793535ef4 100644 --- a/project/jni/application/openarena/AndroidAppSettings.cfg +++ b/project/jni/application/openarena/AndroidAppSettings.cfg @@ -37,8 +37,8 @@ HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig' FirstStartMenuOptions='' MultiABI=y AppMinimumRAM=300 -AppVersionCode=08815 -AppVersionName="0.8.8.15" +AppVersionCode=08816 +AppVersionName="0.8.8.16" ResetSdlConfigForThisVersion=y DeleteFilesOnUpgrade="libsdl-DownloadFinished-10.flag .openarena/baseoa/q3config.cfg" CompiledLibraries="sdl_mixer sdl_image freetype curl vorbis ogg" diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 8e5c2bbce..5c6bfe3c1 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 8e5c2bbce310547036f47661ce164fcec99de043 +Subproject commit 5c6bfe3c1eb50fbf775a0bb459f09b6a38d0d4be diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index 86f8d3231..6f83b0c5a 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit 86f8d32314a322712afd0b23c6f33cda7d9ac726 +Subproject commit 6f83b0c5a4b91e45ace33fffeb8ca36ff3291276 diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h index dc7fba931..fe0e67f72 100644 --- a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h +++ b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h @@ -43,10 +43,7 @@ extern "C" { #endif /* Button IDs */ -enum { - - SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */ - +enum { SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */ SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, @@ -56,6 +53,8 @@ enum { SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, /* Button to show screen keyboard */ + SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, /* Joystick/D-Pad button */ + SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM }; @@ -88,11 +87,15 @@ extern DECLSPEC extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons); extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(void); +/* Hide the whole screen keyboard */ extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardShown(int shown); extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(void); - +/* Get the button size modifier, as configured by user with SDL startup menu */ extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(void); +/* Set a particular button to pass a mouse/multitouch events down to the application, by default all buttons block touch events */ +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(int buttonId, int generateEvents); + /* Show Android on-screen keyboard, and pass entered text back to application as SDL keypress events, previousText is UTF-8 encoded, it may be NULL, only 256 first bytes will be used, and this call will not block */ extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char * previousText); diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c index 700da7971..149a09c1e 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c @@ -297,25 +297,28 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t // even if the finger is not anymore above screen kb button it will not acr as mouse event, and if it's initially // touches the screen outside of screen kb it won't trigger button keypress - // I think it's more logical this way - if( SDL_ANDROID_isTouchscreenKeyboardUsed && ( action == MOUSE_DOWN || touchPointers[pointerId] == TOUCH_PTR_SCREENKB ) ) + if( SDL_ANDROID_isTouchscreenKeyboardUsed && ( action == MOUSE_DOWN || touchPointers[pointerId] & TOUCH_PTR_SCREENKB ) ) { - if( SDL_ANDROID_processTouchscreenKeyboard(x, y, action, pointerId) && action == MOUSE_DOWN ) - touchPointers[pointerId] = TOUCH_PTR_SCREENKB; - if( touchPointers[pointerId] == TOUCH_PTR_SCREENKB ) + unsigned processed = SDL_ANDROID_processTouchscreenKeyboard(x, y, action, pointerId); + //__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_processTouchscreenKeyboard: ptr %d action %d ret 0x%08x", pointerId, action, processed); + if( processed && action == MOUSE_DOWN ) + touchPointers[pointerId] |= TOUCH_PTR_SCREENKB; + if( touchPointers[pointerId] & TOUCH_PTR_SCREENKB ) { if( action == MOUSE_UP ) touchPointers[pointerId] = TOUCH_PTR_UP; - return; + if( !(processed & TOUCHSCREEN_KEYBOARD_PASS_EVENT_DOWN_TO_SDL) ) + return; } } if( action == MOUSE_DOWN ) { - touchPointers[pointerId] = TOUCH_PTR_MOUSE; + touchPointers[pointerId] |= TOUCH_PTR_MOUSE; firstMousePointerId = -1; for( i = 0; i < MAX_MULTITOUCH_POINTERS; i++ ) { - if( touchPointers[i] == TOUCH_PTR_MOUSE ) + if( touchPointers[i] & TOUCH_PTR_MOUSE ) { firstMousePointerId = i; break; @@ -680,7 +683,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t firstMousePointerId = -1; for( i = 0; i < MAX_MULTITOUCH_POINTERS; i++ ) { - if( touchPointers[i] == TOUCH_PTR_MOUSE ) + if( touchPointers[i] |= TOUCH_PTR_MOUSE ) { firstMousePointerId = i; break; @@ -2159,32 +2162,6 @@ JAVA_EXPORT_NAME(Settings_nativeSetTouchscreenCalibration) (JNIEnv* env, jobject SDL_ANDROID_TouchscreenCalibrationHeight = y2 - y1; } -static int ScreenKbRedefinedByUser = 0; - -JNIEXPORT void JNICALL -JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyLayout) (JNIEnv* env, jobject thiz, jint keynum, jint x1, jint y1, jint x2, jint y2) -{ - SDL_Rect rect = {x1, y1, x2-x1, y2-y1}; - int key = -1; - if( keynum == 0 ) - key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD; - if( keynum == 1 ) - key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT; - if( keynum - 2 >= 0 && keynum - 2 <= SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 ) - key = keynum - 2 + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0; - - if( key >= 0 ) - { - ScreenKbRedefinedByUser = 1; - SDL_ANDROID_SetScreenKeyboardButtonPos(key, &rect); - } -} - -int SDL_ANDROID_GetScreenKeyboardRedefinedByUser() -{ - return ScreenKbRedefinedByUser; -} - JNIEXPORT void JNICALL JAVA_EXPORT_NAME(Settings_nativeInitKeymap) ( JNIEnv* env, jobject thiz ) { diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.h b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.h index b7e813d81..59caac53a 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.h +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.h @@ -123,8 +123,8 @@ typedef SDLKey SDL_scancode; #define SDL_KEY_VAL(X) X enum MOUSE_ACTION { MOUSE_DOWN = 0, MOUSE_UP = 1, MOUSE_MOVE = 2, MOUSE_HOVER = 3 }; - -extern int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId); +enum { TOUCHSCREEN_KEYBOARD_PASS_EVENT_DOWN_TO_SDL = 0x40000000 }; +extern unsigned SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId); extern int SDL_ANDROID_isTouchscreenKeyboardUsed; #ifndef SDL_ANDROID_KEYCODE_0 diff --git a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c index 2efb87bb0..864123689 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c @@ -48,15 +48,15 @@ #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) -enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT-1, BUTTON_ARROWS = MAX_BUTTONS } ; // Max amount of custom buttons +enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, BUTTON_ARROWS = MAX_BUTTONS } ; // Max amount of custom buttons int SDL_ANDROID_isTouchscreenKeyboardUsed = 0; -static int touchscreenKeyboardTheme = 0; -static int touchscreenKeyboardShown = 1; -static int AutoFireButtonsNum = 0; -static int buttonsize = 1; -static int buttonDrawSize = 1; -static int transparency = 128; +static short touchscreenKeyboardTheme = 0; +static short touchscreenKeyboardShown = 1; +static short AutoFireButtonsNum = 0; +static short buttonsize = 1; +static short buttonDrawSize = 1; +static short transparency = 128; static SDL_Rect arrows, arrowsExtended, buttons[MAX_BUTTONS], buttonsAutoFireRect[MAX_BUTTONS_AUTOFIRE]; static SDL_Rect arrowsDraw, buttonsDraw[MAX_BUTTONS]; @@ -71,13 +71,14 @@ SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_5)), }; enum { ARROW_LEFT = 1, ARROW_RIGHT = 2, ARROW_UP = 4, ARROW_DOWN = 8 }; -static int oldArrows = 0; -static int ButtonAutoFire[MAX_BUTTONS_AUTOFIRE]; -static int ButtonAutoFireX[MAX_BUTTONS_AUTOFIRE*2]; -static int ButtonAutoFireRot[MAX_BUTTONS_AUTOFIRE]; -static int ButtonAutoFireDecay[MAX_BUTTONS_AUTOFIRE]; +static short oldArrows = 0; +static short ButtonAutoFire[MAX_BUTTONS_AUTOFIRE]; +static short ButtonAutoFireX[MAX_BUTTONS_AUTOFIRE*2]; +static short ButtonAutoFireRot[MAX_BUTTONS_AUTOFIRE]; +static short ButtonAutoFireDecay[MAX_BUTTONS_AUTOFIRE]; -static int pointerInButtonRect[MAX_BUTTONS + 1]; +static short pointerInButtonRect[MAX_BUTTONS + 1]; +static short buttonsGenerateSdlEvents[MAX_BUTTONS + 1]; typedef struct { @@ -416,22 +417,20 @@ static inline int ArrowKeysPressed(int x, int y) return ret; } -int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId) +unsigned SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId) { int i; - int processed = 0; - + unsigned processed = 0; if( !touchscreenKeyboardShown ) return 0; - if( action == MOUSE_DOWN ) { //__android_log_print(ANDROID_LOG_INFO, "libSDL", "touch %03dx%03d ptr %d action %d", x, y, pointerId, action); if( InsideRect( &arrows, x, y ) ) { - processed = 1; + processed |= 1< SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 || ! key ) + if( buttonId < 0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 || ! key ) return 0; - buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = key; + buttonKeysyms[buttonId] = key; return 1; }; SDLKey SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId) { - if( buttonId < SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 ) + if( buttonId < 0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 ) return SDLK_UNKNOWN; - return buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0]; + return buttonKeysyms[buttonId]; }; int SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons) @@ -1100,3 +1102,37 @@ int SDLCALL SDL_ToggleScreenKeyboard(void *unused) else return SDL_ShowScreenKeyboard(NULL); } + +int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(int buttonId, int generateEvents) +{ + if( buttonId < 0 || buttonId >= SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM ) + return 0; + buttonsGenerateSdlEvents[buttonId] = generateEvents; + return 1; +} + +static int ScreenKbRedefinedByUser = 0; + +JNIEXPORT void JNICALL +JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyLayout) (JNIEnv* env, jobject thiz, jint keynum, jint x1, jint y1, jint x2, jint y2) +{ + SDL_Rect rect = {x1, y1, x2-x1, y2-y1}; + int key = -1; + if( keynum == 0 ) + key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD; + if( keynum == 1 ) + key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT; + if( keynum - 2 >= 0 && keynum - 2 <= SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 ) + key = keynum - 2 + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0; + + if( key >= 0 ) + { + ScreenKbRedefinedByUser = 1; + SDL_ANDROID_SetScreenKeyboardButtonPos(key, &rect); + } +} + +int SDL_ANDROID_GetScreenKeyboardRedefinedByUser() +{ + return ScreenKbRedefinedByUser; +}