USB: fix debug builds on linux by switching to devcon

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-04 17:58:16 +01:00 committed by refractionpcsx2
parent ede7fa86fa
commit 73ca53eadc
5 changed files with 35 additions and 35 deletions

View File

@ -101,7 +101,7 @@ bool LoadSettingValue(const TSTDSTRING& ini, const TSTDSTRING& section, const TC
#endif
catch (std::exception& err)
{
OSDebugOut(TEXT("%" SFMTs "\n"), err.what());
DevCon.WriteLn("%s\n", err.what());
}
}
return false;
@ -161,7 +161,7 @@ void SaveConfig()
OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str());
#else
bool ret = ciniFile.Save(str_to_wstr(IniPath));
OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str());
DevCon.WriteLn("ciniFile.Save: %d [%s]\n", ret, IniPath.c_str());
#endif
}
@ -203,7 +203,7 @@ void LoadConfig()
if (dev)
{
OSDebugOut(_T("Checking device '%" SFMTs "' api: '%" SFMTs "'...\n"), conf.Port[i].c_str(), api.c_str());
DevCon.WriteLn("Checking device '%s' api: '%s'...\n", conf.Port[i].c_str(), api.c_str());
if (!dev->IsValidAPI(api))
{
api = "<invalid>";
@ -211,10 +211,10 @@ void LoadConfig()
if (!apis.empty())
api = *apis.begin();
OSDebugOut(_T("Invalid! Defaulting to '%" SFMTs "'\n"), api.c_str());
DevCon.WriteLn("Invalid! Defaulting to '%s'\n", api.c_str());
}
else
OSDebugOut(_T("API OK\n"));
DevCon.WriteLn("API OK\n");
}
if (api.size())

View File

@ -95,7 +95,7 @@ bool LoadSetting(const char* dev_type, int port, const std::string& key, const T
bool ret = false;
if (key.empty())
{
OSDebugOut(_T("Key is empty for '%s' on port %d\n"), name, port);
DevCon.WriteLn("Key is empty for '%s' on port %d\n", name, port);
return false;
}
@ -108,7 +108,7 @@ bool LoadSetting(const char* dev_type, int port, const std::string& key, const T
section << tkey << _T(" ") << port;
TSTDSTRING str = section.str();
OSDebugOut("[%s] '%s'=", str.c_str(), name);
DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);
ret = LoadSettingValue(IniPath, str, name, var);
if (ret)
OSDebugOutStream_noprfx(var);
@ -121,7 +121,7 @@ template <typename Type>
bool LoadSetting(const TCHAR* section, const TCHAR* key, Type& var)
{
bool ret = false;
OSDebugOut("[%s] '%s'=", section, key);
DevCon.WriteLn("[%s] '%s'=", section, key);
ret = LoadSettingValue(IniPath, section, key, var);
if (ret)
OSDebugOutStream_noprfx(var);
@ -150,7 +150,7 @@ bool SaveSetting(const char* dev_type, int port, const std::string& key, const T
bool ret = false;
if (key.empty())
{
OSDebugOut(_T("Key is empty for '%s' on port %d\n"), name, port);
DevCon.WriteLn("Key is empty for '%s' on port %d\n", name, port);
return false;
}
@ -163,7 +163,7 @@ bool SaveSetting(const char* dev_type, int port, const std::string& key, const T
section << tkey << _T(" ") << port;
TSTDSTRING str = section.str();
OSDebugOut(_T("[%s] '%s'="), str.c_str(), name);
DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);
ret = SaveSettingValue(IniPath, str, name, var);
OSDebugOutStream_noprfx(var);
@ -174,7 +174,7 @@ template <typename Type>
bool SaveSetting(const TCHAR* section, const TCHAR* key, const Type var)
{
bool ret = false;
OSDebugOut(_T("[%s] '%s'="), section, key);
DevCon.WriteLn("[%s] '%s'=", section, key);
ret = SaveSettingValue(IniPath, section, key, var);
OSDebugOutStream_noprfx(var);

View File

@ -60,7 +60,7 @@ static void wheeltypeChanged(GtkComboBox* widget, gpointer data)
uint8_t port = MIN(reinterpret_cast<uintptr_t>(data), 1);
conf.WheelType[port] = idx;
OSDebugOut("Selected wheel type, port %d idx: %d\n", port, idx);
DevCon.WriteLn("Selected wheel type, port %d idx: %d\n", port, idx);
}
}
@ -85,7 +85,7 @@ static void populateApiWidget(SettingsCB* settingsCB, const std::string& device)
else
api = it->second;
OSDebugOut("Current api: %s\n", api.c_str());
DevCon.WriteLn("Current api: %s\n", api.c_str());
settingsCB->api = api;
int i = 0;
for (auto& it : dev->ListAPIs())
@ -119,7 +119,7 @@ static void deviceChanged(GtkComboBox* widget, gpointer data)
else
conf.Port[0] = s;
OSDebugOut("Selected player %d idx: %d [%s]\n", player, active, s.c_str());
DevCon.WriteLn("Selected player %d idx: %d [%s]\n", player, active, s.c_str());
}
static void apiChanged(GtkComboBox* widget, gpointer data)
@ -147,7 +147,7 @@ static void apiChanged(GtkComboBox* widget, gpointer data)
changedAPIs[pair] = *it;
settingsCB->api = *it;
OSDebugOut("selected api: %s\n", it->c_str());
DevCon.WriteLn("selected api: %s\n", it->c_str());
}
}
}
@ -162,12 +162,12 @@ static void configureApi(GtkWidget* widget, gpointer data)
auto& api = settingsCB->api;
auto dev = RegisterDevice::instance().Device(name);
OSDebugOut("configure api %s [%s] for player %d\n", api.c_str(), name.c_str(), player);
DevCon.WriteLn("configure api %s [%s] for player %d\n", api.c_str(), name.c_str(), player);
if (dev)
{
GtkWidget* dlg = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "dlg"));
int res = dev->Configure(port, api, dlg);
OSDebugOut("Configure returned %d\n", res);
DevCon.WriteLn("Configure returned %d\n", res);
}
}
@ -252,7 +252,7 @@ void USBconfigure()
auto deviceProxy = RegisterDevice::instance().Device(device);
if (!deviceProxy)
{
OSDebugOut(_T("Device '%" SFMTs "' is registered, but failed to get proxy!\n"), device.c_str());
DevCon.WriteLn("Device '%s' is registered, but failed to get proxy!\n"), device.c_str();
continue;
}
auto name = deviceProxy->Name();

View File

@ -557,7 +557,7 @@ namespace usb_hid
HIDState* hs = &us->f.hid;
int ret;
OSDebugOut(TEXT("usb-hid: req %04X val: %04X idx: %04X len: %d\n"), request, value, index, length);
DevCon.WriteLn("usb-hid: req %04X val: %04X idx: %04X len: %d\n", request, value, index, length);
ret = usb_desc_handle_control(dev, p, request, value, index, length, data);
if (ret >= 0)
{
@ -642,7 +642,7 @@ namespace usb_hid
break;
case SET_IDLE:
hs->idle = (uint8_t)(value >> 8);
OSDebugOut(TEXT("IDLE %d\n"), hs->idle);
DevCon.WriteLn("IDLE %d\n", hs->idle);
hid_set_next_idle(hs);
if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET)
{
@ -897,7 +897,7 @@ namespace usb_hid
USBDevice* BeatManiaDevice::CreateDevice(int port)
{
OSDebugOut(_T("%s\n"), __func__);
DevCon.WriteLn("%s\n", __func__);
UsbHIDState* s;
std::string varApi;

View File

@ -91,7 +91,7 @@ namespace usb_pad
void SetAutoCenter(FFDevice* ffdev, const autocenter& effect)
{
OSDebugOut(_T("%s: k1 %d k2 %d clip %d\n"), __func__, effect.k1, effect.k2, effect.clip);
DevCon.WriteLn("%s: k1 %d k2 %d clip %d\n", __func__, effect.k1, effect.k2, effect.clip);
ffdev->SetAutoCenter((effect.k1 * effect.clip / 255) * 100 / 255); // FIXME
}
@ -103,7 +103,7 @@ namespace usb_pad
static int warned = 0;
int caps = 0;
OSDebugOut(TEXT("FFB %02X, %02X, %02X, %02X : %02X, %02X, %02X, %02X\n"),
DevCon.WriteLn("FFB %02X, %02X, %02X, %02X : %02X, %02X, %02X, %02X\n",
ffdata->cmdslot, ffdata->type, ffdata->u.params[0], ffdata->u.params[1],
ffdata->u.params[2], ffdata->u.params[3], ffdata->u.params[4], ffdata->padd0);
@ -173,7 +173,7 @@ namespace usb_pad
{
if (warned == 0)
{
OSDebugOut("variable force cannot be converted to constant force (l1=%hhu, t1=%hhu, s1=%hhu, d1=%hhu\n",
DevCon.WriteLn("variable force cannot be converted to constant force (l1=%hhu, t1=%hhu, s1=%hhu, d1=%hhu\n",
ffdata->u.variable.l1, ffdata->u.variable.t1, ffdata->u.variable.s1, ffdata->u.variable.d1);
warned = 1;
}
@ -189,7 +189,7 @@ namespace usb_pad
{
if (warned == 0)
{
OSDebugOut("variable force cannot be converted to constant force (l2=%hhu, t2=%hhu, s2=%hhu, d2=%hhu\n",
DevCon.WriteLn("variable force cannot be converted to constant force (l2=%hhu, t2=%hhu, s2=%hhu, d2=%hhu\n",
ffdata->u.variable.l2, ffdata->u.variable.t2, ffdata->u.variable.s2, ffdata->u.variable.d2);
warned = 1;
}
@ -216,7 +216,7 @@ namespace usb_pad
SetAutoCenter(mFFdev, ffdata->u.autocenter);
break;
default:
OSDebugOut(TEXT("CMD_DOWNLOAD_AND_PLAY: unhandled force type 0x%02X in slots 0x%02X\n"), ffdata->type, slots);
DevCon.WriteLn("CMD_DOWNLOAD_AND_PLAY: unhandled force type 0x%02X in slots 0x%02X\n", ffdata->type, slots);
break;
}
}
@ -251,7 +251,7 @@ namespace usb_pad
mFFdev->DisableForce(EFF_DAMPER);
break;
default:
OSDebugOut(TEXT("CMD_STOP: unhandled force type 0x%02X in slot 0x%02X\n"), ffdata->type, slots);
DevCon.WriteLn("CMD_STOP: unhandled force type 0x%02X in slot 0x%02X\n", ffdata->type, slots);
break;
}
}
@ -259,7 +259,7 @@ namespace usb_pad
}
break;
case CMD_DEFAULT_SPRING_ON: //0x04
OSDebugOut(TEXT("CMD_DEFAULT_SPRING_ON: unhandled cmd\n"));
DevCon.WriteLn("CMD_DEFAULT_SPRING_ON: unhandled cmd\n");
break;
case CMD_DEFAULT_SPRING_OFF: //0x05
{
@ -270,24 +270,24 @@ namespace usb_pad
}
else
{
OSDebugOut(TEXT("CMD_DEFAULT_SPRING_OFF: unhandled slots 0x%02X\n"), slots);
DevCon.WriteLn("CMD_DEFAULT_SPRING_OFF: unhandled slots 0x%02X\n", slots);
}
}
break;
case CMD_NORMAL_MODE: //0x08
OSDebugOut(TEXT("CMD_NORMAL_MODE: unhandled cmd\n"));
DevCon.WriteLn("CMD_NORMAL_MODE: unhandled cmd\n");
break;
case CMD_SET_LED: //0x09
OSDebugOut(TEXT("CMD_SET_LED: unhandled cmd\n"));
DevCon.WriteLn("CMD_SET_LED: unhandled cmd\n");
break;
case CMD_RAW_MODE: //0x0B
OSDebugOut(TEXT("CMD_RAW_MODE: unhandled cmd\n"));
DevCon.WriteLn("CMD_RAW_MODE: unhandled cmd\n");
break;
case CMD_SET_DEFAULT_SPRING: //0x0E
OSDebugOut(TEXT("CMD_SET_DEFAULT_SPRING: unhandled cmd\n"));
DevCon.WriteLn("CMD_SET_DEFAULT_SPRING: unhandled cmd\n");
break;
case CMD_SET_DEAD_BAND: //0x0F
OSDebugOut(TEXT("CMD_SET_DEAD_BAND: unhandled cmd\n"));
DevCon.WriteLn("CMD_SET_DEAD_BAND: unhandled cmd\n");
break;
}
}
@ -302,7 +302,7 @@ namespace usb_pad
if (ffdata->type == EXT_CMD_WHEEL_RANGE_200_DEGREES)
{
}
OSDebugOut(TEXT("CMD_EXTENDED: unhandled cmd 0x%02X%02X%02X\n"),
DevCon.WriteLn("CMD_EXTENDED: unhandled cmd 0x%02X%02X%02X\n",
ffdata->type, ffdata->u.params[0], ffdata->u.params[1]);
}
}