コード例 #1
0
static void android_app_destroy(struct android_app* android_app) {
    free_saved_state(android_app);
    pthread_mutex_lock(&android_app->mutex);
    if (android_app->inputQueue != NULL) {
        AInputQueue_detachLooper(android_app->inputQueue);
    }
    AConfiguration_delete(android_app->config);
    android_app->destroyed = 1;
    pthread_cond_broadcast(&android_app->cond);
    pthread_mutex_unlock(&android_app->mutex);
    // Can't touch android_app object after this.
}
コード例 #2
0
static void android_app_destroy ( struct android_app* android_app ) {
	LOGV ( "android_app_destroy!" );
	free_saved_state ( android_app );
	pthread_mutex_lock ( &android_app->mutex );
	if ( android_app->inputQueue != NULL ) {
		AInputQueue_detachLooper ( android_app->inputQueue );
	}
	AConfiguration_delete ( android_app->config );
	android_app->destroyed = 1;
	pthread_cond_broadcast ( &android_app->cond );
	pthread_mutex_unlock ( &android_app->mutex );
	// 이후에 android_app 개체를 터치할 수 없습니다.
}
コード例 #3
0
int8_t android_app_read_cmd(struct android_app* android_app) {
    int8_t cmd;
    if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd)) {
        switch (cmd) {
            case APP_CMD_SAVE_STATE:
                free_saved_state(android_app);
                break;
        }
        return cmd;
    } else {
        LOGE("No data on command pipe!");
    }
    return -1;
}
コード例 #4
0
void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) {
    switch (cmd) {
        case APP_CMD_TERM_WINDOW:
            pthread_mutex_lock(&android_app->mutex);
            android_app->window = NULL;
            pthread_cond_broadcast(&android_app->cond);
            pthread_mutex_unlock(&android_app->mutex);
            break;

        case APP_CMD_SAVE_STATE:
            pthread_mutex_lock(&android_app->mutex);
            android_app->stateSaved = 1;
            pthread_cond_broadcast(&android_app->cond);
            pthread_mutex_unlock(&android_app->mutex);
            break;

        case APP_CMD_RESUME:
            free_saved_state(android_app);
            break;
    }
}
コード例 #5
0
static void gfx_ctx_check_window(bool *quit,
      bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
   (void)width;
   (void)height;
   (void)frame_count;

   int id;
   struct android_app* android_app = g_android.app;

   *quit = false;
   *resize = false;

   RARCH_PERFORMANCE_INIT(alooper_pollonce);
   RARCH_PERFORMANCE_START(alooper_pollonce);
   
   id = ALooper_pollOnce(0, NULL, 0, NULL);

   if(id == LOOPER_ID_MAIN)
   {
      int8_t cmd;

      if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd))
      {
         if(cmd == APP_CMD_SAVE_STATE)
            free_saved_state(android_app);
      }
      else
         cmd = -1;

      engine_handle_cmd(android_app, cmd);
   }

   RARCH_PERFORMANCE_STOP(alooper_pollonce);

   // Check if we are exiting.
   if (g_extern.lifecycle_state & (1ULL << RARCH_QUIT_KEY))
      *quit = true;
}