(Android) Call process_cmd and process_input directly - try to get

rid of all these poll callbacks
This commit is contained in:
twinaphex 2012-10-31 19:22:34 +01:00
parent 5240f2d9f1
commit a2ea556be5
4 changed files with 14 additions and 7 deletions

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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)