Revert "(Android) show message on ROM load failure/crash"

This reverts commit 41a302de43.
This commit is contained in:
twinaphex 2013-02-27 04:29:01 +01:00
parent a34c93e58f
commit c85a20a0b1
3 changed files with 2 additions and 55 deletions

View File

@ -59,13 +59,11 @@ public class RetroArch extends Activity implements
AdapterView.OnItemClickListener {
private IconAdapter<ModuleWrapper> 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;
}
}

View File

@ -19,7 +19,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/resource.h>
#include <byteswap.h>
#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);

View File

@ -49,7 +49,6 @@ struct android_app
AInputQueue* pendingInputQueue;
ANativeWindow* pendingWindow;
char current_ime[PATH_MAX];
char return_file[PATH_MAX];
};
enum {