diff --git a/app/src/main/cpp/love b/app/src/main/cpp/love index 502adfcb..aaeb318a 160000 --- a/app/src/main/cpp/love +++ b/app/src/main/cpp/love @@ -1 +1 @@ -Subproject commit 502adfcb15ce3cafb529768701a0eab599ac7d85 +Subproject commit aaeb318aa6b3718f6b1d079c3b0191081a74d40b diff --git a/app/src/main/java/org/love2d/android/GameActivity.java b/app/src/main/java/org/love2d/android/GameActivity.java index bba5d4cf..26329ee1 100644 --- a/app/src/main/java/org/love2d/android/GameActivity.java +++ b/app/src/main/java/org/love2d/android/GameActivity.java @@ -55,8 +55,9 @@ public class GameActivity extends SDLActivity { protected Vibrator vibrator; protected boolean shortEdgesMode; - private GameInfo currentGameInfo; private int delayedFd = -1; + private String[] args = new String[0]; + private boolean isFused; 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 protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "started"); + isFused = hasEmbeddedGame(); if (checkCallingOrSelfPermission(Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED) { vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); } - currentGameInfo = new GameInfo(); Intent intent = getIntent(); super.onCreate(savedInstanceState); @@ -169,11 +175,6 @@ public class GameActivity extends SDLActivity { return inputStream != null; } - @Keep - public GameInfo getGameInfo() { - return currentGameInfo; - } - @Keep public void vibrate(double seconds) { if (vibrator != null) { @@ -188,7 +189,7 @@ public class GameActivity extends SDLActivity { } @Keep - public boolean openURLFromLOVE(String url) { + public static boolean openURLFromLOVE(String url) { Log.d(TAG, "opening url = " + url); return openURL(url) == 0; } @@ -323,7 +324,7 @@ public class GameActivity extends SDLActivity { if (mSingleton == null) { // Game is not running, consider setting the currentGameInfo here - if (hasEmbeddedGame()) { + if (isFused) { // Send it as dropped file later delayedFd = convertToFileDescriptor(game); } else { @@ -394,20 +395,9 @@ public class GameActivity extends SDLActivity { if (scheme.equals("content")) { // 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")) { - File f = new File(path); - currentGameInfo.path = path; - currentGameInfo.identity = f.getName(); + args = new String[] {path}; } } }