Replace QNetwork operations with libcurl + wolfssl

This commit is contained in:
RipleyTom 2020-03-13 18:34:08 +01:00 committed by Ivan
parent 132c3e1c1a
commit b1d8bf754e
17 changed files with 590 additions and 437 deletions

9
.gitmodules vendored
View File

@ -55,3 +55,12 @@
path = 3rdparty/span
url = https://github.com/tcbrindle/span
ignore = dirty
[submodule "3rdparty/curl"]
path = 3rdparty/curl
url = https://github.com/RipleyTom/curl.git
ignore = dirty
[submodule "3rdparty/wolfssl"]
path = 3rdparty/wolfssl
url = https://github.com/RipleyTom/wolfssl.git
ignore = dirty

View File

@ -8,7 +8,7 @@ export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib
cd rpcs3
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang 3rdparty/curl 3rdparty/wolfssl
# Download pre-compiled llvm libs
curl -sLO https://github.com/RPCS3/llvm-mirror/releases/download/custom-build/llvmlibs-linux.tar.gz

View File

@ -413,6 +413,11 @@ endif()
# LLVM
include(llvm.cmake)
# Wolfssl
add_subdirectory(wolfssl EXCLUDE_FROM_ALL)
# Libcurl
add_subdirectory(curl EXCLUDE_FROM_ALL)
# add nice ALIAS targets for ease of use
add_library(3rdparty::libusb ALIAS usb-1.0-static)
@ -436,3 +441,5 @@ add_library(3rdparty::vulkan ALIAS ${VULKAN_TARGET})
add_library(3rdparty::openal ALIAS 3rdparty_openal)
add_library(3rdparty::ffmpeg ALIAS 3rdparty_ffmpeg)
add_library(3rdparty::glew ALIAS 3rdparty_glew)
add_library(3rdparty::wolfssl ALIAS wolfssl-3-static)
add_library(3rdparty::libcurl ALIAS libcurl)

1
3rdparty/curl vendored Submodule

@ -0,0 +1 @@
Subproject commit aa1a12cb234bd31c6058d04c398a159d06b85889

8
3rdparty/qt5.cmake vendored
View File

@ -1,16 +1,16 @@
add_library(3rdparty_qt5 INTERFACE)
find_package(Qt5 5.14 CONFIG COMPONENTS Widgets Network Qml Concurrent)
find_package(Qt5 5.14 CONFIG COMPONENTS Widgets Qml Concurrent)
if(WIN32)
find_package(Qt5 5.14 COMPONENTS WinExtras REQUIRED)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Network Qt5::Qml Qt5::Concurrent)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Qml Qt5::Concurrent)
else()
find_package(Qt5 5.14 COMPONENTS DBus Gui)
if(Qt5DBus_FOUND)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Network Qt5::Qml Qt5::Concurrent)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Qml Qt5::Concurrent)
target_compile_definitions(3rdparty_qt5 INTERFACE -DHAVE_QTDBUS)
else()
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::Network Qt5::Qml Qt5::Concurrent)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::Qml Qt5::Concurrent)
endif()
target_include_directories(3rdparty_qt5 INTERFACE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
endif()

1
3rdparty/wolfssl vendored Submodule

@ -0,0 +1 @@
Subproject commit f7130a4e43170ac2bb1046a65d10c01e6ec1d698

View File

@ -11,6 +11,7 @@ environment:
VULKAN_SDK: "C:\\VulkanSDK\\1.1.126.0"
VULKAN_SDK_URL: https://sdk.lunarg.com/sdk/download/1.1.126.0/windows/VulkanSDK-1.1.126.0-Installer.exe
VULKAN_SDK_SHA: ee86f25580b550390ce46508415e744d62e87e9c0de6cd299998058253a2a4ba
CACERT_PEM: https://curl.haxx.se/ca/cacert.pem
cache:
- glslang.7z -> appveyor.yml
@ -54,6 +55,8 @@ install:
3rdparty/yaml-cpp `
3rdparty/zlib `
3rdparty/FAudio `
3rdparty/curl `
3rdparty/wolfssl `
asmjit `
Vulkan/glslang
@ -104,16 +107,16 @@ after_build:
}
copy-item compat_database.dat .\bin\GuiConfigs\compat_database.dat
- ps: | # Download cacert.pem for SSL certificate validation
irm $env:CACERT_PEM -outfile .\bin\cacert.pem
- ps: | # package artifacts
7z a -m0=LZMA2 -mx9 $env:BUILD .\bin\*
7z a -m0=LZMA2 -mx9 openssl_win64.7z C:\OpenSSL-v111-Win64\bin\libcrypto-1_1-x64.dll `
C:\OpenSSL-v111-Win64\bin\libssl-1_1-x64.dll
$env:FILESIZE = (Get-Item $env:BUILD).length
- ps: | # generate sha256 hashes
(get-filehash $env:BUILD -algorithm SHA256).Hash | out-file ("{0}.sha256" -f $env:BUILD) -encoding ascii
$env:SHA256SUM = (get-filehash $env:BUILD -algorithm SHA256).Hash
(get-filehash openssl_win64.7z -algorithm SHA256).Hash | out-file "openssl_win64.7z.sha256" -encoding ascii
test: off
@ -122,10 +125,6 @@ artifacts:
name: rpcs3
- path: $(BUILD).sha256
name: rpcs3 sha256 hash
- path: openssl_win64.7z
name: openssl
- path: openssl_win64.7z.sha256
name: openssl sha256 hash
deploy:
provider: GitHub

151
rpcs3.sln
View File

@ -59,6 +59,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxpro
{60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF}
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D} = {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}
{FDC361C5-7734-493B-8CFB-037308B35122} = {FDC361C5-7734-493B-8CFB-037308B35122}
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C} = {5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}
@ -81,11 +82,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "7z", "7z", "{CB3DD03E-074E-
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7zlib", "3rdparty\7zlib.vcxproj", "{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wolfssl", "wolfssl", "{6DA34724-E5B2-4306-906D-1A2340637047}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssl", "3rdparty\wolfssl\wolfssl.vcxproj", "{73973223-5EE8-41CA-8E88-1D60E89A237B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcurl", "libcurl", "{BE02DA0B-BEE1-4214-AFA9-3617982F2FEA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "3rdparty\curl\rpcs3_projects\libcurl.vcxproj", "{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}"
ProjectSection(ProjectDependencies) = postProject
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {73973223-5EE8-41CA-8E88-1D60E89A237B}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - LLVM|x64 = Debug - LLVM|x64
Debug - MemLeak|x64 = Debug - MemLeak|x64
Debug|x64 = Debug|x64
DLL Debug|x64 = DLL Debug|x64
DLL Release|x64 = DLL Release|x64
LIB Release - LIB wolfSSL|x64 = LIB Release - LIB wolfSSL|x64
Release - LLVM|x64 = Release - LLVM|x64
Release|x64 = Release|x64
EndGlobalSection
@ -96,6 +111,12 @@ Global
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.ActiveCfg = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.Build.0 = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.DLL Debug|x64.ActiveCfg = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.DLL Debug|x64.Build.0 = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.DLL Release|x64.ActiveCfg = Release|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.DLL Release|x64.Build.0 = Release|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64
@ -106,6 +127,12 @@ Global
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.ActiveCfg = Debug|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.Build.0 = Debug|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.DLL Debug|x64.ActiveCfg = Debug|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.DLL Debug|x64.Build.0 = Debug|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.DLL Release|x64.ActiveCfg = Release|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.DLL Release|x64.Build.0 = Release|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.ActiveCfg = Release|x64
@ -113,6 +140,12 @@ Global
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Debug|x64.ActiveCfg = Debug|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.DLL Debug|x64.ActiveCfg = Debug|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.DLL Debug|x64.Build.0 = Debug|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.DLL Release|x64.ActiveCfg = Release|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.DLL Release|x64.Build.0 = Release|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release - LLVM|x64.ActiveCfg = Release|x64
{8BC303AB-25BE-4276-8E57-73F171B2D672}.Release|x64.ActiveCfg = Release|x64
{3384223A-6D97-4799-9862-359F85312892}.Debug - LLVM|x64.ActiveCfg = Debug - LLVM|x64
@ -121,6 +154,12 @@ Global
{3384223A-6D97-4799-9862-359F85312892}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{3384223A-6D97-4799-9862-359F85312892}.Debug|x64.ActiveCfg = Debug|x64
{3384223A-6D97-4799-9862-359F85312892}.Debug|x64.Build.0 = Debug|x64
{3384223A-6D97-4799-9862-359F85312892}.DLL Debug|x64.ActiveCfg = Debug|x64
{3384223A-6D97-4799-9862-359F85312892}.DLL Debug|x64.Build.0 = Debug|x64
{3384223A-6D97-4799-9862-359F85312892}.DLL Release|x64.ActiveCfg = Release|x64
{3384223A-6D97-4799-9862-359F85312892}.DLL Release|x64.Build.0 = Release|x64
{3384223A-6D97-4799-9862-359F85312892}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{3384223A-6D97-4799-9862-359F85312892}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{3384223A-6D97-4799-9862-359F85312892}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{3384223A-6D97-4799-9862-359F85312892}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{3384223A-6D97-4799-9862-359F85312892}.Release|x64.ActiveCfg = Release|x64
@ -131,6 +170,12 @@ Global
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Debug|x64.ActiveCfg = Debug|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Debug|x64.Build.0 = Debug|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.DLL Debug|x64.ActiveCfg = Debug|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.DLL Debug|x64.Build.0 = Debug|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.DLL Release|x64.ActiveCfg = Release|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.DLL Release|x64.Build.0 = Release|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{78CB2F39-B809-4A06-8329-8C0A19119D3D}.Release|x64.ActiveCfg = Release|x64
@ -141,6 +186,12 @@ Global
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Debug|x64.ActiveCfg = Debug|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Debug|x64.Build.0 = Debug|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.DLL Debug|x64.ActiveCfg = Debug|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.DLL Debug|x64.Build.0 = Debug|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.DLL Release|x64.ActiveCfg = Release|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.DLL Release|x64.Build.0 = Release|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{30A05C4D-F5FD-421C-A864-17A64BDEAA75}.Release|x64.ActiveCfg = Release|x64
@ -150,6 +201,12 @@ Global
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug - MemLeak|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug|x64.ActiveCfg = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.DLL Debug|x64.ActiveCfg = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.DLL Debug|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.DLL Release|x64.ActiveCfg = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.DLL Release|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release - LLVM|x64.ActiveCfg = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release - LLVM|x64.Build.0 = Release|x64
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release|x64.ActiveCfg = Release|x64
@ -160,6 +217,12 @@ Global
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Debug - MemLeak|x64.Build.0 = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Debug|x64.ActiveCfg = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Debug|x64.Build.0 = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.DLL Debug|x64.ActiveCfg = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.DLL Debug|x64.Build.0 = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.DLL Release|x64.ActiveCfg = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.DLL Release|x64.Build.0 = Debug Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.LIB Release - LIB wolfSSL|x64.Build.0 = Release Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Release - LLVM|x64.ActiveCfg = Release Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Release - LLVM|x64.Build.0 = Release Library|x64
{D6973076-9317-4EF2-A0B8-B7A18AC0713E}.Release|x64.ActiveCfg = Release Library|x64
@ -170,6 +233,12 @@ Global
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Debug - MemLeak|x64.Build.0 = Debug|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Debug|x64.ActiveCfg = Debug|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Debug|x64.Build.0 = Debug|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.DLL Debug|x64.ActiveCfg = Debug|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.DLL Debug|x64.Build.0 = Debug|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.DLL Release|x64.ActiveCfg = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.DLL Release|x64.Build.0 = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Release - LLVM|x64.ActiveCfg = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Release - LLVM|x64.Build.0 = Release|x64
{60F89955-91C6-3A36-8000-13C592FEC2DF}.Release|x64.ActiveCfg = Release|x64
@ -177,6 +246,12 @@ Global
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Debug|x64.ActiveCfg = Debug|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.DLL Debug|x64.ActiveCfg = Debug|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.DLL Debug|x64.Build.0 = Debug|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.DLL Release|x64.ActiveCfg = Release|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.DLL Release|x64.Build.0 = Release|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Release - LLVM|x64.ActiveCfg = Release|x64
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Release|x64.ActiveCfg = Release|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug - LLVM|x64.ActiveCfg = Debug - LLVM|x64
@ -185,6 +260,12 @@ Global
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug|x64.ActiveCfg = Debug|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug|x64.Build.0 = Debug|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.DLL Debug|x64.ActiveCfg = Debug|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.DLL Debug|x64.Build.0 = Debug|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.DLL Release|x64.ActiveCfg = Release|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.DLL Release|x64.Build.0 = Release|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Release|x64.ActiveCfg = Release|x64
@ -195,6 +276,12 @@ Global
{FDC361C5-7734-493B-8CFB-037308B35122}.Debug - MemLeak|x64.Build.0 = Debug|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.Debug|x64.ActiveCfg = Debug|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.Debug|x64.Build.0 = Debug|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.DLL Debug|x64.ActiveCfg = Debug|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.DLL Debug|x64.Build.0 = Debug|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.DLL Release|x64.ActiveCfg = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.DLL Release|x64.Build.0 = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.Release - LLVM|x64.ActiveCfg = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.Release - LLVM|x64.Build.0 = Release|x64
{FDC361C5-7734-493B-8CFB-037308B35122}.Release|x64.ActiveCfg = Release|x64
@ -205,6 +292,12 @@ Global
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.Build.0 = Debug|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.Build.0 = Debug|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.DLL Debug|x64.ActiveCfg = Debug|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.DLL Debug|x64.Build.0 = Debug|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.DLL Release|x64.ActiveCfg = Release|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.DLL Release|x64.Build.0 = Release|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release - LLVM|x64.ActiveCfg = Release - LLVM|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release - LLVM|x64.Build.0 = Release - LLVM|x64
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64
@ -215,6 +308,12 @@ Global
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug - MemLeak|x64.Build.0 = Debug|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|x64.ActiveCfg = Debug|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|x64.Build.0 = Debug|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.DLL Debug|x64.ActiveCfg = Debug|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.DLL Debug|x64.Build.0 = Debug|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.DLL Release|x64.ActiveCfg = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.DLL Release|x64.Build.0 = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release - LLVM|x64.ActiveCfg = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release - LLVM|x64.Build.0 = Release|x64
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|x64.ActiveCfg = Release|x64
@ -225,6 +324,12 @@ Global
{939FE206-1182-ABC3-1234-FEAB88E98404}.Debug - MemLeak|x64.Build.0 = Debug|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Debug|x64.ActiveCfg = Debug|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Debug|x64.Build.0 = Debug|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.DLL Debug|x64.ActiveCfg = Debug|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.DLL Debug|x64.Build.0 = Debug|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.DLL Release|x64.ActiveCfg = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.DLL Release|x64.Build.0 = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release - LLVM|x64.ActiveCfg = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release - LLVM|x64.Build.0 = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release|x64.ActiveCfg = Release|x64
@ -235,6 +340,12 @@ Global
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug - MemLeak|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DLL Debug|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DLL Debug|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DLL Release|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.DLL Release|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release - LLVM|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release - LLVM|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
@ -245,10 +356,48 @@ Global
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug - MemLeak|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug|x64.ActiveCfg = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.DLL Debug|x64.ActiveCfg = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.DLL Debug|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.DLL Release|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.DLL Release|x64.Build.0 = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release - LLVM|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release - LLVM|x64.Build.0 = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release|x64.Build.0 = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug - LLVM|x64.Build.0 = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug - MemLeak|x64.Build.0 = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|x64.ActiveCfg = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|x64.Build.0 = Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.ActiveCfg = DLL Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.Build.0 = DLL Debug|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.ActiveCfg = DLL Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.Build.0 = DLL Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release - LLVM|x64.ActiveCfg = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release - LLVM|x64.Build.0 = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|x64.ActiveCfg = Release|x64
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|x64.Build.0 = Release|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug - LLVM|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug - LLVM|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug - MemLeak|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug - MemLeak|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.DLL Debug|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.DLL Debug|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.DLL Release|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.DLL Release|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release - LIB wolfSSL|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release - LIB wolfSSL|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release - LLVM|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release - LLVM|x64.Build.0 = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.ActiveCfg = LIB Release - LIB wolfSSL|x64
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.Build.0 = LIB Release - LIB wolfSSL|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -270,6 +419,8 @@ Global
{939FE206-1182-ABC3-1234-FEAB88E98404} = {D16E245C-CC5A-4B9A-8BAB-1176F02C1631}
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {6D8E86F7-84A0-45BA-ACC3-F02FC5545B3B}
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C} = {CB3DD03E-074E-4FA5-B253-51A3372D1768}
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {6DA34724-E5B2-4306-906D-1A2340637047}
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {BE02DA0B-BEE1-4214-AFA9-3617982F2FEA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06CC7920-E085-4B81-9582-8DE8AAD42510}

File diff suppressed because it is too large Load Diff

View File

@ -91,4 +91,6 @@ target_link_libraries(rpcs3_ui
3rdparty::hidapi
3rdparty::libusb
3rdparty::libpng
3rdparty::7z)
3rdparty::7z
3rdparty::wolfssl
3rdparty::libcurl)

View File

@ -4,22 +4,56 @@
#include <QMessageBox>
#include <QJsonDocument>
#include <QNetworkReply>
#include <QThread>
LOG_CHANNEL(compat_log, "Compat");
constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
size_t curl_write_cb_compat(char* ptr, size_t /*size*/, size_t nmemb, void* userdata)
{
game_compatibility* gm_cmp = reinterpret_cast<game_compatibility*>(userdata);
return gm_cmp->update_buffer(ptr, nmemb);
}
game_compatibility::game_compatibility(std::shared_ptr<gui_settings> settings) : m_xgui_settings(settings)
{
m_filepath = m_xgui_settings->GetSettingsDir() + "/compat_database.dat";
m_url = "https://rpcs3.net/compatibility?api=v1&export";
m_network_request = QNetworkRequest(QUrl(m_url));
m_curl = curl_easy_init();
RequestCompatibility();
}
size_t game_compatibility::update_buffer(char* data, size_t size)
{
if (m_curl_abort)
{
return 0;
}
const auto old_size = m_curl_buf.size();
const auto new_size = old_size + size;
m_curl_buf.resize(static_cast<int>(new_size));
memcpy(m_curl_buf.data() + old_size, data, size);
if (m_actual_dwnld_size < 0)
{
if (curl_easy_getinfo(m_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &m_actual_dwnld_size) == CURLE_OK && m_actual_dwnld_size > 0)
{
if (m_progress_dialog)
m_progress_dialog->setMaximum(static_cast<int>(m_actual_dwnld_size));
}
}
if (m_progress_dialog)
m_progress_dialog->setValue(static_cast<int>(new_size));
return size;
}
bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_download)
{
int return_code = json_data["return_code"].toInt();
@ -118,112 +152,44 @@ void game_compatibility::RequestCompatibility(bool online)
return;
}
if (QSslSocket::supportsSsl() == false)
{
compat_log.error("Can not retrieve the online database! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
const QString message = tr("Can not retrieve the online database!<br>Please make sure your system supports SSL.<br>Visit our <a href='https://rpcs3.net/quickstart'>quickstart guide</a> for more information.");
QMessageBox box(QMessageBox::Icon::Warning, tr("Warning!"), message, QMessageBox::StandardButton::Ok, nullptr);
box.setTextFormat(Qt::RichText);
box.exec();
return;
}
compat_log.notice("SSL supported! Beginning compatibility database download from: %s", sstr(m_url));
// Send request and wait for response
m_network_access_manager.reset(new QNetworkAccessManager());
QNetworkReply* network_reply = m_network_access_manager->get(m_network_request);
compat_log.notice("Beginning compatibility database download from: %s", m_url);
// Show Progress
m_progress_dialog = new progress_dialog(tr("Downloading Database"), tr(".Please wait."), tr("Abort"), 0, 100, true);
m_progress_dialog = new progress_dialog(tr("Downloading Database"), tr("Please wait ..."), tr("Abort"), 0, 100, true);
m_progress_dialog->show();
// Animate progress dialog a bit more
m_progress_timer.reset(new QTimer(this));
connect(m_progress_timer.get(), &QTimer::timeout, [&]()
{
switch (++m_timer_count % 3)
{
case 0:
m_timer_count = 0;
m_progress_dialog->setLabelText(tr(".Please wait."));
break;
case 1:
m_progress_dialog->setLabelText(tr("..Please wait.."));
break;
default:
m_progress_dialog->setLabelText(tr("...Please wait..."));
break;
}
});
m_progress_timer->start(500);
curl_easy_setopt(m_curl, CURLOPT_URL, m_url.c_str());
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curl_write_cb_compat);
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, this);
curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1);
m_curl_buf.clear();
m_curl_abort = false;
// Handle abort
connect(m_progress_dialog, &QProgressDialog::canceled, network_reply, &QNetworkReply::abort);
connect(m_progress_dialog, &QProgressDialog::canceled, [this] { m_curl_abort = true; });
connect(m_progress_dialog, &QProgressDialog::finished, m_progress_dialog, &QProgressDialog::deleteLater);
// Handle progress
connect(network_reply, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)
QThread::create([&]
{
m_progress_dialog->setMaximum(bytesTotal);
m_progress_dialog->setValue(bytesReceived);
});
const auto result = curl_easy_perform(m_curl);
// Handle network error
connect(network_reply, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), [=, this](QNetworkReply::NetworkError error)
{
if (error == QNetworkReply::NoError)
{
return;
}
if (error != QNetworkReply::OperationCanceledError)
{
// We failed to retrieve a new database, therefore refresh gamelist to old state
const QString error = network_reply->errorString();
Q_EMIT DownloadError(error);
compat_log.error("Network Error - %s", sstr(error));
}
// Clean up Progress Dialog
if (m_progress_dialog)
{
m_progress_dialog->close();
}
if (m_progress_timer)
{
m_progress_timer->stop();
m_progress_dialog = nullptr;
}
network_reply->deleteLater();
});
// Handle response according to its contents
connect(network_reply, &QNetworkReply::finished, [=, this]()
{
if (network_reply->error() != QNetworkReply::NoError)
if (result != CURLE_OK)
{
Q_EMIT DownloadError(qstr("Curl error: ") + qstr(curl_easy_strerror(result)));
return;
}
// Clean up Progress Dialog
if (m_progress_dialog)
{
m_progress_dialog->close();
}
if (m_progress_timer)
{
m_progress_timer->stop();
}
compat_log.notice("Database download finished");
// Read data from network reply
QByteArray data = network_reply->readAll();
network_reply->deleteLater();
// Create new map from database and write database to file if database was valid
if (ReadJSON(QJsonDocument::fromJson(data).object(), online))
if (ReadJSON(QJsonDocument::fromJson(m_curl_buf).object(), online))
{
// We have a new database in map, therefore refresh gamelist to new state
Q_EMIT DownloadFinished();
@ -242,12 +208,12 @@ void game_compatibility::RequestCompatibility(bool online)
return;
}
file.write(data);
file.write(m_curl_buf);
file.close();
compat_log.success("Write database to file: %s", sstr(m_filepath));
compat_log.success("Wrote database to file: %s", sstr(m_filepath));
}
});
})->start();
// We want to retrieve a new database, therefore refresh gamelist and indicate that
Q_EMIT DownloadStarted();

View File

@ -4,9 +4,10 @@
#include <QPainter>
#include <QJsonObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QTimer>
#define NOMINMAX
#define CURL_STATICLIB
#include <curl/curl.h>
class gui_settings;
class progress_dialog;
@ -39,12 +40,13 @@ private:
};
int m_timer_count = 0;
QString m_filepath;
QString m_url;
QNetworkRequest m_network_request;
std::string m_url;
std::atomic<bool> m_curl_abort = false;
double m_actual_dwnld_size = -1.0;
CURL *m_curl = nullptr;
QByteArray m_curl_buf;
progress_dialog* m_progress_dialog = nullptr;
std::shared_ptr<gui_settings> m_xgui_settings;
std::unique_ptr<QTimer> m_progress_timer;
std::unique_ptr<QNetworkAccessManager> m_network_access_manager;
std::map<std::string, compat_status> m_compat_database;
/** Creates new map from the database */
@ -63,6 +65,8 @@ public:
/** Returns the data for the requested status */
compat_status GetStatusData(const QString& status);
size_t update_buffer(char* data, size_t size);
Q_SIGNALS:
void DownloadStarted();
void DownloadFinished();

View File

@ -22,6 +22,8 @@
#include <QScreen>
#include <QFontDatabase>
#include <QLibraryInfo>
#include <QDirIterator>
#include <clocale>

View File

@ -29,6 +29,8 @@
#include <thread>
#include <QScreen>
#include <QDirIterator>
#include <QMimeData>
#include "stdafx.h"
#include "rpcs3_version.h"

View File

@ -8,6 +8,7 @@
#include <QActionGroup>
#include <QMainWindow>
#include <QIcon>
#include <QMimeData>
#include "update_manager.h"
#include "settings.h"

View File

@ -7,10 +7,15 @@
#include "Emu/System.h"
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
#include <QThread>
#include <sstream>
#include <iomanip>
#if defined(_WIN32)
#define NOMINMAX
#include <windows.h>
#include <CpuArch.h>
#include <7z.h>
@ -29,9 +34,40 @@
LOG_CHANNEL(update_log, "UPDATER");
size_t curl_write_cb(char* ptr, size_t /*size*/, size_t nmemb, void* userdata)
{
update_manager* upd_mgr = reinterpret_cast<update_manager*>(userdata);
return upd_mgr->update_buffer(ptr, nmemb);
}
update_manager::update_manager()
{
m_manager.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
m_curl = curl_easy_init();
#ifdef _WIN32
// This shouldn't be needed on linux
curl_easy_setopt(m_curl, CURLOPT_CAINFO, "cacert.pem");
#endif
}
size_t update_manager::update_buffer(char* data, size_t size)
{
if (m_curl_abort)
{
return 0;
}
const auto old_size = m_curl_buf.size();
const auto new_size = old_size + size;
m_curl_buf.resize(static_cast<int>(new_size));
memcpy(m_curl_buf.data() + old_size, data, size);
if (m_progress_dialog && m_update_dialog)
{
m_progress_dialog->setValue(static_cast<int>(new_size));
}
return size;
}
void update_manager::check_for_updates(bool automatic, QWidget* parent)
@ -44,91 +80,54 @@ void update_manager::check_for_updates(bool automatic, QWidget* parent)
}
#endif
if (QSslSocket::supportsSsl() == false)
{
update_log.error("Unable to update RPCS3! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
if (!automatic)
{
const QString message = tr("Unable to update RPCS3!<br>Please make sure your system supports SSL.<br>Visit our <a href='https://rpcs3.net/quickstart'>Quickstart</a> guide for more information.");
QMessageBox box(QMessageBox::Icon::Warning, tr("Auto-updater"), message, QMessageBox::StandardButton::Ok, parent);
box.setTextFormat(Qt::RichText);
box.exec();
}
return;
}
m_parent = parent;
const std::string request_url = m_update_url + rpcs3::get_commit_and_hash().second;
QNetworkReply* reply_json = m_manager.get(QNetworkRequest(QUrl(QString::fromStdString(request_url))));
m_parent = parent;
m_curl_abort = false;
m_update_dialog = false;
m_curl_buf.clear();
m_progress_dialog = new progress_dialog(tr("Checking For Updates"), tr("Please wait..."), tr("Abort"), 0, 100, true, parent);
m_progress_dialog->setAutoClose(false);
m_progress_dialog->setAutoReset(false);
m_progress_dialog->show();
connect(m_progress_dialog, &QProgressDialog::canceled, reply_json, &QNetworkReply::abort);
connect(m_progress_dialog, &QProgressDialog::canceled, [&]() { m_curl_abort = true; });
connect(m_progress_dialog, &QProgressDialog::finished, m_progress_dialog, &QProgressDialog::deleteLater);
// clang-format off
connect(reply_json, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)
const std::string request_url = m_update_url + rpcs3::get_commit_and_hash().second;
curl_easy_setopt(m_curl, CURLOPT_URL, request_url.c_str());
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curl_write_cb);
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, this);
bool result_json = false;
if (const auto curl_result = curl_easy_perform(m_curl); curl_result != CURLE_OK)
{
m_progress_dialog->setMaximum(bytesTotal);
m_progress_dialog->setValue(bytesReceived);
});
connect(reply_json, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), this, &update_manager::handle_error);
connect(reply_json, &QNetworkReply::finished, [=, this]()
update_log.error("Curl error(query): %s", curl_easy_strerror(curl_result));
}
else
{
handle_reply(reply_json, &update_manager::handle_json, automatic, "Retrieved JSON Info");
});
// clang-format on
}
result_json = handle_json(automatic);
}
void update_manager::handle_error(QNetworkReply::NetworkError error)
{
if (error != QNetworkReply::NoError)
if (!result_json && !m_curl_abort)
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
if (!reply)
return;
m_progress_dialog->close();
reply->deleteLater();
if (error != QNetworkReply::OperationCanceledError)
if (!automatic)
{
const QString err_str = reply->errorString();
update_log.error("Network Error: %s", err_str.toStdString());
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("An error occurred during the auto-updating process.\nCheck the log for more information."));
}
if (m_progress_dialog)
{
m_progress_dialog->close();
m_progress_dialog = nullptr;
}
}
}
bool update_manager::handle_reply(QNetworkReply* reply, const std::function<bool(update_manager& man, const QByteArray&, bool)>& func, bool automatic, const std::string& message)
bool update_manager::handle_json(bool automatic)
{
if (auto error = reply->error(); error != QNetworkReply::NoError)
return false;
// Read data from network reply
const QByteArray data = reply->readAll();
reply->deleteLater();
update_log.notice("%s", message);
if (!func(*this, data, automatic))
{
m_progress_dialog->close();
if (!automatic)
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("An error occurred during the auto-updating process.\nCheck the log for more information."));
}
return true;
}
bool update_manager::handle_json(const QByteArray& data, bool automatic)
{
const QJsonObject json_data = QJsonDocument::fromJson(data).object();
int return_code = json_data["return_code"].toInt(-255);
const QJsonObject json_data = QJsonDocument::fromJson(m_curl_buf).object();
const int return_code = json_data["return_code"].toInt(-255);
bool hash_found = true;
@ -218,7 +217,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
{
update_log.notice("Converting string: %s", str);
std::istringstream input(str);
input.imbue(std::locale(setlocale(LC_ALL, "C")));
input.imbue(std::locale(setlocale(LC_TIME, "C")));
input >> std::get_time(tm, format.c_str());
return !input.fail();
@ -232,7 +231,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
s64 u_timediff = static_cast<s64>(std::difftime(lts_time, cur_time));
update_log.notice("Current: %lld, latest: %lld, difference: %lld", static_cast<s64>(cur_time), static_cast<s64>(lts_time), u_timediff);
timediff = tr("Your version is %1 day(s), %2 hour(s) and %3 minute(s) old.").arg(u_timediff / (60 * 60 * 24)).arg((u_timediff / (60 * 60)) % 24).arg((u_timediff / 60) % 60);
timediff = tr("Your version is %1 day(s), %2 hour(s) and %3 minute(s) old.").arg(u_timediff / (60 * 60 * 24)).arg((u_timediff / (60 * 60)) % 24).arg((u_timediff / 60) % 60);
}
const QString to_show = tr("A new version of RPCS3 is available!\n\nCurrent version: %1\nLatest version: %2\n%3\n\nDo you want to update?")
@ -252,33 +251,52 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
m_progress_dialog->setWindowTitle(tr("Downloading Update"));
// Download RPCS3
m_progress_dialog->setMaximum(m_expected_size);
m_progress_dialog->setValue(0);
QNetworkReply* reply_rpcs3 = m_manager.get(QNetworkRequest(QUrl(latest[os]["download"].toString())));
m_update_dialog = true;
connect(m_progress_dialog, &QProgressDialog::canceled, reply_rpcs3, &QNetworkReply::abort);
const std::string request_url = latest[os]["download"].toString().toStdString();
curl_easy_setopt(m_curl, CURLOPT_URL, request_url.c_str());
curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1);
// clang-format off
connect(reply_rpcs3, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)
m_curl_buf.clear();
QThread::create([this, automatic]
{
m_progress_dialog->setMaximum(bytesTotal);
m_progress_dialog->setValue(bytesReceived);
});
bool result_rpcs3 = false;
connect(reply_rpcs3, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), this, &update_manager::handle_error);
connect(reply_rpcs3, &QNetworkReply::finished, [=, this]()
{
handle_reply(reply_rpcs3, &update_manager::handle_rpcs3, automatic, "Retrieved RPCS3");
});
// clang-format on
if (const auto curl_result = curl_easy_perform(m_curl); curl_result != CURLE_OK)
{
update_log.error("Curl error(download): %s", curl_easy_strerror(curl_result));
}
else
{
result_rpcs3 = handle_rpcs3();
}
if (!result_rpcs3 && !m_curl_abort)
{
if (!automatic)
{
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("An error occurred during the auto-updating process.\nCheck the log for more information."));
}
if (m_progress_dialog)
{
m_progress_dialog->close();
m_progress_dialog = nullptr;
}
}
})->start();
return true;
}
bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic*/)
bool update_manager::handle_rpcs3()
{
if (m_expected_size != rpcs3_data.size() + 0u)
if (m_expected_size != m_curl_buf.size() + 0u)
{
update_log.error("Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size);
update_log.error("Download size mismatch: %d expected: %d", m_curl_buf.size(), m_expected_size);
return false;
}
@ -286,7 +304,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
mbedtls_sha256_context ctx;
mbedtls_sha256_init(&ctx);
mbedtls_sha256_starts_ret(&ctx, 0);
mbedtls_sha256_update_ret(&ctx, reinterpret_cast<const unsigned char*>(rpcs3_data.data()), rpcs3_data.size());
mbedtls_sha256_update_ret(&ctx, reinterpret_cast<const unsigned char*>(m_curl_buf.data()), m_curl_buf.size());
mbedtls_sha256_finish_ret(&ctx, res_hash);
std::string res_hash_string("0000000000000000000000000000000000000000000000000000000000000000");
@ -348,7 +366,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
update_log.error("Failed to create new AppImage file: %s", replace_path);
return false;
}
if (new_appimage.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size() + 0u)
if (new_appimage.write(m_curl_buf.data(), m_curl_buf.size()) != m_curl_buf.size() + 0u)
{
update_log.error("Failed to write new AppImage file: %s", replace_path);
return false;
@ -378,7 +396,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
update_log.error("Failed to create temporary file: %s", tmpfile_path);
return false;
}
if (tmpfile.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size())
if (tmpfile.write(m_curl_buf.data(), m_curl_buf.size()) != m_curl_buf.size())
{
update_log.error("Failed to write temporary file: %s", tmpfile_path);
return false;

View File

@ -1,36 +1,38 @@
#pragma once
#include "stdafx.h"
#include <QtNetwork>
#define NOMINMAX
#define CURL_STATICLIB
#include <curl/curl.h>
#include <QObject>
#include <QByteArray>
class progress_dialog;
class update_manager : public QObject
class update_manager final : public QObject
{
Q_OBJECT
private:
const std::string m_update_url = "https://update.rpcs3.net/?api=v1&c=";
const std::string m_tmp_folder = "/rpcs3_old/";
private:
std::atomic<bool> m_update_dialog = false;
progress_dialog* m_progress_dialog = nullptr;
QWidget* m_parent = nullptr;
QNetworkAccessManager m_manager;
CURL *m_curl = nullptr;
QByteArray m_curl_buf;
std::atomic<bool> m_curl_abort = false;
std::string m_expected_hash;
u64 m_expected_size = 0;
private:
bool handle_reply(QNetworkReply* reply, const std::function<bool(update_manager& man, const QByteArray&, bool)>& func, bool automatic, const std::string& message);
bool handle_json(const QByteArray& json_data, bool automatic);
bool handle_rpcs3(const QByteArray& rpcs3_data, bool automatic);
bool handle_json(bool automatic);
bool handle_rpcs3();
public:
update_manager();
void check_for_updates(bool automatic, QWidget* parent = nullptr);
private Q_SLOTS:
void handle_error(QNetworkReply::NetworkError error);
size_t update_buffer(char *data, size_t size);
};