USB: remove outdated macros instances

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-04 18:09:33 +01:00 committed by refractionpcsx2
parent 73ca53eadc
commit 5799e35327
6 changed files with 31 additions and 40 deletions

View File

@ -158,7 +158,7 @@ void SaveConfig()
#ifdef _WIN32
bool ret = ciniFile.Save(IniPath);
OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str());
OSDebugOut(TEXT("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str());
#else
bool ret = ciniFile.Save(str_to_wstr(IniPath));
DevCon.WriteLn("ciniFile.Save: %d [%s]\n", ret, IniPath.c_str());
@ -242,8 +242,8 @@ void RemoveSection(const char* dev_type, int port, const std::string& key)
TSTDSTRINGSTREAM section;
if (dev_type)
section << dev_type << _T(" ");
section << tkey << _T(" ") << port;
section << dev_type << TEXT(" ");
section << tkey << TEXT(" ") << port;
TSTDSTRING str = section.str();
#ifdef _WIN32

View File

@ -104,8 +104,8 @@ bool LoadSetting(const char* dev_type, int port, const std::string& key, const T
TSTDSTRINGSTREAM section;
if (dev_type)
section << dev_type << _T(" ");
section << tkey << _T(" ") << port;
section << dev_type << TEXT(" ");
section << tkey << TEXT(" ") << port;
TSTDSTRING str = section.str();
DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);
@ -159,8 +159,8 @@ bool SaveSetting(const char* dev_type, int port, const std::string& key, const T
TSTDSTRINGSTREAM section;
if (dev_type)
section << dev_type << _T(" ");
section << tkey << _T(" ") << port;
section << dev_type << TEXT(" ");
section << tkey << TEXT(" ") << port;
TSTDSTRING str = section.str();
DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);

View File

@ -56,11 +56,6 @@
#define TSTDSTRINGSTREAM std::wstringstream
#define TSTDTOSTRING std::to_wstring
#ifdef _MSC_VER
//typedef SSIZE_T ssize_t;
#endif
//FIXME narrow string fmt
#define SFMTs "S"
@ -69,10 +64,6 @@
void SysMessageW(const wchar_t* fmt, ...);
#define SysMessage SysMessageW
#ifndef _T
#define _T(x) L##x
#endif
#else //_WIN32
#define MAX_PATH PATH_MAX

View File

@ -442,7 +442,7 @@ namespace usb_pad
{
CID = controlid;
RemoveInputMap(port, controlid);
SetWindowText(GetDlgItem(hWnd, LABELS[CID]), _T("Unmapped"));
SetWindowText(GetDlgItem(hWnd, LABELS[CID]), TEXT("Unmapped"));
}
void CreateDrawing(int port, HDC hDrawingDC, int scale)
@ -1220,18 +1220,18 @@ namespace usb_pad
void SaveDInputConfig(int port, const char* dev_type)
{
SaveSetting(_T("dinput"), _T("BYPASSCAL"), BYPASSCAL);
SaveSetting(TEXT("dinput"), TEXT("BYPASSCAL"), BYPASSCAL);
wchar_t section[256];
swprintf_s(section, L"%S dinput %d", dev_type, port);
ClearSection(section);
SaveSetting(section, _T("INVERTFORCES"), INVERTFORCES[port]);
SaveSetting(section, TEXT("INVERTFORCES"), INVERTFORCES[port]);
#ifdef _WIN32
SaveSetting(section, _T("# CONTROL n"), str_to_wstr("GUID,MAPPING TYPE,MAPPED TO,INVERTED,HALF,LINEAR,OFFSET,DEADZONE"));
SaveSetting(section, TEXT("# 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");
SaveSetting(section, TEXT("# CONTROL n"), "GUID,MAPPING TYPE,MAPPED TO,INVERTED,HALF,LINEAR,OFFSET,DEADZONE");
#endif
for (auto& control : g_Controls[port])
@ -1242,7 +1242,7 @@ namespace usb_pad
std::stringstream ss;
ss << joy->GetGUID() << "," << im.type << "," << im.mapped;
//SaveSetting(section, _T("ProductName"), joy->Product());
//SaveSetting(section, TEXT("ProductName"), joy->Product());
if (joy->GetControlType() == CT_JOYSTICK)
{
@ -1253,7 +1253,7 @@ namespace usb_pad
<< "," << im.DEADZONE;
}
swprintf_s(text, _T("CONTROL %i"), cid);
swprintf_s(text, TEXT("CONTROL %i"), cid);
#ifdef _WIN32
SaveSetting(section, text, str_to_wstr(ss.str()));
#else
@ -1261,29 +1261,29 @@ namespace usb_pad
#endif
}
SaveSetting(section, _T("GAINZ"), GAINZ[port][0]);
SaveSetting(section, _T("FFMULTI"), FFMULTI[port][0]);
SaveSetting(section, TEXT("GAINZ"), GAINZ[port][0]);
SaveSetting(section, TEXT("FFMULTI"), FFMULTI[port][0]);
//only for config dialog
SaveSetting(section, _T("UseRamp"), useRamp);
SaveSetting(section, TEXT("UseRamp"), useRamp);
}
void LoadDInputConfig(int port, const char* dev_type)
{
LoadSetting(_T("dinput"), _T("BYPASSCAL"), BYPASSCAL);
LoadSetting(TEXT("dinput"), TEXT("BYPASSCAL"), BYPASSCAL);
wchar_t section[256];
swprintf_s(section, L"%S dinput %d", dev_type, port);
LoadSetting(section, _T("INVERTFORCES"), INVERTFORCES[port]);
if (!LoadSetting(section, _T("GAINZ"), GAINZ[port][0]))
LoadSetting(section, TEXT("INVERTFORCES"), INVERTFORCES[port]);
if (!LoadSetting(section, TEXT("GAINZ"), GAINZ[port][0]))
GAINZ[port][0] = 10000;
if (!LoadSetting(section, _T("FFMULTI"), FFMULTI[port][0]))
if (!LoadSetting(section, TEXT("FFMULTI"), FFMULTI[port][0]))
FFMULTI[port][0] = 0;
try
{
swprintf_s(section, _T("%" SFMTs " dinput %d"), dev_type, port);
swprintf_s(section, TEXT("%" SFMTs " dinput %d"), dev_type, port);
for (int cid = 0; cid < CID_COUNT; cid++)
{
@ -1292,7 +1292,7 @@ namespace usb_pad
std::string control, guid, value;
std::stringstream ss;
swprintf_s(text, _T("CONTROL %i"), cid);
swprintf_s(text, TEXT("CONTROL %i"), cid);
#ifdef _WIN32
if (!LoadSetting(section, text, str_to_wstr(control)))
#else
@ -1323,7 +1323,7 @@ namespace usb_pad
if (im.type == MT_NONE)
{
OSDebugOut(_T("Skipping control %d (%s), mapping type is None\n"), cid, g_pJoysticks[im.index]->Product().c_str());
OSDebugOut(TEXT("Skipping control %d (%s), mapping type is None\n"), cid, g_pJoysticks[im.index]->Product().c_str());
continue;
}
@ -1352,7 +1352,7 @@ namespace usb_pad
OSDebugOut(TEXT("%" SFMTs "\n"), err.what());
}
LoadSetting(section, _T("UseRamp"), useRamp);
LoadSetting(section, TEXT("UseRamp"), useRamp);
}
int DInputPad::Configure(int port, const char* dev_type, void* data)

View File

@ -846,7 +846,7 @@ namespace usb_pad
pKeyboard->SetDataFormat(&c_dfDIKeyboard);
pKeyboard->SetCooperativeLevel(hWindow, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
pKeyboard->Acquire();
g_pJoysticks.push_back(new JoystickDevice(CT_KEYBOARD, pKeyboard, GUID_SysKeyboard, _T("SysKeyboard")));
g_pJoysticks.push_back(new JoystickDevice(CT_KEYBOARD, pKeyboard, GUID_SysKeyboard, TEXT("SysKeyboard")));
}
OSDebugOut(TEXT("DINPUT: CreateDevice Mouse %p\n"), hWindow);
@ -857,7 +857,7 @@ namespace usb_pad
pMouse->SetDataFormat(&c_dfDIMouse2);
pMouse->SetCooperativeLevel(hWindow, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
pMouse->Acquire();
g_pJoysticks.push_back(new JoystickDevice(CT_MOUSE, pMouse, GUID_SysMouse, _T("SysMouse")));
g_pJoysticks.push_back(new JoystickDevice(CT_MOUSE, pMouse, GUID_SysMouse, TEXT("SysMouse")));
}
//enumerate attached only
@ -869,7 +869,7 @@ namespace usb_pad
{
auto joy = g_pJoysticks[i];
auto device = joy->GetDevice();
OSDebugOut(_T("DINPUT: SetDataFormat Joystick %s\n"), joy->Product().c_str());
OSDebugOut(TEXT("DINPUT: SetDataFormat Joystick %s\n"), joy->Product().c_str());
device->SetDataFormat(&c_dfDIJoystick2);
DIDEVCAPS diCaps;
@ -878,7 +878,7 @@ namespace usb_pad
if (diCaps.dwFlags & DIDC_FORCEFEEDBACK)
{
OSDebugOut(_T("DINPUT: SetCooperativeLevel Joystick %s\n"), joy->Product().c_str());
OSDebugOut(TEXT("DINPUT: SetCooperativeLevel Joystick %s\n"), joy->Product().c_str());
//Exclusive
device->SetCooperativeLevel(hWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND);

View File

@ -56,7 +56,7 @@ namespace usb_pad
std::wstring hid, tmp;
//swprintf_s(sec, TEXT("%S RAW DEVICE %d"), dev_type, j++);
if (LoadSetting(dev_type, j, "RAW DEVICE", _T("HID"), hid) && !hid.empty() && !MapExists(maps, hid))
if (LoadSetting(dev_type, j, "RAW DEVICE", TEXT("HID"), hid) && !hid.empty() && !MapExists(maps, hid))
{
Mappings m;
ZeroMemory(&m, sizeof(Mappings));
@ -106,7 +106,7 @@ namespace usb_pad
{
WCHAR dev[1024] = {0}, tmp[16] = {0}, bind[32] = {0};
SaveSetting<std::wstring>(dev_type, numDevice, "RAW DEVICE", _T("HID"), it.hidPath);
SaveSetting<std::wstring>(dev_type, numDevice, "RAW DEVICE", TEXT("HID"), it.hidPath);
//writing everything separately, then string lengths are more predictable
for (int i = 0; i < MAX_BUTTONS; i++)