From d5abf459bb41f12a0d4576c0da5010410f7bcd4f Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Sat, 15 May 2021 17:34:31 +0200 Subject: [PATCH] windows: continue the merge, handle some subprojects linking --- PCSX2_suite.sln | 6 ++- pcsx2/DEV9/Win32/Win32.cpp | 11 ++--- pcsx2/GS/GS.h | 8 ++-- pcsx2/GS/GS_types.h | 40 +++++++++++++------ pcsx2/GS/Renderers/Common/GSOsdManager.h | 2 +- pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp | 2 +- pcsx2/GS/Renderers/OpenGL/GSShaderOGL.cpp | 2 +- pcsx2/PAD/Windows/PAD.cpp | 12 +++--- pcsx2/PAD/Windows/PAD.h | 1 + pcsx2/PAD/Windows/PADConfig.cpp | 2 +- pcsx2/PAD/Windows/Tooltips.cpp | 2 +- pcsx2/PAD/Windows/Tooltips.h | 2 +- pcsx2/USB/usb-mic/audiodev-wasapi.h | 2 +- pcsx2/windows/VCprojects/pcsx2.vcxproj | 3 +- .../windows/VCprojects/pcsx2.vcxproj.filters | 3 -- 15 files changed, 59 insertions(+), 39 deletions(-) diff --git a/PCSX2_suite.sln b/PCSX2_suite.sln index d8c3861ee6..6bad0b28f4 100644 --- a/PCSX2_suite.sln +++ b/PCSX2_suite.sln @@ -18,12 +18,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Include", "Include", "{0FAD common\include\afxresmw.h = common\include\afxresmw.h common\include\Pcsx2Defs.h = common\include\Pcsx2Defs.h common\include\Pcsx2Types.h = common\include\Pcsx2Types.h - common\include\PluginCallbacks.h = common\include\PluginCallbacks.h EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{2D6F0A62-A247-4CCF-947F-FCD54BE16103}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2\windows\VCprojects\pcsx2.vcxproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}" + ProjectSection(ProjectDependencies) = postProject + {12728250-16EC-4DC6-94D7-E21DD88947F8} = {12728250-16EC-4DC6-94D7-E21DD88947F8} + {27F17499-A372-4408-8AFA-4F9F4584FBD3} = {27F17499-A372-4408-8AFA-4F9F4584FBD3} + {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "3rdparty\soundtouch\SoundTouch.vcxproj", "{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}" EndProject diff --git a/pcsx2/DEV9/Win32/Win32.cpp b/pcsx2/DEV9/Win32/Win32.cpp index e3c46608f2..d4770946ec 100644 --- a/pcsx2/DEV9/Win32/Win32.cpp +++ b/pcsx2/DEV9/Win32/Win32.cpp @@ -16,17 +16,18 @@ #include "PrecompiledHeader.h" #include #include +#include #include #include "ghc/filesystem.h" #include "fmt/format.h" -#include "..\Config.h" +#include "DEV9/Config.h" #include "resource.h" -#include "..\DEV9.h" -#include "..\pcap_io.h" -#include "..\net.h" -#include "..\PacketReader\IP\IP_Address.h" +#include "DEV9/DEV9.h" +#include "DEV9/pcap_io.h" +#include "DEV9/net.h" +#include "DEV9/PacketReader\IP\IP_Address.h" #include "tap.h" #include "AppCoreThread.h" diff --git a/pcsx2/GS/GS.h b/pcsx2/GS/GS.h index 4e16782fb2..60c521aec2 100644 --- a/pcsx2/GS/GS.h +++ b/pcsx2/GS/GS.h @@ -25,8 +25,6 @@ #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - #include #include #include @@ -113,7 +111,11 @@ #include #include +#ifdef __POSIX__ #include +#else +#include +#endif #include #include @@ -1968,4 +1970,4 @@ extern bool gsopen_done; void GSDoFreezeOut(void* dest); -void GSDoFreezeIn(pxInputStream& infp); +void GSDoFreezeIn(pxInputStream& infp); \ No newline at end of file diff --git a/pcsx2/GS/GS_types.h b/pcsx2/GS/GS_types.h index 326b1f7af7..02aa51d117 100644 --- a/pcsx2/GS/GS_types.h +++ b/pcsx2/GS/GS_types.h @@ -54,6 +54,34 @@ typedef signed long long sint64; #endif +#ifdef _WIN32 +inline std::string convert_utf16_to_utf8(const std::wstring& utf16_string) +{ + const int size = WideCharToMultiByte(CP_UTF8, 0, utf16_string.c_str(), utf16_string.size(), nullptr, 0, nullptr, nullptr); + std::string converted_string(size, 0); + WideCharToMultiByte(CP_UTF8, 0, utf16_string.c_str(), utf16_string.size(), converted_string.data(), converted_string.size(), nullptr, nullptr); + return converted_string; +} + +inline std::wstring convert_utf8_to_utf16(const std::string& utf8_string) +{ + int size = MultiByteToWideChar(CP_UTF8, 0, utf8_string.c_str(), -1, nullptr, 0); + std::vector converted_string(size); + MultiByteToWideChar(CP_UTF8, 0, utf8_string.c_str(), -1, converted_string.data(), converted_string.size()); + return {converted_string.data()}; +} +#endif + +// _wfopen has to be used on Windows for pathnames containing non-ASCII characters. +inline FILE* px_fopen(const std::string& filename, const std::string& mode) +{ +#ifdef _WIN32 + return _wfopen(convert_utf8_to_utf16(filename).c_str(), convert_utf8_to_utf16(mode).c_str()); +#else + return fopen(filename.c_str(), mode.c_str()); +#endif +} + #define _MM_TRANSPOSE4_SI128(row0, row1, row2, row3) \ { \ __m128 tmp0 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0x44); \ @@ -70,22 +98,10 @@ typedef signed long long sint64; extern void* vmalloc(size_t size, bool code); extern void vmfree(void* ptr, size_t size); -// _wfopen has to be used on Windows for pathnames containing non-ASCII characters. -inline FILE* px_fopen(const std::string& filename, const std::string& mode) -{ -#ifdef _WIN32 - return _wfopen(convert_utf8_to_utf16(filename).c_str(), convert_utf8_to_utf16(mode).c_str()); -#else - return fopen(filename.c_str(), mode.c_str()); -#endif -} - #define countof(a) (sizeof(a) / sizeof(a[0])) #ifdef __cpp_constinit #define CONSTINIT constinit -#elif __has_attribute(require_constant_initialization) -#define CONSTINIT __attribute__((require_constant_initialization)) #else #define CONSTINIT #endif diff --git a/pcsx2/GS/Renderers/Common/GSOsdManager.h b/pcsx2/GS/Renderers/Common/GSOsdManager.h index 281508d953..e98352ba5d 100644 --- a/pcsx2/GS/Renderers/Common/GSOsdManager.h +++ b/pcsx2/GS/Renderers/Common/GSOsdManager.h @@ -19,7 +19,7 @@ #include "GS/GSVector.h" #include "GSVertex.h" #include "GSTexture.h" -#include +#include "ft2build.h" #include FT_FREETYPE_H class GSOsdManager diff --git a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp index 969ba1dcbd..9c86f69d25 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp @@ -23,7 +23,7 @@ //#define ONLY_LINES #ifdef _WIN32 -#include "resource.h" +#include "GS/resource.h" #else #include "GS_res.h" #endif diff --git a/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.cpp index 60b5e06b2e..64af609145 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.cpp @@ -18,7 +18,7 @@ #include "GLState.h" #ifdef _WIN32 -#include "resource.h" +#include "GS/resource.h" #else #include "GS_res.h" #endif diff --git a/pcsx2/PAD/Windows/PAD.cpp b/pcsx2/PAD/Windows/PAD.cpp index b45741e938..1136782a68 100644 --- a/pcsx2/PAD/Windows/PAD.cpp +++ b/pcsx2/PAD/Windows/PAD.cpp @@ -1554,7 +1554,7 @@ keyEvent* PADkeyEvent() return &ev; } -struct PadFreezeData +struct PadFullFreezeData { char format[8]; // Currently all different versions are incompatible. @@ -1577,13 +1577,13 @@ s32 PADfreeze(int mode, freezeData* data) if (mode == FREEZE_SIZE) { - data->size = sizeof(PadFreezeData); + data->size = sizeof(PadFullFreezeData); } else if (mode == FREEZE_LOAD) { - PadFreezeData& pdata = *(PadFreezeData*)(data->data); + PadFullFreezeData& pdata = *(PadFullFreezeData*)(data->data); StopVibrate(); - if (data->size != sizeof(PadFreezeData) || + if (data->size != sizeof(PadFullFreezeData) || pdata.version != PAD_SAVE_STATE_VERSION || strcmp(pdata.format, "PadMode")) return 0; @@ -1620,9 +1620,9 @@ s32 PADfreeze(int mode, freezeData* data) } else if (mode == FREEZE_SAVE) { - if (data->size != sizeof(PadFreezeData)) + if (data->size != sizeof(PadFullFreezeData)) return 0; - PadFreezeData& pdata = *(PadFreezeData*)(data->data); + PadFullFreezeData& pdata = *(PadFullFreezeData*)(data->data); // Tales of the Abyss - pad fix diff --git a/pcsx2/PAD/Windows/PAD.h b/pcsx2/PAD/Windows/PAD.h index 3c948f8cc8..53dae2797b 100644 --- a/pcsx2/PAD/Windows/PAD.h +++ b/pcsx2/PAD/Windows/PAD.h @@ -33,6 +33,7 @@ #include #include +#include "App.h" typedef struct { diff --git a/pcsx2/PAD/Windows/PADConfig.cpp b/pcsx2/PAD/Windows/PADConfig.cpp index 88b4a10e73..ae45f70c42 100644 --- a/pcsx2/PAD/Windows/PADConfig.cpp +++ b/pcsx2/PAD/Windows/PADConfig.cpp @@ -1363,7 +1363,7 @@ void AddTooltip(UINT id, HWND hWnd) { static UINT tooltipStructSize = GetTooltipStructSize(); bool hasTooltip; - LPWSTR message = dialog_message(id, &hasTooltip); + LPWSTR message = pad_dialog_message(id, &hasTooltip); if (!hasTooltip) return; diff --git a/pcsx2/PAD/Windows/Tooltips.cpp b/pcsx2/PAD/Windows/Tooltips.cpp index 04c6703854..1a807b8f38 100644 --- a/pcsx2/PAD/Windows/Tooltips.cpp +++ b/pcsx2/PAD/Windows/Tooltips.cpp @@ -17,7 +17,7 @@ #include "Global.h" #include "resource_pad.h" -LPWSTR dialog_message(int ID, bool* updateText) +LPWSTR pad_dialog_message(int ID, bool* updateText) { if (updateText) *updateText = true; diff --git a/pcsx2/PAD/Windows/Tooltips.h b/pcsx2/PAD/Windows/Tooltips.h index 451f95a1f5..a0933a7f57 100644 --- a/pcsx2/PAD/Windows/Tooltips.h +++ b/pcsx2/PAD/Windows/Tooltips.h @@ -18,6 +18,6 @@ #include "Global.h" -LPWSTR dialog_message(int ID, bool* updateText = false); +LPWSTR pad_dialog_message(int ID, bool* updateText = false); #endif diff --git a/pcsx2/USB/usb-mic/audiodev-wasapi.h b/pcsx2/USB/usb-mic/audiodev-wasapi.h index 58b3927186..981d0738a4 100644 --- a/pcsx2/USB/usb-mic/audiodev-wasapi.h +++ b/pcsx2/USB/usb-mic/audiodev-wasapi.h @@ -16,7 +16,7 @@ // Used OBS as example #include "audiodeviceproxy.h" -#include "USB/libsamplerate/samplerate.h" +#include #include "USB/shared/ringbuffer.h" #include diff --git a/pcsx2/windows/VCprojects/pcsx2.vcxproj b/pcsx2/windows/VCprojects/pcsx2.vcxproj index a7d0cef59b..364f71e32c 100644 --- a/pcsx2/windows/VCprojects/pcsx2.vcxproj +++ b/pcsx2/windows/VCprojects/pcsx2.vcxproj @@ -57,7 +57,7 @@ - $(ProjectRootDir)/gui;$(SvnRootDir)\3rdparty\xbyak;%(AdditionalIncludeDirectories) + $(ProjectRootDir)/gui;$(SolutionDir)3rdparty\xbyak;$(SolutionDir)3rdparty\freetype\include;$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;$(SolutionDir)3rdparty/baseclasses/;%(AdditionalIncludeDirectories) Async Use PrecompiledHeader.h @@ -475,7 +475,6 @@ - diff --git a/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters b/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters index d0813de575..b2aedad2a4 100644 --- a/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters +++ b/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters @@ -1392,9 +1392,6 @@ System\Ps2\GS - - System\Ps2\GS - System\Ps2\GS