From c85a20a0b1c8a022a909dc09daa0c4f62e3d32bd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Feb 2013 04:29:01 +0100 Subject: [PATCH] Revert "(Android) show message on ROM load failure/crash" This reverts commit 41a302de43dc7770639159b39d89c4250e1fb8c9. --- .../src/org/retroarch/browser/RetroArch.java | 33 ++----------------- frontend/frontend_android.c | 23 ------------- frontend/frontend_android.h | 1 - 3 files changed, 2 insertions(+), 55 deletions(-) diff --git a/android/phoenix/src/org/retroarch/browser/RetroArch.java b/android/phoenix/src/org/retroarch/browser/RetroArch.java index 03bc47adc6..53cc797b03 100644 --- a/android/phoenix/src/org/retroarch/browser/RetroArch.java +++ b/android/phoenix/src/org/retroarch/browser/RetroArch.java @@ -59,13 +59,11 @@ public class RetroArch extends Activity implements AdapterView.OnItemClickListener { private IconAdapter adapter; static private final int ACTIVITY_LOAD_ROM = 0; - static private final int ACTIVITY_NATIVE_ACTIVITY = 1; static private String libretro_path; static private Double report_refreshrate; static private final String TAG = "RetroArch-Phoenix"; private ConfigFile config; private ConfigFile core_config; - private String return_file; private final double getDisplayRefreshRate() { // Android is *very* likely to screw this up. @@ -284,12 +282,6 @@ public class RetroArch extends Activity implements } } - if (getCacheDir() != null && getCacheDir().getAbsolutePath() != null) { - return_file = getCacheDir().getAbsolutePath() + File.pathSeparator + ".return"; - } else { - return_file = getDefaultConfigPath() + ".ret"; - } - this.setVolumeControlStream(AudioManager.STREAM_MUSIC); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { @@ -356,7 +348,7 @@ public class RetroArch extends Activity implements else if (getCacheDir() != null && getCacheDir().getAbsolutePath() != null) return getCacheDir().getAbsolutePath() + File.separator + "retroarch.cfg"; else // emergency fallback, all else failed - return "/mnt/sdcard/retroarch.cfg"; + return "/mnt/sd/retroarch.cfg"; } private void updateConfigFile() { @@ -460,7 +452,6 @@ public class RetroArch extends Activity implements switch (requestCode) { case ACTIVITY_LOAD_ROM: if (data.getStringExtra("PATH") != null) { - new File(return_file).delete(); Toast.makeText(this, "Loading: [" + data.getStringExtra("PATH") + "]...", Toast.LENGTH_SHORT).show(); @@ -468,30 +459,10 @@ public class RetroArch extends Activity implements myIntent.putExtra("ROM", data.getStringExtra("PATH")); myIntent.putExtra("LIBRETRO", libretro_path); myIntent.putExtra("CONFIGFILE", getDefaultConfigPath()); - myIntent.putExtra("RETURN", return_file); myIntent.putExtra("IME", current_ime); - startActivityForResult(myIntent, ACTIVITY_NATIVE_ACTIVITY); + startActivity(myIntent); } break; - case ACTIVITY_NATIVE_ACTIVITY: - Log.i(TAG, "native return"); - AlertDialog.Builder builder = new AlertDialog.Builder(this).setNeutralButton("OK", null); - try { - DataInputStream cacheStream = new DataInputStream(new FileInputStream(return_file)); - int value = cacheStream.readInt(); - cacheStream.close(); - Log.i(TAG, "native return value"); - Log.i(TAG, "native return value:" + value); - if (value != 0) { - builder.setTitle("Error").setMessage("RetroArch Could not load the chosen ROM").show(); - } - } catch (FileNotFoundException e) { - builder.setTitle("Crash").setMessage("RetroArch Crashed").show(); - } catch (IOException e) { - builder.setTitle("Error").setMessage("RetroArch Could not load the chosen ROM").show(); - } - new File(return_file).delete(); - break; } } diff --git a/frontend/frontend_android.c b/frontend/frontend_android.c index cf3ae7b336..cee92d11dc 100644 --- a/frontend/frontend_android.c +++ b/frontend/frontend_android.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "frontend_android.h" #include "../android/native/jni/jni_macros.h" @@ -281,12 +280,6 @@ static bool android_app_start_main(struct android_app *android_app, int *init_re strlcpy(out_args.in, "IME", sizeof(out_args.in)); jni_get(&in_params, &out_args); - // Return value file - out_args.out = android_app->return_file; - out_args.out_sizeof = sizeof(android_app->return_file); - strlcpy(out_args.in, "RETURN", sizeof(out_args.in)); - jni_get(&in_params, &out_args); - (*in_params.java_vm)->DetachCurrentThread(in_params.java_vm); RARCH_LOG("Checking arguments passed ...\n"); @@ -294,9 +287,6 @@ static bool android_app_start_main(struct android_app *android_app, int *init_re RARCH_LOG("Libretro path: [%s].\n", libretro_path); RARCH_LOG("Config file: [%s].\n", config_file); RARCH_LOG("Current IME: [%s].\n", android_app->current_ime); - RARCH_LOG("Return file: [%s].\n", android_app->return_file); - - unlink(android_app->return_file); struct rarch_main_wrap args = {0}; @@ -381,19 +371,6 @@ exit: #endif rarch_main_clear_state(); - int bs_return = bswap_32(init_ret); - FILE *return_file = fopen(android_app->return_file, "w"); - if (return_file) - { - fwrite(&bs_return, 4, 1, return_file); - fclose(return_file); - } - - // returning from the native activity too fast can make the Java frontend not reappear - // work around it only if we fail to load the ROM - if (init_ret != 0) - usleep(1000000); - RARCH_LOG("android_app_destroy!"); if (android_app->inputQueue != NULL) AInputQueue_detachLooper(android_app->inputQueue); diff --git a/frontend/frontend_android.h b/frontend/frontend_android.h index 591493705a..16e6f21f9f 100644 --- a/frontend/frontend_android.h +++ b/frontend/frontend_android.h @@ -49,7 +49,6 @@ struct android_app AInputQueue* pendingInputQueue; ANativeWindow* pendingWindow; char current_ime[PATH_MAX]; - char return_file[PATH_MAX]; }; enum {