diff options
| author | JosJuice <josjuice@gmail.com> | 2021-10-02 11:09:36 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-10-02 11:09:36 +0200 |
| commit | 9bb85ca70619f08d9349f798f9c204c08df5b2d9 (patch) | |
| tree | dd52f4215e053f7a50e2529dd7cadca309bee01f /Source/Android | |
| parent | bb367394cfd3a07c981b843418ff227ac1d9e2ba (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')
4 files changed, 39 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(); diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 0f3e8dfbff..581e2bccfb 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -425,6 +425,7 @@ <string name="convert_converting">Converting</string> <string name="convert_warning_iso">Removing junk data does not save any space when converting to ISO (unless you package the ISO file in a compressed file format such as ZIP afterwards). Do you want to continue anyway?</string> <string name="convert_warning_gcz">Converting Wii disc images to GCZ without removing junk data does not save any noticeable amount of space compared to converting to ISO. Do you want to continue anyway?</string> + <string name="convert_warning_nkit">Dolphin can\'t convert NKit files to non-NKit files. Converting an NKit file in Dolphin will result in another NKit file.\n\nIf you want to convert an NKit file to a non-NKit file, you can use the same program as you originally used when converting the file to the NKit format.\n\nDo you want to continue anyway?</string> <string name="convert_success_message">The disc image was successfully converted.</string> <string name="convert_failure_message">Dolphin failed to complete the requested action.</string> <string name="convert_format_info"> diff --git a/Source/Android/jni/GameList/GameFile.cpp b/Source/Android/jni/GameList/GameFile.cpp index 5cc3d6c391..e62052966d 100644 --- a/Source/Android/jni/GameList/GameFile.cpp +++ b/Source/Android/jni/GameList/GameFile.cpp @@ -162,6 +162,12 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isDatel return static_cast<jboolean>(GetRef(env, obj)->IsDatelDisc()); } +JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isNKit(JNIEnv* env, + jobject obj) +{ + return static_cast<jboolean>(GetRef(env, obj)->IsNKit()); +} + JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env, jobject obj) { |
