mirror of https://github.com/PCSX2/pcsx2.git
USB: introduce back linux support
This commit is contained in:
parent
30235f49db
commit
92be17986f
|
@ -136,15 +136,24 @@ void SaveConfig()
|
|||
SaveSetting("MAIN", "log", conf.Log);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
SaveSetting(nullptr, 0, N_DEVICE_PORT, N_DEVICE, str_to_wstr(conf.Port[0]));
|
||||
SaveSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, str_to_wstr(conf.Port[1]));
|
||||
#else
|
||||
SaveSetting(nullptr, 0, N_DEVICE_PORT, N_DEVICE, conf.Port[0]);
|
||||
SaveSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, conf.Port[1]);
|
||||
#endif
|
||||
|
||||
SaveSetting(nullptr, 0, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[0]);
|
||||
SaveSetting(nullptr, 1, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[1]);
|
||||
|
||||
for (auto& k : changedAPIs)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SaveSetting(nullptr, k.first.first, k.first.second, N_DEVICE_API, str_to_wstr(k.second));
|
||||
#else
|
||||
SaveSetting(nullptr, k.first.first, k.first.second, N_DEVICE_API, k.second);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -169,8 +178,13 @@ void LoadConfig()
|
|||
LoadSetting("MAIN", "log", conf.Log);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, 0, N_DEVICE_PORT, N_DEVICE, str_to_wstr(conf.Port[0]));
|
||||
LoadSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, str_to_wstr(conf.Port[1]));
|
||||
#else
|
||||
LoadSetting(nullptr, 0, N_DEVICE_PORT, N_DEVICE, conf.Port[0]);
|
||||
LoadSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, conf.Port[1]);
|
||||
#endif
|
||||
|
||||
LoadSetting(nullptr, 0, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[0]);
|
||||
LoadSetting(nullptr, 1, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[1]);
|
||||
|
@ -180,7 +194,11 @@ void LoadConfig()
|
|||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
std::string api;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, i, conf.Port[i], N_DEVICE_API, str_to_wstr(api));
|
||||
#else
|
||||
LoadSetting(nullptr, i, conf.Port[i], N_DEVICE_API, api);
|
||||
#endif
|
||||
auto dev = instance.Device(conf.Port[i]);
|
||||
|
||||
if (dev)
|
||||
|
|
|
@ -516,7 +516,11 @@ namespace usb_eyetoy
|
|||
{
|
||||
VideoDevice* videodev = nullptr;
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
VideoDeviceProxyBase* proxy = RegisterVideoDevice::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
|
|
@ -730,7 +730,11 @@ namespace usb_hid
|
|||
UsbHIDState* s;
|
||||
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
UsbHIDProxyBase* proxy = RegisterUsbHID::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
@ -821,7 +825,11 @@ namespace usb_hid
|
|||
UsbHIDState* s;
|
||||
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
UsbHIDProxyBase* proxy = RegisterUsbHID::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
@ -893,7 +901,11 @@ namespace usb_hid
|
|||
UsbHIDState* s;
|
||||
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
UsbHIDProxyBase* proxy = RegisterUsbHID::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
|
|
@ -986,7 +986,11 @@ namespace usb_mic
|
|||
USBDevice* HeadsetDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string api;
|
||||
#ifdef _WIN32
|
||||
if (!LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(api)))
|
||||
#else
|
||||
if (!LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, api))
|
||||
#endif
|
||||
return nullptr;
|
||||
return HeadsetDevice::CreateDevice(port, api);
|
||||
}
|
||||
|
|
|
@ -243,7 +243,11 @@ namespace usb_mic
|
|||
USBDevice* LogitechMicDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string api;
|
||||
#ifdef _WIN32
|
||||
if (!LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(api)))
|
||||
#else
|
||||
if (!LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, api))
|
||||
#endif
|
||||
return nullptr;
|
||||
|
||||
USBDevice* dev = SingstarDevice::CreateDevice(port, api);
|
||||
|
|
|
@ -778,7 +778,11 @@ namespace usb_mic
|
|||
USBDevice* SingstarDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string api;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, SingstarDevice::TypeName(), N_DEVICE_API, str_to_wstr(api));
|
||||
#else
|
||||
LoadSetting(nullptr, port, SingstarDevice::TypeName(), N_DEVICE_API, api);
|
||||
#endif
|
||||
return SingstarDevice::CreateDevice(port, api);
|
||||
}
|
||||
USBDevice* SingstarDevice::CreateDevice(int port, const std::string& api)
|
||||
|
|
|
@ -1228,7 +1228,11 @@ namespace usb_pad
|
|||
ClearSection(section);
|
||||
SaveSetting(section, _T("INVERTFORCES"), INVERTFORCES[port]);
|
||||
|
||||
#ifdef _WIN32
|
||||
SaveSetting(section, _T("# CONTROL n"), str_to_wstr("GUID,MAPPING TYPE,MAPPED TO,INVERTED,HALF,LINEAR,OFFSET,DEADZONE"));
|
||||
#else
|
||||
SaveSetting(section, _T("# CONTROL n"), "GUID,MAPPING TYPE,MAPPED TO,INVERTED,HALF,LINEAR,OFFSET,DEADZONE");
|
||||
#endif
|
||||
|
||||
for (auto& control : g_Controls[port])
|
||||
{
|
||||
|
@ -1250,7 +1254,11 @@ namespace usb_pad
|
|||
}
|
||||
|
||||
swprintf_s(text, _T("CONTROL %i"), cid);
|
||||
#ifdef _WIN32
|
||||
SaveSetting(section, text, str_to_wstr(ss.str()));
|
||||
#else
|
||||
SaveSetting(section, text, ss.str());
|
||||
#endif
|
||||
}
|
||||
|
||||
SaveSetting(section, _T("GAINZ"), GAINZ[port][0]);
|
||||
|
@ -1285,7 +1293,11 @@ namespace usb_pad
|
|||
std::stringstream ss;
|
||||
|
||||
swprintf_s(text, _T("CONTROL %i"), cid);
|
||||
#ifdef _WIN32
|
||||
if (!LoadSetting(section, text, str_to_wstr(control)))
|
||||
#else
|
||||
if (!LoadSetting(section, text, control))
|
||||
#endif
|
||||
continue;
|
||||
|
||||
ss << control;
|
||||
|
|
|
@ -539,7 +539,11 @@ namespace usb_pad
|
|||
USBDevice* PadDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
PadProxyBase* proxy = RegisterPad::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
@ -663,7 +667,11 @@ namespace usb_pad
|
|||
USBDevice* RBDrumKitDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
PadProxyBase* proxy = RegisterPad::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
@ -732,7 +740,11 @@ namespace usb_pad
|
|||
USBDevice* BuzzDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
PadProxyBase* proxy = RegisterPad::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
|
|
@ -392,7 +392,11 @@ namespace usb_pad
|
|||
USBDevice* SeamicDevice::CreateDevice(int port)
|
||||
{
|
||||
std::string varApi;
|
||||
#ifdef _WIN32
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, str_to_wstr(varApi));
|
||||
#else
|
||||
LoadSetting(nullptr, port, TypeName(), N_DEVICE_API, varApi);
|
||||
#endif
|
||||
PadProxyBase* proxy = RegisterPad::instance().Proxy(varApi);
|
||||
if (!proxy)
|
||||
{
|
||||
|
@ -401,10 +405,16 @@ namespace usb_pad
|
|||
return NULL;
|
||||
}
|
||||
|
||||
USB_LOG("usb-pad: creating device '%s' on port %d with %s\n", TypeName(), port, str_to_wstr(varApi));
|
||||
|
||||
std::string api;
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
USB_LOG("usb-pad: creating device '%s' on port %d with %s\n", TypeName(), port, str_to_wstr(varApi));
|
||||
if (!LoadSetting(nullptr, port, usb_mic::SingstarDevice::TypeName(), N_DEVICE_API, str_to_wstr(api)))
|
||||
#else
|
||||
USB_LOG("usb-pad: creating device '%s' on port %d with %s\n", TypeName(), port, varApi.c_str());
|
||||
if (!LoadSetting(nullptr, port, usb_mic::SingstarDevice::TypeName(), N_DEVICE_API, api))
|
||||
#endif
|
||||
return nullptr;
|
||||
|
||||
USBDevice* mic = usb_mic::SingstarDevice::CreateDevice(port, api);
|
||||
|
|
Loading…
Reference in New Issue