|
@@ -55,8 +55,9 @@ public class GameActivity extends SDLActivity {
|
|
|
|
|
|
|
|
protected Vibrator vibrator;
|
|
protected Vibrator vibrator;
|
|
|
protected boolean shortEdgesMode;
|
|
protected boolean shortEdgesMode;
|
|
|
- private GameInfo currentGameInfo;
|
|
|
|
|
private int delayedFd = -1;
|
|
private int delayedFd = -1;
|
|
|
|
|
+ private String[] args = new String[0];
|
|
|
|
|
+ private boolean isFused;
|
|
|
|
|
|
|
|
private static native void nativeSetDefaultStreamValues(int sampleRate, int framesPerBurst);
|
|
private static native void nativeSetDefaultStreamValues(int sampleRate, int framesPerBurst);
|
|
|
|
|
|
|
@@ -81,15 +82,20 @@ public class GameActivity extends SDLActivity {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected String[] getArguments() {
|
|
|
|
|
+ return args;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
Log.d(TAG, "started");
|
|
Log.d(TAG, "started");
|
|
|
|
|
+ isFused = hasEmbeddedGame();
|
|
|
|
|
|
|
|
if (checkCallingOrSelfPermission(Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED) {
|
|
if (checkCallingOrSelfPermission(Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED) {
|
|
|
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
|
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- currentGameInfo = new GameInfo();
|
|
|
|
|
Intent intent = getIntent();
|
|
Intent intent = getIntent();
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
@@ -169,11 +175,6 @@ public class GameActivity extends SDLActivity {
|
|
|
return inputStream != null;
|
|
return inputStream != null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Keep
|
|
|
|
|
- public GameInfo getGameInfo() {
|
|
|
|
|
- return currentGameInfo;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Keep
|
|
@Keep
|
|
|
public void vibrate(double seconds) {
|
|
public void vibrate(double seconds) {
|
|
|
if (vibrator != null) {
|
|
if (vibrator != null) {
|
|
@@ -188,7 +189,7 @@ public class GameActivity extends SDLActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Keep
|
|
@Keep
|
|
|
- public boolean openURLFromLOVE(String url) {
|
|
|
|
|
|
|
+ public static boolean openURLFromLOVE(String url) {
|
|
|
Log.d(TAG, "opening url = " + url);
|
|
Log.d(TAG, "opening url = " + url);
|
|
|
return openURL(url) == 0;
|
|
return openURL(url) == 0;
|
|
|
}
|
|
}
|
|
@@ -323,7 +324,7 @@ public class GameActivity extends SDLActivity {
|
|
|
if (mSingleton == null) {
|
|
if (mSingleton == null) {
|
|
|
// Game is not running, consider setting the currentGameInfo here
|
|
// Game is not running, consider setting the currentGameInfo here
|
|
|
|
|
|
|
|
- if (hasEmbeddedGame()) {
|
|
|
|
|
|
|
+ if (isFused) {
|
|
|
// Send it as dropped file later
|
|
// Send it as dropped file later
|
|
|
delayedFd = convertToFileDescriptor(game);
|
|
delayedFd = convertToFileDescriptor(game);
|
|
|
} else {
|
|
} else {
|
|
@@ -394,20 +395,9 @@ public class GameActivity extends SDLActivity {
|
|
|
|
|
|
|
|
if (scheme.equals("content")) {
|
|
if (scheme.equals("content")) {
|
|
|
// The intent may have more information about the filename
|
|
// The intent may have more information about the filename
|
|
|
- currentGameInfo.identity = intent.getStringExtra("name");
|
|
|
|
|
-
|
|
|
|
|
- if (currentGameInfo.identity == null) {
|
|
|
|
|
- // Use "lovegame" as fallback
|
|
|
|
|
- // TODO: Use the content URI basename
|
|
|
|
|
- Log.w(TAG, "Using \"lovegame\" as fallback for game identity (Uri " + game + ")");
|
|
|
|
|
- currentGameInfo.identity = "lovegame";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- currentGameInfo.fd = convertToFileDescriptor(game);
|
|
|
|
|
|
|
+ args = new String[] {"/love2d://fd/" + convertToFileDescriptor(game)};
|
|
|
} else if (scheme.equals("file")) {
|
|
} else if (scheme.equals("file")) {
|
|
|
- File f = new File(path);
|
|
|
|
|
- currentGameInfo.path = path;
|
|
|
|
|
- currentGameInfo.identity = f.getName();
|
|
|
|
|
|
|
+ args = new String[] {path};
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|