From 5799e35327be00d7e1d24f20be21409a48aa5863 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Wed, 4 Nov 2020 18:09:33 +0100 Subject: [PATCH] USB: remove outdated macros instances --- pcsx2/USB/configuration.cpp | 6 ++--- pcsx2/USB/configuration.h | 8 +++--- pcsx2/USB/platcompat.h | 9 ------- pcsx2/USB/usb-pad/dx/dinput-config.cpp | 36 +++++++++++++------------- pcsx2/USB/usb-pad/dx/dinput.cpp | 8 +++--- pcsx2/USB/usb-pad/raw/raw-config.cpp | 4 +-- 6 files changed, 31 insertions(+), 40 deletions(-) diff --git a/pcsx2/USB/configuration.cpp b/pcsx2/USB/configuration.cpp index c1f62f7656..cd159e9293 100644 --- a/pcsx2/USB/configuration.cpp +++ b/pcsx2/USB/configuration.cpp @@ -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 diff --git a/pcsx2/USB/configuration.h b/pcsx2/USB/configuration.h index 6fdc82dd8c..91a65cd28a 100644 --- a/pcsx2/USB/configuration.h +++ b/pcsx2/USB/configuration.h @@ -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); diff --git a/pcsx2/USB/platcompat.h b/pcsx2/USB/platcompat.h index e908d01a2e..98c358dd4b 100644 --- a/pcsx2/USB/platcompat.h +++ b/pcsx2/USB/platcompat.h @@ -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 diff --git a/pcsx2/USB/usb-pad/dx/dinput-config.cpp b/pcsx2/USB/usb-pad/dx/dinput-config.cpp index 18056decfd..6c6015a29c 100644 --- a/pcsx2/USB/usb-pad/dx/dinput-config.cpp +++ b/pcsx2/USB/usb-pad/dx/dinput-config.cpp @@ -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) diff --git a/pcsx2/USB/usb-pad/dx/dinput.cpp b/pcsx2/USB/usb-pad/dx/dinput.cpp index 3298d49ea8..c531c8d2e7 100644 --- a/pcsx2/USB/usb-pad/dx/dinput.cpp +++ b/pcsx2/USB/usb-pad/dx/dinput.cpp @@ -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); diff --git a/pcsx2/USB/usb-pad/raw/raw-config.cpp b/pcsx2/USB/usb-pad/raw/raw-config.cpp index 2e4759df12..0eef1b3e08 100644 --- a/pcsx2/USB/usb-pad/raw/raw-config.cpp +++ b/pcsx2/USB/usb-pad/raw/raw-config.cpp @@ -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(dev_type, numDevice, "RAW DEVICE", _T("HID"), it.hidPath); + SaveSetting(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++)