mirror of
https://github.com/ARMSX2/ARMSX1.git
synced 2026-08-24 16:53:35 -07:00
Add protocol launch handling and fast forward toggle
This commit is contained in:
@@ -20,6 +20,12 @@
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="armsx" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -20,12 +20,26 @@ public class EmulatorActivity extends SDLActivity {
|
||||
static final String EXTRA_NATIVE_ARGS = "com.nanodata.armsx.EXTRA_NATIVE_ARGS";
|
||||
private static final String TAG = "EmulatorActivity";
|
||||
|
||||
private static native void nativeEnqueueLaunchArgument(String argument);
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setRequestedOrientation(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
|
||||
String launchArgument = launchArgumentFromIntent(intent);
|
||||
if (launchArgument != null && !launchArgument.isEmpty()) {
|
||||
Log.i(TAG, "Runtime protocol launch: " + launchArgument);
|
||||
nativeEnqueueLaunchArgument(launchArgument);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[]{"SDL2", "armsx"};
|
||||
@@ -57,9 +71,27 @@ public class EmulatorActivity extends SDLActivity {
|
||||
}
|
||||
}
|
||||
|
||||
String launchArgument = launchArgumentFromIntent(intent);
|
||||
if (launchArgument != null && !launchArgument.isEmpty()) {
|
||||
args.add(launchArgument);
|
||||
}
|
||||
|
||||
return args.toArray(new String[0]);
|
||||
}
|
||||
|
||||
private @Nullable String launchArgumentFromIntent(@Nullable Intent intent) {
|
||||
if (intent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String dataString = intent.getDataString();
|
||||
if (dataString != null && !dataString.isEmpty()) {
|
||||
return dataString;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private @Nullable String copyBundledBios() {
|
||||
AssetManager assets = getAssets();
|
||||
try (InputStream input = assets.open("bios.bin")) {
|
||||
|
||||
Reference in New Issue
Block a user