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

This commit is contained in:
pelya
2014-11-05 22:45:48 +02:00
59 changed files with 882 additions and 311 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ project/res/drawable/app_icon.png
project/proguard-project.txt
project/proguard-local.cfg
project/themes/converter
project/jni/android-support

View File

@@ -54,6 +54,9 @@ fi
android update project -p project || exit 1
rm -f project/src/Globals.java
}
[ -z "$GCCVER" ] && GCCVER=4.6
# Set here your own NDK path if needed
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
NDKBUILDPATH=$PATH
@@ -98,7 +101,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
rm obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so libs/armeabi/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
|| true ; } && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "y\\|all\\|armeabi-v7a" > /dev/null && \
@@ -106,7 +109,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
rm obj/local/armeabi-v7a/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
|| true ; } && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "armeabi-v7a-hard" > /dev/null && \
@@ -114,7 +117,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
rm obj/local/armeabi-v7a-hard/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a-hard.so obj/local/armeabi-v7a-hard/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a-hard.so libs/armeabi-v7a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${GCCVER}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
|| true ; } && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips" > /dev/null && \
@@ -122,7 +125,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
rm obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so libs/mips/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-4.6/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-${GCCVER}/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so \
|| true ; } && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86" > /dev/null && \
@@ -130,7 +133,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
rm obj/local/x86/libapplication.so && \
cp jni/application/src/libapplication-x86.so obj/local/x86/libapplication.so && \
cp jni/application/src/libapplication-x86.so libs/x86/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-4.6/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-${GCCVER}/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so \
|| true ; } && \
cd .. && ./copyAssets.sh && cd project && \
{ if $build_release ; then \

View File

@@ -854,6 +854,10 @@ cd ../../..
if [ "$GooglePlayGameServicesId" = "n" -o -z "$GooglePlayGameServicesId" ] ; then
$SEDI "/==GOOGLEPLAYGAMESERVICES==/ d" project/AndroidManifest.xml
GooglePlayGameServicesId=""
grep 'google-play-services' project/local.properties > /dev/null && {
$SEDI 's/.*google-play-services.*//g' project/local.properties
rm -f project/libs/android-support-v4.jar
}
else
for F in $JAVA_SRC_PATH/googleplaygameservices/*.java; do
OUT=`echo $F | sed 's@.*/@@'` # basename tool is not available everywhere
@@ -863,7 +867,7 @@ else
done
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
SDK_DIR=`grep '^sdk.dir' project/local.properties | sed 's/.*=//'`
grep 'android.library.reference.1' project/local.properties > /dev/null || {
grep 'google-play-services' project/local.properties > /dev/null || {
# Ant is way too smart, and adds current project path in front of the ${sdk.dir}
echo 'android.library.reference.1=../../../../../../../../../../../../../../${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib' >> project/local.properties
echo 'proguard.config=proguard.cfg;proguard-local.cfg' >> project/local.properties
@@ -908,6 +912,9 @@ fi
./copyAssets.sh || exit 1
rm -rf project/jni/android-support
ln -s "`which ndk-build | sed 's@/ndk-build@@'`/sources/android/support" project/jni/android-support
if uname -s | grep -i "darwin" > /dev/null ; then
find project/src -name "*.killme.tmp" -delete
fi

View File

@@ -31,7 +31,7 @@
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
</application>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<!-- ==INTERNET== --> <uses-permission android:name="android.permission.INTERNET"></uses-permission>
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>

View File

@@ -4,7 +4,7 @@
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
@@ -28,6 +28,15 @@
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
@@ -41,25 +50,23 @@
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.

View File

@@ -80,7 +80,6 @@ class Globals
public static boolean HorizontalOrientation = true;
public static boolean ImmersiveMode = true;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasTrackball = false;
public static boolean PhoneHasArrowKeys = false;
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
@@ -92,7 +91,6 @@ class Globals
public static boolean FloatingScreenJoystick = false;
public static int AccelerometerSensitivity = 2;
public static int AccelerometerCenterPos = 2;
public static int TrackballDampening = 0;
public static int AudioBufferConfig = 0;
public static boolean OptionalDataDownload[] = null;
public static int LeftClickMethod = ForceRelativeMouseMode ? Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT : Mouse.LEFT_CLICK_NORMAL;

View File

@@ -264,7 +264,16 @@ class SDL_1_2_Keycodes
public static final int SDLK_EURO = 321;
public static final int SDLK_UNDO = 322;
public static final int SDLK_NO_REMAP = 512;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
// Autogenerated by hand with a command:
@@ -511,7 +520,16 @@ class SDL_1_3_Keycodes
public static final int SDLK_EJECT = 281;
public static final int SDLK_SLEEP = 282;
public static final int SDLK_NO_REMAP = 512;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
class SDL_Keys

View File

@@ -92,13 +92,13 @@ class Settings
out.writeInt(SETTINGS_FILE_VERSION);
out.writeBoolean(Globals.DownloadToSdcard);
out.writeBoolean(Globals.PhoneHasArrowKeys);
out.writeBoolean(Globals.PhoneHasTrackball);
out.writeBoolean(false);
out.writeBoolean(Globals.UseAccelerometerAsArrowKeys);
out.writeBoolean(Globals.UseTouchscreenKeyboard);
out.writeInt(Globals.TouchscreenKeyboardSize);
out.writeInt(Globals.AccelerometerSensitivity);
out.writeInt(Globals.AccelerometerCenterPos);
out.writeInt(Globals.TrackballDampening);
out.writeInt(0);
out.writeInt(Globals.AudioBufferConfig);
out.writeInt(Globals.TouchscreenKeyboardTheme);
out.writeInt(Globals.RightClickMethod);
@@ -274,13 +274,13 @@ class Settings
throw new IOException();
Globals.DownloadToSdcard = settingsFile.readBoolean();
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
Globals.PhoneHasTrackball = settingsFile.readBoolean();
settingsFile.readBoolean();
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
Globals.AccelerometerSensitivity = settingsFile.readInt();
Globals.AccelerometerCenterPos = settingsFile.readInt();
Globals.TrackballDampening = settingsFile.readInt();
settingsFile.readInt();
Globals.AudioBufferConfig = settingsFile.readInt();
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
Globals.RightClickMethod = settingsFile.readInt();
@@ -546,8 +546,6 @@ class Settings
nativeSetVideoForceSoftwareMode();
if( Globals.SwVideoMode && Globals.MultiThreadedVideo )
nativeSetVideoMultithreaded();
if( Globals.PhoneHasTrackball )
nativeSetTrackballUsed();
applyMouseEmulationOptions();
nativeSetJoystickUsed( Globals.AppUsesThirdJoystick ? 3 : (Globals.AppUsesSecondJoystick ? 2 : (Globals.AppUsesJoystick ? 1 : 0)) );
if( Globals.AppUsesAccelerometer )
@@ -555,7 +553,6 @@ class Settings
if( Globals.AppUsesMultitouch )
nativeSetMultitouchUsed();
nativeSetAccelerometerSettings(Globals.AccelerometerSensitivity, Globals.AccelerometerCenterPos);
nativeSetTrackballDampening(Globals.TrackballDampening);
if( Globals.UseTouchscreenKeyboard )
{
boolean screenKbReallyUsed = false;
@@ -612,6 +609,7 @@ class Settings
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "DATADIR", Globals.DataDir );
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
SdcardAppPath.setEnv(p);
nativeSetEnv( "HOME", Globals.DataDir );
nativeSetEnv( "SDCARD", Environment.getExternalStorageDirectory().getAbsolutePath() );
nativeSetEnv( "ANDROID_VERSION", String.valueOf(android.os.Build.VERSION.SDK_INT) );
@@ -705,6 +703,14 @@ class Settings
return Dummy.Holder.sInstance;
}
public abstract String path(final Context p);
private void setEnvInternal(final Context p)
{
nativeSetEnv( "UNSECURE_STORAGE_DIR_0", Globals.DataDir );
}
public static void setEnv(final Context p)
{
get().setEnvInternal(p);
}
public String bestPath(final Context p)
{
return path(p);
@@ -759,11 +765,25 @@ class Settings
if( size > maxSize )
{
maxSize = size;
ret = path.getPath();
ret = path.getAbsolutePath();
}
}
return ret;
};
public void setEnvInternal(final Context p)
{
File[] paths = p.getExternalFilesDirs(null);
int index = 0;
for( File path: paths )
{
if( path == null )
continue;
if( !path.exists() )
path.mkdirs();
nativeSetEnv( "UNSECURE_STORAGE_DIR_" + index, path.getAbsolutePath() );
index++;
}
}
}
private static class Dummy extends SdcardAppPath
{
@@ -833,8 +853,6 @@ class Settings
return true;
}
private static native void nativeSetTrackballUsed();
private static native void nativeSetTrackballDampening(int value);
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,

View File

@@ -123,8 +123,6 @@ abstract class DifferentTouchInput
Log.i("SDL", "Device board: " + android.os.Build.BOARD);
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
{
if( DetectCrappyDragonRiseDatexGamepad() )
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance;
//return IcsTouchInput.Holder.sInstance;
return AutoDetectTouchInput.Holder.sInstance;
}
@@ -145,12 +143,6 @@ abstract class DifferentTouchInput
}
}
}
private static boolean DetectCrappyDragonRiseDatexGamepad()
{
if( CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance == null )
return false;
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance.detect();
}
private static class SingleTouchInput extends DifferentTouchInput
{
@@ -362,6 +354,7 @@ abstract class DifferentTouchInput
}
private static class IcsTouchInput extends GingerbreadTouchInput
{
float hatX = 0.0f, hatY = 0.0f;
private static class Holder
{
private static final IcsTouchInput sInstance = new IcsTouchInput();
@@ -387,10 +380,34 @@ abstract class DifferentTouchInput
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
{
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, on Nvidia Shield and some other joysticks
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
{
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
if( hatX == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1, 0);
}
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
{
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
if( hatY == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
}
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER) );
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER),
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
return;
}
// Process mousewheel
@@ -430,69 +447,6 @@ abstract class DifferentTouchInput
super.process(event);
}
}
private static class CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad extends IcsTouchInput
{
private static class Holder
{
private static final CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad sInstance = new CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad();
}
float hatX = 0.0f, hatY = 0.0f;
public void processGenericEvent(final MotionEvent event)
{
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
{
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, they also send keyboard events
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_RX), event.getAxisValue(MotionEvent.AXIS_RZ),
0, 0);
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
{
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
if( hatX == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1, 0);
}
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
{
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
if( hatY == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
}
return;
}
super.processGenericEvent(event);
}
public boolean detect()
{
int[] devIds = InputDevice.getDeviceIds();
for( int id : devIds )
{
InputDevice device = InputDevice.getDevice(id);
if( device == null )
continue;
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() );
if( (device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD &&
(device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
device.getName().indexOf("DragonRise Inc") == 0 )
{
System.out.println("libSDL: Detected crappy DragonRise gamepad, enabling special hack for it. Please press button labeled 'Analog', otherwise it won't work, because it's cheap and crappy");
return true;
}
}
return false;
}
}
private static class CrappyMtkTabletWithBrokenTouchDrivers extends IcsTouchInput
{
private static class Holder
@@ -1082,7 +1036,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
public static native void nativeHardwareMouseDetected( int detected );
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
public static native void nativeMouseWheel( int scrollX, int scrollY );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger, int usingHat );
}

View File

@@ -3,7 +3,7 @@
APP_MODULES := application sdl-1.2 sdl_main sdl_native_helpers jpeg png ogg flac vorbis freetype tremor ogg
# To filter out static libs from all libs in makefile
APP_AVAILABLE_STATIC_LIBS := jpeg png tremor freetype xerces ogg tremor vorbis flac boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread boost_locale glu icudata icutest icui18n icuio icule iculx icutu icuuc sdl_savepng
APP_AVAILABLE_STATIC_LIBS := jpeg png tremor freetype xerces ogg tremor vorbis flac boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread boost_locale glu icudata icutest icui18n icuio icule iculx icutu icuuc sdl_savepng android_support
APP_ABI := armeabi

View File

@@ -124,7 +124,7 @@ AppNeedsArrowKeys=y
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
FloatingScreenJoystick=y
FloatingScreenJoystick=n
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=y
@@ -221,7 +221,7 @@ AppMinimumRAM=0
# 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"
CompiledLibraries="sdl_image android_support"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n

View File

@@ -13,6 +13,7 @@
#include <string.h>
#include <math.h>
#include <android/log.h>
#include <wchar.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
@@ -444,6 +445,7 @@ int main(int argc, char* argv[])
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_Joystick * joysticks[6];
for( i = 0; i < 6; i++ )
joysticks[i] = SDL_JoystickOpen(i);
@@ -554,6 +556,19 @@ int main(int argc, char* argv[])
memset(gamepads, 0, sizeof(gamepads));
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t));
wchar_t ss[256];
const wchar_t *ss2 = L"String 2 ЕНГ ---";
swprintf(ss, 256, L"String ЙЦУК --- %ls", ss2);
char ss3[512] = "";
char ss4[512] = "";
for(i = 0; i < wcslen(ss); i++)
{
char tmp[16];
sprintf(tmp, "%04X ", (int)ss[i]);
strcat(ss3, tmp);
sprintf(ss4, "%ls", ss);
}
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "swprintf: len %d data %s: %s", wcslen(ss), ss3, ss4);
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "On-screen buttons:");
for(i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
@@ -732,6 +747,14 @@ int main(int argc, char* argv[])
x_speed = 500.0 * sin(t * 0.37);
y_speed = 500.0 * sin(t * 0.53);
z_speed = 400.0 * sin(t * 0.21);
if( SDL_GetKeyState(NULL)[SDLK_LEFT] )
x_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] )
x_speed += 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_UP] )
y_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_DOWN] )
y_speed += 100000 * dt;
ballfield_move(balls, x_speed, y_speed, z_speed);
x_offs -= x_speed;

View File

@@ -7,10 +7,10 @@ AppName="Commander Genius"
AppFullName=net.sourceforge.clonekeenplus
# Application version code (integer)
AppVersionCode=174000
AppVersionCode=180010
# Application user-visible version name (string)
AppVersionName="1.7.4.0 Release"
AppVersionName="1.8.0.0 Release"
# 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
@@ -215,7 +215,7 @@ CompiledLibraries="ogg sdl_image boost_system"
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-frtti -fexceptions -finline-functions -O2 -DOGG=1 -DANDROID=1 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11 -Ijni/../jni/application/commandergenius/commandergenius/lib/GsKit -Ijni/vorbis/include/vorbis'
AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DANDROID=1 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11 -Ijni/../jni/application/commandergenius/commandergenius/lib/GsKit -Ijni/vorbis/include/vorbis'
# Additional LDFLAGS for application
#AppLdflags='-ltremor'
@@ -228,7 +228,7 @@ AppOverlapsSystemHeaders=
AppSubdirsBuild='commandergenius/src/* commandergenius/lib/*'
# Exclude these files from build
AppBuildExclude=''
AppBuildExclude='commandergenius/src/engine/dbfusion'
# Application command line parameters, including app name as 0-th param
AppCmdline=''

View File

@@ -0,0 +1,262 @@
# The application settings for Android libSDL port
# Specify application name (e.x. My Application)
AppName="JaggedAlliance2"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=com.opensourced.ja2
# Application version code (integer)
AppVersionCode=01235204
# Application user-visible version name (string)
AppVersionName="0.12.352.04"
# 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
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!JaggedAllianceData|ja2.zip"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade=""
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText=''
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=16
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=y
# Application video output will be resized to fit into native device screen (y)/(n)
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
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
# Create Android service, so the app is less likely to be killed while in background
CreateService=
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
CompatibilityHacksForceScreenUpdate=n
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
# force screen update by moving mouse cursor a little after each click (y) or (n)
CompatibilityHacksForceScreenUpdateMouseClick=y
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=n
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=n
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
CompatibilityHacksAppIgnoresAudioBufferSize=n
# Hack for VCMI: preload additional shared libraries before aplication start
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -
# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)
CompatibilityHacksSlowCompatibleEventQueue=n
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=n
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
AppUsesMouse=y
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
AppNeedsTwoButtonMouse=y
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
# If you disable it, swiping with two fingers will send mouse wheel events
RightMouseButtonLongPress=y
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=n
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
ForceRelativeMouseMode=n
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
AppNeedsArrowKeys=n
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
FloatingScreenJoystick=
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=y
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
AppUsesThirdJoystick=
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=n
# Application records audio (it will use any available source, such a s microphone)
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
AccessSdCard=y
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=n
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=y
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
# This option is reported to be buggy, sometimes failing to restore video state
NonBlockingSwapBuffers=n
# Redefine common hardware keys to SDL keysyms
# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent
# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices
# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)
# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA
RedefinedKeys="MOUSE_RIGHT"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=1
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="LCTRL RETURN KP_PLUS KP_MINUS LCTRL"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames=""
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick)
# 1 = Simple Theme by Beholder (white, with gamepad joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
TouchscreenKeysTheme=2
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions=''
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
MultiABI='armeabi-v7a'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# 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="jpeg png boost_filesystem boost_system android_support"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=y
# Aditional CFLAGS for application
AppCflags=''
# Additional LDFLAGS for application
AppLdflags=''
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild=''
# Exclude these files from build
AppBuildExclude=''
# Application command line parameters, including app name as 0-th param
AppCmdline='ja2 -resversion ENGLISH'
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
MinimumScreenSize=
# Your AdMob Publisher ID, (n) if you don't want advertisements
AdmobPublisherId=
# Your AdMob test device ID, to receive a test ad
AdmobTestDeviceId=
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=

View File

@@ -0,0 +1,8 @@
#!/bin/sh
[ -e src-$1 ] || {
git clone --depth 1 https://bitbucket.org/gennady/ja2-stracciatella.git src-$1 || exit 1
patch -p1 -d src-$1 < ja2.patch || exit 1
} || exit 1
../setEnvironment-$1.sh sh -c "make -j4 -C src-$1 WITH_LPTHREAD=0 Q=" && cp -f src-$1/ja2 libapplication-$1.so

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,349 @@
diff --git a/Makefile b/Makefile
index a21c6b5..d6a8e9d 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ endif
endif
CFLAGS += $(CFLAGS_SDL)
-LDFLAGS += $(LDFLAGS_SDL)
+LDFLAGS += $(LDFLAGS_SDL) -lboost_filesystem -lboost_system
############################################################
# MinGW settings for building on Windows and for
@@ -98,7 +98,8 @@ CFLAGS += -I Build/Utils
CFLAGS += -I sgp
CFLAGS += -I src
CFLAGS += -I _build/lib-MicroIni/include
-CFLAGS += -I _build/lib-boost
+#CFLAGS += -I _build/lib-boost
+CFLAGS += -I ../../../boost/include
CFLAGS += -I _build/lib-rapidjson
CFLAGS += -I _build/lib-slog
CFLAGS += -I _build/lib-smacker/libsmacker
@@ -154,7 +155,7 @@ CCFLAGS += -Wmissing-prototypes
CXXFLAGS += $(CFLAGS)
-LDFLAGS += -lm
+LDFLAGS += -lm -landroid_support
ifeq "$(WITH_LPTHREAD)" "1"
LDFLAGS += -lpthread
@@ -522,15 +523,15 @@ SRCS += _build/lib-MicroIni/src/MicroIni/Line.cpp
SRCS += _build/lib-MicroIni/src/MicroIni/Section.cpp
SRCS += _build/lib-MicroIni/src/MicroIni/Value.cpp
-SRCS += _build/lib-boost/libs/system/src/error_code.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/codecvt_error_category.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/operations.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/path.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/path_traits.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/portability.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/unique_path.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/utf8_codecvt_facet.cpp
-SRCS += _build/lib-boost/libs/filesystem/src/windows_file_codecvt.cpp
+#SRCS += _build/lib-boost/libs/system/src/error_code.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/codecvt_error_category.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/operations.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/path.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/path_traits.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/portability.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/unique_path.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/utf8_codecvt_facet.cpp
+#SRCS += _build/lib-boost/libs/filesystem/src/windows_file_codecvt.cpp
SRCS += _build/lib-slog/slog/slog.c
diff --git a/_build/lib-slog/slog/slog.c b/_build/lib-slog/slog/slog.c
index 87ceb53..3799dbc 100644
--- a/_build/lib-slog/slog/slog.c
+++ b/_build/lib-slog/slog/slog.c
@@ -30,6 +30,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
+#include <android/log.h>
#if defined(_MSC_VER)
/* Visual Studio */
@@ -152,6 +153,8 @@ void SLOG_LogMessage(SLOGLevel level, const char *tag, const char *format, ...)
buf[size] = 0;
+ __android_log_print(ANDROID_LOG_INFO, "JA2", "%s", buf);
+
if(logToConsole)
{
write(s_consoleFD, buf, size);
diff --git a/ja2config.h b/ja2config.h
index cb3f1f9..d2659ec 100644
--- a/ja2config.h
+++ b/ja2config.h
@@ -1,3 +1,3 @@
/* location of externalized data, mods, unittests files, etc */
/* when empty - the same directory as ja2 binary */
-#define EXTRA_DATA_DIR ""
+#define EXTRA_DATA_DIR "."
diff --git a/sgp/Debug.cc b/sgp/Debug.cc
index 3ce95c3..c9c00f1 100644
--- a/sgp/Debug.cc
+++ b/sgp/Debug.cc
@@ -1,4 +1,5 @@
#include "Debug.h"
+#include "Logger.h"
#if defined ( SGP_DEBUG ) || defined ( FORCE_ASSERTS_ON )
@@ -38,8 +39,9 @@ BOOLEAN InitializeDebugManager(void)
void DebugMsg(TopicID uiTopicId, DebugLevel uiDebugLevel, const char* strMessage)
{
- fprintf(stderr, "%s\n", strMessage);
+ printf("%s\n", strMessage);
+/*
//add _NO_DEBUG_TXT to your SGP preprocessor definitions to avoid this f**king huge file from
//slowly growing behind the scenes!!!!
#ifndef _NO_DEBUG_TXT
@@ -50,6 +52,7 @@ void DebugMsg(TopicID uiTopicId, DebugLevel uiDebugLevel, const char* strMessage
fclose(OutFile);
}
#endif
+*/
}
@@ -67,9 +70,8 @@ static void _DebugRecordToDebugger(BOOLEAN gfState)
void _DebugMessage(const char* pString, UINT32 uiLineNum, const char* pSourceFile)
{
- char ubOutputString[512];
- sprintf(ubOutputString, "{ %ld } %s [Line %d in %s]\n", GetClock(), pString, uiLineNum, pSourceFile);
-
+ printf("{ %ld } %s [Line %d in %s]\n", GetClock(), pString, uiLineNum, pSourceFile);
+/*
if (gfRecordToDebugger)
{
fputs(ubOutputString, stderr);
@@ -86,17 +88,17 @@ void _DebugMessage(const char* pString, UINT32 uiLineNum, const char* pSourceFil
}
}
#endif
+*/
}
void _FailMessage(const char *pString, UINT32 uiLineNum, const char *pSourceFile)
{
- char ubOutputString[512];
if (pString != NULL)
- sprintf(ubOutputString, "{ %ld } Assertion Failure [Line %d in %s]: %s\n", GetClock(), uiLineNum, pSourceFile, pString);
+ printf("{ %ld } Assertion Failure [Line %d in %s]: %s\n", GetClock(), uiLineNum, pSourceFile, pString);
else
- sprintf(ubOutputString, "{ %ld } Assertion Failure [Line %d in %s]\n", GetClock(), uiLineNum, pSourceFile);
-
+ printf("{ %ld } Assertion Failure [Line %d in %s]\n", GetClock(), uiLineNum, pSourceFile);
+/*
//Output to debugger
if (gfRecordToDebugger)
fputs(ubOutputString, stderr);
@@ -113,7 +115,7 @@ void _FailMessage(const char *pString, UINT32 uiLineNum, const char *pSourceFile
}
}
#endif
-
+*/
SDL_Quit();
abort();
}
diff --git a/sgp/Debug.h b/sgp/Debug.h
index 05717f9..6285a33 100644
--- a/sgp/Debug.h
+++ b/sgp/Debug.h
@@ -9,6 +9,7 @@
#define DEBUG_PRINT_GAME_CYCLE_TIME (0) /**< Flag telling to print how much time every game cycle takes. */
+#define SGP_DEBUG 1
#if defined ( SGP_DEBUG ) || defined ( FORCE_ASSERTS_ON )
// If DEBUG_ is defined, we need to initialize all the debug macros. Otherwise all the
diff --git a/sgp/FileMan.cc b/sgp/FileMan.cc
index 38d8b36..a5de49f 100644
--- a/sgp/FileMan.cc
+++ b/sgp/FileMan.cc
@@ -104,6 +104,7 @@ std::string FileMan::findConfigFolderAndSwitchIntoIt()
}
#else
const char* home = getenv("HOME");
+ return home; // Do not create extra dirs on Android
if (home == NULL)
{
const struct passwd* const passwd = getpwuid(getuid());
@@ -152,6 +153,7 @@ std::string FileMan::findConfigFolderAndSwitchIntoIt()
int FileMan::openFileCaseInsensitive(const std::string &folderPath, const char *filename, int mode)
{
std::string path = FileMan::joinPaths(folderPath, filename);
+ SLOGD(TAG, "%s: open file %s\n", __func__, path.c_str());
int d = open(path.c_str(), mode);
if (d < 0)
{
diff --git a/sgp/FileMan.h b/sgp/FileMan.h
index a7f96cb..6d7a64f 100644
--- a/sgp/FileMan.h
+++ b/sgp/FileMan.h
@@ -11,7 +11,7 @@
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#else
-# include <glob.h>
+//# include <glob.h>
#endif
/* Delete the file at path. Returns true iff deleting the file succeeded or
diff --git a/sgp/LibraryDataBase.cc b/sgp/LibraryDataBase.cc
index 2205166..039a202 100644
--- a/sgp/LibraryDataBase.cc
+++ b/sgp/LibraryDataBase.cc
@@ -1,5 +1,8 @@
#include <cstdlib>
#include <stdexcept>
+#ifdef WITH_UNITTESTS
+#include "gtest/gtest.h"
+#endif
#include "Types.h"
#include "FileMan.h"
diff --git a/sgp/Logger.h b/sgp/Logger.h
index 771e515..d7995d3 100644
--- a/sgp/Logger.h
+++ b/sgp/Logger.h
@@ -6,6 +6,7 @@
* General logging
***********************************************************/
+#include "../../../android_debug.h"
/** Available log levels. */
enum
{
@@ -16,7 +17,7 @@ enum
};
/** Current log level. */
-#define LOG_LEVEL (LOGLEVEL_INFO)
+#define LOG_LEVEL (LOGLEVEL_DEBUG)
#if LOG_LEVEL >= LOGLEVEL_ERROR
#define LOG_ERROR printf
diff --git a/sgp/Platform.h b/sgp/Platform.h
index 263f9b1..57d377c 100644
--- a/sgp/Platform.h
+++ b/sgp/Platform.h
@@ -12,7 +12,7 @@
#define PATH_SEPARATOR '\\'
#define PATH_SEPARATOR_STR "\\"
#else
-#define CASE_SENSITIVE_FS 1
+#define CASE_SENSITIVE_FS 0 // SD card on Android is case-insensitive
#define PATH_SEPARATOR '/'
#define PATH_SEPARATOR_STR "/"
#endif
diff --git a/sgp/PlatformSDL.h b/sgp/PlatformSDL.h
index 7d69ce0..246d80c 100644
--- a/sgp/PlatformSDL.h
+++ b/sgp/PlatformSDL.h
@@ -15,7 +15,7 @@
* http://developer.apple.com/library/mac/#technotes/tn2133/_index.html
*
*/
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__ANDROID__)
#define EXPENSIVE_SDL_UPDATE_RECT (1)
#else
#define EXPENSIVE_SDL_UPDATE_RECT (0)
diff --git a/sgp/SGP.cc b/sgp/SGP.cc
index d156d73..e34ecd8 100644
--- a/sgp/SGP.cc
+++ b/sgp/SGP.cc
@@ -13,6 +13,9 @@
#include <exception>
#include <new>
+#ifdef WITH_UNITTESTS
+#include "gtest/gtest.h"
+#endif
#include "Button_System.h"
#include "Debug.h"
@@ -32,6 +35,9 @@
#include "Video.h"
#include "VSurface.h"
#include <SDL.h>
+#ifdef __ANDROID__
+#include <SDL_screenkeyboard.h>
+#endif
#include "UILayout.h"
#include "GameRes.h"
#include "Logger.h"
@@ -49,9 +55,6 @@
#include "slog/slog.h"
#define TAG "SGP"
-#ifdef WITH_UNITTESTS
-#include "gtest/gtest.h"
-#endif
#if defined _WIN32
# define WIN32_LEAN_AND_MEAN
@@ -273,6 +276,7 @@ static void MainLoop(int msPerGameCycle)
static int Failure(char const* const msg, bool showInfoIcon=false)
{
+ __android_log_print(ANDROID_LOG_FATAL, "JA2", "%s", msg);
fprintf(stderr, "%s\n", msg);
#if defined _WIN32
MessageBox(0, msg, APPLICATION_NAME, MB_OK | (showInfoIcon ? MB_ICONINFORMATION : MB_ICONERROR) | MB_TASKMODAL);
@@ -318,7 +322,7 @@ static BOOLEAN ParseParameters(int argc, char* const argv[],
int main(int argc, char* argv[])
try
{
- std::string exeFolder = FileMan::getParentPath(argv[0], true);
+ //std::string exeFolder = FileMan::getParentPath(argv[0], true);
#if defined BROKEN_SWPRINTF
if (setlocale(LC_CTYPE, "UTF-8") == NULL)
@@ -365,6 +369,15 @@ try
SDL_Init(SDL_INIT_VIDEO);
SDL_EnableUNICODE(SDL_ENABLE);
+#ifdef __ANDROID__
+ SDL_Rect r = { 64 * SDL_ListModes(NULL, 0)[0]->w / 1280,
+ 492 * SDL_ListModes(NULL, 0)[0]->h / 800,
+ (199 - 64) * SDL_ListModes(NULL, 0)[0]->w / 1280,
+ (627 - 492) * SDL_ListModes(NULL, 0)[0]->h / 800};
+ if (!SDL_ANDROID_GetScreenKeyboardRedefinedByUser())
+ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &r);
+#endif
+
#ifdef __APPLE__
// Enable 3-button mouse support if the user haven't instructed
// otherwise
@@ -398,7 +411,7 @@ try
if(extraDataDir.empty())
{
// use location of the exe file
- extraDataDir = exeFolder;
+ //extraDataDir = exeFolder;
}
std::string externalizedDataPath = FileMan::joinPaths(extraDataDir, "externalized");
@@ -775,7 +788,7 @@ static void WriteDefaultConfigFile(const char* ConfigFile)
#ifdef _WIN32
fprintf(IniFile, "data_dir = C:\\Program Files\\Jagged Alliance 2");
#else
- fprintf(IniFile, "data_dir = /some/place/where/the/data/is");
+ fprintf(IniFile, "data_dir = .");
#endif
fclose(IniFile);
fprintf(stderr, "Please edit \"%s\" to point to the binary data.\n", ConfigFile);

View File

@@ -7,10 +7,10 @@ AppName="OpenTTD"
AppFullName=org.openttd.sdl
# Application version code (integer)
AppVersionCode=14234
AppVersionCode=14434
# Application user-visible version name (string)
AppVersionName="1.4.2.34"
AppVersionName="1.4.4.34"
# 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
@@ -18,7 +18,7 @@ AppVersionName="1.4.2.34"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.4.2-1.zip.xz|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.2-1.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz"
AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.4.4.zip.xz|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.4.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n

View File

@@ -1,6 +1,6 @@
#!/bin/sh
VER=1.4.2-1
VER=1.4.4
cd data
rm -f ../AndroidData/openttd-data-*.zip.xz ../AndroidData/openttd-data-*.zip

View File

@@ -22,7 +22,7 @@ grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=arm-linux-androideabi
GCCVER=4.6
[ -z "$GCCVER" ] && GCCVER=4.6
PLATFORMVER=android-14
LOCAL_PATH=`dirname $0`
if which realpath > /dev/null ; then

View File

@@ -71,8 +71,8 @@ endif
all:
@echo "ROOTDIR=$(ROOTDIR)" > Makefile.global
@echo "XOBJ=$(XOBJ)" >> Makefile.global
@echo "CFLAGS=-g -ansi -pedantic -Wall -W -O2 -I $(ROOTDIR)/include $(shell sdl-config --cflags)" >> Makefile.global
@echo "XOBJ=$(XOBJ)" >> Makefile.global
@echo "CFLAGS=-g -ansi -pedantic -Wall -W -O0 -I $(ROOTDIR)/include $(shell sdl-config --cflags) -g" >> Makefile.global
@echo "LDFLAGS=-lz $(shell sdl-config --libs) -g" >> Makefile.global
@echo "CC=gcc" >> Makefile.global
@echo "CPP=gcc -E" >> Makefile.global

View File

@@ -568,7 +568,7 @@ e_them_t3_action2(U8 e)
U8 i;
S16 x, y;
while (1) {
/*while (1)*/ {
/* calc new sprite */
i = ent_sprseq[ent_ents[e].sprbase + ent_ents[e].sproffs];

View File

@@ -158,7 +158,7 @@ sysarg_init(int argc, char **argv)
else if (!strcmp(argv[i], "-speed")) {
if (++i == argc) sysarg_fail("missing speed value");
sysarg_args_period = atoi(argv[i]) - 1;
if (sysarg_args_period < 0 || sysarg_args_period > 99)
if (sysarg_args_period < 0 || sysarg_args_period > 250)
sysarg_fail("invalid speed value");
}

View File

@@ -7,10 +7,10 @@ AppName="Debian"
AppFullName=com.cuntubuntu
# Application version code (integer)
AppVersionCode=140704
AppVersionCode=141008
# Application user-visible version name (string)
AppVersionName="14.07.04"
AppVersionName="14.10.08"
# 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
@@ -18,10 +18,10 @@ AppVersionName="14.07.04"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-debug-wheezy-proot-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh^!!Update|:update1.tar.gz:update1.tgz^!!Update|:update2.tar.gz:update2-<ARCH>.tgz"
AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-debug-wheezy-proot-<ARCH>.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh^!!Update|:update1.tar.gz:update1.tgz^!!Update|:update2.tar.gz:update2-<ARCH>.tgz^!!Update|:update3.tar.gz:update3.tgz^!!Update|:update4.tar.gz:update4.tgz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"

View File

@@ -242,6 +242,12 @@ static void * unpackFilesThread(void * unused)
{ "update1.tar.gz", "update1.sh", "" },
{ "update2.tar.gz", "update2.sh", "" },
{ "update3.tar.gz", "update3.sh", "" },
{ "update4.tar.gz", "update4.sh", "" },
{ "update5.tar.gz", "update5.sh", "" },
{ "update6.tar.gz", "update6.sh", "" },
{ "update7.tar.gz", "update7.sh", "" },
{ "update8.tar.gz", "update8.sh", "" },
{ "update9.tar.gz", "update9.sh", "" },
{NULL, NULL, NULL}
};
int i;

View File

@@ -31,7 +31,7 @@
// GNU libc offers the helpful header <endian.h> which defines
// __BYTE_ORDER
#if defined (__GLIBC__) || defined(ANDROID)
#if defined (__GLIBC__) || defined(ANDROID) || defined(__ANDROID__)
# include <endian.h>
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
# define BOOST_LITTLE_ENDIAN

View File

@@ -54,7 +54,7 @@
#endif
//Check for XSI shared memory objects. They are available in nearly all UNIX platforms
#if !defined(__QNXNTO__) /*&& !defined(ANDROID)*/
#if !defined(__QNXNTO__) && !defined(ANDROID) && !defined(__ANDROID__)
#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
#endif

View File

@@ -16,10 +16,6 @@
#include <cstdlib> // For std::size_t
#include <new> // For placement new
#ifdef ANDROID
#include <android/log.h>
#endif
// On MSVC, disable "conditional expression is constant" warning (level 4).
// This warning is almost impossible to avoid with certain types of templated code
#ifdef _MSC_VER
@@ -603,8 +599,11 @@ namespace boost { namespace property_tree { namespace detail {namespace rapidxml
// Setup new pool in allocated memory
char *pool = align(raw_memory);
header *new_header;
memcpy( (void*) (&new_header), (void*) (&pool), sizeof(header*));
//header *new_header = reinterpret_cast<header *>(pool);
header *new_header = (header *)((void*)pool);
new_header->previous_begin = m_begin;
m_begin = raw_memory;
m_ptr = pool + sizeof(header);

View File

@@ -36,12 +36,17 @@ template<class T> struct addressof_impl
{
static inline T * f( T & v, long )
{
T *ptr;
/* return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));*/
ptr = (T*)(&v);
// memcpy(&ptr, &v, sizeof(T*));
return ptr; }
/*T* address;
T* oldAdress = &v;
memcpy( (void*) &address, (void*)(&oldAdress), sizeof(T*));*/
/*return reinterpret_cast<T*>(
&const_cast<char&>( reinterpret_cast<const volatile char &>(v) )
);*/
//return address;
return &v;
}
static inline T * f( T * v, int )
{

View File

@@ -2,7 +2,10 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifeq ($(filter armeabi-v7a-hard, $(APP_ABI)),) # Pre-compiled lib disabled for armhf ABI
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a-hard) # Pre-compiled lib disabled for armhf ABI
ifneq ($(TARGET_ARCH_ABI),arm64-v8a) # Not supported yet
ifneq ($(TARGET_ARCH_ABI),x86_64) # Not supported yet
ifneq ($(TARGET_ARCH_ABI),mips64) # Not supported yet
LOCAL_MODULE := $(notdir $(LOCAL_PATH))
@@ -13,3 +16,6 @@ LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
include $(PREBUILT_SHARED_LIBRARY)
endif
endif
endif
endif

View File

@@ -2,7 +2,10 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifeq ($(filter armeabi-v7a-hard, $(APP_ABI)),) # Pre-compiled lib disabled for armhf ABI
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a-hard) # Pre-compiled lib disabled for armhf ABI
ifneq ($(TARGET_ARCH_ABI),arm64-v8a) # Not supported yet
ifneq ($(TARGET_ARCH_ABI),x86_64) # Not supported yet
ifneq ($(TARGET_ARCH_ABI),mips64) # Not supported yet
LOCAL_MODULE := $(notdir $(LOCAL_PATH))
@@ -17,3 +20,6 @@ obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a: $(LOCAL_PATH)/$(LOCAL_SRC_FIL
include $(PREBUILT_STATIC_LIBRARY)
endif
endif
endif
endif

View File

@@ -88,7 +88,6 @@ extern void SDL_ANDROID_PumpEvents()
{
static int oldMouseButtons = 0;
SDL_Event ev;
SDL_ANDROID_processAndroidTrackballDampening();
SDL_ANDROID_processMoveMouseWithKeyboard();
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_Window * window = SDL_GetFocusWindow();

View File

@@ -71,7 +71,6 @@ extern void SDL_ANDROID_PumpEvents()
{
joystickEventsCount = 0;
SDL_ANDROID_processAndroidTrackballDampening();
SDL_ANDROID_processMoveMouseWithKeyboard();
};
@@ -170,6 +169,12 @@ extern void SDL_ANDROID_MainThreadPushKeyboardKey(int pressed, SDL_scancode key,
return;
}
if ( key >= SDLK_MOUSE_LEFT && key <= SDLK_MOUSE_X2 )
{
SDL_ANDROID_MainThreadPushMouseButton(pressed, key - SDLK_MOUSE_LEFT + SDL_BUTTON_LEFT);
return;
}
keysym.scancode = key;
if ( key < SDLK_LAST )
keysym.scancode = SDL_android_keysym_to_scancode[key];

View File

@@ -62,7 +62,6 @@ static inline SDL_scancode TranslateKey(int scancode)
return SDL_android_keymap[scancode];
}
static int isTrackballUsed = 0;
int SDL_ANDROID_isMouseUsed = 0;
#define NORMALIZE_FLOAT_32767(X) (fminf(32767.0f, fmaxf(-32767.0f, (X) * 32767.0f)))
@@ -92,8 +91,6 @@ int SDL_ANDROID_joysticksAmount = 0;
static int SDL_ANDROID_isAccelerometerUsed = 0;
static int isMultitouchUsed = 0;
SDL_Joystick *SDL_ANDROID_CurrentJoysticks[JOY_GAMEPAD4+1];
static int TrackballDampening = 0; // in milliseconds
static Uint32 lastTrackballAction = 0;
enum { TOUCH_PTR_UP = 0, TOUCH_PTR_MOUSE = 1, TOUCH_PTR_SCREENKB = 2 };
static int touchPointers[MAX_MULTITOUCH_POINTERS] = {0};
static int firstMousePointerId = -1, secondMousePointerId = -1;
@@ -709,7 +706,10 @@ static void ProcessMouseMultitouch( int action, int pointerId )
}
}
if( pointerId != firstMousePointerId && pointerId != secondMousePointerId && (action == MOUSE_DOWN || action == MOUSE_UP) )
{
SDL_ANDROID_MainThreadPushMouseButton( (action == MOUSE_DOWN) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE );
multitouchGestureHappened = 1; // Prevent firing left mouse button when lifting two fingers
}
}
static void ProcessMouseHover( jint *xx, jint *yy, int action, int distance )
@@ -942,8 +942,6 @@ void SDL_ANDROID_WarpMouse(int x, int y)
}
};
static int processAndroidTrackball(int key, int action);
JNIEXPORT jint JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action, jint unicode )
{
@@ -953,9 +951,6 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
return 1;
#endif
if( isTrackballUsed )
if( processAndroidTrackball(key, action) )
return 1;
if( key == rightClickKey && rightClickMethod == RIGHT_CLICK_WITH_KEY )
{
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
@@ -967,7 +962,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
return 1;
}
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d translated %d unicode %d", key, TranslateKey(key), unicode);
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d action %d translated %d unicode %d", key, action, TranslateKey(key), unicode);
if( TranslateKey(key) == SDLK_NO_REMAP || (TranslateKey(key) == SDLK_UNKNOWN && (unicode & 0xFF80) == 0) )
return 0;
@@ -1074,12 +1069,6 @@ JAVA_EXPORT_NAME(AccelerometerReader_nativeGyroscope) ( JNIEnv* env, jobject th
}
}
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetTrackballUsed) ( JNIEnv* env, jobject thiz)
{
isTrackballUsed = 1;
}
static int getClickTimeout(int v)
{
switch(v)
@@ -1327,15 +1316,10 @@ JAVA_EXPORT_NAME(Settings_nativeSetAccelerometerSettings) ( JNIEnv* env, jobjec
accelerometerCenterPos = centerPos;
}
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetTrackballDampening) ( JNIEnv* env, jobject thiz, jint value)
{
TrackballDampening = (value * 200);
}
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* env, jobject thiz,
jfloat stick1x, jfloat stick1y, jfloat stick2x, jfloat stick2y, jfloat rtrigger, jfloat ltrigger)
jfloat stick1x, jfloat stick1y, jfloat stick2x, jfloat stick2y, jfloat rtrigger, jfloat ltrigger,
jint usingHat)
{
if( SDL_ANDROID_CurrentJoysticks[JOY_GAMEPAD1] )
{
@@ -1346,7 +1330,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* en
SDL_ANDROID_MainThreadPushJoystickAxis(JOY_GAMEPAD1, 4, NORMALIZE_FLOAT_32767(ltrigger));
SDL_ANDROID_MainThreadPushJoystickAxis(JOY_GAMEPAD1, 5, NORMALIZE_FLOAT_32767(rtrigger));
}
else
else if( !usingHat )
{
// Translate to up/down/left/right
if( stick1x < -0.5f )
@@ -1392,128 +1376,6 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* en
}
}
static int leftPressed = 0, rightPressed = 0, upPressed = 0, downPressed = 0;
int processAndroidTrackball(int key, int action)
{
SDL_keysym keysym;
if( ! action && (
key == KEYCODE_DPAD_UP ||
key == KEYCODE_DPAD_DOWN ||
key == KEYCODE_DPAD_LEFT ||
key == KEYCODE_DPAD_RIGHT ) )
return 1;
lastTrackballAction = SDL_GetTicks();
if( key == KEYCODE_DPAD_UP )
{
if( downPressed )
{
downPressed = 0;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN), 0 );
return 1;
}
if( !upPressed )
{
upPressed = 1;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
else
{
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
return 1;
}
if( key == KEYCODE_DPAD_DOWN )
{
if( upPressed )
{
upPressed = 0;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP), 0 );
return 1;
}
if( !upPressed )
{
downPressed = 1;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
else
{
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
return 1;
}
if( key == KEYCODE_DPAD_LEFT )
{
if( rightPressed )
{
rightPressed = 0;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT), 0 );
return 1;
}
if( !leftPressed )
{
leftPressed = 1;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
else
{
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
return 1;
}
if( key == KEYCODE_DPAD_RIGHT )
{
if( leftPressed )
{
leftPressed = 0;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT), 0 );
return 1;
}
if( !rightPressed )
{
rightPressed = 1;
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
else
{
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
}
return 1;
}
return 0;
}
void SDL_ANDROID_processAndroidTrackballDampening()
{
if( !TrackballDampening )
return;
if( SDL_GetTicks() > TrackballDampening + lastTrackballAction )
{
if( upPressed )
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP), 0 );
if( downPressed )
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN), 0 );
if( leftPressed )
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT), 0 );
if( rightPressed )
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT), 0 );
upPressed = 0;
downPressed = 0;
leftPressed = 0;
rightPressed = 0;
}
}
int SDL_SYS_JoystickInit(void)
{
SDL_numjoysticks = JOY_GAMEPAD4 + 1;

View File

@@ -59,8 +59,21 @@ If you compile this code with SDL 1.3 or newer, or use in some other way, the li
/* JNI-C++ wrapper stuff */
// Special key to signal that key should be handled by Java internally, such as Volume Up/Down keys
#define SDLK_NO_REMAP 512
enum
{
// Mouse buttons can be mapped to on-screen keys
SDLK_MOUSE_LEFT = 500,
SDLK_MOUSE_MIDDLE = 501,
SDLK_MOUSE_RIGHT = 502,
SDLK_MOUSE_WHEEL_UP = 503,
SDLK_MOUSE_WHEEL_DOWN = 504,
SDLK_MOUSE_X1 = 505,
SDLK_MOUSE_X2 = 506,
// Special key to signal that key should be handled by Java internally, such as Volume Up/Down keys
SDLK_NO_REMAP = 512,
};
#define SDL_SCANCODE_NO_REMAP SDLK_NO_REMAP
#if SDL_VERSION_ATLEAST(1,3,0)

View File

@@ -73,7 +73,6 @@ extern int SDL_ANDROID_IsScreenKeyboardShownFlag;
extern int SDL_ANDROID_drawTouchscreenKeyboard();
extern void SDL_ANDROID_VideoContextLost();
extern void SDL_ANDROID_VideoContextRecreated();
extern void SDL_ANDROID_processAndroidTrackballDampening();
extern void SDL_ANDROID_processMoveMouseWithKeyboard();
extern int SDL_ANDROID_InsideVideoThread();
extern void SDL_ANDROID_initFakeStdout();

View File

@@ -211,6 +211,15 @@ KEYCODE_BUTTON_14 = 201,
KEYCODE_BUTTON_15 = 202,
KEYCODE_BUTTON_16 = 203,
// Press mouse buttons with keyboard events
KEYCODE_MOUSE_LEFT = 248,
KEYCODE_MOUSE_MIDDLE = 249,
KEYCODE_MOUSE_RIGHT = 250,
KEYCODE_MOUSE_WHEEL_UP = 251,
KEYCODE_MOUSE_WHEEL_DOWN= 252,
KEYCODE_MOUSE_X1 = 253,
KEYCODE_MOUSE_X2 = 254,
KEYCODE_LAST = 255 // Android 2.3 added several new gaming keys, Android 3.1 added even more - plz keep in sync with Keycodes.java
};

View File

@@ -241,6 +241,14 @@ void SDL_android_init_keymap(SDLKey *SDL_android_keymap)
keymap[KEYCODE_BUTTON_14] = SDL_KEY(N);
keymap[KEYCODE_BUTTON_15] = SDL_KEY(O);
keymap[KEYCODE_BUTTON_16] = SDL_KEY(P);
keymap[KEYCODE_MOUSE_LEFT] = SDL_KEY(MOUSE_LEFT);
keymap[KEYCODE_MOUSE_MIDDLE] = SDL_KEY(MOUSE_MIDDLE);
keymap[KEYCODE_MOUSE_RIGHT] = SDL_KEY(MOUSE_RIGHT);
keymap[KEYCODE_MOUSE_WHEEL_UP] = SDL_KEY(MOUSE_WHEEL_UP);
keymap[KEYCODE_MOUSE_WHEEL_DOWN] = SDL_KEY(MOUSE_WHEEL_DOWN);
keymap[KEYCODE_MOUSE_X1] = SDL_KEY(MOUSE_X1);
keymap[KEYCODE_MOUSE_X2] = SDL_KEY(MOUSE_X2);
}
unsigned char SDL_android_keysym_to_scancode[SDLK_LAST] = {

View File

@@ -14,6 +14,4 @@ LOCAL_STATIC_LIBRARIES := png
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION)
LOCAL_LDLIBS := -lz
include $(BUILD_STATIC_LIBRARY)

View File

@@ -20,7 +20,7 @@ NDK=`readlink -f $NDK`
#echo NDK $NDK
GCCPREFIX=arm-linux-androideabi
GCCVER=4.6
[ -z "$GCCVER" ] && GCCVER=4.6
PLATFORMVER=android-8
LOCAL_PATH=`dirname $0`
if which realpath > /dev/null ; then

View File

@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-20
target=android-21

Binary file not shown.

View File

@@ -11,7 +11,9 @@ Installation
============
Install latest Android SDK and NDK from http://developer.android.com/index.html
You'll need to install Java Ant too.
You'll need to install Java Ant too. Since for building apk files some java classes are needed as well,
it is recommended to install OpenJDK and its development files. (On RPM based distros
usually called java-x.x.x-openjdk and java-x.x.x-openjdk-devel)
The application will run on Android OS 1.6 and above, but will use features from Android 4.4 if available.
The most supported environment for this port is Linux, MacOs should be okay too.
If you're developing under Windows you'd better install Portable Ubuntu, to get proper Linux environment
@@ -279,6 +281,16 @@ There is helper script project/jni/application/setEnvironment.sh which will set
for configure script and makefile, see AndroidBuild.sh in project/jni/application/scummvm dir for reference.
How to compile your own application using GCC 4.7 or newer
==========================================================
By default, your application will be build with GCC 4.6. To use a newer version of GCC, e.g. GCC 4.8, set-up
your project like described but execute following commands before running any of the commandergenius scripts
to configure or build your project:
export GCCVER=4.8
export NDK_TOOLCHAIN_VERSION=${GCCVER}
Android application sleep/resume support
========================================

View File

@@ -23,14 +23,10 @@ TODO, which will get actually done
- SDL: sometimes the screen stays black after restoring from background.
- Debian noroot: audio support - implement PulseAudio server.
- XSDL: support Android intent x11://localhost:6000 - http://www.openintents.org/node/905
- OpenTTD: cloud save support.
- USB Keyboard: touchpad mode, configurable mouse speed, show keyboard LEDs, show error when root is not installed.
- OpenTTD: Town window too tall.
- S Planner Killer: options to restore calendar settiongs, and to kill lock-screen widget.
- OpenTTD: Togglable legend area for map window.
- Nvidia Shield D-Pad does not send any events (probably acts as 3-rd joystick).
- USB Keyboard: touchpad-style mouse input.
- GemRB: update.