void android_main(struct android_app *state) { app_dummy(); //TODO-Have this update a variable, and use that to establish the pipes, sockets for improved compatibility with future android versions char *writeLocation = (char *) state->activity->internalDataPath; char *bootmsg = FINSBOOT_MSG; __android_log_print(ANDROID_LOG_INFO, "FINS", bootmsg); __android_log_print(ANDROID_LOG_INFO, "FINS", writeLocation); __android_log_print(ANDROID_LOG_INFO, "FINS", "Forking into capturermain() and main()"); /* int ret; __android_log_print(ANDROID_LOG_INFO, "FINS", "Gaining su status"); if ((ret = system("su"))) { __android_log_print(ANDROID_LOG_ERROR, "FINS", "SU failure: ret=%d, errno=%u, str='%s'", ret, errno, strerror(errno)); } */ if (0) { int i = 0; while (i < 1000) { __android_log_print(ANDROID_LOG_INFO, "FINS", "i=%d", i++); sleep(2); } return; } __android_log_print(ANDROID_LOG_INFO, "FINS", "Starting FINS: core_main()"); core_dummy(); core_main(); while (1) ; //sleep(1); __android_log_print(ANDROID_LOG_INFO, "FINS", "Exiting FINS: core_main()"); }
void android_main(struct android_app *state) { app_dummy(); //TODO-Have this update a variable, and use that to establish the pipes, sockets for improved compatibility with future android versions char *writeLocation = (char *) state->activity->internalDataPath; char *bootmsg = FINSBOOT_MSG; LOGI(bootmsg); LOGI("internalDataPath='%s'", writeLocation); struct engine engine; memset(&engine, 0, sizeof(engine)); state->userData = &engine; state->onAppCmd = engine_handle_cmd; state->onInputEvent = engine_handle_input; engine.app = state; if (state->savedState != NULL) { // We are starting with a previous saved state; restore from it. engine.state = *(struct saved_state*) state->savedState; } int ret; if (0) { LOGI("Gaining su status"); if ((ret = system("su"))) { LOGE("SU failure: ret=%d, errno=%u, str='%s'", ret, errno, strerror(errno)); } } //apk can access files in /data as well but can't write to anything core_dummy(); //core_main((uint8_t *) (FINS_TMP_ROOT "/envi.cfg"), (uint8_t *) (FINS_TMP_ROOT "/stack.cfg"), 0); core_main((uint8_t *) ("/sdcard/fins/envi.cfg"), (uint8_t *) ("/sdcard/fins/stack.cfg"), 0); //core_tests(); //For random testing purposes //core_termination_handler(0); //############ terminating // loop waiting for stuff to do. while (1) { // Read all pending events. int ident; int events; struct android_poll_source* source; // If not animating, we will block forever waiting for events. // If animating, we loop until all events are read, then continue // to draw the next frame of animation. while ((ident = ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events, (void**) &source)) >= 0) { // Process this event. if (source != NULL) { source->process(state, source); } // If a sensor has data, process it now. if (ident == LOOPER_ID_USER) { } // Check if we are exiting. if (state->destroyRequested != 0) { //engine_term_display(&engine); engine.animating = 0; LOGE("exiting main return"); //return; } } if (engine.animating) { // Done with events; draw next animation frame. //engine.state.angle += .01f; //change state? // Drawing is throttled to the screen update rate, so there // is no need to do timing here. //engine_draw_frame(&engine); //LOGI("draw frame"); } } }