mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-25 12:17:04 +00:00
Merge pull request #3119 from fr500/master
android platform driver improvements
This commit is contained in:
commit
69c148f9a3
@ -72,8 +72,7 @@ static char screenshot_dir[PATH_MAX_LENGTH];
|
||||
static char downloads_dir[PATH_MAX_LENGTH];
|
||||
static char apk_dir[PATH_MAX_LENGTH];
|
||||
static char app_dir[PATH_MAX_LENGTH];
|
||||
static char internal_storage_path[PATH_MAX_LENGTH];
|
||||
static char internal_storage_app_path[PATH_MAX_LENGTH];
|
||||
|
||||
#else
|
||||
static const char *proc_apm_path = "/proc/apm";
|
||||
static const char *proc_acpi_battery_path = "/proc/acpi/battery";
|
||||
@ -542,12 +541,14 @@ bool test_permissions(const char *path)
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
bool ret;
|
||||
|
||||
RARCH_LOG("Testing permissions for %s\n",path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "Testing permissions for %s\n",path);
|
||||
|
||||
fill_pathname_join(buf, path, ".retroarch", sizeof(buf));
|
||||
ret = path_mkdir(buf);
|
||||
|
||||
RARCH_LOG("Create %s in %s %s\n", buf, path, ret ? "true" : "false");
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "Create %s in %s %s\n", buf, path, ret ? "true" : "false");
|
||||
|
||||
if(ret)
|
||||
rmdir(buf);
|
||||
@ -1203,12 +1204,14 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
frontend_android_get_version(&major, &minor, &rel);
|
||||
|
||||
RARCH_LOG("Android OS version (major : %d, minor : %d, rel : %d)\n",
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV] Android version (major : %d, minor : %d, rel : %d)\n",
|
||||
major, minor, rel);
|
||||
|
||||
CALL_OBJ_METHOD(env, obj, android_app->activity->clazz,
|
||||
android_app->getIntent);
|
||||
RARCH_LOG("Checking arguments passed from intent ...\n");
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV] Checking arguments passed from intent ...\n");
|
||||
|
||||
/* Config file. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
@ -1223,7 +1226,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
strlcpy(config_path, argv, sizeof(config_path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
RARCH_LOG("[ENV]: config file: [%s]\n", config_path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: config file: [%s]\n", config_path);
|
||||
if (args && *config_path)
|
||||
args->config_path = config_path;
|
||||
}
|
||||
@ -1240,7 +1244,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
sizeof(android_app->current_ime));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
RARCH_LOG("[ENV]: current IME: [%s]\n", android_app->current_ime);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: current IME: [%s]\n", android_app->current_ime);
|
||||
}
|
||||
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
@ -1253,7 +1258,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
RARCH_LOG("[ENV]: used: [%s].\n", used ? "true" : "false");
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: used: [%s].\n", used ? "true" : "false");
|
||||
}
|
||||
|
||||
/* LIBRETRO. */
|
||||
@ -1270,7 +1276,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
strlcpy(core_path, argv, sizeof(core_path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
RARCH_LOG("[ENV]: libretro path: [%s]\n", core_path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: libretro path: [%s]\n", core_path);
|
||||
if (args && *core_path)
|
||||
args->libretro_path = core_path;
|
||||
}
|
||||
@ -1292,7 +1299,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
RARCH_LOG("[ENV]: auto-start game [%s]\n", path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: auto-start game [%s]\n", path);
|
||||
if (args && *path)
|
||||
args->content_path = path;
|
||||
}
|
||||
@ -1314,7 +1322,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(internal_storage_path))
|
||||
{
|
||||
RARCH_LOG("[ENV]: internal storage location: [%s]\n", internal_storage_path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: android internal storage location: [%s]\n",
|
||||
internal_storage_path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1334,7 +1344,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(screenshot_dir))
|
||||
{
|
||||
RARCH_LOG("[ENV]: picture folder location [%s]\n", screenshot_dir);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: android picture folder location [%s]\n",
|
||||
screenshot_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1354,7 +1366,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(downloads_dir))
|
||||
{
|
||||
RARCH_LOG("[ENV]: download folder location [%s]\n", downloads_dir);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: android download folder location [%s]\n",
|
||||
downloads_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1373,7 +1387,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(apk_dir))
|
||||
{
|
||||
RARCH_LOG("[ENV]: APK location [%s]\n", apk_dir);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: APK location [%s]\n", apk_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1392,7 +1407,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(internal_storage_app_path))
|
||||
{
|
||||
RARCH_LOG("[ENV]: external files location [%s]\n", internal_storage_app_path);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: android external files location [%s]\n",
|
||||
internal_storage_app_path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1428,7 +1445,8 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
if (!string_is_empty(app_dir))
|
||||
{
|
||||
RARCH_LOG("[ENV]: application location: [%s]\n", app_dir);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: application location: [%s]\n", app_dir);
|
||||
if (args && *app_dir)
|
||||
{
|
||||
char buf[PATH_MAX_LENGTH] = {0};
|
||||
@ -1473,7 +1491,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
path_mkdir(g_defaults.dir.core_assets);
|
||||
}
|
||||
|
||||
RARCH_LOG("[ENV]: default download folder: [%s]", g_defaults.dir.core_assets);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: default download folder: [%s]",
|
||||
g_defaults.dir.core_assets);
|
||||
|
||||
if(*screenshot_dir && test_permissions(screenshot_dir))
|
||||
{
|
||||
@ -1487,7 +1507,9 @@ static void frontend_linux_get_env(int *argc,
|
||||
path_mkdir(g_defaults.dir.screenshot);
|
||||
}
|
||||
|
||||
RARCH_LOG("[ENV]: default screenshot folder: [%s]", g_defaults.dir.screenshot);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: default screenshot folder: [%s]",
|
||||
g_defaults.dir.screenshot);
|
||||
|
||||
switch (perms)
|
||||
{
|
||||
@ -1597,9 +1619,15 @@ static void frontend_linux_get_env(int *argc,
|
||||
fill_pathname_join(buf, internal_storage_app_path, "system", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
RARCH_LOG("[ENV]: default savefile folder: [%s]", g_defaults.dir.sram);
|
||||
RARCH_LOG("[ENV]: default savestate folder: [%s]", g_defaults.dir.savestate);
|
||||
RARCH_LOG("[ENV]: default system folder: [%s]", g_defaults.dir.system);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: default savefile folder: [%s]",
|
||||
g_defaults.dir.sram);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: default savestate folder: [%s]",
|
||||
g_defaults.dir.savestate);
|
||||
__android_log_print(ANDROID_LOG_INFO,
|
||||
"RetroArch", "[ENV]: default system folder: [%s]",
|
||||
g_defaults.dir.system);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,8 @@
|
||||
|
||||
bool test_permissions(const char *path);
|
||||
|
||||
char sdcard_dir[PATH_MAX_LENGTH];
|
||||
char internal_storage_path[PATH_MAX_LENGTH];
|
||||
char internal_storage_app_path[PATH_MAX_LENGTH];
|
||||
|
||||
struct android_app;
|
||||
|
||||
|
@ -664,9 +664,9 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
menu_entries_add_enum(info->list, tmp, "", MENU_ENUM_LABEL_UNKNOWN, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
#ifdef ANDROID
|
||||
bool perms = test_permissions(sdcard_dir);
|
||||
bool perms = test_permissions(internal_storage_path);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%s: %s", "Internal SD card status",
|
||||
snprintf(tmp, sizeof(tmp), "%s: %s", "Internal storage status",
|
||||
perms ? "read-write" : "read-only");
|
||||
menu_entries_add_enum(info->list, tmp, "",
|
||||
MENU_ENUM_LABEL_UNKNOWN, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user