mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Some cleanups
This commit is contained in:
parent
16b7ca63c3
commit
44e2504cd7
@ -58,6 +58,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
|||||||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; frontend_ctx_drivers[i]; i++)
|
for (i = 0; frontend_ctx_drivers[i]; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(frontend_ctx_drivers[i]->ident, ident) == 0)
|
if (strcmp(frontend_ctx_drivers[i]->ident, ident) == 0)
|
||||||
@ -77,6 +78,7 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
|||||||
const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; frontend_ctx_drivers[i]; i++)
|
for (i = 0; frontend_ctx_drivers[i]; i++)
|
||||||
return frontend_ctx_drivers[i];
|
return frontend_ctx_drivers[i];
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ extern void android_app_entry(void *args);
|
|||||||
|
|
||||||
void engine_handle_cmd(void *data)
|
void engine_handle_cmd(void *data)
|
||||||
{
|
{
|
||||||
struct android_app *android_app = (struct android_app*)g_android;
|
|
||||||
int8_t cmd;
|
int8_t cmd;
|
||||||
|
struct android_app *android_app = (struct android_app*)g_android;
|
||||||
|
|
||||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
||||||
cmd = -1;
|
cmd = -1;
|
||||||
@ -175,8 +175,10 @@ static void android_app_set_input(void *data, AInputQueue* inputQueue)
|
|||||||
slock_lock(android_app->mutex);
|
slock_lock(android_app->mutex);
|
||||||
android_app->pendingInputQueue = inputQueue;
|
android_app->pendingInputQueue = inputQueue;
|
||||||
android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
|
android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
|
||||||
|
|
||||||
while (android_app->inputQueue != android_app->pendingInputQueue)
|
while (android_app->inputQueue != android_app->pendingInputQueue)
|
||||||
scond_wait(android_app->cond, android_app->mutex);
|
scond_wait(android_app->cond, android_app->mutex);
|
||||||
|
|
||||||
slock_unlock(android_app->mutex);
|
slock_unlock(android_app->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,16 +526,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||||||
android_app->getIntent);
|
android_app->getIntent);
|
||||||
RARCH_LOG("Checking arguments passed from intent ...\n");
|
RARCH_LOG("Checking arguments passed from intent ...\n");
|
||||||
|
|
||||||
// Config file
|
/* Config file. */
|
||||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||||
(*env)->NewStringUTF(env, "CONFIGFILE"));
|
(*env)->NewStringUTF(env, "CONFIGFILE"));
|
||||||
|
|
||||||
if (android_app->getStringExtra && jstr)
|
if (android_app->getStringExtra && jstr)
|
||||||
{
|
{
|
||||||
|
const char *argv = NULL;
|
||||||
static char config_path[PATH_MAX_LENGTH];
|
static char config_path[PATH_MAX_LENGTH];
|
||||||
*config_path = '\0';
|
*config_path = '\0';
|
||||||
|
|
||||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||||
|
|
||||||
if (argv && *argv)
|
if (argv && *argv)
|
||||||
strlcpy(config_path, argv, sizeof(config_path));
|
strlcpy(config_path, argv, sizeof(config_path));
|
||||||
@ -544,7 +547,7 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||||||
args->config_path = config_path;
|
args->config_path = config_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current IME
|
/* Current IME. */
|
||||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||||
(*env)->NewStringUTF(env, "IME"));
|
(*env)->NewStringUTF(env, "IME"));
|
||||||
|
|
||||||
@ -570,16 +573,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||||||
RARCH_LOG("USED: [%s].\n", used ? "true" : "false");
|
RARCH_LOG("USED: [%s].\n", used ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
// LIBRETRO
|
/* LIBRETRO. */
|
||||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||||
(*env)->NewStringUTF(env, "LIBRETRO"));
|
(*env)->NewStringUTF(env, "LIBRETRO"));
|
||||||
|
|
||||||
if (android_app->getStringExtra && jstr)
|
if (android_app->getStringExtra && jstr)
|
||||||
{
|
{
|
||||||
|
const char *argv = NULL;
|
||||||
static char core_path[PATH_MAX_LENGTH];
|
static char core_path[PATH_MAX_LENGTH];
|
||||||
*core_path = '\0';
|
|
||||||
|
|
||||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
*core_path = '\0';
|
||||||
|
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||||
if (argv && *argv)
|
if (argv && *argv)
|
||||||
strlcpy(core_path, argv, sizeof(core_path));
|
strlcpy(core_path, argv, sizeof(core_path));
|
||||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||||
@ -589,16 +593,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||||||
args->libretro_path = core_path;
|
args->libretro_path = core_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content
|
/* Content. */
|
||||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||||
(*env)->NewStringUTF(env, "ROM"));
|
(*env)->NewStringUTF(env, "ROM"));
|
||||||
|
|
||||||
if (android_app->getStringExtra && jstr)
|
if (android_app->getStringExtra && jstr)
|
||||||
{
|
{
|
||||||
|
const char *argv = NULL;
|
||||||
static char path[PATH_MAX_LENGTH];
|
static char path[PATH_MAX_LENGTH];
|
||||||
*path = '\0';
|
|
||||||
|
|
||||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
*path = '\0';
|
||||||
|
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||||
|
|
||||||
if (argv && *argv)
|
if (argv && *argv)
|
||||||
strlcpy(path, argv, sizeof(path));
|
strlcpy(path, argv, sizeof(path));
|
||||||
@ -612,16 +617,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content
|
/* Content. */
|
||||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||||
(*env)->NewStringUTF(env, "DATADIR"));
|
(*env)->NewStringUTF(env, "DATADIR"));
|
||||||
|
|
||||||
if (android_app->getStringExtra && jstr)
|
if (android_app->getStringExtra && jstr)
|
||||||
{
|
{
|
||||||
|
const char *argv = NULL;
|
||||||
static char path[PATH_MAX_LENGTH];
|
static char path[PATH_MAX_LENGTH];
|
||||||
*path = '\0';
|
|
||||||
|
|
||||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
*path = '\0';
|
||||||
|
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||||
|
|
||||||
if (argv && *argv)
|
if (argv && *argv)
|
||||||
strlcpy(path, argv, sizeof(path));
|
strlcpy(path, argv, sizeof(path));
|
||||||
@ -745,6 +751,7 @@ static void frontend_android_init(void *data)
|
|||||||
|
|
||||||
static void frontend_android_deinit(void *data)
|
static void frontend_android_deinit(void *data)
|
||||||
{
|
{
|
||||||
|
JNIEnv *env;
|
||||||
struct android_app *android_app = (struct android_app*)data;
|
struct android_app *android_app = (struct android_app*)data;
|
||||||
|
|
||||||
if (!android_app)
|
if (!android_app)
|
||||||
@ -753,7 +760,8 @@ static void frontend_android_deinit(void *data)
|
|||||||
RARCH_LOG("Deinitializing RetroArch ...\n");
|
RARCH_LOG("Deinitializing RetroArch ...\n");
|
||||||
android_app->activityState = APP_CMD_DEAD;
|
android_app->activityState = APP_CMD_DEAD;
|
||||||
|
|
||||||
JNIEnv *env = jni_thread_getenv();
|
env = jni_thread_getenv();
|
||||||
|
|
||||||
if (env && android_app->onRetroArchExit)
|
if (env && android_app->onRetroArchExit)
|
||||||
CALL_VOID_METHOD(env, android_app->activity->clazz,
|
CALL_VOID_METHOD(env, android_app->activity->clazz,
|
||||||
android_app->onRetroArchExit);
|
android_app->onRetroArchExit);
|
||||||
|
@ -25,11 +25,11 @@ static void emscripten_mainloop(void)
|
|||||||
{
|
{
|
||||||
int ret = main_entry_decide(0, NULL, NULL);
|
int ret = main_entry_decide(0, NULL, NULL);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret != -1)
|
||||||
{
|
return;
|
||||||
main_exit(NULL);
|
|
||||||
exit(0);
|
main_exit(NULL);
|
||||||
}
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user