From d70d04c4736e776750d24f805200a6fde009f222 Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 15 Apr 2017 17:26:04 -0500 Subject: [PATCH] improve shield portable hack --- input/drivers/android_input.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index 6793d1dc5d..c227f41888 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -949,13 +949,10 @@ static void handle_hotplug(android_input_t *android, } } - /* NVIDIA Shield Portable - * This is a simple hack, basically groups the "back" - * button with the rest of the gamepad - */ else if(strstr(device_model, "SHIELD") && ( strstr(device_name, "Virtual") || strstr(device_name, "gpio") || - strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01"))) + strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.01") || + strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.02"))) { /* only use the hack if the device is one of the built-in devices */ RARCH_LOG("Special Device Detected: %s\n", device_model); @@ -967,10 +964,28 @@ static void handle_hotplug(android_input_t *android, if ( pad_id2 > 0) return; - strlcpy (name_buf, "NVIDIA SHIELD Portable", sizeof(name_buf)); } } + + else if(strstr(device_model, "SHIELD") && ( + strstr(device_name, "Virtual") || strstr(device_name, "gpio") || + strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.03"))) + { + /* only use the hack if the device is one of the built-in devices */ + RARCH_LOG("Special Device Detected: %s\n", device_model); + { + if (strstr(device_name, "NVIDIA Corporation NVIDIA Controller v01.03") + && android->pads_connected==0) + pad_id1 = id; + else if (strstr(device_name, "Virtual") || strstr(device_name, "gpio")) + { + id = pad_id1; + return; + } + strlcpy (name_buf, "NVIDIA SHIELD Gamepad", sizeof(name_buf)); + } + } /* Other ATV Devices * Add other common ATV devices that will follow the Android