SDL2 Java implementation
This commit is contained in:
2
build.sh
2
build.sh
@@ -62,7 +62,7 @@ fi
|
||||
if [ -e project/local.properties ] && \
|
||||
grep "package `grep AppFullName= AndroidAppSettings.cfg | sed 's/.*=//'`;" project/src/Globals.java > /dev/null 2>&1 && \
|
||||
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
|
||||
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ]
|
||||
[ -z "`find project/java/* project/javaSDL2/* project/jni/sdl2/android-project/app/src/main/java/org/libsdl/app/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ]
|
||||
then
|
||||
true
|
||||
else
|
||||
|
||||
@@ -882,7 +882,7 @@ cat $ANDROID_MANIFEST_TEMPLATE | \
|
||||
sed "s/android:screenOrientation=.*/android:screenOrientation=\"$ScreenOrientation1\"/" | \
|
||||
sed "s^android:versionCode=.*^android:versionCode=\"$AppVersionCode\"^" | \
|
||||
sed "s^android:versionName=.*^android:versionName=\"$AppVersionName\"^" | \
|
||||
sed "s^activity android:name=.*^activity android:name=\"MainActivity\"^" > \
|
||||
sed "s^activity android:name=\"SDLActivity\"^activity android:name=\"MainActivity\"^" > \
|
||||
project/AndroidManifest.xml
|
||||
if [ "$AdmobPublisherId" = "n" -o -z "$AdmobPublisherId" ] ; then
|
||||
$SEDI "/==ADMOB==/ d" project/AndroidManifest.xml
|
||||
@@ -1056,6 +1056,12 @@ $SEDI "s%public static String GooglePlayGameServicesId = .*%public static String
|
||||
$SEDI "s/public static String AppLibraries.*/public static String AppLibraries[] = { $LibrariesToLoad };/" project/src/Globals.java
|
||||
$SEDI "s/public static String AppMainLibraries.*/public static String AppMainLibraries[] = { $MainLibrariesToLoad };/" project/src/Globals.java
|
||||
|
||||
if $UsingSdl2; then
|
||||
# Delete options that reference classes from SDL 1.2
|
||||
$SEDI "s/public static SettingsMenu.Menu HiddenMenuOptions .*;//" project/src/Globals.java
|
||||
$SEDI "s/public static SettingsMenu.Menu FirstStartMenuOptions .*;//" project/src/Globals.java
|
||||
fi
|
||||
|
||||
echo Patching project/jni/Settings.mk
|
||||
echo '# DO NOT EDIT THIS FILE - it is automatically generated, edit file SettingsTemplate.mk' > project/jni/Settings.mk
|
||||
cat project/jni/SettingsTemplate.mk | \
|
||||
|
||||
@@ -177,7 +177,6 @@ class DataDownloader extends Thread
|
||||
{
|
||||
Parent = _Parent;
|
||||
Status = new StatusWriter( _Status, _Parent );
|
||||
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
|
||||
outFilesDir = Globals.DataDir;
|
||||
DownloadComplete = false;
|
||||
this.start();
|
||||
@@ -193,6 +192,7 @@ class DataDownloader extends Thread
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (Parent.getVideoLayout() != null)
|
||||
Parent.getVideoLayout().setOnKeyListener(new BackKeyListener(Parent));
|
||||
|
||||
String [] downloadFiles = Globals.DataDownloadUrl;
|
||||
@@ -235,6 +235,7 @@ class DataDownloader extends Thread
|
||||
}
|
||||
}
|
||||
DownloadComplete = true;
|
||||
if (Parent.getVideoLayout() != null)
|
||||
Parent.getVideoLayout().setOnKeyListener(null);
|
||||
initParent();
|
||||
}
|
||||
@@ -855,7 +856,7 @@ class DataDownloader extends Thread
|
||||
public MainActivity Parent;
|
||||
public void run()
|
||||
{
|
||||
Parent.initSDL();
|
||||
Parent.downloadFinishedInitSDL();
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
|
||||
@@ -43,6 +43,7 @@ import android.widget.RelativeLayout;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.Color;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -193,7 +194,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
||||
{
|
||||
ApplicationInfo info = this.getPackageManager().getApplicationInfo(Parent.getPackageName(), 0);
|
||||
ApplicationInfo info = this.getPackageManager().getApplicationInfo(this.getPackageName(), 0);
|
||||
if( info.splitSourceDirs != null )
|
||||
{
|
||||
for( String apk: info.splitSourceDirs )
|
||||
@@ -345,7 +346,7 @@ public class MainActivity extends Activity
|
||||
this.runOnUiThread(cb);
|
||||
}
|
||||
|
||||
public void initSDL()
|
||||
public void downloadFinishedInitSDL()
|
||||
{
|
||||
setScreenOrientation();
|
||||
updateScreenOrientation();
|
||||
@@ -590,7 +591,7 @@ public class MainActivity extends Activity
|
||||
downloader.setStatusField(_tv);
|
||||
if( downloader.DownloadComplete )
|
||||
{
|
||||
initSDL();
|
||||
downloadFinishedInitSDL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
project/java/Mouse.java
Normal file
56
project/java/Mouse.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
class Mouse
|
||||
{
|
||||
public static final int LEFT_CLICK_NORMAL = 0;
|
||||
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
|
||||
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
|
||||
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
|
||||
public static final int LEFT_CLICK_WITH_KEY = 4;
|
||||
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
|
||||
public static final int LEFT_CLICK_WITH_TAP = 6;
|
||||
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
|
||||
|
||||
public static final int RIGHT_CLICK_NONE = 0;
|
||||
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
|
||||
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
|
||||
public static final int RIGHT_CLICK_WITH_KEY = 3;
|
||||
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
|
||||
|
||||
public static final int SDL_FINGER_DOWN = 0;
|
||||
public static final int SDL_FINGER_UP = 1;
|
||||
public static final int SDL_FINGER_MOVE = 2;
|
||||
public static final int SDL_FINGER_HOVER = 3;
|
||||
|
||||
public static final int ZOOM_NONE = 0;
|
||||
public static final int ZOOM_MAGNIFIER = 1;
|
||||
|
||||
public static final int MOUSE_HW_INPUT_FINGER = 0;
|
||||
public static final int MOUSE_HW_INPUT_STYLUS = 1;
|
||||
public static final int MOUSE_HW_INPUT_MOUSE = 2;
|
||||
|
||||
public static final int MAX_HOVER_DISTANCE = 1024;
|
||||
public static final int HOVER_REDRAW_SCREEN = 1024 * 10;
|
||||
public static final float MAX_PRESSURE = 1024.0f;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ class SDL_1_2_Keycodes
|
||||
|
||||
// Autogenerated by hand with a command:
|
||||
// grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
|
||||
class SDL_1_3_Keycodes
|
||||
class SDL_2_Keycodes
|
||||
{
|
||||
public static final int SDLK_UNKNOWN = 0;
|
||||
public static final int SDLK_A = 4;
|
||||
@@ -519,6 +519,10 @@ class SDL_1_3_Keycodes
|
||||
public static final int SDLK_KBDILLUMUP = 280;
|
||||
public static final int SDLK_EJECT = 281;
|
||||
public static final int SDLK_SLEEP = 282;
|
||||
public static final int SDLK_APP1 = 283;
|
||||
public static final int SDLK_APP2 = 284;
|
||||
public static final int SDLK_AUDIOREWIND = 285;
|
||||
public static final int SDLK_AUDIOFASTFORWARD = 286;
|
||||
|
||||
// Mouse buttons can be mapped to on-screen keys
|
||||
public static final int SDLK_MOUSE_LEFT = 500;
|
||||
@@ -558,9 +562,9 @@ class SDL_Keys
|
||||
ArrayList<String> Names = new ArrayList<String> ();
|
||||
ArrayList<Integer> Values = new ArrayList<Integer> ();
|
||||
Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields();
|
||||
if( Globals.Using_SDL_1_3 )
|
||||
if( Globals.UsingSDL2 )
|
||||
{
|
||||
fields = SDL_1_3_Keycodes.class.getDeclaredFields();
|
||||
fields = SDL_2_Keycodes.class.getDeclaredFields();
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -629,7 +629,7 @@ public class Settings
|
||||
Globals.TouchscreenKeyboardTransparency,
|
||||
Globals.FloatingScreenJoystick ? 1 : 0,
|
||||
Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
SetupTouchscreenKeyboardGraphics(p);
|
||||
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(p);
|
||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
|
||||
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
||||
@@ -736,63 +736,6 @@ public class Settings
|
||||
} catch (Exception eeeee) {}
|
||||
}
|
||||
|
||||
static byte [] loadRaw(Activity p, int res)
|
||||
{
|
||||
byte [] buf = new byte[65536 * 2];
|
||||
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
|
||||
int written = 0;
|
||||
try{
|
||||
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
|
||||
int readed = 0;
|
||||
while( (readed = is.read(buf)) >= 0 )
|
||||
{
|
||||
if( written + readed > a.length )
|
||||
{
|
||||
byte [] b = new byte [written + readed];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
a = b;
|
||||
}
|
||||
System.arraycopy(buf, 0, a, written, readed);
|
||||
written += readed;
|
||||
}
|
||||
} catch(Exception e) {};
|
||||
byte [] b = new byte [written];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
return b;
|
||||
}
|
||||
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p)
|
||||
{
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
if(Globals.TouchscreenKeyboardTheme < 0)
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
if(Globals.TouchscreenKeyboardTheme > 9)
|
||||
Globals.TouchscreenKeyboardTheme = 9;
|
||||
|
||||
if( Globals.TouchscreenKeyboardTheme == 0 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
|
||||
if( Globals.TouchscreenKeyboardTheme == 1 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
|
||||
if( Globals.TouchscreenKeyboardTheme == 3 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
|
||||
if( Globals.TouchscreenKeyboardTheme == 4 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
|
||||
if( Globals.TouchscreenKeyboardTheme == 5 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
|
||||
if( Globals.TouchscreenKeyboardTheme == 6 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
|
||||
if( Globals.TouchscreenKeyboardTheme == 7 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
|
||||
if( Globals.TouchscreenKeyboardTheme == 8 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
|
||||
if( Globals.TouchscreenKeyboardTheme == 9 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
|
||||
}
|
||||
}
|
||||
|
||||
abstract static class SdcardAppPath
|
||||
{
|
||||
public static SdcardAppPath get()
|
||||
@@ -1023,7 +966,7 @@ public class Settings
|
||||
private static native void nativeSetVideoMultithreaded();
|
||||
private static native void nativeSetVideoForceSoftwareMode();
|
||||
public static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick, int buttonAmount);
|
||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
public static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
private static native void nativeInitKeymap();
|
||||
private static native int nativeGetKeymapKey(int key);
|
||||
private static native void nativeSetKeymapKey(int javakey, int key);
|
||||
|
||||
@@ -369,7 +369,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
defaults = defaults2;
|
||||
}
|
||||
|
||||
if(Globals.Using_SDL_1_3)
|
||||
if(Globals.UsingSDL2)
|
||||
{
|
||||
CharSequence[] items2 = {
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
|
||||
@@ -33,11 +33,13 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
@@ -69,40 +71,6 @@ import android.hardware.input.InputManager;
|
||||
import android.graphics.Rect;
|
||||
|
||||
|
||||
class Mouse
|
||||
{
|
||||
public static final int LEFT_CLICK_NORMAL = 0;
|
||||
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
|
||||
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
|
||||
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
|
||||
public static final int LEFT_CLICK_WITH_KEY = 4;
|
||||
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
|
||||
public static final int LEFT_CLICK_WITH_TAP = 6;
|
||||
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
|
||||
|
||||
public static final int RIGHT_CLICK_NONE = 0;
|
||||
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
|
||||
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
|
||||
public static final int RIGHT_CLICK_WITH_KEY = 3;
|
||||
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
|
||||
|
||||
public static final int SDL_FINGER_DOWN = 0;
|
||||
public static final int SDL_FINGER_UP = 1;
|
||||
public static final int SDL_FINGER_MOVE = 2;
|
||||
public static final int SDL_FINGER_HOVER = 3;
|
||||
|
||||
public static final int ZOOM_NONE = 0;
|
||||
public static final int ZOOM_MAGNIFIER = 1;
|
||||
|
||||
public static final int MOUSE_HW_INPUT_FINGER = 0;
|
||||
public static final int MOUSE_HW_INPUT_STYLUS = 1;
|
||||
public static final int MOUSE_HW_INPUT_MOUSE = 2;
|
||||
|
||||
public static final int MAX_HOVER_DISTANCE = 1024;
|
||||
public static final int HOVER_REDRAW_SCREEN = 1024 * 10;
|
||||
public static final float MAX_PRESSURE = 1024.0f;
|
||||
}
|
||||
|
||||
abstract class DifferentTouchInput
|
||||
{
|
||||
public abstract void process(final MotionEvent event);
|
||||
@@ -776,7 +744,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
|
||||
if(mGlContextLost) {
|
||||
mGlContextLost = false;
|
||||
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
super.SwapBuffers();
|
||||
}
|
||||
|
||||
@@ -1256,6 +1224,63 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
}
|
||||
}
|
||||
|
||||
static byte [] loadRaw(Activity p, int res)
|
||||
{
|
||||
byte [] buf = new byte[65536 * 2];
|
||||
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
|
||||
int written = 0;
|
||||
try{
|
||||
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
|
||||
int readed = 0;
|
||||
while( (readed = is.read(buf)) >= 0 )
|
||||
{
|
||||
if( written + readed > a.length )
|
||||
{
|
||||
byte [] b = new byte [written + readed];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
a = b;
|
||||
}
|
||||
System.arraycopy(buf, 0, a, written, readed);
|
||||
written += readed;
|
||||
}
|
||||
} catch(Exception e) {};
|
||||
byte [] b = new byte [written];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
return b;
|
||||
}
|
||||
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p)
|
||||
{
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
if(Globals.TouchscreenKeyboardTheme < 0)
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
if(Globals.TouchscreenKeyboardTheme > 9)
|
||||
Globals.TouchscreenKeyboardTheme = 9;
|
||||
|
||||
if( Globals.TouchscreenKeyboardTheme == 0 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
|
||||
if( Globals.TouchscreenKeyboardTheme == 1 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
|
||||
if( Globals.TouchscreenKeyboardTheme == 3 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
|
||||
if( Globals.TouchscreenKeyboardTheme == 4 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
|
||||
if( Globals.TouchscreenKeyboardTheme == 5 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
|
||||
if( Globals.TouchscreenKeyboardTheme == 6 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
|
||||
if( Globals.TouchscreenKeyboardTheme == 7 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
|
||||
if( Globals.TouchscreenKeyboardTheme == 8 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
|
||||
if( Globals.TouchscreenKeyboardTheme == 9 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
|
||||
}
|
||||
}
|
||||
|
||||
DemoRenderer mRenderer;
|
||||
MainActivity mParent;
|
||||
|
||||
|
||||
1
project/javaSDL2/DataDownloader.java
Symbolic link
1
project/javaSDL2/DataDownloader.java
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/DataDownloader.java
|
||||
@@ -22,11 +22,21 @@ freely, subject to the following restrictions:
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.UiModeManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.FrameLayout;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
this.instance = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Globals.DataDir = this.getFilesDir().getAbsolutePath();
|
||||
@@ -37,7 +47,7 @@ public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||
{
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
||||
{
|
||||
ApplicationInfo info = this.getPackageManager().getApplicationInfo(Parent.getPackageName(), 0);
|
||||
ApplicationInfo info = this.getPackageManager().getApplicationInfo(this.getPackageName(), 0);
|
||||
if( info.splitSourceDirs != null )
|
||||
{
|
||||
for( String apk: info.splitSourceDirs )
|
||||
@@ -60,6 +70,17 @@ public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||
Settings.setEnvVars(this);
|
||||
}
|
||||
|
||||
public void downloadFinishedInitSDL() {
|
||||
// TODO: implement this
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resumeNativeThread() {
|
||||
Log.i("SDL", "Intercepted resumeNativeThread() from MainActivity");
|
||||
super.resumeNativeThread();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
@@ -71,7 +92,7 @@ public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
return new String[0];
|
||||
return Globals.CommandLine.split(" ");
|
||||
}
|
||||
|
||||
private static String GetMappedLibraryName(final String s) {
|
||||
@@ -82,6 +103,41 @@ public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||
return s;
|
||||
}
|
||||
|
||||
public int getApplicationVersion() {
|
||||
try {
|
||||
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
return packageInfo.versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.i("SDL", "libSDL: Cannot get the version of our own package: " + e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isRunningOnOUYA() {
|
||||
try {
|
||||
PackageInfo packageInfo = getPackageManager().getPackageInfo("tv.ouya", 0);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
|
||||
return (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) || Globals.OuyaEmulation;
|
||||
}
|
||||
|
||||
public static void setScreenOrientation() {
|
||||
// For compatibility with SDL 1.2 code
|
||||
}
|
||||
|
||||
public static void setUpStatusLabel() {
|
||||
// For compatibility with SDL 1.2 code
|
||||
}
|
||||
|
||||
public static FrameLayout getVideoLayout() {
|
||||
// For compatibility with SDL 1.2 code
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MainActivity instance = null;
|
||||
public String ObbMountPath = null; // Deprecated, always empty
|
||||
public String assetPackPath = null; // Not saved to the config file
|
||||
public boolean readExternalStoragePermissionDialogAnswered = false; // Deprecated, always false
|
||||
}
|
||||
|
||||
1
project/javaSDL2/Mouse.java
Symbolic link
1
project/javaSDL2/Mouse.java
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/Mouse.java
|
||||
1
project/javaSDL2/SDL_Keys.java
Symbolic link
1
project/javaSDL2/SDL_Keys.java
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/SDL_Keys.java
|
||||
48
project/javaSDL2/Stubs.java
Normal file
48
project/javaSDL2/Stubs.java
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
// Stubs for compatibility with SDL 1.2 code
|
||||
|
||||
class SettingsMenu {
|
||||
public static void showConfig(final MainActivity p, final boolean firstStart) {
|
||||
}
|
||||
}
|
||||
|
||||
class RestartMainActivity extends Activity {
|
||||
// For compatibility with SDL 1.2 code
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static final String ACTIVITY_AUTODETECT_SCREEN_ORIENTATION = "libsdl.org.ACTIVITY_AUTODETECT_SCREEN_ORIENTATION";
|
||||
public static final String SDL_RESTART_PARAMS = "SDL_RESTART_PARAMS";
|
||||
}
|
||||
|
||||
class DemoGLSurfaceView {
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p) {
|
||||
}
|
||||
}
|
||||
1
project/javaSDL2/XZInputStream.java
Symbolic link
1
project/javaSDL2/XZInputStream.java
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/XZInputStream.java
|
||||
Reference in New Issue
Block a user