From ef2406e8f636a61835a1cd405d310ead297b497e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 16 Jun 2013 18:18:15 +0200 Subject: [PATCH] (Android) Another Xperia Play hack (Context) Context file changes to do with FPS reporting --- android/native/jni/input_android.c | 12 ++---------- android/native/jni/input_autodetect.c | 16 ++++++++++++++++ android/native/jni/input_autodetect.h | 5 +++++ gfx/context/ps3_ctx.c | 5 ++--- gfx/context/vc_egl_ctx.c | 3 +-- gfx/context/xdk_ctx.c | 5 ++--- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index 21ee88245d..f704e068f0 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -310,7 +310,7 @@ static void *android_input_init(void) int zeus_id = -1; int zeus_second_id = -1; -static unsigned zeus_port; +unsigned zeus_port; static void android_input_set_keybinds(void *data, unsigned device, unsigned port, unsigned id, unsigned keybind_action) @@ -1141,16 +1141,8 @@ static void android_input_set_keybinds(void *data, unsigned device, strlcpy(g_settings.input.device_names[port], "Xperia Play", sizeof(g_settings.input.device_names[port])); - if (zeus_id < 0) + if ((zeus_second_id != -1 && (zeus_second_id == id))) { - RARCH_LOG("zeus_pad 1 detected: %d\n", id); - zeus_id = id; - zeus_port = port; - } - else - { - RARCH_LOG("zeus_pad 2 detected: %d\n", id); - zeus_second_id = id; port = zeus_port; shift = 8 + (port * 8); } diff --git a/android/native/jni/input_autodetect.c b/android/native/jni/input_autodetect.c index f2a5964cae..bf8e4631df 100644 --- a/android/native/jni/input_autodetect.c +++ b/android/native/jni/input_autodetect.c @@ -85,6 +85,22 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned input_autodetect_get_device_name(android_app, name_buf, sizeof(name_buf), id); RARCH_LOG("device name: %s\n", name_buf); + /* Shitty hack put back in again */ + if (strstr(name_buf, "keypad-game-zeus") || strstr(name_buf, "keypad-zeus")) + { + if (zeus_id < 0) + { + RARCH_LOG("zeus_pad 1 detected: %d\n", id); + zeus_id = id; + zeus_port = port; + } + else + { + RARCH_LOG("zeus_pad 2 detected: %d\n", id); + zeus_second_id = id; + } + } + if (g_settings.input.autodetect_enable) { device = 0; diff --git a/android/native/jni/input_autodetect.h b/android/native/jni/input_autodetect.h index 2bde935fdd..2763d74b2d 100644 --- a/android/native/jni/input_autodetect.h +++ b/android/native/jni/input_autodetect.h @@ -83,4 +83,9 @@ enum { void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned port, unsigned id, int source); +/* Xperia Play externs */ +extern unsigned zeus_port; +extern int zeus_id; +extern int zeus_second_id; + #endif diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index faeab5a0af..e4731d9b9f 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -191,9 +191,8 @@ static void gfx_ctx_update_window_title(void) gl_t *gl = (gl_t*)driver.video_data; char buf[128]; - gfx_get_fps(buf, sizeof(buf), false); - - if (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW) && + if (gfx_get_fps(buf, sizeof(buf), false) && + (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) && gl->font_ctx) { font_params_t params = {0}; diff --git a/gfx/context/vc_egl_ctx.c b/gfx/context/vc_egl_ctx.c index 6460b38c66..60ebec88b9 100644 --- a/gfx/context/vc_egl_ctx.c +++ b/gfx/context/vc_egl_ctx.c @@ -110,8 +110,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128]; - if (gfx_get_fps(buf, sizeof(buf), false)) - RARCH_LOG("%s.\n", buf); + gfx_get_fps(buf, sizeof(buf), false); } static void gfx_ctx_get_video_size(unsigned *width, unsigned *height) diff --git a/gfx/context/xdk_ctx.c b/gfx/context/xdk_ctx.c index 7875c40faf..0341be3164 100644 --- a/gfx/context/xdk_ctx.c +++ b/gfx/context/xdk_ctx.c @@ -82,9 +82,8 @@ static void gfx_ctx_xdk_update_window_title(void) char buf[128]; xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data; - gfx_get_fps(buf, sizeof(buf), false); - - if (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) + if (gfx_get_fps(buf, sizeof(buf), false) && + g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) { #if defined(_XBOX1) float mem_width = font_x + 30;