summaryrefslogtreecommitdiff
path: root/platform/android/java/src/com
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-04-28 21:56:43 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-04-28 21:56:43 -0300
commit87f37bc5a305e6a68ef232be580350588e300fcc (patch)
tree608af97f58c0dd7f2f6f86d973b072f7888bfca0 /platform/android/java/src/com
parent7fadc2f93a18f2b5487fbcd6e90bcde781c53fec (diff)
-Added OpenSSL and HTTPS support
-Built-in version of the library for Windows, Android and iOS (other OSs use system one) -Small fixes all around
Diffstat (limited to 'platform/android/java/src/com')
-rw-r--r--platform/android/java/src/com/android/godot/Godot.java50
-rw-r--r--platform/android/java/src/com/android/godot/GodotLib.java2
2 files changed, 50 insertions, 2 deletions
diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java
index 0fa07e2490..35ecdc818e 100644
--- a/platform/android/java/src/com/android/godot/Godot.java
+++ b/platform/android/java/src/com/android/godot/Godot.java
@@ -60,6 +60,7 @@ import java.io.IOException;
import android.provider.Settings.Secure;
import android.widget.FrameLayout;
import com.android.godot.input.*;
+import java.io.InputStream;
public class Godot extends Activity implements SensorEventListener
@@ -177,6 +178,48 @@ public class Godot extends Activity implements SensorEventListener
return Godot._self;
}
+
+ private String[] getCommandLine() {
+
+ InputStream is;
+ try {
+ is = getAssets().open("/_cl_");
+ byte[] len = new byte[4];
+ int r = is.read(len);
+ if (r<4) {
+ System.out.printf("**ERROR** Wrong cmdline length.\n");
+ return new String[0];
+ }
+ int argc=((int)(len[3])<<24) | ((int)(len[2])<<16) | ((int)(len[1])<<8) | ((int)(len[0]));
+ String[] cmdline = new String[argc];
+ for(int i=0;i<argc;i++) {
+ r = is.read(len);
+ if (r<4) {
+ System.out.printf("**ERROR** Wrong cmdline param lenght.\n");
+ return new String[0];
+ }
+ int strlen=((int)(len[3])<<24) | ((int)(len[2])<<16) | ((int)(len[1])<<8) | ((int)(len[0]));
+ if (strlen>65535) {
+ System.out.printf("**ERROR** Wrong command len\n");
+ return new String[0];
+ }
+ byte[] arg = new byte[strlen];
+ r = is.read(arg);
+ if (r!=strlen) {
+ cmdline[i]=new String(arg,"UTF-8");
+ }
+
+ }
+
+ return cmdline;
+ } catch (Exception e) {
+
+ return new String[0];
+ }
+
+
+ }
+
@Override protected void onCreate(Bundle icicle) {
System.out.printf("** GODOT ACTIVITY CREATED HERE ***\n");
@@ -187,10 +230,13 @@ public class Godot extends Activity implements SensorEventListener
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+
+
+
io = new GodotIO(this);
io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
GodotLib.io=io;
- GodotLib.initialize(this,io.needsReloadHooks());
+ GodotLib.initialize(this,io.needsReloadHooks(),getCommandLine());
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
@@ -198,6 +244,8 @@ public class Godot extends Activity implements SensorEventListener
result_callback = null;
mPaymentsManager = PaymentsManager.createManager(this).initService();
+
+
// instanceSingleton( new GodotFacebook(this) );
diff --git a/platform/android/java/src/com/android/godot/GodotLib.java b/platform/android/java/src/com/android/godot/GodotLib.java
index 459c6c1222..ad803f8e8d 100644
--- a/platform/android/java/src/com/android/godot/GodotLib.java
+++ b/platform/android/java/src/com/android/godot/GodotLib.java
@@ -44,7 +44,7 @@ public class GodotLib {
* @param height the current view height
*/
- public static native void initialize(Godot p_instance,boolean need_reload_hook);
+ public static native void initialize(Godot p_instance,boolean need_reload_hook,String[] p_cmdline);
public static native void resize(int width, int height,boolean reload);
public static native void newcontext();
public static native void quit();