Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b595318e7 |
+14
-3
@@ -5,6 +5,20 @@
|
||||
# shellcheck disable=SC2046
|
||||
git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ && !/opencv/ { print $3 }' .gitmodules)
|
||||
|
||||
# Prefer newer Clang than in base system (see also .ci/install-freebsd.sh)
|
||||
# libc++ isn't in llvm* packages, so download manually
|
||||
fetch https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.1/llvm-project-16.0.1.src.tar.xz
|
||||
tar xf llvm*.tar.xz
|
||||
export CC=clang16 CXX=clang++16
|
||||
cmake -B libcxx_build -G Ninja -S llvm*/libcxx \
|
||||
-DLLVM_CCACHE_BUILD=ON \
|
||||
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=libcxx_prefix
|
||||
cmake --build libcxx_build
|
||||
cmake --install libcxx_build
|
||||
export CXXFLAGS="$CXXFLAGS -nostdinc++ -isystem$PWD/libcxx_prefix/include/c++/v1"
|
||||
export LDFLAGS="$LDFLAGS -nostdlib++ -L$PWD/libcxx_prefix/lib -l:libc++.a -lcxxrt"
|
||||
|
||||
CONFIGURE_ARGS="
|
||||
-DWITH_LLVM=ON
|
||||
-DUSE_SDL=OFF
|
||||
@@ -16,9 +30,6 @@ CONFIGURE_ARGS="
|
||||
-DUSE_SYSTEM_OPENCV=ON
|
||||
"
|
||||
|
||||
# base Clang workaround (missing clang-scan-deps)
|
||||
CONFIGURE_ARGS="$CONFIGURE_ARGS -DCMAKE_CXX_SCAN_FOR_MODULES=OFF"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
cmake -B build -G Ninja $CONFIGURE_ARGS
|
||||
cmake --build build
|
||||
|
||||
Executable → Regular
+2
-12
@@ -12,18 +12,8 @@ git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ { print $3
|
||||
|
||||
mkdir build && cd build || exit 1
|
||||
|
||||
if [ "$COMPILER" = "gcc" ]; then
|
||||
# These are set in the dockerfile
|
||||
export CC="${GCC_BINARY}"
|
||||
export CXX="${GXX_BINARY}"
|
||||
export LINKER=gold
|
||||
else
|
||||
export CC="${CLANG_BINARY}"
|
||||
export CXX="${CLANGXX_BINARY}"
|
||||
export LINKER="${LLD_BINARY}"
|
||||
fi
|
||||
export CFLAGS="$CFLAGS -fuse-ld=${LINKER}"
|
||||
export CXXFLAGS="$CXXFLAGS -fuse-ld=${LINKER}"
|
||||
export CC="${CLANG_BINARY}"
|
||||
export CXX="${CLANGXX_BINARY}"
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
|
||||
@@ -47,7 +47,6 @@ ln -s /usr/local/opt/curl/bin/curl /opt/homebrew1/opt/curl/bin/curl
|
||||
|
||||
brew_arm64_install_packages 0mq aom aribb24 ca-certificates cjson dav1d ffmpeg@5 fontconfig freetype freetype2 gettext glew gmp gnutls lame libbluray libidn2 libnettle libogg libpng librist libsodium libsoxr libtasn libtasn1 libunistring libvmaf libvorbis libvpx libx11 libxau libxcb libxdmcp llvm@$LLVM_COMPILER_VER mbedtls molten-vk nettle opencore-amr openjpeg openssl opus p11-kit pkg-config pkgconfig pzstd rav1e sdl2 snappy speex srt svt-av1 theora vulkan-headers webp x264 x265 xz z3 zeromq zmq zstd
|
||||
"$BREW_ARM64_PATH/bin/brew" link -f ffmpeg@5
|
||||
ln -s /opt/homebrew1/opt/llvm@19/lib/unwind/libunwind.1.dylib /opt/homebrew1/opt/llvm@19/lib/libunwind.1.dylib
|
||||
|
||||
# moltenvk based on commit for 1.2.11 release
|
||||
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/6bfc8950c696d1f952425e8af2a6248603dc0df9/Formula/m/molten-vk.rb
|
||||
@@ -72,13 +71,13 @@ if [ ! -d "/tmp/Qt/$QT_VER" ]; then
|
||||
git clone https://github.com/engnr/qt-downloader.git
|
||||
cd qt-downloader
|
||||
git checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597
|
||||
# nested Qt 6.8.2 URL workaround
|
||||
# nested Qt 6.8.1 URL workaround
|
||||
# sed -i '' "s/'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/'qt{0}_{0}{1}{2}'.format(major, minor, patch), 'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/g" qt-downloader
|
||||
# sed -i '' "s/'{}\/{}\/qt{}_{}\/'/'{0}\/{1}\/qt{2}_{3}\/qt{2}_{3}\/'/g" qt-downloader
|
||||
cd "/tmp/Qt"
|
||||
"$BREW_X64_PATH/bin/pipenv" run pip3 install py7zr requests semantic_version lxml
|
||||
mkdir -p "$QT_VER/macos" ; ln -s "macos" "$QT_VER/clang_64"
|
||||
# sed -i '' 's/args\.version \/ derive_toolchain_dir(args) \/ //g' "$WORKDIR/qt-downloader/qt-downloader" # Qt 6.8.2 workaround
|
||||
# sed -i '' 's/args\.version \/ derive_toolchain_dir(args) \/ //g' "$WORKDIR/qt-downloader/qt-downloader" # Qt 6.8.1 workaround
|
||||
"$BREW_X64_PATH/bin/pipenv" run "$WORKDIR/qt-downloader/qt-downloader" macos desktop "$QT_VER" clang_64 --opensource --addons qtmultimedia qtimageformats # -o "$QT_VER/clang_64"
|
||||
fi
|
||||
|
||||
|
||||
+2
-2
@@ -39,13 +39,13 @@ if [ ! -d "/tmp/Qt/$QT_VER" ]; then
|
||||
git clone https://github.com/engnr/qt-downloader.git
|
||||
cd qt-downloader
|
||||
git checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597
|
||||
# nested Qt 6.8.2 URL workaround
|
||||
# nested Qt 6.8.1 URL workaround
|
||||
# sed -i '' "s/'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/'qt{0}_{0}{1}{2}'.format(major, minor, patch), 'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/g" qt-downloader
|
||||
# sed -i '' "s/'{}\/{}\/qt{}_{}\/'/'{0}\/{1}\/qt{2}_{3}\/qt{2}_{3}\/'/g" qt-downloader
|
||||
cd "/tmp/Qt"
|
||||
"$BREW_X64_PATH/bin/pipenv" run pip3 install py7zr requests semantic_version lxml
|
||||
mkdir -p "$QT_VER/macos" ; ln -s "macos" "$QT_VER/clang_64"
|
||||
# sed -i '' 's/args\.version \/ derive_toolchain_dir(args) \/ //g' "$WORKDIR/qt-downloader/qt-downloader" # Qt 6.8.2 workaround
|
||||
# sed -i '' 's/args\.version \/ derive_toolchain_dir(args) \/ //g' "$WORKDIR/qt-downloader/qt-downloader" # Qt 6.8.1 workaround
|
||||
"$BREW_X64_PATH/bin/pipenv" run "$WORKDIR/qt-downloader/qt-downloader" macos desktop "$QT_VER" clang_64 --opensource --addons qtmultimedia qtimageformats # -o "$QT_VER/clang_64"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
# First let's see print some info about our caches
|
||||
"$(cygpath -u "$CCACHE_BIN_DIR")"/ccache.exe --show-stats -v
|
||||
|
||||
# BUILD_blablabla is Azure specific, so we wrap it for portability
|
||||
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
curl -fLo "./llvm.lock" "https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-19.1.7/llvmlibs_mt.7z.sha256"
|
||||
curl -fLo "./llvm.lock" "https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-16.0.1/llvmlibs_mt.7z.sha256"
|
||||
curl -fLo "./glslang.lock" "https://github.com/RPCS3/glslang/releases/download/custom-build-win/glslanglibs_mt.7z.sha256"
|
||||
|
||||
@@ -8,8 +8,8 @@ sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
|
||||
export ASSUME_ALWAYS_YES=true
|
||||
pkg info # debug
|
||||
|
||||
# WITH_LLVM
|
||||
pkg install llvm19
|
||||
# Prefer newer Clang than in base system (see also .ci/build-freebsd.sh)
|
||||
pkg install llvm16
|
||||
|
||||
# Mandatory dependencies (qt6-base is pulled via qt6-multimedia)
|
||||
pkg install git ccache cmake ninja qt6-multimedia qt6-svg glew openal-soft ffmpeg
|
||||
|
||||
+13
-29
@@ -19,10 +19,9 @@ QT_DECL_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qtdeclarative${QT_SUFFIX}"
|
||||
QT_TOOL_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qttools${QT_SUFFIX}"
|
||||
QT_MM_URL="${QT_HOST}${QT_PREFIX}addons.qtmultimedia.${QT_PREFIX_2}qtmultimedia${QT_SUFFIX}"
|
||||
QT_SVG_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qtsvg${QT_SUFFIX}"
|
||||
LLVMLIBS_URL='https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-19.1.7/llvmlibs_mt.7z'
|
||||
LLVMLIBS_URL='https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-16.0.1/llvmlibs_mt.7z'
|
||||
GLSLANG_URL='https://github.com/RPCS3/glslang/releases/latest/download/glslanglibs_mt.7z'
|
||||
VULKAN_SDK_URL="https://www.dropbox.com/scl/fi/sjjh0fc4ld281pjbl2xzu/VulkanSDK-1.3.268.0-Installer.exe?rlkey=f6wzc0lvms5vwkt2z3qabfv9d&dl=1"
|
||||
CCACHE_URL="https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-windows-x86_64.zip"
|
||||
|
||||
DEP_URLS=" \
|
||||
$QT_BASE_URL \
|
||||
@@ -32,11 +31,10 @@ DEP_URLS=" \
|
||||
$QT_SVG_URL \
|
||||
$LLVMLIBS_URL \
|
||||
$GLSLANG_URL \
|
||||
$VULKAN_SDK_URL\
|
||||
$CCACHE_URL"
|
||||
$VULKAN_SDK_URL"
|
||||
|
||||
# Azure pipelines doesn't make a cache dir if it doesn't exist, so we do it manually
|
||||
[ -d "$DEPS_CACHE_DIR" ] || mkdir "$DEPS_CACHE_DIR"
|
||||
[ -d "$CACHE_DIR" ] || mkdir "$CACHE_DIR"
|
||||
|
||||
# Pull all the submodules except llvm, since it is built separately and we just download that build
|
||||
# Note: Tried to use git submodule status, but it takes over 20 seconds
|
||||
@@ -60,9 +58,10 @@ download_and_verify()
|
||||
fileName="$4"
|
||||
|
||||
for _ in 1 2 3; do
|
||||
[ -e "$DEPS_CACHE_DIR/$fileName" ] || curl -fLo "$DEPS_CACHE_DIR/$fileName" "$url"
|
||||
fileChecksum=$("${algo}sum" "$DEPS_CACHE_DIR/$fileName" | awk '{ print $1 }')
|
||||
[ -e "$CACHE_DIR/$fileName" ] || curl -fLo "$CACHE_DIR/$fileName" "$url"
|
||||
fileChecksum=$("${algo}sum" "$CACHE_DIR/$fileName" | awk '{ print $1 }')
|
||||
[ "$fileChecksum" = "$correctChecksum" ] && return 0
|
||||
rm "$CACHE_DIR/$fileName"
|
||||
done
|
||||
|
||||
return 1;
|
||||
@@ -81,12 +80,11 @@ for url in $DEP_URLS; do
|
||||
*qt*) checksum=$(curl -fL "${url}.sha1"); algo="sha1"; outDir="$QTDIR/" ;;
|
||||
*llvm*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./build/lib_ext/Release-x64" ;;
|
||||
*glslang*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./build/lib_ext/Release-x64" ;;
|
||||
*ccache*) checksum=$CCACHE_SHA; algo="sha256"; outDir="$CCACHE_BIN_DIR" ;;
|
||||
*Vulkan*)
|
||||
# Vulkan setup needs to be run in batch environment
|
||||
# Need to subshell this or else it doesn't wait
|
||||
download_and_verify "$url" "$VULKAN_SDK_SHA" "sha256" "$fileName"
|
||||
cp "$DEPS_CACHE_DIR/$fileName" .
|
||||
cp "$CACHE_DIR/$fileName" .
|
||||
_=$(echo "$fileName --accept-licenses --default-answer --confirm-command install" | cmd)
|
||||
continue
|
||||
;;
|
||||
@@ -94,15 +92,9 @@ for url in $DEP_URLS; do
|
||||
esac
|
||||
|
||||
download_and_verify "$url" "$checksum" "$algo" "$fileName"
|
||||
7z x -y "$DEPS_CACHE_DIR/$fileName" -aos -o"$outDir"
|
||||
7z x -y "$CACHE_DIR/$fileName" -aos -o"$outDir"
|
||||
done
|
||||
|
||||
# Setup ccache tool
|
||||
[ -d "$CCACHE_DIR" ] || mkdir -p "$(cygpath -u "$CCACHE_DIR")"
|
||||
CCACHE_SH_DIR=$(cygpath -u "$CCACHE_BIN_DIR")
|
||||
mv "$CCACHE_SH_DIR"/ccache-*/* "$CCACHE_SH_DIR"
|
||||
cp "$CCACHE_SH_DIR"/ccache.exe "$CCACHE_SH_DIR"/cl.exe
|
||||
|
||||
# Gather explicit version number and number of commits
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
@@ -111,24 +103,16 @@ COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
# Format the above into filenames
|
||||
if [ -n "$PR_NUMBER" ]; then
|
||||
AVVER="${COMM_TAG}-${COMM_HASH}"
|
||||
BUILD_RAW="rpcs3-v${AVVER}_win64"
|
||||
BUILD="${BUILD_RAW}.7z"
|
||||
BUILD="rpcs3-v${AVVER}_win64.7z"
|
||||
else
|
||||
AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
BUILD_RAW="rpcs3-v${AVVER}-${COMM_HASH}_win64"
|
||||
BUILD="${BUILD_RAW}.7z"
|
||||
BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z"
|
||||
fi
|
||||
|
||||
# BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp.
|
||||
# BUILD is the name of the release artifact
|
||||
# BUILD_RAW is just filename
|
||||
# AVVER is used for GitHub releases, it is the version number.
|
||||
BRANCH="${REPO_NAME}/${REPO_BRANCH}"
|
||||
|
||||
# SC2129
|
||||
{
|
||||
echo "BRANCH=$BRANCH"
|
||||
echo "BUILD=$BUILD"
|
||||
echo "BUILD_RAW=$BUILD_RAW"
|
||||
echo "AVVER=$AVVER"
|
||||
} >> .ci/ci-vars.env
|
||||
echo "BRANCH=$BRANCH" > .ci/ci-vars.env
|
||||
echo "BUILD=$BUILD" >> .ci/ci-vars.env
|
||||
echo "AVVER=$AVVER" >> .ci/ci-vars.env
|
||||
|
||||
+39
-39
@@ -7,7 +7,7 @@ env:
|
||||
BUILD_SOURCEBRANCHNAME: $CIRRUS_BRANCH
|
||||
RPCS3_TOKEN: ENCRYPTED[100ebb8e3552bf2021d0ef55dccda3e58d27be5b6cab0b0b92843ef490195d3c4edaefa087e4a3b425caa6392300b9b1]
|
||||
QT_VER_MAIN: '6'
|
||||
QT_VER: '6.8.2'
|
||||
QT_VER: '6.8.1'
|
||||
|
||||
# windows_task:
|
||||
# matrix:
|
||||
@@ -21,7 +21,7 @@ env:
|
||||
# COMPILER: msvc
|
||||
# BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}\artifacts\
|
||||
# QT_VER_MSVC: 'msvc2022'
|
||||
# QT_DATE: '202501260838'
|
||||
# QT_DATE: '202411221531'
|
||||
# QTDIR: C:\Qt\${QT_VER}\${QT_VER_MSVC}_64
|
||||
# VULKAN_VER: '1.3.268.0'
|
||||
# VULKAN_SDK_SHA: '8459ef49bd06b697115ddd3d97c9aec729e849cd775f5be70897718a9b3b9db5'
|
||||
@@ -56,7 +56,7 @@ env:
|
||||
|
||||
# linux_task:
|
||||
# container:
|
||||
# image: rpcs3/rpcs3-ci-jammy:1.1
|
||||
# image: rpcs3/rpcs3-ci-focal:1.9
|
||||
# cpu: 4
|
||||
# memory: 16G
|
||||
# env:
|
||||
@@ -103,7 +103,7 @@ freebsd_task:
|
||||
matrix:
|
||||
- name: Cirrus FreeBSD
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-4
|
||||
image_family: freebsd-13-3
|
||||
cpu: 8
|
||||
memory: 8G
|
||||
env:
|
||||
@@ -114,38 +114,38 @@ freebsd_task:
|
||||
install_script: "sh -ex ./.ci/install-freebsd.sh"
|
||||
script: "./.ci/build-freebsd.sh"
|
||||
|
||||
# linux_aarch64_task:
|
||||
# env:
|
||||
# BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts
|
||||
# ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/
|
||||
# CCACHE_DIR: "/tmp/ccache_dir"
|
||||
# CCACHE_MAXSIZE: 300M
|
||||
# CI_HAS_ARTIFACTS: true
|
||||
# UPLOAD_COMMIT_HASH: a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1
|
||||
# UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux-arm64"
|
||||
# DEPLOY_APPIMAGE: true
|
||||
# APPDIR: "./appdir"
|
||||
# RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
|
||||
# COMPILER: clang
|
||||
# ccache_cache:
|
||||
# folder: "/tmp/ccache_dir"
|
||||
# matrix:
|
||||
# - name: Cirrus Linux AArch64 Clang
|
||||
# arm_container:
|
||||
# image: 'docker.io/rpcs3/rpcs3-ci-jammy-aarch64:1.1'
|
||||
# cpu: 8
|
||||
# memory: 8G
|
||||
# clang_script:
|
||||
# - mkdir artifacts
|
||||
# - "sh -ex ./.ci/build-linux-aarch64.sh"
|
||||
# artifacts:
|
||||
# name: Artifact
|
||||
# path: "artifacts/*"
|
||||
# push_script: |
|
||||
# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
|
||||
# COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
# COMM_COUNT=$(git rev-list --count HEAD)
|
||||
# COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
# export AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
# .ci/github-upload.sh
|
||||
# fi;
|
||||
linux_aarch64_task:
|
||||
env:
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts
|
||||
ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/
|
||||
CCACHE_DIR: "/tmp/ccache_dir"
|
||||
CCACHE_MAXSIZE: 300M
|
||||
CI_HAS_ARTIFACTS: true
|
||||
UPLOAD_COMMIT_HASH: a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1
|
||||
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux-arm64"
|
||||
DEPLOY_APPIMAGE: true
|
||||
APPDIR: "./appdir"
|
||||
RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
|
||||
COMPILER: clang
|
||||
ccache_cache:
|
||||
folder: "/tmp/ccache_dir"
|
||||
matrix:
|
||||
- name: Cirrus Linux AArch64 Clang
|
||||
arm_container:
|
||||
image: 'docker.io/rpcs3/rpcs3-ci-focal-aarch64:1.0'
|
||||
cpu: 8
|
||||
memory: 8G
|
||||
clang_script:
|
||||
- mkdir artifacts
|
||||
- "sh -ex ./.ci/build-linux-aarch64.sh"
|
||||
artifacts:
|
||||
name: Artifact
|
||||
path: "artifacts/*"
|
||||
push_script: |
|
||||
if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
export AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
.ci/github-upload.sh
|
||||
fi;
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
name: Build RPCS3
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.cirrus.yml'
|
||||
- '.azure-pipelines.yml'
|
||||
- 'README.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '.cirrus.yml'
|
||||
- '.azure-pipelines.yml'
|
||||
- 'README.md'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
BUILD_REPOSITORY_NAME: ${{ github.repository }}
|
||||
BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }}
|
||||
BUILD_SOURCEVERSION: ${{ github.sha }}
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/
|
||||
|
||||
jobs:
|
||||
Linux_Build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
docker_img: "rpcs3/rpcs3-ci-jammy:1.1"
|
||||
build_sh: "/rpcs3/.ci/build-linux.sh"
|
||||
compiler: clang
|
||||
- os: ubuntu-24.04
|
||||
docker_img: "rpcs3/rpcs3-ci-jammy:1.1"
|
||||
build_sh: "/rpcs3/.ci/build-linux.sh"
|
||||
compiler: gcc
|
||||
- os: ubuntu-24.04-arm
|
||||
docker_img: "rpcs3/rpcs3-ci-jammy-aarch64:1.1"
|
||||
build_sh: "/rpcs3/.ci/build-linux-aarch64.sh"
|
||||
compiler: clang
|
||||
UPLOAD_COMMIT_HASH: a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1
|
||||
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux-arm64"
|
||||
name: RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/ccache
|
||||
CI_HAS_ARTIFACTS: true
|
||||
DEPLOY_APPIMAGE: true
|
||||
APPDIR: "/rpcs3/build/appdir"
|
||||
ARTDIR: "/root/artifacts"
|
||||
RELEASE_MESSAGE: "/rpcs3/GitHubReleaseMessage.txt"
|
||||
COMPILER: ${{ matrix.compiler }}
|
||||
UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }}
|
||||
UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Cache
|
||||
uses: actions/cache@main
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ runner.arch }}-${{github.run_id}}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ runner.arch }}-
|
||||
|
||||
- name: Docker setup and build
|
||||
run: |
|
||||
docker pull --quiet ${{ matrix.docker_img }}
|
||||
docker run \
|
||||
-v $PWD:/rpcs3 \
|
||||
--env-file .ci/docker.env \
|
||||
-v ${{ env.CCACHE_DIR }}:/root/.ccache \
|
||||
-v ${{ github.workspace }}/artifacts:/root/artifacts \
|
||||
${{ matrix.docker_img }} \
|
||||
${{ matrix.build_sh }}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: RPCS3 for Linux (${{ runner.arch }}, ${{ matrix.compiler }})
|
||||
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.AppImage
|
||||
compression-level: 0
|
||||
|
||||
- name: Deploy master build to GitHub Releases
|
||||
if: |
|
||||
github.event_name != 'pull_request' &&
|
||||
github.repository == 'RPCS3/rpcs3' &&
|
||||
github.ref == 'refs/heads/master' &&
|
||||
matrix.compiler == 'clang' &&
|
||||
runner.arch == 'ARM64'
|
||||
env:
|
||||
RPCS3_TOKEN: ${{ secrets.RPCS3_TOKEN }}
|
||||
run: |
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
export AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
.ci/github-upload.sh
|
||||
|
||||
Windows_Build:
|
||||
name: RPCS3 Windows
|
||||
runs-on: windows-2025
|
||||
env:
|
||||
COMPILER: msvc
|
||||
QT_VER_MAIN: '6'
|
||||
QT_VER: '6.8.2'
|
||||
QT_VER_MSVC: 'msvc2022'
|
||||
QT_DATE: '202501260838'
|
||||
VULKAN_VER: '1.3.268.0'
|
||||
VULKAN_SDK_SHA: '8459ef49bd06b697115ddd3d97c9aec729e849cd775f5be70897718a9b3b9db5'
|
||||
CCACHE_SHA: '6252f081876a9a9f700fae13a5aec5d0d486b28261d7f1f72ac11c7ad9df4da9'
|
||||
CCACHE_BIN_DIR: 'C:\ccache_bin'
|
||||
CCACHE_DIR: 'C:\ccache'
|
||||
CCACHE_INODECACHE: 'true'
|
||||
CCACHE_SLOPPINESS: 'time_macros'
|
||||
DEPS_CACHE_DIR: ./dependency_cache
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup env
|
||||
run: |
|
||||
echo "QTDIR=C:\Qt\${{ env.QT_VER }}\${{ env.QT_VER_MSVC }}_64" >> ${{ github.env }}
|
||||
echo "VULKAN_SDK=C:\VulkanSDK\${{ env.VULKAN_VER }}" >> ${{ github.env }}
|
||||
|
||||
- name: Get Cache Keys
|
||||
shell: bash
|
||||
run: .ci/get_keys-windows.sh
|
||||
|
||||
- name: Setup Build Ccache
|
||||
uses: actions/cache@main
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: "${{ runner.os }}-ccache-${{ env.COMPILER }}-${{github.run_id}}"
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ env.COMPILER }}-
|
||||
|
||||
- name: Setup Dependencies Cache
|
||||
uses: actions/cache@main
|
||||
with:
|
||||
path: ${{ env.DEPS_CACHE_DIR }}
|
||||
key: "${{ runner.os }}-${{ env.COMPILER }}-${{ env.QT_VER }}-${{ env.VULKAN_SDK_SHA }}-${{ env.CCACHE_SHA }}-${{ hashFiles('llvm.lock') }}-${{ hashFiles('glslang.lock') }}"
|
||||
restore-keys: ${{ runner.os }}-${{ env.COMPILER }}-
|
||||
|
||||
- name: Download and unpack dependencies
|
||||
shell: bash
|
||||
run: .ci/setup-windows.sh
|
||||
|
||||
- name: Export Variables
|
||||
shell: bash
|
||||
run: |
|
||||
while IFS='=' read -r key val; do
|
||||
# Skip lines that are empty or start with '#'
|
||||
[[ -z "$key" || "$key" =~ ^# ]] && continue
|
||||
echo "$key=$val" >> "${{ github.env }}"
|
||||
done < .ci/ci-vars.env
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@main
|
||||
|
||||
- name: Compile RPCS3
|
||||
run: msbuild rpcs3.sln /p:Configuration=Release /p:Platform=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_no_debug_info.targets"
|
||||
|
||||
- name: Pack up build artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p "${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}"
|
||||
.ci/deploy-windows.sh
|
||||
|
||||
- name: Upload artifacts (7z)
|
||||
#TODO: Upload artifact to release repository
|
||||
#condition for release
|
||||
#if: |
|
||||
# github.event_name != 'pull_request' &&
|
||||
# github.repository == 'RPCS3/rpcs3' &&
|
||||
# github.ref == 'refs/heads/master'
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: RPCS3 for Windows (MSVC)
|
||||
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
|
||||
compression-level: 0
|
||||
if-no-files-found: error
|
||||
@@ -28,6 +28,10 @@
|
||||
path = 3rdparty/pugixml
|
||||
url = ../../zeux/pugixml.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/xxHash"]
|
||||
path = 3rdparty/xxHash
|
||||
url = ../../Cyan4973/xxHash.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/yaml-cpp"]
|
||||
path = 3rdparty/yaml-cpp/yaml-cpp
|
||||
url = ../../RPCS3/yaml-cpp.git
|
||||
|
||||
Vendored
+16
-5
@@ -87,16 +87,27 @@ endif()
|
||||
add_subdirectory(hidapi)
|
||||
|
||||
|
||||
# glslang
|
||||
# Vulkan
|
||||
add_subdirectory(glslang EXCLUDE_FROM_ALL)
|
||||
add_library(3rdparty_glslang INTERFACE)
|
||||
target_link_libraries(3rdparty_glslang INTERFACE SPIRV)
|
||||
|
||||
|
||||
# yaml-cpp
|
||||
add_subdirectory(yaml-cpp)
|
||||
|
||||
|
||||
# xxHash
|
||||
if (USE_SYSTEM_XXHASH)
|
||||
pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
|
||||
add_library(xxhash INTERFACE)
|
||||
target_link_libraries(xxhash INTERFACE PkgConfig::XXHASH)
|
||||
else()
|
||||
set(XXHASH_BUNDLED_MODE ON)
|
||||
set(XXHASH_BUILD_XXHSUM OFF)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Make xxHash build static libs")
|
||||
add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
|
||||
target_include_directories(xxhash INTERFACE xxHash)
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
|
||||
find_package(OpenGL REQUIRED OPTIONAL_COMPONENTS EGL)
|
||||
@@ -179,7 +190,7 @@ if(USE_VULKAN)
|
||||
if(VULKAN_FOUND)
|
||||
add_library(3rdparty_vulkan INTERFACE)
|
||||
target_compile_definitions(3rdparty_vulkan INTERFACE -DHAVE_VULKAN)
|
||||
target_link_libraries(3rdparty_vulkan INTERFACE Vulkan::Vulkan)
|
||||
target_link_libraries(3rdparty_vulkan INTERFACE SPIRV Vulkan::Vulkan)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Wayland)
|
||||
@@ -349,8 +360,8 @@ add_library(3rdparty::zstd ALIAS 3rdparty_zstd)
|
||||
add_library(3rdparty::7zip ALIAS 3rdparty_7zip)
|
||||
add_library(3rdparty::flatbuffers ALIAS 3rdparty_flatbuffers)
|
||||
add_library(3rdparty::pugixml ALIAS pugixml)
|
||||
add_library(3rdparty::glslang ALIAS 3rdparty_glslang)
|
||||
add_library(3rdparty::yaml-cpp ALIAS yaml-cpp)
|
||||
add_library(3rdparty::xxhash ALIAS xxhash)
|
||||
add_library(3rdparty::hidapi ALIAS 3rdparty_hidapi)
|
||||
add_library(3rdparty::libpng ALIAS ${LIBPNG_TARGET})
|
||||
add_library(3rdparty::opengl ALIAS 3rdparty_opengl)
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/FAudio updated: af74e661c1...707114aef2
Vendored
+2
-2
@@ -49,11 +49,11 @@
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="./Release" -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DFORCE_STATIC_VCRT=true -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="./Release" -DCMAKE_SYSTEM_VERSION=6.1 -DLIBTYPE=STATIC -DFORCE_STATIC_VCRT=true -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
|
||||
</CmakeReleaseCLI>
|
||||
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="./Debug" -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="./Debug" -DCMAKE_SYSTEM_VERSION=6.1 -DLIBTYPE=STATIC -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
|
||||
</CmakeDebugCLI>
|
||||
<CmakeCopyCLI>
|
||||
echo Copying..
|
||||
|
||||
Vendored
-170
@@ -1,170 +0,0 @@
|
||||
// Based on https://github.com/iOrange/bcdec/blob/963c5e56b7a335e066cff7d16a3de75f4e8ad366/bcdec.h
|
||||
// provides functions to decompress blocks of BC compressed images
|
||||
//
|
||||
// ------------------------------------------------------------------------------
|
||||
//
|
||||
// MIT LICENSE
|
||||
// ===========
|
||||
// Copyright (c) 2022 Sergii Kudlai
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <util/types.hpp>
|
||||
|
||||
static void bcdec__color_block(const u8* compressedBlock, u8* dstColors, int destinationPitch, bool onlyOpaqueMode) {
|
||||
u16 c0, c1;
|
||||
u32 refColors[4]; /* 0xAABBGGRR */
|
||||
u32 colorIndices;
|
||||
u32 r0, g0, b0, r1, g1, b1, r, g, b;
|
||||
|
||||
c0 = *reinterpret_cast<const u16*>(compressedBlock);
|
||||
c1 = *(reinterpret_cast<const u16*>(compressedBlock) + 1);
|
||||
|
||||
/* Unpack 565 ref colors */
|
||||
r0 = (c0 >> 11) & 0x1F;
|
||||
g0 = (c0 >> 5) & 0x3F;
|
||||
b0 = c0 & 0x1F;
|
||||
|
||||
r1 = (c1 >> 11) & 0x1F;
|
||||
g1 = (c1 >> 5) & 0x3F;
|
||||
b1 = c1 & 0x1F;
|
||||
|
||||
/* Expand 565 ref colors to 888 */
|
||||
r = (r0 * 527 + 23) >> 6;
|
||||
g = (g0 * 259 + 33) >> 6;
|
||||
b = (b0 * 527 + 23) >> 6;
|
||||
refColors[0] = 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
|
||||
r = (r1 * 527 + 23) >> 6;
|
||||
g = (g1 * 259 + 33) >> 6;
|
||||
b = (b1 * 527 + 23) >> 6;
|
||||
refColors[1] = 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
|
||||
if (c0 > c1 || onlyOpaqueMode)
|
||||
{ /* Standard BC1 mode (also BC3 color block uses ONLY this mode) */
|
||||
/* color_2 = 2/3*color_0 + 1/3*color_1
|
||||
color_3 = 1/3*color_0 + 2/3*color_1 */
|
||||
r = ((2 * r0 + r1) * 351 + 61) >> 7;
|
||||
g = ((2 * g0 + g1) * 2763 + 1039) >> 11;
|
||||
b = ((2 * b0 + b1) * 351 + 61) >> 7;
|
||||
refColors[2] = 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
|
||||
r = ((r0 + r1 * 2) * 351 + 61) >> 7;
|
||||
g = ((g0 + g1 * 2) * 2763 + 1039) >> 11;
|
||||
b = ((b0 + b1 * 2) * 351 + 61) >> 7;
|
||||
refColors[3] = 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
else
|
||||
{ /* Quite rare BC1A mode */
|
||||
/* color_2 = 1/2*color_0 + 1/2*color_1;
|
||||
color_3 = 0; */
|
||||
r = ((r0 + r1) * 1053 + 125) >> 8;
|
||||
g = ((g0 + g1) * 4145 + 1019) >> 11;
|
||||
b = ((b0 + b1) * 1053 + 125) >> 8;
|
||||
refColors[2] = 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
|
||||
refColors[3] = 0x00000000;
|
||||
}
|
||||
|
||||
colorIndices = *reinterpret_cast<const u32*>(compressedBlock + 4);
|
||||
|
||||
/* Fill out the decompressed color block */
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
int idx = colorIndices & 0x03;
|
||||
*reinterpret_cast<u32*>(dstColors + j * 4) = refColors[idx];
|
||||
colorIndices >>= 2;
|
||||
}
|
||||
|
||||
dstColors += destinationPitch;
|
||||
}
|
||||
}
|
||||
|
||||
static void bcdec__sharp_alpha_block(const u16* alpha, u8* decompressed, int destinationPitch) {
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
decompressed[j * 4] = ((alpha[i] >> (4 * j)) & 0x0F) * 17;
|
||||
}
|
||||
decompressed += destinationPitch;
|
||||
}
|
||||
}
|
||||
|
||||
static void bcdec__smooth_alpha_block(const u8* compressedBlock, u8* decompressed, int destinationPitch) {
|
||||
u8 alpha[8];
|
||||
u64 block = *reinterpret_cast<const u64*>(compressedBlock);
|
||||
u64 indices;
|
||||
|
||||
alpha[0] = block & 0xFF;
|
||||
alpha[1] = (block >> 8) & 0xFF;
|
||||
|
||||
if (alpha[0] > alpha[1])
|
||||
{
|
||||
/* 6 interpolated alpha values. */
|
||||
alpha[2] = (6 * alpha[0] + alpha[1]) / 7; /* 6/7*alpha_0 + 1/7*alpha_1 */
|
||||
alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; /* 5/7*alpha_0 + 2/7*alpha_1 */
|
||||
alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; /* 4/7*alpha_0 + 3/7*alpha_1 */
|
||||
alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; /* 3/7*alpha_0 + 4/7*alpha_1 */
|
||||
alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; /* 2/7*alpha_0 + 5/7*alpha_1 */
|
||||
alpha[7] = ( alpha[0] + 6 * alpha[1]) / 7; /* 1/7*alpha_0 + 6/7*alpha_1 */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 4 interpolated alpha values. */
|
||||
alpha[2] = (4 * alpha[0] + alpha[1]) / 5; /* 4/5*alpha_0 + 1/5*alpha_1 */
|
||||
alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; /* 3/5*alpha_0 + 2/5*alpha_1 */
|
||||
alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; /* 2/5*alpha_0 + 3/5*alpha_1 */
|
||||
alpha[5] = ( alpha[0] + 4 * alpha[1]) / 5; /* 1/5*alpha_0 + 4/5*alpha_1 */
|
||||
alpha[6] = 0x00;
|
||||
alpha[7] = 0xFF;
|
||||
}
|
||||
|
||||
indices = block >> 16;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
decompressed[j * 4] = alpha[indices & 0x07];
|
||||
indices >>= 3;
|
||||
}
|
||||
decompressed += destinationPitch;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bcdec_bc1(const u8* compressedBlock, u8* decompressedBlock, int destinationPitch) {
|
||||
bcdec__color_block(compressedBlock, decompressedBlock, destinationPitch, false);
|
||||
}
|
||||
|
||||
static inline void bcdec_bc2(const u8* compressedBlock, u8* decompressedBlock, int destinationPitch) {
|
||||
bcdec__color_block(compressedBlock + 8, decompressedBlock, destinationPitch, true);
|
||||
bcdec__sharp_alpha_block(reinterpret_cast<const u16*>(compressedBlock), decompressedBlock + 3, destinationPitch);
|
||||
}
|
||||
|
||||
static inline void bcdec_bc3(const u8* compressedBlock, u8* decompressedBlock, int destinationPitch) {
|
||||
bcdec__color_block(compressedBlock + 8, decompressedBlock, destinationPitch, true);
|
||||
bcdec__smooth_alpha_block(compressedBlock, decompressedBlock + 3, destinationPitch);
|
||||
}
|
||||
|
||||
Vendored
+10
-3
@@ -11,13 +11,12 @@ else()
|
||||
set(BUILD_STATIC_CURL OFF CACHE BOOL "Set to ON to build curl executable with static libcurl.")
|
||||
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libcurl.")
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Set to ON to build shared libcurl.")
|
||||
find_package(WolfSSL REQUIRED)
|
||||
set(CURL_USE_WOLFSSL ON CACHE BOOL "enable wolfSSL for SSL/TLS")
|
||||
# If set to ON then CURL can not find our wolfssl
|
||||
set(CURL_USE_WOLFSSL OFF CACHE BOOL "enable wolfSSL for SSL/TLS")
|
||||
set(CURL_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
|
||||
set(HTTP_ONLY ON CACHE BOOL "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)")
|
||||
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'.")
|
||||
option(CURL_DISABLE_INSTALL "Disable installation targets" ON)
|
||||
if(USE_MSVC_STATIC_CRT)
|
||||
set(CURL_STATIC_CRT ON CACHE BOOL "Use static crt to build curl")
|
||||
endif()
|
||||
@@ -27,10 +26,18 @@ else()
|
||||
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)
|
||||
set(SHARE_LIB_OBJECT OFF)
|
||||
set(CURL_DISABLE_TESTS ON)
|
||||
|
||||
add_subdirectory(curl EXCLUDE_FROM_ALL)
|
||||
|
||||
target_link_libraries(libcurl_static PRIVATE wolfssl)
|
||||
if(MSVC)
|
||||
target_compile_definitions(libcurl_static PRIVATE HAVE_SSIZE_T)
|
||||
endif()
|
||||
|
||||
add_library(3rdparty_libcurl INTERFACE)
|
||||
target_link_libraries(3rdparty_libcurl INTERFACE libcurl_static)
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/curl/curl updated: 57495c6487...75a2079d5c
Vendored
+5
-12
@@ -66,6 +66,7 @@
|
||||
<ClCompile Include="curl\lib\base64.c" />
|
||||
<ClCompile Include="curl\lib\bufq.c" />
|
||||
<ClCompile Include="curl\lib\bufref.c" />
|
||||
<ClCompile Include="curl\lib\c-hyper.c" />
|
||||
<ClCompile Include="curl\lib\cf-h1-proxy.c" />
|
||||
<ClCompile Include="curl\lib\cf-h2-proxy.c" />
|
||||
<ClCompile Include="curl\lib\cf-haproxy.c" />
|
||||
@@ -123,7 +124,6 @@
|
||||
<ClCompile Include="curl\lib\http.c" />
|
||||
<ClCompile Include="curl\lib\http1.c" />
|
||||
<ClCompile Include="curl\lib\http2.c" />
|
||||
<ClCompile Include="curl\lib\httpsrr.c" />
|
||||
<ClCompile Include="curl\lib\http_aws_sigv4.c" />
|
||||
<ClCompile Include="curl\lib\http_chunks.c" />
|
||||
<ClCompile Include="curl\lib\http_digest.c" />
|
||||
@@ -175,7 +175,6 @@
|
||||
<ClCompile Include="curl\lib\strcase.c" />
|
||||
<ClCompile Include="curl\lib\strdup.c" />
|
||||
<ClCompile Include="curl\lib\strerror.c" />
|
||||
<ClCompile Include="curl\lib\strparse.c" />
|
||||
<ClCompile Include="curl\lib\strtok.c" />
|
||||
<ClCompile Include="curl\lib\strtoofft.c" />
|
||||
<ClCompile Include="curl\lib\system_win32.c" />
|
||||
@@ -192,11 +191,8 @@
|
||||
<ClCompile Include="curl\lib\vquic\curl_msh3.c" />
|
||||
<ClCompile Include="curl\lib\vquic\curl_ngtcp2.c" />
|
||||
<ClCompile Include="curl\lib\vquic\curl_quiche.c" />
|
||||
<ClCompile Include="curl\lib\vtls\cipher_suite.c" />
|
||||
<ClCompile Include="curl\lib\vtls\hostcheck.c" />
|
||||
<ClCompile Include="curl\lib\vtls\rustls.c" />
|
||||
<ClCompile Include="curl\lib\vtls\vtls_scache.c" />
|
||||
<ClCompile Include="curl\lib\vtls\vtls_spack.c" />
|
||||
<ClCompile Include="curl\lib\vtls\x509asn1.c" />
|
||||
<ClCompile Include="curl\lib\warnless.c" />
|
||||
<ClCompile Include="curl\lib\vauth\cleartext.c" />
|
||||
@@ -245,17 +241,21 @@
|
||||
<ClInclude Include="curl\lib\asyn.h" />
|
||||
<ClInclude Include="curl\lib\bufq.h" />
|
||||
<ClInclude Include="curl\lib\bufref.h" />
|
||||
<ClInclude Include="curl\lib\c-hyper.h" />
|
||||
<ClInclude Include="curl\lib\cf-h1-proxy.h" />
|
||||
<ClInclude Include="curl\lib\cf-h2-proxy.h" />
|
||||
<ClInclude Include="curl\lib\cf-haproxy.h" />
|
||||
<ClInclude Include="curl\lib\cf-https-connect.h" />
|
||||
<ClInclude Include="curl\lib\cf-socket.h" />
|
||||
<ClInclude Include="curl\lib\cfilters.h" />
|
||||
<ClInclude Include="curl\lib\config-amigaos.h" />
|
||||
<ClInclude Include="curl\lib\config-dos.h" />
|
||||
<ClInclude Include="curl\lib\config-mac.h" />
|
||||
<ClInclude Include="curl\lib\config-os400.h" />
|
||||
<ClInclude Include="curl\lib\config-plan9.h" />
|
||||
<ClInclude Include="curl\lib\config-riscos.h" />
|
||||
<ClInclude Include="curl\lib\config-win32.h" />
|
||||
<ClInclude Include="curl\lib\config-win32ce.h" />
|
||||
<ClInclude Include="curl\lib\conncache.h" />
|
||||
<ClInclude Include="curl\lib\connect.h" />
|
||||
<ClInclude Include="curl\lib\content_encoding.h" />
|
||||
@@ -315,7 +315,6 @@
|
||||
<ClInclude Include="curl\lib\http.h" />
|
||||
<ClInclude Include="curl\lib\http1.h" />
|
||||
<ClInclude Include="curl\lib\http2.h" />
|
||||
<ClInclude Include="curl\lib\httpsrr.h" />
|
||||
<ClInclude Include="curl\lib\http_aws_sigv4.h" />
|
||||
<ClInclude Include="curl\lib\http_chunks.h" />
|
||||
<ClInclude Include="curl\lib\http_digest.h" />
|
||||
@@ -364,7 +363,6 @@
|
||||
<ClInclude Include="curl\lib\strcase.h" />
|
||||
<ClInclude Include="curl\lib\strdup.h" />
|
||||
<ClInclude Include="curl\lib\strerror.h" />
|
||||
<ClInclude Include="curl\lib\strparse.h" />
|
||||
<ClInclude Include="curl\lib\strtok.h" />
|
||||
<ClInclude Include="curl\lib\strtoofft.h" />
|
||||
<ClInclude Include="curl\lib\system_win32.h" />
|
||||
@@ -381,13 +379,8 @@
|
||||
<ClInclude Include="curl\lib\vquic\curl_ngtcp2.h" />
|
||||
<ClInclude Include="curl\lib\vquic\curl_quiche.h" />
|
||||
<ClInclude Include="curl\lib\vquic\vquic_int.h" />
|
||||
<ClInclude Include="curl\lib\vtls\cipher_suite.h" />
|
||||
<ClInclude Include="curl\lib\vtls\hostcheck.h" />
|
||||
<ClInclude Include="curl\lib\vtls\rustls.h" />
|
||||
<ClInclude Include="curl\lib\vtls\schannel_int.h" />
|
||||
<ClInclude Include="curl\lib\vtls\vtls_int.h" />
|
||||
<ClInclude Include="curl\lib\vtls\vtls_scache.h" />
|
||||
<ClInclude Include="curl\lib\vtls\vtls_spack.h" />
|
||||
<ClInclude Include="curl\lib\vtls\x509asn1.h" />
|
||||
<ClInclude Include="curl\lib\warnless.h" />
|
||||
<ClInclude Include="curl\lib\vauth\digest.h" />
|
||||
|
||||
+15
-36
@@ -417,6 +417,9 @@
|
||||
<ClCompile Include="curl\lib\vtls\keylog.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\c-hyper.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\easygetopt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -507,21 +510,6 @@
|
||||
<ClCompile Include="curl\lib\curl_sha512_256.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\httpsrr.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\strparse.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\vtls\cipher_suite.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\vtls\vtls_scache.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\vtls\vtls_spack.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="curl\include\curl\curl.h">
|
||||
@@ -566,6 +554,12 @@
|
||||
<ClInclude Include="curl\lib\bufref.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\config-amigaos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\config-dos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\config-mac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -581,6 +575,9 @@
|
||||
<ClInclude Include="curl\lib\config-win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\config-win32ce.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\conncache.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -938,6 +935,9 @@
|
||||
<ClInclude Include="curl\lib\vtls\keylog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\c-hyper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\curl_krb5.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -1034,27 +1034,6 @@
|
||||
<ClInclude Include="curl\lib\curl_sha512_256.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\httpsrr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\strparse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\vtls\cipher_suite.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\vtls\schannel_int.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\vtls\vtls_int.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\vtls\vtls_scache.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\vtls\vtls_spack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="curl\lib\libcurl.rc">
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/fusion/fusion updated: 066d4a63b2...fecf2f0af3
Vendored
+1
-1
Submodule 3rdparty/hidapi/hidapi updated: 6bfdcf7368...8b43a97a93
Vendored
+5
@@ -4,6 +4,11 @@ if (NOT USE_SYSTEM_LIBPNG)
|
||||
# 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")
|
||||
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests")
|
||||
if (NOT USE_SYSTEM_ZLIB)
|
||||
set(PNG_BUILD_ZLIB ON CACHE BOOL "Custom zlib location, else find_package is used")
|
||||
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
|
||||
target_link_libraries(ZLIB::ZLIB INTERFACE 3rdparty_zlib)
|
||||
endif()
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
add_subdirectory(libpng EXCLUDE_FROM_ALL)
|
||||
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/libpng/libpng updated: 872555f4ba...51f5bd68b9
Vendored
+2
@@ -68,6 +68,7 @@
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<StringPooling>true</StringPooling>
|
||||
<DisableSpecificWarnings>$(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
@@ -90,6 +91,7 @@
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/libsdl-org/SDL updated: 7a44b1ab00...fa24d868ac
Vendored
+13
-13
@@ -6,15 +6,15 @@ if(WITH_LLVM)
|
||||
message(STATUS "LLVM will be built from the submodule.")
|
||||
|
||||
set(LLVM_TARGETS_TO_BUILD "AArch64;X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||
option(LLVM_BUILD_RUNTIME "Build the LLVM runtime libraries." OFF)
|
||||
option(LLVM_BUILD_TOOLS "Build the LLVM tools. If OFF, just generate build targets." OFF)
|
||||
option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." OFF)
|
||||
option(LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." OFF)
|
||||
option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" OFF)
|
||||
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." OFF)
|
||||
option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." OFF)
|
||||
option(LLVM_INCLUDE_UTILS "Generate build targets for the LLVM utils." OFF)
|
||||
option(LLVM_CCACHE_BUILD "Set to ON for a ccache enabled build" OFF)
|
||||
option(LLVM_BUILD_RUNTIME OFF)
|
||||
option(LLVM_BUILD_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_BENCHMARKS OFF)
|
||||
option(LLVM_INCLUDE_DOCS OFF)
|
||||
option(LLVM_INCLUDE_EXAMPLES OFF)
|
||||
option(LLVM_INCLUDE_TESTS OFF)
|
||||
option(LLVM_INCLUDE_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_UTILS OFF)
|
||||
option(LLVM_CCACHE_BUILD OFF)
|
||||
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "Enable compiler warnings.")
|
||||
|
||||
# For Windows x86 (not Windows AArch64).
|
||||
@@ -41,7 +41,7 @@ if(WITH_LLVM)
|
||||
|
||||
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)
|
||||
|
||||
find_package(LLVM 19.1 CONFIG)
|
||||
find_package(LLVM 16.0 CONFIG)
|
||||
if(NOT LLVM_FOUND)
|
||||
message(FATAL_ERROR "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
|
||||
endif()
|
||||
@@ -59,8 +59,8 @@ if(WITH_LLVM)
|
||||
message(FATAL_ERROR "Can't find LLVM libraries from the CMAKE_PREFIX_PATH path or LLVM_DIR. \
|
||||
Enable BUILD_LLVM option to build LLVM from included as a git submodule.")
|
||||
endif()
|
||||
if (LLVM_VERSION VERSION_LESS 18)
|
||||
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 18 or above. \
|
||||
if (LLVM_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 16 or above. \
|
||||
Enable BUILD_LLVM option to build LLVM from included as a git submodule.")
|
||||
endif()
|
||||
endif()
|
||||
@@ -68,7 +68,7 @@ if(WITH_LLVM)
|
||||
if (STATIC_LINK_LLVM)
|
||||
if (NOT DEFINED LLVM_TARGETS_TO_BUILD)
|
||||
if(COMPILER_ARM)
|
||||
set(LLVM_TARGETS_TO_BUILD "AArch64" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||
set(LLVM_TARGETS_TO_BUILD "AArch64;X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||
else()
|
||||
set(LLVM_TARGETS_TO_BUILD "X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||
endif()
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/llvm/llvm updated: cd708029e0...cd89023f79
Vendored
+2
-2
@@ -40,11 +40,11 @@
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\llvm_build-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_BENCHMARKS=OFF -DLLVM_BUILD_DOCS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_BUILD_TESTS=OFF\ -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_INSTALL_UTILS=OFF -DLLVM_ENABLE_DIA_SDK=OFF -DLLVM_ENABLE_PDB=OFF -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
</CmakeReleaseCLI>
|
||||
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\llvm_build-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_BENCHMARKS=OFF -DLLVM_BUILD_DOCS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_BUILD_TESTS=OFF\ -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_INSTALL_UTILS=OFF -DLLVM_ENABLE_DIA_SDK=OFF -DLLVM_ENABLE_PDB=OFF -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
</CmakeDebugCLI>
|
||||
<CmakeCleanCLI>
|
||||
echo Cleaning..
|
||||
|
||||
+2
-2
@@ -40,11 +40,11 @@
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\llvm_build-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_BENCHMARKS=OFF -DLLVM_BUILD_DOCS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_BUILD_TESTS=OFF\ -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_INSTALL_UTILS=OFF -DLLVM_ENABLE_DIA_SDK=OFF -DLLVM_ENABLE_PDB=OFF -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
</CmakeReleaseCLI>
|
||||
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
|
||||
cd "$(SolutionDir)build\tmp\llvm_build-$(Configuration)-$(Platform)"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_BENCHMARKS=OFF -DLLVM_BUILD_DOCS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_BUILD_TESTS=OFF\ -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_INSTALL_UTILS=OFF -DLLVM_ENABLE_DIA_SDK=OFF -DLLVM_ENABLE_PDB=OFF -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_INTEL_JITEVENTS=ON "$(SolutionDir)3rdparty\llvm\llvm\llvm"
|
||||
</CmakeDebugCLI>
|
||||
<CmakeCleanCLI>
|
||||
echo Cleaning..
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ set(OPENCV_TARGET 3rdparty_dummy_lib PARENT_SCOPE)
|
||||
|
||||
if (USE_SYSTEM_OPENCV)
|
||||
message(STATUS "RPCS3: using system OpenCV")
|
||||
find_package(OpenCV COMPONENTS core photo)
|
||||
find_package(OpenCV)
|
||||
|
||||
if(OPENCV_FOUND)
|
||||
message(STATUS "RPCS3: found system OpenCV")
|
||||
|
||||
+1
Submodule 3rdparty/xxHash added at e626a72bc2
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{939FE206-1182-ABC3-1234-FEAB88E98404}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\common_default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\common_default_macros.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<PropertyGroup>
|
||||
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\rpcs3_default.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\rpcs3_debug.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\rpcs3_release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="xxHash/xxhash.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="LICENSE" />
|
||||
<Text Include="CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="xxHash/xxhash.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Vendored
+2
@@ -84,6 +84,7 @@
|
||||
<WarningLevel>$(WarningLevel)</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<DisableSpecificWarnings>$(DisableSpecificWarnings);4127;4131;4242;4244</DisableSpecificWarnings>
|
||||
<TreatWarningAsError>$(TreatWarningAsError)</TreatWarningAsError>
|
||||
@@ -101,6 +102,7 @@
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<DisableSpecificWarnings>$(DisableSpecificWarnings);4127;4131;4242;4244</DisableSpecificWarnings>
|
||||
<TreatWarningAsError>$(TreatWarningAsError)</TreatWarningAsError>
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/zstd/zstd updated: f8745da6ff...97291fc502
Vendored
-19
@@ -58,7 +58,6 @@
|
||||
<ClCompile Include=".\zstd\programs\lorem.c" />
|
||||
<ClCompile Include=".\zstd\programs\zstdcli.c" />
|
||||
<ClCompile Include=".\zstd\programs\zstdcli_trace.c" />
|
||||
<ClCompile Include="zstd\lib\compress\zstd_preSplit.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include=".\zstd\lib\common\pool.h" />
|
||||
@@ -98,24 +97,6 @@
|
||||
<ClInclude Include=".\zstd\programs\fileio.h" />
|
||||
<ClInclude Include=".\zstd\programs\platform.h" />
|
||||
<ClInclude Include=".\zstd\programs\util.h" />
|
||||
<ClInclude Include="zstd\lib\common\allocations.h" />
|
||||
<ClInclude Include="zstd\lib\common\bits.h" />
|
||||
<ClInclude Include="zstd\lib\common\bitstream.h" />
|
||||
<ClInclude Include="zstd\lib\common\compiler.h" />
|
||||
<ClInclude Include="zstd\lib\common\cpu.h" />
|
||||
<ClInclude Include="zstd\lib\common\debug.h" />
|
||||
<ClInclude Include="zstd\lib\common\error_private.h" />
|
||||
<ClInclude Include="zstd\lib\common\mem.h" />
|
||||
<ClInclude Include="zstd\lib\common\portability_macros.h" />
|
||||
<ClInclude Include="zstd\lib\common\zstd_deps.h" />
|
||||
<ClInclude Include="zstd\lib\common\zstd_trace.h" />
|
||||
<ClInclude Include="zstd\lib\compress\clevels.h" />
|
||||
<ClInclude Include="zstd\lib\compress\hist.h" />
|
||||
<ClInclude Include="zstd\lib\compress\zstd_compress_internal.h" />
|
||||
<ClInclude Include="zstd\lib\compress\zstd_ldm_geartab.h" />
|
||||
<ClInclude Include="zstd\lib\compress\zstd_preSplit.h" />
|
||||
<ClInclude Include="zstd\lib\decompress\zstd_decompress_block.h" />
|
||||
<ClInclude Include="zstd\lib\decompress\zstd_decompress_internal.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="zstd.rc" />
|
||||
|
||||
+6
-6
@@ -19,26 +19,26 @@ The following tools are required to build RPCS3 on Windows 10 or later:
|
||||
with standalone **CMake** tool.
|
||||
|
||||
- [Python 3.6+](https://www.python.org/downloads/) (add to PATH)
|
||||
- [Qt 6.8.2](https://www.qt.io/download-qt-installer) In case you can't download from the official installer, you can use [Another Qt installer](https://github.com/miurahr/aqtinstall) (In that case you will need to manually add the "qtmultimedia" module when installing Qt)
|
||||
- [Qt 6.8.1](https://www.qt.io/download-qt-installer) In case you can't download from the official installer, you can use [Another Qt installer](https://github.com/miurahr/aqtinstall) (In that case you will need to manually add the "qtmultimedia" module when installing Qt)
|
||||
- [Vulkan SDK 1.3.268.0](https://vulkan.lunarg.com/sdk/home) (see "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html)) for now future SDKs don't work. You need precisely 1.3.268.0.
|
||||
|
||||
The `sln` solution available only on **Visual Studio** is the preferred building solution. It easily allows to build the **RPCS3** application in `Release` and `Debug` mode.
|
||||
|
||||
In order to build **RPCS3** with the `sln` solution (with **Visual Studio**), **Qt** libs need to be detected. To detect the libs:
|
||||
- add and set the `QTDIR` environment variable, e.g. `<QtInstallFolder>\6.8.2\msvc2022_64\`
|
||||
- add and set the `QTDIR` environment variable, e.g. `<QtInstallFolder>\6.8.1\msvc2022_64\`
|
||||
- or use the [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2022)
|
||||
|
||||
**NOTE:** If you have issues with the **Visual Studio Qt Plugin**, you may want to uninstall it and install the [Legacy Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.LEGACYQtVisualStudioTools2022) instead.
|
||||
|
||||
In order to build **RPCS3** with the `CMake` solution (with both **Visual Studio** and standalone **CMake** tool):
|
||||
- add and set the `Qt6_ROOT` environment variable to the **Qt** libs path, e.g. `<QtInstallFolder>\6.8.2\msvc2022_64\`
|
||||
- add and set the `CMAKE_PREFIX_PATH` environment variable to the **Qt** libs path, e.g. `<QtInstallFolder>\6.8.1\msvc2022_64\`
|
||||
|
||||
### Linux
|
||||
|
||||
These are the essentials tools to build RPCS3 on Linux. Some of them can be installed through your favorite package manager:
|
||||
- Clang 17+ or GCC 13+
|
||||
- [CMake 3.28.0+](https://www.cmake.org/download/)
|
||||
- [Qt 6.8.2](https://www.qt.io/download-qt-installer)
|
||||
- [Qt 6.8.1](https://www.qt.io/download-qt-installer)
|
||||
- [Vulkan SDK 1.3.268.0](https://vulkan.lunarg.com/sdk/home) (See "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html)) for now future SDKs don't work. You need precisely 1.3.268.0.
|
||||
- [SDL2](https://github.com/libsdl-org/SDL/releases) (for the FAudio backend)
|
||||
|
||||
@@ -119,7 +119,7 @@ Start **Visual Studio**, click on `Open a project or solution` and select the `r
|
||||
##### Configuring the Qt Plugin (if used)
|
||||
|
||||
1) go to `Extensions->Qt VS Tools->Qt Versions`
|
||||
2) add the path to your Qt installation with compiler e.g. `<QtInstallFolder>\6.8.2\msvc2022_64`, version will fill in automatically
|
||||
2) add the path to your Qt installation with compiler e.g. `<QtInstallFolder>\6.8.1\msvc2022_64`, version will fill in automatically
|
||||
3) go to `Extensions->Qt VS Tools->Options->Legacy Project Format`. (Only available in the **Legacy Qt Plugin**)
|
||||
4) set `Build: Run pre-build setup` to `true`. (Only available in the **Legacy Qt Plugin**)
|
||||
|
||||
@@ -128,7 +128,7 @@ Start **Visual Studio**, click on `Open a project or solution` and select the `r
|
||||
**NOTE:** The recommended build configuration is `Release`. (On older revisions: `Release - LLVM`)
|
||||
|
||||
To speed up the compilation time, you may want to download and extract to `<rpcs3_root>\build\lib_ext\<$(Configuration)>-x64` (e.g. `c:\rpcs3\build\lib_ext\Release-x64`; the path needs to be created) some of the following precompiled libs:
|
||||
- [LLVM libs](https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-19.1.7/llvmlibs_mt.7z)
|
||||
- [LLVM libs](https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-16.0.1/llvmlibs_mt.7z)
|
||||
- [additional libs](https://github.com/RPCS3/glslang/releases/latest/download/glslanglibs_mt.7z)
|
||||
|
||||
**NOTES:**
|
||||
|
||||
@@ -30,7 +30,6 @@ option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF)
|
||||
option(USE_SYSTEM_OPENAL "Prefer system OpenAL instead of the prebuild one" ON)
|
||||
option(USE_SYSTEM_CURL "Prefer system Curl instead of the prebuild one" ON)
|
||||
option(USE_SYSTEM_OPENCV "Prefer system OpenCV instead of the builtin one" ON)
|
||||
option(USE_LTO "Use LTO for building" ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ struct ff_t : bf_base<T, N>
|
||||
#endif
|
||||
|
||||
template <typename T, uint I, uint N>
|
||||
struct fmt_unveil<bf_t<T, I, N>>
|
||||
struct fmt_unveil<bf_t<T, I, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<T>>::type;
|
||||
|
||||
@@ -267,7 +267,7 @@ struct fmt_unveil<bf_t<T, I, N>>
|
||||
};
|
||||
|
||||
template <typename F, typename... Fields>
|
||||
struct fmt_unveil<cf_t<F, Fields...>>
|
||||
struct fmt_unveil<cf_t<F, Fields...>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<typename F::type>>::type;
|
||||
|
||||
@@ -278,7 +278,7 @@ struct fmt_unveil<cf_t<F, Fields...>>
|
||||
};
|
||||
|
||||
template <typename T, T V, uint N>
|
||||
struct fmt_unveil<ff_t<T, V, N>>
|
||||
struct fmt_unveil<ff_t<T, V, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<std::common_type_t<T>>::type;
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,8 @@
|
||||
#include "File.h"
|
||||
#include "mutex.h"
|
||||
#include "StrFmt.h"
|
||||
#include "StrUtil.h"
|
||||
#include "Crypto/sha1.h"
|
||||
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
@@ -16,8 +18,6 @@ using namespace std::literals::string_literals;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
|
||||
#include <cwchar>
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once // No BOM and only basic ASCII in this header, or a neko will die
|
||||
|
||||
#include "util/serialization.hpp"
|
||||
#include "util/types.hpp"
|
||||
#include "util/shared_ptr.hpp"
|
||||
#include "bit_set.h"
|
||||
@@ -79,8 +78,6 @@ namespace fs
|
||||
constexpr bool operator==(const stat_t&) const = default;
|
||||
};
|
||||
|
||||
static_assert(utils::Bitcopy<stat_t>);
|
||||
|
||||
// Helper, layout is equal to iovec struct
|
||||
struct iovec_clone
|
||||
{
|
||||
@@ -129,8 +126,6 @@ namespace fs
|
||||
using enable_bitcopy = std::false_type;
|
||||
};
|
||||
|
||||
static_assert(!utils::Bitcopy<dir_entry>);
|
||||
|
||||
// Directory handle base
|
||||
struct dir_base
|
||||
{
|
||||
|
||||
+5
-13
@@ -77,7 +77,7 @@ struct jit_runtime_base
|
||||
jit_runtime_base& operator=(const jit_runtime_base&) = delete;
|
||||
|
||||
const asmjit::Environment& environment() const noexcept;
|
||||
void* _add(asmjit::CodeHolder* code, usz align = 64) noexcept;
|
||||
void* _add(asmjit::CodeHolder* code) noexcept;
|
||||
virtual uchar* _alloc(usz size, usz align) noexcept = 0;
|
||||
};
|
||||
|
||||
@@ -93,10 +93,6 @@ struct jit_runtime final : jit_runtime_base
|
||||
// Allocate memory
|
||||
static u8* alloc(usz size, usz align, bool exec = true) noexcept;
|
||||
|
||||
// Allocate 0 bytes, observe memory location
|
||||
// Same as alloc(0, 1, exec)
|
||||
static u8* peek(bool exec = true) noexcept;
|
||||
|
||||
// Should be called at least once after global initialization
|
||||
static void initialize();
|
||||
|
||||
@@ -436,7 +432,7 @@ namespace asmjit
|
||||
|
||||
// Build runtime function with asmjit::X86Assembler
|
||||
template <typename FT, typename Asm = native_asm, typename F>
|
||||
inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime* custom_runtime = nullptr, bool reduced_size = false)
|
||||
inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime* custom_runtime = nullptr)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
pthread_jit_write_protect_np(false);
|
||||
@@ -471,7 +467,6 @@ inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime*
|
||||
|
||||
Asm compiler(&code);
|
||||
compiler.addEncodingOptions(EncodingOptions::kOptimizedAlign);
|
||||
compiler.addEncodingOptions(EncodingOptions::kOptimizeForSize);
|
||||
if constexpr (std::is_invocable_r_v<bool, F, Asm&, native_args&>)
|
||||
{
|
||||
if (!builder(compiler, args))
|
||||
@@ -488,7 +483,7 @@ inline FT build_function_asm(std::string_view name, F&& builder, ::jit_runtime*
|
||||
compiler();
|
||||
}
|
||||
|
||||
const auto result = rt._add(&code, reduced_size ? 16 : 64);
|
||||
const auto result = rt._add(&code);
|
||||
jit_announce(result, code.codeSize(), name);
|
||||
return reinterpret_cast<FT>(uptr(result));
|
||||
}
|
||||
@@ -503,8 +498,6 @@ namespace llvm
|
||||
class StringRef;
|
||||
}
|
||||
|
||||
enum class thread_state : u32;
|
||||
|
||||
// Temporary compiler interface
|
||||
class jit_compiler final
|
||||
{
|
||||
@@ -521,9 +514,8 @@ class jit_compiler final
|
||||
atomic_t<usz> m_disk_space = umax;
|
||||
|
||||
public:
|
||||
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags = 0, std::function<u64(const std::string&)> symbols_cement = {}) noexcept;
|
||||
jit_compiler& operator=(thread_state) noexcept;
|
||||
~jit_compiler() noexcept;
|
||||
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags = 0);
|
||||
~jit_compiler();
|
||||
|
||||
// Get LLVM context
|
||||
auto& get_context()
|
||||
|
||||
+2
-25
@@ -147,12 +147,6 @@ static u8* add_jit_memory(usz size, usz align)
|
||||
return pointer;
|
||||
}
|
||||
|
||||
if (!size && align == 1)
|
||||
{
|
||||
// Return memory top address
|
||||
return pointer + (Ctr.load() & 0xffff'ffff);
|
||||
}
|
||||
|
||||
u64 olda, newa;
|
||||
|
||||
// Simple allocation by incrementing pointer to the next free data
|
||||
@@ -217,7 +211,7 @@ const asmjit::Environment& jit_runtime_base::environment() const noexcept
|
||||
return g_env;
|
||||
}
|
||||
|
||||
void* jit_runtime_base::_add(asmjit::CodeHolder* code, usz align) noexcept
|
||||
void* jit_runtime_base::_add(asmjit::CodeHolder* code) noexcept
|
||||
{
|
||||
ensure(!code->flatten());
|
||||
ensure(!code->resolveUnresolvedLinks());
|
||||
@@ -225,7 +219,7 @@ void* jit_runtime_base::_add(asmjit::CodeHolder* code, usz align) noexcept
|
||||
if (!codeSize)
|
||||
return nullptr;
|
||||
|
||||
auto p = ensure(this->_alloc(codeSize, align));
|
||||
auto p = ensure(this->_alloc(codeSize, 64));
|
||||
ensure(!code->relocateToBase(uptr(p)));
|
||||
|
||||
{
|
||||
@@ -237,11 +231,6 @@ void* jit_runtime_base::_add(asmjit::CodeHolder* code, usz align) noexcept
|
||||
|
||||
for (asmjit::Section* section : code->_sections)
|
||||
{
|
||||
if (section->offset() + section->bufferSize() > utils::align<usz>(codeSize, align))
|
||||
{
|
||||
fmt::throw_exception("CodeHolder section exceeds range: Section->offset: 0x%x, Section->bufferSize: 0x%x, alloted-memory=0x%x", section->offset(), section->bufferSize(), utils::align<usz>(codeSize, align));
|
||||
}
|
||||
|
||||
std::memcpy(p + section->offset(), section->data(), section->bufferSize());
|
||||
}
|
||||
}
|
||||
@@ -279,18 +268,6 @@ u8* jit_runtime::alloc(usz size, usz align, bool exec) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
u8* jit_runtime::peek(bool exec) noexcept
|
||||
{
|
||||
if (exec)
|
||||
{
|
||||
return add_jit_memory<s_code_pos, 0x0, utils::protection::wx>(0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return add_jit_memory<s_data_pos, 0x40000000, utils::protection::rw>(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void jit_runtime::initialize()
|
||||
{
|
||||
if (!s_code_init.empty() || !s_data_init.empty())
|
||||
|
||||
+35
-126
@@ -1,6 +1,5 @@
|
||||
#include "util/types.hpp"
|
||||
#include "util/sysinfo.hpp"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "JIT.h"
|
||||
#include "StrFmt.h"
|
||||
#include "File.h"
|
||||
@@ -78,7 +77,8 @@ static u64 make_null_function(const std::string& name)
|
||||
|
||||
if (res.ec == std::errc() && res.ptr == name.c_str() + name.size() && addr < 0x8000'0000)
|
||||
{
|
||||
fmt::throw_exception("Unhandled symbols cementing! (name='%s'", name);
|
||||
// Point the garbage to reserved, non-executable memory
|
||||
return reinterpret_cast<u64>(vm::g_sudo_addr + addr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,34 +174,18 @@ struct JITAnnouncer : llvm::JITEventListener
|
||||
struct MemoryManager1 : llvm::RTDyldMemoryManager
|
||||
{
|
||||
// 256 MiB for code or data
|
||||
static constexpr u64 c_max_size = 0x1000'0000;
|
||||
static constexpr u64 c_max_size = 0x20000000 / 2;
|
||||
|
||||
// Allocation unit (2M)
|
||||
static constexpr u64 c_page_size = 2 * 1024 * 1024;
|
||||
|
||||
// Reserve 256 MiB blocks
|
||||
void* m_code_mems = nullptr;
|
||||
void* m_data_ro_mems = nullptr;
|
||||
void* m_data_rw_mems = nullptr;
|
||||
// Reserve 512 MiB
|
||||
u8* const ptr = static_cast<u8*>(utils::memory_reserve(c_max_size * 2));
|
||||
|
||||
u64 code_ptr = 0;
|
||||
u64 data_ro_ptr = 0;
|
||||
u64 data_rw_ptr = 0;
|
||||
u64 data_ptr = c_max_size;
|
||||
|
||||
// First fallback for non-existing symbols
|
||||
// May be a memory container internally
|
||||
std::function<u64(const std::string&)> m_symbols_cement;
|
||||
|
||||
MemoryManager1(std::function<u64(const std::string&)> symbols_cement = {}) noexcept
|
||||
: m_symbols_cement(std::move(symbols_cement))
|
||||
{
|
||||
auto ptr = reinterpret_cast<u8*>(utils::memory_reserve(c_max_size * 3));
|
||||
m_code_mems = ptr;
|
||||
// ptr += c_max_size;
|
||||
// m_data_ro_mems = ptr;
|
||||
ptr += c_max_size;
|
||||
m_data_rw_mems = ptr;
|
||||
}
|
||||
MemoryManager1() = default;
|
||||
|
||||
MemoryManager1(const MemoryManager1&) = delete;
|
||||
|
||||
@@ -210,22 +194,13 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
|
||||
~MemoryManager1() override
|
||||
{
|
||||
// Hack: don't release to prevent reuse of address space, see jit_announce
|
||||
// constexpr auto how_much = [](u64 pos) { return utils::align(pos, pos < c_page_size ? c_page_size / 4 : c_page_size); };
|
||||
// utils::memory_decommit(m_code_mems, how_much(code_ptr));
|
||||
// utils::memory_decommit(m_data_ro_mems, how_much(data_ro_ptr));
|
||||
// utils::memory_decommit(m_data_rw_mems, how_much(data_rw_ptr));
|
||||
utils::memory_decommit(m_code_mems, c_max_size * 3);
|
||||
utils::memory_decommit(ptr, c_max_size * 2);
|
||||
}
|
||||
|
||||
llvm::JITSymbol findSymbol(const std::string& name) override
|
||||
{
|
||||
u64 addr = RTDyldMemoryManager::getSymbolAddress(name);
|
||||
|
||||
if (!addr && m_symbols_cement)
|
||||
{
|
||||
addr = m_symbols_cement(name);
|
||||
}
|
||||
|
||||
if (!addr)
|
||||
{
|
||||
addr = make_null_function(name);
|
||||
@@ -239,79 +214,45 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
|
||||
return {addr, llvm::JITSymbolFlags::Exported};
|
||||
}
|
||||
|
||||
u8* allocate(u64& alloc_pos, void* block, uptr size, u64 align, utils::protection prot)
|
||||
u8* allocate(u64& oldp, uptr size, uint align, utils::protection prot)
|
||||
{
|
||||
align = align ? align : 16;
|
||||
|
||||
const u64 sizea = utils::align(size, align);
|
||||
|
||||
if (!size || align > c_page_size || sizea > c_max_size || sizea < size)
|
||||
if (align > c_page_size)
|
||||
{
|
||||
jit_log.fatal("Unsupported size/alignment (size=0x%x, align=0x%x)", size, align);
|
||||
jit_log.fatal("Unsupported alignment (size=0x%x, align=0x%x)", size, align);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u64 oldp = alloc_pos;
|
||||
const u64 olda = utils::align(oldp, align);
|
||||
const u64 newp = utils::align(olda + size, align);
|
||||
|
||||
u64 olda = utils::align(oldp, align);
|
||||
|
||||
ensure(olda >= oldp);
|
||||
ensure(olda < ~sizea);
|
||||
|
||||
u64 newp = olda + sizea;
|
||||
|
||||
if ((newp - 1) / c_max_size != (oldp - 1) / c_max_size)
|
||||
if ((newp - 1) / c_max_size != oldp / c_max_size)
|
||||
{
|
||||
constexpr usz num_of_allocations = 1;
|
||||
|
||||
if ((newp - 1) / c_max_size > num_of_allocations)
|
||||
{
|
||||
// Allocating more than one region does not work for relocations, needs more robust solution
|
||||
fmt::throw_exception("Out of memory (size=0x%x, align=0x%x)", size, align);
|
||||
}
|
||||
jit_log.fatal("Out of memory (size=0x%x, align=0x%x)", size, align);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Update allocation counter
|
||||
alloc_pos = newp;
|
||||
|
||||
constexpr usz page_quarter = c_page_size / 4;
|
||||
|
||||
// Optimization: split the first allocation to 512 KiB for single-module compilers
|
||||
if (oldp < c_page_size && align < page_quarter && (std::min(newp, c_page_size) - 1) / page_quarter != (oldp - 1) / page_quarter)
|
||||
{
|
||||
const u64 pagea = utils::align(oldp, page_quarter);
|
||||
const u64 psize = utils::align(std::min(newp, c_page_size) - pagea, page_quarter);
|
||||
utils::memory_commit(reinterpret_cast<u8*>(block) + (pagea % c_max_size), psize, prot);
|
||||
|
||||
// Advance
|
||||
oldp = pagea + psize;
|
||||
}
|
||||
|
||||
if ((newp - 1) / c_page_size != (oldp - 1) / c_page_size)
|
||||
if ((oldp - 1) / c_page_size != (newp - 1) / c_page_size)
|
||||
{
|
||||
// Allocate pages on demand
|
||||
const u64 pagea = utils::align(oldp, c_page_size);
|
||||
const u64 psize = utils::align(newp - pagea, c_page_size);
|
||||
utils::memory_commit(reinterpret_cast<u8*>(block) + (pagea % c_max_size), psize, prot);
|
||||
utils::memory_commit(this->ptr + pagea, psize, prot);
|
||||
}
|
||||
|
||||
return reinterpret_cast<u8*>(block) + (olda % c_max_size);
|
||||
// Update allocation counter
|
||||
oldp = newp;
|
||||
|
||||
return this->ptr + olda;
|
||||
}
|
||||
|
||||
u8* allocateCodeSection(uptr size, uint align, uint /*sec_id*/, llvm::StringRef /*sec_name*/) override
|
||||
{
|
||||
return allocate(code_ptr, m_code_mems, size, align, utils::protection::wx);
|
||||
return allocate(code_ptr, size, align, utils::protection::wx);
|
||||
}
|
||||
|
||||
u8* allocateDataSection(uptr size, uint align, uint /*sec_id*/, llvm::StringRef /*sec_name*/, bool is_ro) override
|
||||
u8* allocateDataSection(uptr size, uint align, uint /*sec_id*/, llvm::StringRef /*sec_name*/, bool /*is_ro*/) override
|
||||
{
|
||||
if (is_ro)
|
||||
{
|
||||
// Disabled
|
||||
//return allocate(data_ro_ptr, m_data_ro_mems, size, align, utils::protection::rw);
|
||||
}
|
||||
|
||||
return allocate(data_rw_ptr, m_data_rw_mems, size, align, utils::protection::rw);
|
||||
return allocate(data_ptr, size, align, utils::protection::rw);
|
||||
}
|
||||
|
||||
bool finalizeMemory(std::string* = nullptr) override
|
||||
@@ -331,14 +272,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
|
||||
// Simple memory manager
|
||||
struct MemoryManager2 : llvm::RTDyldMemoryManager
|
||||
{
|
||||
// First fallback for non-existing symbols
|
||||
// May be a memory container internally
|
||||
std::function<u64(const std::string&)> m_symbols_cement;
|
||||
|
||||
MemoryManager2(std::function<u64(const std::string&)> symbols_cement = {}) noexcept
|
||||
: m_symbols_cement(std::move(symbols_cement))
|
||||
{
|
||||
}
|
||||
MemoryManager2() = default;
|
||||
|
||||
~MemoryManager2() override
|
||||
{
|
||||
@@ -348,11 +282,6 @@ struct MemoryManager2 : llvm::RTDyldMemoryManager
|
||||
{
|
||||
u64 addr = RTDyldMemoryManager::getSymbolAddress(name);
|
||||
|
||||
if (!addr && m_symbols_cement)
|
||||
{
|
||||
addr = m_symbols_cement(name);
|
||||
}
|
||||
|
||||
if (!addr)
|
||||
{
|
||||
addr = make_null_function(name);
|
||||
@@ -632,22 +561,10 @@ bool jit_compiler::add_sub_disk_space(ssz space)
|
||||
}).second;
|
||||
}
|
||||
|
||||
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags, std::function<u64(const std::string&)> symbols_cement) noexcept
|
||||
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags)
|
||||
: m_context(new llvm::LLVMContext)
|
||||
, m_cpu(cpu(_cpu))
|
||||
{
|
||||
[[maybe_unused]] static const bool s_install_llvm_error_handler = []()
|
||||
{
|
||||
llvm::remove_fatal_error_handler();
|
||||
llvm::install_fatal_error_handler([](void*, const char* msg, bool)
|
||||
{
|
||||
const std::string_view out = msg ? msg : "";
|
||||
fmt::throw_exception("LLVM Emergency Exit Invoked: '%s'", out);
|
||||
}, nullptr);
|
||||
|
||||
return true;
|
||||
}();
|
||||
|
||||
std::string result;
|
||||
|
||||
auto null_mod = std::make_unique<llvm::Module> ("null_", *m_context);
|
||||
@@ -660,17 +577,17 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
|
||||
// Auxiliary JIT (does not use custom memory manager, only writes the objects)
|
||||
if (flags & 0x1)
|
||||
{
|
||||
mem = std::make_unique<MemoryManager1>(std::move(symbols_cement));
|
||||
mem = std::make_unique<MemoryManager1>();
|
||||
}
|
||||
else
|
||||
{
|
||||
mem = std::make_unique<MemoryManager2>(std::move(symbols_cement));
|
||||
mem = std::make_unique<MemoryManager2>();
|
||||
null_mod->setTargetTriple(jit_compiler::triple2());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mem = std::make_unique<MemoryManager1>(std::move(symbols_cement));
|
||||
mem = std::make_unique<MemoryManager1>();
|
||||
}
|
||||
|
||||
{
|
||||
@@ -678,7 +595,11 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
|
||||
.setErrorStr(&result)
|
||||
.setEngineKind(llvm::EngineKind::JIT)
|
||||
.setMCJITMemoryManager(std::move(mem))
|
||||
#if LLVM_VERSION_MAJOR < 18
|
||||
.setOptLevel(llvm::CodeGenOpt::Aggressive)
|
||||
#else
|
||||
.setOptLevel(llvm::CodeGenOptLevel::Aggressive)
|
||||
#endif
|
||||
.setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small)
|
||||
#ifdef __APPLE__
|
||||
//.setCodeModel(llvm::CodeModel::Large)
|
||||
@@ -715,19 +636,7 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
|
||||
}
|
||||
}
|
||||
|
||||
jit_compiler& jit_compiler::operator=(thread_state s) noexcept
|
||||
{
|
||||
if (s == thread_state::destroying_context)
|
||||
{
|
||||
// Release resources explicitly
|
||||
m_engine.reset();
|
||||
m_context.reset();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
jit_compiler::~jit_compiler() noexcept
|
||||
jit_compiler::~jit_compiler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "StrUtil.h"
|
||||
#include "cfmt.h"
|
||||
#include "util/endian.hpp"
|
||||
#include "util/logs.hpp"
|
||||
#include "util/v128.hpp"
|
||||
|
||||
#include <locale>
|
||||
|
||||
+18
-21
@@ -22,7 +22,7 @@ namespace fmt
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, typename = void>
|
||||
struct fmt_unveil
|
||||
{
|
||||
static_assert(sizeof(T) > 0, "fmt_unveil<> error: incomplete type");
|
||||
@@ -54,8 +54,7 @@ struct fmt_unveil
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires(std::is_integral_v<T> && sizeof(T) <= 8 && alignof(T) <= 8)
|
||||
struct fmt_unveil<T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_integral_v<T> && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
@@ -66,8 +65,7 @@ struct fmt_unveil<T>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires(std::is_floating_point_v<T> && sizeof(T) <= 8 && alignof(T) <= 8)
|
||||
struct fmt_unveil<T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_floating_point_v<T> && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
@@ -79,8 +77,7 @@ struct fmt_unveil<T>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires std::is_enum_v<T>
|
||||
struct fmt_unveil<T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_enum_v<T>>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
@@ -91,7 +88,7 @@ struct fmt_unveil<T>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T*>
|
||||
struct fmt_unveil<T*, void>
|
||||
{
|
||||
using type = std::add_const_t<T>*;
|
||||
|
||||
@@ -108,7 +105,7 @@ namespace fmt
|
||||
}
|
||||
|
||||
template <fmt::CharT T, usz N>
|
||||
struct fmt_unveil<T[N]>
|
||||
struct fmt_unveil<T[N], void>
|
||||
{
|
||||
using type = std::add_const_t<T>*;
|
||||
|
||||
@@ -119,7 +116,7 @@ struct fmt_unveil<T[N]>
|
||||
};
|
||||
|
||||
template <typename T, bool Se, usz Align>
|
||||
struct fmt_unveil<se_t<T, Se, Align>>
|
||||
struct fmt_unveil<se_t<T, Se, Align>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<T>::type;
|
||||
|
||||
@@ -130,7 +127,7 @@ struct fmt_unveil<se_t<T, Se, Align>>
|
||||
};
|
||||
|
||||
// String type format provider, also type classifier (format() called if an argument is formatted as "%s")
|
||||
template <typename T>
|
||||
template <typename T, typename = void>
|
||||
struct fmt_class_string
|
||||
{
|
||||
// Formatting function (must be explicitly specialized)
|
||||
@@ -203,47 +200,47 @@ struct fmt_class_string
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const void*>
|
||||
struct fmt_class_string<const void*, void>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_class_string<T*> : fmt_class_string<const void*>
|
||||
struct fmt_class_string<T*, void> : fmt_class_string<const void*, void>
|
||||
{
|
||||
// Classify all pointers as const void*
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const char*>
|
||||
struct fmt_class_string<const char*, void>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<char*> : fmt_class_string<const char*>
|
||||
struct fmt_class_string<char*, void> : fmt_class_string<const char*>
|
||||
{
|
||||
// Classify char* as const char*
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const char8_t*> : fmt_class_string<const char*>
|
||||
struct fmt_class_string<const char8_t*, void> : fmt_class_string<const char*>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<char8_t*> : fmt_class_string<const char8_t*>
|
||||
struct fmt_class_string<char8_t*, void> : fmt_class_string<const char8_t*>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const wchar_t*>
|
||||
struct fmt_class_string<const wchar_t*, void>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<wchar_t*> : fmt_class_string<const wchar_t*>
|
||||
struct fmt_class_string<wchar_t*, void> : fmt_class_string<const wchar_t*>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -257,7 +254,7 @@ namespace fmt
|
||||
}
|
||||
|
||||
template <fmt::StringConvertible T>
|
||||
struct fmt_class_string<T>
|
||||
struct fmt_class_string<T, void>
|
||||
{
|
||||
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
||||
{
|
||||
@@ -278,7 +275,7 @@ namespace fmt
|
||||
}
|
||||
|
||||
template <fmt::ByteArray T>
|
||||
struct fmt_class_string<T>
|
||||
struct fmt_class_string<T, void>
|
||||
{
|
||||
static FORCE_INLINE SAFE_BUFFERS(const T&) get_object(u64 arg)
|
||||
{
|
||||
|
||||
+8
-53
@@ -1703,58 +1703,23 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe
|
||||
cpu->state += cpu_flag::wait;
|
||||
}
|
||||
|
||||
Emu.Pause(true);
|
||||
|
||||
if (!g_tls_access_violation_recovered)
|
||||
{
|
||||
vm_log.notice("\n%s", dump_useful_thread_info());
|
||||
}
|
||||
|
||||
// Note: a thread may access violate more than once after hack_alloc recovery
|
||||
// Do not log any further access violations in this case.
|
||||
if (!g_tls_access_violation_recovered)
|
||||
{
|
||||
vm_log.notice("\n%s", dump_useful_thread_info());
|
||||
vm_log.fatal("Access violation %s location 0x%x (%s)", is_writing ? "writing" : (cpu && cpu->get_class() == thread_class::ppu && cpu->get_pc() == addr ? "executing" : "reading"), addr, (is_writing && vm::check_addr(addr)) ? "read-only memory" : "unmapped memory");
|
||||
}
|
||||
|
||||
while (Emu.IsPausedOrReady())
|
||||
{
|
||||
if (cpu)
|
||||
{
|
||||
auto state = +cpu->state;
|
||||
|
||||
if (::is_paused(state) && !::is_stopped(state))
|
||||
{
|
||||
thread_ctrl::wait_on(cpu->state, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Temporary until Emulator updates state
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
}
|
||||
|
||||
Emu.Pause(true);
|
||||
|
||||
while (Emu.IsPaused())
|
||||
{
|
||||
if (cpu)
|
||||
{
|
||||
auto state = +cpu->state;
|
||||
|
||||
if (::is_paused(state) && !::is_stopped(state))
|
||||
{
|
||||
thread_ctrl::wait_on(cpu->state, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Temporary until Emulator updates state
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
thread_ctrl::wait();
|
||||
}
|
||||
|
||||
if (Emu.IsStopped() && !hack_alloc())
|
||||
@@ -1853,11 +1818,6 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
|
||||
pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : "reading";
|
||||
|
||||
fmt::append(msg, "Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);
|
||||
|
||||
if (vm::try_get_addr(reinterpret_cast<u8*>(pExp->ExceptionRecord->ExceptionInformation[1])).second)
|
||||
{
|
||||
fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2039,11 +1999,6 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept
|
||||
|
||||
std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context));
|
||||
|
||||
if (vm::try_get_addr(info->si_addr).second)
|
||||
{
|
||||
fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr);
|
||||
}
|
||||
|
||||
append_thread_name(msg);
|
||||
|
||||
sys_log.fatal("\n%s", msg);
|
||||
|
||||
+5
-1
@@ -5,6 +5,10 @@
|
||||
#include "util/shared_ptr.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <concepts>
|
||||
|
||||
#include "mutex.h"
|
||||
#include "lockless.h"
|
||||
|
||||
// Hardware core layout
|
||||
enum class native_core_arrangement : u32
|
||||
@@ -765,7 +769,7 @@ public:
|
||||
}
|
||||
|
||||
// Move the context (if movable)
|
||||
new (static_cast<void*>(m_threads + m_count - 1)) Thread(std::string(name) + std::to_string(m_count), std::forward<Context>(f));
|
||||
new (static_cast<void*>(m_threads + m_count - 1)) Thread(std::string(name) + std::to_string(m_count - 1), std::forward<Context>(f));
|
||||
}
|
||||
|
||||
// Constructor with a function performed before adding more threads
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ public:
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<bs_t<T>>
|
||||
struct fmt_unveil<bs_t<T>, void>
|
||||
{
|
||||
// Format as is
|
||||
using type = bs_t<T>;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "util/asm.hpp"
|
||||
|
||||
|
||||
@@ -1,32 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "cheat_info.h"
|
||||
#include "Config.h"
|
||||
#include "StrUtil.h"
|
||||
|
||||
LOG_CHANNEL(log_cheat, "Cheat");
|
||||
|
||||
template <>
|
||||
void fmt_class_string<cheat_type>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](cheat_type value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case cheat_type::unsigned_8_cheat: return "Unsigned 8 bits";
|
||||
case cheat_type::unsigned_16_cheat: return "Unsigned 16 bits";
|
||||
case cheat_type::unsigned_32_cheat: return "Unsigned 32 bits";
|
||||
case cheat_type::unsigned_64_cheat: return "Unsigned 64 bits";
|
||||
case cheat_type::signed_8_cheat: return "Signed 8 bits";
|
||||
case cheat_type::signed_16_cheat: return "Signed 16 bits";
|
||||
case cheat_type::signed_32_cheat: return "Signed 32 bits";
|
||||
case cheat_type::signed_64_cheat: return "Signed 64 bits";
|
||||
case cheat_type::float_32_cheat: return "Float 32 bits";
|
||||
case cheat_type::max: break;
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
bool cheat_info::from_str(const std::string& cheat_line)
|
||||
{
|
||||
auto cheat_vec = fmt::split(cheat_line, {"@@@"}, false);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "cond.h"
|
||||
#include "sync.h"
|
||||
|
||||
// use constants, increase signal space
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "date_time.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
template <>
|
||||
void fmt_class_string<std::chrono::sys_time<typename std::chrono::system_clock::duration>>::format(std::string& out, u64 arg)
|
||||
{
|
||||
const std::time_t dateTime = std::chrono::system_clock::to_time_t(get_object(arg));
|
||||
out += date_time::fmt_time("%Y-%m-%dT%H:%M:%S", dateTime);
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <util/types.hpp>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Patch utilities specific to PPU code
|
||||
|
||||
+6
-3
@@ -12,12 +12,18 @@
|
||||
#include <Windows.h>
|
||||
#include <ctime>
|
||||
#elif __linux__
|
||||
#include <errno.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/futex.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef _WIN32
|
||||
DYNAMIC_IMPORT("ntdll.dll", NtWaitForKeyedEvent, NTSTATUS(HANDLE, PVOID Key, BOOLEAN Alertable, PLARGE_INTEGER Timeout));
|
||||
@@ -54,9 +60,6 @@ struct futex_waitv
|
||||
};
|
||||
#endif
|
||||
#else
|
||||
|
||||
#include <condition_variable>
|
||||
|
||||
enum
|
||||
{
|
||||
FUTEX_PRIVATE_FLAG = 0,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "util/types.hpp"
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include "Emu/Cell/timers.hpp"
|
||||
|
||||
// Thread-safe object pool with garbage collection
|
||||
class universal_pool
|
||||
|
||||
+17
-31
@@ -33,20 +33,18 @@ jobs:
|
||||
steps:
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: ccache | $(Agent.OS) | $(COMPILER) | $(Build.SourceVersion)
|
||||
restoreKeys: |
|
||||
ccache | $(Agent.OS) | $(COMPILER)
|
||||
key: ccache | $(Agent.OS) | $(COMPILER)
|
||||
path: $(CCACHE_DIR)
|
||||
displayName: ccache
|
||||
|
||||
- bash: |
|
||||
docker pull --quiet rpcs3/rpcs3-ci-jammy:1.1
|
||||
docker pull --quiet rpcs3/rpcs3-ci-focal:1.9
|
||||
docker run \
|
||||
-v $(pwd):/rpcs3 \
|
||||
--env-file .ci/docker.env \
|
||||
-v $CCACHE_DIR:/root/.ccache \
|
||||
-v $BUILD_ARTIFACTSTAGINGDIRECTORY:/root/artifacts \
|
||||
rpcs3/rpcs3-ci-jammy:1.1 \
|
||||
rpcs3/rpcs3-ci-focal:1.9 \
|
||||
/rpcs3/.ci/build-linux.sh
|
||||
displayName: Docker setup and build
|
||||
|
||||
@@ -71,19 +69,14 @@ jobs:
|
||||
variables:
|
||||
COMPILER: msvc
|
||||
QT_VER_MAIN: '6'
|
||||
QT_VER: '6.8.2'
|
||||
QT_VER: '6.8.1'
|
||||
QT_VER_MSVC: 'msvc2022'
|
||||
QT_DATE: '202501260838'
|
||||
QT_DATE: '202411221531'
|
||||
QTDIR: C:\Qt\$(QT_VER)\$(QT_VER_MSVC)_64
|
||||
VULKAN_VER: '1.3.268.0'
|
||||
VULKAN_SDK_SHA: '8459ef49bd06b697115ddd3d97c9aec729e849cd775f5be70897718a9b3b9db5'
|
||||
VULKAN_SDK: C:\VulkanSDK\$(VULKAN_VER)
|
||||
CCACHE_SHA: '6252f081876a9a9f700fae13a5aec5d0d486b28261d7f1f72ac11c7ad9df4da9'
|
||||
CCACHE_BIN_DIR: 'C:\ccache_bin'
|
||||
CCACHE_DIR: 'C:\ccache'
|
||||
CCACHE_INODECACHE: 'true'
|
||||
CCACHE_SLOPPINESS: 'time_macros'
|
||||
DEPS_CACHE_DIR: ./dependency_cache
|
||||
CACHE_DIR: ./cache
|
||||
UPLOAD_COMMIT_HASH: 7d09e3be30805911226241afbb14f8cdc2eb054e
|
||||
UPLOAD_REPO_FULL_NAME: "RPCS3/rpcs3-binaries-win"
|
||||
|
||||
@@ -96,17 +89,11 @@ jobs:
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: ccache | $(Agent.OS) | $(COMPILER) | "$(Build.SourceVersion)"
|
||||
path: $(CCACHE_DIR)
|
||||
restoreKeys:
|
||||
ccache | $(Agent.OS) | $(COMPILER)
|
||||
displayName: Build Ccache
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: $(Agent.OS) | $(COMPILER) | "$(QT_VER)" | $(VULKAN_SDK_SHA) | $(CCACHE_SHA) | llvm.lock | glslang.lock
|
||||
path: $(DEPS_CACHE_DIR)
|
||||
displayName: Dependencies Cache
|
||||
key: $(Agent.OS) | $(COMPILER) | "$(QT_VER)" | $(VULKAN_SDK_SHA) | llvm.lock | glslang.lock
|
||||
path: $(CACHE_DIR)
|
||||
restoreKeys: |
|
||||
$(Agent.OS) | $(COMPILER)
|
||||
displayName: Cache
|
||||
|
||||
- bash: .ci/setup-windows.sh
|
||||
displayName: Download and unpack dependencies
|
||||
@@ -120,7 +107,6 @@ jobs:
|
||||
maximumCpuCount: true
|
||||
platform: x64
|
||||
configuration: 'Release'
|
||||
msbuildArgs: /p:CLToolPath=$(CCACHE_BIN_DIR) /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="$(Build.SourcesDirectory)\buildfiles\msvc\ci_no_debug_info.targets"
|
||||
displayName: Compile RPCS3
|
||||
|
||||
- bash: .ci/deploy-windows.sh
|
||||
@@ -148,7 +134,7 @@ jobs:
|
||||
ARTDIR: $(Build.ArtifactStagingDirectory)
|
||||
QT_VER: '6.7.3'
|
||||
QT_VER_MAIN: '6'
|
||||
LLVM_COMPILER_VER: '19'
|
||||
LLVM_COMPILER_VER: '16'
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
@@ -156,10 +142,10 @@ jobs:
|
||||
steps:
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: ccache | "$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Build.SourceVersion)"
|
||||
key: ccache | "$(Agent.OS)"
|
||||
path: $(CCACHE_DIR)
|
||||
restoreKeys: |
|
||||
ccache | "$(Agent.OS)" | "$(Agent.OSArchitecture)"
|
||||
ccache | "$(Agent.OS)"
|
||||
displayName: Ccache cache
|
||||
|
||||
- task: Cache@2
|
||||
@@ -209,7 +195,7 @@ jobs:
|
||||
ARTDIR: $(Build.ArtifactStagingDirectory)
|
||||
QT_VER: '6.7.3'
|
||||
QT_VER_MAIN: '6'
|
||||
LLVM_COMPILER_VER: '19'
|
||||
LLVM_COMPILER_VER: '16'
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
@@ -217,10 +203,10 @@ jobs:
|
||||
steps:
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: ccache | "$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Build.SourceVersion)"
|
||||
key: ccache | "$(Agent.OS)"
|
||||
path: $(CCACHE_DIR)
|
||||
restoreKeys: |
|
||||
ccache | "$(Agent.OS)" | "$(Agent.OSArchitecture)"
|
||||
ccache | "$(Agent.OS)"
|
||||
displayName: Ccache cache
|
||||
|
||||
- task: Cache@2
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
set(WOLFSSL_LIBRARY ON)
|
||||
set(WOLFSSL_INCLUDE_DIR ON)
|
||||
set(WOLFSSL_LIBRARIES wolfssl)
|
||||
set(WOLFSSL_FOUND TRUE)
|
||||
@@ -1,11 +0,0 @@
|
||||
if(USE_SYSTEM_ZLIB)
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
find_package(ZLIB)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
else()
|
||||
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES zlibstatic
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/zlib/zlib;${CMAKE_BINARY_DIR}/3rdparty/zlib/zlib")
|
||||
set(ZLIB_FOUND TRUE)
|
||||
endif()
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
@@ -14,7 +14,7 @@
|
||||
<PreprocessorDefinitions>LLVM_AVAILABLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Debug'">%(AdditionalLibraryDirectories);$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\$(Configuration)\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Debug'">%(AdditionalLibraryDirectories);$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\$(Configuration)\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies);
|
||||
LLVMAggressiveInstCombine.lib;
|
||||
LLVMAnalysis.lib;
|
||||
@@ -25,13 +25,11 @@
|
||||
LLVMBitstreamReader.lib;
|
||||
LLVMBitWriter.lib;
|
||||
LLVMCFGuard.lib;
|
||||
LLVMCFIVerify.lib;
|
||||
LLVMCodeGen.lib;
|
||||
LLVMCodeGenData.lib;
|
||||
LLVMCodeGenTypes.lib;
|
||||
LLVMCore.lib;
|
||||
LLVMCoroutines.lib;
|
||||
LLVMCoverage.lib;
|
||||
LLVMDebugInfoBTF.lib;
|
||||
LLVMDebugInfoCodeView.lib;
|
||||
LLVMDebuginfod.lib;
|
||||
LLVMDebugInfoDWARF.lib;
|
||||
@@ -40,27 +38,25 @@
|
||||
LLVMDebugInfoMSF.lib;
|
||||
LLVMDebugInfoPDB.lib;
|
||||
LLVMDemangle.lib;
|
||||
LLVMDiff.lib;
|
||||
LLVMDlltoolDriver.lib;
|
||||
LLVMDWARFLinker.lib;
|
||||
LLVMDWARFLinkerClassic.lib;
|
||||
LLVMDWARFLinkerParallel.lib;
|
||||
LLVMDWP.lib;
|
||||
LLVMExecutionEngine.lib;
|
||||
LLVMExegesis.lib;
|
||||
LLVMExegesisX86.lib;
|
||||
LLVMExtensions.lib;
|
||||
LLVMFileCheck.lib;
|
||||
LLVMFrontendDriver.lib;
|
||||
LLVMFrontendHLSL.lib;
|
||||
LLVMFrontendOffloading.lib;
|
||||
LLVMFrontendOpenACC.lib;
|
||||
LLVMFrontendOpenMP.lib;
|
||||
LLVMFuzzerCLI.lib;
|
||||
LLVMFuzzMutate.lib;
|
||||
LLVMGlobalISel.lib;
|
||||
LLVMHipStdPar.lib;
|
||||
LLVMInstCombine.lib;
|
||||
LLVMInstrumentation.lib;
|
||||
LLVMIntelJITEvents.lib;
|
||||
LLVMIntelJITProfiling.lib;
|
||||
LLVMInterfaceStub.lib;
|
||||
LLVMInterpreter.lib;
|
||||
LLVMipo.lib;
|
||||
@@ -71,10 +67,10 @@
|
||||
LLVMLineEditor.lib;
|
||||
LLVMLinker.lib;
|
||||
LLVMLTO.lib;
|
||||
LLVMMC.lib;
|
||||
LLVMMCA.lib;
|
||||
LLVMMCDisassembler.lib;
|
||||
LLVMMCJIT.lib;
|
||||
LLVMMC.lib;
|
||||
LLVMMCParser.lib;
|
||||
LLVMMIRParser.lib;
|
||||
LLVMObjCARCOpts.lib;
|
||||
@@ -82,7 +78,6 @@
|
||||
LLVMObject.lib;
|
||||
LLVMObjectYAML.lib;
|
||||
LLVMOption.lib;
|
||||
LLVMOrcDebugging.lib;
|
||||
LLVMOrcJIT.lib;
|
||||
LLVMOrcShared.lib;
|
||||
LLVMOrcTargetProcess.lib;
|
||||
@@ -90,18 +85,15 @@
|
||||
LLVMProfileData.lib;
|
||||
LLVMRemarks.lib;
|
||||
LLVMRuntimeDyld.lib;
|
||||
LLVMSandboxIR.lib;
|
||||
LLVMScalarOpts.lib;
|
||||
LLVMSelectionDAG.lib;
|
||||
LLVMSupport.lib;
|
||||
LLVMSymbolize.lib;
|
||||
LLVMTableGenGlobalISel.lib;
|
||||
LLVMTableGen.lib;
|
||||
LLVMTableGenBasic.lib;
|
||||
LLVMTableGenCommon.lib;
|
||||
LLVMTarget.lib;
|
||||
LLVMTargetParser.lib;
|
||||
LLVMTextAPI.lib;
|
||||
LLVMTextAPIBinaryReader.lib;
|
||||
LLVMTransformUtils.lib;
|
||||
LLVMVectorize.lib;
|
||||
LLVMWindowsDriver.lib;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<IncludePath>.\;..\;..\3rdparty\asmjit\asmjit\src;..\..\3rdparty\yaml-cpp\yaml-cpp\include;..\3rdparty\ffmpeg\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\stb;..\3rdparty\openal\openal-soft\include\AL;..\3rdparty\pugixml\src;..\3rdparty\hidapi\hidapi</IncludePath>
|
||||
<IncludePath>.\;..\;..\3rdparty\asmjit\asmjit\src;..\..\3rdparty\yaml-cpp\yaml-cpp\include;..\3rdparty\ffmpeg\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\stb;..\3rdparty\openal\openal-soft\include\AL;..\3rdparty\pugixml\src;..\3rdparty\hidapi\hidapi;..\3rdparty\Optional;..\3rdparty\xxhash</IncludePath>
|
||||
<OutDir>$(SolutionDir)build\lib\$(Configuration)-$(Platform)\</OutDir>
|
||||
<LibraryPath>$(SolutionDir)build\lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir>
|
||||
@@ -23,7 +23,7 @@
|
||||
<AdditionalOptions>/utf-8 /Zc:throwingNew- /constexpr:steps16777216 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;Iphlpapi.lib;Bcrypt.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>xxhash.lib;ws2_32.lib;Iphlpapi.lib;Bcrypt.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\3rdparty\ffmpeg\lib\windows\x86_64</AdditionalLibraryDirectories>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<StackCommitSize>1048576</StackCommitSize>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Release'">%(AdditionalLibraryDirectories);$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\$(Configuration)\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Release'">%(AdditionalLibraryDirectories);$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\lib;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\$(Configuration)\lib</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies);
|
||||
LLVMAggressiveInstCombine.lib;
|
||||
LLVMAnalysis.lib;
|
||||
@@ -26,13 +26,11 @@
|
||||
LLVMBitstreamReader.lib;
|
||||
LLVMBitWriter.lib;
|
||||
LLVMCFGuard.lib;
|
||||
LLVMCFIVerify.lib;
|
||||
LLVMCodeGen.lib;
|
||||
LLVMCodeGenData.lib;
|
||||
LLVMCodeGenTypes.lib;
|
||||
LLVMCore.lib;
|
||||
LLVMCoroutines.lib;
|
||||
LLVMCoverage.lib;
|
||||
LLVMDebugInfoBTF.lib;
|
||||
LLVMDebugInfoCodeView.lib;
|
||||
LLVMDebuginfod.lib;
|
||||
LLVMDebugInfoDWARF.lib;
|
||||
@@ -41,27 +39,25 @@
|
||||
LLVMDebugInfoMSF.lib;
|
||||
LLVMDebugInfoPDB.lib;
|
||||
LLVMDemangle.lib;
|
||||
LLVMDiff.lib;
|
||||
LLVMDlltoolDriver.lib;
|
||||
LLVMDWARFLinker.lib;
|
||||
LLVMDWARFLinkerClassic.lib;
|
||||
LLVMDWARFLinkerParallel.lib;
|
||||
LLVMDWP.lib;
|
||||
LLVMExecutionEngine.lib;
|
||||
LLVMExegesis.lib;
|
||||
LLVMExegesisX86.lib;
|
||||
LLVMExtensions.lib;
|
||||
LLVMFileCheck.lib;
|
||||
LLVMFrontendDriver.lib;
|
||||
LLVMFrontendHLSL.lib;
|
||||
LLVMFrontendOffloading.lib;
|
||||
LLVMFrontendOpenACC.lib;
|
||||
LLVMFrontendOpenMP.lib;
|
||||
LLVMFuzzerCLI.lib;
|
||||
LLVMFuzzMutate.lib;
|
||||
LLVMGlobalISel.lib;
|
||||
LLVMHipStdPar.lib;
|
||||
LLVMInstCombine.lib;
|
||||
LLVMInstrumentation.lib;
|
||||
LLVMIntelJITEvents.lib;
|
||||
LLVMIntelJITProfiling.lib;
|
||||
LLVMInterfaceStub.lib;
|
||||
LLVMInterpreter.lib;
|
||||
LLVMipo.lib;
|
||||
@@ -72,10 +68,10 @@
|
||||
LLVMLineEditor.lib;
|
||||
LLVMLinker.lib;
|
||||
LLVMLTO.lib;
|
||||
LLVMMC.lib;
|
||||
LLVMMCA.lib;
|
||||
LLVMMCDisassembler.lib;
|
||||
LLVMMCJIT.lib;
|
||||
LLVMMC.lib;
|
||||
LLVMMCParser.lib;
|
||||
LLVMMIRParser.lib;
|
||||
LLVMObjCARCOpts.lib;
|
||||
@@ -83,7 +79,6 @@
|
||||
LLVMObject.lib;
|
||||
LLVMObjectYAML.lib;
|
||||
LLVMOption.lib;
|
||||
LLVMOrcDebugging.lib;
|
||||
LLVMOrcJIT.lib;
|
||||
LLVMOrcShared.lib;
|
||||
LLVMOrcTargetProcess.lib;
|
||||
@@ -91,18 +86,15 @@
|
||||
LLVMProfileData.lib;
|
||||
LLVMRemarks.lib;
|
||||
LLVMRuntimeDyld.lib;
|
||||
LLVMSandboxIR.lib;
|
||||
LLVMScalarOpts.lib;
|
||||
LLVMSelectionDAG.lib;
|
||||
LLVMSupport.lib;
|
||||
LLVMSymbolize.lib;
|
||||
LLVMTableGenGlobalISel.lib;
|
||||
LLVMTableGen.lib;
|
||||
LLVMTableGenBasic.lib;
|
||||
LLVMTableGenCommon.lib;
|
||||
LLVMTarget.lib;
|
||||
LLVMTargetParser.lib;
|
||||
LLVMTextAPI.lib;
|
||||
LLVMTextAPIBinaryReader.lib;
|
||||
LLVMTransformUtils.lib;
|
||||
LLVMVectorize.lib;
|
||||
LLVMWindowsDriver.lib;
|
||||
|
||||
@@ -10,6 +10,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vc
|
||||
{3C67A2FF-4710-402A-BE3E-31B0CB0576DF} = {3C67A2FF-4710-402A-BE3E-31B0CB0576DF}
|
||||
{5228F863-E0DD-4DE7-AA7B-5C52B14CD4D0} = {5228F863-E0DD-4DE7-AA7B-5C52B14CD4D0}
|
||||
{8846A9AA-5539-4C91-8301-F54260E1A07A} = {8846A9AA-5539-4C91-8301-F54260E1A07A}
|
||||
{939FE206-1182-ABC3-1234-FEAB88E98404} = {939FE206-1182-ABC3-1234-FEAB88E98404}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm_build", "3rdparty\llvm\llvm_build.vcxproj", "{8BC303AB-25BE-4276-8E57-73F171B2D672}"
|
||||
@@ -66,6 +67,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxpro
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "3rdparty\hidapi\hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxhash", "3rdparty\xxhash.vcxproj", "{939FE206-1182-ABC3-1234-FEAB88E98404}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "3rdparty\libusb\libusb_static.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssl", "3rdparty\wolfssl\wolfssl.vcxproj", "{73973223-5EE8-41CA-8E88-1D60E89A237B}"
|
||||
@@ -158,6 +161,10 @@ Global
|
||||
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|x64.Build.0 = Debug|x64
|
||||
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|x64.ActiveCfg = Release|x64
|
||||
{A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|x64.Build.0 = Release|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}.Release|x64.ActiveCfg = Release|x64
|
||||
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release|x64.Build.0 = Release|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}.Release|x64.ActiveCfg = Release|x64
|
||||
@@ -229,6 +236,7 @@ Global
|
||||
{3EE5F075-B546-42C4-B6A8-E3CCEF38B78D} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2}
|
||||
{FDC361C5-7734-493B-8CFB-037308B35122} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
{A107C21C-418A-4697-BB10-20C3AA60E2E4} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
{939FE206-1182-ABC3-1234-FEAB88E98404} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
|
||||
|
||||
@@ -598,10 +598,7 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
|
||||
#if defined(__SSE2__) || defined(_M_X64)
|
||||
done:
|
||||
#endif
|
||||
|
||||
// Wipe the stack buffer clean
|
||||
std::fill_n(reinterpret_cast<volatile char*>(&cty), sizeof(cty), 0);
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ usz decrypt_binaries_t::decrypt(std::string_view klic_input)
|
||||
case "SCE\0"_u32:
|
||||
{
|
||||
// First KLIC is no KLIC
|
||||
elf_file = decrypt_self(elf_file, key_it != 0 ? reinterpret_cast<u8*>(&m_klics[key_it]) : nullptr);
|
||||
elf_file = decrypt_self(std::move(elf_file), key_it != 0 ? reinterpret_cast<u8*>(&m_klics[key_it]) : nullptr);
|
||||
|
||||
if (!elf_file)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "utils.h"
|
||||
#include <cstring>
|
||||
|
||||
static inline int bn_compare(u8* a, u8* b, u32 n)
|
||||
|
||||
@@ -20,7 +20,6 @@ SELF_KEY::SELF_KEY(u64 ver_start, u64 ver_end, u16 rev, u32 type, const std::str
|
||||
|
||||
KeyVault::KeyVault()
|
||||
{
|
||||
std::memcpy(klicensee_key, NP_KLIC_FREE, sizeof(klicensee_key));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV0Keys()
|
||||
@@ -752,14 +751,15 @@ SELF_KEY KeyVault::FindSelfKey(u32 type, u16 revision, u64 version)
|
||||
return key;
|
||||
}
|
||||
|
||||
void KeyVault::SetKlicenseeKey(const u8* key)
|
||||
void KeyVault::SetKlicenseeKey(u8* key)
|
||||
{
|
||||
std::memcpy(klicensee_key, key, 0x10);
|
||||
klicensee_key = std::make_unique<u8[]>(0x10);
|
||||
memcpy(klicensee_key.get(), key, 0x10);
|
||||
}
|
||||
|
||||
const u8* KeyVault::GetKlicenseeKey() const
|
||||
u8* KeyVault::GetKlicenseeKey() const
|
||||
{
|
||||
return klicensee_key;
|
||||
return klicensee_key.get();
|
||||
}
|
||||
|
||||
void rap_to_rif(unsigned char* rap, unsigned char* rif)
|
||||
|
||||
@@ -319,13 +319,13 @@ class KeyVault
|
||||
std::vector<SELF_KEY> sk_LDR_arr{};
|
||||
std::vector<SELF_KEY> sk_UNK7_arr{};
|
||||
std::vector<SELF_KEY> sk_NPDRM_arr{};
|
||||
u8 klicensee_key[16]{};
|
||||
std::unique_ptr<u8[]> klicensee_key{};
|
||||
|
||||
public:
|
||||
KeyVault();
|
||||
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
|
||||
void SetKlicenseeKey(const u8* key);
|
||||
const u8* GetKlicenseeKey() const;
|
||||
void SetKlicenseeKey(u8* key);
|
||||
u8* GetKlicenseeKey() const;
|
||||
|
||||
private:
|
||||
void LoadSelfLV0Keys();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// Licensed under the terms of the GNU GPL, version 2.0 or later versions.
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
|
||||
#include <string.h>
|
||||
#include "lz.h"
|
||||
|
||||
void decode_range(unsigned int *range, unsigned int *code, unsigned char **src)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
// Reverse-engineered custom Lempel–Ziv–Markov based compression.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void decode_range(unsigned int *range, unsigned int *code, unsigned char **src);
|
||||
int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c);
|
||||
int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "sha1.h"
|
||||
#include "lz.h"
|
||||
#include "ec.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "Emu/system_utils.hpp"
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include "Utilities/File.h"
|
||||
|
||||
constexpr u32 SDAT_FLAG = 0x01000000;
|
||||
|
||||
+85
-158
@@ -5,6 +5,7 @@
|
||||
#include "util/logs.hpp"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "Emu/VFS.h"
|
||||
@@ -39,13 +40,6 @@ package_reader::package_reader(const std::string& path)
|
||||
return;
|
||||
}
|
||||
|
||||
m_is_valid = set_decryption_key();
|
||||
|
||||
if (!m_is_valid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool param_sfo_found = read_param_sfo();
|
||||
|
||||
if (!param_sfo_found)
|
||||
@@ -73,7 +67,7 @@ bool package_reader::read_header()
|
||||
}
|
||||
|
||||
pkg_log.notice("Path: '%s'", m_path);
|
||||
pkg_log.notice("Header: pkg_magic = 0x%x = \"%s\"", +m_header.pkg_magic, std::string_view(reinterpret_cast<const char*>(&m_header.pkg_magic), 4).substr(1)); // Skip 0x7F
|
||||
pkg_log.notice("Header: pkg_magic = 0x%x = \"%s\"", +m_header.pkg_magic, std::string_view(reinterpret_cast<const char*>(&m_header.pkg_magic + 1), 3)); // Skip 0x7F
|
||||
pkg_log.notice("Header: pkg_type = 0x%x = %d", m_header.pkg_type, m_header.pkg_type);
|
||||
pkg_log.notice("Header: pkg_platform = 0x%x = %d", m_header.pkg_platform, m_header.pkg_platform);
|
||||
pkg_log.notice("Header: meta_offset = 0x%x = %d", m_header.meta_offset, m_header.meta_offset);
|
||||
@@ -100,7 +94,7 @@ bool package_reader::read_header()
|
||||
return false;
|
||||
}
|
||||
|
||||
pkg_log.notice("Extended header: magic = 0x%x = \"%s\"", +ext_header.magic, std::string_view(reinterpret_cast<const char*>(&ext_header.magic), 4).substr(1));
|
||||
pkg_log.notice("Extended header: magic = 0x%x = \"%s\"", +ext_header.magic, std::string_view(reinterpret_cast<const char*>(&ext_header.magic + 1), 3));
|
||||
pkg_log.notice("Extended header: unknown_1 = 0x%x = %d", ext_header.unknown_1, ext_header.unknown_1);
|
||||
pkg_log.notice("Extended header: ext_hdr_size = 0x%x = %d", ext_header.ext_hdr_size, ext_header.ext_hdr_size);
|
||||
pkg_log.notice("Extended header: ext_data_size = 0x%x = %d", ext_header.ext_data_size, ext_header.ext_data_size);
|
||||
@@ -119,12 +113,6 @@ bool package_reader::read_header()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (u64{umax} / sizeof(PKGEntry) < m_header.file_count)
|
||||
{
|
||||
pkg_log.error("PKG file count is too large! (0x%x)", m_header.file_count);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (const u16 type = m_header.pkg_type)
|
||||
{
|
||||
case PKG_RELEASE_TYPE_DEBUG: break;
|
||||
@@ -200,6 +188,11 @@ bool package_reader::read_header()
|
||||
|
||||
bool package_reader::read_metadata()
|
||||
{
|
||||
if (!decrypt_data())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read title ID and use it as an installation directory
|
||||
m_install_dir.resize(9);
|
||||
archive_read_block(55, &m_install_dir.front(), m_install_dir.size());
|
||||
@@ -314,7 +307,7 @@ bool package_reader::read_metadata()
|
||||
if (packet.size == sizeof(m_metadata.qa_digest))
|
||||
{
|
||||
archive_read(&m_metadata.qa_digest, sizeof(m_metadata.qa_digest));
|
||||
pkg_log.notice("Metadata: QA Digest = %s", std::span<const u8>(m_metadata.qa_digest, sizeof(m_metadata.qa_digest)));
|
||||
pkg_log.notice("Metadata: QA Digest = 0x%x", m_metadata.qa_digest);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -486,7 +479,7 @@ bool package_reader::read_metadata()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool package_reader::set_decryption_key()
|
||||
bool package_reader::decrypt_data()
|
||||
{
|
||||
if (!m_is_valid)
|
||||
{
|
||||
@@ -501,76 +494,12 @@ bool package_reader::set_decryption_key()
|
||||
aes_context ctx;
|
||||
aes_setkey_enc(&ctx, m_metadata.content_type == 0x15u ? PKG_AES_KEY_VITA_1 : m_metadata.content_type == 0x16u ? PKG_AES_KEY_VITA_2 : PKG_AES_KEY_VITA_3, 128);
|
||||
aes_crypt_ecb(&ctx, AES_ENCRYPT, reinterpret_cast<const uchar*>(&m_header.klicensee), m_dec_key.data());
|
||||
return true;
|
||||
decrypt(0, m_header.file_count * sizeof(PKGEntry), m_dec_key.data());
|
||||
}
|
||||
|
||||
std::memcpy(m_dec_key.data(), PKG_AES_KEY, m_dec_key.size());
|
||||
|
||||
if (std::vector<PKGEntry> entries; !read_entries(entries))
|
||||
else
|
||||
{
|
||||
pkg_log.notice("PKG may be IDU, retrying with IDU key.");
|
||||
|
||||
std::memcpy(m_dec_key.data(), PKG_AES_KEY_IDU, m_dec_key.size());
|
||||
|
||||
if (!read_entries(entries))
|
||||
{
|
||||
pkg_log.error("PKG decryption failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool package_reader::read_entries(std::vector<PKGEntry>& entries)
|
||||
{
|
||||
entries.clear();
|
||||
entries.resize(m_header.file_count + BUF_PADDING / sizeof(PKGEntry) + 1);
|
||||
|
||||
const usz read_size = decrypt(0, m_header.file_count * sizeof(PKGEntry), m_dec_key.data(), entries.data());
|
||||
|
||||
if (read_size < m_header.file_count * sizeof(PKGEntry))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
entries.resize(m_header.file_count);
|
||||
|
||||
const usz fsz = m_file.size() - m_header.data_offset;
|
||||
|
||||
// Data integrity validation
|
||||
for (const PKGEntry& entry : entries)
|
||||
{
|
||||
if (!entry.name_size)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.name_size > PKG_MAX_FILENAME_SIZE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fsz < entry.name_size || fsz - entry.name_size < entry.name_offset)
|
||||
{
|
||||
// Name exceeds file(s)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry.file_size)
|
||||
{
|
||||
if (fsz < entry.file_size || fsz - entry.file_size < entry.file_offset)
|
||||
{
|
||||
// Data exceeds file(s)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry.name_offset == entry.file_offset)
|
||||
{
|
||||
// Repeated value: odd
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::memcpy(m_dec_key.data(), PKG_AES_KEY, m_dec_key.size());
|
||||
decrypt(0, m_header.file_count * sizeof(PKGEntry), m_header.pkg_platform == PKG_PLATFORM_TYPE_PSP_PSVITA ? PKG_AES_KEY2 : m_dec_key.data());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -578,34 +507,28 @@ bool package_reader::read_entries(std::vector<PKGEntry>& entries)
|
||||
|
||||
bool package_reader::read_param_sfo()
|
||||
{
|
||||
std::vector<PKGEntry> entries;
|
||||
|
||||
if (!read_entries(entries))
|
||||
if (!decrypt_data())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<u8> data_buf;
|
||||
std::vector<PKGEntry> entries(m_header.file_count);
|
||||
|
||||
std::memcpy(entries.data(), m_bufs.back().get(), entries.size() * sizeof(PKGEntry));
|
||||
|
||||
for (const PKGEntry& entry : entries)
|
||||
{
|
||||
if (entry.name_size > PKG_MAX_FILENAME_SIZE)
|
||||
if (entry.name_size > 256)
|
||||
{
|
||||
pkg_log.error("PKG name size is too big (size=0x%x, offset=0x%x)", entry.name_size, entry.name_offset);
|
||||
pkg_log.error("PKG name size is too big (0x%x)", entry.name_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool is_psp = (entry.type & PKG_FILE_ENTRY_PSP) != 0u;
|
||||
|
||||
std::string name(entry.name_size + BUF_PADDING, '\0');
|
||||
decrypt(entry.name_offset, entry.name_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data());
|
||||
|
||||
if (usz read_size = decrypt(entry.name_offset, entry.name_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), name.data()); read_size < entry.name_size)
|
||||
{
|
||||
pkg_log.error("PKG name could not be read (size=0x%x, offset=0x%x)", entry.name_size, entry.name_offset);
|
||||
continue;
|
||||
}
|
||||
|
||||
fmt::trim_back(name, "\0"sv);
|
||||
const std::string_view name{reinterpret_cast<char*>(m_bufs.back().get()), entry.name_size};
|
||||
|
||||
// We're looking for the PARAM.SFO file, if there is any
|
||||
if (usz ndelim = name.find_first_not_of('/'); ndelim == umax || name.substr(ndelim) != "PARAM.SFO")
|
||||
@@ -614,21 +537,19 @@ bool package_reader::read_param_sfo()
|
||||
}
|
||||
|
||||
// Read the package's PARAM.SFO
|
||||
fs::file tmp = fs::make_stream<std::vector<uchar>>();
|
||||
if (fs::file tmp = fs::make_stream<std::vector<uchar>>())
|
||||
{
|
||||
for (u64 pos = 0; pos < entry.file_size; pos += BUF_SIZE)
|
||||
{
|
||||
const u64 block_size = std::min<u64>(BUF_SIZE, entry.file_size - pos);
|
||||
|
||||
data_buf.resize(block_size + BUF_PADDING);
|
||||
|
||||
if (decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), data_buf.data()) != block_size)
|
||||
if (decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data()).size() != block_size)
|
||||
{
|
||||
pkg_log.error("Failed to decrypt PARAM.SFO file");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tmp.write(data_buf.data(), block_size) != block_size)
|
||||
if (tmp.write(m_bufs.back().get(), block_size) != block_size)
|
||||
{
|
||||
pkg_log.error("Failed to write to temporary PARAM.SFO file");
|
||||
return false;
|
||||
@@ -647,6 +568,9 @@ bool package_reader::read_param_sfo()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pkg_log.error("Failed to create temporary PARAM.SFO file");
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -834,38 +758,31 @@ bool package_reader::fill_data(std::map<std::string, install_entry*>& all_instal
|
||||
m_entry_indexer = 0;
|
||||
m_written_bytes = 0;
|
||||
|
||||
usz num_failures = 0;
|
||||
|
||||
std::vector<PKGEntry> entries;
|
||||
|
||||
if (!read_entries(entries))
|
||||
if (!decrypt_data())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
usz num_failures = 0;
|
||||
|
||||
std::vector<PKGEntry> entries(m_header.file_count);
|
||||
|
||||
std::memcpy(entries.data(), m_bufs.back().get(), entries.size() * sizeof(PKGEntry));
|
||||
|
||||
// Create directories first
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.name_size > PKG_MAX_FILENAME_SIZE)
|
||||
{
|
||||
num_failures++;
|
||||
pkg_log.error("PKG name size is too big (size=0x%x, offset=0x%x)", entry.name_size, entry.name_offset);
|
||||
pkg_log.error("PKG name size is too big (0x%x)", entry.name_size);
|
||||
break;
|
||||
}
|
||||
|
||||
std::string name(entry.name_size + BUF_PADDING, '\0');
|
||||
|
||||
const bool is_psp = (entry.type & PKG_FILE_ENTRY_PSP) != 0u;
|
||||
decrypt(entry.name_offset, entry.name_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data());
|
||||
|
||||
if (const usz read_size = decrypt(entry.name_offset, entry.name_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), name.data()); read_size < entry.name_size)
|
||||
{
|
||||
num_failures++;
|
||||
pkg_log.error("PKG name could not be read (size=0x%x, offset=0x%x)", entry.name_size, entry.name_offset);
|
||||
break;
|
||||
}
|
||||
|
||||
fmt::trim_back(name, "\0"sv);
|
||||
|
||||
const std::string_view name{reinterpret_cast<char*>(m_bufs.back().get()), entry.name_size};
|
||||
std::string path = m_install_path + vfs::escape(name);
|
||||
|
||||
if (entry.pad || (entry.type & ~PKG_FILE_ENTRY_KNOWN_BITS))
|
||||
@@ -947,7 +864,7 @@ bool package_reader::fill_data(std::map<std::string, install_entry*>& all_instal
|
||||
|
||||
fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic);
|
||||
|
||||
void package_reader::extract_worker()
|
||||
void package_reader::extract_worker(thread_key thread_data_key)
|
||||
{
|
||||
std::vector<u8> read_cache;
|
||||
|
||||
@@ -1143,21 +1060,23 @@ void package_reader::extract_worker()
|
||||
{
|
||||
const u64 block_size = std::min<u64>({BUF_SIZE, std::max<u64>(size * 5 / 3, 65536), entry.file_size - pos});
|
||||
|
||||
read_cache.resize(block_size + BUF_PADDING);
|
||||
read_cache.resize(block_size);
|
||||
cache_off = pos;
|
||||
|
||||
const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), read_cache.data());
|
||||
const std::span<const char> data_span = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), thread_data_key);
|
||||
|
||||
if (!advance_size)
|
||||
if (data_span.empty())
|
||||
{
|
||||
cache_off = umax;
|
||||
read_cache.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
read_cache.resize(advance_size);
|
||||
read_cache.resize(data_span.size());
|
||||
std::memcpy(read_cache.data(), data_span.data(), data_span.size());
|
||||
|
||||
size = std::min<usz>(advance_size, size);
|
||||
std::memcpy(ptr, read_cache.data(), size);
|
||||
size = std::min<usz>(data_span.size(), size);
|
||||
std::memcpy(ptr, data_span.data(), size);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -1165,15 +1084,17 @@ void package_reader::extract_worker()
|
||||
{
|
||||
const u64 block_size = std::min<u64>(BUF_SIZE, size - read_size);
|
||||
|
||||
const usz advance_size = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), static_cast<u8*>(ptr) + read_size);
|
||||
const std::span<const char> data_span = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), thread_data_key);
|
||||
|
||||
if (!advance_size)
|
||||
if (data_span.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
read_size += advance_size;
|
||||
pos += advance_size;
|
||||
std::memcpy(static_cast<u8*>(ptr) + read_size, data_span.data(), data_span.size());
|
||||
|
||||
read_size += data_span.size();
|
||||
pos += data_span.size();
|
||||
}
|
||||
|
||||
return read_size + size_cache_end;
|
||||
@@ -1201,9 +1122,9 @@ void package_reader::extract_worker()
|
||||
}
|
||||
|
||||
// 16MB buffer
|
||||
std::vector<u8> buffer(std::min<usz>(entry.file_size, 1u << 24) + BUF_PADDING);
|
||||
std::vector<u8> buffer(std::min<usz>(entry.file_size, 1u << 24));
|
||||
|
||||
while (usz read_size = final_data.read(buffer.data(), buffer.size() - BUF_PADDING))
|
||||
while (usz read_size = final_data.read(buffer.data(), buffer.size()))
|
||||
{
|
||||
out.write(buffer.data(), read_size);
|
||||
m_written_bytes += read_size;
|
||||
@@ -1304,15 +1225,20 @@ package_install_result package_reader::extract_data(std::deque<package_reader>&
|
||||
|
||||
if (reader.m_num_failures == 0)
|
||||
{
|
||||
const usz thread_count = std::min<usz>(utils::get_thread_count(), reader.m_install_entries.size());
|
||||
reader.m_bufs.resize(std::min<usz>(utils::get_thread_count(), reader.m_install_entries.size()));
|
||||
|
||||
named_thread_group workers("PKG Installer "sv, std::max<u32>(::narrow<u32>(thread_count), 1) - 1, [&]()
|
||||
atomic_t<usz> thread_indexer = 0;
|
||||
|
||||
named_thread_group workers("PKG Installer "sv, std::max<u32>(::narrow<u32>(reader.m_bufs.size()), 1) - 1, [&]()
|
||||
{
|
||||
reader.extract_worker();
|
||||
reader.extract_worker(thread_key{thread_indexer++});
|
||||
});
|
||||
|
||||
reader.extract_worker();
|
||||
reader.extract_worker(thread_key{thread_indexer++});
|
||||
workers.join();
|
||||
|
||||
reader.m_bufs.clear();
|
||||
reader.m_bufs.shrink_to_fit();
|
||||
}
|
||||
|
||||
num_failures += reader.m_num_failures;
|
||||
@@ -1387,25 +1313,33 @@ std::span<const char> package_reader::archive_read_block(u64 offset, void* data_
|
||||
return {static_cast<const char*>(data_ptr), read_n};
|
||||
}
|
||||
|
||||
usz package_reader::decrypt(u64 offset, u64 size, const uchar* key, void* local_buf)
|
||||
std::span<const char> package_reader::decrypt(u64 offset, u64 size, const uchar* key, thread_key thread_data_key)
|
||||
{
|
||||
if (!m_is_valid)
|
||||
{
|
||||
return 0;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (m_header.data_offset > ~offset)
|
||||
if (m_bufs.empty())
|
||||
{
|
||||
return 0;
|
||||
// Assume in single-threaded mode still
|
||||
m_bufs.resize(1);
|
||||
}
|
||||
|
||||
auto& local_buf = ::at32(m_bufs, thread_data_key.unique_num);
|
||||
|
||||
if (!local_buf)
|
||||
{
|
||||
// Allocate buffer with BUF_SIZE size or more if required
|
||||
local_buf.reset(new u128[std::max<u64>(BUF_SIZE, sizeof(PKGEntry) * m_header.file_count) / sizeof(u128)]);
|
||||
}
|
||||
|
||||
// Read the data and set available size
|
||||
const auto data_span = archive_read_block(m_header.data_offset + offset, local_buf, size);
|
||||
ensure(data_span.data() == static_cast<void*>(local_buf));
|
||||
const auto data_span = archive_read_block(m_header.data_offset + offset, local_buf.get(), size);
|
||||
ensure(data_span.data() == static_cast<void*>(local_buf.get()));
|
||||
|
||||
// Get block count
|
||||
const u64 blocks = (data_span.size() + 15) / 16;
|
||||
const auto out_data = reinterpret_cast<u8*>(local_buf);
|
||||
|
||||
if (m_header.pkg_type == PKG_RELEASE_TYPE_DEBUG)
|
||||
{
|
||||
@@ -1423,15 +1357,15 @@ usz package_reader::decrypt(u64 offset, u64 size, const uchar* key, void* local_
|
||||
// Initialize stream cipher for current position
|
||||
input[7] = offset / 16 + i;
|
||||
|
||||
struct sha1_hash
|
||||
union sha1_hash
|
||||
{
|
||||
u8 data[20];
|
||||
} hash{};
|
||||
u128 _v128;
|
||||
} hash;
|
||||
|
||||
sha1(reinterpret_cast<const u8*>(input), sizeof(input), hash.data);
|
||||
|
||||
const u128 v = read_from_ptr<u128>(out_data, i * 16);
|
||||
write_to_ptr<u128>(out_data, i * 16, v ^ read_from_ptr<u128>(hash.data));
|
||||
local_buf[i] ^= hash._v128;
|
||||
}
|
||||
}
|
||||
else if (m_header.pkg_type == PKG_RELEASE_TYPE_RELEASE)
|
||||
@@ -1451,8 +1385,7 @@ usz package_reader::decrypt(u64 offset, u64 size, const uchar* key, void* local_
|
||||
|
||||
aes_crypt_ecb(&ctx, AES_ENCRYPT, reinterpret_cast<const u8*>(&input), reinterpret_cast<u8*>(&key));
|
||||
|
||||
const u128 v = read_from_ptr<u128>(out_data, i * 16);
|
||||
write_to_ptr<u128>(out_data, i * 16, v ^ key);
|
||||
local_buf[i] ^= key;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1460,14 +1393,8 @@ usz package_reader::decrypt(u64 offset, u64 size, const uchar* key, void* local_
|
||||
pkg_log.error("Unknown release type (0x%x)", m_header.pkg_type);
|
||||
}
|
||||
|
||||
if (blocks * 16 != size)
|
||||
{
|
||||
// Put NTS and other zeroes on unaligned reads
|
||||
std::memset(out_data + size, 0, blocks * 16 - size);
|
||||
}
|
||||
|
||||
// Return the amount of data written in buf
|
||||
return std::min<usz>(size, data_span.size());
|
||||
return data_span;
|
||||
}
|
||||
|
||||
int package_reader::get_progress(int maximum) const
|
||||
|
||||
+10
-6
@@ -314,6 +314,11 @@ struct package_install_result
|
||||
|
||||
class package_reader
|
||||
{
|
||||
struct thread_key
|
||||
{
|
||||
const usz unique_num = umax;
|
||||
};
|
||||
|
||||
struct install_entry
|
||||
{
|
||||
typename std::map<std::string, install_entry*>::value_type* weak_reference{};
|
||||
@@ -349,7 +354,7 @@ public:
|
||||
bool is_valid() const { return m_is_valid; }
|
||||
package_install_result check_target_app_version() const;
|
||||
static package_install_result extract_data(std::deque<package_reader>& readers, std::deque<std::string>& bootable_paths);
|
||||
const psf::registry& get_psf() const { return m_psf; }
|
||||
psf::registry get_psf() const { return m_psf; }
|
||||
result get_result() const { return m_result; };
|
||||
|
||||
int get_progress(int maximum = 100) const;
|
||||
@@ -360,15 +365,14 @@ private:
|
||||
bool read_header();
|
||||
bool read_metadata();
|
||||
bool read_param_sfo();
|
||||
bool set_decryption_key();
|
||||
bool read_entries(std::vector<PKGEntry>& entries);
|
||||
bool decrypt_data();
|
||||
void archive_seek(s64 new_offset, const fs::seek_mode damode = fs::seek_set);
|
||||
u64 archive_read(void* data_ptr, u64 num_bytes);
|
||||
bool set_install_path();
|
||||
bool fill_data(std::map<std::string, install_entry*>& all_install_entries);
|
||||
std::span<const char> archive_read_block(u64 offset, void* data_ptr, u64 num_bytes);
|
||||
usz decrypt(u64 offset, u64 size, const uchar* key, void* local_buf);
|
||||
void extract_worker();
|
||||
std::span<const char> decrypt(u64 offset, u64 size, const uchar* key, thread_key thread_data_key = {0});
|
||||
void extract_worker(thread_key thread_data_key);
|
||||
|
||||
std::deque<install_entry> m_install_entries;
|
||||
std::string m_install_path;
|
||||
@@ -379,7 +383,6 @@ private:
|
||||
bool m_was_null = false;
|
||||
|
||||
static constexpr usz BUF_SIZE = 8192 * 1024; // 8 MB
|
||||
static constexpr usz BUF_PADDING = 32;
|
||||
|
||||
bool m_is_valid = false;
|
||||
result m_result = result::not_started;
|
||||
@@ -387,6 +390,7 @@ private:
|
||||
std::string m_path{};
|
||||
std::string m_install_dir{};
|
||||
fs::file m_file{};
|
||||
std::vector<std::unique_ptr<u128[]>> m_bufs{};
|
||||
std::array<uchar, 16> m_dec_key{};
|
||||
|
||||
PKGHeader m_header{};
|
||||
|
||||
+26
-14
@@ -1,11 +1,14 @@
|
||||
#include "stdafx.h"
|
||||
#include "aes.h"
|
||||
#include "utils.h"
|
||||
#include "unself.h"
|
||||
#include "util/asm.hpp"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "Crypto/unzip.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
inline u8 Read8(const fs::file& f)
|
||||
{
|
||||
u8 ret;
|
||||
@@ -1045,8 +1048,11 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
}
|
||||
else if (npd->license == 3) // Free license.
|
||||
{
|
||||
// Use klicensee if available. (may be set to NP_KLIC_FREE if none is set)
|
||||
std::memcpy(npdrm_key, key_v.GetKlicenseeKey(), 0x10);
|
||||
// Use klicensee if available.
|
||||
if (key_v.GetKlicenseeKey())
|
||||
memcpy(npdrm_key, key_v.GetKlicenseeKey(), 0x10);
|
||||
else
|
||||
memcpy(npdrm_key, NP_KLIC_FREE, 0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1082,7 +1088,7 @@ const NPD_HEADER* SELFDecrypter::GetNPDHeader() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadMetadata(const u8* klic_key)
|
||||
bool SELFDecrypter::LoadMetadata(u8* klic_key)
|
||||
{
|
||||
aes_context aes;
|
||||
const auto metadata_info = std::make_unique<u8[]>(sizeof(meta_info));
|
||||
@@ -1316,11 +1322,11 @@ static bool IsDebugSelf(const fs::file& f)
|
||||
return false;
|
||||
}
|
||||
|
||||
static fs::file CheckDebugSelf(const fs::file& s)
|
||||
static bool CheckDebugSelf(fs::file& s)
|
||||
{
|
||||
if (s.size() < 0x18)
|
||||
{
|
||||
return {};
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the key version.
|
||||
@@ -1349,14 +1355,15 @@ static fs::file CheckDebugSelf(const fs::file& s)
|
||||
e.write(buf, size);
|
||||
}
|
||||
|
||||
return e;
|
||||
s = std::move(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Leave the file untouched.
|
||||
return {};
|
||||
return false;
|
||||
}
|
||||
|
||||
fs::file decrypt_self(const fs::file& elf_or_self, const u8* klic_key, SelfAdditionalInfo* out_info)
|
||||
fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* out_info, bool require_encrypted)
|
||||
{
|
||||
if (out_info)
|
||||
{
|
||||
@@ -1373,10 +1380,10 @@ fs::file decrypt_self(const fs::file& elf_or_self, const u8* klic_key, SelfAddit
|
||||
// Check SELF header first. Check for a debug SELF.
|
||||
if (elf_or_self.size() >= 4 && elf_or_self.read<u32>() == "SCE\0"_u32)
|
||||
{
|
||||
if (fs::file res = CheckDebugSelf(elf_or_self))
|
||||
if (CheckDebugSelf(elf_or_self))
|
||||
{
|
||||
// TODO: Decrypt
|
||||
return res;
|
||||
return elf_or_self;
|
||||
}
|
||||
|
||||
// Check the ELF file class (32 or 64 bit).
|
||||
@@ -1395,14 +1402,14 @@ fs::file decrypt_self(const fs::file& elf_or_self, const u8* klic_key, SelfAddit
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata(klic_key))
|
||||
{
|
||||
(klic_key ? self_log.notice : self_log.error)("Failed to load SELF file metadata!");
|
||||
self_log.error("Failed to load SELF file metadata!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
// Decrypt the SELF file data.
|
||||
if (!self_dec.DecryptData())
|
||||
{
|
||||
(klic_key ? self_log.notice : self_log.error)("Failed to decrypt SELF file data!");
|
||||
self_log.error("Failed to decrypt SELF file data!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
@@ -1410,7 +1417,12 @@ fs::file decrypt_self(const fs::file& elf_or_self, const u8* klic_key, SelfAddit
|
||||
return self_dec.MakeElf(isElf32);
|
||||
}
|
||||
|
||||
return {};
|
||||
if (require_encrypted)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return elf_or_self;
|
||||
}
|
||||
|
||||
bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key, NPD_HEADER* npd_out)
|
||||
|
||||
@@ -476,7 +476,7 @@ public:
|
||||
fs::file MakeElf(bool isElf32);
|
||||
bool LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info = nullptr);
|
||||
void ShowHeaders(bool isElf32);
|
||||
bool LoadMetadata(const u8* klic_key);
|
||||
bool LoadMetadata(u8* klic_key);
|
||||
bool DecryptData();
|
||||
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
|
||||
const NPD_HEADER* GetNPDHeader() const;
|
||||
@@ -559,7 +559,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
fs::file decrypt_self(const fs::file& elf_or_self, const u8* klic_key = nullptr, SelfAdditionalInfo* additional_info = nullptr);
|
||||
fs::file decrypt_self(fs::file elf_or_self, u8* klic_key = nullptr, SelfAdditionalInfo* additional_info = nullptr, bool require_encrypted = false);
|
||||
bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key = nullptr, NPD_HEADER* npd_out = nullptr);
|
||||
bool get_npdrm_self_header(const fs::file& self, NPD_HEADER& npd);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/asm.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "AudioBackend.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu//Cell/Modules/cellAudioOut.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "Emu/Audio/Cubeb/CubebBackend.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include "util/logs.hpp"
|
||||
#include "Emu/Audio/audio_device_enumerator.h"
|
||||
|
||||
@@ -39,8 +38,6 @@ CubebBackend::CubebBackend()
|
||||
m_dev_collection_cb_enabled = true;
|
||||
}
|
||||
|
||||
cubeb_set_log_callback(CUBEB_LOG_NORMAL, log_cb);
|
||||
|
||||
Cubeb.notice("Using backend %s", cubeb_get_backend_id(ctx));
|
||||
|
||||
std::lock_guard cb_lock{m_state_cb_mutex};
|
||||
@@ -571,15 +568,3 @@ void CubebBackend::device_collection_changed_cb(cubeb* context, void* user_ptr)
|
||||
cubeb->m_state_callback(AudioStateEvent::DEFAULT_DEVICE_MAYBE_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
void CubebBackend::log_cb(const char* fmt, ...)
|
||||
{
|
||||
char buf[256]{};
|
||||
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
vsnprintf(buf, sizeof(buf) - 1, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
Cubeb.notice("Cubeb log: %s", buf);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "Utilities/mutex.h"
|
||||
#include "util/atomic.hpp"
|
||||
#include "Emu/Audio/AudioBackend.h"
|
||||
|
||||
@@ -51,7 +53,6 @@ private:
|
||||
static long data_cb(cubeb_stream* stream, void* user_ptr, void const* input_buffer, void* output_buffer, long nframes);
|
||||
static void state_cb(cubeb_stream* stream, void* user_ptr, cubeb_state state);
|
||||
static void device_collection_changed_cb(cubeb* context, void* user_ptr);
|
||||
static void log_cb(const char *fmt, ...);
|
||||
|
||||
struct device_handle
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FAudioBackend.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Audio/audio_device_enumerator.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#error "FAudio support disabled but still being built."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Emu/Audio/AudioBackend.h"
|
||||
|
||||
#include "FAudio.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#endif
|
||||
|
||||
#include "Emu/Audio/FAudio/faudio_enumerator.h"
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "util/logs.hpp"
|
||||
|
||||
@@ -65,7 +65,7 @@ XAudio2Backend::XAudio2Backend()
|
||||
m_com_init_success = true;
|
||||
}
|
||||
|
||||
if (HRESULT hr = XAudio2Create(&instance, 0, XAUDIO2_USE_DEFAULT_PROCESSOR); FAILED(hr))
|
||||
if (HRESULT hr = XAudio2Create(instance.GetAddressOf(), 0, XAUDIO2_USE_DEFAULT_PROCESSOR); FAILED(hr))
|
||||
{
|
||||
XAudio.error("XAudio2Create() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
return;
|
||||
@@ -78,7 +78,7 @@ XAudio2Backend::XAudio2Backend()
|
||||
}
|
||||
|
||||
// Try to register a listener for device changes
|
||||
if (HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&enumerator)); FAILED(hr))
|
||||
if (HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(enumerator.GetAddressOf())); FAILED(hr))
|
||||
{
|
||||
XAudio.error("CoCreateInstance() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
return;
|
||||
@@ -215,7 +215,7 @@ bool XAudio2Backend::Open(std::string_view dev_id, AudioFreq freq, AudioSampleSi
|
||||
if (use_default_device)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<IMMDevice> default_dev{};
|
||||
if (HRESULT hr = m_device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &default_dev); FAILED(hr))
|
||||
if (HRESULT hr = m_device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, default_dev.GetAddressOf()); FAILED(hr))
|
||||
{
|
||||
XAudio.error("GetDefaultAudioEndpoint() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
return false;
|
||||
@@ -319,7 +319,7 @@ f64 XAudio2Backend::GetCallbackFrameLen()
|
||||
Microsoft::WRL::ComPtr<IXAudio2Extension> xaudio_ext{};
|
||||
f64 min_latency{};
|
||||
|
||||
if (HRESULT hr = m_xaudio2_instance.As(&xaudio_ext); 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));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#error "XAudio2 can only be built on Windows."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Emu/Audio/AudioBackend.h"
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ xaudio2_enumerator::~xaudio2_enumerator()
|
||||
std::vector<audio_device_enumerator::audio_device> xaudio2_enumerator::get_output_devices()
|
||||
{
|
||||
Microsoft::WRL::ComPtr<IMMDeviceEnumerator> devEnum{};
|
||||
if (HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&devEnum)); FAILED(hr))
|
||||
if (HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(devEnum.GetAddressOf())); FAILED(hr))
|
||||
{
|
||||
xaudio_dev_enum.error("CoCreateInstance() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
return {};
|
||||
@@ -57,7 +57,7 @@ std::vector<audio_device_enumerator::audio_device> xaudio2_enumerator::get_outpu
|
||||
for (UINT dev_idx = 0; dev_idx < count; dev_idx++)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<IMMDevice> endpoint{};
|
||||
if (HRESULT hr = devices->Item(dev_idx, &endpoint); FAILED(hr))
|
||||
if (HRESULT hr = devices->Item(dev_idx, endpoint.GetAddressOf()); FAILED(hr))
|
||||
{
|
||||
xaudio_dev_enum.error("devices->Item() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
continue;
|
||||
@@ -83,7 +83,7 @@ std::vector<audio_device_enumerator::audio_device> xaudio2_enumerator::get_outpu
|
||||
CoTaskMemFree(id);
|
||||
|
||||
Microsoft::WRL::ComPtr<IPropertyStore> props{};
|
||||
if (HRESULT hr = endpoint->OpenPropertyStore(STGM_READ, &props); FAILED(hr))
|
||||
if (HRESULT hr = endpoint->OpenPropertyStore(STGM_READ, props.GetAddressOf()); FAILED(hr))
|
||||
{
|
||||
xaudio_dev_enum.error("endpoint->OpenPropertyStore() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
|
||||
continue;
|
||||
|
||||
@@ -20,10 +20,6 @@ add_library(rpcs3_emu STATIC
|
||||
IPC_socket.cpp
|
||||
)
|
||||
|
||||
if(USE_LTO)
|
||||
set_target_properties(rpcs3_emu PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
endif()
|
||||
|
||||
if(USE_ASAN)
|
||||
set_source_files_properties(../../Utilities/Thread.cpp PROPERTIES COMPILE_DEFINITIONS USE_ASAN)
|
||||
endif()
|
||||
@@ -48,7 +44,6 @@ target_include_directories(rpcs3_emu
|
||||
target_sources(rpcs3_emu PRIVATE
|
||||
../util/atomic.cpp
|
||||
../util/console.cpp
|
||||
../util/emu_utils.cpp
|
||||
../util/media_utils.cpp
|
||||
../util/video_provider.cpp
|
||||
../util/logs.cpp
|
||||
@@ -62,7 +57,6 @@ target_sources(rpcs3_emu PRIVATE
|
||||
../../Utilities/cheat_info.cpp
|
||||
../../Utilities/cond.cpp
|
||||
../../Utilities/Config.cpp
|
||||
../../Utilities/date_time.cpp
|
||||
../../Utilities/File.cpp
|
||||
../../Utilities/JITASM.cpp
|
||||
../../Utilities/JITLLVM.cpp
|
||||
@@ -468,7 +462,6 @@ target_sources(rpcs3_emu PRIVATE
|
||||
NP/rpcn_countries.cpp
|
||||
NP/upnp_config.cpp
|
||||
NP/upnp_handler.cpp
|
||||
NP/ip_address.cpp
|
||||
)
|
||||
|
||||
# Memory
|
||||
@@ -484,9 +477,7 @@ target_sources(rpcs3_emu PRIVATE
|
||||
RSX/Common/surface_store.cpp
|
||||
RSX/Common/TextureUtils.cpp
|
||||
RSX/Common/texture_cache.cpp
|
||||
RSX/Common/texture_cache_types.cpp
|
||||
RSX/Core/RSXContext.cpp
|
||||
RSX/Core/RSXDisplay.cpp
|
||||
RSX/Core/RSXDrawCommands.cpp
|
||||
RSX/gcm_enums.cpp
|
||||
RSX/gcm_printing.cpp
|
||||
@@ -501,7 +492,6 @@ target_sources(rpcs3_emu PRIVATE
|
||||
RSX/GL/GLPipelineCompiler.cpp
|
||||
RSX/GL/GLPresent.cpp
|
||||
RSX/GL/GLRenderTargets.cpp
|
||||
RSX/GL/GLResolveHelper.cpp
|
||||
RSX/GL/GLShaderInterpreter.cpp
|
||||
RSX/GL/GLTexture.cpp
|
||||
RSX/GL/GLTextureCache.cpp
|
||||
@@ -574,7 +564,6 @@ target_sources(rpcs3_emu PRIVATE
|
||||
RSX/Program/program_util.cpp
|
||||
RSX/Program/SPIRVCommon.cpp
|
||||
RSX/Program/VertexProgramDecompiler.cpp
|
||||
RSX/GSFrameBase.cpp
|
||||
RSX/RSXDisAsm.cpp
|
||||
RSX/RSXFIFO.cpp
|
||||
RSX/RSXOffload.cpp
|
||||
@@ -640,7 +629,7 @@ target_link_libraries(rpcs3_emu
|
||||
3rdparty::vulkan 3rdparty::glew
|
||||
3rdparty::libusb 3rdparty::wolfssl
|
||||
PRIVATE
|
||||
3rdparty::glslang
|
||||
3rdparty::xxhash
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
@@ -110,8 +110,7 @@ protected:
|
||||
virtual u32 DisAsmBranchTarget(s32 /*imm*/);
|
||||
|
||||
// TODO: Add builtin fmt helpper for best performance
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
template <typename T, std::enable_if_t<std::is_integral_v<T>, int> = 0>
|
||||
static std::string SignedHex(T value)
|
||||
{
|
||||
const auto v = static_cast<std::make_signed_t<T>>(value);
|
||||
|
||||
@@ -1302,7 +1302,7 @@ cpu_thread* cpu_thread::get_next_cpu()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern std::shared_ptr<CPUDisAsm> make_disasm(const cpu_thread* cpu, shared_ptr<cpu_thread> handle);
|
||||
std::shared_ptr<CPUDisAsm> make_disasm(const cpu_thread* cpu, shared_ptr<cpu_thread> handle);
|
||||
|
||||
void cpu_thread::dump_all(std::string& ret) const
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CPUTranslator.h"
|
||||
|
||||
#include "util/v128.hpp"
|
||||
#include "util/simd.hpp"
|
||||
#include "util/logs.hpp"
|
||||
|
||||
LOG_CHANNEL(llvm_log, "LLVM");
|
||||
|
||||
+63
-108
@@ -2,12 +2,6 @@
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/sysinfo.hpp"
|
||||
#include "Utilities/StrFmt.h"
|
||||
#include "Utilities/JIT.h"
|
||||
#include "util/v128.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
@@ -27,12 +21,11 @@
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/KnownBits.h"
|
||||
#include "llvm/Support/ModRef.h"
|
||||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/IntrinsicsX86.h"
|
||||
#ifdef ARCH_ARM64
|
||||
#include "llvm/IR/IntrinsicsAArch64.h"
|
||||
#endif
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -41,6 +34,13 @@
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/sysinfo.hpp"
|
||||
#include "Utilities/StrFmt.h"
|
||||
#include "Utilities/BitField.h"
|
||||
#include "Utilities/JIT.h"
|
||||
|
||||
#include "util/v128.hpp"
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -62,8 +62,9 @@ template <typename T>
|
||||
concept LLVMValue = (std::is_pointer_v<T>) && (std::is_base_of_v<llvm::Value, std::remove_pointer_t<T>>);
|
||||
|
||||
template <typename T>
|
||||
concept DSLValue = requires(T& v, llvm::IRBuilder<>* ir) {
|
||||
{ v.eval(ir) } -> LLVMValue;
|
||||
concept DSLValue = requires (T& v)
|
||||
{
|
||||
{ v.eval(std::declval<llvm::IRBuilder<>*>()) } -> LLVMValue;
|
||||
};
|
||||
|
||||
template <usz N>
|
||||
@@ -477,33 +478,31 @@ struct llvm_value_t<T[N]> : llvm_value_t<std::conditional_t<(std::extent_v<T> >
|
||||
template <typename T>
|
||||
using llvm_expr_t = std::decay_t<T>;
|
||||
|
||||
template <typename T>
|
||||
template <typename T, typename = void>
|
||||
struct is_llvm_expr
|
||||
{
|
||||
};
|
||||
|
||||
template <DSLValue T>
|
||||
struct is_llvm_expr<T>
|
||||
template <typename T>
|
||||
struct is_llvm_expr<T, std::void_t<decltype(std::declval<T>().eval(std::declval<llvm::IRBuilder<>*>()))>>
|
||||
{
|
||||
using type = typename std::decay_t<T>::type;
|
||||
};
|
||||
|
||||
template <typename T, typename Of>
|
||||
template <typename T, typename Of, typename = void>
|
||||
struct is_llvm_expr_of
|
||||
{
|
||||
static constexpr bool ok = false;
|
||||
};
|
||||
|
||||
template <typename T, typename Of>
|
||||
requires(requires { typename is_llvm_expr<T>::type; } && requires { typename is_llvm_expr<Of>::type; })
|
||||
struct is_llvm_expr_of<T, Of>
|
||||
struct is_llvm_expr_of<T, Of, std::void_t<typename is_llvm_expr<T>::type, typename is_llvm_expr<Of>::type>>
|
||||
{
|
||||
static constexpr bool ok = std::is_same_v<typename is_llvm_expr<T>::type, typename is_llvm_expr<Of>::type>;
|
||||
};
|
||||
|
||||
template <typename T, typename... Types>
|
||||
requires(is_llvm_expr_of<T, Types>::ok && ...)
|
||||
using llvm_common_t = typename is_llvm_expr<T>::type;
|
||||
using llvm_common_t = std::enable_if_t<(is_llvm_expr_of<T, Types>::ok && ...), typename is_llvm_expr<T>::type>;
|
||||
|
||||
template <typename... Args>
|
||||
using llvm_match_tuple = decltype(std::tuple_cat(std::declval<llvm_expr_t<Args>&>().match(std::declval<llvm::Value*&>(), nullptr)...));
|
||||
@@ -1609,8 +1608,7 @@ struct llvm_ord
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires is_llvm_cmp<std::decay_t<T>>::value
|
||||
llvm_ord(T&&) -> llvm_ord<T&&>;
|
||||
llvm_ord(T&&) -> llvm_ord<std::enable_if_t<is_llvm_cmp<std::decay_t<T>>::value, T&&>>;
|
||||
|
||||
template <typename Cmp, typename T = llvm_common_t<Cmp>>
|
||||
struct llvm_uno
|
||||
@@ -1663,8 +1661,7 @@ struct llvm_uno
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
requires is_llvm_cmp<std::decay_t<T>>::value
|
||||
llvm_uno(T&&) -> llvm_uno<T&&>;
|
||||
llvm_uno(T&&) -> llvm_uno<std::enable_if_t<is_llvm_cmp<std::decay_t<T>>::value, T&&>>;
|
||||
|
||||
template <typename T1, typename T2>
|
||||
inline llvm_cmp<T1, T2, llvm::ICmpInst::ICMP_EQ> operator ==(T1&& a1, T2&& a2)
|
||||
@@ -3025,7 +3022,7 @@ struct llvm_calli
|
||||
if (((std::get<I>(r) = std::get<I>(a).match(v[I], _m), v[I]) && ...))
|
||||
{
|
||||
return std::tuple_cat(std::get<I>(r)...);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3199,16 +3196,14 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires requires { typename llvm_common_t<T>; }
|
||||
template <typename T, typename = llvm_common_t<T>>
|
||||
static auto match_expr(llvm::Value* v, llvm::Module* _m, T&& expr)
|
||||
{
|
||||
auto r = expr.match(v, _m);
|
||||
return std::tuple_cat(std::make_tuple(v != nullptr), r);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires requires { typename llvm_common_t<T, U>; }
|
||||
template <typename T, typename U, typename = llvm_common_t<T, U>>
|
||||
auto match_expr(T&& arg, U&& expr) -> decltype(std::tuple_cat(std::make_tuple(false), expr.match(std::declval<llvm::Value*&>(), nullptr)))
|
||||
{
|
||||
auto v = arg.eval(m_ir);
|
||||
@@ -3243,235 +3238,202 @@ public:
|
||||
return expr_t<T, F>{std::forward<T>(expr), std::move(matcher)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires is_llvm_cmp<std::decay_t<T>>::value
|
||||
template <typename T, typename = std::enable_if_t<is_llvm_cmp<std::decay_t<T>>::value>>
|
||||
static auto fcmp_ord(T&& cmp_expr)
|
||||
{
|
||||
return llvm_ord{std::forward<T>(cmp_expr)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires is_llvm_cmp<std::decay_t<T>>::value
|
||||
template <typename T, typename = std::enable_if_t<is_llvm_cmp<std::decay_t<T>>::value>>
|
||||
static auto fcmp_uno(T&& cmp_expr)
|
||||
{
|
||||
return llvm_uno{std::forward<T>(cmp_expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_noncast<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_noncast<U, T>::is_ok>>
|
||||
static auto noncast(T&& expr)
|
||||
{
|
||||
return llvm_noncast<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_bitcast<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_bitcast<U, T>::is_ok>>
|
||||
static auto bitcast(T&& expr)
|
||||
{
|
||||
return llvm_bitcast<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_fpcast<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_fpcast<U, T>::is_ok>>
|
||||
static auto fpcast(T&& expr)
|
||||
{
|
||||
return llvm_fpcast<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_trunc<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_trunc<U, T>::is_ok>>
|
||||
static auto trunc(T&& expr)
|
||||
{
|
||||
return llvm_trunc<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_sext<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_sext<U, T>::is_ok>>
|
||||
static auto sext(T&& expr)
|
||||
{
|
||||
return llvm_sext<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename U, typename T>
|
||||
requires llvm_zext<U, T>::is_ok
|
||||
template <typename U, typename T, typename = std::enable_if_t<llvm_zext<U, T>::is_ok>>
|
||||
static auto zext(T&& expr)
|
||||
{
|
||||
return llvm_zext<U, T>{std::forward<T>(expr)};
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_select<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_select<T, U, V>::is_ok>>
|
||||
static auto select(T&& c, U&& a, V&& b)
|
||||
{
|
||||
return llvm_select<T, U, V>{std::forward<T>(c), std::forward<U>(a), std::forward<V>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_min<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_min<T, U>::is_ok>>
|
||||
static auto min(T&& a, U&& b)
|
||||
{
|
||||
return llvm_min<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_min<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_min<T, U>::is_ok>>
|
||||
static auto max(T&& a, U&& b)
|
||||
{
|
||||
return llvm_max<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_fshl<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_fshl<T, U, V>::is_ok>>
|
||||
static auto fshl(T&& a, U&& b, V&& c)
|
||||
{
|
||||
return llvm_fshl<T, U, V>{std::forward<T>(a), std::forward<U>(b), std::forward<V>(c)};
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_fshr<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_fshr<T, U, V>::is_ok>>
|
||||
static auto fshr(T&& a, U&& b, V&& c)
|
||||
{
|
||||
return llvm_fshr<T, U, V>{std::forward<T>(a), std::forward<U>(b), std::forward<V>(c)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_rol<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_rol<T, U>::is_ok>>
|
||||
static auto rol(T&& a, U&& b)
|
||||
{
|
||||
return llvm_rol<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_add_sat<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_add_sat<T, U>::is_ok>>
|
||||
static auto add_sat(T&& a, U&& b)
|
||||
{
|
||||
return llvm_add_sat<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_sub_sat<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_sub_sat<T, U>::is_ok>>
|
||||
static auto sub_sat(T&& a, U&& b)
|
||||
{
|
||||
return llvm_sub_sat<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_extract<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_extract<T, U>::is_ok>>
|
||||
static auto extract(T&& v, U&& i)
|
||||
{
|
||||
return llvm_extract<T, U>{std::forward<T>(v), std::forward<U>(i)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_extract<T, llvm_const_int<u32>>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_extract<T, llvm_const_int<u32>>::is_ok>>
|
||||
static auto extract(T&& v, u32 i)
|
||||
{
|
||||
return llvm_extract<T, llvm_const_int<u32>>{std::forward<T>(v), llvm_const_int<u32>{i}};
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_insert<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_insert<T, U, V>::is_ok>>
|
||||
static auto insert(T&& v, U&& i, V&& e)
|
||||
{
|
||||
return llvm_insert<T, U, V>{std::forward<T>(v), std::forward<U>(i), std::forward<V>(e)};
|
||||
}
|
||||
|
||||
template <typename T, typename V>
|
||||
requires llvm_insert<T, llvm_const_int<u32>, V>::is_ok
|
||||
template <typename T, typename V, typename = std::enable_if_t<llvm_insert<T, llvm_const_int<u32>, V>::is_ok>>
|
||||
static auto insert(T&& v, u32 i, V&& e)
|
||||
{
|
||||
return llvm_insert<T, llvm_const_int<u32>, V>{std::forward<T>(v), llvm_const_int<u32>{i}, std::forward<V>(e)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_const_int<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_const_int<T>::is_ok>>
|
||||
static auto splat(u64 c)
|
||||
{
|
||||
return llvm_const_int<T>{c};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_const_float<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_const_float<T>::is_ok>>
|
||||
static auto fsplat(f64 c)
|
||||
{
|
||||
return llvm_const_float<T>{c};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires llvm_splat<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_splat<T, U>::is_ok>>
|
||||
static auto vsplat(U&& v)
|
||||
{
|
||||
return llvm_splat<T, U>{std::forward<U>(v)};
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
requires llvm_const_vector<sizeof...(Args), T>::is_ok
|
||||
template <typename T, typename... Args, typename = std::enable_if_t<llvm_const_vector<sizeof...(Args), T>::is_ok>>
|
||||
static auto build(Args... args)
|
||||
{
|
||||
return llvm_const_vector<sizeof...(Args), T>{static_cast<std::remove_extent_t<T>>(args)...};
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
requires llvm_zshuffle<sizeof...(Args), T>::is_ok
|
||||
template <typename T, typename... Args, typename = std::enable_if_t<llvm_zshuffle<sizeof...(Args), T>::is_ok>>
|
||||
static auto zshuffle(T&& v, Args... indices)
|
||||
{
|
||||
return llvm_zshuffle<sizeof...(Args), T>{std::forward<T>(v), {static_cast<int>(indices)...}};
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename... Args>
|
||||
requires llvm_shuffle2<sizeof...(Args), T, U>::is_ok
|
||||
template <typename T, typename U, typename... Args, typename = std::enable_if_t<llvm_shuffle2<sizeof...(Args), T, U>::is_ok>>
|
||||
static auto shuffle2(T&& v1, U&& v2, Args... indices)
|
||||
{
|
||||
return llvm_shuffle2<sizeof...(Args), T, U>{std::forward<T>(v1), std::forward<U>(v2), {static_cast<int>(indices)...}};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_ctlz<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_ctlz<T>::is_ok>>
|
||||
static auto ctlz(T&& a)
|
||||
{
|
||||
return llvm_ctlz<T>{std::forward<T>(a)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_ctpop<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_ctpop<T>::is_ok>>
|
||||
static auto ctpop(T&& a)
|
||||
{
|
||||
return llvm_ctpop<T>{std::forward<T>(a)};
|
||||
}
|
||||
|
||||
// Average: (a + b + 1) >> 1
|
||||
template <typename T, typename U>
|
||||
requires llvm_avg<T, U>::is_ok
|
||||
template <typename T, typename U, typename = std::enable_if_t<llvm_avg<T, U>::is_ok>>
|
||||
static auto avg(T&& a, U&& b)
|
||||
{
|
||||
return llvm_avg<T, U>{std::forward<T>(a), std::forward<U>(b)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_fsqrt<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_fsqrt<T>::is_ok>>
|
||||
static auto fsqrt(T&& a)
|
||||
{
|
||||
return llvm_fsqrt<T>{std::forward<T>(a)};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires llvm_fabs<T>::is_ok
|
||||
template <typename T, typename = std::enable_if_t<llvm_fabs<T>::is_ok>>
|
||||
static auto fabs(T&& a)
|
||||
{
|
||||
return llvm_fabs<T>{std::forward<T>(a)};
|
||||
}
|
||||
|
||||
// Optionally opportunistic hardware FMA, can be used if results are identical for all possible input values
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_fmuladd<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_fmuladd<T, U, V>::is_ok>>
|
||||
static auto fmuladd(T&& a, U&& b, V&& c, bool strict_fma)
|
||||
{
|
||||
return llvm_fmuladd<T, U, V>{std::forward<T>(a), std::forward<U>(b), std::forward<V>(c), strict_fma};
|
||||
}
|
||||
|
||||
// Opportunistic hardware FMA, can be used if results are identical for all possible input values
|
||||
template <typename T, typename U, typename V>
|
||||
requires llvm_fmuladd<T, U, V>::is_ok
|
||||
template <typename T, typename U, typename V, typename = std::enable_if_t<llvm_fmuladd<T, U, V>::is_ok>>
|
||||
auto fmuladd(T&& a, U&& b, V&& c)
|
||||
{
|
||||
return llvm_fmuladd<T, U, V>{std::forward<T>(a), std::forward<U>(b), std::forward<V>(c), m_use_fma};
|
||||
@@ -3794,8 +3756,7 @@ public:
|
||||
return load_const(g, i, get_type<T>());
|
||||
}
|
||||
|
||||
template <typename T, typename I>
|
||||
requires requires(I& i, llvm::IRBuilder<>* ir) { i.eval(ir); }
|
||||
template <typename T, typename I> requires requires () { std::declval<I>().eval(std::declval<llvm::IRBuilder<>*>()); }
|
||||
value_t<T> load_const(llvm::GlobalVariable* g, I i)
|
||||
{
|
||||
value_t<T> result;
|
||||
@@ -3914,8 +3875,7 @@ public:
|
||||
return llvm_calli<u8[16], T, U, V>{"any_select_by_bit4", {std::forward<T>(m), std::forward<U>(a), std::forward<V>(b)}};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::is_same_v<llvm_common_t<T>, f32[4]>
|
||||
template <typename T, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T>, f32[4]>>>
|
||||
static auto fre(T&& a)
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
@@ -3925,8 +3885,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::is_same_v<llvm_common_t<T>, f32[4]>
|
||||
template <typename T, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T>, f32[4]>>>
|
||||
static auto frsqe(T&& a)
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
@@ -3936,8 +3895,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires std::is_same_v<llvm_common_t<T, U>, f32[4]>
|
||||
template <typename T, typename U, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T, U>, f32[4]>>>
|
||||
static auto fmax(T&& a, U&& b)
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
@@ -3947,8 +3905,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires std::is_same_v<llvm_common_t<T, U>, f32[4]>
|
||||
template <typename T, typename U, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T, U>, f32[4]>>>
|
||||
static auto fmin(T&& a, U&& b)
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
@@ -3958,15 +3915,13 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires std::is_same_v<llvm_common_t<T, U>, u8[16]>
|
||||
template <typename T, typename U, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T, U>, u8[16]>>>
|
||||
static auto vdbpsadbw(T&& a, U&& b, u8 c)
|
||||
{
|
||||
return llvm_calli<u16[8], T, U, llvm_const_int<u32>>{"llvm.x86.avx512.dbpsadbw.128", {std::forward<T>(a), std::forward<U>(b), llvm_const_int<u32>{c}}};
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
requires std::is_same_v<llvm_common_t<T, U>, f32[4]>
|
||||
template <typename T, typename U, typename = std::enable_if_t<std::is_same_v<llvm_common_t<T, U>, f32[4]>>>
|
||||
static auto vrangeps(T&& a, U&& b, u8 c, u8 d)
|
||||
{
|
||||
return llvm_calli<f32[4], T, U, llvm_const_int<u32>, T, llvm_const_int<u8>>{"llvm.x86.avx512.mask.range.ps.128", {std::forward<T>(a), std::forward<U>(b), llvm_const_int<u32>{c}, std::forward<T>(a), llvm_const_int<u8>{d}}};
|
||||
@@ -3975,7 +3930,7 @@ public:
|
||||
|
||||
// Format llvm::SizeType
|
||||
template <>
|
||||
struct fmt_unveil<llvm::TypeSize>
|
||||
struct fmt_unveil<llvm::TypeSize, void>
|
||||
{
|
||||
using type = usz;
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ constexpr FORCE_INLINE CellNotAnError not_an_error(const T& value)
|
||||
return static_cast<CellNotAnError>(static_cast<s32>(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, typename>
|
||||
struct ppu_gpr_cast_impl;
|
||||
|
||||
template <>
|
||||
struct ppu_gpr_cast_impl<error_code>
|
||||
struct ppu_gpr_cast_impl<error_code, void>
|
||||
{
|
||||
static inline u64 to(const error_code& code)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Utilities/Thread.h"
|
||||
|
||||
#include "Emu/Cell/lv2/sys_spu.h"
|
||||
#include "Emu/Cell/lv2/sys_sync.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/Audio/audio_utils.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/timers.hpp"
|
||||
#include "Emu/Cell/lv2/sys_process.h"
|
||||
#include "Emu/Cell/lv2/sys_event.h"
|
||||
#include "Emu/Cell/Modules/cellAudioOut.h"
|
||||
#include "cellAudio.h"
|
||||
#include "util/video_provider.h"
|
||||
|
||||
@@ -704,7 +704,7 @@ void cell_audio_thread::operator()()
|
||||
|
||||
thread_ctrl::scoped_priority high_prio(+1);
|
||||
|
||||
while (Emu.IsPausedOrReady())
|
||||
while (Emu.IsPaused())
|
||||
{
|
||||
thread_ctrl::wait_for(5000);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/endian.hpp"
|
||||
|
||||
// Error codes
|
||||
enum CellAudioInError : u32
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/lv2/sys_event.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/timers.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@@ -149,44 +148,9 @@ void camera_context::save(utils::serial& ar)
|
||||
return;
|
||||
}
|
||||
|
||||
const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), cellCamera);
|
||||
GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), cellCamera);
|
||||
|
||||
ar(notify_data_map, start_timestamp_us, read_mode, is_streaming, is_attached, is_open, info, attr, frame_num);
|
||||
|
||||
if (ar.is_writing() || version >= 2)
|
||||
{
|
||||
ar(is_attached_dirty);
|
||||
}
|
||||
|
||||
if (!ar.is_writing())
|
||||
{
|
||||
if (is_open)
|
||||
{
|
||||
if (!open_camera())
|
||||
{
|
||||
cellCamera.error("Failed to open camera while loading savestate");
|
||||
}
|
||||
else if (is_streaming && !start_camera())
|
||||
{
|
||||
cellCamera.error("Failed to start camera while loading savestate");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gem_camera_shared::gem_camera_shared(utils::serial& ar)
|
||||
{
|
||||
save(ar);
|
||||
}
|
||||
|
||||
void gem_camera_shared::save(utils::serial& ar)
|
||||
{
|
||||
const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), cellCamera);
|
||||
|
||||
if (ar.is_writing() || version >= 2)
|
||||
{
|
||||
ar(frame_timestamp_us, width, height, size, format);
|
||||
}
|
||||
}
|
||||
|
||||
static bool check_dev_num(s32 dev_num)
|
||||
@@ -471,6 +435,7 @@ error_code cellCameraInit()
|
||||
g_camera.attr[CELL_CAMERA_USBLOAD] = { 4 };
|
||||
break;
|
||||
}
|
||||
|
||||
case fake_camera_type::eyetoy2:
|
||||
{
|
||||
g_camera.attr[CELL_CAMERA_SATURATION] = { 64 };
|
||||
@@ -490,6 +455,7 @@ error_code cellCameraInit()
|
||||
g_camera.attr[CELL_CAMERA_AGCHIGH] = { 64 };
|
||||
break;
|
||||
}
|
||||
|
||||
case fake_camera_type::uvc1_1:
|
||||
{
|
||||
g_camera.attr[CELL_CAMERA_DEVICEID] = { 0x5ca, 0x18d0 }; // KBCR-S01MU
|
||||
@@ -497,14 +463,14 @@ error_code cellCameraInit()
|
||||
g_camera.attr[CELL_CAMERA_NUMFRAME] = { 1 }; // Amount of supported resolutions
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
cellCamera.todo("Trying to init cellCamera with un-researched camera type.");
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Some other default attributes? Need to check the actual behaviour on a real PS3.
|
||||
|
||||
g_camera.is_attached = g_cfg.io.camera != camera_handler::null;
|
||||
g_camera.is_attached = true;
|
||||
g_camera.init = 1;
|
||||
return CELL_OK;
|
||||
}
|
||||
@@ -850,8 +816,8 @@ s32 cellCameraIsAttached(s32 dev_num)
|
||||
// normally should be attached immediately after event queue is registered, but just to be sure
|
||||
if (!is_attached)
|
||||
{
|
||||
g_camera.is_attached = is_attached = true;
|
||||
g_camera.is_attached_dirty = true;
|
||||
g_camera.send_attach_state(true);
|
||||
is_attached = g_camera.is_attached;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1640,15 +1606,9 @@ void camera_context::operator()()
|
||||
{
|
||||
while (thread_ctrl::state() != thread_state::aborting && !Emu.IsStopped())
|
||||
{
|
||||
// send ATTACH event
|
||||
if (init && is_attached_dirty && !Emu.IsPausedOrReady())
|
||||
{
|
||||
send_attach_state(is_attached);
|
||||
}
|
||||
|
||||
const s32 fps = info.framerate;
|
||||
|
||||
if (!init || !fps || Emu.IsPausedOrReady() || g_cfg.io.camera == camera_handler::null)
|
||||
if (!fps || Emu.IsPaused() || g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
thread_ctrl::wait_for(1000); // hack
|
||||
continue;
|
||||
@@ -1823,7 +1783,6 @@ void camera_context::reset_state()
|
||||
read_mode = CELL_CAMERA_READ_FUNCCALL;
|
||||
is_streaming = false;
|
||||
is_attached = false;
|
||||
is_attached_dirty = false;
|
||||
is_open = false;
|
||||
info.framerate = 0;
|
||||
std::memset(&attr, 0, sizeof(attr));
|
||||
@@ -1869,7 +1828,6 @@ void camera_context::send_attach_state(bool attached)
|
||||
|
||||
// We're not expected to send any events for attaching/detaching
|
||||
is_attached = attached;
|
||||
is_attached_dirty = false;
|
||||
}
|
||||
|
||||
void camera_context::set_attr(s32 attrib, u32 arg1, u32 arg2)
|
||||
@@ -1904,13 +1862,15 @@ void camera_context::set_attr(s32 attrib, u32 arg1, u32 arg2)
|
||||
|
||||
void camera_context::add_queue(u64 key, u64 source, u64 flag)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
{
|
||||
std::lock_guard lock_data_map(mutex_notify_data_map);
|
||||
|
||||
notify_data_map[key] = { source, flag };
|
||||
}
|
||||
|
||||
is_attached_dirty = true;
|
||||
// send ATTACH event - HACKY
|
||||
send_attach_state(is_attached);
|
||||
}
|
||||
|
||||
void camera_context::remove_queue(u64 key)
|
||||
@@ -1937,8 +1897,7 @@ bool camera_context::on_handler_state(camera_handler_base::camera_handler_state
|
||||
{
|
||||
if (is_attached)
|
||||
{
|
||||
is_attached = false;
|
||||
is_attached_dirty = true;
|
||||
send_attach_state(false);
|
||||
}
|
||||
if (handler)
|
||||
{
|
||||
@@ -1979,8 +1938,7 @@ bool camera_context::on_handler_state(camera_handler_base::camera_handler_state
|
||||
if (!is_attached)
|
||||
{
|
||||
cellCamera.warning("Camera handler not attached. Sending attach event...", static_cast<int>(state));
|
||||
is_attached = true;
|
||||
is_attached_dirty = true;
|
||||
send_attach_state(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Utilities/Timer.h"
|
||||
#include "Emu/Cell/lv2/sys_memory.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Emu/Io/camera_handler_base.h"
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
#include "Utilities/mutex.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
@@ -427,7 +427,6 @@ public:
|
||||
atomic_t<u8> read_mode{CELL_CAMERA_READ_FUNCCALL};
|
||||
atomic_t<bool> is_streaming{false};
|
||||
atomic_t<bool> is_attached{false};
|
||||
atomic_t<bool> is_attached_dirty{false};
|
||||
atomic_t<bool> is_open{false};
|
||||
|
||||
CellCameraInfoEx info{};
|
||||
@@ -472,13 +471,6 @@ using camera_thread = named_thread<camera_context>;
|
||||
/// Shared data between cellGem and cellCamera
|
||||
struct gem_camera_shared
|
||||
{
|
||||
gem_camera_shared() {}
|
||||
gem_camera_shared(utils::serial& ar);
|
||||
|
||||
void save(utils::serial& ar);
|
||||
|
||||
SAVESTATE_INIT_POS(7);
|
||||
|
||||
atomic_t<u64> frame_timestamp_us{}; // latest read timestamp from cellCamera (cellCameraRead(Ex))
|
||||
atomic_t<s32> width{640};
|
||||
atomic_t<s32> height{480};
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "util/asm.hpp"
|
||||
|
||||
#include <thread>
|
||||
|
||||
LOG_CHANNEL(cellDmux);
|
||||
|
||||
template <>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
#include "cellPamf.h"
|
||||
|
||||
// Error Codes
|
||||
enum CellDmuxError :u32
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
|
||||
#include "cellPamf.h"
|
||||
#include "cellDmux.h"
|
||||
#include "cellDmuxPamf.h"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user