diff --git a/frontend/platform/platform_android.c b/frontend/platform/platform_android.c index 5df43dd517..bd5ddaddbd 100644 --- a/frontend/platform/platform_android.c +++ b/frontend/platform/platform_android.c @@ -415,7 +415,6 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[], v JNIEnv *env; jobject obj = NULL; jstring jstr = NULL; - bool valschanged = false; struct android_app* android_app = (struct android_app*)data; if (!android_app) @@ -436,8 +435,7 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[], v strlcpy(g_extern.fullpath, argv, sizeof(g_extern.fullpath)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; - RARCH_LOG("ROM Filename: [%s].\n", g_extern.fullpath); + RARCH_LOG("Content Filename: [%s].\n", g_extern.fullpath); } // Config file @@ -445,11 +443,10 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[], v if (android_app->getStringExtra && jstr) { const char *argv = (*env)->GetStringUTFChars(env, jstr, 0); - strlcpy(g_extern.config_path, argv, sizeof(g_extern.config_path)); + strlcpy(default_paths.config_path, argv, sizeof(default_paths.config_path)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; - RARCH_LOG("Config file: [%s].\n", g_extern.config_path); + RARCH_LOG("Config file: [%s].\n", default_paths.config_path); } // Current IME @@ -460,7 +457,6 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[], v strlcpy(android_app->current_ime, argv, sizeof(android_app->current_ime)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; RARCH_LOG("Current IME: [%s].\n", android_app->current_ime); } @@ -473,25 +469,17 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[], v (*env)->ReleaseStringUTFChars(env, jstr, argv); } - - if (valschanged) - { - g_extern.block_config_read = false; - config_load(); - g_extern.block_config_read = true; - } - //LIBRETRO CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "LIBRETRO")); if (android_app->getStringExtra && jstr) { const char *argv = (*env)->GetStringUTFChars(env, jstr, 0); - strlcpy(g_settings.libretro, argv, sizeof(g_settings.libretro)); + strlcpy(default_paths.core_path, argv, sizeof(default_paths.core_path)); (*env)->ReleaseStringUTFChars(env, jstr, argv); } - RARCH_LOG("Libretro path: [%s].\n", g_settings.libretro); + RARCH_LOG("Libretro path: [%s].\n", default_paths.core_path); } @@ -502,7 +490,6 @@ static void process_pending_intent(void *data) JNIEnv *env; struct android_app* android_app = (struct android_app*)data; jstring jstr = NULL; - bool valschanged = false; bool startgame = false; if (!android_app) @@ -522,7 +509,6 @@ static void process_pending_intent(void *data) strlcpy(g_extern.fullpath, argv, sizeof(g_extern.fullpath)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; startgame = true; RARCH_LOG("ROM Filename: [%s].\n", g_extern.fullpath); } @@ -533,10 +519,9 @@ static void process_pending_intent(void *data) if (android_app->getPendingIntentConfigPath && jstr) { const char *argv = (*env)->GetStringUTFChars(env, jstr, 0); - strlcpy(g_extern.config_path, argv, sizeof(g_extern.config_path)); + strlcpy(default_paths.config_path, argv, sizeof(default_paths.config_path)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; RARCH_LOG("Config file: [%s].\n", g_extern.config_path); } @@ -549,28 +534,20 @@ static void process_pending_intent(void *data) strlcpy(android_app->current_ime, argv, sizeof(android_app->current_ime)); (*env)->ReleaseStringUTFChars(env, jstr, argv); - valschanged = true; RARCH_LOG("Current IME: [%s].\n", android_app->current_ime); } - if (valschanged) - { - g_extern.block_config_read = false; - config_load(); - g_extern.block_config_read = true; - } - //LIBRETRO jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz, android_app->getPendingIntentLibretroPath); JNI_EXCEPTION(env); if (android_app->getPendingIntentLibretroPath && jstr) { const char *argv = (*env)->GetStringUTFChars(env, jstr, 0); - strlcpy(g_settings.libretro, argv, sizeof(g_settings.libretro)); + strlcpy(default_paths.core_path, argv, sizeof(default_paths.core_path)); (*env)->ReleaseStringUTFChars(env, jstr, argv); } - RARCH_LOG("Libretro path: [%s].\n", g_settings.libretro); + RARCH_LOG("Libretro path: [%s].\n", default_paths.core_path); if (startgame) { diff --git a/general.h b/general.h index 31575fbf5c..89c07bcd63 100644 --- a/general.h +++ b/general.h @@ -126,6 +126,7 @@ enum sound_mode_enums struct defaults { char config_path[PATH_MAX]; + char core_path[PATH_MAX]; char autoconfig_dir[PATH_MAX]; char audio_filter_dir[PATH_MAX]; char assets_dir[PATH_MAX]; diff --git a/settings.c b/settings.c index 46f24f0723..5a2f46aecb 100644 --- a/settings.c +++ b/settings.c @@ -483,6 +483,8 @@ void config_set_defaults(void) strlcpy(g_settings.assets_directory, default_paths.assets_dir, sizeof(g_settings.assets_directory)); if (*default_paths.core_dir) strlcpy(g_settings.libretro_directory, default_paths.core_dir, sizeof(g_settings.libretro_directory)); + if (*default_paths.core_path) + strlcpy(g_settings.libretro, default_paths.core_path, sizeof(g_settings.libretro)); if (*default_paths.core_info_dir) strlcpy(g_settings.libretro_info_path, default_paths.core_info_dir, sizeof(g_settings.libretro_info_path)); if (*default_paths.overlay_dir)