Merge pull request #7012 from TheOfficialFloW/patch-1

Use sceCtrlIsMultiControllerSupported to detect
This commit is contained in:
Twinaphex 2018-07-24 15:02:20 +02:00 committed by GitHub
commit 70a24ae421
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,6 @@
#include <psp2/ctrl.h> #include <psp2/ctrl.h>
#include <psp2/touch.h> #include <psp2/touch.h>
#define PSP_MAX_PADS 4 #define PSP_MAX_PADS 4
static int psp2_model;
static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info; static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info;
static SceCtrlActuator actuators[PSP_MAX_PADS] = {0}; static SceCtrlActuator actuators[PSP_MAX_PADS] = {0};
@ -64,7 +63,7 @@ extern uint64_t lifecycle_state;
static const char *psp_joypad_name(unsigned pad) static const char *psp_joypad_name(unsigned pad)
{ {
#ifdef VITA #ifdef VITA
if (psp2_model != SCE_KERNEL_MODEL_VITATV) if (!sceCtrlIsMultiControllerSupported())
return "Vita Controller"; return "Vita Controller";
switch (curr_ctrl_info.port[pad + 1]) switch (curr_ctrl_info.port[pad + 1])
@ -89,8 +88,7 @@ static bool psp_joypad_init(void *data)
(void)data; (void)data;
#if defined(VITA) #if defined(VITA)
psp2_model = sceKernelGetModelForCDialog(); if (!sceCtrlIsMultiControllerSupported())
if (psp2_model != SCE_KERNEL_MODEL_VITATV)
{ {
sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
@ -192,7 +190,7 @@ static void psp_joypad_poll(void)
#endif #endif
#ifdef VITA #ifdef VITA
if (psp2_model != SCE_KERNEL_MODEL_VITATV) if (!sceCtrlIsMultiControllerSupported())
players_count = 1; players_count = 1;
else else
{ {
@ -237,7 +235,7 @@ static void psp_joypad_poll(void)
SceCtrlData state_tmp; SceCtrlData state_tmp;
unsigned i = player; unsigned i = player;
#if defined(VITA) #if defined(VITA)
unsigned p = (psp2_model == SCE_KERNEL_MODEL_VITATV) ? player + 1 : player; unsigned p = (sceCtrlIsMultiControllerSupported()) ? player + 1 : player;
if (curr_ctrl_info.port[p] == SCE_CTRL_TYPE_UNPAIRED) if (curr_ctrl_info.port[p] == SCE_CTRL_TYPE_UNPAIRED)
continue; continue;
#elif defined(SN_TARGET_PSP2) #elif defined(SN_TARGET_PSP2)
@ -261,7 +259,7 @@ static void psp_joypad_poll(void)
continue; continue;
#endif #endif
#if defined(VITA) #if defined(VITA)
if (psp2_model == SCE_KERNEL_MODEL_VITA if (!sceCtrlIsMultiControllerSupported()
&& settings->bools.input_backtouch_enable) && settings->bools.input_backtouch_enable)
{ {
unsigned i; unsigned i;
@ -332,7 +330,7 @@ static bool psp_joypad_rumble(unsigned pad,
enum retro_rumble_effect effect, uint16_t strength) enum retro_rumble_effect effect, uint16_t strength)
{ {
#ifdef VITA #ifdef VITA
if (psp2_model != SCE_KERNEL_MODEL_VITATV) if (!sceCtrlIsMultiControllerSupported())
return false; return false;
switch (effect) switch (effect)