From 9bb85ca70619f08d9349f798f9c204c08df5b2d9 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 2 Oct 2021 11:09:36 +0200 Subject: DolphinQt/Android: Add warning when converting NKit files Yes, that's right! It's time to add even more NKit warnings, because users still don't understand what NKit is or how it works! More specifically, some users seem to be under the impression that converting an NKit file to for instance RVZ using Dolphin's convert feature will result in a normal RVZ file, when it in fact results in an NKit RVZ file (since NKit is not a container format in the sense that GCZ/WIA/RVZ/WBFS/CISO is, but rather a kind of trimmed ISO). I can hardly blame users for not knowing this, because it's not intuitive unless you know the technical details of how NKit works. --- .../dolphinemu/fragments/ConvertFragment.java | 49 +++++++++++++--------- .../org/dolphinemu/dolphinemu/model/GameFile.java | 2 + 2 files changed, 32 insertions(+), 19 deletions(-) (limited to 'Source/Android/app/src/main/java') diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/ConvertFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/ConvertFragment.java index cb0f045a30..d1f09bbd50 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/ConvertFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/ConvertFragment.java @@ -27,6 +27,7 @@ import java.io.File; import java.util.ArrayList; import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.Fragment; @@ -331,32 +332,42 @@ public class ConvertFragment extends Fragment implements View.OnClickListener @Override public void onClick(View view) { - Context context = requireContext(); - boolean scrub = getRemoveJunkData(); - int format = mFormat.getValue(context); + int format = mFormat.getValue(requireContext()); - boolean iso_warning = scrub && format == BLOB_TYPE_PLAIN; - boolean gcz_warning = !scrub && format == BLOB_TYPE_GCZ && !gameFile.isDatelDisc() && - gameFile.getPlatform() == Platform.WII.toInt(); + Runnable action = this::showSavePrompt; - if (iso_warning || gcz_warning) + if (gameFile.isNKit()) { - AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase); - builder.setMessage(iso_warning ? R.string.convert_warning_iso : R.string.convert_warning_gcz) - .setPositiveButton(R.string.yes, (dialog, i) -> - { - dialog.dismiss(); - showSavePrompt(); - }) - .setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss()); - AlertDialog alert = builder.create(); - alert.show(); + action = addAreYouSureDialog(action, R.string.convert_warning_nkit); + } + + if (!scrub && format == BLOB_TYPE_GCZ && !gameFile.isDatelDisc() && + gameFile.getPlatform() == Platform.WII.toInt()) + { + action = addAreYouSureDialog(action, R.string.convert_warning_gcz); } - else + + if (scrub && format == BLOB_TYPE_PLAIN) { - showSavePrompt(); + action = addAreYouSureDialog(action, R.string.convert_warning_iso); } + + action.run(); + } + + private Runnable addAreYouSureDialog(Runnable action, @StringRes int warning_text) + { + return () -> + { + Context context = requireContext(); + AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase); + builder.setMessage(warning_text) + .setPositiveButton(R.string.yes, (dialog, i) -> action.run()) + .setNegativeButton(R.string.no, null); + AlertDialog alert = builder.create(); + alert.show(); + }; } private void showSavePrompt() 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 93f6f120b3..b8de619e31 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 @@ -60,6 +60,8 @@ public class GameFile public native boolean isDatelDisc(); + public native boolean isNKit(); + public native int[] getBanner(); public native int getBannerWidth(); -- cgit v1.2.3