rpcsx/rpcs3/Input/pad_thread.cpp

304 lines
7.3 KiB
C++
Raw Normal View History

2020-12-05 13:08:24 +01:00
#include "stdafx.h"
#include "pad_thread.h"
#include "product_info.h"
2019-02-02 15:15:09 +01:00
#include "ds3_pad_handler.h"
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 12:07:33 +02:00
#include "ds4_pad_handler.h"
#include "dualsense_pad_handler.h"
#ifdef _WIN32
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 12:07:33 +02:00
#include "xinput_pad_handler.h"
#include "mm_joystick_handler.h"
#elif HAVE_LIBEVDEV
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 12:07:33 +02:00
#include "evdev_joystick_handler.h"
#endif
CMake: Refactor CMake build (#5032) * CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
2018-09-18 12:07:33 +02:00
#include "keyboard_pad_handler.h"
#include "Emu/Io/Null/NullPadHandler.h"
2020-02-22 20:42:49 +01:00
#include "Emu/Io/PadHandler.h"
#include "Emu/Io/pad_config.h"
LOG_CHANNEL(input_log, "Input");
namespace pad
{
atomic_t<pad_thread*> g_current = nullptr;
2021-05-28 11:35:03 +02:00
shared_mutex g_pad_mutex;
std::string g_title_id;
atomic_t<bool> g_reset{false};
2020-06-26 08:40:05 +02:00
atomic_t<bool> g_enabled{true};
atomic_t<bool> g_active{false};
}
2018-12-17 19:13:35 +01:00
struct pad_setting
{
u32 port_status = 0;
u32 device_capability = 0;
u32 device_type = 0;
s32 ldd_handle = -1;
2018-12-17 19:13:35 +01:00
};
2019-09-18 01:44:06 +02:00
pad_thread::pad_thread(void *_curthread, void *_curwindow, std::string_view title_id) : curthread(_curthread), curwindow(_curwindow)
{
pad::g_title_id = title_id;
2018-12-17 19:13:35 +01:00
Init();
thread = std::make_shared<std::thread>(&pad_thread::ThreadFunc, this);
pad::g_current = this;
}
pad_thread::~pad_thread()
{
pad::g_current = nullptr;
pad::g_active = false;
2018-12-17 19:13:35 +01:00
thread->join();
handlers.clear();
}
void pad_thread::Init()
{
std::lock_guard lock(pad::g_pad_mutex);
// Cache old settings if possible
std::array<pad_setting, CELL_PAD_MAX_PORT_NUM> pad_settings;
2018-12-17 19:13:35 +01:00
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; i++) // max 7 pads
{
if (m_pads[i])
2018-12-17 19:13:35 +01:00
{
pad_settings[i] =
{
m_pads[i]->m_port_status,
m_pads[i]->m_device_capability,
m_pads[i]->m_device_type,
m_pads[i]->ldd ? static_cast<s32>(i) : -1
};
2018-12-17 19:13:35 +01:00
}
else
{
pad_settings[i] =
{
CELL_PAD_STATUS_DISCONNECTED,
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_ACTUATOR,
CELL_PAD_DEV_TYPE_STANDARD,
-1
};
2018-12-17 19:13:35 +01:00
}
}
num_ldd_pad = 0;
[Qt/Input] Improve pad_settings_dialog a bit (#3611) * Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
2017-11-27 22:31:15 +01:00
m_info.now_connect = 0;
2018-12-17 19:13:35 +01:00
handlers.clear();
g_cfg_input.load(pad::g_title_id);
std::shared_ptr<keyboard_pad_handler> keyptr;
2018-12-17 19:13:35 +01:00
// Always have a Null Pad Handler
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
handlers.emplace(pad_handler::null, nullpad);
2018-12-17 19:13:35 +01:00
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; i++) // max 7 pads
{
std::shared_ptr<PadHandlerBase> cur_pad_handler;
const bool is_ldd_pad = pad_settings[i].ldd_handle == static_cast<s32>(i);
const auto handler_type = is_ldd_pad ? pad_handler::null : g_cfg_input.player[i]->handler.get();
2018-12-17 19:13:35 +01:00
2020-11-01 01:11:16 +01:00
if (handlers.contains(handler_type))
{
[Qt/Input] Improve pad_settings_dialog a bit (#3611) * Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
2017-11-27 22:31:15 +01:00
cur_pad_handler = handlers[handler_type];
}
else
{
[Qt/Input] Improve pad_settings_dialog a bit (#3611) * Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
2017-11-27 22:31:15 +01:00
switch (handler_type)
{
case pad_handler::keyboard:
keyptr = std::make_shared<keyboard_pad_handler>();
2019-12-04 21:56:19 +01:00
keyptr->moveToThread(static_cast<QThread*>(curthread));
keyptr->SetTargetWindow(static_cast<QWindow*>(curwindow));
cur_pad_handler = keyptr;
break;
2019-02-02 15:15:09 +01:00
case pad_handler::ds3:
cur_pad_handler = std::make_shared<ds3_pad_handler>();
break;
case pad_handler::ds4:
cur_pad_handler = std::make_shared<ds4_pad_handler>();
break;
case pad_handler::dualsense:
cur_pad_handler = std::make_shared<dualsense_pad_handler>();
break;
#ifdef _WIN32
case pad_handler::xinput:
cur_pad_handler = std::make_shared<xinput_pad_handler>();
break;
case pad_handler::mm:
cur_pad_handler = std::make_shared<mm_joystick_handler>();
break;
#endif
#ifdef HAVE_LIBEVDEV
case pad_handler::evdev:
cur_pad_handler = std::make_shared<evdev_joystick_handler>();
break;
#endif
2021-04-07 23:05:18 +02:00
case pad_handler::null:
break;
}
[Qt/Input] Improve pad_settings_dialog a bit (#3611) * Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
2017-11-27 22:31:15 +01:00
handlers.emplace(handler_type, cur_pad_handler);
}
2021-02-09 02:24:33 +01:00
cur_pad_handler->set_player(i);
cur_pad_handler->Init();
m_pads[i] = std::make_shared<Pad>(CELL_PAD_STATUS_DISCONNECTED, pad_settings[i].device_capability, pad_settings[i].device_type);
if (is_ldd_pad)
{
InitLddPad(pad_settings[i].ldd_handle);
}
else if (cur_pad_handler->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string()) == false)
{
2018-12-17 19:13:35 +01:00
// Failed to bind the device to cur_pad_handler so binds to NullPadHandler
input_log.error("Failed to bind device %s to handler %s", g_cfg_input.player[i]->device.to_string(), handler_type);
nullpad->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string());
}
}
}
2017-09-12 23:42:00 +02:00
void pad_thread::SetRumble(const u32 pad, u8 largeMotor, bool smallMotor)
{
if (pad > m_pads.size())
return;
if (m_pads[pad]->m_vibrateMotors.size() >= 2)
{
m_pads[pad]->m_vibrateMotors[0].m_value = largeMotor;
m_pads[pad]->m_vibrateMotors[1].m_value = smallMotor ? 255 : 0;
}
}
2018-12-30 02:34:15 +01:00
void pad_thread::SetIntercepted(bool intercepted)
{
if (intercepted)
{
m_info.system_info |= CELL_PAD_INFO_INTERCEPTED;
m_info.ignore_input = true;
2018-12-30 02:34:15 +01:00
}
else
{
m_info.system_info &= ~CELL_PAD_INFO_INTERCEPTED;
2018-12-30 02:34:15 +01:00
}
}
void pad_thread::ThreadFunc()
{
pad::g_active = true;
while (pad::g_active)
{
if (!pad::g_enabled)
{
std::this_thread::sleep_for(1ms);
continue;
}
if (pad::g_reset && pad::g_reset.exchange(false))
2018-12-17 19:13:35 +01:00
{
Init();
}
u32 connected_devices = 0;
for (auto& cur_pad_handler : handlers)
{
cur_pad_handler.second->ThreadProc();
connected_devices += cur_pad_handler.second->connected_devices;
}
m_info.now_connect = connected_devices + num_ldd_pad;
// The following section is only reached when a dialog was closed and the pads are still intercepted.
// As long as any of the listed buttons is pressed, cellPadGetData will ignore all input (needed for Hotline Miami).
// ignore_input was added because if we keep the pads intercepted, then some games will enter the menu due to unexpected system interception (tested with Ninja Gaiden Sigma).
if (!(m_info.system_info & CELL_PAD_INFO_INTERCEPTED) && m_info.ignore_input)
{
bool any_button_pressed = false;
for (const auto& pad : m_pads)
{
if (pad->m_port_status & CELL_PAD_STATUS_CONNECTED)
{
for (const auto& button : pad->m_buttons)
{
if (button.m_pressed && (
button.m_outKeyCode == CELL_PAD_CTRL_CROSS ||
button.m_outKeyCode == CELL_PAD_CTRL_CIRCLE ||
button.m_outKeyCode == CELL_PAD_CTRL_TRIANGLE ||
button.m_outKeyCode == CELL_PAD_CTRL_SQUARE ||
button.m_outKeyCode == CELL_PAD_CTRL_START ||
button.m_outKeyCode == CELL_PAD_CTRL_SELECT))
{
any_button_pressed = true;
break;
}
}
if (any_button_pressed)
{
break;
}
}
}
if (!any_button_pressed)
{
m_info.ignore_input = false;
}
}
std::this_thread::sleep_for(1ms);
}
}
2019-04-28 23:35:11 +02:00
void pad_thread::InitLddPad(u32 handle)
{
if (handle >= m_pads.size())
{
return;
}
static const auto product = input::get_product_info(input::product_type::playstation_3_controller);
m_pads[handle]->ldd = true;
m_pads[handle]->Init
(
CELL_PAD_STATUS_CONNECTED | CELL_PAD_STATUS_ASSIGN_CHANGES | CELL_PAD_STATUS_CUSTOM_CONTROLLER,
CELL_PAD_CAPABILITY_PS3_CONFORMITY,
CELL_PAD_DEV_TYPE_LDD,
0, // CELL_PAD_PCLASS_TYPE_STANDARD
product.pclass_profile,
product.vendor_id,
product.product_id
);
num_ldd_pad++;
}
2019-04-28 23:35:11 +02:00
s32 pad_thread::AddLddPad()
{
// Look for first null pad
for (u32 i = 0; i < CELL_PAD_MAX_PORT_NUM; i++)
{
if (g_cfg_input.player[i]->handler == pad_handler::null && !m_pads[i]->ldd)
2019-04-28 23:35:11 +02:00
{
InitLddPad(i);
2019-04-28 23:35:11 +02:00
return i;
}
}
return -1;
}
void pad_thread::UnregisterLddPad(u32 handle)
{
m_pads[handle]->ldd = false;
num_ldd_pad--;
}