mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Android: Add Install WAD to menu_game_grid
This commit is contained in:
parent
c9aab4f809
commit
2d6d0c86cc
@ -447,6 +447,8 @@ public final class NativeLibrary
|
|||||||
|
|
||||||
public static native void ReloadWiimoteConfig();
|
public static native void ReloadWiimoteConfig();
|
||||||
|
|
||||||
|
public static native boolean InstallWAD(String file);
|
||||||
|
|
||||||
private static boolean alertResult = false;
|
private static boolean alertResult = false;
|
||||||
|
|
||||||
public static boolean displayAlertMsg(final String caption, final String text,
|
public static boolean displayAlertMsg(final String caption, final String text,
|
||||||
|
@ -322,6 +322,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||||||
case MainPresenter.REQUEST_GAME_FILE:
|
case MainPresenter.REQUEST_GAME_FILE:
|
||||||
extensions = FileBrowserHelper.GAME_EXTENSIONS;
|
extensions = FileBrowserHelper.GAME_EXTENSIONS;
|
||||||
break;
|
break;
|
||||||
|
case MainPresenter.REQUEST_WAD_FILE:
|
||||||
|
extensions = FileBrowserHelper.WAD_EXTENSION;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidParameterException("Unhandled request code");
|
throw new InvalidParameterException("Unhandled request code");
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,13 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
|||||||
FileBrowserHelper.GAME_EXTENSIONS);
|
FileBrowserHelper.GAME_EXTENSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchInstallWAD()
|
||||||
|
{
|
||||||
|
FileBrowserHelper.openFilePicker(this, MainPresenter.REQUEST_WAD_FILE, false,
|
||||||
|
FileBrowserHelper.WAD_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param requestCode An int describing whether the Activity that is returning did so successfully.
|
* @param requestCode An int describing whether the Activity that is returning did so successfully.
|
||||||
* @param resultCode An int describing what Activity is giving us this callback.
|
* @param resultCode An int describing what Activity is giving us this callback.
|
||||||
@ -181,6 +188,14 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
|||||||
EmulationActivity.launchFile(this, FileBrowserHelper.getSelectedFiles(result));
|
EmulationActivity.launchFile(this, FileBrowserHelper.getSelectedFiles(result));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MainPresenter.REQUEST_WAD_FILE:
|
||||||
|
// If the user picked a file, as opposed to just backing out.
|
||||||
|
if (resultCode == MainActivity.RESULT_OK)
|
||||||
|
{
|
||||||
|
mPresenter.installWAD(FileBrowserHelper.getSelectedPath(result));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,12 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||||
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||||
import org.dolphinemu.dolphinemu.model.GameFileCache;
|
import org.dolphinemu.dolphinemu.model.GameFileCache;
|
||||||
@ -18,6 +20,7 @@ public final class MainPresenter
|
|||||||
public static final int REQUEST_DIRECTORY = 1;
|
public static final int REQUEST_DIRECTORY = 1;
|
||||||
public static final int REQUEST_GAME_FILE = 2;
|
public static final int REQUEST_GAME_FILE = 2;
|
||||||
public static final int REQUEST_SD_FILE = 3;
|
public static final int REQUEST_SD_FILE = 3;
|
||||||
|
public static final int REQUEST_WAD_FILE = 4;
|
||||||
|
|
||||||
private final MainView mView;
|
private final MainView mView;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@ -92,6 +95,10 @@ public final class MainPresenter
|
|||||||
case R.id.menu_open_file:
|
case R.id.menu_open_file:
|
||||||
mView.launchOpenFileActivity();
|
mView.launchOpenFileActivity();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.menu_install_wad:
|
||||||
|
mView.launchInstallWAD();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -111,4 +118,16 @@ public final class MainPresenter
|
|||||||
{
|
{
|
||||||
mDirToAdd = dir;
|
mDirToAdd = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void installWAD(String file)
|
||||||
|
{
|
||||||
|
if (NativeLibrary.InstallWAD(file))
|
||||||
|
{
|
||||||
|
Toast.makeText(mContext, R.string.wad_install_success, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Toast.makeText(mContext, R.string.wad_install_failure, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ public interface MainView
|
|||||||
|
|
||||||
void launchOpenFileActivity();
|
void launchOpenFileActivity();
|
||||||
|
|
||||||
|
void launchInstallWAD();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be called when the game file cache is updated.
|
* To be called when the game file cache is updated.
|
||||||
*/
|
*/
|
||||||
|
@ -150,6 +150,13 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
|||||||
FileBrowserHelper.GAME_EXTENSIONS);
|
FileBrowserHelper.GAME_EXTENSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchInstallWAD()
|
||||||
|
{
|
||||||
|
FileBrowserHelper.openFilePicker(this, MainPresenter.REQUEST_WAD_FILE, false,
|
||||||
|
FileBrowserHelper.WAD_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showGames()
|
public void showGames()
|
||||||
{
|
{
|
||||||
@ -187,6 +194,14 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
|||||||
EmulationActivity.launchFile(this, FileBrowserHelper.getSelectedFiles(result));
|
EmulationActivity.launchFile(this, FileBrowserHelper.getSelectedFiles(result));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MainPresenter.REQUEST_WAD_FILE:
|
||||||
|
// If the user picked a file, as opposed to just backing out.
|
||||||
|
if (resultCode == MainActivity.RESULT_OK)
|
||||||
|
{
|
||||||
|
mPresenter.installWAD(FileBrowserHelper.getSelectedPath(result));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ public final class FileBrowserHelper
|
|||||||
public static final HashSet<String> RAW_EXTENSION = new HashSet<>(Collections.singletonList(
|
public static final HashSet<String> RAW_EXTENSION = new HashSet<>(Collections.singletonList(
|
||||||
"raw"));
|
"raw"));
|
||||||
|
|
||||||
|
public static final HashSet<String> WAD_EXTENSION = new HashSet<>(Collections.singletonList(
|
||||||
|
"wad"));
|
||||||
|
|
||||||
public static void openDirectoryPicker(FragmentActivity activity, HashSet<String> extensions)
|
public static void openDirectoryPicker(FragmentActivity activity, HashSet<String> extensions)
|
||||||
{
|
{
|
||||||
Intent i = new Intent(activity, CustomFilePickerActivity.class);
|
Intent i = new Intent(activity, CustomFilePickerActivity.class);
|
||||||
|
@ -31,10 +31,16 @@
|
|||||||
android:title="@string/grid_menu_refresh"
|
android:title="@string/grid_menu_refresh"
|
||||||
android:icon="@drawable/ic_refresh"
|
android:icon="@drawable/ic_refresh"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_open_file"
|
android:id="@+id/menu_open_file"
|
||||||
android:icon="@android:drawable/ic_media_play"
|
android:icon="@android:drawable/ic_media_play"
|
||||||
android:title="Open File"
|
android:title="@string/grid_menu_open_file"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_install_wad"
|
||||||
|
android:title="@string/grid_menu_install_wad"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -288,6 +288,10 @@
|
|||||||
<string name="grid_menu_gcpad_settings">GameCube Input</string>
|
<string name="grid_menu_gcpad_settings">GameCube Input</string>
|
||||||
<string name="grid_menu_wiimote_settings">Wii Input</string>
|
<string name="grid_menu_wiimote_settings">Wii Input</string>
|
||||||
<string name="grid_menu_refresh">Refresh Library</string>
|
<string name="grid_menu_refresh">Refresh Library</string>
|
||||||
|
<string name="grid_menu_open_file">Open File</string>
|
||||||
|
<string name="grid_menu_install_wad">Install WAD</string>
|
||||||
|
<string name="wad_install_success">Successfully installed this title to the NAND.</string>
|
||||||
|
<string name="wad_install_failure">Failed to install this title to the NAND.</string>
|
||||||
|
|
||||||
<!-- Add Directory Screen-->
|
<!-- Add Directory Screen-->
|
||||||
<string name="add_directory_title">Add Folder to Library</string>
|
<string name="add_directory_title">Add Folder to Library</string>
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/PowerPC/Profiler.h"
|
#include "Core/PowerPC/Profiler.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/WiiUtils.h"
|
||||||
|
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DiscIO/Volume.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); });
|
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<jboolean>(WiiUtils::InstallWAD(path));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user