Skip to content

Commit

Permalink
Merge pull request #5969 from JosJuice/android-filename
Browse files Browse the repository at this point in the history
MainAndroid: Remove s_filename
  • Loading branch information
leoetlino committed Aug 28, 2017
2 parents 378416f + f8703f9 commit 1705d15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,6 @@ private 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.
*
Expand Down Expand Up @@ -328,7 +321,7 @@ private NativeLibrary()
/**
* Begins emulation.
*/
public static native void Run();
public static native void Run(String path);

// Surface Handling
public static native void SurfaceChanged(Surface surf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public void onCreate(Bundle savedInstanceState)
@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);
Expand Down Expand Up @@ -241,7 +238,8 @@ public void run()
Log.info("[EmulationFragment] Starting emulation: " + mSurface);

// Start emulation using the provided Surface.
NativeLibrary.Run();
String path = getArguments().getString(ARGUMENT_GAME_PATH);
NativeLibrary.Run(path);
}
};

Expand Down
19 changes: 7 additions & 12 deletions Source/Android/jni/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 1705d15

Please sign in to comment.