From 5f6caf33f0ed43d024b34e8af75f0bfa7de029dc Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 16 Nov 2015 18:04:49 +0300 Subject: [PATCH] MINGW64: Compilation fix --- .gitignore | 9 ++++- .gitmodules | 1 + Utilities/File.cpp | 1 + Utilities/GNU.cpp | 8 ---- Utilities/GNU.h | 19 ++++----- rpcs3/CMakeLists.txt | 28 +++++++++---- rpcs3/Emu/Audio/AudioManager.cpp | 2 +- rpcs3/Emu/Audio/XAudio2/XAudio2Thread.cpp | 2 +- rpcs3/Emu/Audio/XAudio2/XAudio2Thread.h | 5 ++- rpcs3/Emu/Cell/PPUInterpreter.cpp | 6 +-- rpcs3/Emu/Cell/PPUInterpreter.h | 28 ++++++++++--- rpcs3/Emu/Cell/SPUInterpreter.cpp | 14 +++---- rpcs3/Emu/FS/VFS.cpp | 2 + rpcs3/Emu/Io/XInput/XInputPadHandler.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp | 2 +- .../D3D12/D3D12FragmentProgramDecompiler.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12Overlay.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12Utils.cpp | 2 +- .../D3D12/D3D12VertexProgramDecompiler.cpp | 2 +- rpcs3/Emu/RSX/GL/GLProcTable.h | 2 +- rpcs3/Emu/RSX/GSManager.cpp | 4 +- rpcs3/Emu/SysCalls/Modules/cellL10n.cpp | 6 ++- rpcs3/Gui/CompilerELF.cpp | 4 +- rpcs3/Gui/GameViewer.cpp | 39 +------------------ rpcs3/Gui/SettingsDialog.cpp | 8 ++-- rpcs3/rpcs3.cpp | 4 +- rpcs3/stdafx_d3d12.cpp | 2 + rpcs3/stdafx_d3d12.h | 3 +- 35 files changed, 111 insertions(+), 112 deletions(-) diff --git a/.gitignore b/.gitignore index 8c771d5ef8..b40d5b4a15 100644 --- a/.gitignore +++ b/.gitignore @@ -76,5 +76,12 @@ rpcs3-tests/x64/* .DS_Store rpcs3/Emu/SysCalls/Modules/prx_*.h -/CMakeFiles/ +# cmake +Makefile +*CMakeFiles* CMakeCache.txt +*cmake_install.cmake* + +# cotire +rpcs3/cotire/* +rpcs3/rpcs3_*_cotire.cmake diff --git a/.gitmodules b/.gitmodules index ccfc784c3c..a1d4cad25f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,6 +8,7 @@ [submodule "asmjit"] path = asmjit url = https://github.com/kobalicek/asmjit + ignore = dirty [submodule "llvm"] path = llvm url = https://github.com/llvm-mirror/llvm diff --git a/Utilities/File.cpp b/Utilities/File.cpp index e5f47b6b4d..56824b18e0 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -3,6 +3,7 @@ #include "File.h" #ifdef _WIN32 +#define _WIN32_WINNT 0x0601 #include #define GET_API_ERROR static_cast(GetLastError()) diff --git a/Utilities/GNU.cpp b/Utilities/GNU.cpp index 70daa61441..29467b205f 100644 --- a/Utilities/GNU.cpp +++ b/Utilities/GNU.cpp @@ -49,11 +49,3 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) return retval; } #endif /* __APPLE__ */ -#if defined(__GNUG__) - -void * _aligned_malloc(size_t size, size_t alignment) { - void *buffer; - return (posix_memalign(&buffer, alignment, size) == 0) ? buffer : 0; -} -#endif - diff --git a/Utilities/GNU.h b/Utilities/GNU.h index fd41c69269..a54ac15a4f 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -41,23 +41,18 @@ #define _fpclass(x) std::fpclassify(x) #define _byteswap_ushort(x) __builtin_bswap16(x) -#define _byteswap_ulong(x) __builtin_bswap32(x) #define _byteswap_uint64(x) __builtin_bswap64(x) #define INFINITE 0xFFFFFFFF -inline std::uint64_t __umulh(std::uint64_t a, std::uint64_t b) +#if !defined(__MINGW32__) +#define _byteswap_ulong(x) __builtin_bswap32(x) +#else +inline std::uint32_t _byteswap_ulong(std::uint32_t value) { - std::uint64_t result; - __asm__("mulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b)); - return result; -} - -inline std::int64_t __mulh(std::int64_t a, std::int64_t b) -{ - std::int64_t result; - __asm__("imulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b)); - return result; + __asm__("bswap %0" : "+r"(value)); + return value; } +#endif #ifdef __APPLE__ diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 5bc93996df..beb6a44907 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -30,8 +30,11 @@ if(NOT MSVC) if($ENV{CI}) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1") # fix for travis gcc OoM crash. Might be fixed with the move to containers. endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fexceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fexceptions -w") add_compile_options(-msse -msse2 -mcx16 -mssse3) + if(WIN32) + add_compile_options(-municode -static -mwindows) + endif() else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zc:throwingNew /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1") endif() @@ -44,7 +47,7 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") #on some Linux distros shm_unlink and similar functions are in librt only set(ADDITIONAL_LIBS "rt" "X11") -elseif(UNIX) +elseif(UNIX OR NOT MSVC) #it seems like glibc includes the iconv functions we use but other libc #implementations like the one on OSX don't seem implement them set(ADDITIONAL_LIBS "iconv") @@ -67,7 +70,7 @@ if(NOT WIN32) endif() find_package(wxWidgets COMPONENTS core base net aui gl xml REQUIRED) -if(NOT WIN32) +if(NOT MSVC) if(APPLE) find_path(GLEW_INCLUDE_DIR GL/glew.h /usr/include/GL @@ -130,7 +133,11 @@ if(LLVM_FOUND) endif() endif() -link_directories("${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib" "${RPCS3_SRC_DIR}/../asmjit/" "${RPCS3_SRC_DIR}/../minidx12/") +link_directories("${RPCS3_SRC_DIR}/../asmjit/" "${RPCS3_SRC_DIR}/../minidx12/") + +if(MSVC OR NOT WIN32) + link_directories("${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib") +endif() get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) foreach(dir ${dirs}) @@ -152,18 +159,23 @@ RPCS3_SRC add_executable(rpcs3 ${RPCS3_SRC}) + if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_CURRENT_BINARY_DIR}/../asmjit/") #hack because the asmjit cmake file force fno exceptions upd: not sure if vs2015 build is affected else() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") endif() if(WIN32) # I'm not sure we need all of these libs, but we link them in vs - target_link_libraries(rpcs3 odbc32.lib odbccp32.lib comctl32.lib ws2_32.lib shlwapi.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib dxgi.lib d2d1.lib dwrite.lib d3dcompiler.lib) + target_link_libraries(rpcs3 odbc32.lib odbccp32.lib comctl32.lib ws2_32.lib shlwapi.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Iphlpapi.lib) if(LLVM_FOUND) - target_link_libraries(rpcs3 asmjit.lib ${wxWidgets_LIBRARIES} ${OPENAL_LIBRARY} avformat.lib avcodec.lib avutil.lib swresample.lib swscale.lib ${LLVM_LIBS} ${ADDITIONAL_LIBS}) - else() - target_link_libraries(rpcs3 asmjit.lib ${wxWidgets_LIBRARIES} ${OPENAL_LIBRARY} avformat.lib avcodec.lib avutil.lib swresample.lib swscale.lib ${ADDITIONAL_LIBS}) + target_link_libraries(rpcs3 ${LLVM_LIBS}) endif() + if(NOT MSVC) + target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} ${GLEW_LIBRARY} opengl32.lib glu32.lib) + else() + target_link_libraries(rpcs3 dxgi.lib d2d1.lib dwrite.lib d3dcompiler.lib) + endif() + target_link_libraries(rpcs3 asmjit.lib avformat.lib avcodec.lib avutil.lib swresample.lib swscale.lib ${wxWidgets_LIBRARIES} ${OPENAL_LIBRARY} ${ADDITIONAL_LIBS}) else() if(LLVM_FOUND) target_link_libraries(rpcs3 asmjit.a ${wxWidgets_LIBRARIES} ${OPENAL_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) diff --git a/rpcs3/Emu/Audio/AudioManager.cpp b/rpcs3/Emu/Audio/AudioManager.cpp index a252db243e..39e21ef462 100644 --- a/rpcs3/Emu/Audio/AudioManager.cpp +++ b/rpcs3/Emu/Audio/AudioManager.cpp @@ -25,7 +25,7 @@ void AudioManager::Init() default: case audio_output_type::Null: m_audio_out = new NullAudioThread(); break; case audio_output_type::OpenAL: m_audio_out = new OpenALThread(); break; -#if defined (_WIN32) +#ifdef _MSC_VER case audio_output_type::XAudio2: m_audio_out = new XAudio2Thread(); break; #endif } diff --git a/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.cpp b/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.cpp index df28e6e36d..ae384bc8b8 100644 --- a/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.cpp +++ b/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" +#ifdef _MSC_VER #include "Utilities/Log.h" #include "Emu/System.h" #include "Emu/state.h" -#if defined (_WIN32) #include "XAudio2Thread.h" XAudio2Thread::~XAudio2Thread() diff --git a/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.h b/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.h index e3a1a22b2c..cf7141c792 100644 --- a/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.h +++ b/rpcs3/Emu/Audio/XAudio2/XAudio2Thread.h @@ -1,7 +1,8 @@ #pragma once +#ifdef _MSC_VER #include "Emu/Audio/AudioThread.h" -#if defined (_WIN32) + #define _WIN32_WINNT 0x0601 // This is to be sure that correct (2.7) header is included #include "minidx9/Include/XAudio2.h" // XAudio2 2.8 available only on Win8+, used XAudio2 2.7 from dxsdk #undef _WIN32_WINNT @@ -25,4 +26,4 @@ public: virtual void Stop(); virtual void AddData(const void* src, int size); }; -#endif \ No newline at end of file +#endif diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index 861cd45468..5cc29a4c39 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -1747,7 +1747,7 @@ void ppu_interpreter::SUBFC(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::MULHDU(PPUThread& CPU, ppu_opcode_t op) { - CPU.GPR[op.rd] = __umulh(CPU.GPR[op.ra], CPU.GPR[op.rb]); + CPU.GPR[op.rd] = UMULH64(CPU.GPR[op.ra], CPU.GPR[op.rb]); if (op.rc) CPU.UpdateCR0(CPU.GPR[op.rd]); } @@ -1933,7 +1933,7 @@ void ppu_interpreter::LVEWX(PPUThread& CPU, ppu_opcode_t op) void ppu_interpreter::MULHD(PPUThread& CPU, ppu_opcode_t op) { - CPU.GPR[op.rd] = __mulh(CPU.GPR[op.ra], CPU.GPR[op.rb]); + CPU.GPR[op.rd] = MULH64(CPU.GPR[op.ra], CPU.GPR[op.rb]); if (op.rc) CPU.UpdateCR0(CPU.GPR[op.rd]); } @@ -2162,7 +2162,7 @@ void ppu_interpreter::MULLD(PPUThread& CPU, ppu_opcode_t op) CPU.GPR[op.rd] = (s64)(RA * RB); if (op.oe) { - const s64 high = __mulh(RA, RB); + const s64 high = MULH64(RA, RB); CPU.SetOV(high != s64(CPU.GPR[op.rd]) >> 63); } if (op.rc) CPU.UpdateCR0(CPU.GPR[op.rd]); diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 2f2e55404a..148b483ef9 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -3,14 +3,32 @@ #include "Emu/Cell/PPUOpcodes.h" #include "Emu/Memory/Memory.h" -#include -#ifdef _MSC_VER +#if defined(_MSC_VER) #include #else #include #define _rotl64(x,r) (((u64)(x) << (r)) | ((u64)(x) >> (64 - (r)))) #endif +#if defined(__GNUG__) +inline std::uint64_t UMULH64(std::uint64_t a, std::uint64_t b) +{ + std::uint64_t result; + __asm__("mulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b)); + return result; +} + +inline std::int64_t MULH64(std::int64_t a, std::int64_t b) +{ + std::int64_t result; + __asm__("imulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b)); + return result; +} +#else +#define UMULH64 __umulh +#define MULH64 __mulh +#endif + #include extern u64 rotate_mask[64][64]; // defined in PPUThread.cpp @@ -2453,7 +2471,7 @@ private: } void MULHDU(u32 rd, u32 ra, u32 rb, u32 rc) { - CPU.GPR[rd] = __umulh(CPU.GPR[ra], CPU.GPR[rb]); + CPU.GPR[rd] = UMULH64(CPU.GPR[ra], CPU.GPR[rb]); if(rc) CPU.UpdateCR0(CPU.GPR[rd]); } void ADDC(u32 rd, u32 ra, u32 rb, u32 oe, u32 rc) @@ -2619,7 +2637,7 @@ private: } void MULHD(u32 rd, u32 ra, u32 rb, u32 rc) { - CPU.GPR[rd] = __mulh(CPU.GPR[ra], CPU.GPR[rb]); + CPU.GPR[rd] = MULH64(CPU.GPR[ra], CPU.GPR[rb]); if(rc) CPU.UpdateCR0(CPU.GPR[rd]); } void MULHW(u32 rd, u32 ra, u32 rb, u32 rc) @@ -2823,7 +2841,7 @@ private: CPU.GPR[rd] = (s64)(RA * RB); if(oe) { - const s64 high = __mulh(RA, RB); + const s64 high = MULH64(RA, RB); CPU.SetOV(high != s64(CPU.GPR[rd]) >> 63); } if(rc) CPU.UpdateCR0(CPU.GPR[rd]); diff --git a/rpcs3/Emu/Cell/SPUInterpreter.cpp b/rpcs3/Emu/Cell/SPUInterpreter.cpp index 9f20f09b67..d4968b8bb7 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/SPUInterpreter.cpp @@ -1310,12 +1310,12 @@ static const double DOUBLE_NAN = (double&)DOUBLE_NAN_I; inline bool issnan(double x) { - return isnan(x) && ((s64&)x) << 12 > 0; + return std::isnan(x) && ((s64&)x) << 12 > 0; } inline bool issnan(float x) { - return isnan(x) && ((s32&)x) << 9 > 0; + return std::isnan(x) && ((s32&)x) << 9 > 0; } inline int fexpf(float x) @@ -1631,7 +1631,7 @@ static void DFASM(SPUThread& spu, spu_opcode_t op, DoubleOp operation) b = copysign(0.0, b); } double result; - if (isnan(a) || isnan(b)) + if (std::isnan(a) || std::isnan(b)) { spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DNAN); if (issnan(a) || issnan(b)) @@ -1696,10 +1696,10 @@ static void DFMA(SPUThread& spu, spu_opcode_t op, bool neg, bool sub) c = copysign(0.0, c); } double result; - if (isnan(a) || isnan(b) || isnan(c)) + if (std::isnan(a) || std::isnan(b) || std::isnan(c)) { spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DNAN); - if (issnan(a) || issnan(b) || issnan(c) || (isinf(a) && b == 0.0f) || (a == 0.0f && isinf(b))) + if (issnan(a) || issnan(b) || issnan(c) || (std::isinf(a) && b == 0.0f) || (a == 0.0f && std::isinf(b))) spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DINV); result = DOUBLE_NAN; } @@ -1746,7 +1746,7 @@ void spu_interpreter::precise::FESD(SPUThread& spu, spu_opcode_t op) for (int i = 0; i < 2; i++) { const float a = spu.gpr[op.ra]._f[i * 2 + 1]; - if (isnan(a)) + if (std::isnan(a)) { spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DNAN); if (issnan(a)) @@ -1771,7 +1771,7 @@ void spu_interpreter::precise::FRDS(SPUThread& spu, spu_opcode_t op) { SetHostRoundingMode(spu.fpscr.checkSliceRounding(i)); const double a = spu.gpr[op.ra]._d[i]; - if (isnan(a)) + if (std::isnan(a)) { spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DNAN); if (issnan(a)) diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index 0f4e5bd947..9eea52af0e 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -236,6 +236,8 @@ void VFS::DeleteAll(const std::string& ps3_path) const DeleteAll(ps3_path + "/" + entry->name); } } + + RemoveDir(ps3_path); } u64 VFS::GetDirSize(const std::string& ps3_path) const diff --git a/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp b/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp index 51c6d6474c..8a8f6c994c 100644 --- a/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp +++ b/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp @@ -1,5 +1,5 @@ #include "stdafx_gui.h" -#if defined (_WIN32) +#ifdef _MSC_VER #include "Utilities/Log.h" #include "XInputPadHandler.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp index a8c3d571d9..41407a7d03 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "Utilities/Log.h" #include "D3D12GSRender.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp index e454a75738..688470a491 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12CommonDecompiler.h" std::string getFloatTypeNameImp(size_t elementCount) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp index 2242882d26..cc12b78898 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12Formats.h" #include "D3D12Utils.h" #include "Emu/RSX/GCM.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp index 4ad6251a59..79b1b71ae7 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12FragmentProgramDecompiler.h" #include "D3D12CommonDecompiler.h" #include "Utilities/Log.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 65495b2c57..122fdeabec 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12GSRender.h" #include #include diff --git a/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp b/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp index 13fbd3b658..985417e130 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12MemoryHelpers.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Overlay.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Overlay.cpp index dc3e4eb17b..17e062807f 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Overlay.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Overlay.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12GSRender.h" #include #include diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp index 5ff444059b..2585c2b016 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12PipelineState.h" #include "D3D12GSRender.h" #include "Emu/state.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp index 26957865ab..52383d0bd9 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12RenderTargetSets.h" #include "Utilities/rPlatform.h" // only for rImage #include "Utilities/File.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp index 2f2df283f0..1283937067 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12GSRender.h" #include "d3dx12.h" #include "../Common/TextureUtils.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Utils.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Utils.cpp index 0c18b013bc..2851fc7bf6 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Utils.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Utils.cpp @@ -2,7 +2,7 @@ * Contains utility shaders */ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12GSRender.h" #include "d3dx12.h" #include "Utilities/Log.h" diff --git a/rpcs3/Emu/RSX/D3D12/D3D12VertexProgramDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12VertexProgramDecompiler.cpp index 6954d1ed99..955237879d 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12VertexProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12VertexProgramDecompiler.cpp @@ -1,5 +1,5 @@ #include "stdafx_d3d12.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "D3D12VertexProgramDecompiler.h" #include "D3D12CommonDecompiler.h" #include "Utilities/Log.h" diff --git a/rpcs3/Emu/RSX/GL/GLProcTable.h b/rpcs3/Emu/RSX/GL/GLProcTable.h index eca05e3bc6..0a4bb05c13 100644 --- a/rpcs3/Emu/RSX/GL/GLProcTable.h +++ b/rpcs3/Emu/RSX/GL/GLProcTable.h @@ -172,7 +172,7 @@ OPENGL_PROC(PFNGLDEBUGMESSAGEINSERTARBPROC, DebugMessageInsertARB); OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKARBPROC, DebugMessageCallbackARB); //... -#ifndef __GNUG__ +#if !defined(__GNUG__) || defined(__MINGW32__) OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor); OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation); OPENGL_PROC(PFNGLCOMPRESSEDTEXIMAGE2DPROC, CompressedTexImage2D); diff --git a/rpcs3/Emu/RSX/GSManager.cpp b/rpcs3/Emu/RSX/GSManager.cpp index c0523ae6c0..d95d1eabe1 100644 --- a/rpcs3/Emu/RSX/GSManager.cpp +++ b/rpcs3/Emu/RSX/GSManager.cpp @@ -7,7 +7,7 @@ #include "GSManager.h" #include "Null/NullGSRender.h" #include "GL/GLGSRender.h" -#ifdef _WIN32 +#ifdef _MSC_VER #include "Emu/RSX/D3D12/D3D12GSRender.h" #endif @@ -37,7 +37,7 @@ void GSManager::Init() default: case rsx_renderer_type::Null : m_render = new NullGSRender(); break; case rsx_renderer_type::OpenGL: m_render = new GLGSRender(); break; -#ifdef _WIN32 +#ifdef _MSC_VER case rsx_renderer_type::DX12: m_render = new D3D12GSRender(); break; #endif } diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index f97af92f0b..5a25c36c76 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -2,9 +2,11 @@ #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" -#ifdef _MSC_VER +#ifdef _WIN32 #include -#else +#endif + +#ifndef _MSC_VER #include #endif diff --git a/rpcs3/Gui/CompilerELF.cpp b/rpcs3/Gui/CompilerELF.cpp index 6528daf5de..3e97ee7ef6 100644 --- a/rpcs3/Gui/CompilerELF.cpp +++ b/rpcs3/Gui/CompilerELF.cpp @@ -125,7 +125,7 @@ CompilerELF::CompilerELF(wxWindow* parent) " b exit, 0, 0\n" ); -#ifdef _WIN32 +#ifdef _MSC_VER ::SendMessage((HWND)hex_list->GetHWND(), WM_VSCROLL, SB_BOTTOM, 0); ::SendMessage((HWND)asm_list->GetHWND(), WM_VSCROLL, SB_BOTTOM, 0); #endif @@ -318,7 +318,7 @@ void CompilerELF::OnScroll(wxScrollWinEvent& event) dst = hex_list; } -#ifdef _WIN32 +#ifdef _MSC_VER if(!m_disable_scroll && src && dst && event.GetOrientation() == wxVERTICAL) { s64 kind = -1; diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index 4a5fb23177..78b0e51314 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -38,32 +38,6 @@ public: } }; -class WxDirDeleteTraverser : public wxDirTraverser -{ -public: - virtual wxDirTraverseResult OnFile(const wxString& filename) override - { - if (!wxRemoveFile(filename)) - { - LOG_ERROR(HLE, "Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); - } - return wxDIR_CONTINUE; - } - virtual wxDirTraverseResult OnDir(const wxString& dirname) override - { - wxDir dir(dirname); - dir.Traverse(*this); - if (!wxRmDir(dirname)) - { - //this get triggered a few times while clearing folders - //but if this gets reimplented we should probably warn - //if directories can't be removed - } - return wxDIR_CONTINUE; - } -}; - - // GameViewer functions GameViewer::GameViewer(wxWindow* parent) : wxListView(parent) { @@ -295,19 +269,8 @@ void GameViewer::ConfigureGame(wxCommandEvent& WXUNUSED(event)) void GameViewer::RemoveGame(wxCommandEvent& event) { Emu.GetVFS().Init("/"); - - // get local path from VFS - std::string local_path; - Emu.GetVFS().GetDevice(m_path, local_path); - std::string del_path = local_path + "/" + this->GetItemText(event.GetId(), 6).ToStdString(); - + Emu.GetVFS().DeleteAll(m_path + "/" + this->GetItemText(event.GetId(), 6).ToStdString()); Emu.GetVFS().UnMountAll(); - // TODO: Replace wxWidgetsSpecific filesystem stuff? - WxDirDeleteTraverser deleter; - wxDir localDir(del_path); - localDir.Traverse(deleter); - wxRmdir(del_path); // delete empty directory - Refresh(); } diff --git a/rpcs3/Gui/SettingsDialog.cpp b/rpcs3/Gui/SettingsDialog.cpp index 1b944ff05e..fd651850a0 100644 --- a/rpcs3/Gui/SettingsDialog.cpp +++ b/rpcs3/Gui/SettingsDialog.cpp @@ -13,9 +13,11 @@ #pragma comment(lib, "iphlpapi.lib") #undef GetHwnd +#ifdef _MSC_VER #include #include #include +#endif #else #include #include @@ -231,7 +233,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cbox_gs_render->Append("Null"); cbox_gs_render->Append("OpenGL"); -#ifdef _WIN32 +#ifdef _MSC_VER Microsoft::WRL::ComPtr dxgiFactory; Microsoft::WRL::ComPtr adapter; @@ -266,7 +268,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cbox_pad_handler->Append("Null"); cbox_pad_handler->Append("Windows"); -#if defined (_WIN32) +#ifdef _MSC_VER cbox_pad_handler->Append("XInput"); #endif @@ -282,7 +284,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cbox_audio_out->Append("Null"); cbox_audio_out->Append("OpenAL"); -#if defined (_WIN32) +#ifdef _MSC_VER cbox_audio_out->Append("XAudio2"); #endif diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 5d3f2be527..50256fef02 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -18,7 +18,7 @@ #include "Emu/Io/Pad.h" #include "Emu/Io/Null/NullPadHandler.h" #include "Emu/Io/Windows/WindowsPadHandler.h" -#if defined(_WIN32) +#ifdef _MSC_VER #include "Emu/Io/XInput/XInputPadHandler.h" #endif @@ -107,7 +107,7 @@ bool Rpcs3App::OnInit() { case io_handler_mode::null: return std::make_unique(); case io_handler_mode::windows: return std::make_unique(); -#if defined(_WIN32) +#ifdef _MSC_VER case io_handler_mode::xinput: return std::make_unique(); #endif default: throw EXCEPTION("Invalid Pad Handler Mode %d", +(u32)mode); diff --git a/rpcs3/stdafx_d3d12.cpp b/rpcs3/stdafx_d3d12.cpp index 65496e782d..958b9a50b1 100644 --- a/rpcs3/stdafx_d3d12.cpp +++ b/rpcs3/stdafx_d3d12.cpp @@ -1,6 +1,8 @@ #include "stdafx_d3d12.h" +#ifdef _MSC_VER #pragma comment(lib, "d2d1") #pragma comment(lib, "DXGI") #pragma comment(lib, "Dwrite") #pragma comment(lib, "d3dcompiler.lib") +#endif diff --git a/rpcs3/stdafx_d3d12.h b/rpcs3/stdafx_d3d12.h index 324cfbd6ce..b72b986643 100644 --- a/rpcs3/stdafx_d3d12.h +++ b/rpcs3/stdafx_d3d12.h @@ -1,7 +1,8 @@ #pragma once +#ifdef _MSC_VER #include "stdafx.h" -#ifdef _WIN32 + // Must be included first #include