From 1e03bb3d504d8ec8d825e61019705167d12a3361 Mon Sep 17 00:00:00 2001 From: Toad King Date: Tue, 4 Dec 2012 17:36:02 -0500 Subject: [PATCH] [ANDROID] "handle" all config changes while executing the emulator re-init video code on orientation change --- android/native/jni/android_general.h | 1 + android/native/jni/main.c | 12 +++++++++++- android/phoenix/AndroidManifest.xml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/android/native/jni/android_general.h b/android/native/jni/android_general.h index 0d34d098c8..3a48c3b8ab 100644 --- a/android/native/jni/android_general.h +++ b/android/native/jni/android_general.h @@ -34,6 +34,7 @@ struct droid unsigned width; unsigned height; struct saved_state state; + int32_t last_orient; }; extern struct droid g_android; diff --git a/android/native/jni/main.c b/android/native/jni/main.c index 7154cea0ee..c902e23f63 100644 --- a/android/native/jni/main.c +++ b/android/native/jni/main.c @@ -385,7 +385,17 @@ static void* android_app_entry(void* param) RARCH_LOG("Initializing succeeded.\n"); RARCH_LOG("RetroArch started.\n"); rarch_init_msg_queue(); - while (rarch_main_iterate()); + g_android.last_orient = AConfiguration_getOrientation(android_app->config); + while (rarch_main_iterate()) + { + if (AConfiguration_getOrientation(android_app->config) != g_android.last_orient) + { + // reinit video driver for new window dimensions + driver.video->free(driver.video_data); + init_video_input(); + g_android.last_orient = AConfiguration_getOrientation(android_app->config); + } + } RARCH_LOG("RetroArch stopped.\n"); } diff --git a/android/phoenix/AndroidManifest.xml b/android/phoenix/AndroidManifest.xml index 076e71a440..cbb8bace7d 100644 --- a/android/phoenix/AndroidManifest.xml +++ b/android/phoenix/AndroidManifest.xml @@ -19,7 +19,7 @@ - +