From f01ccfdb824d37dd9bee2eb150a7721ea19b6837 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 27 Jun 2020 12:35:18 +0200 Subject: Android: Only allow conversion when appropriate --- .../dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java | 10 ++++++++-- .../main/java/org/dolphinemu/dolphinemu/model/GameFile.java | 2 ++ Source/Android/jni/GameList/GameFile.cpp | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java index d3f5395107..6480b24c2c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java @@ -29,6 +29,7 @@ public class GamePropertiesDialog extends DialogFragment private static final String ARG_GAMEID = "game_id"; public static final String ARG_REVISION = "revision"; private static final String ARG_PLATFORM = "platform"; + private static final String ARG_SHOULD_ALLOW_CONVERSION = "should_allow_conversion"; public static GamePropertiesDialog newInstance(GameFile gameFile) { @@ -39,6 +40,7 @@ public class GamePropertiesDialog extends DialogFragment arguments.putString(ARG_GAMEID, gameFile.getGameId()); arguments.putInt(ARG_REVISION, gameFile.getRevision()); arguments.putInt(ARG_PLATFORM, gameFile.getPlatform()); + arguments.putBoolean(ARG_SHOULD_ALLOW_CONVERSION, gameFile.shouldAllowConversion()); fragment.setArguments(arguments); return fragment; @@ -52,6 +54,7 @@ public class GamePropertiesDialog extends DialogFragment String gameId = requireArguments().getString(ARG_GAMEID); int revision = requireArguments().getInt(ARG_REVISION); int platform = requireArguments().getInt(ARG_PLATFORM); + boolean shouldAllowConversion = requireArguments().getBoolean(ARG_SHOULD_ALLOW_CONVERSION); AlertDialogItemsBuilder itemsBuilder = new AlertDialogItemsBuilder(requireContext()); @@ -59,8 +62,11 @@ public class GamePropertiesDialog extends DialogFragment GameDetailsDialog.newInstance(path).show(requireActivity() .getSupportFragmentManager(), "game_details")); - itemsBuilder.add(R.string.properties_convert, (dialog, i) -> - ConvertActivity.launch(getContext(), path)); + if (shouldAllowConversion) + { + itemsBuilder.add(R.string.properties_convert, (dialog, i) -> + ConvertActivity.launch(getContext(), path)); + } itemsBuilder.add(R.string.properties_set_default_iso, (dialog, i) -> { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java index c0b55f5da7..9ac331c2b2 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java @@ -48,6 +48,8 @@ public class GameFile public native boolean shouldShowFileFormatDetails(); + public native boolean shouldAllowConversion(); + public native long getFileSize(); public native boolean isDatelDisc(); diff --git a/Source/Android/jni/GameList/GameFile.cpp b/Source/Android/jni/GameList/GameFile.cpp index 31c95fc48d..21e8aa24aa 100644 --- a/Source/Android/jni/GameList/GameFile.cpp +++ b/Source/Android/jni/GameList/GameFile.cpp @@ -73,6 +73,8 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env, jobject obj); JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj); +JNIEXPORT jboolean JNICALL +Java_org_dolphinemu_dolphinemu_model_GameFile_shouldAllowConversion(JNIEnv* env, jobject obj); JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env, jobject obj); JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isDatelDisc(JNIEnv* env, @@ -188,6 +190,12 @@ Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv return static_cast(GetRef(env, obj)->ShouldShowFileFormatDetails()); } +JNIEXPORT jboolean JNICALL +Java_org_dolphinemu_dolphinemu_model_GameFile_shouldAllowConversion(JNIEnv* env, jobject obj) +{ + return static_cast(GetRef(env, obj)->ShouldAllowConversion()); +} + JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env, jobject obj) { -- cgit v1.2.3