summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-10-02 11:09:36 +0200
committerJosJuice <josjuice@gmail.com>2021-10-02 11:09:36 +0200
commit9bb85ca70619f08d9349f798f9c204c08df5b2d9 (patch)
treedd52f4215e053f7a50e2529dd7cadca309bee01f /Source/Android/app/src/main/java
parentbb367394cfd3a07c981b843418ff227ac1d9e2ba (diff)
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.
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/ConvertFragment.java49
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java2
2 files changed, 32 insertions, 19 deletions
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();