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.
This commit is contained in:
JosJuice 2021-10-02 11:09:36 +02:00
parent bb367394cf
commit 9bb85ca706
6 changed files with 55 additions and 19 deletions

View File

@ -27,6 +27,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -331,32 +332,42 @@ public class ConvertFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onClick(View view) public void onClick(View view)
{ {
Context context = requireContext();
boolean scrub = getRemoveJunkData(); boolean scrub = getRemoveJunkData();
int format = mFormat.getValue(context); int format = mFormat.getValue(requireContext());
boolean iso_warning = scrub && format == BLOB_TYPE_PLAIN; Runnable action = this::showSavePrompt;
boolean gcz_warning = !scrub && format == BLOB_TYPE_GCZ && !gameFile.isDatelDisc() &&
gameFile.getPlatform() == Platform.WII.toInt();
if (iso_warning || gcz_warning) if (gameFile.isNKit())
{ {
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);
}
if (scrub && format == BLOB_TYPE_PLAIN)
{
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); AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase);
builder.setMessage(iso_warning ? R.string.convert_warning_iso : R.string.convert_warning_gcz) builder.setMessage(warning_text)
.setPositiveButton(R.string.yes, (dialog, i) -> .setPositiveButton(R.string.yes, (dialog, i) -> action.run())
{ .setNegativeButton(R.string.no, null);
dialog.dismiss();
showSavePrompt();
})
.setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss());
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} };
else
{
showSavePrompt();
}
} }
private void showSavePrompt() private void showSavePrompt()

View File

@ -60,6 +60,8 @@ public class GameFile
public native boolean isDatelDisc(); public native boolean isDatelDisc();
public native boolean isNKit();
public native int[] getBanner(); public native int[] getBanner();
public native int getBannerWidth(); public native int getBannerWidth();

View File

@ -425,6 +425,7 @@
<string name="convert_converting">Converting</string> <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_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_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_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_failure_message">Dolphin failed to complete the requested action.</string>
<string name="convert_format_info"> <string name="convert_format_info">

View File

@ -162,6 +162,12 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isDatel
return static_cast<jboolean>(GetRef(env, obj)->IsDatelDisc()); 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, JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
jobject obj) jobject obj)
{ {

View File

@ -329,6 +329,21 @@ void ConvertDialog::Convert()
} }
} }
if (std::any_of(m_files.begin(), m_files.end(), std::mem_fn(&UICommon::GameFile::IsNKit)))
{
if (!ShowAreYouSureDialog(
tr("Dolphin can't convert NKit files to non-NKit files. Converting an NKit file in "
"Dolphin will result in another NKit file.\n"
"\n"
"If 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"
"\n"
"Do you want to continue anyway?")))
{
return;
}
}
QString extension; QString extension;
QString filter; QString filter;
switch (format) switch (format)

View File

@ -106,6 +106,7 @@ public:
u64 GetVolumeSize() const { return m_volume_size; } u64 GetVolumeSize() const { return m_volume_size; }
bool IsVolumeSizeAccurate() const { return m_volume_size_is_accurate; } bool IsVolumeSizeAccurate() const { return m_volume_size_is_accurate; }
bool IsDatelDisc() const { return m_is_datel_disc; } bool IsDatelDisc() const { return m_is_datel_disc; }
bool IsNKit() const { return m_is_nkit; }
const GameBanner& GetBannerImage() const; const GameBanner& GetBannerImage() const;
const GameCover& GetCoverImage() const; const GameCover& GetCoverImage() const;
void DoState(PointerWrap& p); void DoState(PointerWrap& p);