mirror of
https://github.com/libretro/RetroArch
synced 2025-02-13 03:40:33 +00:00
Create new rarch_main signature
This commit is contained in:
parent
4e187ad642
commit
14505cc222
@ -29,9 +29,6 @@
|
|||||||
struct android_app *g_android;
|
struct android_app *g_android;
|
||||||
static pthread_key_t thread_key;
|
static pthread_key_t thread_key;
|
||||||
|
|
||||||
/* Forward declaration. */
|
|
||||||
extern void android_app_entry(void *args);
|
|
||||||
|
|
||||||
void engine_handle_cmd(void *data)
|
void engine_handle_cmd(void *data)
|
||||||
{
|
{
|
||||||
int8_t cmd;
|
int8_t cmd;
|
||||||
@ -350,6 +347,23 @@ static void jni_thread_destruct(void *value)
|
|||||||
pthread_setspecific(thread_key, NULL);
|
pthread_setspecific(thread_key, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void android_app_entry(void *data)
|
||||||
|
{
|
||||||
|
char *argv[1];
|
||||||
|
int argc = 0;
|
||||||
|
|
||||||
|
if (rarch_main(argc, argv, data) != 0)
|
||||||
|
goto end;
|
||||||
|
#ifndef HAVE_MAIN
|
||||||
|
while (rarch_main_iterate() != -1);
|
||||||
|
|
||||||
|
main_exit(args);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
end:
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Native activity interaction (called from main thread)
|
* Native activity interaction (called from main thread)
|
||||||
**/
|
**/
|
||||||
|
@ -529,10 +529,3 @@ const frontend_ctx_driver_t frontend_ctx_darwin = {
|
|||||||
frontend_darwin_get_powerstate,
|
frontend_darwin_get_powerstate,
|
||||||
"darwin",
|
"darwin",
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(HAVE_COCOA) && !defined(HAVE_COCOATOUCH)
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
return rarch_main(argc, argv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -36,7 +36,7 @@ int main(int argc, char *argv[])
|
|||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
emscripten_set_canvas_size(800, 600);
|
emscripten_set_canvas_size(800, 600);
|
||||||
rarch_main(argc, argv);
|
rarch_main(argc, argv, NULL);
|
||||||
emscripten_set_main_loop(emscripten_mainloop,
|
emscripten_set_main_loop(emscripten_mainloop,
|
||||||
settings->video.vsync ? 0 : INT_MAX, 1);
|
settings->video.vsync ? 0 : INT_MAX, 1);
|
||||||
|
|
||||||
|
@ -22,16 +22,6 @@
|
|||||||
#include "../runloop.h"
|
#include "../runloop.h"
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
|
|
||||||
#if defined(ANDROID)
|
|
||||||
#define returnfunc() exit(0)
|
|
||||||
#define return_var(var) return
|
|
||||||
#define args_initial_ptr() data
|
|
||||||
#else
|
|
||||||
#define returnfunc() return 0
|
|
||||||
#define return_var(var) return var
|
|
||||||
#define args_initial_ptr() NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_ARGS 32
|
#define MAX_ARGS 32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,17 +266,9 @@ error:
|
|||||||
*
|
*
|
||||||
* Returns: varies per platform.
|
* Returns: varies per platform.
|
||||||
**/
|
**/
|
||||||
#if defined(ANDROID)
|
int rarch_main(int argc, char *argv[], void *data)
|
||||||
void android_app_entry(void *data)
|
|
||||||
#else
|
|
||||||
int rarch_main(int argc, char *argv[])
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
void *args = (void*)data;
|
||||||
char *argv[1];
|
|
||||||
int argc = 0;
|
|
||||||
#endif
|
|
||||||
void *args = (void *)args_initial_ptr();
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
settings_t *settings = NULL;
|
settings_t *settings = NULL;
|
||||||
driver_t *driver = NULL;
|
driver_t *driver = NULL;
|
||||||
@ -311,9 +293,7 @@ int rarch_main(int argc, char *argv[])
|
|||||||
if (!(ret = (main_load_content(argc, argv, args,
|
if (!(ret = (main_load_content(argc, argv, args,
|
||||||
driver->frontend_ctx->environment_get,
|
driver->frontend_ctx->environment_get,
|
||||||
driver->frontend_ctx->process_args))))
|
driver->frontend_ctx->process_args))))
|
||||||
{
|
return ret;
|
||||||
return_var(ret);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event_command(EVENT_CMD_HISTORY_INIT);
|
event_command(EVENT_CMD_HISTORY_INIT);
|
||||||
@ -346,12 +326,12 @@ int rarch_main(int argc, char *argv[])
|
|||||||
main_exit(args);
|
main_exit(args);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
returnfunc();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_MAIN
|
#ifndef HAVE_MAIN
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return rarch_main(argc, argv);
|
return rarch_main(argc, argv, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,11 +59,7 @@ void main_exit_save_config(void);
|
|||||||
*
|
*
|
||||||
* Returns: varies per platform.
|
* Returns: varies per platform.
|
||||||
**/
|
**/
|
||||||
#if defined(ANDROID)
|
int rarch_main(int argc, char *argv[], void *data);
|
||||||
void android_app_entry(void *data);
|
|
||||||
#else
|
|
||||||
int rarch_main(int argc, char *argv[]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main_load_content:
|
* main_load_content:
|
||||||
|
@ -33,18 +33,6 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include "../compat/strl.h"
|
#include "../compat/strl.h"
|
||||||
|
|
||||||
#undef main
|
|
||||||
|
|
||||||
int rarch_main(int argc, char **argv);
|
|
||||||
static void start_rarch(const char *path)
|
|
||||||
{
|
|
||||||
char arg0[] = "retroarch";
|
|
||||||
char arg1[256];
|
|
||||||
strlcpy(arg1, path, sizeof(arg1));
|
|
||||||
char *argv[3] = { arg0, arg1, NULL };
|
|
||||||
rarch_main(sizeof(argv) / sizeof(argv[0]) - 1, argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FG_COL -1
|
#define FG_COL -1
|
||||||
#define BG_COL 0
|
#define BG_COL 0
|
||||||
|
|
||||||
@ -168,8 +156,6 @@ int main(void)
|
|||||||
strlcat(fn, entries[pos].d_name, sizeof(fn));
|
strlcat(fn, entries[pos].d_name, sizeof(fn));
|
||||||
|
|
||||||
printf("%s\n", fn);
|
printf("%s\n", fn);
|
||||||
|
|
||||||
start_rarch(fn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +108,6 @@ struct defaults
|
|||||||
/* Public data structures. */
|
/* Public data structures. */
|
||||||
extern struct defaults g_defaults;
|
extern struct defaults g_defaults;
|
||||||
|
|
||||||
/* Public functions. */
|
|
||||||
int rarch_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int rarch_main(int argc, char *argv[]);
|
int rarch_main(int argc, char *argv[], void *data);
|
||||||
|
|
||||||
#undef main
|
#undef main
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
while (rarch_main(argc, argv) == 0)
|
while (rarch_main(argc, argv, NULL) == 0)
|
||||||
{
|
{
|
||||||
if (optind + 1 >= argc)
|
if (optind + 1 >= argc)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,7 +175,7 @@ static char** waiting_argv;
|
|||||||
|
|
||||||
[apple_platform loadingCore:nil withFile:nil];
|
[apple_platform loadingCore:nil withFile:nil];
|
||||||
|
|
||||||
if (rarch_main(waiting_argc, waiting_argv))
|
if (rarch_main(waiting_argc, waiting_argv, NULL))
|
||||||
apple_rarch_exited();
|
apple_rarch_exited();
|
||||||
|
|
||||||
waiting_argc = 0;
|
waiting_argc = 0;
|
||||||
|
@ -279,7 +279,7 @@ enum
|
|||||||
|
|
||||||
[self setDelegate:self];
|
[self setDelegate:self];
|
||||||
|
|
||||||
if (rarch_main(0, NULL))
|
if (rarch_main(0, NULL, NULL))
|
||||||
apple_rarch_exited();
|
apple_rarch_exited();
|
||||||
|
|
||||||
/* Setup window */
|
/* Setup window */
|
||||||
@ -290,7 +290,7 @@ enum
|
|||||||
|
|
||||||
[apple_platform loadingCore:nil withFile:nil];
|
[apple_platform loadingCore:nil withFile:nil];
|
||||||
|
|
||||||
if (rarch_main(0, NULL))
|
if (rarch_main(0, NULL, NULL))
|
||||||
apple_rarch_exited();
|
apple_rarch_exited();
|
||||||
|
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user