mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-21 18:22:33 +01:00
Make compile with msvc, clang and gcc on Windows
This commit is contained in:
parent
ed75bab7b2
commit
0c94606fcf
5
.gitignore
vendored
5
.gitignore
vendored
@ -31,6 +31,7 @@
|
|||||||
*.wav
|
*.wav
|
||||||
|
|
||||||
/build
|
/build
|
||||||
|
/build-*
|
||||||
/lib
|
/lib
|
||||||
/tmp
|
/tmp
|
||||||
/ipch
|
/ipch
|
||||||
@ -135,3 +136,7 @@ yaml-cpp.pc
|
|||||||
cacert.pem
|
cacert.pem
|
||||||
|
|
||||||
_ReSharper.*/
|
_ReSharper.*/
|
||||||
|
CMakeUserPresets.json
|
||||||
|
|
||||||
|
.cache/
|
||||||
|
.lldbinit
|
||||||
|
74
3rdparty/CMakeLists.txt
vendored
74
3rdparty/CMakeLists.txt
vendored
@ -4,6 +4,11 @@ include(CMakeDependentOption)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
|
# Warnings are silenced for 3rdparty code
|
||||||
|
if(NOT MSVC)
|
||||||
|
add_compile_options("$<$<COMPILE_LANGUAGE:CXX,C>:-w>")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Dummy target to use when lib isn't available
|
# Dummy target to use when lib isn't available
|
||||||
add_library(3rdparty_dummy_lib INTERFACE)
|
add_library(3rdparty_dummy_lib INTERFACE)
|
||||||
|
|
||||||
@ -42,16 +47,16 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
# libusb
|
# libusb
|
||||||
if(CMAKE_SYSTEM MATCHES "DragonFly|FreeBSD")
|
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
|
||||||
pkg_check_modules(LIBUSB REQUIRED IMPORTED_TARGET libusb-1.0>=1.0 )
|
pkg_check_modules(LIBUSB REQUIRED IMPORTED_TARGET libusb-1.0>=1.0 )
|
||||||
CMAKE_DEPENDENT_OPTION( USE_SYSTEM_LIBUSB "Use system libusb-1.0 as shared library" ON
|
cmake_dependent_option(USE_SYSTEM_LIBUSB "Use system libusb-1.0 as shared library" ON
|
||||||
"LIBUSB_FOUND" OFF)
|
"LIBUSB_FOUND" OFF)
|
||||||
else()
|
else()
|
||||||
pkg_check_modules(LIBUSB IMPORTED_TARGET libusb-1.0>=1.0 )
|
pkg_check_modules(LIBUSB IMPORTED_TARGET libusb-1.0>=1.0 )
|
||||||
CMAKE_DEPENDENT_OPTION( USE_SYSTEM_LIBUSB "Use system libusb-1.0 as shared library" OFF
|
cmake_dependent_option(USE_SYSTEM_LIBUSB "Use system libusb-1.0 as shared library" OFF
|
||||||
"LIBUSB_FOUND" OFF)
|
"LIBUSB_FOUND" OFF)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM MATCHES "DragonFly|FreeBSD")
|
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
|
||||||
# Always use system libusb as reference implementation isn't supported
|
# Always use system libusb as reference implementation isn't supported
|
||||||
add_library(usb-1.0-shared INTERFACE)
|
add_library(usb-1.0-shared INTERFACE)
|
||||||
target_link_libraries(usb-1.0-shared INTERFACE PkgConfig::LIBUSB)
|
target_link_libraries(usb-1.0-shared INTERFACE PkgConfig::LIBUSB)
|
||||||
@ -100,10 +105,6 @@ endif()
|
|||||||
|
|
||||||
# OpenGL
|
# OpenGL
|
||||||
|
|
||||||
# Prefer GLVND for OpenGL rather than legacy, unless it's been defined elsewhere, in the case of AppImage builds
|
|
||||||
if(NOT DEFINED OpenGL_GL_PREFERENCE)
|
|
||||||
set(OpenGL_GL_PREFERENCE GLVND)
|
|
||||||
endif()
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
add_library(3rdparty_opengl INTERFACE)
|
add_library(3rdparty_opengl INTERFACE)
|
||||||
@ -111,17 +112,14 @@ target_include_directories(3rdparty_opengl INTERFACE GL)
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_link_libraries(3rdparty_opengl INTERFACE ${OPENGL_LIBRARIES} opengl32.lib glu32.lib)
|
target_link_libraries(3rdparty_opengl INTERFACE OpenGL::GL OpenGL::GLU)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(3rdparty_opengl INTERFACE dxgi.lib d2d1.lib dwrite.lib)
|
target_link_libraries(3rdparty_opengl INTERFACE dxgi.lib d2d1.lib dwrite.lib)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(APPLE)
|
||||||
|
target_link_libraries(3rdparty_opengl INTERFACE OpenGL::GL OpenGL::GLU)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(3rdparty_opengl INTERFACE ${OPENGL_LIBRARIES})
|
target_link_libraries(3rdparty_opengl INTERFACE OpenGL::GL OpenGL::GLU OpenGL::GLX)
|
||||||
|
|
||||||
target_compile_definitions(3rdparty_opengl
|
|
||||||
INTERFACE
|
|
||||||
-DGL_GLEXT_PROTOTYPES
|
|
||||||
-DGLX_GLXEXT_PROTOTYPES)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -160,9 +158,9 @@ set(VULKAN_TARGET 3rdparty_dummy_lib)
|
|||||||
if(USE_VULKAN)
|
if(USE_VULKAN)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
if(USE_SYSTEM_MVK)
|
if(USE_SYSTEM_MVK)
|
||||||
message("-- RPCS3: Using system MoltenVK")
|
message(STATUS "RPCS3: Using system MoltenVK")
|
||||||
else()
|
else()
|
||||||
message("-- RPCS3: MoltenVK submodule")
|
message(STATUS "RPCS3: MoltenVK submodule")
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK"
|
||||||
@ -204,9 +202,9 @@ if(USE_VULKAN)
|
|||||||
|
|
||||||
set(VULKAN_TARGET 3rdparty_vulkan)
|
set(VULKAN_TARGET 3rdparty_vulkan)
|
||||||
else()
|
else()
|
||||||
message("WARNING! USE_VULKAN was enabled, but libvulkan was not found. RPCS3 will be compiled without Vulkan support.")
|
message(WARNING "USE_VULKAN was enabled, but libvulkan was not found. RPCS3 will be compiled without Vulkan support.")
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message( FATAL_ERROR "ERROR! To build without Vulkan support on macOS, please disable USE_VULKAN.")
|
message(FATAL_ERROR "To build without Vulkan support on macOS, please disable USE_VULKAN.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -225,7 +223,7 @@ if(USE_FAUDIO)
|
|||||||
if (USE_SYSTEM_FAUDIO)
|
if (USE_SYSTEM_FAUDIO)
|
||||||
if (NOT SDL2_FOUND OR SDL2_VERSION VERSION_LESS 2.0.12)
|
if (NOT SDL2_FOUND OR SDL2_VERSION VERSION_LESS 2.0.12)
|
||||||
message(WARNING
|
message(WARNING
|
||||||
"-- RPCS3: System FAudio requires SDL 2.0.9 or newer. Please note, this warning"
|
"RPCS3: FAudio requires SDL 2.0.9 or newer. Please note, this warning"
|
||||||
"can also be displayed with SDL2 versions between 2.0.9-2.0.12, as the"
|
"can also be displayed with SDL2 versions between 2.0.9-2.0.12, as the"
|
||||||
"CMake config files are not correctly installed. Since a valid SDL2"
|
"CMake config files are not correctly installed. Since a valid SDL2"
|
||||||
">=2.0.9 version cannot be found, building with FAudio will be skipped.")
|
">=2.0.9 version cannot be found, building with FAudio will be skipped.")
|
||||||
@ -262,36 +260,36 @@ add_library(3rdparty_ffmpeg INTERFACE)
|
|||||||
|
|
||||||
# Select the version of ffmpeg to use, default is builtin
|
# Select the version of ffmpeg to use, default is builtin
|
||||||
if(USE_SYSTEM_FFMPEG)
|
if(USE_SYSTEM_FFMPEG)
|
||||||
message("-- RPCS3: using shared ffmpeg")
|
message(STATUS "RPCS3: using shared ffmpeg")
|
||||||
find_package(FFMPEG REQUIRED)
|
find_package(FFMPEG REQUIRED)
|
||||||
|
|
||||||
target_include_directories(3rdparty_ffmpeg INTERFACE ${FFMPEG_INCLUDE_DIR})
|
target_include_directories(3rdparty_ffmpeg INTERFACE ${FFMPEG_INCLUDE_DIR})
|
||||||
target_link_libraries(3rdparty_ffmpeg INTERFACE ${FFMPEG_LIBRARIES})
|
target_link_libraries(3rdparty_ffmpeg INTERFACE ${FFMPEG_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
if (NOT MSVC AND WIN32)
|
if (NOT MSVC AND WIN32)
|
||||||
message("-- RPCS3: building ffmpeg submodule")
|
message(STATUS "RPCS3: building ffmpeg submodule")
|
||||||
|
|
||||||
|
include(ProcessorCount)
|
||||||
|
ProcessorCount(N)
|
||||||
|
|
||||||
ExternalProject_Add(ffmpeg-mingw
|
ExternalProject_Add(ffmpeg-mingw
|
||||||
DOWNLOAD_COMMAND ""
|
DOWNLOAD_COMMAND ""
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg
|
||||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ffmpeg
|
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ffmpeg
|
||||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/configure --prefix=./windows/x86_64 --arch=x86_64 --disable-avdevice --disable-programs --disable-avfilter --disable-postproc --disable-doc --disable-pthreads --enable-w32threads --disable-network --disable-everything --disable-encoders --disable-muxers --disable-hwaccels --disable-parsers --disable-protocols --enable-dxva2 --enable-static --disable-shared --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-decoder=mp3 --enable-decoder=pcm_s16le --enable-decoder=pcm_s8 --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-encoder=pcm_s16le --enable-encoder=ffv1 --enable-encoder=mpeg4 --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=mjpeg --enable-parser=aac --enable-parser=aac_latm --enable-muxer=avi --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mp3 --enable-demuxer=mpegvideo --enable-demuxer=mpegps --enable-demuxer=mjpeg --enable-demuxer=avi --enable-demuxer=aac --enable-demuxer=pmp --enable-demuxer=oma --enable-demuxer=pcm_s16le --enable-demuxer=pcm_s8 --enable-demuxer=wav --enable-hwaccel=h264_dxva2 --enable-indev=dshow --enable-protocol=file
|
CONFIGURE_COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/configure --prefix=./windows/x86_64 --arch=x86_64 --disable-avdevice --disable-programs --disable-avfilter --disable-postproc --disable-doc --disable-pthreads --enable-w32threads --disable-network --disable-everything --disable-encoders --disable-muxers --disable-hwaccels --disable-parsers --disable-protocols --enable-dxva2 --enable-static --disable-shared --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-decoder=mp3 --enable-decoder=pcm_s16le --enable-decoder=pcm_s8 --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-encoder=pcm_s16le --enable-encoder=ffv1 --enable-encoder=mpeg4 --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=mjpeg --enable-parser=aac --enable-parser=aac_latm --enable-muxer=avi --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mp3 --enable-demuxer=mpegvideo --enable-demuxer=mpegps --enable-demuxer=mjpeg --enable-demuxer=avi --enable-demuxer=aac --enable-demuxer=pmp --enable-demuxer=oma --enable-demuxer=pcm_s16le --enable-demuxer=pcm_s8 --enable-demuxer=wav --enable-hwaccel=h264_dxva2 --enable-indev=dshow --enable-protocol=file
|
||||||
BUILD_COMMAND make -j 4
|
BUILD_COMMAND make -j ${N}
|
||||||
INSTALL_COMMAND make install
|
INSTALL_COMMAND make install
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FFMPEG_LIB_AVFORMAT "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib/libavformat.a")
|
target_link_directories(3rdparty_ffmpeg INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib")
|
||||||
set(FFMPEG_LIB_AVCODEC "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib/libavcodec.a")
|
target_link_libraries(3rdparty_ffmpeg INTERFACE avformat avcodec avutil swscale swresample iconv)
|
||||||
set(FFMPEG_LIB_AVUTIL "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib/libavutil.a")
|
|
||||||
set(FFMPEG_LIB_SWSCALE "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib/libswscale.a")
|
|
||||||
set(FFMPEG_LIB_SWRESAMPLE "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/windows/x86_64/lib/libswresample.a")
|
|
||||||
else()
|
else()
|
||||||
message("-- RPCS3: using builtin ffmpeg")
|
message(STATUS "RPCS3: using builtin ffmpeg")
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(FFMPEG_LIB_DIR "ffmpeg/windows/x86_64")
|
set(FFMPEG_LIB_DIR "ffmpeg/windows/x86_64")
|
||||||
target_link_libraries(3rdparty_ffmpeg INTERFACE "Bcrypt.lib")
|
target_link_libraries(3rdparty_ffmpeg INTERFACE "Bcrypt.lib")
|
||||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(FFMPEG_LIB_DIR "ffmpeg/linux/x86_64")
|
set(FFMPEG_LIB_DIR "ffmpeg/linux/x86_64")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(FFMPEG_LIB_DIR "ffmpeg/macos/x86_64")
|
set(FFMPEG_LIB_DIR "ffmpeg/macos/x86_64")
|
||||||
@ -304,31 +302,31 @@ else()
|
|||||||
find_library(FFMPEG_LIB_AVUTIL avutil PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_AVUTIL avutil PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_SWSCALE swscale PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_SWSCALE swscale PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
find_library(FFMPEG_LIB_SWRESAMPLE swresample PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
find_library(FFMPEG_LIB_SWRESAMPLE swresample PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(3rdparty_ffmpeg INTERFACE "ffmpeg/include")
|
target_link_libraries(3rdparty_ffmpeg
|
||||||
|
|
||||||
target_link_libraries(3rdparty_ffmpeg
|
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${FFMPEG_LIB_AVFORMAT}
|
${FFMPEG_LIB_AVFORMAT}
|
||||||
${FFMPEG_LIB_AVCODEC}
|
${FFMPEG_LIB_AVCODEC}
|
||||||
${FFMPEG_LIB_AVUTIL}
|
${FFMPEG_LIB_AVUTIL}
|
||||||
${FFMPEG_LIB_SWSCALE}
|
${FFMPEG_LIB_SWSCALE}
|
||||||
${FFMPEG_LIB_SWRESAMPLE}
|
${FFMPEG_LIB_SWRESAMPLE}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(3rdparty_ffmpeg INTERFACE "ffmpeg/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# GLEW
|
# GLEW
|
||||||
add_library(3rdparty_glew INTERFACE)
|
add_library(3rdparty_glew INTERFACE)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
find_package(GLEW 1.13.0 REQUIRED)
|
find_package(GLEW REQUIRED)
|
||||||
target_link_libraries(3rdparty_glew INTERFACE GLEW::GLEW)
|
target_link_libraries(3rdparty_glew INTERFACE GLEW::GLEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# LLVM
|
# LLVM
|
||||||
include(llvm.cmake)
|
add_subdirectory(llvm EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# WOLFSSL
|
# WOLFSSL
|
||||||
add_subdirectory(wolfssl EXCLUDE_FROM_ALL)
|
add_subdirectory(wolfssl EXCLUDE_FROM_ALL)
|
||||||
|
2
3rdparty/OpenAL/CMakeLists.txt
vendored
2
3rdparty/OpenAL/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
|||||||
# OpenAL
|
# OpenAL
|
||||||
if (MSVC)
|
if (WIN32)
|
||||||
find_path(OPENAL_INCLUDE_DIR al.h PATHS include/)
|
find_path(OPENAL_INCLUDE_DIR al.h PATHS include/)
|
||||||
find_library(OPENAL_LIBRARY OpenAL32 PATHS libs/Win64/)
|
find_library(OPENAL_LIBRARY OpenAL32 PATHS libs/Win64/)
|
||||||
else()
|
else()
|
||||||
|
32
3rdparty/curl/CMakeLists.txt
vendored
32
3rdparty/curl/CMakeLists.txt
vendored
@ -1,24 +1,36 @@
|
|||||||
# CURL
|
# CURL
|
||||||
|
|
||||||
if(USE_SYSTEM_CURL)
|
if(USE_SYSTEM_CURL)
|
||||||
message("-- RPCS3: using shared libcurl")
|
message(STATUS "RPCS3: using shared libcurl")
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
add_library(libcurl INTERFACE)
|
add_library(libcurl INTERFACE)
|
||||||
target_link_libraries(libcurl INTERFACE CURL::libcurl)
|
target_link_libraries(libcurl INTERFACE CURL::libcurl)
|
||||||
else()
|
else()
|
||||||
message("-- RPCS3: building libcurl + wolfssl submodules")
|
message(STATUS "RPCS3: building libcurl + wolfssl submodules")
|
||||||
add_compile_definitions(HAVE_SNI OPENSSL_EXTRA)
|
set(BUILD_CURL_EXE OFF CACHE BOOL "Set to ON to build curl executable.")
|
||||||
option(BUILD_CURL_EXE "Set to ON to build curl executable." OFF)
|
# If set to ON then CURL can not find our wolfssl
|
||||||
option(CURL_USE_WOLFSSL "enable wolfSSL for SSL/TLS" ON)
|
set(CURL_USE_WOLFSSL OFF CACHE BOOL "enable wolfSSL for SSL/TLS")
|
||||||
option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" ON)
|
set(CURL_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
|
||||||
option(CURL_ZLIB "Set to ON to enable building curl with zlib support." OFF)
|
set(HTTP_ONLY ON CACHE BOOL "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)")
|
||||||
option(USE_LIBIDN2 "Use libidn2 for IDN support" OFF) # Disabled because MacOs CI doesn't work otherwise
|
set(USE_LIBIDN2 OFF CACHE BOOL "Use libidn2 for IDN support") # Disabled because MacOS CI doesn't work otherwise
|
||||||
set(CURL_CA_PATH "none" CACHE STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
set(CURL_CA_PATH "none" CACHE STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||||
if(USE_MSVC_STATIC_CRT)
|
if(USE_MSVC_STATIC_CRT)
|
||||||
set(CURL_STATIC_CRT ON CACHE BOOL "Use static crt to build curl" FORCE)
|
set(CURL_STATIC_CRT ON CACHE BOOL "Use static crt to build curl")
|
||||||
endif()
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
set(ENABLE_UNICODE ON CACHE BOOL "enable Unicode")
|
||||||
|
endif()
|
||||||
|
set(CURL_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2")
|
||||||
|
set(CURL_USE_LIBPSL OFF CACHE BOOL "Use libPSL")
|
||||||
|
|
||||||
|
set(SSL_ENABLED ON)
|
||||||
|
set(USE_WOLFSSL ON)
|
||||||
|
|
||||||
add_subdirectory(curl EXCLUDE_FROM_ALL)
|
add_subdirectory(curl EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set_property(TARGET libcurl PROPERTY FOLDER "3rdparty/")
|
target_link_libraries(libcurl PRIVATE wolfssl)
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_definitions(libcurl PRIVATE HAVE_SSIZE_T)
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
2
3rdparty/hidapi/CMakeLists.txt
vendored
2
3rdparty/hidapi/CMakeLists.txt
vendored
@ -14,7 +14,7 @@ if(APPLE)
|
|||||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hid Shlwapi.lib)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi::hidapi hidapi::include Shlwapi.lib)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
|
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
|
||||||
endif()
|
endif()
|
||||||
|
9
3rdparty/libpng/CMakeLists.txt
vendored
9
3rdparty/libpng/CMakeLists.txt
vendored
@ -2,14 +2,15 @@
|
|||||||
# Select the version of libpng to use, default is builtin
|
# Select the version of libpng to use, default is builtin
|
||||||
if (NOT USE_SYSTEM_LIBPNG)
|
if (NOT USE_SYSTEM_LIBPNG)
|
||||||
# We use libpng's static library and don't need to build the shared library and run the tests
|
# We use libpng's static library and don't need to build the shared library and run the tests
|
||||||
set(PNG_SHARED OFF CACHE BOOL "Build shared lib" FORCE)
|
set(PNG_SHARED OFF CACHE BOOL "Build shared lib")
|
||||||
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests" FORCE)
|
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests")
|
||||||
set(PNG_BUILD_ZLIB ON CACHE BOOL "ZLIB is already build or package is found" FORCE)
|
set(PNG_BUILD_ZLIB ON CACHE BOOL "ZLIB is already build or package is found")
|
||||||
set(SKIP_INSTALL_ALL ON)
|
set(SKIP_INSTALL_ALL ON)
|
||||||
add_subdirectory(libpng EXCLUDE_FROM_ALL)
|
add_subdirectory(libpng EXCLUDE_FROM_ALL)
|
||||||
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
|
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
|
||||||
|
target_link_libraries(png_static 3rdparty::zlib)
|
||||||
|
|
||||||
set(LIBPNG_TARGET png_static PARENT_SCOPE)
|
set(LIBPNG_TARGET png_static PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
find_package(PNG REQUIRED)
|
find_package(PNG REQUIRED)
|
||||||
|
|
||||||
|
2
3rdparty/libusb/CMakeLists.txt
vendored
2
3rdparty/libusb/CMakeLists.txt
vendored
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.4)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
project(libusb)
|
project(libusb)
|
||||||
|
|
||||||
|
6
3rdparty/libusb/config.cmake
vendored
6
3rdparty/libusb/config.cmake
vendored
@ -89,7 +89,11 @@ set(PACKAGE_URL "http://www.libusb.org" CACHE INTERNAL "package url" FORCE)
|
|||||||
set(PACKAGE_TARNAME "libusb" CACHE INTERNAL "tarball name" FORCE)
|
set(PACKAGE_TARNAME "libusb" CACHE INTERNAL "tarball name" FORCE)
|
||||||
set(VERSION "${PACKAGE_VERSION}" CACHE INTERNAL "version" FORCE)
|
set(VERSION "${PACKAGE_VERSION}" CACHE INTERNAL "version" FORCE)
|
||||||
|
|
||||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
if(MSVC)
|
||||||
|
file(COPY libusb/msvc/config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
else()
|
||||||
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
||||||
|
endif()
|
||||||
message(STATUS "Generated configuration file in ${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
message(STATUS "Generated configuration file in ${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
||||||
|
|
||||||
# for generated config.h
|
# for generated config.h
|
||||||
|
25
3rdparty/libusb/libusb.cmake
vendored
25
3rdparty/libusb/libusb.cmake
vendored
@ -3,22 +3,6 @@ include(os.cmake)
|
|||||||
include(config.cmake)
|
include(config.cmake)
|
||||||
include(FindThreads)
|
include(FindThreads)
|
||||||
|
|
||||||
set (LIBUSB_COMMON
|
|
||||||
core.c
|
|
||||||
descriptor.c
|
|
||||||
io.c
|
|
||||||
sync.c
|
|
||||||
hotplug.c
|
|
||||||
strerror.c
|
|
||||||
libusb-1.0.rc
|
|
||||||
libusb-1.0.def
|
|
||||||
)
|
|
||||||
|
|
||||||
foreach(SRC IN LISTS LIBUSB_COMMON)
|
|
||||||
list(APPEND LIBUSB_COMMON_FINAL ${LIBUSB_SOURCE_DIR}/libusb/${SRC})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
|
|
||||||
include_directories(${LIBUSB_SOURCE_DIR}/libusb)
|
include_directories(${LIBUSB_SOURCE_DIR}/libusb)
|
||||||
include_directories(${LIBUSB_SOURCE_DIR}/libusb/os)
|
include_directories(${LIBUSB_SOURCE_DIR}/libusb/os)
|
||||||
|
|
||||||
@ -28,7 +12,14 @@ endif()
|
|||||||
|
|
||||||
add_library(usb-1.0-static
|
add_library(usb-1.0-static
|
||||||
STATIC
|
STATIC
|
||||||
${LIBUSB_COMMON_FINAL}
|
libusb/libusb/core.c
|
||||||
|
libusb/libusb/descriptor.c
|
||||||
|
libusb/libusb/io.c
|
||||||
|
libusb/libusb/sync.c
|
||||||
|
libusb/libusb/hotplug.c
|
||||||
|
libusb/libusb/strerror.c
|
||||||
|
libusb/libusb/libusb-1.0.rc
|
||||||
|
libusb/libusb/libusb-1.0.def
|
||||||
${LIBUSB_PLATFORM}
|
${LIBUSB_PLATFORM}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
43
3rdparty/libusb/os.cmake
vendored
43
3rdparty/libusb/os.cmake
vendored
@ -5,42 +5,43 @@ if (CMAKE_USE_PTHREADS_INIT)
|
|||||||
set(PTHREADS_ENABLED TRUE)
|
set(PTHREADS_ENABLED TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
if (CYGWIN)
|
||||||
add_compile_definitions(PLATFORM_WINDOWS=1)
|
add_compile_definitions(PLATFORM_WINDOWS=1)
|
||||||
set(OS_WINDOWS 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
set(OS_WINDOWS 1)
|
||||||
|
|
||||||
# Enable MingW support for RC language (for CMake pre-2.8)
|
message(STATUS "Detected Cygwin")
|
||||||
if (MINGW)
|
set(PTHREADS_ENABLED TRUE)
|
||||||
set(CMAKE_RC_COMPILER_INIT windres)
|
set(WITHOUT_POLL_H TRUE)
|
||||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
|
||||||
endif()
|
|
||||||
enable_language(RC)
|
|
||||||
|
|
||||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
|
||||||
message(STATUS "Detected cygwin")
|
|
||||||
set(PTHREADS_ENABLED TRUE)
|
|
||||||
set(WITHOUT_POLL_H TRUE CACHE INTERNAL "Disable using poll.h even if it's available - use windows poll instead fo cygwin's" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND PLATFORM_SRC
|
list(APPEND PLATFORM_SRC
|
||||||
events_windows.c
|
events_windows.c
|
||||||
windows_usbdk.c
|
windows_usbdk.c
|
||||||
windows_common.c
|
windows_common.c
|
||||||
windows_winusb.c
|
windows_winusb.c
|
||||||
threads_windows.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PTHREADS_ENABLED AND NOT WITHOUT_PTHREADS)
|
if (PTHREADS_ENABLED AND NOT WITHOUT_PTHREADS)
|
||||||
list(APPEND PLATFORM_SRC threads_posix)
|
list(APPEND PLATFORM_SRC threads_posix)
|
||||||
else()
|
|
||||||
list(APPEND PLATFORM_SRC threads_windows.c)
|
|
||||||
endif()
|
endif()
|
||||||
|
elseif(WIN32)
|
||||||
|
add_compile_definitions(PLATFORM_WINDOWS=1)
|
||||||
|
set(OS_WINDOWS 1)
|
||||||
|
set(PTHREADS_ENABLED FALSE)
|
||||||
|
|
||||||
|
list(APPEND PLATFORM_SRC
|
||||||
|
events_windows.c
|
||||||
|
windows_usbdk.c
|
||||||
|
windows_common.c
|
||||||
|
windows_winusb.c
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND PLATFORM_SRC threads_windows.c)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
# Apple != OSX alone
|
# Apple != OSX alone
|
||||||
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
||||||
set(OS_DARWIN 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
set(OS_DARWIN 1)
|
||||||
|
|
||||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(PLATFORM_SRC
|
set(PLATFORM_SRC
|
||||||
darwin_usb.c
|
darwin_usb.c
|
||||||
threads_posix.c
|
threads_posix.c
|
||||||
@ -77,7 +78,7 @@ elseif (UNIX)
|
|||||||
# Unix is for all *NIX systems including OSX
|
# Unix is for all *NIX systems including OSX
|
||||||
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
||||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
set(OS_LINUX 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
set(OS_LINUX 1)
|
||||||
|
|
||||||
set(PLATFORM_SRC
|
set(PLATFORM_SRC
|
||||||
linux_usbfs.c
|
linux_usbfs.c
|
||||||
@ -108,4 +109,4 @@ set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARIES} PARENT_SCOPE)
|
|||||||
if (WITHOUT_PTHREADS)
|
if (WITHOUT_PTHREADS)
|
||||||
set(PTHREADS_ENABLED FALSE)
|
set(PTHREADS_ENABLED FALSE)
|
||||||
endif()
|
endif()
|
||||||
set(THREADS_POSIX ${PTHREADS_ENABLED} CACHE INTERNAL "use pthreads" FORCE)
|
set(THREADS_POSIX ${PTHREADS_ENABLED})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
CHECK_CXX_COMPILER_FLAG("-msse -msse2 -mcx16" COMPILER_X86)
|
check_cxx_compiler_flag("-msse -msse2 -mcx16" COMPILER_X86)
|
||||||
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+lse" COMPILER_ARM)
|
check_cxx_compiler_flag("-march=armv8-a+lse" COMPILER_ARM)
|
||||||
|
|
||||||
if(BUILD_LLVM)
|
if(BUILD_LLVM)
|
||||||
message(STATUS "LLVM will be built from the submodule.")
|
message(STATUS "LLVM will be built from the submodule.")
|
||||||
@ -14,28 +14,26 @@ if(WITH_LLVM)
|
|||||||
option(LLVM_INCLUDE_TESTS OFF)
|
option(LLVM_INCLUDE_TESTS OFF)
|
||||||
option(LLVM_INCLUDE_TOOLS OFF)
|
option(LLVM_INCLUDE_TOOLS OFF)
|
||||||
option(LLVM_INCLUDE_UTILS OFF)
|
option(LLVM_INCLUDE_UTILS OFF)
|
||||||
option(LLVM_CCACHE_BUILD ON)
|
# we globally enable ccache
|
||||||
|
set(LLVM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(LLVM_USE_INTEL_JITEVENTS ON)
|
set(LLVM_USE_INTEL_JITEVENTS ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(LLVM_USE_INTEL_JITEVENTS ON)
|
set(LLVM_USE_INTEL_JITEVENTS ON)
|
||||||
set(LLVM_USE_PERF ON)
|
set(LLVM_USE_PERF ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CXX_FLAGS_OLD ${CMAKE_CXX_FLAGS})
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS")
|
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# LLVM needs to be built out-of-tree
|
# LLVM needs to be built out-of-tree
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/llvm/llvm/llvm ${CMAKE_BINARY_DIR}/3rdparty/llvm/llvm_build EXCLUDE_FROM_ALL)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/llvm/llvm ${CMAKE_CURRENT_BINARY_DIR}/llvm_build EXCLUDE_FROM_ALL)
|
||||||
set(LLVM_DIR "${CMAKE_BINARY_DIR}/3rdparty/llvm/llvm_build/lib/cmake/llvm/")
|
set(LLVM_DIR "${CMAKE_CURRENT_BINARY_DIR}/llvm_build/lib/cmake/llvm/")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS ${CXX_FLAGS_OLD})
|
|
||||||
set(STATIC_LINK_LLVM ON CACHE BOOL "Link against LLVM statically. This will get set to ON if you build LLVM from the submodule." FORCE)
|
set(STATIC_LINK_LLVM ON CACHE BOOL "Link against LLVM statically. This will get set to ON if you build LLVM from the submodule." FORCE)
|
||||||
|
|
||||||
# now tries to find LLVM again
|
# now tries to find LLVM again
|
||||||
@ -72,11 +70,11 @@ if(WITH_LLVM)
|
|||||||
set(LLVM_TARGETS_TO_BUILD "X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
set(LLVM_TARGETS_TO_BUILD "X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(WIN32 OR CMAKE_SYSTEM MATCHES "Linux")
|
if((WIN32 AND BUILD_LLVM) OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set (LLVM_ADDITIONAL_LIBS ${LLVM_ADDITIONAL_LIBS} IntelJITEvents)
|
list (APPEND LLVM_ADDITIONAL_LIBS IntelJITEvents)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set (LLVM_ADDITIONAL_LIBS ${LLVM_ADDITIONAL_LIBS} PerfJITEvents)
|
list (APPEND LLVM_ADDITIONAL_LIBS PerfJITEvents)
|
||||||
endif()
|
endif()
|
||||||
llvm_map_components_to_libnames(LLVM_LIBS
|
llvm_map_components_to_libnames(LLVM_LIBS
|
||||||
${LLVM_TARGETS_TO_BUILD}
|
${LLVM_TARGETS_TO_BUILD}
|
||||||
@ -92,7 +90,8 @@ if(WITH_LLVM)
|
|||||||
add_library(3rdparty_llvm INTERFACE)
|
add_library(3rdparty_llvm INTERFACE)
|
||||||
target_link_libraries(3rdparty_llvm INTERFACE ${LLVM_LIBS})
|
target_link_libraries(3rdparty_llvm INTERFACE ${LLVM_LIBS})
|
||||||
target_include_directories(3rdparty_llvm INTERFACE ${LLVM_INCLUDE_DIRS})
|
target_include_directories(3rdparty_llvm INTERFACE ${LLVM_INCLUDE_DIRS})
|
||||||
target_compile_definitions(3rdparty_llvm INTERFACE ${LLVM_DEFINITIONS} -DLLVM_AVAILABLE)
|
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
|
||||||
|
target_compile_definitions(3rdparty_llvm INTERFACE ${LLVM_DEFINITIONS_LIST} LLVM_AVAILABLE)
|
||||||
|
|
||||||
add_library(3rdparty::llvm ALIAS 3rdparty_llvm)
|
add_library(3rdparty::llvm ALIAS 3rdparty_llvm)
|
||||||
else()
|
else()
|
10
3rdparty/pine/pine_server.h
vendored
10
3rdparty/pine/pine_server.h
vendored
@ -32,6 +32,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
constexpr SOCKET invalid_socket = INVALID_SOCKET;
|
||||||
|
#else
|
||||||
|
constexpr int invalid_socket = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace pine
|
namespace pine
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -381,7 +387,7 @@ namespace pine
|
|||||||
|
|
||||||
m_msgsock = accept(m_sock, 0, 0);
|
m_msgsock = accept(m_sock, 0, 0);
|
||||||
|
|
||||||
if (m_msgsock == -1)
|
if (m_msgsock == invalid_socket)
|
||||||
{
|
{
|
||||||
// everything else is non recoverable in our scope
|
// everything else is non recoverable in our scope
|
||||||
// we also mark as recoverable socket errors where it would block a
|
// we also mark as recoverable socket errors where it would block a
|
||||||
@ -541,7 +547,7 @@ namespace pine
|
|||||||
}
|
}
|
||||||
server.sin_port = htons(Impl::get_port());
|
server.sin_port = htons(Impl::get_port());
|
||||||
|
|
||||||
if (bind(m_sock, (struct sockaddr*)&server, sizeof(server)) == SOCKET_ERROR)
|
if (bind(m_sock, reinterpret_cast<struct sockaddr*>(&server), sizeof(server)) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
Impl::error("IPC: Error while binding to socket! Shutting down...");
|
Impl::error("IPC: Error while binding to socket! Shutting down...");
|
||||||
return;
|
return;
|
||||||
|
4
3rdparty/qt5.cmake
vendored
4
3rdparty/qt5.cmake
vendored
@ -20,7 +20,7 @@ endif()
|
|||||||
if(NOT Qt5Widgets_FOUND)
|
if(NOT Qt5Widgets_FOUND)
|
||||||
if(Qt5Widgets_VERSION VERSION_LESS ${QT_MIN_VER})
|
if(Qt5Widgets_VERSION VERSION_LESS ${QT_MIN_VER})
|
||||||
message("Minimum supported Qt5 version is ${QT_MIN_VER}! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
|
message("Minimum supported Qt5 version is ${QT_MIN_VER}! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
|
||||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt.
|
message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt.
|
||||||
If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions.
|
If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions.
|
||||||
Find the correct ppa at https://launchpad.net/~beineri and follow the instructions.")
|
Find the correct ppa at https://launchpad.net/~beineri and follow the instructions.")
|
||||||
@ -35,7 +35,7 @@ Find the correct ppa at https://launchpad.net/~beineri and follow the instructio
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\${QT_MIN_VER}\\msvc2019_64\\)
|
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\${QT_MIN_VER}\\msvc2019_64\\)
|
||||||
You can also try setting the Qt5_DIR preprocessor definiton.")
|
You can also try setting the Qt5_DIR preprocessor definiton.")
|
||||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
message(FATAL_ERROR "Make sure to install your distro's qt5 package!")
|
message(FATAL_ERROR "Make sure to install your distro's qt5 package!")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "You need to have Qt5 installed, look online for instructions on installing Qt5 on ${CMAKE_SYSTEM}.")
|
message(FATAL_ERROR "You need to have Qt5 installed, look online for instructions on installing Qt5 on ${CMAKE_SYSTEM}.")
|
||||||
|
48
3rdparty/wolfssl/CMakeLists.txt
vendored
48
3rdparty/wolfssl/CMakeLists.txt
vendored
@ -1,40 +1,26 @@
|
|||||||
if(USE_SYSTEM_WOLFSSL)
|
if(USE_SYSTEM_WOLFSSL)
|
||||||
message("-- RPCS3: using shared wolfssl")
|
message(STATUS "RPCS3: using shared wolfssl")
|
||||||
pkg_check_modules(WolfSSL REQUIRED IMPORTED_TARGET wolfssl>=4.7.0)
|
pkg_check_modules(WolfSSL REQUIRED IMPORTED_TARGET wolfssl>=4.7.0)
|
||||||
add_library(wolfssl INTERFACE)
|
add_library(wolfssl INTERFACE)
|
||||||
target_link_libraries(wolfssl INTERFACE PkgConfig::WolfSSL)
|
target_link_libraries(wolfssl INTERFACE PkgConfig::WolfSSL)
|
||||||
else()
|
else()
|
||||||
# TODO(cjj19970505@live.cn)
|
set(WOLFSSL_TLS13 OFF CACHE STRING "Enable wolfSSL TLS v1.3 (default: enabled)")
|
||||||
# OPENSSL_EXTRA, and HAVE_SNI are unconfigurable from CMake cache.
|
set(WOLFSSL_SHA3 ON CACHE STRING "Enable wolfSSL SHA-3 support (default: enabled on x86_64/aarch64)")
|
||||||
# but they do have it in a TODO list (wolfssl/CMakeList, 1021)
|
set(WOLFSSL_SHAKE256 ON CACHE STRING "Enable wolfSSL SHAKE256 support (default: enabled on x86_64/aarch64)")
|
||||||
add_compile_definitions(OPENSSL_EXTRA WOLFSSL_DES_ECB HAVE_SNI HAVE_WRITE_DUP)
|
set(WOLFSSL_BASE64_ENCODE OFF CACHE STRING "Enable Base64 encoding (default: enabled on x86_64)")
|
||||||
add_compile_definitions(FP_MAX_BITS=8192)
|
set(WOLFSSL_DES3 ON CACHE STRING "Enable DES3 (default: disabled)")
|
||||||
|
set(WOLFSSL_PWDBASED ON CACHE STRING "Enable PWDBASED (default: disabled)")
|
||||||
set(WOLFSSL_TLS13 "no" CACHE INTERNAL "")
|
set(WOLFSSL_FAST_MATH ON CACHE STRING "Enable fast math ops (default: disabled)")
|
||||||
set(WOLFSSL_SHA224 "yes" CACHE INTERNAL "")
|
set(WOLFSSL_EXAMPLES OFF CACHE STRING "Enable examples (default: enabled)")
|
||||||
set(WOLFSSL_SHA3 "yes" CACHE INTERNAL "")
|
set(WOLFSSL_CRYPT_TESTS OFF CACHE STRING "Enable Crypt Bench/Test (default: enabled)")
|
||||||
set(WOLFSSL_SHAKE256 "yes" CACHE INTERNAL "")
|
set(WOLFSSL_ASYNC_THREADS OFF CACHE STRING "Enable Asynchronous Threading (default: enabled)")
|
||||||
set(WOLFSSL_BASE64_ENCODE "no" CACHE INTERNAL "")
|
set(WOLFSSL_BUILD_OUT_OF_TREE ON CACHE STRING "Don't generate files in the source tree (default: no)")
|
||||||
set(WOLFSSL_DES3 "yes" CACHE INTERNAL "")
|
set(WOLFSSL_SNI ON CACHE STRING "Enable SNI (default: disabled)")
|
||||||
set(WOLFSSL_POLY1305 "yes" CACHE INTERNAL "")
|
set(WOLFSSL_OPENSSLEXTRA ON CACHE STRING "Enable extra OpenSSL API, size+ (default: disabled)")
|
||||||
set(WOLFSSL_CHACHA "yes" CACHE INTERNAL "")
|
set(WOLFSSL_HARDEN OFF CACHE STRING "Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)")
|
||||||
set(WOLFSSL_FILESYSTEM "yes" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_PWDBASED "yes" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_FAST_MATH "yes" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_EXAMPLES "no" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_CRYPT_TESTS "no" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_ASYNC_THREADS "no" CACHE INTERNAL "")
|
|
||||||
set(WOLFSSL_CONFIG_H "no" CACHE INTERNAL "")
|
|
||||||
|
|
||||||
add_subdirectory(wolfssl EXCLUDE_FROM_ALL)
|
add_subdirectory(wolfssl EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set(WolfSSL_LIBRARY "$<TARGET_FILE:wolfssl>" CACHE INTERNAL "")
|
target_compile_definitions(wolfssl PUBLIC WOLFSSL_DES_ECB HAVE_WRITE_DUP)
|
||||||
|
target_compile_definitions(wolfssl PUBLIC FP_MAX_BITS=8192)
|
||||||
# "${CMAKE_CURRENT_SOURCE_DIR}/wolfssl/wolfssl/" provides openssl headers
|
|
||||||
# So that curl can be built on an environment where openssl headers are not provided
|
|
||||||
set(WolfSSL_INCLUDE_DIR
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/wolfssl/"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/wolfssl/wolfssl/"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/wolfssl/"
|
|
||||||
CACHE INTERNAL "")
|
|
||||||
endif()
|
endif()
|
||||||
|
20
3rdparty/zlib/CMakeLists.txt
vendored
20
3rdparty/zlib/CMakeLists.txt
vendored
@ -1,14 +1,16 @@
|
|||||||
if (USE_SYSTEM_ZLIB)
|
if (USE_SYSTEM_ZLIB)
|
||||||
message(STATUS "-- RPCS3: Using syztem ZLIB")
|
message(STATUS "RPCS3: Using system ZLIB")
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
|
|
||||||
|
add_library(3rdparty_zlib INTERFACE)
|
||||||
|
target_link_libraries(3rdparty_zlib INTERFACE ${ZLIB_LIBRARIES})
|
||||||
|
target_include_directories(3rdparty_zlib INTERFACE ${ZLIB_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
message(STATUS "-- RPCS3: Using builtin ZLIB")
|
message(STATUS "RPCS3: Using builtin ZLIB")
|
||||||
set(SKIP_INSTALL_ALL ON)
|
set(SKIP_INSTALL_ALL ON)
|
||||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${CMAKE_CURRENT_BINARY_DIR}/zlib")
|
|
||||||
set(ZLIB_LIBRARY zlibstatic)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(3rdparty_zlib INTERFACE)
|
add_library(3rdparty_zlib INTERFACE)
|
||||||
target_link_libraries(3rdparty_zlib INTERFACE ${ZLIB_LIBRARY})
|
target_link_libraries(3rdparty_zlib INTERFACE zlibstatic)
|
||||||
target_include_directories(3rdparty_zlib INTERFACE ${ZLIB_INCLUDE_DIR})
|
target_include_directories(3rdparty_zlib INTERFACE zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
|
||||||
|
endif()
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 3.16.9)
|
cmake_minimum_required(VERSION 3.16.9)
|
||||||
|
|
||||||
project(rpcs3)
|
project(rpcs3 LANGUAGES C CXX)
|
||||||
|
|
||||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
|
||||||
message(FATAL_ERROR "RPCS3 requires at least gcc-11.")
|
message(FATAL_ERROR "RPCS3 requires at least gcc-11.")
|
||||||
endif()
|
endif()
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
|
||||||
message(FATAL_ERROR "RPCS3 requires at least clang-12.0.")
|
message(FATAL_ERROR "RPCS3 requires at least clang-12.0.")
|
||||||
endif()
|
endif()
|
||||||
@ -25,7 +27,7 @@ option(USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
|
|||||||
option(USE_SDL "Enables SDL input handler" OFF)
|
option(USE_SDL "Enables SDL input handler" OFF)
|
||||||
option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" OFF)
|
option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" OFF)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/buildfiles/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT MSVC)
|
if(CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT MSVC)
|
||||||
add_definitions(-D_DEBUG)
|
add_compile_definitions(_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@ -75,7 +77,7 @@ if(MSVC)
|
|||||||
# TODO(cjj19970505@live.cn)
|
# TODO(cjj19970505@live.cn)
|
||||||
# offical QT uses dynamic CRT.
|
# offical QT uses dynamic CRT.
|
||||||
# When building our lib with static CRT and debug build type
|
# When building our lib with static CRT and debug build type
|
||||||
# and linking with Qt with dynmaic CRT and debug build,
|
# and linking with Qt with dynamic CRT and debug build,
|
||||||
# error is encountered in runtime (which is expected).
|
# error is encountered in runtime (which is expected).
|
||||||
# But building our lib with static CRT and release build type,
|
# But building our lib with static CRT and release build type,
|
||||||
# and linking with Qt with dynamic CRT and release build seems to be working,
|
# and linking with Qt with dynamic CRT and release build seems to be working,
|
||||||
@ -90,6 +92,7 @@ if(MSVC)
|
|||||||
message(AUTHOR_WARNING "Debug build currently can not work with static CRT.")
|
message(AUTHOR_WARNING "Debug build currently can not work with static CRT.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
add_compile_options(/MP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
@ -98,13 +101,12 @@ endif()
|
|||||||
|
|
||||||
find_program(CCACHE_FOUND ccache)
|
find_program(CCACHE_FOUND ccache)
|
||||||
if(CCACHE_FOUND)
|
if(CCACHE_FOUND)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DUNICODE)
|
add_compile_definitions(UNICODE)
|
||||||
add_definitions(-D_WIN32_WINNT=0x0602)
|
add_compile_definitions(_WIN32_WINNT=0x0602)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||||
@ -112,10 +114,7 @@ if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
|||||||
link_directories(/opt/homebrew/lib)
|
link_directories(/opt/homebrew/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Warnings are silenced for 3rdparty code
|
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.")
|
||||||
set(CMAKE_CXX_FLAGS -w)
|
|
||||||
set(CMAKE_C_FLAGS -w)
|
|
||||||
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "")
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_options(/wd4530 /utf-8) # C++ exception handler used, but unwind semantics are not enabled
|
add_compile_options(/wd4530 /utf-8) # C++ exception handler used, but unwind semantics are not enabled
|
||||||
@ -123,9 +122,6 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(3rdparty)
|
add_subdirectory(3rdparty)
|
||||||
|
|
||||||
unset(CMAKE_CXX_FLAGS)
|
|
||||||
unset(CMAKE_C_FLAGS)
|
|
||||||
|
|
||||||
if (DISABLE_LTO)
|
if (DISABLE_LTO)
|
||||||
if (CMAKE_C_FLAGS)
|
if (CMAKE_C_FLAGS)
|
||||||
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||||
@ -137,7 +133,7 @@ endif()
|
|||||||
|
|
||||||
string(FIND "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}" "-flto" FOUND_LTO)
|
string(FIND "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}" "-flto" FOUND_LTO)
|
||||||
if (NOT FOUND_LTO EQUAL -1)
|
if (NOT FOUND_LTO EQUAL -1)
|
||||||
message(FATAL_ERROR "Rpcs3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
|
message(FATAL_ERROR "RPCS3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
@ -149,6 +145,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
|||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
add_subdirectory(rpcs3)
|
add_subdirectory(rpcs3)
|
||||||
|
|
||||||
|
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT rpcs3)
|
||||||
|
68
CMakePresets.json
Normal file
68
CMakePresets.json
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "gcc",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "build-gcc",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"USE_FAUDIO": "OFF",
|
||||||
|
"USE_SYSTEM_CURL": "OFF",
|
||||||
|
"USE_SYSTEM_ZLIB": "OFF",
|
||||||
|
"USE_SYSTEM_LIBPNG": "OFF",
|
||||||
|
"USE_NATIVE_INSTRUCTIONS": "ON",
|
||||||
|
"USE_PRECOMPILED_HEADERS": "ON",
|
||||||
|
"BUILD_LLVM": "OFF",
|
||||||
|
"STATIC_LINK_LLVM": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "build-clang64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"USE_FAUDIO": "OFF",
|
||||||
|
"USE_SYSTEM_CURL": "OFF",
|
||||||
|
"USE_SYSTEM_ZLIB": "OFF",
|
||||||
|
"USE_SYSTEM_LIBPNG": "OFF",
|
||||||
|
"LLVM_ENABLE_LIBCXX": "ON",
|
||||||
|
"USE_NATIVE_INSTRUCTIONS": "ON",
|
||||||
|
"USE_PRECOMPILED_HEADERS": "ON",
|
||||||
|
"BUILD_LLVM": "OFF",
|
||||||
|
"STATIC_LINK_LLVM": "ON"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"CXX": "clang++",
|
||||||
|
"CC": "clang"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "msvc",
|
||||||
|
"displayName": "Windows x64",
|
||||||
|
"generator": "Visual Studio 17 2022",
|
||||||
|
"binaryDir": "build-msvc",
|
||||||
|
"architecture": {
|
||||||
|
"value": "x64",
|
||||||
|
"strategy": "external"
|
||||||
|
},
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
|
||||||
|
"USE_FAUDIO": "OFF",
|
||||||
|
"USE_PRECOMPILED_HEADERS": "ON",
|
||||||
|
"USE_SYSTEM_ZLIB": "OFF",
|
||||||
|
"USE_NATIVE_INSTRUCTIONS": "ON",
|
||||||
|
"BUILD_LLVM": "ON",
|
||||||
|
"STATIC_LINK_LLVM": "ON"
|
||||||
|
},
|
||||||
|
"vendor": {
|
||||||
|
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||||
|
"hostOS": [
|
||||||
|
"Windows"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -725,7 +725,7 @@ namespace CRCPP
|
|||||||
{
|
{
|
||||||
while (size--)
|
while (size--)
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
|
#ifdef _MSC_VER
|
||||||
// Disable warning about data loss when doing (remainder >> CHAR_BIT) when
|
// Disable warning about data loss when doing (remainder >> CHAR_BIT) when
|
||||||
// remainder is one byte long. The algorithm is still correct in this case,
|
// remainder is one byte long. The algorithm is still correct in this case,
|
||||||
// though it's possible that one additional machine instruction will be executed.
|
// though it's possible that one additional machine instruction will be executed.
|
||||||
@ -733,7 +733,7 @@ namespace CRCPP
|
|||||||
# pragma warning (disable : 4333)
|
# pragma warning (disable : 4333)
|
||||||
#endif
|
#endif
|
||||||
remainder = (remainder >> CHAR_BIT) ^ lookupTable[static_cast<unsigned char>(remainder ^ *current++)];
|
remainder = (remainder >> CHAR_BIT) ^ lookupTable[static_cast<unsigned char>(remainder ^ *current++)];
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
|
#ifdef _MSC_VER
|
||||||
# pragma warning (pop)
|
# pragma warning (pop)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -225,9 +225,9 @@ namespace fs
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] stat_t file_base::stat()
|
[[noreturn]] stat_t file_base::get_stat()
|
||||||
{
|
{
|
||||||
fmt::throw_exception("fs::file::stat() not supported.");
|
fmt::throw_exception("fs::file::get_stat() not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_base::sync()
|
void file_base::sync()
|
||||||
@ -1131,7 +1131,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||||||
CloseHandle(m_handle);
|
CloseHandle(m_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
stat_t stat() override
|
stat_t get_stat() override
|
||||||
{
|
{
|
||||||
FILE_BASIC_INFO basic_info;
|
FILE_BASIC_INFO basic_info;
|
||||||
ensure(GetFileInformationByHandleEx(m_handle, FileBasicInfo, &basic_info, sizeof(FILE_BASIC_INFO))); // "file::stat"
|
ensure(GetFileInformationByHandleEx(m_handle, FileBasicInfo, &basic_info, sizeof(FILE_BASIC_INFO))); // "file::stat"
|
||||||
@ -1356,7 +1356,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||||||
::close(m_fd);
|
::close(m_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
stat_t stat() override
|
stat_t get_stat() override
|
||||||
{
|
{
|
||||||
struct ::stat file_info;
|
struct ::stat file_info;
|
||||||
ensure(::fstat(m_fd, &file_info) == 0); // "file::stat"
|
ensure(::fstat(m_fd, &file_info) == 0); // "file::stat"
|
||||||
@ -1506,7 +1506,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||||||
|
|
||||||
m_file = std::make_unique<unix_file>(fd);
|
m_file = std::make_unique<unix_file>(fd);
|
||||||
|
|
||||||
if (mode & fs::isfile && !(mode & fs::write) && stat().is_directory)
|
if (mode & fs::isfile && !(mode & fs::write) && get_stat().is_directory)
|
||||||
{
|
{
|
||||||
m_file.reset();
|
m_file.reset();
|
||||||
g_tls_error = error::isdir;
|
g_tls_error = error::isdir;
|
||||||
@ -1657,7 +1657,7 @@ bool fs::dir::open(const std::string& path)
|
|||||||
to_utf8(info.name, found.cFileName);
|
to_utf8(info.name, found.cFileName);
|
||||||
info.is_directory = (found.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
info.is_directory = (found.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||||
info.is_writable = (found.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0;
|
info.is_writable = (found.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0;
|
||||||
info.size = ((u64)found.nFileSizeHigh << 32) | (u64)found.nFileSizeLow;
|
info.size = (static_cast<u64>(found.nFileSizeHigh) << 32) | static_cast<u64>(found.nFileSizeLow);
|
||||||
info.atime = to_time(found.ftLastAccessTime);
|
info.atime = to_time(found.ftLastAccessTime);
|
||||||
info.mtime = to_time(found.ftLastWriteTime);
|
info.mtime = to_time(found.ftLastWriteTime);
|
||||||
info.ctime = info.mtime;
|
info.ctime = info.mtime;
|
||||||
@ -2002,13 +2002,13 @@ fs::file fs::make_gather(std::vector<fs::file> files)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::stat_t stat() override
|
fs::stat_t get_stat() override
|
||||||
{
|
{
|
||||||
fs::stat_t result{};
|
fs::stat_t result{};
|
||||||
|
|
||||||
if (!files.empty())
|
if (!files.empty())
|
||||||
{
|
{
|
||||||
result = files[0].stat();
|
result = files[0].get_stat();
|
||||||
}
|
}
|
||||||
|
|
||||||
result.is_directory = false;
|
result.is_directory = false;
|
||||||
|
@ -89,7 +89,7 @@ namespace fs
|
|||||||
{
|
{
|
||||||
virtual ~file_base();
|
virtual ~file_base();
|
||||||
|
|
||||||
[[noreturn]] virtual stat_t stat();
|
[[noreturn]] virtual stat_t get_stat();
|
||||||
virtual void sync();
|
virtual void sync();
|
||||||
virtual bool trunc(u64 length) = 0;
|
virtual bool trunc(u64 length) = 0;
|
||||||
virtual u64 read(void* buffer, u64 size) = 0;
|
virtual u64 read(void* buffer, u64 size) = 0;
|
||||||
@ -273,14 +273,14 @@ namespace fs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file information
|
// Get file information
|
||||||
stat_t stat(
|
stat_t get_stat(
|
||||||
u32 line = __builtin_LINE(),
|
u32 line = __builtin_LINE(),
|
||||||
u32 col = __builtin_COLUMN(),
|
u32 col = __builtin_COLUMN(),
|
||||||
const char* file = __builtin_FILE(),
|
const char* file = __builtin_FILE(),
|
||||||
const char* func = __builtin_FUNCTION()) const
|
const char* func = __builtin_FUNCTION()) const
|
||||||
{
|
{
|
||||||
if (!m_file) xnull({line, col, file, func});
|
if (!m_file) xnull({line, col, file, func});
|
||||||
return m_file->stat();
|
return m_file->get_stat();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync file buffers
|
// Sync file buffers
|
||||||
@ -814,7 +814,7 @@ namespace fs
|
|||||||
return obj.size();
|
return obj.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
stat_t stat() override
|
stat_t get_stat() override
|
||||||
{
|
{
|
||||||
return m_stat;
|
return m_stat;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ std::string fmt::win_error_to_string(unsigned long error, void* module_handle)
|
|||||||
std::string message;
|
std::string message;
|
||||||
LPWSTR message_buffer = nullptr;
|
LPWSTR message_buffer = nullptr;
|
||||||
if (FormatMessageW((module_handle ? FORMAT_MESSAGE_FROM_HMODULE : FORMAT_MESSAGE_FROM_SYSTEM) | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
|
if (FormatMessageW((module_handle ? FORMAT_MESSAGE_FROM_HMODULE : FORMAT_MESSAGE_FROM_SYSTEM) | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
module_handle, error, 0, (LPWSTR)&message_buffer, 0, nullptr))
|
module_handle, error, 0, reinterpret_cast<LPWSTR>(&message_buffer), 0, nullptr))
|
||||||
{
|
{
|
||||||
message = fmt::format("%s (0x%x)", fmt::trim(wchar_to_utf8(message_buffer), " \t\n\r\f\v"), error);
|
message = fmt::format("%s (0x%x)", fmt::trim(wchar_to_utf8(message_buffer), " \t\n\r\f\v"), error);
|
||||||
}
|
}
|
||||||
|
@ -1828,15 +1828,15 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
|
|||||||
const bool s_exception_handler_set = []() -> bool
|
const bool s_exception_handler_set = []() -> bool
|
||||||
{
|
{
|
||||||
#ifdef USE_ASAN
|
#ifdef USE_ASAN
|
||||||
if (!AddVectoredExceptionHandler(FALSE, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
|
if (!AddVectoredExceptionHandler(FALSE, static_cast<PVECTORED_EXCEPTION_HANDLER>(exception_handler)))
|
||||||
#else
|
#else
|
||||||
if (!AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
|
if (!AddVectoredExceptionHandler(1, static_cast<PVECTORED_EXCEPTION_HANDLER>(exception_handler)))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
report_fatal_error("AddVectoredExceptionHandler() failed.");
|
report_fatal_error("AddVectoredExceptionHandler() failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exception_filter))
|
if (!SetUnhandledExceptionFilter(static_cast<LPTOP_LEVEL_EXCEPTION_FILTER>(exception_filter)))
|
||||||
{
|
{
|
||||||
report_fatal_error("SetUnhandledExceptionFilter() failed.");
|
report_fatal_error("SetUnhandledExceptionFilter() failed.");
|
||||||
}
|
}
|
||||||
@ -2042,7 +2042,7 @@ void thread_base::start()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_thread = ::_beginthreadex(nullptr, 0, entry_point, this, CREATE_SUSPENDED, nullptr);
|
m_thread = ::_beginthreadex(nullptr, 0, entry_point, this, CREATE_SUSPENDED, nullptr);
|
||||||
ensure(m_thread);
|
ensure(m_thread);
|
||||||
ensure(::ResumeThread(reinterpret_cast<HANDLE>(+m_thread)) != -1);
|
ensure(::ResumeThread(reinterpret_cast<HANDLE>(+m_thread)) != static_cast<DWORD>(-1));
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
pthread_attr_t stack_size_attr;
|
pthread_attr_t stack_size_attr;
|
||||||
pthread_attr_init(&stack_size_attr);
|
pthread_attr_init(&stack_size_attr);
|
||||||
@ -2150,7 +2150,7 @@ u64 thread_base::finalize(thread_state result_state) noexcept
|
|||||||
tls_cycles += cycles;
|
tls_cycles += cycles;
|
||||||
FILETIME ctime, etime, ktime, utime;
|
FILETIME ctime, etime, ktime, utime;
|
||||||
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
|
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
|
||||||
const u64 time = ((ktime.dwLowDateTime | (u64)ktime.dwHighDateTime << 32) + (utime.dwLowDateTime | (u64)utime.dwHighDateTime << 32)) * 100ull - tls_time;
|
const u64 time = ((ktime.dwLowDateTime | static_cast<u64>(ktime.dwHighDateTime) << 32) + (utime.dwLowDateTime | static_cast<u64>(utime.dwHighDateTime) << 32)) * 100ull - tls_time;
|
||||||
tls_time += time;
|
tls_time += time;
|
||||||
const u64 fsoft = 0;
|
const u64 fsoft = 0;
|
||||||
const u64 fhard = 0;
|
const u64 fhard = 0;
|
||||||
|
@ -73,12 +73,12 @@ namespace utils
|
|||||||
std::vector<std::string> get_backtrace_symbols(const std::vector<void*>& stack)
|
std::vector<std::string> get_backtrace_symbols(const std::vector<void*>& stack)
|
||||||
{
|
{
|
||||||
std::vector<std::string> result = {};
|
std::vector<std::string> result = {};
|
||||||
std::vector<u8> symbol_buf(sizeof(SYMBOL_INFO) + sizeof(TCHAR) * 256);
|
std::vector<u8> symbol_buf(sizeof(SYMBOL_INFOW) + sizeof(TCHAR) * 256);
|
||||||
|
|
||||||
const auto hProcess = ::GetCurrentProcess();
|
const auto hProcess = ::GetCurrentProcess();
|
||||||
|
|
||||||
auto sym = reinterpret_cast<SYMBOL_INFO*>(symbol_buf.data());
|
auto sym = reinterpret_cast<SYMBOL_INFOW*>(symbol_buf.data());
|
||||||
sym->SizeOfStruct = sizeof(SYMBOL_INFO);
|
sym->SizeOfStruct = sizeof(SYMBOL_INFOW);
|
||||||
sym->MaxNameLen = 256;
|
sym->MaxNameLen = 256;
|
||||||
|
|
||||||
IMAGEHLP_LINEW64 line_info{};
|
IMAGEHLP_LINEW64 line_info{};
|
||||||
@ -90,7 +90,7 @@ namespace utils
|
|||||||
for (const auto& pointer : stack)
|
for (const auto& pointer : stack)
|
||||||
{
|
{
|
||||||
DWORD64 unused;
|
DWORD64 unused;
|
||||||
SymFromAddr(hProcess, reinterpret_cast<DWORD64>(pointer), &unused, sym);
|
SymFromAddrW(hProcess, reinterpret_cast<DWORD64>(pointer), &unused, sym);
|
||||||
|
|
||||||
if (sym->NameLen)
|
if (sym->NameLen)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ namespace utils
|
|||||||
|
|
||||||
// Attempt to get file and line information if available
|
// Attempt to get file and line information if available
|
||||||
DWORD unused2;
|
DWORD unused2;
|
||||||
if (SymGetLineFromAddrW(hProcess, reinterpret_cast<DWORD64>(pointer), &unused2, &line_info))
|
if (SymGetLineFromAddrW64(hProcess, reinterpret_cast<DWORD64>(pointer), &unused2, &line_info))
|
||||||
{
|
{
|
||||||
const auto full_path = fmt::format("%s:%u %s", wstr_to_utf8(line_info.FileName, -1), line_info.LineNumber, function_name);
|
const auto full_path = fmt::format("%s:%u %s", wstr_to_utf8(line_info.FileName, -1), line_info.LineNumber, function_name);
|
||||||
result.push_back(full_path);
|
result.push_back(full_path);
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
# Check and configure compiler options for RPCS3
|
# Check and configure compiler options for RPCS3
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew- /constexpr:steps16777216 /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1")
|
add_compile_options(/Zc:throwingNew- /constexpr:steps16777216)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D NOMINMAX /D _ENABLE_EXTENDED_ALIGNED_STORAGE=1 /D _HAS_EXCEPTIONS=0")
|
add_compile_definitions(
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED")
|
_CRT_SECURE_NO_DEPRECATE=1 _CRT_NON_CONFORMING_SWPRINTFS=1 _SCL_SECURE_NO_WARNINGS=1
|
||||||
|
NOMINMAX _ENABLE_EXTENDED_ALIGNED_STORAGE=1 _HAS_EXCEPTIONS=0)
|
||||||
|
add_link_options(/DYNAMICBASE:NO /BASE:0x10000 /FIXED)
|
||||||
|
|
||||||
#TODO: Some of these could be cleaned up
|
#TODO: Some of these could be cleaned up
|
||||||
add_compile_options(/wd4805) # Comparing boolean and int
|
add_compile_options(/wd4805) # Comparing boolean and int
|
||||||
@ -12,19 +14,19 @@ if(MSVC)
|
|||||||
add_link_options(/ignore:4281) # Undesirable base address 0x10000
|
add_link_options(/ignore:4281) # Undesirable base address 0x10000
|
||||||
|
|
||||||
# MSVC 2017 uses iterator as base class internally, causing a lot of warning spam
|
# MSVC 2017 uses iterator as base class internally, causing a lot of warning spam
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING=1")
|
add_compile_definitions(_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING=1)
|
||||||
|
|
||||||
# Increase stack limit to 8 MB
|
# Increase stack limit to 8 MB
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608,1048576")
|
add_link_options(/STACK:8388608,1048576)
|
||||||
else()
|
else()
|
||||||
# Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it.
|
# Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it.
|
||||||
CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE)
|
check_cxx_compiler_flag("-no-pie" HAS_NO_PIE)
|
||||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
CHECK_CXX_COMPILER_FLAG("-msse -msse2 -mcx16" COMPILER_X86)
|
check_cxx_compiler_flag("-msse -msse2 -mcx16" COMPILER_X86)
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
CHECK_CXX_COMPILER_FLAG("-march=armv8.4-a" COMPILER_ARM)
|
check_cxx_compiler_flag("-march=armv8.4-a" COMPILER_ARM)
|
||||||
else()
|
else()
|
||||||
CHECK_CXX_COMPILER_FLAG("-march=armv8.1-a" COMPILER_ARM)
|
check_cxx_compiler_flag("-march=armv8.1-a" COMPILER_ARM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_options(-Wall)
|
add_compile_options(-Wall)
|
||||||
@ -65,24 +67,24 @@ else()
|
|||||||
add_compile_options(-Wstrict-aliasing=1)
|
add_compile_options(-Wstrict-aliasing=1)
|
||||||
#add_compile_options(-Wnull-dereference)
|
#add_compile_options(-Wnull-dereference)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_compile_options(-Werror=inconsistent-missing-override)
|
add_compile_options(-Werror=inconsistent-missing-override)
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(-Werror=suggest-override)
|
add_compile_options(-Werror=suggest-override)
|
||||||
add_compile_options(-Wclobbered)
|
add_compile_options(-Wclobbered)
|
||||||
add_compile_options(-Wcast-function-type)
|
# add_compile_options(-Wcast-function-type)
|
||||||
add_compile_options(-Wduplicated-branches)
|
add_compile_options(-Wduplicated-branches)
|
||||||
add_compile_options(-Wduplicated-cond)
|
add_compile_options(-Wduplicated-cond)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#TODO Clean the code so these are removed
|
#TODO Clean the code so these are removed
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_compile_options(-fconstexpr-steps=16777216)
|
add_compile_options(-fconstexpr-steps=16777216)
|
||||||
add_compile_options(-Wno-unused-lambda-capture)
|
add_compile_options(-Wno-unused-lambda-capture)
|
||||||
add_compile_options(-Wno-unused-private-field)
|
add_compile_options(-Wno-unused-private-field)
|
||||||
add_compile_options(-Wno-delete-non-virtual-dtor)
|
add_compile_options(-Wno-delete-non-virtual-dtor)
|
||||||
add_compile_options(-Wno-unused-command-line-argument)
|
add_compile_options(-Wno-unused-command-line-argument)
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(-Wno-class-memaccess)
|
add_compile_options(-Wno-class-memaccess)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -92,10 +94,10 @@ else()
|
|||||||
|
|
||||||
if(NOT APPLE AND NOT WIN32)
|
if(NOT APPLE AND NOT WIN32)
|
||||||
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
|
add_link_options(-Wl,--exclude-libs,ALL)
|
||||||
|
|
||||||
if(HAS_NO_PIE)
|
if(HAS_NO_PIE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
|
add_link_options(-no-pie)
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
@ -103,20 +105,18 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
|
if (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
|
add_link_options(-Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
|
add_link_options(-Wl,-no_pie)
|
||||||
endif()
|
endif()
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set(CMAKE_RC_COMPILER_INIT windres)
|
add_compile_definitions(__STDC_FORMAT_MACROS=1)
|
||||||
enable_language(RC)
|
|
||||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1")
|
|
||||||
|
|
||||||
# Workaround for mingw64 (MSYS2)
|
# Workaround for mingw64 (MSYS2)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
add_link_options(-Wl,--allow-multiple-definition)
|
||||||
|
|
||||||
# Increase stack limit to 8 MB
|
# Increase stack limit to 8 MB
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack -Wl,8388608")
|
add_link_options(-Wl,--stack -Wl,8388608)
|
||||||
|
|
||||||
|
add_link_options(-Wl,--image-base,0x10000)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,4 @@
|
|||||||
|
# Define GNU standard installation directories
|
||||||
if(USE_PRECOMPILED_HEADERS AND NOT COMMAND target_precompile_headers)
|
|
||||||
include(cotire)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Define GNU standard installation directories
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# Generate git-version.h at build time.
|
# Generate git-version.h at build time.
|
||||||
@ -16,10 +11,10 @@ include(CheckFunctionExists)
|
|||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
set(ADDITIONAL_LIBS "")
|
set(ADDITIONAL_LIBS "")
|
||||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
#on some Linux distros shm_unlink and similar functions are in librt only
|
#on some Linux distros shm_unlink and similar functions are in librt only
|
||||||
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "rt")
|
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "rt")
|
||||||
elseif(NOT MSVC AND NOT CMAKE_CXX_FLAGS MATCHES "LIBICONV_PLUG")
|
elseif(NOT WIN32 AND NOT CMAKE_CXX_FLAGS MATCHES "LIBICONV_PLUG")
|
||||||
#it seems like glibc includes the iconv functions we use but other libc
|
#it seems like glibc includes the iconv functions we use but other libc
|
||||||
#implementations like the one on OSX don't seem implement them
|
#implementations like the one on OSX don't seem implement them
|
||||||
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "iconv")
|
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "iconv")
|
||||||
@ -34,13 +29,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT RPCS3_SRC_DIR)
|
|
||||||
set(RPCS3_SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
message("-- Initializing RPCS3_SRC_DIR=${RPCS3_SRC_DIR}")
|
|
||||||
else()
|
|
||||||
message("-- Using Custom RPCS3_SRC_DIR=${RPCS3_SRC_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Qt5
|
# Qt5
|
||||||
# finds Qt libraries and setups custom commands for MOC and UIC
|
# finds Qt libraries and setups custom commands for MOC and UIC
|
||||||
# Must be done here because generated MOC and UIC targets cant
|
# Must be done here because generated MOC and UIC targets cant
|
||||||
@ -51,7 +39,21 @@ include(${CMAKE_SOURCE_DIR}/3rdparty/qt5.cmake)
|
|||||||
add_subdirectory(Emu)
|
add_subdirectory(Emu)
|
||||||
add_subdirectory(rpcs3qt)
|
add_subdirectory(rpcs3qt)
|
||||||
|
|
||||||
set(RPCS3_SRC
|
if(WIN32)
|
||||||
|
add_executable(rpcs3 WIN32)
|
||||||
|
target_sources(rpcs3 PRIVATE rpcs3.rc)
|
||||||
|
elseif(APPLE)
|
||||||
|
add_executable(rpcs3 MACOSX_BUNDLE)
|
||||||
|
target_sources(rpcs3 PRIVATE rpcs3.icns)
|
||||||
|
set_target_properties(rpcs3
|
||||||
|
PROPERTIES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/rpcs3.plist.in")
|
||||||
|
else()
|
||||||
|
add_executable(rpcs3)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_sources(rpcs3
|
||||||
|
PRIVATE
|
||||||
display_sleep_control.cpp
|
display_sleep_control.cpp
|
||||||
headless_application.cpp
|
headless_application.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -75,36 +77,20 @@ set(RPCS3_SRC
|
|||||||
Input/xinput_pad_handler.cpp
|
Input/xinput_pad_handler.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
gen_git_version(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_executable(rpcs3 WIN32 ${RPCS3_SRC})
|
|
||||||
elseif(APPLE)
|
|
||||||
add_executable(rpcs3 MACOSX_BUNDLE ${RPCS3_SRC} "${RPCS3_SRC_DIR}/rpcs3.icns")
|
|
||||||
set_target_properties(rpcs3
|
|
||||||
PROPERTIES
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST "${RPCS3_SRC_DIR}/rpcs3.plist.in")
|
|
||||||
else()
|
|
||||||
add_executable(rpcs3 ${RPCS3_SRC})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
gen_git_version(${RPCS3_SRC_DIR})
|
|
||||||
set_target_properties(rpcs3
|
set_target_properties(rpcs3
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
AUTOUIC ON)
|
AUTOUIC ON)
|
||||||
|
|
||||||
target_link_libraries(rpcs3 rpcs3_emu rpcs3_ui)
|
target_link_libraries(rpcs3 PRIVATE rpcs3_emu rpcs3_ui)
|
||||||
target_link_libraries(rpcs3 3rdparty::discordRPC 3rdparty::qt5 3rdparty::hidapi 3rdparty::libusb 3rdparty::wolfssl 3rdparty::libcurl)
|
target_link_libraries(rpcs3 PRIVATE 3rdparty::discordRPC 3rdparty::qt5 3rdparty::hidapi 3rdparty::libusb 3rdparty::wolfssl 3rdparty::libcurl 3rdparty::zlib)
|
||||||
target_link_libraries(rpcs3 ${ADDITIONAL_LIBS})
|
target_link_libraries(rpcs3 PRIVATE ${ADDITIONAL_LIBS})
|
||||||
|
|
||||||
# Win resource file
|
|
||||||
if(WIN32)
|
|
||||||
target_sources(rpcs3 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/rpcs3.rc")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Unix display manager
|
# Unix display manager
|
||||||
if(X11_FOUND)
|
if(X11_FOUND)
|
||||||
target_include_directories(rpcs3 PUBLIC ${X11_INCLUDE_DIR})
|
target_include_directories(rpcs3 PUBLIC ${X11_INCLUDE_DIR})
|
||||||
target_link_libraries(rpcs3 ${X11_LIBRARIES})
|
target_link_libraries(rpcs3 PRIVATE ${X11_LIBRARIES})
|
||||||
elseif(USE_VULKAN AND UNIX AND NOT WAYLAND_FOUND AND NOT APPLE)
|
elseif(USE_VULKAN AND UNIX AND NOT WAYLAND_FOUND AND NOT APPLE)
|
||||||
# Wayland has been checked in 3rdparty/CMakeLists.txt already.
|
# Wayland has been checked in 3rdparty/CMakeLists.txt already.
|
||||||
message(FATAL_ERROR "RPCS3 requires either X11 or Wayland (or both) for Vulkan.")
|
message(FATAL_ERROR "RPCS3 requires either X11 or Wayland (or both) for Vulkan.")
|
||||||
@ -113,30 +99,26 @@ endif()
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(rpcs3 Threads::Threads)
|
target_link_libraries(rpcs3 PRIVATE Threads::Threads)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(rpcs3 ws2_32.lib Iphlpapi.lib Winmm.lib Psapi.lib gdi32.lib setupapi.lib)
|
target_link_libraries(rpcs3 PRIVATE ws2_32 Iphlpapi Winmm Psapi gdi32 setupapi pdh)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS})
|
target_link_libraries(rpcs3 PRIVATE ${CMAKE_DL_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_PRECOMPILED_HEADERS)
|
if(USE_PRECOMPILED_HEADERS)
|
||||||
if(COMMAND target_precompile_headers)
|
target_precompile_headers(rpcs3 PRIVATE stdafx.h)
|
||||||
target_precompile_headers(rpcs3 PRIVATE "${RPCS3_SRC_DIR}/stdafx.h")
|
|
||||||
else()
|
|
||||||
set_target_properties(rpcs3 PROPERTIES
|
|
||||||
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
|
|
||||||
COTIRE_ADD_UNITY_BUILD OFF)
|
|
||||||
|
|
||||||
cotire(rpcs3)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
||||||
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
||||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
if(APPLE)
|
||||||
|
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
||||||
|
elseif(WIN32)
|
||||||
|
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Copy icons to executable directory
|
# Copy icons to executable directory
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
@ -147,7 +129,7 @@ if(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
add_custom_command(TARGET rpcs3 POST_BUILD
|
add_custom_command(TARGET rpcs3 POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
${RPCS3_SRC_DIR}/rpcs3.icns $<TARGET_FILE_DIR:rpcs3>/../Resources/rpcs3.icns
|
${CMAKE_CURRENT_SOURCE_DIR}/rpcs3.icns $<TARGET_FILE_DIR:rpcs3>/../Resources/rpcs3.icns
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${CMAKE_SOURCE_DIR}/bin/Icons $<TARGET_FILE_DIR:rpcs3>/../Resources/Icons
|
${CMAKE_SOURCE_DIR}/bin/Icons $<TARGET_FILE_DIR:rpcs3>/../Resources/Icons
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
@ -183,18 +165,18 @@ elseif(WIN32)
|
|||||||
# share/cmake/Qt5/ for Qt5_Dir
|
# share/cmake/Qt5/ for Qt5_Dir
|
||||||
|
|
||||||
# If Qt5 is installed from official Qt installer
|
# If Qt5 is installed from official Qt installer
|
||||||
list(APPEND _QT5_TOOLS_PATHS "${Qt5_DIR}/../../../bin/")
|
# list(APPEND _QT5_TOOLS_PATHS "${Qt5_DIR}/../../../bin/")
|
||||||
|
|
||||||
# If Qt5 is installed from vcpkg
|
# If Qt5 is installed from vcpkg
|
||||||
list(APPEND _QT5_TOOLS_PATHS "${Qt5_DIR}/../../../tools/qt5$<$<CONFIG:Debug>:/debug>/bin/")
|
# list(APPEND _QT5_TOOLS_PATHS "${Qt5_DIR}/../../../tools/qt5$<$<CONFIG:Debug>:/debug>/bin/")
|
||||||
|
|
||||||
add_custom_command(TARGET rpcs3 POST_BUILD
|
add_custom_command(TARGET rpcs3 POST_BUILD
|
||||||
COMMAND set PATH=${_QT5_TOOLS_PATHS}$<SEMICOLON>%PATH%
|
# COMMAND set PATH=${_QT5_TOOLS_PATHS}$<SEMICOLON>%PATH%
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_SOURCE_DIR}/bin" "$<TARGET_FILE_DIR:rpcs3>"
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_SOURCE_DIR}/bin" "$<TARGET_FILE_DIR:rpcs3>"
|
||||||
# If Qt5 is installed from vcpkg, add binary path to PATH
|
# If Qt5 is installed from vcpkg, add binary path to PATH
|
||||||
# otherwise windeployqt tool won't be able to locate necessary dlls
|
# otherwise windeployqt tool won't be able to locate necessary dlls
|
||||||
COMMAND set PATH=${Qt5_DIR}/../../../$<$<CONFIG:Debug>:debug/>bin/$<SEMICOLON>%PATH%
|
# COMMAND set PATH=${Qt5_DIR}/../../../$<$<CONFIG:Debug>:debug/>bin/$<SEMICOLON>%PATH%
|
||||||
COMMAND "${_WINDEPLOYQT}" --no-angle --no-compiler-runtime --no-opengl-sw --no-patchqt --no-translations --no-quick --plugindir "$<TARGET_FILE_DIR:rpcs3>/qt/plugins" $<$<CONFIG:Debug>:--debug> $<$<CONFIG:Release>:--release> "$<TARGET_FILE:rpcs3>")
|
COMMAND "${WINDEPLOYQT_EXECUTABLE}" --no-angle --no-compiler-runtime --no-opengl-sw --no-patchqt --no-translations --no-quick --plugindir "$<TARGET_FILE_DIR:rpcs3>/qt/plugins" --verbose 0 "$<TARGET_FILE:rpcs3>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Unix installation
|
# Unix installation
|
||||||
|
@ -95,9 +95,9 @@ public:
|
|||||||
bool ReadHeader();
|
bool ReadHeader();
|
||||||
u64 ReadData(u64 pos, u8* data, u64 size);
|
u64 ReadData(u64 pos, u8* data, u64 size);
|
||||||
|
|
||||||
fs::stat_t stat() override
|
fs::stat_t get_stat() override
|
||||||
{
|
{
|
||||||
fs::stat_t stats = edata_file.stat();
|
fs::stat_t stats = edata_file.get_stat();
|
||||||
stats.is_writable = false; // TODO
|
stats.is_writable = false; // TODO
|
||||||
stats.size = file_size;
|
stats.size = file_size;
|
||||||
return stats;
|
return stats;
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "xaudio2_9redist.lib")
|
#pragma comment(lib, "xaudio2_9redist.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XAUDIO2_USE_DEFAULT_PROCESSOR
|
||||||
|
#define XAUDIO2_USE_DEFAULT_PROCESSOR XAUDIO2_DEFAULT_PROCESSOR
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_CHANNEL(XAudio);
|
LOG_CHANNEL(XAudio);
|
||||||
|
|
||||||
@ -26,6 +32,7 @@ void fmt_class_string<ERole>::format(std::string& out, u64 arg)
|
|||||||
case eConsole: return "eConsole";
|
case eConsole: return "eConsole";
|
||||||
case eMultimedia: return "eMultimedia";
|
case eMultimedia: return "eMultimedia";
|
||||||
case eCommunications: return "eCommunications";
|
case eCommunications: return "eCommunications";
|
||||||
|
case ERole_enum_count: return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
return unknown;
|
return unknown;
|
||||||
@ -42,6 +49,7 @@ void fmt_class_string<EDataFlow>::format(std::string& out, u64 arg)
|
|||||||
case eRender: return "eRender";
|
case eRender: return "eRender";
|
||||||
case eCapture: return "eCapture";
|
case eCapture: return "eCapture";
|
||||||
case eAll: return "eAll";
|
case eAll: return "eAll";
|
||||||
|
case EDataFlow_enum_count: return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
return unknown;
|
return unknown;
|
||||||
@ -309,9 +317,12 @@ f64 XAudio2Backend::GetCallbackFrameLen()
|
|||||||
return _10ms;
|
return _10ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _MSC_VER
|
||||||
Microsoft::WRL::ComPtr<IXAudio2Extension> xaudio_ext{};
|
Microsoft::WRL::ComPtr<IXAudio2Extension> xaudio_ext{};
|
||||||
|
#endif
|
||||||
f64 min_latency{};
|
f64 min_latency{};
|
||||||
|
|
||||||
|
#if _MSC_VER
|
||||||
if (HRESULT hr = m_xaudio2_instance->QueryInterface(IID_IXAudio2Extension, std::bit_cast<void**>(xaudio_ext.GetAddressOf())); FAILED(hr))
|
if (HRESULT hr = m_xaudio2_instance->QueryInterface(IID_IXAudio2Extension, std::bit_cast<void**>(xaudio_ext.GetAddressOf())); FAILED(hr))
|
||||||
{
|
{
|
||||||
XAudio.error("QueryInterface() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
XAudio.error("QueryInterface() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||||
@ -326,6 +337,7 @@ f64 XAudio2Backend::GetCallbackFrameLen()
|
|||||||
min_latency = static_cast<f64>(samples_per_q) / freq;
|
min_latency = static_cast<f64>(samples_per_q) / freq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return std::max<f64>(min_latency, _10ms); // 10ms is the minimum for XAudio
|
return std::max<f64>(min_latency, _10ms); // 10ms is the minimum for XAudio
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,11 @@
|
|||||||
#include "Utilities/mutex.h"
|
#include "Utilities/mutex.h"
|
||||||
#include "Emu/Audio/AudioBackend.h"
|
#include "Emu/Audio/AudioBackend.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#include <xaudio2redist.h>
|
#include <xaudio2redist.h>
|
||||||
|
#else
|
||||||
|
#include <xaudio2.h>
|
||||||
|
#endif
|
||||||
#include <wrl/client.h>
|
#include <wrl/client.h>
|
||||||
#include <MMDeviceAPI.h>
|
#include <MMDeviceAPI.h>
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
#endif
|
#endif
|
||||||
#include "SoundTouch.h"
|
#include "SoundTouch.h"
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
add_library(rpcs3_emu
|
add_library(rpcs3_emu STATIC
|
||||||
cache_utils.cpp
|
cache_utils.cpp
|
||||||
games_config.cpp
|
games_config.cpp
|
||||||
IdManager.cpp
|
IdManager.cpp
|
||||||
@ -19,8 +19,9 @@ add_library(rpcs3_emu
|
|||||||
IPC_socket.cpp
|
IPC_socket.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# prevent WolfSSL from warning about not having harden options
|
if(USE_ASAN)
|
||||||
add_compile_definitions(WC_NO_HARDEN)
|
set_source_files_properties(../../Utilities/Thread.cpp PROPERTIES COMPILE_DEFINITIONS USE_ASAN)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(rpcs3_emu
|
target_link_libraries(rpcs3_emu
|
||||||
PRIVATE
|
PRIVATE
|
||||||
@ -36,7 +37,7 @@ target_link_libraries(rpcs3_emu
|
|||||||
# For stdafx.h
|
# For stdafx.h
|
||||||
target_include_directories(rpcs3_emu
|
target_include_directories(rpcs3_emu
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${RPCS3_SRC_DIR})
|
${PROJECT_SOURCE_DIR}/rpcs3)
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
target_sources(rpcs3_emu PRIVATE
|
target_sources(rpcs3_emu PRIVATE
|
||||||
@ -78,15 +79,27 @@ target_link_libraries(rpcs3_emu
|
|||||||
3rdparty::pugixml)
|
3rdparty::pugixml)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS /GR-)
|
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES
|
||||||
|
COMPILE_FLAGS /GR-
|
||||||
|
SKIP_PRECOMPILE_HEADERS ON
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS -fno-rtti)
|
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES
|
||||||
|
COMPILE_FLAGS -fno-rtti
|
||||||
|
SKIP_PRECOMPILE_HEADERS ON
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_source_files_properties("../util/yaml.cpp" PROPERTIES COMPILE_FLAGS /EHsc)
|
set_source_files_properties("../util/yaml.cpp" PROPERTIES
|
||||||
|
COMPILE_FLAGS /EHsc
|
||||||
|
SKIP_PRECOMPILE_HEADERS ON
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
set_source_files_properties("../util/yaml.cpp" PROPERTIES COMPILE_FLAGS -fexceptions)
|
set_source_files_properties("../util/yaml.cpp" PROPERTIES
|
||||||
|
COMPILE_FLAGS -fexceptions
|
||||||
|
SKIP_PRECOMPILE_HEADERS ON
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Crypto
|
# Crypto
|
||||||
@ -139,9 +152,13 @@ if(USE_FAUDIO)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_include_directories(rpcs3_emu PUBLIC "${RPCS3_SRC_DIR}/../3rdparty/XAudio2Redist/include")
|
target_include_directories(rpcs3_emu PUBLIC "${PROJECT_SOURCE_DIR}/3rdparty/XAudio2Redist/include")
|
||||||
target_link_libraries(rpcs3_emu PRIVATE "${RPCS3_SRC_DIR}/../3rdparty/XAudio2Redist/libs/xaudio2_9redist.lib")
|
if(MSVC)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:xaudio2_9redist.dll")
|
target_link_libraries(rpcs3_emu PRIVATE "${PROJECT_SOURCE_DIR}/3rdparty/XAudio2Redist/libs/xaudio2_9redist.lib")
|
||||||
|
target_link_options(rpcs3_emu PRIVATE /DELAYLOAD:xaudio2_9redist.dll)
|
||||||
|
else()
|
||||||
|
target_link_libraries(rpcs3_emu PRIVATE xaudio2_8)
|
||||||
|
endif()
|
||||||
target_sources(rpcs3_emu PRIVATE
|
target_sources(rpcs3_emu PRIVATE
|
||||||
Audio/XAudio2/XAudio2Backend.cpp
|
Audio/XAudio2/XAudio2Backend.cpp
|
||||||
Audio/XAudio2/xaudio2_enumerator.cpp
|
Audio/XAudio2/xaudio2_enumerator.cpp
|
||||||
@ -366,7 +383,10 @@ target_sources(rpcs3_emu PRIVATE
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
set_source_files_properties(Cell/PPUTranslator.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
|
set_source_files_properties(Cell/PPUTranslator.cpp PROPERTIES
|
||||||
|
COMPILE_FLAGS -fno-rtti
|
||||||
|
SKIP_PRECOMPILE_HEADERS ON
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(rpcs3_emu
|
target_link_libraries(rpcs3_emu
|
||||||
@ -576,23 +596,12 @@ target_link_libraries(rpcs3_emu
|
|||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
||||||
if (${HAVE_CLOCK_GETTIME})
|
if (HAVE_CLOCK_GETTIME)
|
||||||
target_compile_definitions(rpcs3_emu PUBLIC -DHAVE_CLOCK_GETTIME)
|
target_compile_definitions(rpcs3_emu PUBLIC -DHAVE_CLOCK_GETTIME)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(USE_PRECOMPILED_HEADERS)
|
if(USE_PRECOMPILED_HEADERS)
|
||||||
if(COMMAND target_precompile_headers)
|
target_precompile_headers(rpcs3_emu PRIVATE "${PROJECT_SOURCE_DIR}/rpcs3/stdafx.h")
|
||||||
target_precompile_headers(rpcs3_emu PRIVATE "${RPCS3_SRC_DIR}/stdafx.h")
|
|
||||||
else()
|
|
||||||
# Setup cotire
|
|
||||||
option(UNITY_BUILD_EMU "Use unity build for rpcs3_emu target" OFF)
|
|
||||||
|
|
||||||
set_target_properties(rpcs3_emu PROPERTIES
|
|
||||||
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
|
|
||||||
COTIRE_ADD_UNITY_BUILD ${UNITY_BUILD_EMU})
|
|
||||||
|
|
||||||
cotire(rpcs3_emu)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "Winhttp.lib")
|
#pragma comment(lib, "Winhttp.lib")
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_CHANNEL(cellHttpUtil);
|
LOG_CHANNEL(cellHttpUtil);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
typedef int HostCode;
|
typedef int HostCode;
|
||||||
#else
|
#else
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
@ -24,7 +24,7 @@ LOG_CHANNEL(cellL10n);
|
|||||||
// If this makes your compilation fail, try replace the string code with one in "iconv -l"
|
// If this makes your compilation fail, try replace the string code with one in "iconv -l"
|
||||||
bool _L10nCodeParse(s32 code, HostCode& retCode)
|
bool _L10nCodeParse(s32 code, HostCode& retCode)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
retCode = 0;
|
retCode = 0;
|
||||||
if ((code >= _L10N_CODE_) || (code < 0)) return false;
|
if ((code >= _L10N_CODE_) || (code < 0)) return false;
|
||||||
switch (code)
|
switch (code)
|
||||||
@ -161,7 +161,7 @@ bool _L10nCodeParse(s32 code, HostCode& retCode)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
|
|
||||||
// Use code page to transform std::string to std::wstring.
|
// Use code page to transform std::string to std::wstring.
|
||||||
s32 _OEM2Wide(HostCode oem_code, const std::string& src, std::wstring& dst)
|
s32 _OEM2Wide(HostCode oem_code, const std::string& src, std::wstring& dst)
|
||||||
@ -206,7 +206,7 @@ std::string _OemToOem(HostCode src_code, HostCode dst_code, const std::string& s
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *dst, s32 *dst_len, bool allowIncomplete)
|
s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *dst, s32 *dst_len, [[maybe_unused]] bool allowIncomplete)
|
||||||
{
|
{
|
||||||
HostCode srcCode = 0, dstCode = 0; //OEM code pages
|
HostCode srcCode = 0, dstCode = 0; //OEM code pages
|
||||||
bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list.
|
bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list.
|
||||||
@ -216,13 +216,13 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
|
|||||||
|| ((!dst_page_converted) && (dstCode == 0)))
|
|| ((!dst_page_converted) && (dstCode == 0)))
|
||||||
return ConverterUnknown;
|
return ConverterUnknown;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
const std::string wrapped_source = std::string(static_cast<const char *>(src), src_len);
|
const std::string wrapped_source = std::string(static_cast<const char *>(src), src_len);
|
||||||
const std::string target = _OemToOem(srcCode, dstCode, wrapped_source);
|
const std::string target = _OemToOem(srcCode, dstCode, wrapped_source);
|
||||||
|
|
||||||
if (dst != nullptr)
|
if (dst != nullptr)
|
||||||
{
|
{
|
||||||
if (target.length() > *dst_len) return DSTExhausted;
|
if (target.length() > static_cast<usz>(*dst_len)) return DSTExhausted;
|
||||||
memcpy(dst, target.c_str(), target.length());
|
memcpy(dst, target.c_str(), target.length());
|
||||||
}
|
}
|
||||||
*dst_len = ::narrow<s32>(target.size());
|
*dst_len = ::narrow<s32>(target.size());
|
||||||
|
@ -3077,9 +3077,9 @@ namespace
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::stat_t stat() override
|
fs::stat_t get_stat() override
|
||||||
{
|
{
|
||||||
return m_file.stat();
|
return m_file.get_stat();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool trunc(u64) override
|
bool trunc(u64) override
|
||||||
|
@ -1551,7 +1551,8 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst)
|
|||||||
|
|
||||||
spu_function_t spu_runtime::find(const u32* ls, u32 addr) const
|
spu_function_t spu_runtime::find(const u32* ls, u32 addr) const
|
||||||
{
|
{
|
||||||
for (auto& item : ::at32(m_stuff, ls[addr / 4] >> 12))
|
const u32 index = ls[addr / 4] >> 12;
|
||||||
|
for (const auto& item : ::at32(m_stuff, index))
|
||||||
{
|
{
|
||||||
if (const auto ptr = item.compiled.load())
|
if (const auto ptr = item.compiled.load())
|
||||||
{
|
{
|
||||||
|
@ -499,8 +499,8 @@ void lv2_file::save(utils::serial& ar)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::stat_t test_s = test.stat();
|
fs::stat_t test_s = test.get_stat();
|
||||||
fs::stat_t file_s = file.stat();
|
fs::stat_t file_s = file.get_stat();
|
||||||
|
|
||||||
// They don't matter for comparison and only create problems with encrypted files
|
// They don't matter for comparison and only create problems with encrypted files
|
||||||
test_s.is_writable = file_s.is_writable;
|
test_s.is_writable = file_s.is_writable;
|
||||||
@ -518,7 +518,7 @@ void lv2_file::save(utils::serial& ar)
|
|||||||
if (in_mem)
|
if (in_mem)
|
||||||
{
|
{
|
||||||
ar(file.to_vector<u8>());
|
ar(file.to_vector<u8>());
|
||||||
ar(file.stat());
|
ar(file.get_stat());
|
||||||
}
|
}
|
||||||
|
|
||||||
ar(file.pos());
|
ar(file.pos());
|
||||||
@ -589,9 +589,9 @@ struct lv2_file::file_view : fs::file_base
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::stat_t stat() override
|
fs::stat_t get_stat() override
|
||||||
{
|
{
|
||||||
return m_file->file.stat();
|
return m_file->file.get_stat();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool trunc(u64) override
|
bool trunc(u64) override
|
||||||
@ -1567,7 +1567,7 @@ error_code sys_fs_fstat(ppu_thread& ppu, u32 fd, vm::ptr<CellFsStat> sb)
|
|||||||
return CELL_EIO;
|
return CELL_EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fs::stat_t info = file->file.stat();
|
const fs::stat_t info = file->file.get_stat();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
ppu.check_state();
|
ppu.check_state();
|
||||||
|
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
#include "lv2_socket_native.h"
|
#include "lv2_socket_native.h"
|
||||||
#include "sys_net_helpers.h"
|
#include "sys_net_helpers.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
constexpr SOCKET invalid_socket = INVALID_SOCKET;
|
||||||
|
#else
|
||||||
|
constexpr int invalid_socket = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_CHANNEL(sys_net);
|
LOG_CHANNEL(sys_net);
|
||||||
|
|
||||||
lv2_socket_native::lv2_socket_native(lv2_socket_family family, lv2_socket_type type, lv2_ip_protocol protocol)
|
lv2_socket_native::lv2_socket_native(lv2_socket_family family, lv2_socket_type type, lv2_ip_protocol protocol)
|
||||||
@ -75,11 +81,7 @@ s32 lv2_socket_native::create_socket()
|
|||||||
|
|
||||||
auto socket_res = ::socket(native_domain, native_type, native_proto);
|
auto socket_res = ::socket(native_domain, native_type, native_proto);
|
||||||
|
|
||||||
#ifdef _WIN32
|
if (socket_res == invalid_socket)
|
||||||
if (socket_res == INVALID_SOCKET)
|
|
||||||
#else
|
|
||||||
if (socket_res == -1)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return -get_last_error(false);
|
return -get_last_error(false);
|
||||||
}
|
}
|
||||||
@ -113,7 +115,7 @@ std::tuple<bool, s32, std::shared_ptr<lv2_socket>, sys_net_sockaddr> lv2_socket_
|
|||||||
|
|
||||||
socket_type native_socket = ::accept(socket, reinterpret_cast<struct sockaddr*>(&native_addr), &native_addrlen);
|
socket_type native_socket = ::accept(socket, reinterpret_cast<struct sockaddr*>(&native_addr), &native_addrlen);
|
||||||
|
|
||||||
if (native_socket != -1)
|
if (native_socket != invalid_socket)
|
||||||
{
|
{
|
||||||
auto newsock = std::make_shared<lv2_socket_native>(family, type, protocol);
|
auto newsock = std::make_shared<lv2_socket_native>(family, type, protocol);
|
||||||
newsock->set_socket(native_socket, family, type, protocol);
|
newsock->set_socket(native_socket, family, type, protocol);
|
||||||
|
@ -2102,7 +2102,7 @@ rsxaudio_periodic_tmr::wait_result rsxaudio_periodic_tmr::wait(const std::functi
|
|||||||
const HANDLE wait_arr[obj_wait_cnt] = { timer_handle, cancel_event };
|
const HANDLE wait_arr[obj_wait_cnt] = { timer_handle, cancel_event };
|
||||||
const auto wait_status = WaitForMultipleObjects(obj_wait_cnt, wait_arr, false, INFINITE);
|
const auto wait_status = WaitForMultipleObjects(obj_wait_cnt, wait_arr, false, INFINITE);
|
||||||
|
|
||||||
if (wait_status == WAIT_FAILED || wait_status >= WAIT_ABANDONED_0 && wait_status < WAIT_ABANDONED_0 + obj_wait_cnt)
|
if (wait_status == WAIT_FAILED || (wait_status >= WAIT_ABANDONED_0 && wait_status < WAIT_ABANDONED_0 + obj_wait_cnt))
|
||||||
{
|
{
|
||||||
tmr_error = true;
|
tmr_error = true;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ const auto s_time_aux_info = []() -> time_aux_info_t
|
|||||||
time_aux_info_t result;
|
time_aux_info_t result;
|
||||||
result.perf_freq = freq.QuadPart;
|
result.perf_freq = freq.QuadPart;
|
||||||
result.start_time = start.QuadPart;
|
result.start_time = start.QuadPart;
|
||||||
result.start_ftime = (ftime.dwLowDateTime | (u64)ftime.dwHighDateTime << 32) - 116444736000000000;
|
result.start_ftime = (ftime.dwLowDateTime | static_cast<u64>(ftime.dwHighDateTime) << 32) - 116444736000000000;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}();
|
}();
|
||||||
|
@ -67,7 +67,7 @@ namespace id_manager
|
|||||||
static constexpr std::pair<u32, u32> invl_range = get_invl_range<T>();
|
static constexpr std::pair<u32, u32> invl_range = get_invl_range<T>();
|
||||||
static constexpr bool uses_lowest_id = get_force_lowest_id<T>();
|
static constexpr bool uses_lowest_id = get_force_lowest_id<T>();
|
||||||
|
|
||||||
static_assert(count && step && u64{step} * (count - 1) + base < u32{umax} + u64{base != 0 ? 1 : 0}, "ID traits: invalid object range");
|
static_assert(u32{count} && u32{step} && u64{step} * (count - 1) + base < u32{umax} + u64{base != 0 ? 1 : 0}, "ID traits: invalid object range");
|
||||||
|
|
||||||
// TODO: Add more conditions
|
// TODO: Add more conditions
|
||||||
static_assert(!invl_range.second || (u64{invl_range.second} + invl_range.first <= 32 /*....*/ ));
|
static_assert(!invl_range.second || (u64{invl_range.second} + invl_range.first <= 32 /*....*/ ));
|
||||||
|
@ -1148,7 +1148,7 @@ namespace vm
|
|||||||
{
|
{
|
||||||
auto fill64 = [](u8* ptr, u64 data, usz count)
|
auto fill64 = [](u8* ptr, u64 data, usz count)
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
__stosq(reinterpret_cast<u64*>(ptr), data, count);
|
__stosq(reinterpret_cast<u64*>(ptr), data, count);
|
||||||
#elif defined(ARCH_X64)
|
#elif defined(ARCH_X64)
|
||||||
__asm__ ("mov %0, %%rdi; mov %1, %%rax; mov %2, %%rcx; rep stosq;"
|
__asm__ ("mov %0, %%rdi; mov %1, %%rax; mov %2, %%rcx; rep stosq;"
|
||||||
|
@ -29,7 +29,14 @@
|
|||||||
|
|
||||||
#include "generated/np2_structs_generated.h"
|
#include "generated/np2_structs_generated.h"
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#endif
|
||||||
#include <wolfssl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
class vec_stream
|
class vec_stream
|
||||||
{
|
{
|
||||||
@ -454,7 +461,11 @@ namespace rpcn
|
|||||||
|
|
||||||
sockaddr_in addr_rpcn{};
|
sockaddr_in addr_rpcn{};
|
||||||
sockaddr_in addr_rpcn_udp{};
|
sockaddr_in addr_rpcn_udp{};
|
||||||
|
#ifdef _WIN32
|
||||||
|
SOCKET sockfd = 0;
|
||||||
|
#else
|
||||||
int sockfd = 0;
|
int sockfd = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
atomic_t<u64> rpcn_request_counter = 0x100000001; // Counter used for commands whose result is not forwarded to NP handler(login, create, sendmessage, etc)
|
atomic_t<u64> rpcn_request_counter = 0x100000001; // Counter used for commands whose result is not forwarded to NP handler(login, create, sendmessage, etc)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "glutils/ring_buffer.h"
|
#include "glutils/ring_buffer.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "opengl32.lib")
|
#pragma comment(lib, "opengl32.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ void gl::init()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, gl##n, gl##n)
|
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, gl##n, gl##n)
|
||||||
#define WGL_PROC(p, n) OPENGL_PROC2(p, wgl##n, wgl##n)
|
#define WGL_PROC(p, n) OPENGL_PROC2(p, wgl##n, wgl##n)
|
||||||
#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = (p)wglGetProcAddress(#tn))) rsx_log.error("OpenGL: initialization of " #tn " failed.")
|
#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = reinterpret_cast<p>(wglGetProcAddress(#tn)))) rsx_log.error("OpenGL: initialization of " #tn " failed.")
|
||||||
#include "GLProcTable.h"
|
#include "GLProcTable.h"
|
||||||
#undef OPENGL_PROC
|
#undef OPENGL_PROC
|
||||||
#undef WGL_PROC
|
#undef WGL_PROC
|
||||||
|
@ -48,6 +48,8 @@ private:
|
|||||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include "3rdparty/GPUOpen/include/vk_mem_alloc.h"
|
#include "3rdparty/GPUOpen/include/vk_mem_alloc.h"
|
||||||
|
@ -129,6 +129,7 @@ void fmt_class_string<game_boot_result>::format(std::string& out, u64 arg)
|
|||||||
case game_boot_result::unsupported_disc_type: return "This disc type is not supported yet";
|
case game_boot_result::unsupported_disc_type: return "This disc type is not supported yet";
|
||||||
case game_boot_result::savestate_corrupted: return "Savestate data is corrupted or it's not an RPCS3 savestate";
|
case game_boot_result::savestate_corrupted: return "Savestate data is corrupted or it's not an RPCS3 savestate";
|
||||||
case game_boot_result::savestate_version_unsupported: return "Savestate versioning data differes from your RPCS3 build";
|
case game_boot_result::savestate_version_unsupported: return "Savestate versioning data differes from your RPCS3 build";
|
||||||
|
case game_boot_result::still_running: return "Game is still running";
|
||||||
}
|
}
|
||||||
return unknown;
|
return unknown;
|
||||||
});
|
});
|
||||||
|
@ -139,7 +139,7 @@ void xinput_pad_handler::SetPadData(const std::string& padId, u8 /*player_id*/,
|
|||||||
vibrate.wLeftMotorSpeed = large_motor * 257; // between 0 to 65535
|
vibrate.wLeftMotorSpeed = large_motor * 257; // between 0 to 65535
|
||||||
vibrate.wRightMotorSpeed = small_motor * 257; // between 0 to 65535
|
vibrate.wRightMotorSpeed = small_motor * 257; // between 0 to 65535
|
||||||
|
|
||||||
(*xinputSetState)(static_cast<u32>(device_number), &vibrate);
|
xinputSetState(static_cast<u32>(device_number), &vibrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 xinput_pad_handler::get_battery_level(const std::string& padId)
|
u32 xinput_pad_handler::get_battery_level(const std::string& padId)
|
||||||
@ -150,7 +150,7 @@ u32 xinput_pad_handler::get_battery_level(const std::string& padId)
|
|||||||
|
|
||||||
// Receive Battery Info. If device is not on cable, get battery level, else assume full.
|
// Receive Battery Info. If device is not on cable, get battery level, else assume full.
|
||||||
XINPUT_BATTERY_INFORMATION battery_info;
|
XINPUT_BATTERY_INFORMATION battery_info;
|
||||||
(*xinputGetBatteryInformation)(device_number, BATTERY_DEVTYPE_GAMEPAD, &battery_info);
|
xinputGetBatteryInformation(device_number, BATTERY_DEVTYPE_GAMEPAD, &battery_info);
|
||||||
|
|
||||||
switch (battery_info.BatteryType)
|
switch (battery_info.BatteryType)
|
||||||
{
|
{
|
||||||
@ -336,6 +336,12 @@ pad_preview_values xinput_pad_handler::get_preview_values(const std::unordered_m
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
T getProc(HMODULE hModule, LPCSTR lpProcName)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<T>(GetProcAddress(hModule, lpProcName));
|
||||||
|
}
|
||||||
|
|
||||||
bool xinput_pad_handler::Init()
|
bool xinput_pad_handler::Init()
|
||||||
{
|
{
|
||||||
if (m_is_init)
|
if (m_is_init)
|
||||||
@ -346,14 +352,14 @@ bool xinput_pad_handler::Init()
|
|||||||
library = LoadLibrary(it);
|
library = LoadLibrary(it);
|
||||||
if (library)
|
if (library)
|
||||||
{
|
{
|
||||||
xinputGetExtended = reinterpret_cast<PFN_XINPUTGETEXTENDED>(GetProcAddress(library, "XInputGetExtended")); // Optional
|
xinputGetExtended = getProc<PFN_XINPUTGETEXTENDED>(library, "XInputGetExtended"); // Optional
|
||||||
xinputGetCustomData = reinterpret_cast<PFN_XINPUTGETCUSTOMDATA>(GetProcAddress(library, "XInputGetCustomData")); // Optional
|
xinputGetCustomData = getProc<PFN_XINPUTGETCUSTOMDATA>(library, "XInputGetCustomData"); // Optional
|
||||||
xinputGetState = reinterpret_cast<PFN_XINPUTGETSTATE>(GetProcAddress(library, reinterpret_cast<LPCSTR>(100)));
|
xinputGetState = getProc<PFN_XINPUTGETSTATE>(library, reinterpret_cast<LPCSTR>(100));
|
||||||
if (!xinputGetState)
|
if (!xinputGetState)
|
||||||
xinputGetState = reinterpret_cast<PFN_XINPUTGETSTATE>(GetProcAddress(library, "XInputGetState"));
|
xinputGetState = getProc<PFN_XINPUTGETSTATE>(library, "XInputGetState");
|
||||||
|
|
||||||
xinputSetState = reinterpret_cast<PFN_XINPUTSETSTATE>(GetProcAddress(library, "XInputSetState"));
|
xinputSetState = getProc<PFN_XINPUTSETSTATE>(library, "XInputSetState");
|
||||||
xinputGetBatteryInformation = reinterpret_cast<PFN_XINPUTGETBATTERYINFORMATION>(GetProcAddress(library, "XInputGetBatteryInformation"));
|
xinputGetBatteryInformation = getProc<PFN_XINPUTGETBATTERYINFORMATION>(library, "XInputGetBatteryInformation");
|
||||||
|
|
||||||
if (xinputGetState && xinputSetState && xinputGetBatteryInformation)
|
if (xinputGetState && xinputSetState && xinputGetBatteryInformation)
|
||||||
{
|
{
|
||||||
@ -496,7 +502,7 @@ void xinput_pad_handler::get_extended_info(const pad_ensemble& binding)
|
|||||||
|
|
||||||
// Receive Battery Info. If device is not on cable, get battery level, else assume full
|
// Receive Battery Info. If device is not on cable, get battery level, else assume full
|
||||||
XINPUT_BATTERY_INFORMATION battery_info;
|
XINPUT_BATTERY_INFORMATION battery_info;
|
||||||
(*xinputGetBatteryInformation)(padnum, BATTERY_DEVTYPE_GAMEPAD, &battery_info);
|
xinputGetBatteryInformation(padnum, BATTERY_DEVTYPE_GAMEPAD, &battery_info);
|
||||||
pad->m_cable_state = battery_info.BatteryType == BATTERY_TYPE_WIRED ? 1 : 0;
|
pad->m_cable_state = battery_info.BatteryType == BATTERY_TYPE_WIRED ? 1 : 0;
|
||||||
pad->m_battery_level = pad->m_cable_state ? BATTERY_LEVEL_FULL : battery_info.BatteryLevel;
|
pad->m_battery_level = pad->m_cable_state ? BATTERY_LEVEL_FULL : battery_info.BatteryLevel;
|
||||||
|
|
||||||
@ -545,7 +551,7 @@ void xinput_pad_handler::apply_pad_data(const pad_ensemble& binding)
|
|||||||
vibrate.wLeftMotorSpeed = speed_large * 257; // between 0 to 65535
|
vibrate.wLeftMotorSpeed = speed_large * 257; // between 0 to 65535
|
||||||
vibrate.wRightMotorSpeed = speed_small * 257; // between 0 to 65535
|
vibrate.wRightMotorSpeed = speed_small * 257; // between 0 to 65535
|
||||||
|
|
||||||
if ((*xinputSetState)(padnum, &vibrate) == ERROR_SUCCESS)
|
if (xinputSetState(padnum, &vibrate) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
dev->newVibrateData = false;
|
dev->newVibrateData = false;
|
||||||
dev->last_vibration = steady_clock::now();
|
dev->last_vibration = steady_clock::now();
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
# prevent WolfSSL from warning about not having harden options
|
add_library(rpcs3_ui STATIC
|
||||||
add_compile_definitions(WC_NO_HARDEN)
|
|
||||||
|
|
||||||
set(SRC_FILES
|
|
||||||
about_dialog.cpp
|
about_dialog.cpp
|
||||||
auto_pause_settings_dialog.cpp
|
auto_pause_settings_dialog.cpp
|
||||||
breakpoint_handler.cpp
|
breakpoint_handler.cpp
|
||||||
@ -109,9 +106,7 @@ set(SRC_FILES
|
|||||||
vfs_dialog_usb_input.cpp
|
vfs_dialog_usb_input.cpp
|
||||||
vfs_dialog_usb_tab.cpp
|
vfs_dialog_usb_tab.cpp
|
||||||
welcome_dialog.cpp
|
welcome_dialog.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set(UI_FILES
|
|
||||||
about_dialog.ui
|
about_dialog.ui
|
||||||
camera_settings_dialog.ui
|
camera_settings_dialog.ui
|
||||||
main_window.ui
|
main_window.ui
|
||||||
@ -123,16 +118,14 @@ set(UI_FILES
|
|||||||
settings_dialog.ui
|
settings_dialog.ui
|
||||||
shortcut_dialog.ui
|
shortcut_dialog.ui
|
||||||
welcome_dialog.ui
|
welcome_dialog.ui
|
||||||
|
|
||||||
|
"../resources.qrc"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RES_FILES "../resources.qrc")
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND RES_FILES "../windows.qrc")
|
target_sources(rpcs3_ui PUBLIC "../windows.qrc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(rpcs3_ui ${SRC_FILES} ${UI_FILES} ${RES_FILES})
|
|
||||||
|
|
||||||
set_target_properties(rpcs3_ui
|
set_target_properties(rpcs3_ui
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
AUTOMOC ON
|
AUTOMOC ON
|
||||||
|
@ -2368,7 +2368,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_dialog::closeEvent(QCloseEvent* event)
|
void settings_dialog::closeEvent([[maybe_unused]] QCloseEvent* event)
|
||||||
{
|
{
|
||||||
m_gui_settings->SetValue(gui::cfg_geometry, saveGeometry());
|
m_gui_settings->SetValue(gui::cfg_geometry, saveGeometry());
|
||||||
m_gui_settings->sync();
|
m_gui_settings->sync();
|
||||||
|
@ -150,7 +150,7 @@ namespace gui::utils
|
|||||||
return return_value;
|
return return_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
res = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&pShellLink);
|
res = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pShellLink));
|
||||||
if (FAILED(res))
|
if (FAILED(res))
|
||||||
return cleanup(false, "CoCreateInstance failed");
|
return cleanup(false, "CoCreateInstance failed");
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ namespace gui::utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use the IPersistFile object to save the shell link
|
// Use the IPersistFile object to save the shell link
|
||||||
res = pShellLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile);
|
res = pShellLink->QueryInterface(IID_PPV_ARGS(&pPersistFile));
|
||||||
if (FAILED(res))
|
if (FAILED(res))
|
||||||
return cleanup(false, fmt::format("QueryInterface failed (%s)", str_error(res)));
|
return cleanup(false, fmt::format("QueryInterface failed (%s)", str_error(res)));
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@
|
|||||||
#include <7zCrc.h>
|
#include <7zCrc.h>
|
||||||
#include <7zFile.h>
|
#include <7zFile.h>
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX MAX_PATH
|
#define PATH_MAX MAX_PATH
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
#include "util/atomic.hpp"
|
#include "util/atomic.hpp"
|
||||||
#include "util/endian.hpp"
|
#include "util/endian.hpp"
|
||||||
|
#include "Utilities/Config.h"
|
||||||
#include "Utilities/StrFmt.h"
|
#include "Utilities/StrFmt.h"
|
||||||
#include "Utilities/File.h"
|
#include "Utilities/File.h"
|
||||||
#include "util/logs.hpp"
|
#include "util/logs.hpp"
|
||||||
|
@ -8,6 +8,7 @@ extern bool g_use_rtm;
|
|||||||
extern u64 g_rtm_tx_limit1;
|
extern u64 g_rtm_tx_limit1;
|
||||||
|
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
|
#ifdef _MSC_VER
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
u32 _xbegin();
|
u32 _xbegin();
|
||||||
@ -18,8 +19,6 @@ extern "C"
|
|||||||
|
|
||||||
uchar _rotl8(uchar, uchar);
|
uchar _rotl8(uchar, uchar);
|
||||||
ushort _rotl16(ushort, uchar);
|
ushort _rotl16(ushort, uchar);
|
||||||
uint _rotl(uint, int);
|
|
||||||
u64 _rotl64(u64, int);
|
|
||||||
u64 __popcnt64(u64);
|
u64 __popcnt64(u64);
|
||||||
|
|
||||||
s64 __mulh(s64, s64);
|
s64 __mulh(s64, s64);
|
||||||
@ -29,6 +28,10 @@ extern "C"
|
|||||||
u64 _udiv128(u64, u64, u64, u64*);
|
u64 _udiv128(u64, u64, u64, u64*);
|
||||||
void __debugbreak();
|
void __debugbreak();
|
||||||
}
|
}
|
||||||
|
#include <intrin.h>
|
||||||
|
#else
|
||||||
|
#include <immintrin.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
@ -47,7 +50,7 @@ namespace utils
|
|||||||
#else
|
#else
|
||||||
status = _xbegin();
|
status = _xbegin();
|
||||||
|
|
||||||
if (status != umax) [[unlikely]]
|
if (status != _XBEGIN_STARTED) [[unlikely]]
|
||||||
{
|
{
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
@ -138,7 +141,7 @@ namespace utils
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && !defined(__clang__)
|
||||||
return _m_prefetchw(ptr);
|
return _m_prefetchw(ptr);
|
||||||
#else
|
#else
|
||||||
return __builtin_prefetch(ptr, 1, 0);
|
return __builtin_prefetch(ptr, 1, 0);
|
||||||
|
@ -4,7 +4,12 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef _M_X64
|
#ifndef _MSC_VER
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4996)
|
#pragma warning(disable: 4996)
|
||||||
|
|
||||||
@ -67,7 +72,7 @@ namespace utils
|
|||||||
|
|
||||||
FORCE_INLINE void atomic_fence_consume()
|
FORCE_INLINE void atomic_fence_consume()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
#else
|
#else
|
||||||
__atomic_thread_fence(__ATOMIC_CONSUME);
|
__atomic_thread_fence(__ATOMIC_CONSUME);
|
||||||
@ -76,7 +81,7 @@ FORCE_INLINE void atomic_fence_consume()
|
|||||||
|
|
||||||
FORCE_INLINE void atomic_fence_acquire()
|
FORCE_INLINE void atomic_fence_acquire()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
#else
|
#else
|
||||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||||
@ -85,7 +90,7 @@ FORCE_INLINE void atomic_fence_acquire()
|
|||||||
|
|
||||||
FORCE_INLINE void atomic_fence_release()
|
FORCE_INLINE void atomic_fence_release()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
#else
|
#else
|
||||||
__atomic_thread_fence(__ATOMIC_RELEASE);
|
__atomic_thread_fence(__ATOMIC_RELEASE);
|
||||||
@ -94,7 +99,7 @@ FORCE_INLINE void atomic_fence_release()
|
|||||||
|
|
||||||
FORCE_INLINE void atomic_fence_acq_rel()
|
FORCE_INLINE void atomic_fence_acq_rel()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
#else
|
#else
|
||||||
__atomic_thread_fence(__ATOMIC_ACQ_REL);
|
__atomic_thread_fence(__ATOMIC_ACQ_REL);
|
||||||
@ -103,7 +108,7 @@ FORCE_INLINE void atomic_fence_acq_rel()
|
|||||||
|
|
||||||
FORCE_INLINE void atomic_fence_seq_cst()
|
FORCE_INLINE void atomic_fence_seq_cst()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
_InterlockedOr(static_cast<long*>(_AddressOfReturnAddress()), 0);
|
_InterlockedOr(static_cast<long*>(_AddressOfReturnAddress()), 0);
|
||||||
_ReadWriteBarrier();
|
_ReadWriteBarrier();
|
||||||
@ -114,7 +119,7 @@ FORCE_INLINE void atomic_fence_seq_cst()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -349,7 +354,7 @@ struct atomic_storage
|
|||||||
|
|
||||||
using type = get_uint_t<sizeof(T)>;
|
using type = get_uint_t<sizeof(T)>;
|
||||||
|
|
||||||
#ifndef _M_X64
|
#if !defined(_MSC_VER) || !defined(_M_X64)
|
||||||
|
|
||||||
#if defined(__ATOMIC_HLE_ACQUIRE) && defined(__ATOMIC_HLE_RELEASE)
|
#if defined(__ATOMIC_HLE_ACQUIRE) && defined(__ATOMIC_HLE_RELEASE)
|
||||||
static constexpr int s_hle_ack = __ATOMIC_SEQ_CST | __ATOMIC_HLE_ACQUIRE;
|
static constexpr int s_hle_ack = __ATOMIC_SEQ_CST | __ATOMIC_HLE_ACQUIRE;
|
||||||
@ -479,7 +484,7 @@ struct atomic_storage
|
|||||||
|
|
||||||
/* Second part: MSVC-specific */
|
/* Second part: MSVC-specific */
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline T add_fetch(T& dest, T value)
|
static inline T add_fetch(T& dest, T value)
|
||||||
{
|
{
|
||||||
return atomic_storage<T>::fetch_add(dest, value) + value;
|
return atomic_storage<T>::fetch_add(dest, value) + value;
|
||||||
@ -549,7 +554,7 @@ struct atomic_storage
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
return _interlockedbittestandset((long*)dst, bit) != 0;
|
return _interlockedbittestandset((long*)dst, bit) != 0;
|
||||||
#elif defined(ARCH_X64)
|
#elif defined(ARCH_X64)
|
||||||
bool result;
|
bool result;
|
||||||
@ -576,7 +581,7 @@ struct atomic_storage
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
return _interlockedbittestandreset((long*)dst, bit) != 0;
|
return _interlockedbittestandreset((long*)dst, bit) != 0;
|
||||||
#elif defined(ARCH_X64)
|
#elif defined(ARCH_X64)
|
||||||
bool result;
|
bool result;
|
||||||
@ -603,7 +608,7 @@ struct atomic_storage
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Keep trying until we actually invert desired bit
|
// Keep trying until we actually invert desired bit
|
||||||
@ -628,7 +633,7 @@ struct atomic_storage
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct atomic_storage<T, 1> : atomic_storage<T, 0>
|
struct atomic_storage<T, 1> : atomic_storage<T, 0>
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
||||||
{
|
{
|
||||||
const char v = std::bit_cast<char>(comp);
|
const char v = std::bit_cast<char>(comp);
|
||||||
@ -698,7 +703,7 @@ struct atomic_storage<T, 1> : atomic_storage<T, 0>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct atomic_storage<T, 2> : atomic_storage<T, 0>
|
struct atomic_storage<T, 2> : atomic_storage<T, 0>
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
||||||
{
|
{
|
||||||
const short v = std::bit_cast<short>(comp);
|
const short v = std::bit_cast<short>(comp);
|
||||||
@ -780,7 +785,7 @@ struct atomic_storage<T, 2> : atomic_storage<T, 0>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct atomic_storage<T, 4> : atomic_storage<T, 0>
|
struct atomic_storage<T, 4> : atomic_storage<T, 0>
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
||||||
{
|
{
|
||||||
const long v = std::bit_cast<long>(comp);
|
const long v = std::bit_cast<long>(comp);
|
||||||
@ -876,7 +881,7 @@ struct atomic_storage<T, 4> : atomic_storage<T, 0>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct atomic_storage<T, 8> : atomic_storage<T, 0>
|
struct atomic_storage<T, 8> : atomic_storage<T, 0>
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
static inline bool compare_exchange(T& dest, T& comp, T exch)
|
||||||
{
|
{
|
||||||
const llong v = std::bit_cast<llong>(comp);
|
const llong v = std::bit_cast<llong>(comp);
|
||||||
@ -972,7 +977,7 @@ struct atomic_storage<T, 8> : atomic_storage<T, 0>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct atomic_storage<T, 16> : atomic_storage<T, 0>
|
struct atomic_storage<T, 16> : atomic_storage<T, 0>
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
static inline T load(const T& dest)
|
static inline T load(const T& dest)
|
||||||
{
|
{
|
||||||
atomic_fence_acquire();
|
atomic_fence_acquire();
|
||||||
@ -1907,4 +1912,5 @@ namespace atomic_wait
|
|||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "tlhelp32.h"
|
#include "tlhelp32.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "pdh.lib")
|
#pragma comment(lib, "pdh.lib")
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include "fstream"
|
#include "fstream"
|
||||||
#include "sstream"
|
#include "sstream"
|
||||||
@ -99,13 +101,13 @@ namespace utils
|
|||||||
void cpu_stats::init_cpu_query()
|
void cpu_stats::init_cpu_query()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
PDH_STATUS status = PdhOpenQuery(NULL, NULL, &m_cpu_query);
|
PDH_STATUS status = PdhOpenQuery(NULL, 0, &m_cpu_query);
|
||||||
if (ERROR_SUCCESS != status)
|
if (ERROR_SUCCESS != status)
|
||||||
{
|
{
|
||||||
perf_log.error("Failed to open cpu query for per core cpu usage: %s", pdh_error(status));
|
perf_log.error("Failed to open cpu query for per core cpu usage: %s", pdh_error(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = PdhAddEnglishCounter(m_cpu_query, L"\\Processor(*)\\% Processor Time", NULL, &m_cpu_cores);
|
status = PdhAddEnglishCounter(m_cpu_query, L"\\Processor(*)\\% Processor Time", 0, &m_cpu_cores);
|
||||||
if (ERROR_SUCCESS != status)
|
if (ERROR_SUCCESS != status)
|
||||||
{
|
{
|
||||||
perf_log.error("Failed to add processor time counter for per core cpu usage: %s", pdh_error(status));
|
perf_log.error("Failed to add processor time counter for per core cpu usage: %s", pdh_error(status));
|
||||||
@ -159,7 +161,7 @@ namespace utils
|
|||||||
DWORD dwItemCount = 0; // Number of items in the items buffer
|
DWORD dwItemCount = 0; // Number of items in the items buffer
|
||||||
|
|
||||||
status = PdhGetFormattedCounterArray(m_cpu_cores, PDH_FMT_DOUBLE, &dwBufferSize, &dwItemCount, nullptr);
|
status = PdhGetFormattedCounterArray(m_cpu_cores, PDH_FMT_DOUBLE, &dwBufferSize, &dwItemCount, nullptr);
|
||||||
if (PDH_MORE_DATA == status)
|
if (static_cast<PDH_STATUS>(PDH_MORE_DATA) == status)
|
||||||
{
|
{
|
||||||
std::vector<PDH_FMT_COUNTERVALUE_ITEM> items(utils::aligned_div(dwBufferSize, sizeof(PDH_FMT_COUNTERVALUE_ITEM)));
|
std::vector<PDH_FMT_COUNTERVALUE_ITEM> items(utils::aligned_div(dwBufferSize, sizeof(PDH_FMT_COUNTERVALUE_ITEM)));
|
||||||
if (items.size() >= dwItemCount)
|
if (items.size() >= dwItemCount)
|
||||||
@ -195,7 +197,7 @@ namespace utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PDH_CALC_NEGATIVE_DENOMINATOR == status) // Apparently this is a common uncritical error
|
else if (static_cast<PDH_STATUS>(PDH_CALC_NEGATIVE_DENOMINATOR) == status) // Apparently this is a common uncritical error
|
||||||
{
|
{
|
||||||
perf_log.notice("Failed to get per core cpu usage: %s", pdh_error(status));
|
perf_log.notice("Failed to get per core cpu usage: %s", pdh_error(status));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
|
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
|
#ifdef _MSC_VER
|
||||||
extern "C" void _mm_lfence();
|
extern "C" void _mm_lfence();
|
||||||
|
#else
|
||||||
|
#include <immintrin.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
|
@ -597,7 +597,7 @@ inline void gv_zeroupper()
|
|||||||
#if defined(ARCH_X64)
|
#if defined(ARCH_X64)
|
||||||
if (!g_use_avx)
|
if (!g_use_avx)
|
||||||
return;
|
return;
|
||||||
#if defined(_M_X64)
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
_mm256_zeroupper();
|
_mm256_zeroupper();
|
||||||
#else
|
#else
|
||||||
__asm__ volatile("vzeroupper;");
|
__asm__ volatile("vzeroupper;");
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "util/asm.hpp"
|
#include "util/asm.hpp"
|
||||||
#include "util/fence.hpp"
|
#include "util/fence.hpp"
|
||||||
|
|
||||||
#ifdef _M_X64
|
#if defined(_M_X64) && defined(_MSC_VER)
|
||||||
extern "C" u64 _xgetbv(u32);
|
extern "C" u64 _xgetbv(u32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -470,8 +470,8 @@ std::string utils::get_OS_version()
|
|||||||
std::vector<char> holder(service_pack.Length + 1, '\0');
|
std::vector<char> holder(service_pack.Length + 1, '\0');
|
||||||
if (has_sp)
|
if (has_sp)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(CP_UTF8, NULL, service_pack.Buffer, service_pack.Length,
|
WideCharToMultiByte(CP_UTF8, 0, service_pack.Buffer, service_pack.Length,
|
||||||
(LPSTR) holder.data(), static_cast<int>(holder.size()), nullptr, nullptr);
|
static_cast<LPSTR>(holder.data()), static_cast<int>(holder.size()), nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::append(output,
|
fmt::append(output,
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
|
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
|
#ifdef _MSC_VER
|
||||||
extern "C" u64 __rdtsc();
|
extern "C" u64 __rdtsc();
|
||||||
|
#else
|
||||||
|
#include <immintrin.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
|
@ -86,12 +86,20 @@ namespace utils
|
|||||||
constexpr int c_mfd_huge_2mb = 0;
|
constexpr int c_mfd_huge_2mb = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MEM_RESERVE_PLACEHOLDER
|
||||||
|
#define MEM_RESERVE_PLACEHOLDER 0x00040000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MEM_REPLACE_PLACEHOLDER
|
||||||
|
#define MEM_REPLACE_PLACEHOLDER 0x00004000
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DYNAMIC_IMPORT("KernelBase.dll", VirtualAlloc2, PVOID(HANDLE Process, PVOID Base, SIZE_T Size, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
|
DYNAMIC_IMPORT("KernelBase.dll", VirtualAlloc2, PVOID(HANDLE Process, PVOID Base, SIZE_T Size, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
|
||||||
DYNAMIC_IMPORT("KernelBase.dll", MapViewOfFile3, PVOID(HANDLE Handle, HANDLE Process, PVOID Base, ULONG64 Off, SIZE_T ViewSize, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
|
DYNAMIC_IMPORT("KernelBase.dll", MapViewOfFile3, PVOID(HANDLE Handle, HANDLE Process, PVOID Base, ULONG64 Off, SIZE_T ViewSize, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
|
||||||
DYNAMIC_IMPORT("KernelBase.dll", UnmapViewOfFile2, BOOL(HANDLE Process, PVOID BaseAddress, ULONG UnmapFlags));
|
DYNAMIC_IMPORT("KernelBase.dll", UnmapViewOfFile2, BOOL(HANDLE Process, PVOID BaseAddress, ULONG UnmapFlags));
|
||||||
|
|
||||||
const bool has_win10_memory_mapping_api()
|
bool has_win10_memory_mapping_api()
|
||||||
{
|
{
|
||||||
return VirtualAlloc2 && MapViewOfFile3 && UnmapViewOfFile2;
|
return VirtualAlloc2 && MapViewOfFile3 && UnmapViewOfFile2;
|
||||||
}
|
}
|
||||||
@ -442,7 +450,7 @@ namespace utils
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* memory_map_fd(native_handle fd, usz size, protection prot)
|
void* memory_map_fd([[maybe_unused]] native_handle fd, [[maybe_unused]] usz size, [[maybe_unused]] protection prot)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// TODO
|
// TODO
|
||||||
@ -591,7 +599,7 @@ namespace utils
|
|||||||
ensure(clean(GetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info))));
|
ensure(clean(GetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info))));
|
||||||
ensure(clean(GetFileSizeEx(h, &_eof.EndOfFile)));
|
ensure(clean(GetFileSizeEx(h, &_eof.EndOfFile)));
|
||||||
|
|
||||||
if (info.AllocationSize.QuadPart && _eof.EndOfFile.QuadPart == m_size)
|
if (info.AllocationSize.QuadPart && _eof.EndOfFile.QuadPart == static_cast<LONGLONG>(m_size))
|
||||||
{
|
{
|
||||||
// Truncate file since it may be dirty (fool-proof)
|
// Truncate file since it may be dirty (fool-proof)
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
@ -604,7 +612,7 @@ namespace utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_eof.EndOfFile.QuadPart != m_size)
|
if (_eof.EndOfFile.QuadPart != static_cast<LONGLONG>(m_size))
|
||||||
{
|
{
|
||||||
// Reset file size to 0 if it doesn't match
|
// Reset file size to 0 if it doesn't match
|
||||||
_eof.EndOfFile.QuadPart = 0;
|
_eof.EndOfFile.QuadPart = 0;
|
||||||
@ -870,7 +878,7 @@ namespace utils
|
|||||||
return {nullptr, fmt::format("VirtualQuery() Unexpceted memory info: state=0x%x, %s", mem.State, std::as_bytes(std::span(&mem, 1)))};
|
return {nullptr, fmt::format("VirtualQuery() Unexpceted memory info: state=0x%x, %s", mem.State, std::as_bytes(std::span(&mem, 1)))};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto base = (u8*)mem.AllocationBase;
|
const auto base = static_cast<u8*>(mem.AllocationBase);
|
||||||
const auto size = mem.RegionSize + (target - base);
|
const auto size = mem.RegionSize + (target - base);
|
||||||
|
|
||||||
if (is_memory_mappping_memory(ptr))
|
if (is_memory_mappping_memory(ptr))
|
||||||
@ -981,7 +989,7 @@ namespace utils
|
|||||||
::MEMORY_BASIC_INFORMATION mem{}, mem2{};
|
::MEMORY_BASIC_INFORMATION mem{}, mem2{};
|
||||||
ensure(::VirtualQuery(target - 1, &mem, sizeof(mem)) && ::VirtualQuery(target + m_size, &mem2, sizeof(mem2)));
|
ensure(::VirtualQuery(target - 1, &mem, sizeof(mem)) && ::VirtualQuery(target + m_size, &mem2, sizeof(mem2)));
|
||||||
|
|
||||||
const auto size1 = mem.State == MEM_RESERVE ? target - (u8*)mem.AllocationBase : 0;
|
const auto size1 = mem.State == MEM_RESERVE ? target - static_cast<u8*>(mem.AllocationBase) : 0;
|
||||||
const auto size2 = mem2.State == MEM_RESERVE ? mem2.RegionSize : 0;
|
const auto size2 = mem2.State == MEM_RESERVE ? mem2.RegionSize : 0;
|
||||||
|
|
||||||
if (!size1 && !size2)
|
if (!size1 && !size2)
|
||||||
@ -1011,7 +1019,7 @@ namespace utils
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto size1 = mem.State == MEM_RESERVE ? target - (u8*)mem.AllocationBase : 0;
|
const auto size1 = mem.State == MEM_RESERVE ? target - static_cast<u8*>(mem.AllocationBase) : 0;
|
||||||
const auto size2 = mem2.State == MEM_RESERVE ? mem2.RegionSize : 0;
|
const auto size2 = mem2.State == MEM_RESERVE ? mem2.RegionSize : 0;
|
||||||
|
|
||||||
if (!::VirtualAlloc(mem.State == MEM_RESERVE ? mem.AllocationBase : target, m_size + size1 + size2, MEM_RESERVE, PAGE_NOACCESS))
|
if (!::VirtualAlloc(mem.State == MEM_RESERVE ? mem.AllocationBase : target, m_size + size1 + size2, MEM_RESERVE, PAGE_NOACCESS))
|
||||||
|
Loading…
Reference in New Issue
Block a user