mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(Android) Start using android_main_poll
This commit is contained in:
parent
aac304410b
commit
ff6babc22a
@ -426,7 +426,7 @@ static void frontend_android_get_environment_settings(int *argc,
|
||||
#endif
|
||||
}
|
||||
|
||||
int android_run_events(void *data);
|
||||
int android_main_poll(void *data);
|
||||
|
||||
static bool android_input_lookup_name_prekitkat(char *buf,
|
||||
int *vendorId, int *productId, size_t size, int id)
|
||||
@ -600,7 +600,7 @@ static void frontend_android_init(void *data)
|
||||
|
||||
while (!android_app->window)
|
||||
{
|
||||
if (android_run_events(android_app) == -1)
|
||||
if (android_main_poll(NULL) == -1)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -606,6 +606,7 @@ void android_input_handle_user(android_input_state_t *state)
|
||||
|
||||
int android_main_poll(void *data)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
int ident, events;
|
||||
AInputEvent *event;
|
||||
struct android_poll_source *source;
|
||||
@ -617,8 +618,8 @@ int android_main_poll(void *data)
|
||||
/* Handle all events. If our activity is in pause state,
|
||||
* block until we're unpaused. */
|
||||
while ((ident =
|
||||
ALooper_pollAll((input_driver_key_pressed(RARCH_PAUSE_TOGGLE))
|
||||
? -1 : 0,
|
||||
ALooper_pollAll(
|
||||
input_driver_key_pressed(RARCH_PAUSE_TOGGLE) ? -1 : 0,
|
||||
NULL, &events, (void**)&source)) >= 0)
|
||||
{
|
||||
switch (ident)
|
||||
@ -643,7 +644,11 @@ int android_main_poll(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (copy_state)
|
||||
/* Check if we are exiting. */
|
||||
if (global && global->system.shutdown)
|
||||
return -1;
|
||||
|
||||
if (copy_state && android)
|
||||
memcpy(&android->copy, &userdata->thread_state, sizeof(android->copy));
|
||||
|
||||
return 0;
|
||||
@ -654,23 +659,6 @@ static void android_input_poll(void *data)
|
||||
android_main_poll(data);
|
||||
}
|
||||
|
||||
int android_run_events(void *data)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
int id = ALooper_pollOnce(-1, NULL, NULL, NULL);
|
||||
int32_t cmd = android_app_read_cmd(android_app);
|
||||
|
||||
if (id == LOOPER_ID_MAIN)
|
||||
engine_handle_cmd(android_app, cmd);
|
||||
|
||||
/* Check if we are exiting. */
|
||||
if (global->system.shutdown)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int16_t android_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id)
|
||||
|
@ -204,6 +204,8 @@ bool input_driver_key_pressed(int key)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const input_driver_t *input = input_get_ptr(driver);
|
||||
|
||||
if (!driver || !input)
|
||||
return false;
|
||||
return input->key_pressed(driver->input_data, key);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user