(Android) Add "USED" intent extra to RetroActivity

This commit is contained in:
twinaphex 2013-11-24 17:58:23 +01:00
parent 4c4c828c02
commit 1d06b07a16
3 changed files with 27 additions and 18 deletions

View File

@ -101,12 +101,13 @@ public final class HistorySelection extends DialogFragment
String current_ime = Settings.Secure.getString(ctx.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(ctx, String.format(getString(R.string.loading_gamepath), gamePath), Toast.LENGTH_SHORT).show();
Intent myIntent = new Intent(ctx, RetroActivity.class);
myIntent.putExtra("ROM", gamePath);
myIntent.putExtra("LIBRETRO", corePath);
myIntent.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
myIntent.putExtra("IME", current_ime);
startActivity(myIntent);
Intent retro = new Intent(ctx, RetroActivity.class);
retro.putExtra("ROM", gamePath);
retro.putExtra("LIBRETRO", corePath);
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
retro.putExtra("IME", current_ime);
retro.putExtra("USED", "false");
startActivity(retro);
dismiss();
}
};

View File

@ -336,12 +336,13 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
final String libretro_path = prefs.getString("libretro_path", ctx.getApplicationInfo().dataDir + "/cores");
final Intent rgui = new Intent(ctx, RetroActivity.class);
final Intent retro = new Intent(ctx, RetroActivity.class);
final String current_ime = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
rgui.putExtra("LIBRETRO", libretro_path);
rgui.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
rgui.putExtra("IME", current_ime);
startActivity(rgui);
retro.putExtra("LIBRETRO", libretro_path);
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
retro.putExtra("IME", current_ime);
retro.putExtra("USED", "false");
startActivity(retro);
}
// Load Core Preference
else if (prefKey.equals("loadCorePref"))
@ -396,6 +397,7 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
retro.putExtra("LIBRETRO", libretro_path);
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
retro.putExtra("IME", current_ime);
retro.putExtra("USED", "false");
startActivity(retro);
}
}

View File

@ -391,10 +391,10 @@ static void get_environment_settings(int argc, char *argv[], void *data)
return;
CALL_OBJ_METHOD(env, obj, android_app->activity->clazz, android_app->getIntent);
RARCH_LOG("Checking arguments passed from intent...\n");
// ROM
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "ROM"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
@ -402,11 +402,11 @@ static void get_environment_settings(int argc, char *argv[], void *data)
(*env)->ReleaseStringUTFChars(env, jstr, argv);
valschanged = true;
RARCH_LOG("ROM Filename: [%s].\n", g_extern.fullpath);
}
// Config file
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "CONFIGFILE"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
@ -414,11 +414,11 @@ static void get_environment_settings(int argc, char *argv[], void *data)
(*env)->ReleaseStringUTFChars(env, jstr, argv);
valschanged = true;
RARCH_LOG("Config file: [%s].\n", g_extern.config_path);
}
// Current IME
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "IME"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
@ -426,12 +426,18 @@ static void get_environment_settings(int argc, char *argv[], void *data)
(*env)->ReleaseStringUTFChars(env, jstr, argv);
valschanged = true;
RARCH_LOG("Current IME: [%s].\n", android_app->current_ime);
}
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "USED"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
bool used = (strcmp(argv, "false") == 0) ? false : true;
RARCH_LOG("USED: [%s].\n", used ? "true" : "false");
(*env)->ReleaseStringUTFChars(env, jstr, argv);
}
RARCH_LOG("Checking arguments passed from intent...\n");
RARCH_LOG("ROM Filename: [%s].\n", g_extern.fullpath);
RARCH_LOG("Config file: [%s].\n", g_extern.config_path);
RARCH_LOG("Current IME: [%s].\n", android_app->current_ime);
if (valschanged)
{