Android: Move InstallWAD to a new WiiUtils class
I'm trying to move away from dumping every native method in NativeLibrary.
This commit is contained in:
parent
2ada5b422d
commit
80b56b6575
|
@ -444,8 +444,6 @@ public final class NativeLibrary
|
|||
|
||||
public static native void ReloadLoggerConfig();
|
||||
|
||||
public static native boolean InstallWAD(String file);
|
||||
|
||||
public static native boolean ConvertDiscImage(String inPath, String outPath, int platform,
|
||||
int format, int blockSize, int compression, int compressionLevel, boolean scrub,
|
||||
CompressCallback callback);
|
||||
|
|
|
@ -13,7 +13,6 @@ import androidx.appcompat.app.AlertDialog;
|
|||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
|
@ -22,9 +21,9 @@ import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
|||
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
|
||||
import org.dolphinemu.dolphinemu.utils.ContentHandler;
|
||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||
import org.dolphinemu.dolphinemu.utils.WiiUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
public final class MainPresenter
|
||||
{
|
||||
|
@ -162,7 +161,7 @@ public final class MainPresenter
|
|||
|
||||
Thread installWADThread = new Thread(() ->
|
||||
{
|
||||
if (NativeLibrary.InstallWAD(file))
|
||||
if (WiiUtils.installWAD(file))
|
||||
{
|
||||
mainPresenterActivity.runOnUiThread(
|
||||
() -> Toast.makeText(mContext, R.string.wad_install_success, Toast.LENGTH_SHORT)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.utils;
|
||||
|
||||
public final class WiiUtils
|
||||
{
|
||||
public static native boolean installWAD(String file);
|
||||
}
|
|
@ -5,6 +5,7 @@ add_library(main SHARED
|
|||
IniFile.cpp
|
||||
MainAndroid.cpp
|
||||
NativeConfig.cpp
|
||||
WiiUtils.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/PowerPC/Profiler.h"
|
||||
#include "Core/State.h"
|
||||
#include "Core/WiiUtils.h"
|
||||
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
|
@ -596,14 +595,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadLogger
|
|||
Common::Log::LogManager::Init();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallWAD(JNIEnv* env,
|
||||
jclass,
|
||||
jstring jFile)
|
||||
{
|
||||
const std::string path = GetJString(env, jFile);
|
||||
return static_cast<jboolean>(WiiUtils::InstallWAD(path));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ConvertDiscImage(
|
||||
JNIEnv* env, jclass, jstring jInPath, jstring jOutPath, jint jPlatform, jint jFormat,
|
||||
jint jBlockSize, jint jCompression, jint jCompressionLevel, jboolean jScrub, jobject jCallback)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2021 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
|
||||
#include "Core/WiiUtils.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_utils_WiiUtils_installWAD(JNIEnv* env,
|
||||
jclass,
|
||||
jstring jFile)
|
||||
{
|
||||
const std::string path = GetJString(env, jFile);
|
||||
return static_cast<jboolean>(WiiUtils::InstallWAD(path));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue