From 2d6d0c86cc71a1d3b1a2b865c6abd8cb7ace8665 Mon Sep 17 00:00:00 2001 From: Ryan Meredith Date: Fri, 17 Apr 2020 05:25:08 -0400 Subject: [PATCH] Android: Add Install WAD to menu_game_grid --- .../dolphinemu/dolphinemu/NativeLibrary.java | 2 ++ .../features/settings/ui/SettingsAdapter.java | 3 +++ .../dolphinemu/ui/main/MainActivity.java | 15 +++++++++++++++ .../dolphinemu/ui/main/MainPresenter.java | 19 +++++++++++++++++++ .../dolphinemu/ui/main/MainView.java | 2 ++ .../dolphinemu/ui/main/TvMainActivity.java | 15 +++++++++++++++ .../dolphinemu/utils/FileBrowserHelper.java | 3 +++ .../app/src/main/res/menu/menu_game_grid.xml | 12 +++++++++--- .../app/src/main/res/values/strings.xml | 4 ++++ Source/Android/jni/MainAndroid.cpp | 9 +++++++++ 10 files changed, 81 insertions(+), 3 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index f04fee5c67..89ded1289d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -447,6 +447,8 @@ public final class NativeLibrary public static native void ReloadWiimoteConfig(); + public static native boolean InstallWAD(String file); + private static boolean alertResult = false; public static boolean displayAlertMsg(final String caption, final String text, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java index 30e410bb5b..001bba3b5e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java @@ -322,6 +322,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter RAW_EXTENSION = new HashSet<>(Collections.singletonList( "raw")); + public static final HashSet WAD_EXTENSION = new HashSet<>(Collections.singletonList( + "wad")); + public static void openDirectoryPicker(FragmentActivity activity, HashSet extensions) { Intent i = new Intent(activity, CustomFilePickerActivity.class); diff --git a/Source/Android/app/src/main/res/menu/menu_game_grid.xml b/Source/Android/app/src/main/res/menu/menu_game_grid.xml index 72facc4eaa..43b835b294 100644 --- a/Source/Android/app/src/main/res/menu/menu_game_grid.xml +++ b/Source/Android/app/src/main/res/menu/menu_game_grid.xml @@ -31,10 +31,16 @@ android:title="@string/grid_menu_refresh" android:icon="@drawable/ic_refresh" app:showAsAction="ifRoom"/> + + android:title="@string/grid_menu_open_file" + app:showAsAction="ifRoom"/> - \ No newline at end of file + + + diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 74a6399d27..c508beb4c6 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -288,6 +288,10 @@ GameCube Input Wii Input Refresh Library + Open File + Install WAD + Successfully installed this title to the NAND. + Failed to install this title to the NAND. Add Folder to Library diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 122f3fd6d9..adcba61345 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -43,6 +43,7 @@ #include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/Profiler.h" #include "Core/State.h" +#include "Core/WiiUtils.h" #include "DiscIO/Enums.h" #include "DiscIO/Volume.h" @@ -733,6 +734,14 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(J Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(path); }); } +JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallWAD(JNIEnv* env, + jobject obj, + jstring jFile) +{ + const std::string path = GetJString(env, jFile); + return static_cast(WiiUtils::InstallWAD(path)); +} + #ifdef __cplusplus } #endif