|
@@ -39,6 +39,7 @@ import org.godotengine.godot.io.file.FileAccessHandler;
|
|
import org.godotengine.godot.plugin.GodotPlugin;
|
|
import org.godotengine.godot.plugin.GodotPlugin;
|
|
import org.godotengine.godot.plugin.GodotPluginRegistry;
|
|
import org.godotengine.godot.plugin.GodotPluginRegistry;
|
|
import org.godotengine.godot.tts.GodotTTS;
|
|
import org.godotengine.godot.tts.GodotTTS;
|
|
|
|
+import org.godotengine.godot.utils.BenchmarkUtils;
|
|
import org.godotengine.godot.utils.GodotNetUtils;
|
|
import org.godotengine.godot.utils.GodotNetUtils;
|
|
import org.godotengine.godot.utils.PermissionsUtil;
|
|
import org.godotengine.godot.utils.PermissionsUtil;
|
|
import org.godotengine.godot.xr.XRMode;
|
|
import org.godotengine.godot.xr.XRMode;
|
|
@@ -268,6 +269,8 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
public GodotIO io;
|
|
public GodotIO io;
|
|
public GodotNetUtils netUtils;
|
|
public GodotNetUtils netUtils;
|
|
public GodotTTS tts;
|
|
public GodotTTS tts;
|
|
|
|
+ private DirectoryAccessHandler directoryAccessHandler;
|
|
|
|
+ private FileAccessHandler fileAccessHandler;
|
|
|
|
|
|
static SingletonBase[] singletons = new SingletonBase[MAX_SINGLETONS];
|
|
static SingletonBase[] singletons = new SingletonBase[MAX_SINGLETONS];
|
|
static int singleton_count = 0;
|
|
static int singleton_count = 0;
|
|
@@ -601,7 +604,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
}
|
|
}
|
|
return cmdline;
|
|
return cmdline;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ // The _cl_ file can be missing with no adverse effect
|
|
return new String[0];
|
|
return new String[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -662,8 +665,8 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
netUtils = new GodotNetUtils(activity);
|
|
netUtils = new GodotNetUtils(activity);
|
|
tts = new GodotTTS(activity);
|
|
tts = new GodotTTS(activity);
|
|
Context context = getContext();
|
|
Context context = getContext();
|
|
- DirectoryAccessHandler directoryAccessHandler = new DirectoryAccessHandler(context);
|
|
|
|
- FileAccessHandler fileAccessHandler = new FileAccessHandler(context);
|
|
|
|
|
|
+ directoryAccessHandler = new DirectoryAccessHandler(context);
|
|
|
|
+ fileAccessHandler = new FileAccessHandler(context);
|
|
mSensorManager = (SensorManager)activity.getSystemService(Context.SENSOR_SERVICE);
|
|
mSensorManager = (SensorManager)activity.getSystemService(Context.SENSOR_SERVICE);
|
|
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
|
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
|
mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
|
|
mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
|
|
@@ -685,6 +688,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onCreate(Bundle icicle) {
|
|
public void onCreate(Bundle icicle) {
|
|
|
|
+ BenchmarkUtils.beginBenchmarkMeasure("Godot::onCreate");
|
|
super.onCreate(icicle);
|
|
super.onCreate(icicle);
|
|
|
|
|
|
final Activity activity = getActivity();
|
|
final Activity activity = getActivity();
|
|
@@ -736,6 +740,18 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
editor.putString("store_public_key", main_pack_key);
|
|
editor.putString("store_public_key", main_pack_key);
|
|
|
|
|
|
editor.apply();
|
|
editor.apply();
|
|
|
|
+ i++;
|
|
|
|
+ } else if (command_line[i].equals("--benchmark")) {
|
|
|
|
+ BenchmarkUtils.setUseBenchmark(true);
|
|
|
|
+ new_args.add(command_line[i]);
|
|
|
|
+ } else if (has_extra && command_line[i].equals("--benchmark-file")) {
|
|
|
|
+ BenchmarkUtils.setUseBenchmark(true);
|
|
|
|
+ new_args.add(command_line[i]);
|
|
|
|
+
|
|
|
|
+ // Retrieve the filepath
|
|
|
|
+ BenchmarkUtils.setBenchmarkFile(command_line[i + 1]);
|
|
|
|
+ new_args.add(command_line[i + 1]);
|
|
|
|
+
|
|
i++;
|
|
i++;
|
|
} else if (command_line[i].trim().length() != 0) {
|
|
} else if (command_line[i].trim().length() != 0) {
|
|
new_args.add(command_line[i]);
|
|
new_args.add(command_line[i]);
|
|
@@ -807,6 +823,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
mCurrentIntent = activity.getIntent();
|
|
mCurrentIntent = activity.getIntent();
|
|
|
|
|
|
initializeGodot();
|
|
initializeGodot();
|
|
|
|
+ BenchmarkUtils.endBenchmarkMeasure("Godot::onCreate");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1021,22 +1038,6 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
// Do something here if sensor accuracy changes.
|
|
// Do something here if sensor accuracy changes.
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- @Override public boolean dispatchKeyEvent(KeyEvent event) {
|
|
|
|
-
|
|
|
|
- if (event.getKeyCode()==KeyEvent.KEYCODE_BACK) {
|
|
|
|
-
|
|
|
|
- System.out.printf("** BACK REQUEST!\n");
|
|
|
|
-
|
|
|
|
- GodotLib.quit();
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- System.out.printf("** OTHER KEY!\n");
|
|
|
|
-
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
public void onBackPressed() {
|
|
public void onBackPressed() {
|
|
boolean shouldQuit = true;
|
|
boolean shouldQuit = true;
|
|
|
|
|
|
@@ -1242,6 +1243,16 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
mView.initInputDevices();
|
|
mView.initInputDevices();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Keep
|
|
|
|
+ public DirectoryAccessHandler getDirectoryAccessHandler() {
|
|
|
|
+ return directoryAccessHandler;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Keep
|
|
|
|
+ public FileAccessHandler getFileAccessHandler() {
|
|
|
|
+ return fileAccessHandler;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Keep
|
|
@Keep
|
|
private int createNewGodotInstance(String[] args) {
|
|
private int createNewGodotInstance(String[] args) {
|
|
if (godotHost != null) {
|
|
if (godotHost != null) {
|
|
@@ -1249,4 +1260,19 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Keep
|
|
|
|
+ private void beginBenchmarkMeasure(String label) {
|
|
|
|
+ BenchmarkUtils.beginBenchmarkMeasure(label);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Keep
|
|
|
|
+ private void endBenchmarkMeasure(String label) {
|
|
|
|
+ BenchmarkUtils.endBenchmarkMeasure(label);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Keep
|
|
|
|
+ private void dumpBenchmark(String benchmarkFile) {
|
|
|
|
+ BenchmarkUtils.dumpBenchmark(fileAccessHandler, benchmarkFile);
|
|
|
|
+ }
|
|
}
|
|
}
|