summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-08-23 22:32:23 +0200
committerJosJuice <josjuice@gmail.com>2017-08-23 22:36:21 +0200
commitf8703f90e309303fea272a0078abc4e3fa4167ed (patch)
treeeda14ce765210f22e23dc6ca0fa1a02e8ce02476 /Source
parent4ee85a3e076f8f5569809542b8d8a8869b9b47f9 (diff)
MainAndroid: Remove s_filename
This fits better as a function parameter than as global state.
Diffstat (limited to 'Source')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java9
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java6
-rw-r--r--Source/Android/jni/MainAndroid.cpp19
3 files changed, 10 insertions, 24 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 bb9a75194b..de821f105c 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
@@ -247,13 +247,6 @@ public final class NativeLibrary
public static native void SetConfig(String configFile, String Section, String Key, String Value);
/**
- * Sets the filename to be run during emulation.
- *
- * @param filename The filename to be run during emulation.
- */
- public static native void SetFilename(String filename);
-
- /**
* Gets the embedded banner within the given ISO/ROM.
*
* @param filename the file path to the ISO/ROM.
@@ -328,7 +321,7 @@ public final class NativeLibrary
/**
* Begins emulation.
*/
- public static native void Run();
+ public static native void Run(String path);
// Surface Handling
public static native void SurfaceChanged(Surface surf);
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
index 7066b34c65..5bf1a7d677 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java
@@ -66,9 +66,6 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
- String path = getArguments().getString(ARGUMENT_GAME_PATH);
- NativeLibrary.SetFilename(path);
-
View contents = inflater.inflate(R.layout.fragment_emulation, container, false);
SurfaceView surfaceView = (SurfaceView) contents.findViewById(R.id.surface_emulation);
@@ -241,7 +238,8 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
Log.info("[EmulationFragment] Starting emulation: " + mSurface);
// Start emulation using the provided Surface.
- NativeLibrary.Run();
+ String path = getArguments().getString(ARGUMENT_GAME_PATH);
+ NativeLibrary.Run(path);
}
};
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp
index 07846711e6..37795ab131 100644
--- a/Source/Android/jni/MainAndroid.cpp
+++ b/Source/Android/jni/MainAndroid.cpp
@@ -53,7 +53,6 @@ JavaVM* g_java_vm;
namespace
{
ANativeWindow* s_surf;
-std::string s_filename;
std::string s_set_userpath;
jclass s_jni_class;
@@ -466,7 +465,8 @@ JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj);
-JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj);
+JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
+ jstring jFile);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
jobject obj,
jobject surf);
@@ -633,13 +633,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(
ini.Save(File::GetUserPath(D_CONFIG_IDX) + std::string(file));
}
-JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv* env,
- jobject obj,
- jstring jFile)
-{
- s_filename = GetJString(env, jFile);
-}
-
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
jobject obj,
jint slot)
@@ -773,9 +766,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo
WiimoteReal::Refresh();
}
-JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj)
+JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj,
+ jstring jFile)
{
- __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", s_filename.c_str());
+ const std::string path = GetJString(env, jFile);
+ __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", path.c_str());
// Install our callbacks
OSD::AddCallback(OSD::CallbackType::Initialization, ButtonManager::Init);
@@ -791,7 +786,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv*
// No use running the loop when booting fails
s_have_wm_user_stop = false;
- if (BootManager::BootCore(BootParameters::GenerateFromFile(s_filename)))
+ if (BootManager::BootCore(BootParameters::GenerateFromFile(path)))
{
static constexpr int TIMEOUT = 10000;
static constexpr int WAIT_STEP = 25;