From 1b1fc39f02ef4824316f400092e2fceffa3aab97 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:21:20 -0700 Subject: [PATCH 01/25] handle to GetFileVersionInfoW must be zero --- Source/Core/Common/CompatPatches.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/CompatPatches.cpp b/Source/Core/Common/CompatPatches.cpp index f2b179eb12..260488cd6a 100644 --- a/Source/Core/Common/CompatPatches.cpp +++ b/Source/Core/Common/CompatPatches.cpp @@ -183,7 +183,7 @@ static bool GetModuleVersion(const wchar_t* name, Version* version) if (!data_len) return false; std::vector block(data_len); - if (!GetFileVersionInfoW(path->c_str(), handle, data_len, block.data())) + if (!GetFileVersionInfoW(path->c_str(), 0, data_len, block.data())) return false; void* buf; UINT buf_len; From 3bc8a26083549087c3bb285d5742a71160ae146b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:23:28 -0700 Subject: [PATCH 02/25] don't use std::move on const variables --- Source/Core/Common/FileSearch.cpp | 2 +- Source/Core/Core/IOS/ES/Formats.cpp | 4 ++-- Source/Core/UICommon/CommandLineParse.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index 6b28b93b4c..ff2de8eb3b 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -98,7 +98,7 @@ std::vector DoFileSearch(const std::vector& directorie }; for (const auto& directory : directories) { - const fs::path directory_path = StringToPath(directory); + fs::path directory_path = StringToPath(directory); if (fs::is_directory(directory_path)) // Can't create iterators for non-existant directories { if (recursive) diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index c1c815aef4..6e9a31f55c 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -621,7 +621,7 @@ UIDSys::UIDSys(std::shared_ptr fs) : m_fs{fs} { while (true) { - const std::pair entry = ReadUidSysEntry(*file); + std::pair entry = ReadUidSysEntry(*file); if (!entry.first && !entry.second) break; @@ -766,7 +766,7 @@ std::map ParseCertChain(const std::vector& chain) return certs; processed += cert_reader.GetBytes().size(); - const std::string name = cert_reader.GetName(); + std::string name = cert_reader.GetName(); certs.emplace(std::move(name), std::move(cert_reader)); } return certs; diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index c89a5784f0..6c06cb2ef2 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -45,7 +45,7 @@ public: std::getline(buffer, section, '.'); std::getline(buffer, key, '='); std::getline(buffer, value, '='); - const std::optional system = Config::GetSystemFromName(system_str); + std::optional system = Config::GetSystemFromName(system_str); if (system) { m_values.emplace_back( From 49590c9a42d8d6912f87d70eb92ad369c1a992d5 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:24:03 -0700 Subject: [PATCH 03/25] FileUtil: handle some error conditions --- Source/Core/Common/FileUtil.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index d5ba4d03a0..b3efa6b868 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -600,7 +600,7 @@ std::string GetCurrentDir() if (!dir) { ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LastStrerrorString().c_str()); - return nullptr; + return ""; } std::string strDir = dir; free(dir); @@ -621,10 +621,15 @@ std::string CreateTempDir() return ""; GUID guid; - CoCreateGuid(&guid); - TCHAR tguid[40]; - StringFromGUID2(guid, tguid, 39); - tguid[39] = 0; + if (FAILED(CoCreateGuid(&guid))) + { + return ""; + } + OLECHAR tguid[40]{}; + if (!StringFromGUID2(guid, tguid, _countof(tguid))) + { + return ""; + } std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid); if (!CreateDir(dir)) return ""; From b021573a7074a07e8e391526d818555caef24d3f Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:24:46 -0700 Subject: [PATCH 04/25] GekkoDisassembler: fix rld* --- Source/Core/Common/GekkoDisassembler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/GekkoDisassembler.cpp b/Source/Core/Common/GekkoDisassembler.cpp index 040ac84980..828adcaf03 100644 --- a/Source/Core/Common/GekkoDisassembler.cpp +++ b/Source/Core/Common/GekkoDisassembler.cpp @@ -1470,7 +1470,7 @@ u32* GekkoDisassembler::DoDisassembly(bool big_endian) break; case 30: - switch (in & 0x1c) + switch ((in >> 2) & 0x7) { case 0: rld(in, "icl", 0); // rldicl From c22748dc38596ffc42b77496fdb62ef2c92efdcc Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:26:38 -0700 Subject: [PATCH 05/25] windows: fix some incorrect string lengths --- Source/Core/Common/Timer.cpp | 2 +- Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp index 81fb792ff3..d33d1951eb 100644 --- a/Source/Core/Common/Timer.cpp +++ b/Source/Core/Common/Timer.cpp @@ -254,7 +254,7 @@ std::string Timer::GetDateTimeFormatted(double time) #ifdef _WIN32 wchar_t tmp[32] = {}; - wcsftime(tmp, sizeof(tmp), L"%x %X", localTime); + wcsftime(tmp, std::size(tmp), L"%x %X", localTime); return WStringToUTF8(tmp); #else char tmp[32] = {}; diff --git a/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp b/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp index a421484005..75b9edb5ea 100644 --- a/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp +++ b/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp @@ -35,7 +35,7 @@ bool IsTAPDevice(const TCHAR* guid) TCHAR net_cfg_instance_id[256]; DWORD data_type; - len = sizeof(enum_name); + len = _countof(enum_name); status = RegEnumKeyEx(netcard_key, i, enum_name, &len, nullptr, nullptr, nullptr, nullptr); if (status == ERROR_NO_MORE_ITEMS) @@ -43,7 +43,8 @@ bool IsTAPDevice(const TCHAR* guid) else if (status != ERROR_SUCCESS) return false; - _sntprintf(unit_string, sizeof(unit_string), _T("%s\\%s"), ADAPTER_KEY, enum_name); + _sntprintf(unit_string, _countof(unit_string), _T("%s\\%s"), ADAPTER_KEY, enum_name); + unit_string[_countof(unit_string) - 1] = _T('\0'); status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, unit_string, 0, KEY_READ, &unit_key); @@ -110,14 +111,15 @@ bool GetGUIDs(std::vector>& guids) DWORD name_type; const TCHAR name_string[] = _T("Name"); - len = sizeof(enum_name); + len = _countof(enum_name); status = RegEnumKeyEx(control_net_key, i, enum_name, &len, nullptr, nullptr, nullptr, nullptr); if (status != ERROR_SUCCESS) continue; - _sntprintf(connection_string, sizeof(connection_string), _T("%s\\%s\\Connection"), + _sntprintf(connection_string, _countof(connection_string), _T("%s\\%s\\Connection"), NETWORK_CONNECTIONS_KEY, enum_name); + connection_string[_countof(connection_string) - 1] = _T('\0'); status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, &connection_key); From 79f5ea04744a50c006067800d506211553757387 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:30:06 -0700 Subject: [PATCH 06/25] initialize some variables which need to be --- Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp | 2 +- Source/Core/Core/IOS/Network/IP/Top.cpp | 16 +++++++--------- Source/Core/Core/PowerPC/PPCSymbolDB.cpp | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp b/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp index 75b9edb5ea..1b4a47433b 100644 --- a/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp +++ b/Source/Core/Core/HW/EXI/BBA/TAP_Win32.cpp @@ -198,7 +198,7 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate() } /* get driver version info */ - ULONG info[3]; + ULONG info[3]{}; if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION, &info, sizeof(info), &info, sizeof(info), &len, nullptr)) { diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp index 5f8ee3282a..2cd38142fd 100644 --- a/Source/Core/Core/IOS/Network/IP/Top.cpp +++ b/Source/Core/Core/IOS/Network/IP/Top.cpp @@ -86,13 +86,12 @@ static constexpr u32 inet_addr(u8 a, u8 b, u8 c, u8 d) static int inet_pton(const char* src, unsigned char* dst) { - int saw_digit, octets; + int saw_digit = 0; + int octets = 0; + unsigned char tmp[4]{}; + unsigned char* tp = tmp; char ch; - unsigned char tmp[4], *tp; - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; while ((ch = *src++) != '\0') { if (ch >= '0' && ch <= '9') @@ -927,8 +926,9 @@ IPCCommandResult NetIPTop::HandleRecvFromRequest(const IOCtlVRequest& request) IPCCommandResult NetIPTop::HandleGetAddressInfoRequest(const IOCtlVRequest& request) { addrinfo hints; + const bool hints_valid = request.in_vectors.size() > 2 && request.in_vectors[2].size; - if (request.in_vectors.size() > 2 && request.in_vectors[2].size) + if (hints_valid) { hints.ai_flags = Memory::Read_U32(request.in_vectors[2].address); hints.ai_family = Memory::Read_U32(request.in_vectors[2].address + 0x4); @@ -959,9 +959,7 @@ IPCCommandResult NetIPTop::HandleGetAddressInfoRequest(const IOCtlVRequest& requ } addrinfo* result = nullptr; - int ret = getaddrinfo( - pNodeName, pServiceName, - (request.in_vectors.size() > 2 && request.in_vectors[2].size) ? &hints : nullptr, &result); + int ret = getaddrinfo(pNodeName, pServiceName, hints_valid ? &hints : nullptr, &result); u32 addr = request.io_vectors[0].address; u32 sockoffset = addr + 0x460; if (ret == 0) diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index fc02b54bbb..30a2f5b857 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -247,7 +247,7 @@ bool PPCSymbolDB::LoadMap(const std::string& filename, bool bad) continue; } - char temp[256]; + char temp[256]{}; sscanf(line, "%255s", temp); if (strcmp(temp, "UNUSED") == 0) From 938fd4e43871d281f5efa185a5b62b8b74fa13f3 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:30:49 -0700 Subject: [PATCH 07/25] use constexpr for some compile-time expressions --- Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp | 2 +- .../Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp | 4 ++-- Source/Core/VideoBackends/D3D12/VertexManager.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index b8513df344..661398b351 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -208,7 +208,7 @@ static void CopyDescriptorToBuffer(std::vector* buffer, T descriptor) descriptor.Swap(); buffer->insert(buffer->end(), reinterpret_cast(&descriptor), reinterpret_cast(&descriptor) + size); - const size_t number_of_padding_bytes = Common::AlignUp(size, 4) - size; + constexpr size_t number_of_padding_bytes = Common::AlignUp(size, 4) - size; buffer->insert(buffer->end(), number_of_padding_bytes, 0); } diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp index a81fae3dc1..5d1a6ed21d 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp @@ -61,8 +61,8 @@ template SType ScaleAndClamp(double ps, u32 stScale) { float convPS = (float)ps * m_quantizeTable[stScale]; - float min = (float)std::numeric_limits::min(); - float max = (float)std::numeric_limits::max(); + constexpr float min = (float)std::numeric_limits::min(); + constexpr float max = (float)std::numeric_limits::max(); return (SType)std::clamp(convPS, min, max); } diff --git a/Source/Core/VideoBackends/D3D12/VertexManager.cpp b/Source/Core/VideoBackends/D3D12/VertexManager.cpp index bdf5fbe8e8..ecaec7c9c1 100644 --- a/Source/Core/VideoBackends/D3D12/VertexManager.cpp +++ b/Source/Core/VideoBackends/D3D12/VertexManager.cpp @@ -195,10 +195,10 @@ void VertexManager::UploadAllConstants() { // We are free to re-use parts of the buffer now since we're uploading all constants. const u32 pixel_constants_offset = 0; - const u32 vertex_constants_offset = + constexpr u32 vertex_constants_offset = Common::AlignUp(pixel_constants_offset + sizeof(PixelShaderConstants), D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT); - const u32 geometry_constants_offset = + constexpr u32 geometry_constants_offset = Common::AlignUp(vertex_constants_offset + sizeof(VertexShaderConstants), D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT); const u32 allocation_size = geometry_constants_offset + sizeof(GeometryShaderConstants); From 3ee4c53d652c52f3733194534a9538730d1806e4 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:32:14 -0700 Subject: [PATCH 08/25] wiimotereal: add some error handling. replace malloc with make_unique --- Source/Core/Core/HW/WiimoteReal/IOWin.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp index f755eedb6b..74cfe5cb88 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp @@ -418,6 +418,10 @@ int WriteToHandle(HANDLE& dev_handle, WinWriteMethod& method, const u8* buf, siz { OVERLAPPED hid_overlap_write = OVERLAPPED(); hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr); + if (!hid_overlap_write.hEvent) + { + return 0; + } DWORD written = 0; IOWrite(dev_handle, hid_overlap_write, method, buf, size, &written); @@ -431,6 +435,10 @@ int ReadFromHandle(HANDLE& dev_handle, u8* buf) { OVERLAPPED hid_overlap_read = OVERLAPPED(); hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr); + if (!hid_overlap_read.hEvent) + { + return 0; + } const int read = IORead(dev_handle, hid_overlap_read, buf, 1); CloseHandle(hid_overlap_read.hEvent); return read; @@ -533,7 +541,6 @@ void WiimoteScannerWindows::FindWiimotes(std::vector& found_wiimotes, SP_DEVICE_INTERFACE_DATA device_data = {}; device_data.cbSize = sizeof(device_data); - PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = nullptr; for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, nullptr, &device_id, index, &device_data); ++index) @@ -541,7 +548,8 @@ void WiimoteScannerWindows::FindWiimotes(std::vector& found_wiimotes, // Get the size of the data block required DWORD len; SetupDiGetDeviceInterfaceDetail(device_info, &device_data, nullptr, 0, &len, nullptr); - detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len); + auto detail_data_buf = std::make_unique(len); + auto detail_data = reinterpret_cast(detail_data_buf.get()); detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); SP_DEVINFO_DATA device_info_data = {}; @@ -558,7 +566,6 @@ void WiimoteScannerWindows::FindWiimotes(std::vector& found_wiimotes, if (!IsNewWiimote(WStringToUTF8(device_path)) || !IsWiimote(device_path, write_method)) { - free(detail_data); continue; } @@ -568,8 +575,6 @@ void WiimoteScannerWindows::FindWiimotes(std::vector& found_wiimotes, else found_wiimotes.push_back(wiimote); } - - free(detail_data); } SetupDiDestroyDeviceInfoList(device_info); From ccbc4c2d991cd42dbc2943aebe617d31b2c74a59 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 17 Aug 2020 17:32:58 -0700 Subject: [PATCH 09/25] fix possible dangling shared_ptr ptr in ios --- Source/Core/Core/IOS/IOS.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index ede48baf1b..b5fe88b709 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -824,7 +824,8 @@ void Init() if (!s_ios) return; - auto device = static_cast(s_ios->GetDeviceByName("/dev/sdio/slot0").get()); + auto sdio_slot0 = s_ios->GetDeviceByName("/dev/sdio/slot0"); + auto device = static_cast(sdio_slot0.get()); if (device) device->EventNotify(); }); From 181e0dba21b78a23df9a459fc01b870ccf0466e9 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:04:50 -0700 Subject: [PATCH 10/25] apply `if constexpr` in a couple places --- Source/Core/Common/FileSearch.cpp | 4 +++- Source/Core/Common/SDCardUtil.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index ff2de8eb3b..bbcdc12026 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -125,9 +125,11 @@ std::vector DoFileSearch(const std::vector& directorie // std::filesystem uses the OS separator. constexpr fs::path::value_type os_separator = fs::path::preferred_separator; static_assert(os_separator == DIR_SEP_CHR || os_separator == '\\', "Unsupported path separator"); - if (os_separator != DIR_SEP_CHR) + if constexpr (os_separator != DIR_SEP_CHR) + { for (auto& path : result) std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR); + } return result; } diff --git a/Source/Core/Common/SDCardUtil.cpp b/Source/Core/Common/SDCardUtil.cpp index 22284a008f..16f855f6ea 100644 --- a/Source/Core/Common/SDCardUtil.cpp +++ b/Source/Core/Common/SDCardUtil.cpp @@ -247,7 +247,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename) if (!write_sector(file, s_fsinfo_sector)) goto FailWrite; - if (BACKUP_BOOT_SECTOR > 0) + if constexpr (BACKUP_BOOT_SECTOR > 0) { if (!write_empty(file, BACKUP_BOOT_SECTOR - 2)) goto FailWrite; From 12ea56a6b2249b4efc2a2ee2524191cc5fe8eb2b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:06:42 -0700 Subject: [PATCH 11/25] remove extraneous WIN32_LEAN_AND_MEAN definition --- Source/Core/Common/Semaphore.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/Core/Common/Semaphore.h b/Source/Core/Common/Semaphore.h index d132288f2a..731d070929 100644 --- a/Source/Core/Common/Semaphore.h +++ b/Source/Core/Common/Semaphore.h @@ -6,9 +6,6 @@ #ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif #include namespace Common From 2c2fd21d41e43a5b1fae2d10478ec891830cf80d Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sat, 22 Aug 2020 02:07:33 -0700 Subject: [PATCH 12/25] msbuild: silence warnings about deprecated codecvt items --- Source/VSProps/Base.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 348d58fe53..1954c7cf1d 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -54,6 +54,8 @@ $(ExternalsDir)zstd\lib;%(AdditionalIncludeDirectories) FMT_HEADER_ONLY=1;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) USE_UPNP;USE_USBDK;__LIBUSB__;%(PreprocessorDefinitions) SFML_STATIC;%(PreprocessorDefinitions) USE_ANALYTICS=1;%(PreprocessorDefinitions) From c629af631907b06c193137043fa86eb5ce739b95 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:08:16 -0700 Subject: [PATCH 13/25] replace is_pod with is_standard_layout && is_trivially_copyable --- Source/Core/Core/HW/WiimoteCommon/WiimoteHid.h | 2 +- Source/Core/Core/HW/WiimoteEmu/I2CBus.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteCommon/WiimoteHid.h b/Source/Core/Core/HW/WiimoteCommon/WiimoteHid.h index fbcbd8b9e2..6afa1fc38c 100644 --- a/Source/Core/Core/HW/WiimoteCommon/WiimoteHid.h +++ b/Source/Core/Core/HW/WiimoteCommon/WiimoteHid.h @@ -54,7 +54,7 @@ struct TypedHIDInputData T data; - static_assert(std::is_pod()); + static_assert(std::is_standard_layout_v && std::is_trivially_copyable_v); u8* GetData() { return reinterpret_cast(this); } const u8* GetData() const { return reinterpret_cast(this); } diff --git a/Source/Core/Core/HW/WiimoteEmu/I2CBus.h b/Source/Core/Core/HW/WiimoteEmu/I2CBus.h index f20719af32..256f386cd9 100644 --- a/Source/Core/Core/HW/WiimoteEmu/I2CBus.h +++ b/Source/Core/Core/HW/WiimoteEmu/I2CBus.h @@ -26,7 +26,7 @@ protected: template static int RawRead(T* reg_data, u8 addr, int count, u8* data_out) { - static_assert(std::is_pod::value); + static_assert(std::is_standard_layout_v && std::is_trivially_copyable_v); static_assert(0x100 == sizeof(T)); // TODO: addr wraps around after 0xff @@ -42,7 +42,7 @@ protected: template static int RawWrite(T* reg_data, u8 addr, int count, const u8* data_in) { - static_assert(std::is_pod::value); + static_assert(std::is_standard_layout_v && std::is_trivially_copyable_v); static_assert(0x100 == sizeof(T)); // TODO: addr wraps around after 0xff From 89b6a4cbeedfeece3378b8f1907af6b1e2072061 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:09:04 -0700 Subject: [PATCH 14/25] DolphinQt: resolve Qt5.15 deprecations --- .../ControllerInterface/DualShockUDPClientWidget.cpp | 2 +- Source/Core/DolphinQt/Config/ControllersWindow.cpp | 3 +++ Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp | 2 +- Source/Core/DolphinQt/QtUtils/FlowLayout.cpp | 2 +- Source/Core/DolphinQt/Settings/InterfacePane.cpp | 6 +++--- .../DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp | 7 +++---- Source/Core/DolphinQt/Settings/WiiPane.cpp | 7 +++---- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientWidget.cpp b/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientWidget.cpp index 4c7f41c5e4..1b18435544 100644 --- a/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientWidget.cpp +++ b/Source/Core/DolphinQt/Config/ControllerInterface/DualShockUDPClientWidget.cpp @@ -28,7 +28,7 @@ void DualShockUDPClientWidget::CreateWidgets() m_servers_enabled = new QCheckBox(tr("Enable")); m_servers_enabled->setChecked(Config::Get(ciface::DualShockUDPClient::Settings::SERVERS_ENABLED)); - main_layout->addWidget(m_servers_enabled, 0, 0); + main_layout->addWidget(m_servers_enabled, 0, {}); m_server_list = new QListWidget(); main_layout->addWidget(m_server_list); diff --git a/Source/Core/DolphinQt/Config/ControllersWindow.cpp b/Source/Core/DolphinQt/Config/ControllersWindow.cpp index 2f3d03ed43..82e6da599b 100644 --- a/Source/Core/DolphinQt/Config/ControllersWindow.cpp +++ b/Source/Core/DolphinQt/Config/ControllersWindow.cpp @@ -131,9 +131,12 @@ static int GetLayoutHorizontalSpacing(const QGridLayout* layout) // Docs claim this is deprecated, but on macOS with Qt 5.8 this is the only one that actually // works. float pixel_ratio = QGuiApplication::primaryScreen()->devicePixelRatio(); +#ifdef __APPLE__ + // TODO is this still required? hspacing = pixel_ratio * style->pixelMetric(QStyle::PM_DefaultLayoutSpacing); if (hspacing >= 0) return hspacing; +#endif // Ripped from qtbase/src/widgets/styles/qcommonstyle.cpp return pixel_ratio * 6; diff --git a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp index 00070d2146..60d32a8a25 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp @@ -156,7 +156,7 @@ void MemoryViewWidget::Update() } else { - hex_item->setFlags(0); + hex_item->setFlags({}); hex_item->setText(QStringLiteral("-")); } } diff --git a/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp b/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp index b20d42f96e..bd481ea624 100644 --- a/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp +++ b/Source/Core/DolphinQt/QtUtils/FlowLayout.cpp @@ -120,7 +120,7 @@ QLayoutItem* FlowLayout::takeAt(int index) Qt::Orientations FlowLayout::expandingDirections() const { - return 0; + return {}; } bool FlowLayout::hasHeightForWidth() const diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.cpp b/Source/Core/DolphinQt/Settings/InterfacePane.cpp index af5545565f..99d3993942 100644 --- a/Source/Core/DolphinQt/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt/Settings/InterfacePane.cpp @@ -186,9 +186,9 @@ void InterfacePane::ConnectLayout() connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); - connect(m_combobox_theme, qOverload(&QComboBox::currentIndexChanged), - &Settings::Instance(), &Settings::SetThemeName); - connect(m_combobox_userstyle, qOverload(&QComboBox::currentIndexChanged), this, + connect(m_combobox_theme, qOverload(&QComboBox::currentIndexChanged), this, + [=](int index) { Settings::Instance().SetThemeName(m_combobox_theme->itemText(index)); }); + connect(m_combobox_userstyle, qOverload(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); connect(m_combobox_language, qOverload(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); diff --git a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp index ba531093f0..5f9fdceca5 100644 --- a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp +++ b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp @@ -168,10 +168,9 @@ void USBDeviceAddToWhitelistDialog::OnDeviceSelection() { // Not the nicest way of doing this but... QString device = usb_inserted_devices_list->currentItem()->text().left(9); - QString* vid = new QString( - device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[0]); - QString* pid = new QString( - device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[1]); + QStringList split = device.split(QString::fromStdString(":")); + QString* vid = new QString(split[0]); + QString* pid = new QString(split[1]); device_vid_textbox->setText(*vid); device_pid_textbox->setText(*pid); } diff --git a/Source/Core/DolphinQt/Settings/WiiPane.cpp b/Source/Core/DolphinQt/Settings/WiiPane.cpp index 6ee0dd5558..e482a1ca3f 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt/Settings/WiiPane.cpp @@ -279,10 +279,9 @@ void WiiPane::OnUSBWhitelistAddButton() void WiiPane::OnUSBWhitelistRemoveButton() { QString device = m_whitelist_usb_list->currentItem()->text().left(9); - QString vid = - QString(device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[0]); - QString pid = - QString(device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[1]); + QStringList split = device.split(QString::fromStdString(":")); + QString vid = QString(split[0]); + QString pid = QString(split[1]); const u16 vid_u16 = static_cast(std::stoul(vid.toStdString(), nullptr, 16)); const u16 pid_u16 = static_cast(std::stoul(pid.toStdString(), nullptr, 16)); SConfig::GetInstance().m_usb_passthrough_devices.erase({vid_u16, pid_u16}); From fcc8dfd1897cfe303dae631d9de6ab6804a2e328 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:59:51 -0700 Subject: [PATCH 15/25] Common/Assert: no longer needs special impl for msvc --- Source/Core/Common/Assert.h | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/Source/Core/Common/Assert.h b/Source/Core/Common/Assert.h index afe4ead4ee..24d8b73202 100644 --- a/Source/Core/Common/Assert.h +++ b/Source/Core/Common/Assert.h @@ -9,28 +9,6 @@ #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" -#ifdef _WIN32 -#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \ - do \ - { \ - if (!(_a_)) \ - { \ - if (!PanicYesNo(_fmt_, __VA_ARGS__)) \ - Crash(); \ - } \ - } while (0) - -#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \ - do \ - { \ - if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \ - { \ - ERROR_LOG(_t_, _msg_, __VA_ARGS__); \ - if (!PanicYesNo(_msg_, __VA_ARGS__)) \ - Crash(); \ - } \ - } while (0) -#else #define ASSERT_MSG(_t_, _a_, _fmt_, ...) \ do \ { \ @@ -44,14 +22,16 @@ #define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \ do \ { \ - if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \ + if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \ { \ - ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \ - if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \ - Crash(); \ + if (!(_a_)) \ + { \ + ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \ + if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \ + Crash(); \ + } \ } \ } while (0) -#endif #define ASSERT(_a_) \ do \ @@ -64,6 +44,6 @@ #define DEBUG_ASSERT(_a_) \ do \ { \ - if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \ + if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \ ASSERT(_a_); \ } while (0) From ae061276d66a08b50d45f0889e60aaf39ae50429 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:54:26 -0700 Subject: [PATCH 16/25] msbuild: enable /Zc:externConstexpr,lambda note about preprocessor --- Source/VSProps/Base.props | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 1954c7cf1d..9c2c66c229 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -80,8 +80,12 @@ stdcpplatest true - - /Zc:throwingNew /volatile:iso %(AdditionalOptions) + + /Zc:externConstexpr,lambda,throwingNew /volatile:iso %(AdditionalOptions) /Zo %(AdditionalOptions) From 7279f31b245e919356dfd168a68740a478cf2294 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 21 Aug 2020 18:58:38 -0700 Subject: [PATCH 17/25] msbuild: re-enable C4996 and C4351 C4996 enables warnings about deprecated items C4351 was phased out (thus a no-op) years ago --- Source/VSProps/Base.props | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 9c2c66c229..0112d5ec02 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -53,7 +53,13 @@ $(ExternalsDir)zlib;%(AdditionalIncludeDirectories) $(ExternalsDir)zstd\lib;%(AdditionalIncludeDirectories) FMT_HEADER_ONLY=1;%(PreprocessorDefinitions) - _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + _WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) USE_UPNP;USE_USBDK;__LIBUSB__;%(PreprocessorDefinitions) @@ -92,13 +98,6 @@ /utf-8 %(AdditionalOptions) OldStyle Caret - - 4996;4351;%(DisableSpecificWarnings) 5054;%(DisableSpecificWarnings) - ($ProjectDir)Config\Graphics;%(AdditionalIncludeDirectories) + $(ProjectDir)Config\Graphics;%(AdditionalIncludeDirectories) $(ProjectDir)Config;%(AdditionalIncludeDirectories) $(ProjectDir)Config\ControllerInterface;%(AdditionalIncludeDirectories) $(ProjectDir)Config\Mapping;%(AdditionalIncludeDirectories) From 9717a418b92ada22c9e68863d06f044bd3e88613 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 27 Aug 2020 01:57:18 -0700 Subject: [PATCH 19/25] msbuild: properly enable /Brepro --- Source/VSProps/Base.props | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 0112d5ec02..f1cc6a44bb 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -120,6 +120,7 @@ 4946 Reinterpret cast between related types --> /w44263 /w44265 /w44946 %(AdditionalOptions) + /Brepro %(AdditionalOptions) @@ -144,6 +145,7 @@ true true + /Brepro %(AdditionalOptions) @@ -156,11 +158,12 @@ enableCompatPatches - /NODEFAULTLIB:libcmt /Brepro %(AdditionalOptions) + /NODEFAULTLIB:libcmt %(AdditionalOptions) true true + /Brepro %(AdditionalOptions) stdcpplatest @@ -124,22 +125,21 @@ - true _DEBUG;_SECURE_SCL=1;%(PreprocessorDefinitions) MultiThreadedDebugDLL Disabled - true AnySuitable Speed true true MultiThreadedDLL false - false _SECURE_SCL=0;%(PreprocessorDefinitions) + /Gw %(AdditionalOptions) + true From 8068ff92bfc363379f35bb3fea6e76c5bf9513fd Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 27 Aug 2020 03:47:41 -0700 Subject: [PATCH 21/25] msbuild: use x64-hosted toolchain --- Source/VSProps/Base.props | 6 ------ Source/VSProps/Configuration.Base.props | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index f9a619f9b1..ab8e22a8e2 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -2,12 +2,6 @@ - $(BuildRootDir)$(Platform)\$(Configuration)\$(ProjectName)\ $(IntDir)bin\ $(ProjectName)$(TargetSuffix) diff --git a/Source/VSProps/Configuration.Base.props b/Source/VSProps/Configuration.Base.props index 30c800ce44..dfbeedf4de 100644 --- a/Source/VSProps/Configuration.Base.props +++ b/Source/VSProps/Configuration.Base.props @@ -3,7 +3,7 @@ v142 Unicode - + x64 true From 4db06bf85b87376f6f5ac51242fa28663ee8471d Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 27 Aug 2020 13:00:36 -0700 Subject: [PATCH 22/25] ogl: init ProgramShaderCache::s_ubo_align to 1. silences a warning that it may cause div-by-zero. --- Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index a738a98fa2..ec976676c4 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -38,7 +38,7 @@ namespace OGL { u32 ProgramShaderCache::s_ubo_buffer_size; -s32 ProgramShaderCache::s_ubo_align; +s32 ProgramShaderCache::s_ubo_align = 1; GLuint ProgramShaderCache::s_attributeless_VBO = 0; GLuint ProgramShaderCache::s_attributeless_VAO = 0; GLuint ProgramShaderCache::s_last_VAO = 0; From 969ea6e4f54f1021edaa8f565e20b17a78f6f753 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 27 Aug 2020 21:58:48 -0700 Subject: [PATCH 23/25] msvc: enable /Zc:preprocessor and make build compile cleanly --- Source/Core/Common/MsgHandler.h | 34 -------------------- Source/Core/VideoBackends/D3D/D3DBase.h | 6 ---- Source/Core/VideoBackends/D3D12/Common.h | 7 ---- Source/Core/VideoBackends/D3DCommon/Common.h | 7 ++++ Source/Core/VideoCommon/VideoCommon.h | 4 --- Source/VSProps/Base.props | 12 +++---- 6 files changed, 13 insertions(+), 57 deletions(-) diff --git a/Source/Core/Common/MsgHandler.h b/Source/Core/Common/MsgHandler.h index 946a34dbb3..aadef05ea7 100644 --- a/Source/Core/Common/MsgHandler.h +++ b/Source/Core/Common/MsgHandler.h @@ -32,39 +32,6 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...) void SetEnableAlert(bool enable); } // namespace Common -#if defined(_WIN32) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1) -#define SuccessAlert(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__) - -#define PanicAlert(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__) - -#define PanicYesNo(format, ...) \ - Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__) - -#define AskYesNo(format, ...) Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__) - -#define CriticalAlert(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__) - -// Use these macros (that do the same thing) if the message should be translated. - -#define SuccessAlertT(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__) - -#define PanicAlertT(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__) - -#define PanicYesNoT(format, ...) \ - Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__) - -#define AskYesNoT(format, ...) \ - Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__) - -#define CriticalAlertT(format, ...) \ - Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__) - -#else #define SuccessAlert(format, ...) \ Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__) @@ -95,4 +62,3 @@ void SetEnableAlert(bool enable); #define CriticalAlertT(format, ...) \ Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__) -#endif diff --git a/Source/Core/VideoBackends/D3D/D3DBase.h b/Source/Core/VideoBackends/D3D/D3DBase.h index 7fed1bb2c3..c61d505457 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.h +++ b/Source/Core/VideoBackends/D3D/D3DBase.h @@ -15,12 +15,6 @@ #include "Common/CommonTypes.h" #include "Common/MsgHandler.h" -#define CHECK(cond, Message, ...) \ - if (!(cond)) \ - { \ - PanicAlert("%s failed in %s at line %d: " Message, __func__, __FILE__, __LINE__, __VA_ARGS__); \ - } - namespace DX11 { using Microsoft::WRL::ComPtr; diff --git a/Source/Core/VideoBackends/D3D12/Common.h b/Source/Core/VideoBackends/D3D12/Common.h index 47d0307350..f0b4b29d96 100644 --- a/Source/Core/VideoBackends/D3D12/Common.h +++ b/Source/Core/VideoBackends/D3D12/Common.h @@ -9,13 +9,6 @@ #include "Common/MsgHandler.h" #include "VideoBackends/D3DCommon/Common.h" -#define CHECK(cond, Message, ...) \ - if (!(cond)) \ - { \ - PanicAlert(__FUNCTION__ " failed in %s at line %d: " Message, __FILE__, __LINE__, \ - __VA_ARGS__); \ - } - namespace DX12 { using Microsoft::WRL::ComPtr; diff --git a/Source/Core/VideoBackends/D3DCommon/Common.h b/Source/Core/VideoBackends/D3DCommon/Common.h index 5f05c82978..4dced9af91 100644 --- a/Source/Core/VideoBackends/D3DCommon/Common.h +++ b/Source/Core/VideoBackends/D3DCommon/Common.h @@ -12,6 +12,13 @@ #include "Common/CommonTypes.h" +#define CHECK(cond, Message, ...) \ + if (!(cond)) \ + { \ + PanicAlert("%s failed in %s at line %d: " Message, __func__, __FILE__, __LINE__, \ + ##__VA_ARGS__); \ + } + struct IDXGIFactory; enum class AbstractTextureFormat : u32; diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h index 65f8d2820b..3f2de54c71 100644 --- a/Source/Core/VideoCommon/VideoCommon.h +++ b/Source/Core/VideoCommon/VideoCommon.h @@ -20,11 +20,7 @@ constexpr u32 MAX_XFB_WIDTH = 720; // that are next to each other in memory (TODO: handle that situation). constexpr u32 MAX_XFB_HEIGHT = 576; -#if defined(_WIN32) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1) -#define PRIM_LOG(...) DEBUG_LOG(VIDEO, __VA_ARGS__) -#else #define PRIM_LOG(...) DEBUG_LOG(VIDEO, ##__VA_ARGS__) -#endif // warning: mapping buffer should be disabled to use this // #define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3], diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index ab8e22a8e2..1b8144ed00 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -81,12 +81,8 @@ stdcpplatest true - - /Zc:externConstexpr,lambda,throwingNew /volatile:iso %(AdditionalOptions) + + /Zc:externConstexpr,lambda,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) /Zo %(AdditionalOptions) @@ -109,6 +105,10 @@ Currently jits use some annoying code patterns which makes this common --> 4245;%(DisableSpecificWarnings) + + 5105;%(DisableSpecificWarnings) + false From 24e8ed8e2761ac991057ac0f808c3d2bd913fe5b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 28 Aug 2020 01:39:38 -0700 Subject: [PATCH 25/25] msbuild: add experimental:deterministic for safety --- Source/VSProps/Base.props | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index d8eb5d9679..64a0ee636f 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -118,6 +118,12 @@ --> /w44263 /w44265 /w44946 %(AdditionalOptions) /Brepro %(AdditionalOptions) + + /experimental:deterministic %(AdditionalOptions)