mirror of
https://github.com/libretro/RetroArch
synced 2025-03-12 22:14:30 +00:00
(Android) Call process_cmd and process_input directly - try to get
rid of all these poll callbacks
This commit is contained in:
parent
5240f2d9f1
commit
a2ea556be5
@ -168,7 +168,7 @@ void process_input(struct android_app* app, struct android_poll_source* source)
|
||||
}
|
||||
}
|
||||
|
||||
static void process_cmd(struct android_app* app, struct android_poll_source* source)
|
||||
void process_cmd(struct android_app* app, struct android_poll_source* source)
|
||||
{
|
||||
int8_t cmd = android_app_read_cmd(app);
|
||||
|
||||
|
@ -326,6 +326,9 @@ extern "C" {
|
||||
*/
|
||||
extern void android_main(struct android_app* app);
|
||||
|
||||
extern void process_input(struct android_app* app, struct android_poll_source* source);
|
||||
extern void process_cmd(struct android_app* app, struct android_poll_source* source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -320,15 +320,20 @@ static void android_input_poll(void *data)
|
||||
(void)data;
|
||||
|
||||
// Read all pending events.
|
||||
int event;
|
||||
int event, id;
|
||||
struct android_poll_source* source;
|
||||
struct android_app* state = g_android.app;
|
||||
|
||||
ALooper_pollOnce(0, NULL, &event, (void**)&source);
|
||||
id = ALooper_pollOnce(0, NULL, &event, (void**)&source);
|
||||
|
||||
// Process this event.
|
||||
if(event)
|
||||
source->process(state, source);
|
||||
{
|
||||
if(id == LOOPER_ID_INPUT)
|
||||
process_input(state, source);
|
||||
else
|
||||
process_cmd(state, source);
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t android_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
|
@ -149,15 +149,14 @@ void android_main(struct android_app* state)
|
||||
while(!g_android.window_inited)
|
||||
{
|
||||
// Read all pending events.
|
||||
int ident;
|
||||
struct android_poll_source* source;
|
||||
|
||||
// Block forever waiting for events.
|
||||
while ((ident=ALooper_pollAll(0, NULL, 0, (void**)&source)) >= 0)
|
||||
while ((ALooper_pollOnce(0, NULL, 0, (void**)&source)) >= 0)
|
||||
{
|
||||
// Process this event.
|
||||
if (source != NULL)
|
||||
source->process(g_android.app, source);
|
||||
process_cmd(g_android.app, source);
|
||||
|
||||
// Check if we are exiting.
|
||||
if (g_android.app->destroyRequested != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user