Merge branch 'sdl_android' of github.com:pelya/commandergenius

This commit is contained in:
pelya
2019-01-30 21:57:58 +02:00
17 changed files with 82 additions and 31 deletions

View File

@@ -405,7 +405,7 @@ echo "# Available architectures: armeabi-v7a arm64-v8a x86 x86_64" >> AndroidApp
echo MultiABI=\'$MultiABI\' >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Optional shared libraries to compile - removing some of them will save space" >> AndroidAppSettings.cfg
echo "# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed" >> AndroidAppSettings.cfg
echo "# MP3 patents are expired, but libmad license is GPL, not LGPL" >> AndroidAppSettings.cfg
grep 'Available' project/jni/SettingsTemplate.mk >> AndroidAppSettings.cfg
echo CompiledLibraries=\"$CompiledLibraries\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
@@ -1102,8 +1102,6 @@ fi
./copyAssets.sh || exit 1
rm -rf project/jni/android-support
echo "$NDK_TOOLCHAIN_VERSION" | grep 'clang' > /dev/null || \
ln -s "`which ndk-build | sed 's@/ndk-build@@'`/sources/android/support" project/jni/android-support
rm -rf project/res/drawable/banner.png
if [ -e project/jni/application/src/banner.png ]; then

View File

@@ -871,6 +871,8 @@ public class MainActivity extends Activity
screenKeyboard.setTextColor(this.getResources().getColor(android.R.color.background_light));
if( isRunningOnOUYA() && Globals.TvBorders )
screenKeyboard.setPadding(100, 100, 100, 100); // Bad bad HDMI TVs all have cropped borders
else
screenKeyboard.setPadding(20, 20, 20, 20); // Account for rounded screen corners
_screenKeyboard = screenKeyboard;
_videoLayout.addView(_screenKeyboard);
//_screenKeyboard.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.NONE, false));
@@ -1195,6 +1197,7 @@ public class MainActivity extends Activity
File libpath = new File(getFilesDir().getAbsolutePath() + "/../lib/" + libname);
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded lib " + libpath.getAbsolutePath());
}
catch( UnsatisfiedLinkError e )
{
@@ -1205,11 +1208,13 @@ public class MainActivity extends Activity
File libpath = new File(getFilesDir().getAbsolutePath() + "/" + libname);
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded lib " + libpath.getAbsolutePath());
}
catch( UnsatisfiedLinkError ee )
{
Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString());
System.loadLibrary(l);
Log.i("SDL", "libSDL: loaded lib " + l + " from app lib path");
}
}
}

View File

@@ -3,7 +3,10 @@ APP_PROJECT_PATH := $(call my-dir)/..
include jni/Settings.mk
APP_STL := c++_static
APP_CFLAGS := -Oz -DNDEBUG -g # -Oz works best with clang
APP_CFLAGS := -g
ifneq ($(NDK_DEBUG),1)
APP_CFLAGS += -Oz -DNDEBUG # -Oz works best with clang
endif
APP_PIE := true # This feature makes executables incompatible to Android API 15 or lower, but executables without PIE will not run on Android 5.0 and newer
SDL_EXCLUDE_LIBGCC := -Wl,--exclude-libs,libgcc.a
SDL_EXCLUDE_LIBUNWIND := -Wl,--exclude-libs,libunwind.a

View File

@@ -6,7 +6,7 @@ APP_AVAILABLE_STATIC_LIBS := jpeg png freetype fontconfig xerces ogg vorbis flac
boost_regex boost_serialization boost_signals boost_stacktrace_basic boost_stacktrace_noop \
boost_system boost_test_exec_monitor boost_thread boost_timer boost_type_erasure boost_unit_test_framework boost_wave boost_wserialization \
glu icudata icutest icui18n icuio icule iculx icutu icuuc icu-le-hb harfbuzz sdl_savepng android_support \
gl4es nanogl gd
gl4es nanogl gd guichan
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
APP_MODULES := application sdl-1.2 sdl_main sdl_native_helpers jpeg png ogg flac vorbis freetype tremor ogg

View File

@@ -67,7 +67,7 @@ SwVideoMode=y
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=y
SdlVideoResizeKeepAspect=n
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=y
@@ -269,7 +269,7 @@ APP_PLATFORM=
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi-v7a x86 arm64-v8a x86_64
MultiABI='armeabi-v7a arm64-v8a x86 x86_64'
MultiABI='arm64-v8a' # armeabi-v7a x86 x86_64
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed

View File

@@ -715,7 +715,7 @@ int main(int argc, char* argv[])
if(evt.key.keysym.sym == SDLK_2)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input started");
asyncTextInputBuf[0] = 0;
strcpy(asyncTextInputBuf, "async");
SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf));
}
if(evt.key.keysym.sym == SDLK_3)
@@ -768,7 +768,7 @@ int main(int argc, char* argv[])
}
}
}
if( screenKeyboardShown != SDL_IsScreenKeyboardShown(NULL))
if( screenKeyboardShown != SDL_IsScreenKeyboardShown(NULL) )
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Screen keyboard shown: %d -> %d", screenKeyboardShown, SDL_IsScreenKeyboardShown(NULL));
screenKeyboardShown = SDL_IsScreenKeyboardShown(NULL);

View File

@@ -7,10 +7,10 @@ AppName="OpenLieroX"
AppFullName=openlierox.net
# Application version code (integer)
AppVersionCode=10580525
AppVersionCode=10580526
# Application user-visible version name (string)
AppVersionName="0.58rc5a25"
AppVersionName="0.58rc5a26"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -269,7 +269,7 @@ MultiABI='armeabi-v7a arm64-v8a x86 x86_64' # arm64-v8a x86 x86_64
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
CompiledLibraries="sdl_image sdl_mixer xml2 curl gd jpeg vorbis ogg lzma mad"
CompiledLibraries="sdl_image sdl_mixer xml2 curl ssl crypto gd jpeg vorbis ogg lzma mad"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n

View File

@@ -11,9 +11,9 @@ index 9e6150a..09ade66 100644
if( Globals.TouchscreenKeyboardTheme == 4 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
if( Globals.TouchscreenKeyboardTheme == 5 )
--- /dev/null 2018-04-10 21:06:44.327303421 +0300
+++ b/project/java/RunFromOtherApp.java 2018-05-17 22:21:46.816651827 +0300
@@ -0,0 +1,108 @@
--- /dev/null 2018-12-13 18:37:19.876000065 +0200
+++ Connect.java 2018-12-17 21:16:01.027001714 +0200
@@ -0,0 +1,115 @@
+/*
+Simple DirectMedia Layer
+Java source code (C) 2009-2014 Sergii Pylypenko
@@ -105,7 +105,7 @@ index 9e6150a..09ade66 100644
+import android.content.ComponentName;
+
+
+public class RunFromOtherApp extends Activity
+public class Connect extends Activity
+{
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
@@ -114,9 +114,16 @@ index 9e6150a..09ade66 100644
+
+ Intent main = new Intent(this, MainActivity.class);
+ main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ if( getIntent().getScheme() != null && getIntent().getScheme().equals("openlierox") )
+ if( getIntent().getScheme() != null && getIntent().getScheme().equals("openlierox") && getIntent().getData() != null && getIntent().getData().getHost().equals("connect") )
+ {
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getHost() + ":" + getIntent().getData().getPort());
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getPath().replace("/","").replace("!",":"));
+ }
+ if( getIntent().getScheme() != null && getIntent().getScheme().equals("https") && getIntent().getData() != null && getIntent().getData().getPath().contains("connect") )
+ {
+ if( getIntent().getData().getQueryParameter("a") != null )
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getQueryParameter("a").replace("!",":"));
+ else
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getPath().replace("/connect/","").replace("!",":"));
+ }
+ startActivity(main);
+ finish();

View File

@@ -1,21 +1,26 @@
--- a/project/AndroidManifest.xml 2018-05-17 22:12:08.421817275 +0300
+++ a/project/AndroidManifest.xml 2018-05-17 22:14:05.186301554 +0300
@@ -27,6 +27,19 @@
@@ -27,6 +27,24 @@
<category android:name="tv.ouya.intent.category.GAME" /> <!-- For that one user who still got an OUYA in his living room and won't throw it away just because someone else decides that it's dead -->
</intent-filter>
</activity>
+ <activity android:name=".RunFromOtherApp"
+ <activity android:name=".Connect"
+ android:label="@string/app_name"
+ android:launchMode="standard"
+ android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
+ android:windowSoftInputMode="stateUnspecified">
+ <intent-filter>
+ <action android:name="android.intent.action.RUN" />
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.BROWSABLE"/>
+ <data android:scheme="openlierox"/>
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.BROWSABLE"/>
+ <data android:scheme="https" android:host="liero.1337.cx" android:pathPrefix="/connect/"/>
+ </intent-filter>
+ </activity>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /> <!-- Samsung's multiwindow -->
<activity android:name=".RestartMainActivity"

View File

@@ -264,7 +264,7 @@ APP_PLATFORM=android-21
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
MultiABI='armeabi-v7a' # arm64-v8a x86 x86_64
MultiABI='armeabi-v7a arm64-v8a x86 x86_64' # arm64-v8a x86 x86_64
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed

View File

@@ -20,6 +20,4 @@ LOCAL_SHARED_LIBRARIES += sdl_image sdl_ttf
LOCAL_STATIC_LIBRARIES :=
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(BUILD_STATIC_LIBRARY)

View File

@@ -9,7 +9,7 @@ $(error Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package wit
endif
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -O3 \
LOCAL_CFLAGS := \
-DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) \
-DSDL_CURDIR_PATH=\"$(SDL_CURDIR_PATH)\" \
-DSDL_TRACKBALL_KEYUP_DELAY=$(SDL_TRACKBALL_KEYUP_DELAY) \
@@ -17,6 +17,10 @@ LOCAL_CFLAGS := -O3 \
-DSDL_VIDEO_RENDER_RESIZE=$(SDL_VIDEO_RENDER_RESIZE) \
$(SDL_ADDITIONAL_CFLAGS)
ifneq ($(NDK_DEBUG),1)
LOCAL_CFLAGS += -O3 -DNDEBUG
endif
SDL_SRCS := \
src/*.c \
src/audio/*.c \

View File

@@ -78,7 +78,7 @@ extern void SDL_ANDROID_MainThreadPushMouseMotion(int x, int y)
{
SDL_ANDROID_currentMouseX = x;
SDL_ANDROID_currentMouseY = y;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "MainThreadPushMouseMotion: %4d %4d", x, y);
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "MainThreadPushMouseMotion: %4d %4d", x, y);
SDL_SendMouseMotion( ANDROID_CurrentWindow, 0, x, y );
}

View File

@@ -856,7 +856,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t
return;
#endif
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Motion event: %4d %4d action %d ptr %d, force %d radius %d", x, y, action, pointerId, force, radius);
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Motion event: %4d %4d action %d ptr %d, force %d radius %d", x, y, action, pointerId, force, radius);
pointerId = BumpPointerId( pointerId );

View File

@@ -5,11 +5,15 @@ include $(CLEAR_VARS)
LOCAL_MODULE := sdl_image
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/../jpeg/include $(LOCAL_PATH)/../png/include $(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include $(LOCAL_PATH)/include
LOCAL_CFLAGS := -O3 \
LOCAL_CFLAGS := \
-DLOAD_JPG -DLOAD_PNG -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM \
-DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM \
-DLOAD_XV
ifneq ($(NDK_DEBUG),1)
LOCAL_CFLAGS += -O3 -DNDEBUG
endif
LOCAL_CPP_EXTENSION := .cpp
LOCAL_SRC_FILES := $(notdir $(wildcard $(LOCAL_PATH)/*.c))

View File

@@ -8,7 +8,11 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include $(
$(LOCAL_PATH)/../mad/include $(LOCAL_PATH)/../flac/include $(LOCAL_PATH)/../ogg/include \
$(LOCAL_PATH)/../vorbis/include $(LOCAL_PATH)/../tremor/include $(LOCAL_PATH)/../mikmod/include \
$(LOCAL_PATH)/timidity
LOCAL_CFLAGS := -O3 -DWAV_MUSIC -DOGG_MUSIC -DFLAC_MUSIC -DMOD_MUSIC -DMID_MUSIC -DUSE_TIMIDITY_MIDI
LOCAL_CFLAGS := -DWAV_MUSIC -DOGG_MUSIC -DFLAC_MUSIC -DMOD_MUSIC -DMID_MUSIC -DUSE_TIMIDITY_MIDI
ifneq ($(NDK_DEBUG),1)
LOCAL_CFLAGS += -O3 -DNDEBUG
endif
LOCAL_CPP_EXTENSION := .cpp

View File

@@ -25,6 +25,10 @@ TODO, which will get actually done
- SDL: support for mounting OBB files as directories: https://developer.android.com/google/play/expansion-files.html
- SDL: SdlVideoResizeKeepAspect=y mouse location shifted near right border.
- SDL: Text input window still blocks touches sometimes after text input is finished.
- Debian: proot crashes on Shield TV arm64 box.
- Debian: add hardlink simulation to proot, for Android 6.
@@ -44,3 +48,22 @@ TODO, which will get actually done
- XSDL: proper window resizing, with xrandr resizing XSDL screen buffer.
- XSDL: use better approach than launching xsel to type Unicode symbols.
- XSDL: apostrophe and minus on hardware keyboard with Italian layout are swapped, and slash (key 7) dos not work, seems to be incorrect keycode processing in SDL.
- XSDL: do not use xsel to enter Unicode characters, modify clipboard directly.
- XSDL: add SO_REUSEPORT flag.
- XSDL: fix xrandr screen resizing.
- XSDL: use pixel size instead of screen size.
- XSDL: native PulseAudio support using OpenSLES.
- OpenLieroX: limited lives are shown incorrectly in score table when spectating.
- SuperTux: update to new upstream version.
- SuperTux: right click does not work in editor.