Merge main into feat/shader-nested-sampler-tables

This commit is contained in:
Yunus Shaikh committed 2026-11-13 07:52:51 -08:00
commit 40d718d87b
2670 files changed
+155696 -16066

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
docs/run-report-fixtures/*.json text eol=lf
docs/dev/debt/*.md merge=union
+2 -8
View File
@@ -1,8 +1,2 @@
agc_driver_graphics undefined UBSan stops on the misaligned guest word loads of the ASan build's CopyGuestBytes (Execution/src/GuestMemory.cpp), which #10973 fixes, and then on Graphics/src/DepthSurface.cpp:730, which binds a TextureDetiler reference to a null pointer when the context has no detiler.
agc_driver_graphics_maps_fallback undefined UBSan stops on the misaligned guest word loads of the ASan build's CopyGuestBytes (Execution/src/GuestMemory.cpp), which #10973 fixes, and then on Graphics/src/DepthSurface.cpp:730, which binds a TextureDetiler reference to a null pointer when the context has no detiler.
agc_driver_pm4 undefined UBSan stops on the misaligned guest word loads of the ASan build's CopyGuestBytes (Execution/src/GuestMemory.cpp); #10973 fixes them.
agc_performance_overlay address,undefined Runs past its 30 s ctest TIMEOUT in the sanitizer build on ubuntu-latest (timed out at 30.18 s); it passes without sanitizers, and alone it takes about 19 s; #11555 gives it 120 s in ASan builds.
guest_backtrace address Fails only in ASan builds, with 'guest backtrace: first frame is not in the calling module', because the sanitizer adds a frame to backtrace(); #9240 starts the frames at the caller.
guest_getrlimit address The test lowers RLIMIT_DATA to 1 TiB, below the private memory ASan has already mapped, so ASan's next internal mapping fails with ENOMEM ('failed to allocate ... DTLS_NextBlock').
guest_math address,undefined ubuntu-latest's GCC 15 targets x86-64-v3 and fuses libc's float multiply-adds into FMA, so atanf misses the console bits by one ulp; #11059 builds libc with -ffp-contract=off.
guest_vorbis_dec undefined The bundled libvorbis left-shifts a negative value (3rdparty/vorbis/lib/psy.c:319); #11480 updates libvorbis to the upstream fix.
agc_driver_graphics address Stops on its check that guest heap memory lies below 1 << 40 (libSceAgcDriver/tests/Graphics.cpp, 'guest heap memory is beyond the 40-bit PS4 GPU address space'), because the ASan build maps the guest arena above 1 TiB; tracked in #16813.
agc_driver_graphics_maps_fallback address Stops on its check that guest heap memory lies below 1 << 40 (libSceAgcDriver/tests/Graphics.cpp, 'guest heap memory is beyond the 40-bit PS4 GPU address space'), because the ASan build maps the guest arena above 1 TiB; tracked in #16813.
+95 -12
View File
@@ -43,7 +43,7 @@ env:
jobs:
eligibility:
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
@@ -321,7 +321,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -343,7 +353,10 @@ jobs:
run: arch -x86_64 /usr/bin/true || sudo softwareupdate --install-rosetta --agree-to-license
- run: cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.architectures }}
- run: cmake --build build-relinker --parallel 3
- run: ctest --test-dir build-relinker --output-on-failure --timeout 120 --parallel 4 --no-tests=error
- run: |
repeat=()
if [ "$RUNNER_OS" = Windows ]; then repeat=(--repeat after-timeout:2); fi
ctest --test-dir build-relinker --output-on-failure --timeout 120 --parallel 4 --no-tests=error "${repeat[@]}"
relinker-asan:
needs: eligibility
@@ -365,7 +378,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -411,7 +434,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -451,7 +484,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -495,7 +538,17 @@ jobs:
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
fetch_options=()
if [ "$(git rev-parse --is-shallow-repository)" = true ]; then fetch_options+=(--unshallow); fi
git fetch --no-tags "${fetch_options[@]}" origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags "${fetch_options[@]}" origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -630,7 +683,7 @@ jobs:
needs: eligibility
if: ${{ ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.eligibility.outputs.full == 'true') || (github.event_name == 'pull_request' && needs.eligibility.outputs.mingw-host-tests == 'true') }}
runs-on: windows-latest
timeout-minutes: ${{ github.event_name == 'workflow_dispatch' && inputs.select == false && 90 || 45 }}
timeout-minutes: 90
env:
WINLIBS_RELEASE: 15.2.0posix-14.0.0-ucrt-r7
WINLIBS_ZIP: winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-14.0.0-r7.zip
@@ -654,7 +707,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -765,7 +828,7 @@ jobs:
if: github.event_name == 'pull_request'
shell: cmd
run: python tools/build_mingw_host_only_tests.py build changed.txt
- name: Build and run changed guest core/libs tests
- name: Build and run changed core/libs tests
if: github.event_name == 'pull_request'
shell: cmd
run: python tools/build_changed_guest_tests.py build changed.txt --output-log ctest.log
@@ -822,7 +885,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
@@ -856,7 +929,17 @@ jobs:
read -ra heads <<< "$PR_HEAD"
refspecs=()
for number in "${numbers[@]}"; do refspecs+=("+refs/pull/$number/head:refs/remotes/pull/$number"); done
git fetch --no-tags --unshallow origin "${refspecs[@]}"
for attempt in $(seq 1 5); do
if git fetch --no-tags --unshallow origin "${refspecs[@]}"; then
break
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::git fetch failed after 5 attempts"
exit 1
fi
echo "::warning::git fetch failed (attempt $attempt/5), retrying in $((attempt * 3))s..."
sleep $((attempt * 3))
done
for i in "${!numbers[@]}"; do
if [ "$(git rev-parse "refs/remotes/pull/${numbers[i]}")" != "${heads[i]}" ]; then echo "::error::Pull request #${numbers[i]} has newer commits; start a new build"; exit 1; fi
if ! git -c user.name=ci -c user.email=ci@localhost merge --no-ff --no-edit "refs/remotes/pull/${numbers[i]}"; then echo "::error::Pull request #${numbers[i]} does not merge cleanly into main and the pull requests before it; rebase it first"; exit 1; fi
+1 -1
View File
@@ -11,7 +11,7 @@ permissions: {}
concurrency:
group: conflict-label
cancel-in-progress: true
cancel-in-progress: false
jobs:
label:
+7 -1
View File
@@ -24,7 +24,13 @@ jobs:
- name: Fetch pull request objects without checking out its code
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: git fetch --no-tags origin "$HEAD_SHA"
run: |
for attempt in 1 2 3 4 5; do
git fetch --no-tags origin "$HEAD_SHA" && exit 0
echo "::warning::git fetch failed on attempt $attempt; retrying in $((attempt * 3)) s"
sleep $((attempt * 3))
done
exit 1
- name: Check conventions with the current base branch script
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+2
View File
@@ -12,6 +12,7 @@ permissions: {}
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
issues: write
env:
@@ -32,6 +33,7 @@ jobs:
force_label perf fef2c0 'Performance change'
force_label 'perf numbers missing' e99695 'perf pull request without a before and after summary line'
force_label 'review queue' 1d76db 'Next in the maintainer review queue: checks pass, no open change request, no conflict'
force_label 'already in main' c5def5 'Merging would not change main; never closed automatically'
label relinker 5319e7 'core/relinker'
label libc fbca04 'libc'
+2
View File
@@ -8,6 +8,8 @@ on:
- core/shader/recompiler/**
- tools/progress.py
- tools/shader_scan.py
- tools/isa_profiles.py
- tools/gfx1013_isa_forms.txt
- tools/rdna2_isa_forms.txt
- tools/rdna_isa.txt
+25 -1
View File
@@ -5,6 +5,7 @@ on:
branches: [main]
paths:
- .github/workflows/pages.yml
- .github/workflows/pages-progress.yml
- CMakeLists.txt
- core/relinker/**
- demo/web/**
@@ -12,12 +13,18 @@ on:
- tools/package_release.py
- tools/nid_names.py
- tools/progress.py
- tools/progress_prs.py
- tools/pr_overlap.py
- tools/shader_scan.py
- tools/isa_profiles.py
- tools/gfx1013_isa_forms.txt
- tools/rdna2_isa_forms.txt
- tools/progress_history.py
- tools/rdna_isa.txt
- tools/test_web.py
workflow_dispatch:
schedule:
- cron: '37 4 * * *'
release:
types: [published]
workflow_run:
@@ -37,6 +44,7 @@ jobs:
pages:
if: ${{ !github.event.repository.fork && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest
timeout-minutes: 30
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
@@ -49,7 +57,23 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
run: python3 tools/build_web.py --build build-wasm --release
- run: python3 tools/progress.py --require-shader-source build-wasm/web
- name: Prepare the open-PR estimate fallback
run: |
python3 - "$RUNNER_TEMP/open-pr-progress.json" <<'PY'
import json
import sys
from datetime import datetime, timezone
from pathlib import Path
Path(sys.argv[1]).write_text(json.dumps({"available": False,
"generated_at": datetime.now(timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z"),
"reason": "estimator failed before producing a result"}) + "\n", encoding="utf-8")
PY
- name: Estimate open-PR library progress
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: true
run: python3 tools/progress_prs.py --output "$RUNNER_TEMP/open-pr-progress.json"
- run: python3 tools/progress.py --require-shader-source --open-pr-estimate "$RUNNER_TEMP/open-pr-progress.json" build-wasm/web
- run: python3 tools/progress_history.py build-wasm/web
- uses: actions/upload-pages-artifact@v5
with:
+1
View File
@@ -12,6 +12,7 @@ permissions: {}
concurrency:
group: pr-labels-${{ github.event.pull_request.number || 'all' }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
jobs:
labels:
+22
View File
@@ -0,0 +1,22 @@
name: PR already in main
on:
schedule:
- cron: '20 * * * *'
workflow_dispatch:
permissions: {}
concurrency:
group: pr-already-in-main
jobs:
unchanged:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v7
- env:
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: python3 -I tools/pr_unchanged.py
+6
View File
@@ -7,6 +7,11 @@ on:
- 'core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaOpcode.hpp'
- 'tools/nid_names.py'
- 'tools/progress.py'
- 'tools/shader_scan.py'
- 'tools/isa_profiles.py'
- 'tools/rdna2_isa_forms.txt'
- 'tools/gfx1013_isa_forms.txt'
- 'core/shader/recompiler/**'
- 'tools/rdna_isa.txt'
- '.github/workflows/progress-report.yml'
@@ -20,6 +25,7 @@ concurrency:
jobs:
report:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
with:
+2 -2
View File
@@ -30,10 +30,10 @@ jobs:
include:
- platform: linux
runner: ubuntu-latest
timeout: 60
timeout: 120
- platform: windows
runner: windows-latest
timeout: 60
timeout: 120
runs-on: ${{ matrix.runner }}
timeout-minutes: ${{ matrix.timeout }}
defaults:
+4
View File
@@ -9,6 +9,8 @@ on:
- tools/requirements-run-report.txt
- tools/tests/test_run_report_schema.py
- tools/tests/test_run_report_docs.py
- tools/tests/test_run_report_summary.py
- tools/run_report_summary.py
- docs/user/USAGE.md
- docs/user/run-report.md
@@ -35,3 +37,5 @@ jobs:
run: '"$RUNNER_TEMP/venv/bin/python" tools/tests/test_run_report_schema.py'
- name: Check the run report docs
run: python3 tools/tests/test_run_report_docs.py
- name: Check the run report summary
run: PYTHONPATH=. python3 tools/tests/test_run_report_summary.py
+2 -1
View File
@@ -43,9 +43,10 @@ jobs:
node --check demo/web/archive.mjs
node --check demo/web/batch.mjs
node --check demo/web/failure-report.mjs
node --check demo/web/i18n.mjs
node --check demo/web/output-directory.mjs
node --check demo/web/worker.mjs
- name: Test browser converter helpers
run: node --test demo/web/tests/app.test.mjs demo/web/tests/batch.test.mjs demo/web/tests/failure-report.test.mjs demo/web/tests/output-directory.test.mjs
run: node --test demo/web/tests/app.test.mjs demo/web/tests/batch.test.mjs demo/web/tests/failure-report.test.mjs demo/web/tests/i18n.test.mjs demo/web/tests/output-directory.test.mjs
- name: Test directory writer resources
run: node --test demo/web/tests/directory-writer.test.mjs
+1 -1
View File
@@ -21,7 +21,7 @@ env:
jobs:
windows-msys2:
runs-on: windows-latest
timeout-minutes: 45
timeout-minutes: 90
defaults:
run:
shell: bash
+4
View File
@@ -97,3 +97,7 @@
[submodule "3rdparty/libpsl"]
path = 3rdparty/libpsl
url = https://github.com/rockdaboot/libpsl.git
[submodule "3rdparty/icu"]
path = 3rdparty/icu
url = https://github.com/unicode-org/icu.git
shallow = true
Vendored Submodule
+1
Submodule 3rdparty/icu added at 049e0d6a42.
+2 -2
View File
@@ -9,7 +9,7 @@ AnyPS5 relinks PS5 executables into native Linux or Windows programs that run ag
- Known gaps go in `docs/dev/debt/<library>.md`; notes, reports and logs go in the pull request. Add no other files.
- Commit subjects and PR titles are Conventional Commits.
- PR body: copy [the template](.github/pull_request_template.md), keep every line, tick every box, and fill `What`, `Tested`, `Depends on` (#N or none), `Fixes` (Fixes #N or none), `Unblocks` (title ID and discussion, or none), `GPUs tested` (AGC, shader recompiler, VideoOut; otherwise n/a) and `AI-assisted` (yes or no).
- Before pushing run `python3 tools/check_conventions.py --base origin/main`; before opening run `python3 tools/pr_overlap.py --branch <branch>`.
- Before starting a function run `python3 tools/pr_overlap.py --names <function>`; before pushing run `python3 tools/check_conventions.py --base origin/main`; before opening run `python3 tools/pr_overlap.py --branch <branch>`.
- Build and test: [BUILD](docs/dev/BUILD.md); a relinker-only change builds with `-DANYPS5_RELINKER_ONLY=ON`.
- A speed claim shows `tools/trace_digest.py` summaries of `main` and of the change from the same machine and scene.
- AGC, shader recompiler and VideoOut changes: run the same focused tests on `main` and the change with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` using `ctest --test-dir build -R <pattern> -V` from the same machine and GPU. Confirm neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, then compare the logs and confirm the change adds no new `VUID-` validation errors (`ctest` can report `Passed` when validation errors are logged).
- AGC, shader recompiler and VideoOut changes: run the same focused tests on `main` and the change with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LOADER_DEBUG=layer` using `ctest --test-dir build -R <pattern> -V` from the same machine and GPU. Confirm each log shows the loader inserting the layer (`Insert instance layer "VK_LAYER_KHRONOS_validation"`) and neither contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, then compare the logs and confirm the change adds no new `VUID-` validation errors (`ctest` can report `Passed` when validation errors are logged). Use a validation layer at least as new as the `3rdparty/Vulkan-Headers` submodule (`VK_HEADER_VERSION` 335, i.e. layer 1.4.335 or newer); an older layer does not know the `pNext` structs the driver chains (for example `VK_KHR_shader_fma`) and logs a spurious `VUID-VkDeviceCreateInfo-pNext-pNext` that fails every GPU test.
+125 -6
View File
@@ -6,6 +6,23 @@ endif()
project(Relinker CXX)
set(ANYPS5_TEST_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
if(MINGW)
enable_language(RC)
configure_file(cmake/WindowsManifest.rc.in WindowsManifest.rc @ONLY)
function(add_test_executable_manifests_test)
if(NOT BUILD_TESTING)
return()
endif()
get_property(testExecutables GLOBAL PROPERTY ANYPS5_TEST_EXECUTABLES)
list(TRANSFORM testExecutables REPLACE "^(.+)$" "$<TARGET_FILE:\\1>")
list(JOIN testExecutables "\n" testExecutableFiles)
file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/test_executables.txt" CONTENT "${testExecutableFiles}\n")
add_test(NAME test_executable_manifests COMMAND ${CMAKE_COMMAND} -DEXECUTABLES=${CMAKE_BINARY_DIR}/test_executables.txt
-P ${CMAKE_SOURCE_DIR}/cmake/ExecutableManifests.cmake)
set_tests_properties(test_executable_manifests PROPERTIES TIMEOUT 60)
endfunction()
cmake_language(DEFER CALL add_test_executable_manifests_test)
endif()
function(add_test_executable target)
cmake_parse_arguments(ATE "NO_RUNTIME_DLL_STAGING" "" "" ${ARGN})
@@ -16,8 +33,10 @@ function(add_test_executable target)
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<1:${ANYPS5_TEST_OUTPUT_DIRECTORY}>")
endif()
if(MINGW)
target_sources(${target} PRIVATE $<TARGET_OBJECTS:anyps5_windows_test_exit>)
target_sources(${target} PRIVATE $<TARGET_OBJECTS:anyps5_windows_test_exit> "${CMAKE_BINARY_DIR}/WindowsManifest.rc")
set_property(GLOBAL APPEND PROPERTY ANYPS5_TEST_EXECUTABLES ${target})
target_link_options(${target} PRIVATE LINKER:--wrap=main)
target_link_options(${target} PRIVATE LINKER:--disable-high-entropy-va)
if(ATE_NO_RUNTIME_DLL_STAGING)
get_filename_component(_nostage_compiler_dir "${CMAKE_CXX_COMPILER}" DIRECTORY)
foreach(runtime libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll)
@@ -31,7 +50,7 @@ function(add_test_executable target)
endif()
if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 3.21 AND NOT ATE_NO_RUNTIME_DLL_STAGING)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}> "$<TARGET_FILE:${target}>" "$<TARGET_FILE_DIR:${target}>/"
COMMAND "${CMAKE_COMMAND}" "-DDEST_DIR=$<TARGET_FILE_DIR:${target}>" -P "${CMAKE_SOURCE_DIR}/cmake/CopyRuntimeFiles.cmake" $<TARGET_RUNTIME_DLLS:${target}> "$<TARGET_FILE:${target}>"
COMMAND_EXPAND_LISTS
VERBATIM
)
@@ -80,6 +99,25 @@ if(BUILD_TESTING)
endif()
file(COPY "${testCompilerDirectory}/${runtimeName}" DESTINATION "${ANYPS5_TEST_OUTPUT_DIRECTORY}")
endforeach()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
function(anyps5_put_compiler_runtime_first directory compilerDirectory)
file(RELATIVE_PATH relativeDirectory "${CMAKE_SOURCE_DIR}" "${directory}")
if(relativeDirectory MATCHES "^3rdparty(/|$)")
return()
endif()
get_property(tests DIRECTORY "${directory}" PROPERTY TESTS)
foreach(test IN LISTS tests)
set_property(TEST "${test}" DIRECTORY "${directory}" APPEND PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${compilerDirectory}")
endforeach()
get_property(children DIRECTORY "${directory}" PROPERTY SUBDIRECTORIES)
foreach(child IN LISTS children)
anyps5_put_compiler_runtime_first("${child}" "${compilerDirectory}")
endforeach()
endfunction()
cmake_language(DEFER CALL anyps5_put_compiler_runtime_first "${CMAKE_CURRENT_SOURCE_DIR}" "${testCompilerDirectory}")
else()
message(STATUS "CMake older than 3.28: tests are not given the compiler's runtime directory on PATH")
endif()
endif()
endif()
@@ -111,9 +149,22 @@ if(NOT ANYPS5_CXX_LINKS_STANDARD_LIBRARY)
"Supported toolchains are listed in docs/dev/BUILD.md.")
endif()
if(MINGW)
check_cxx_source_compiles("#include <memory>\n#if defined(__GLIBCXX__) && !defined(_GLIBCXX_ATOMIC_WORD_BUILTINS) && !defined(_GLIBCXX_ATOMIC_BUILTINS)\nstatic_assert(__gnu_cxx::__default_lock_policy != __gnu_cxx::_S_atomic);\n#endif\nint main() { return 0; }" ANYPS5_CXX_HAS_COMPATIBLE_SHARED_PTR_ATOMICS)
if(NOT ANYPS5_CXX_HAS_COMPATIBLE_SHARED_PTR_ATOMICS)
message(FATAL_ERROR "The MinGW C++ standard library selected by ${CMAKE_CXX_COMPILER} uses incompatible shared_ptr reference-count operations (GCC PR125312). "
"Select a corrected MinGW toolchain and configure in a new build directory. "
"Supported toolchains are listed in docs/dev/BUILD.md.")
endif()
endif()
if(ANYPS5_ENABLE_ASAN AND ANYPS5_ENABLE_TSAN)
message(FATAL_ERROR "ANYPS5_ENABLE_ASAN and ANYPS5_ENABLE_TSAN cannot be combined")
endif()
option(ANYPS5_BUILD_FUZZERS "Build the relinker libFuzzer targets with AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
if(ANYPS5_BUILD_FUZZERS AND ANYPS5_ENABLE_TSAN)
message(FATAL_ERROR "ANYPS5_BUILD_FUZZERS already selects AddressSanitizer and UndefinedBehaviorSanitizer; do not combine it with ANYPS5_ENABLE_TSAN")
endif()
if(ANYPS5_ENABLE_TSAN)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "ANYPS5_ENABLE_TSAN is supported only on Linux")
@@ -123,7 +174,6 @@ if(ANYPS5_ENABLE_TSAN)
endif()
endif()
option(ANYPS5_BUILD_FUZZERS "Build the relinker libFuzzer targets with AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
if(ANYPS5_BUILD_FUZZERS)
if(NOT ANYPS5_RELINKER_ONLY)
message(FATAL_ERROR "ANYPS5_BUILD_FUZZERS requires ANYPS5_RELINKER_ONLY")
@@ -251,13 +301,22 @@ if(BUILD_TESTING)
set_tests_properties(progress_history_date_window PROPERTIES TIMEOUT 20)
add_test(NAME pr_ready COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pr_ready.py)
add_test(NAME pr_unchanged COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pr_unchanged.py)
add_test(NAME progress_history COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_history.py ProgressHistoryTests)
add_test(NAME progress_history_csv COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_history.py HistoryCsvTests)
set_tests_properties(progress_history_csv PROPERTIES TIMEOUT 20)
add_test(NAME progress_history_output COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_history.py HistoryReportOutputTests)
set_tests_properties(progress_history_output PROPERTIES TIMEOUT 20)
add_test(NAME progress_report COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress.py)
add_test(NAME progress_open_pr_page COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_open_pr_page.py)
add_test(NAME progress_prs COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_prs.py)
add_test(NAME shader_scan COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_shader_scan.py)
add_test(NAME progress_report_inputs COMMAND ${Python3_EXECUTABLE}
@@ -270,6 +329,9 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_encoding.py)
add_test(NAME progress_render_sliver COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_render_sliver.py)
add_test(NAME tools_progress_diff_json COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_diff_json.py)
set_tests_properties(tools_progress_diff_json PROPERTIES TIMEOUT 20)
add_test(NAME progress_wrappers COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_progress_wrappers.py)
add_test(NAME progress_read_encoding COMMAND ${Python3_EXECUTABLE}
@@ -288,6 +350,9 @@ if(BUILD_TESTING)
add_test(NAME validate_patch_catalog COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_validate_patch_catalog.py)
endif()
add_test(NAME annotation_symbols_ghidra COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_annotation_symbols_ghidra.py)
set_tests_properties(annotation_symbols_ghidra PROPERTIES TIMEOUT 20)
if(NOT APPLE)
add_test(NAME annotate_module COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_annotate_module.py)
@@ -318,6 +383,11 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_unwrap_self.py)
add_test(NAME audit_dump COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_audit_dump.py)
add_test(NAME forced_include_paths COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_forced_include_paths.py
--cmake "${CMAKE_COMMAND}" --compiler "${CMAKE_CXX_COMPILER}"
--generator "${CMAKE_GENERATOR}" --make-program "${CMAKE_MAKE_PROGRAM}")
set_tests_properties(forced_include_paths PROPERTIES TIMEOUT 30)
add_test(NAME ffmpeg_cache_keys COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_ffmpeg_cache_keys.py)
add_test(NAME winlibs_digest COMMAND ${Python3_EXECUTABLE}
@@ -341,6 +411,9 @@ if(BUILD_TESTING)
add_test(NAME performance_csv COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_performance_csv.py)
set_tests_properties(performance_csv PROPERTIES TIMEOUT 20)
add_test(NAME performance_bisect COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_performance_bisect.py)
set_tests_properties(performance_bisect PROPERTIES TIMEOUT 20)
add_test(NAME emsdk_pin COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_emsdk_pin.py)
set(conventions_wrapped_declarations_source "${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_wrapped_declarations.py")
@@ -378,23 +451,31 @@ if(BUILD_TESTING)
set_tests_properties(ctest_no_tests_flag PROPERTIES TIMEOUT 20)
add_test(NAME conventions_doc_links COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_doc_links.py)
set_tests_properties(conventions_doc_links PROPERTIES TIMEOUT 20)
add_test(NAME conventions_unknown_nids COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_unknown_nids.py)
set_tests_properties(conventions_unknown_nids PROPERTIES TIMEOUT 20)
add_test(NAME conventions_debt_length COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_debt_length.py)
set_tests_properties(conventions_debt_length PROPERTIES TIMEOUT 20)
add_test(NAME conventions_debt_labels COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_debt_labels.py)
set_tests_properties(conventions_debt_labels PROPERTIES TIMEOUT 20)
add_test(NAME test_registration COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_test_registration.py)
set_tests_properties(test_registration PROPERTIES TIMEOUT 60)
add_test(NAME unbuilt_exports COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_unbuilt_exports.py)
set_tests_properties(unbuilt_exports PROPERTIES TIMEOUT 20)
add_test(NAME test_script_registration COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/check_test_registration.py --scripts)
set_tests_properties(test_script_registration PROPERTIES TIMEOUT 60)
add_test(NAME tools_sanitizer_json COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_sanitizer_json.py)
set_tests_properties(tools_sanitizer_json PROPERTIES TIMEOUT 20)
add_test(NAME build_eligibility COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_build_eligibility.py)
set_tests_properties(build_eligibility PROPERTIES TIMEOUT 20)
add_test(NAME tools_release_notes_check COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_release_notes_check.py)
set_tests_properties(tools_release_notes_check PROPERTIES TIMEOUT 20)
@@ -406,19 +487,26 @@ if(BUILD_TESTING)
set_tests_properties(pr_intake_reopen PROPERTIES TIMEOUT 60)
add_test(NAME tools_pe_inventory COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/tests/test_pe_symbol_inventory.py)
set_tests_properties(tools_pe_inventory PROPERTIES TIMEOUT 20)
add_test(NAME rebase_verify COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_rebase_verify.py)
add_test(NAME check_skips COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_skips.py)
set_tests_properties(check_skips PROPERTIES TIMEOUT 20)
add_test(NAME relinker_seed_manifest COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_relinker_seed_manifest.py)
set_tests_properties(relinker_seed_manifest PROPERTIES TIMEOUT 20)
add_test(NAME sanitizer_report COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_sanitizer_report.py)
set_tests_properties(sanitizer_report PROPERTIES TIMEOUT 20)
add_test(NAME relinker_fuzz_fixture_warnings COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_relinker_fuzz_fixture_warnings.py)
set_tests_properties(relinker_fuzz_fixture_warnings PROPERTIES TIMEOUT 20)
add_test(NAME select_tests COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_select_tests.py)
set_tests_properties(select_tests PROPERTIES TIMEOUT 20)
add_test(NAME relinker_test_step COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_relinker_test_step.py)
set_tests_properties(relinker_test_step PROPERTIES TIMEOUT 20)
add_test(NAME tools_self_inspect COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/tests/test_inspect_self.py)
set_tests_properties(tools_self_inspect PROPERTIES TIMEOUT 20)
add_test(NAME check_main_sync COMMAND ${Python3_EXECUTABLE}
@@ -443,7 +531,7 @@ if(BUILD_TESTING)
set_tests_properties(select_tests PROPERTIES ENVIRONMENT "ANYPS5_SELECT_TEST_CLASS=SelectTests" TIMEOUT 30)
else()
add_test(NAME select_tests_${test_class} COMMAND ${Python3_EXECUTABLE} "${select_tests_source}" ${test_class})
set_tests_properties(select_tests_${test_class} PROPERTIES TIMEOUT 30)
set_tests_properties(select_tests_${test_class} PROPERTIES TIMEOUT 60)
endif()
endforeach()
add_test(NAME relinker_fuzz_configurations COMMAND ${Python3_EXECUTABLE}
@@ -478,6 +566,12 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_vulkan_validation_gate.py SetupTests)
add_test(NAME vulkan_validation_gate_commands COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_vulkan_validation_gate.py CommandTests)
if(WIN32)
add_test(NAME vulkan_validation_gate_containment COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_vulkan_validation_gate.py ContainmentTests)
add_test(NAME vulkan_validation_gate_nested_containment COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_vulkan_validation_gate.py NestedContainmentTests)
endif()
add_test(NAME stubgen COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_stubgen.py)
set(debt_split_source "${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_debt_split.py")
@@ -508,6 +602,9 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_stubgen_stdout_newlines.py)
add_test(NAME hardware_oracle COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/hw-oracle/test_hw_oracle.py)
add_test(NAME hardware_oracle_probe_catalog COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/hw-oracle/test_probe_catalog.py)
set_tests_properties(hardware_oracle_probe_catalog PROPERTIES TIMEOUT 30)
add_test(NAME job_reference_errors COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_job_reference_errors.py)
set_tests_properties(job_reference_errors PROPERTIES TIMEOUT 20)
@@ -542,6 +639,8 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pr_overlap_export_cache.py)
add_test(NAME pr_overlap_fail_closed COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pr_overlap_fail_closed.py)
add_test(NAME pr_overlap_names COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pr_overlap_names.py)
add_test(NAME nid_database_cache COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_nid_names.py)
add_test(NAME release_package COMMAND ${Python3_EXECUTABLE}
@@ -552,6 +651,9 @@ if(BUILD_TESTING)
add_test(NAME web_library_assets COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_build_web.py)
set_tests_properties(web_library_assets PROPERTIES TIMEOUT 20)
add_test(NAME tools_pad_preview COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pad_preview.py)
set_tests_properties(tools_pad_preview PROPERTIES TIMEOUT 20)
add_test(NAME pad_input COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_pad_input.py)
set_tests_properties(pad_input PROPERTIES TIMEOUT 20)
@@ -590,6 +692,9 @@ if(BUILD_TESTING)
endforeach()
add_test(NAME trace_digest COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_trace_digest.py)
add_test(NAME memory_trace_address COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_memory_trace_address.py)
set_tests_properties(memory_trace_address PROPERTIES TIMEOUT 20)
add_test(NAME symbolize_samples COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_symbolize_samples.py)
add_test(NAME ab_split COMMAND ${Python3_EXECUTABLE}
@@ -622,11 +727,20 @@ if(BUILD_TESTING)
set_tests_properties(ab_split_csv PROPERTIES TIMEOUT 20)
add_test(NAME conventions_agent_files COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_agent_files.py)
add_test(NAME tools_nid_offline COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_nid_offline.py)
set_tests_properties(tools_nid_offline PROPERTIES TIMEOUT 20)
add_test(NAME conventions_alignment COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_alignment.py)
add_test(NAME tools_intervals_complete COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_intervals_complete.py)
set_tests_properties(tools_intervals_complete PROPERTIES TIMEOUT 20)
add_test(NAME trace_intervals_csv COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_trace_intervals_csv.py)
set_tests_properties(trace_intervals_csv PROPERTIES TIMEOUT 20)
add_test(NAME trace_timeline COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_trace_timeline.py)
set_tests_properties(trace_timeline PROPERTIES TIMEOUT 60)
set(trace_digest_test_source "${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_trace_digest.py")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${trace_digest_test_source}")
file(STRINGS "${trace_digest_test_source}" trace_digest_cases REGEX "^class |^ def test_")
@@ -671,7 +785,7 @@ if(BUILD_TESTING)
set_tests_properties(tools_headers_manifest PROPERTIES TIMEOUT 20)
add_test(NAME conventions_pr_template COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_conventions_pr_template.py)
set_tests_properties(conventions_pr_template PROPERTIES TIMEOUT 60)
set_tests_properties(conventions_pr_template PROPERTIES TIMEOUT 180)
add_test(NAME check_compile_preprocessor COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_check_compile_preprocessor.py)
set_tests_properties(check_compile_preprocessor PROPERTIES TIMEOUT 20)
@@ -690,6 +804,8 @@ if(BUILD_TESTING)
endforeach()
add_test(NAME tools_seed_check COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/tests/test_check_configure_seed.py)
set_tests_properties(tools_seed_check PROPERTIES TIMEOUT 20)
add_test(NAME tools_cmake_fuzzer_sanitizers COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/tests/test_cmake_fuzzer_sanitizers.py)
set_tests_properties(tools_cmake_fuzzer_sanitizers PROPERTIES TIMEOUT 120)
add_test(NAME performance_compare COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_performance_compare.py)
set_tests_properties(performance_compare PROPERTIES TIMEOUT 20)
@@ -705,9 +821,10 @@ if(BUILD_TESTING)
function(raise_windows_tooling_test_timeouts)
foreach(windows_tooling_test IN LISTS ARGN)
get_test_property(${windows_tooling_test} TIMEOUT windows_tooling_timeout)
if(windows_tooling_timeout MATCHES "^[0-9.]+$" AND windows_tooling_timeout LESS 120)
if(windows_tooling_timeout STREQUAL "windows_tooling_timeout-NOTFOUND" OR (windows_tooling_timeout MATCHES "^[0-9.]+$" AND windows_tooling_timeout LESS 120))
set_tests_properties(${windows_tooling_test} PROPERTIES TIMEOUT 120)
endif()
set_property(TEST ${windows_tooling_test} APPEND PROPERTY ENVIRONMENT_MODIFICATION "PYTHONUTF8=set:1")
endforeach()
endfunction()
raise_windows_tooling_test_timeouts(${windows_tooling_after})
@@ -809,6 +926,7 @@ set_target_properties(usb-1.0 PROPERTIES POSITION_INDEPENDENT_CODE ON)
include(cmake/ZArchive.cmake)
include(cmake/Opus.cmake)
include(cmake/Sqlite.cmake)
include(cmake/Icu.cmake)
if(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANYPS5_ENABLE_ASAN AND NOT ANYPS5_ENABLE_TSAN))
set(MI_BUILD_SHARED ON CACHE BOOL "" FORCE)
set(MI_BUILD_STATIC OFF CACHE BOOL "" FORCE)
@@ -833,3 +951,4 @@ add_subdirectory(core/Decoder/Jpeg)
add_subdirectory(core/Decoder/Png)
add_subdirectory(core/libs)
add_subdirectory(core/relinker)
add_subdirectory(tools/library-oracle)
+4 -2
View File
@@ -58,11 +58,13 @@ The [pull request template](.github/pull_request_template.md) is the checklist f
- One branch per topic, based on current `main`. Follow-up work goes in a new pull request, not into an open one.
- Open pull requests per author are limited by how many of theirs are merged into `main`: 1 with none merged, 20 with at least 1, no limit from 20. A pull request opened or reopened over the limit is closed automatically; reopen it once another one is merged or closed.
- Before starting, check that no open pull request already implements the same functions.
- Before starting, check that no open pull request already implements the same functions: `python3 tools/pr_overlap.py --names <function>...` prints, for each name, whether `main` implements it or still stubs it and which open pull requests add it.
- Keep the branch up to date with `main` and resolve conflicts yourself; rebasing and force-pushing is fine.
- An AGC test executable and its tests are registered in `core/libs/prx/libSceAgcDriver/tests/cmake/<executable>.cmake`; the tests of an execution test in `tests/execution/` go in the fragment of its `agc_driver_<name>_tests` executable. `CMakeLists.txt` includes the fragments in sorted order, so a fragment uses nothing another fragment defines. A pull request whose change to `libSceAgcDriver/CMakeLists.txt` conflicts after the split rebases and runs `python3 tools/agc_test_split.py resolve` during the stopped rebase, which moves its registrations to their fragments and leaves conflict markers where `main` changed the same lines.
- A new libc or libkernel test executable and its tests are registered in `core/libs/prx/libc/tests/cmake/<executable>.cmake` or `core/libs/prx/libkernel/tests/cmake/<executable>.cmake`. That library's `CMakeLists.txt` includes the fragments in sorted order after its own registrations, so a fragment can use what `CMakeLists.txt` defines but nothing another fragment defines. Tests already registered in `CMakeLists.txt` stay there.
- A pull request that conflicts with `main` and has no activity for 7 days is labeled `stale` with a reminder. It is not closed.
- An hourly job gives the `review queue` label to the oldest 30 pull requests that need no more work from their author, `unblocks title` ones first, and lists them in the review queue issue. A pull request needs more work while it is a draft, conflicts with `main`, has a `perf numbers missing` or `open PR limit` label, has a failing or unfinished check other than Intake, Labels, Eligibility and the progress report, or has a change request whose reviewer was not asked again; pushing alone does not answer a change request. `python3 tools/pr_ready.py --explain <number>` prints what blocks a pull request.
- A pull request whose merge would not change `main` is labeled `already in main` with one comment, checked hourly: GitHub's test merge has the same files as its `main` commit, and no file the pull request touches has changed in `main` since. It is not closed. Close it if it is superseded, or push what is missing.
- If a pull request needs another one first, say so on the checklist line (`Depends on: #N`; `none` otherwise).
- If a pull request fixes a reported issue, write `Fixes #N` on its checklist line (`none` otherwise). GitHub closes the issue on merge, and the `fix error` label is added within the hour.
- If a pull request fixes a stop or a wrong result seen on a title, name it on the checklist line with the title ID and its [Game bring-up](https://github.com/boykopovar/AnyPS5/discussions/categories/game-bring-up) discussion (`Unblocks: PPSA01325 #3232`; `none` otherwise). Reviewers review these first. Such a pull request gets the `unblocks title` label.
@@ -71,7 +73,7 @@ The [pull request template](.github/pull_request_template.md) is the checklist f
- The PR overlap comment lists open pull requests that change the same lines or exports; agree with their authors which one goes first and declare it with `Depends on`.
- Run the tests before opening the pull request and describe what was tested (OS, title or homebrew).
- A pull request that claims a change in speed shows the summary lines of `main` and of the change, from the same machine and scene, and attaches the traces, captured as the [Performance report](.github/ISSUE_TEMPLATE/performance.yml) issue form describes. A slow scene is reported with the same form. A pull request titled `perf(...)` or `perf:` is labeled `perf`, and `perf numbers missing` until its description holds two valid summary lines with different commits. A `perf(tools)`, `perf(ci)` or `perf(build)` pull request has no title to capture, so it is labeled `perf` only and reports its own before and after timings.
- Changes to the AGC driver, the shader recompiler or VideoOut run the same focused tests on `main` and the change with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` using `ctest -V` from the same machine and GPU, confirm neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`, confirm the change introduces no new `VUID-` validation errors compared with `main`, and name each GPU the GPU tests ran on (vendor, model, driver, OS) on the `GPUs tested` checklist line. CI runs these tests only on lavapipe, and hardware drivers fail where lavapipe and other vendors pass, so a reviewer can ask for a run on another vendor before merging.
- Changes to the AGC driver, the shader recompiler or VideoOut run the same focused tests on `main` and the change with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` using `ctest -V` from the same machine and GPU, confirm each log shows the loader inserting the layer (`Insert instance layer "VK_LAYER_KHRONOS_validation"`) and neither reports `was not found but was requested by env var VK_INSTANCE_LAYERS` (the test programs register no debug messenger, so the loader prints either line only with `VK_LOADER_DEBUG=layer`), confirm the change introduces no new `VUID-` validation errors compared with `main`, and name each GPU the GPU tests ran on (vendor, model, driver, OS) on the `GPUs tested` checklist line. CI runs these tests only on lavapipe, and hardware drivers fail where lavapipe and other vendors pass, so a reviewer can ask for a run on another vendor before merging. Use a validation layer at least as new as the `3rdparty/Vulkan-Headers` submodule (`VK_HEADER_VERSION` 335, i.e. layer 1.4.335 or newer); an older layer does not know the `pNext` structs the driver chains (for example `VK_KHR_shader_fma`) and logs a spurious `VUID-VkDeviceCreateInfo-pNext-pNext` that fails every GPU test.
- Investigation notes, reports, screenshots and logs go in the pull request, not in the repository. Images for documentation go in the [gist](https://gist.github.com/boykopovar/0e53f2e1426f29ecd41e3b51540b8a90) comments.
- Say whether the change was written with AI assistance. The author of the pull request is responsible for every line of it.
+2 -2
View File
@@ -1,4 +1,4 @@
**English** | [Português (Brasil)](docs/user/README.pt-BR.md) | [Español](docs/user/README.es.md) | [Català](docs/user/README.ca.md) | [Italiano](docs/user/README.it.md) | [简体中文](docs/user/README.zh-CN.md) | [Русский](docs/user/README.ru.md) | [Bahasa Indonesia](docs/user/README.id.md)
**English** | [Português (Brasil)](docs/user/README.pt-BR.md) | [Español](docs/user/README.es.md) | [Català](docs/user/README.ca.md) | [Italiano](docs/user/README.it.md) | [简体中文](docs/user/README.zh-CN.md) | [Русский](docs/user/README.ru.md) | [Bahasa Indonesia](docs/user/README.id.md) | [Polski](docs/user/README.pl.md) | [日本語](docs/user/README.ja.md)
# About
@@ -16,7 +16,7 @@ Includes a [relinker](core/relinker) that converts executable to the target syst
## Status
[![libraries](https://boykopovar.github.io/AnyPS5/badge-libraries.svg)](https://boykopovar.github.io/AnyPS5/progress.html) [![shader forms decoded, counted from the code](https://boykopovar.github.io/AnyPS5/badge-shaders.svg)](https://boykopovar.github.io/AnyPS5/progress.html) [![implemented in 7 days](https://boykopovar.github.io/AnyPS5/badge-week.svg)](https://boykopovar.github.io/AnyPS5/history.html)
[![libraries](https://boykopovar.github.io/AnyPS5/badge-libraries.svg)](https://boykopovar.github.io/AnyPS5/progress.html) [![RDNA2 reference shader forms decoded](https://boykopovar.github.io/AnyPS5/badge-shaders.svg)](https://boykopovar.github.io/AnyPS5/progress.html) [![gfx1013 reference shader forms decoded](https://boykopovar.github.io/AnyPS5/badge-shaders-gfx1013.svg)](https://boykopovar.github.io/AnyPS5/progress.html) [![implemented in 7 days](https://boykopovar.github.io/AnyPS5/badge-week.svg)](https://boykopovar.github.io/AnyPS5/history.html)
[![progress map](https://boykopovar.github.io/AnyPS5/progress.svg)](https://boykopovar.github.io/AnyPS5/progress.html)
+30
View File
@@ -0,0 +1,30 @@
if(NOT DEST_DIR)
message(FATAL_ERROR "DEST_DIR is required")
endif()
set(ANYPS5_COPY_ATTEMPTS 20)
math(EXPR lastArg "${CMAKE_ARGC} - 1")
if(NOT CMAKE_ARGV2 STREQUAL "-P" OR lastArg LESS 4)
message(FATAL_ERROR "Expected: cmake -DDEST_DIR=<dir> -P CopyRuntimeFiles.cmake <file>...")
endif()
foreach(argIndex RANGE 4 ${lastArg})
set(source "${CMAKE_ARGV${argIndex}}")
get_filename_component(name "${source}" NAME)
get_filename_component(sourceDir "${source}" DIRECTORY)
get_filename_component(destDir "${DEST_DIR}" ABSOLUTE)
if("${sourceDir}" STREQUAL "${destDir}")
continue()
endif()
set(copied FALSE)
foreach(attempt RANGE 1 ${ANYPS5_COPY_ATTEMPTS})
file(MAKE_DIRECTORY "${DEST_DIR}")
file(COPY_FILE "${source}" "${DEST_DIR}/${name}" ONLY_IF_DIFFERENT RESULT result)
if(result STREQUAL "0")
set(copied TRUE)
break()
endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 0.25)
endforeach()
if(NOT copied)
message(FATAL_ERROR "Could not copy ${source} to ${DEST_DIR} after ${ANYPS5_COPY_ATTEMPTS} attempts: ${result}")
endif()
endforeach()
+19
View File
@@ -0,0 +1,19 @@
file(STRINGS "${EXECUTABLES}" executables)
if(NOT executables)
message(FATAL_ERROR "no executables listed in ${EXECUTABLES}")
endif()
set(failures "")
foreach(executable IN LISTS executables)
if(NOT EXISTS "${executable}")
continue()
endif()
file(STRINGS "${executable}" levels REGEX "requestedExecutionLevel level=\"asInvoker\"" LIMIT_COUNT 1)
if(NOT levels)
get_filename_component(name "${executable}" NAME)
list(APPEND failures "${name}: no asInvoker manifest, so a name containing install, setup or update needs elevation to run")
endif()
endforeach()
if(failures)
list(JOIN failures "\n" text)
message(FATAL_ERROR "${text}")
endif()
+139
View File
@@ -0,0 +1,139 @@
set(ICU_SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/icu/icu4c/source)
add_library(icu_common STATIC EXCLUDE_FROM_ALL
${ICU_SOURCE_DIR}/common/appendable.cpp
${ICU_SOURCE_DIR}/common/bmpset.cpp
${ICU_SOURCE_DIR}/common/bytesinkutil.cpp
${ICU_SOURCE_DIR}/common/bytestream.cpp
${ICU_SOURCE_DIR}/common/bytestrie.cpp
${ICU_SOURCE_DIR}/common/characterproperties.cpp
${ICU_SOURCE_DIR}/common/charstr.cpp
${ICU_SOURCE_DIR}/common/cmemory.cpp
${ICU_SOURCE_DIR}/common/cstring.cpp
${ICU_SOURCE_DIR}/common/edits.cpp
${ICU_SOURCE_DIR}/common/emojiprops.cpp
${ICU_SOURCE_DIR}/common/filterednormalizer2.cpp
${ICU_SOURCE_DIR}/common/loadednormalizer2impl.cpp
${ICU_SOURCE_DIR}/common/locmap.cpp
${ICU_SOURCE_DIR}/common/normalizer2.cpp
${ICU_SOURCE_DIR}/common/normalizer2impl.cpp
${ICU_SOURCE_DIR}/common/parsepos.cpp
${ICU_SOURCE_DIR}/common/patternprops.cpp
${ICU_SOURCE_DIR}/common/propname.cpp
${ICU_SOURCE_DIR}/common/putil.cpp
${ICU_SOURCE_DIR}/common/ruleiter.cpp
${ICU_SOURCE_DIR}/common/stringpiece.cpp
${ICU_SOURCE_DIR}/common/uarrsort.cpp
${ICU_SOURCE_DIR}/common/ubidi.cpp
${ICU_SOURCE_DIR}/common/ubidi_props.cpp
${ICU_SOURCE_DIR}/common/ubidiln.cpp
${ICU_SOURCE_DIR}/common/ubidiwrt.cpp
${ICU_SOURCE_DIR}/common/ucnv.cpp
${ICU_SOURCE_DIR}/common/ucnv2022.cpp
${ICU_SOURCE_DIR}/common/ucnv_bld.cpp
${ICU_SOURCE_DIR}/common/ucnv_cb.cpp
${ICU_SOURCE_DIR}/common/ucnv_cnv.cpp
${ICU_SOURCE_DIR}/common/ucnv_ct.cpp
${ICU_SOURCE_DIR}/common/ucnv_err.cpp
${ICU_SOURCE_DIR}/common/ucnv_ext.cpp
${ICU_SOURCE_DIR}/common/ucnv_io.cpp
${ICU_SOURCE_DIR}/common/ucnv_lmb.cpp
${ICU_SOURCE_DIR}/common/ucnv_set.cpp
${ICU_SOURCE_DIR}/common/ucnv_u16.cpp
${ICU_SOURCE_DIR}/common/ucnv_u32.cpp
${ICU_SOURCE_DIR}/common/ucnv_u7.cpp
${ICU_SOURCE_DIR}/common/ucnv_u8.cpp
${ICU_SOURCE_DIR}/common/ucnvbocu.cpp
${ICU_SOURCE_DIR}/common/ucnvhz.cpp
${ICU_SOURCE_DIR}/common/ucnvisci.cpp
${ICU_SOURCE_DIR}/common/ucnvlat1.cpp
${ICU_SOURCE_DIR}/common/ucnvmbcs.cpp
${ICU_SOURCE_DIR}/common/ucnvscsu.cpp
${ICU_SOURCE_DIR}/common/uenum.cpp
${ICU_SOURCE_DIR}/common/ustr_cnv.cpp
${ICU_SOURCE_DIR}/common/ustrfmt.cpp
${ICU_SOURCE_DIR}/common/ucase.cpp
${ICU_SOURCE_DIR}/common/uchar.cpp
${ICU_SOURCE_DIR}/common/ucharstrie.cpp
${ICU_SOURCE_DIR}/common/ucharstrieiterator.cpp
${ICU_SOURCE_DIR}/common/ucln_cmn.cpp
${ICU_SOURCE_DIR}/common/ucmndata.cpp
${ICU_SOURCE_DIR}/common/ucptrie.cpp
${ICU_SOURCE_DIR}/common/udata.cpp
${ICU_SOURCE_DIR}/common/udatamem.cpp
${ICU_SOURCE_DIR}/common/udataswp.cpp
${ICU_SOURCE_DIR}/common/uhash.cpp
${ICU_SOURCE_DIR}/common/uinvchar.cpp
${ICU_SOURCE_DIR}/common/umapfile.cpp
${ICU_SOURCE_DIR}/common/umath.cpp
${ICU_SOURCE_DIR}/common/umutablecptrie.cpp
${ICU_SOURCE_DIR}/common/umutex.cpp
${ICU_SOURCE_DIR}/common/unames.cpp
${ICU_SOURCE_DIR}/common/unifilt.cpp
${ICU_SOURCE_DIR}/common/unifunct.cpp
${ICU_SOURCE_DIR}/common/uniset.cpp
${ICU_SOURCE_DIR}/common/uniset_props.cpp
${ICU_SOURCE_DIR}/common/unisetspan.cpp
${ICU_SOURCE_DIR}/common/unistr.cpp
${ICU_SOURCE_DIR}/common/unistr_case.cpp
${ICU_SOURCE_DIR}/common/unormcmp.cpp
${ICU_SOURCE_DIR}/common/uobject.cpp
${ICU_SOURCE_DIR}/common/uprops.cpp
${ICU_SOURCE_DIR}/common/uscript_props.cpp
${ICU_SOURCE_DIR}/common/ustrcase.cpp
${ICU_SOURCE_DIR}/common/ustring.cpp
${ICU_SOURCE_DIR}/common/ustrtrns.cpp
${ICU_SOURCE_DIR}/common/utf_impl.cpp
${ICU_SOURCE_DIR}/common/util.cpp
${ICU_SOURCE_DIR}/common/utrace.cpp
${ICU_SOURCE_DIR}/common/utrie2.cpp
${ICU_SOURCE_DIR}/common/utrie_swap.cpp
${ICU_SOURCE_DIR}/common/uvector.cpp
${ICU_SOURCE_DIR}/common/uvectr32.cpp
${ICU_SOURCE_DIR}/stubdata/stubdata.cpp)
if(WIN32)
target_sources(icu_common PRIVATE
${ICU_SOURCE_DIR}/common/fixedstring.cpp
${ICU_SOURCE_DIR}/common/localebuilder.cpp
${ICU_SOURCE_DIR}/common/locid.cpp
${ICU_SOURCE_DIR}/common/loclikely.cpp
${ICU_SOURCE_DIR}/common/loclikelysubtags.cpp
${ICU_SOURCE_DIR}/common/lsr.cpp
${ICU_SOURCE_DIR}/common/resource.cpp
${ICU_SOURCE_DIR}/common/ucol_swp.cpp
${ICU_SOURCE_DIR}/common/uloc.cpp
${ICU_SOURCE_DIR}/common/uloc_keytype.cpp
${ICU_SOURCE_DIR}/common/uloc_tag.cpp
${ICU_SOURCE_DIR}/common/uresbund.cpp
${ICU_SOURCE_DIR}/common/uresdata.cpp
${ICU_SOURCE_DIR}/common/ustrenum.cpp
${ICU_SOURCE_DIR}/common/utypes.cpp
${ICU_SOURCE_DIR}/common/wintz.cpp)
endif()
target_include_directories(icu_common SYSTEM PUBLIC ${ICU_SOURCE_DIR}/common)
target_compile_definitions(icu_common PUBLIC U_STATIC_IMPLEMENTATION PRIVATE U_COMMON_IMPLEMENTATION UCONFIG_NO_FILE_IO=1 UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0)
target_compile_features(icu_common PUBLIC cxx_std_17)
set_target_properties(icu_common PROPERTIES POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
if(MINGW OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(icu_common INTERFACE LINKER:--exclude-libs,libicu_common.a)
endif()
add_library(icu_i18n STATIC EXCLUDE_FROM_ALL
${ICU_SOURCE_DIR}/i18n/csdetect.cpp
${ICU_SOURCE_DIR}/i18n/csmatch.cpp
${ICU_SOURCE_DIR}/i18n/csr2022.cpp
${ICU_SOURCE_DIR}/i18n/csrecog.cpp
${ICU_SOURCE_DIR}/i18n/csrmbcs.cpp
${ICU_SOURCE_DIR}/i18n/csrsbcs.cpp
${ICU_SOURCE_DIR}/i18n/csrucode.cpp
${ICU_SOURCE_DIR}/i18n/csrutf8.cpp
${ICU_SOURCE_DIR}/i18n/inputext.cpp
${ICU_SOURCE_DIR}/i18n/ucln_in.cpp
${ICU_SOURCE_DIR}/i18n/ucsdet.cpp)
target_include_directories(icu_i18n SYSTEM PUBLIC ${ICU_SOURCE_DIR}/i18n)
target_compile_definitions(icu_i18n PRIVATE U_I18N_IMPLEMENTATION UCONFIG_NO_FILE_IO=1)
target_link_libraries(icu_i18n PUBLIC icu_common)
set_target_properties(icu_i18n PROPERTIES POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
if(MINGW OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(icu_i18n INTERFACE LINKER:--exclude-libs,libicu_i18n.a)
endif()
+7
View File
@@ -44,6 +44,13 @@ function(add_bundled_libxml2)
set(LIBXML2_WITH_ZLIB OFF CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/libxml2 ${CMAKE_BINARY_DIR}/3rdparty/libxml2 EXCLUDE_FROM_ALL)
foreach(property LINK_LIBRARIES INTERFACE_LINK_LIBRARIES)
get_target_property(libraries LibXml2 ${property})
if(libraries)
list(REMOVE_ITEM libraries windows_seh_personalities)
set_property(TARGET LibXml2 PROPERTY ${property} "${libraries}")
endif()
endforeach()
if(WIN32)
get_target_property(xmlSources LibXml2 SOURCES)
list(FILTER xmlSources EXCLUDE REGEX "\\.rc$")
+12
View File
@@ -0,0 +1,12 @@
get_filename_component(stagedName "${SOURCE}" NAME)
set(staged "${STAGED_DIR}/${stagedName}")
if(EXISTS "${staged}")
file(REAL_PATH "${SOURCE}" sourcePath)
file(REAL_PATH "${staged}" stagedPath)
if(NOT sourcePath STREQUAL stagedPath)
file(COPY_FILE "${SOURCE}" "${staged}" ONLY_IF_DIFFERENT RESULT copyResult)
if(NOT copyResult EQUAL 0)
message(WARNING "${staged} still holds an older ${stagedName}: ${copyResult}")
endif()
endif()
endif()
+19 -2
View File
@@ -17,10 +17,27 @@ endif()
set_target_properties(sqlite_jimsh PROPERTIES OUTPUT_NAME jimsh RUNTIME_OUTPUT_DIRECTORY ${sqliteGen})
set(sqliteTcl $<TARGET_FILE:sqlite_jimsh>)
file(RELATIVE_PATH sqliteTop ${sqliteGen} ${SQLITE_SOURCE_DIR})
set(sqliteHeaderDeps ${SQLITE_SOURCE_DIR}/src/sqlite.h.in ${SQLITE_SOURCE_DIR}/VERSION)
if(sqliteTop MATCHES " ")
set(sqliteTop top)
set(sqliteHeaderInputs VERSION manifest manifest.uuid manifest.tags src/sqlite.h.in ext/rtree/sqlite3rtree.h ext/session/sqlite3session.h ext/fts5/fts5.h)
set(sqliteHeaderDeps)
foreach(input IN LISTS sqliteHeaderInputs)
if(EXISTS ${SQLITE_SOURCE_DIR}/${input})
get_filename_component(inputDir ${input} DIRECTORY)
file(MAKE_DIRECTORY ${sqliteGen}/top/${inputDir})
add_custom_command(OUTPUT ${sqliteGen}/top/${input}
COMMAND ${CMAKE_COMMAND} -E copy ${SQLITE_SOURCE_DIR}/${input} ${sqliteGen}/top/${input}
DEPENDS ${SQLITE_SOURCE_DIR}/${input})
list(APPEND sqliteHeaderDeps ${sqliteGen}/top/${input})
endif()
endforeach()
endif()
add_custom_command(OUTPUT ${sqliteGen}/sqlite3.h
COMMAND ${sqliteTcl} ${SQLITE_SOURCE_DIR}/tool/mksqlite3h.tcl ${SQLITE_SOURCE_DIR} -o ${sqliteGen}/sqlite3.h
COMMAND ${sqliteTcl} ${SQLITE_SOURCE_DIR}/tool/mksqlite3h.tcl ${sqliteTop} -o ${sqliteGen}/sqlite3.h
WORKING_DIRECTORY ${sqliteGen}
DEPENDS sqlite_jimsh sqlite_mksourceid ${SQLITE_SOURCE_DIR}/src/sqlite.h.in ${SQLITE_SOURCE_DIR}/VERSION)
DEPENDS sqlite_jimsh sqlite_mksourceid ${sqliteHeaderDeps})
add_custom_command(OUTPUT ${sqliteGen}/parse.c ${sqliteGen}/parse.h
COMMAND ${CMAKE_COMMAND} -E copy ${SQLITE_SOURCE_DIR}/src/parse.y ${SQLITE_SOURCE_DIR}/tool/lempar.c ${sqliteGen}
COMMAND $<TARGET_FILE:sqlite_lemon> -S parse.y
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
+1
View File
@@ -0,0 +1 @@
1 24 "@CMAKE_SOURCE_DIR@/cmake/WindowsManifest.manifest"
+6
View File
@@ -35,6 +35,10 @@ std::optional<Header> ParseHeader(std::span<const std::uint8_t> png);
std::optional<Image> Decode(std::span<const std::uint8_t> png);
std::vector<std::uint16_t> DecodeRgba16(std::span<const std::uint8_t> png);
bool CheckChunkCrc(std::span<const std::uint8_t> typeAndData, std::uint32_t expected);
inline constexpr std::uint8_t FILTER_NONE = 1 << 0;
inline constexpr std::uint8_t FILTER_SUB = 1 << 1;
inline constexpr std::uint8_t FILTER_UP = 1 << 2;
@@ -45,6 +49,8 @@ inline constexpr std::uint8_t FILTER_ALL = FILTER_NONE | FILTER_SUB | FILTER_UP
struct EncodeOptions {
int compressionLevel = 8;
std::uint8_t filters = FILTER_ALL;
std::uint8_t bitDepth = 8;
bool whiteBackground = false;
};
std::vector<std::uint8_t> Encode(std::span<const std::uint8_t> pixels, std::uint32_t width, std::uint32_t height,
+36 -6
View File
@@ -98,14 +98,19 @@ void appendBigEndian32(std::vector<std::uint8_t>& output, std::uint32_t value) {
for (int shift = 24; shift >= 0; shift -= 8) output.push_back(static_cast<std::uint8_t>(value >> shift));
}
std::uint32_t chunkCrc(std::span<const std::uint8_t> typeAndData) {
std::uint32_t crc = 0xFFFFFFFFu;
for (const auto byte : typeAndData) crc = (crc >> 8) ^ CRC_TABLE[(crc ^ byte) & 0xFF];
return ~crc;
}
void appendChunk(std::vector<std::uint8_t>& output, const char* type, std::span<const std::uint8_t> data) {
appendBigEndian32(output, static_cast<std::uint32_t>(data.size()));
const std::size_t checkedFrom = output.size();
output.insert(output.end(), type, type + 4);
output.insert(output.end(), data.begin(), data.end());
std::uint32_t crc = 0xFFFFFFFFu;
for (std::size_t i = checkedFrom; i < output.size(); ++i) crc = (crc >> 8) ^ CRC_TABLE[(crc ^ output[i]) & 0xFF];
appendBigEndian32(output, ~crc);
const auto crc = chunkCrc(std::span(output).subspan(checkedFrom));
appendBigEndian32(output, crc);
}
int paethPredictor(int left, int up, int upLeft) {
@@ -194,13 +199,33 @@ std::optional<Image> Decode(std::span<const std::uint8_t> png) {
return image;
}
std::vector<std::uint16_t> DecodeRgba16(std::span<const std::uint8_t> png) {
if (png.empty() || png.size() > INT_MAX) return {};
const auto header = ParseHeader(png);
if (!header || header->bitDepth != 16) return {};
int width = 0;
int height = 0;
const std::unique_ptr<stbi_us, decltype(&stbi_image_free)> decoded(
stbi_load_16_from_memory(png.data(), static_cast<int>(png.size()), &width, &height, nullptr, 4),
stbi_image_free);
if (!decoded || width != static_cast<int>(header->width) || height != static_cast<int>(header->height)) return {};
return {decoded.get(), decoded.get() + static_cast<std::size_t>(width) * height * 4};
}
bool CheckChunkCrc(std::span<const std::uint8_t> typeAndData, std::uint32_t expected) {
return chunkCrc(typeAndData) == expected;
}
std::vector<std::uint8_t> Encode(std::span<const std::uint8_t> pixels, std::uint32_t width, std::uint32_t height,
std::uint32_t channels, EncodeOptions options) {
if (channels < 1 || channels > 4) throw std::invalid_argument("Png::Encode: channels must be 1-4");
if (options.compressionLevel < 0 || options.compressionLevel > 9 || options.filters == 0 || (options.filters & ~FILTER_ALL) != 0) {
throw std::invalid_argument("Png::Encode: unsupported options");
}
const std::uint64_t rowSize = static_cast<std::uint64_t>(width) * channels;
if (options.bitDepth != 8 && options.bitDepth != 16)
throw std::invalid_argument("Png::Encode: unsupported sample depth");
const std::uint32_t pixelSize = channels * (options.bitDepth / 8);
const std::uint64_t rowSize = static_cast<std::uint64_t>(width) * pixelSize;
if (width == 0 || height == 0 || rowSize > INT_MAX || (rowSize + 1) * height > INT_MAX) {
throw std::invalid_argument("Png::Encode: unsupported image size");
}
@@ -217,7 +242,7 @@ std::vector<std::uint8_t> Encode(std::span<const std::uint8_t> pixels, std::uint
std::uint64_t bestCost = UINT64_MAX;
for (std::uint8_t filterType = 0; filterType < FILTER_TYPE_COUNT; ++filterType) {
if ((options.filters & (1u << filterType)) == 0) continue;
const std::uint64_t cost =filterRow(row, previousRow, rowSize, channels, filterType, candidate.data());
const std::uint64_t cost = filterRow(row, previousRow, rowSize, pixelSize, filterType, candidate.data());
if (cost >= bestCost) continue;
bestCost = cost;
filteredRow[0] = filterType;
@@ -234,11 +259,16 @@ std::vector<std::uint8_t> Encode(std::span<const std::uint8_t> pixels, std::uint
std::vector<std::uint8_t> header;
appendBigEndian32(header, width);
appendBigEndian32(header, height);
header.insert(header.end(), {8, COLOR_TYPE_BY_CHANNELS[channels], 0, 0, 0});
header.insert(header.end(), {options.bitDepth, COLOR_TYPE_BY_CHANNELS[channels], 0, 0, 0});
std::vector<std::uint8_t> output(SIGNATURE.begin(), SIGNATURE.end());
output.reserve(SIGNATURE.size() + 3 * CHUNK_OVERHEAD + IHDR_SIZE + static_cast<std::size_t>(compressedSize));
appendChunk(output, "IHDR", header);
if (options.whiteBackground) {
const auto high = static_cast<std::uint8_t>(options.bitDepth == 16 ? 255 : 0);
const std::array<std::uint8_t, 6> background{high, 255, high, 255, high, 255};
appendChunk(output, "bKGD", std::span(background).first(channels < 3 ? 2 : 6));
}
appendChunk(output, "IDAT", std::span<const std::uint8_t>(compressed.get(), static_cast<std::size_t>(compressedSize)));
appendChunk(output, "IEND", {});
return output;
+108 -7
View File
@@ -56,8 +56,14 @@ function(configure_windows_unwind target)
if(NOT EXISTS "${CMAKE_OBJCOPY}")
message(FATAL_ERROR "Windows DWARF unwinding requires objcopy")
endif()
set(refreshStagedRuntime "")
get_target_property(targetType ${target} TYPE)
if(BUILD_TESTING AND NOT CMAKE_VERSION VERSION_LESS 3.21 AND targetType STREQUAL "SHARED_LIBRARY")
set(refreshStagedRuntime COMMAND "${CMAKE_COMMAND}" "-DSOURCE=$<TARGET_FILE:${target}>" "-DSTAGED_DIR=${ANYPS5_TEST_OUTPUT_DIRECTORY}" -P "${CMAKE_SOURCE_DIR}/cmake/RefreshStagedRuntime.cmake")
endif()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_OBJCOPY}" --rename-section .eh_frame=.ehfram --rename-section .eh_fram=.ehfram "$<TARGET_FILE:${target}>"
${refreshStagedRuntime}
VERBATIM
)
endif()
@@ -261,6 +267,18 @@ if(BUILD_TESTING)
endif()
endif()
if(BUILD_TESTING)
add_test_executable(guest_abstract_youtube_immediate_returns_tests tests/GuestAbstractYoutubeImmediateReturns.cpp)
target_include_directories(guest_abstract_youtube_immediate_returns_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_abstract_youtube_immediate_returns_tests PRIVATE libSceAbstractYoutube libc)
configure_windows_unwind(guest_abstract_youtube_immediate_returns_tests)
add_test(NAME guest_abstract_youtube_immediate_returns COMMAND guest_abstract_youtube_immediate_returns_tests)
if(WIN32)
set_tests_properties(guest_abstract_youtube_immediate_returns PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAbstractYoutube>")
endif()
endif()
include(prx/libSceFreeType/PostScriptInfo.cmake)
if(APS5_ENABLE_TRACY)
@@ -339,6 +357,11 @@ if(BUILD_TESTING)
add_test(NAME guest_kernel_sys_paths_${case} COMMAND guest_kernel_sys_paths_tests ${UNPATCHED_DIR} unpatched ${case})
add_test(NAME guest_kernel_sys_paths_${case}_patched COMMAND guest_kernel_sys_paths_tests ${PATCHED_DIR} patched ${case})
set_tests_properties(guest_kernel_sys_paths_${case} guest_kernel_sys_paths_${case}_patched PROPERTIES TIMEOUT 20)
if(MINGW)
get_filename_component(kernelSysPathsRuntimeDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY)
set_tests_properties(guest_kernel_sys_paths_${case} guest_kernel_sys_paths_${case}_patched PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${kernelSysPathsRuntimeDirectory}")
endif()
endforeach()
set_tests_properties(guest_kernel_sys_paths_symlinkat guest_kernel_sys_paths_symlinkat_patched PROPERTIES SKIP_RETURN_CODE 77)
@@ -560,6 +583,11 @@ if(BUILD_TESTING)
add_test(NAME guest_kernel_sys_pwrite COMMAND guest_kernel_sys_pwrite_tests ${UNPATCHED_DIR} unpatched)
add_test(NAME guest_kernel_sys_pwrite_patched COMMAND guest_kernel_sys_pwrite_tests ${PATCHED_DIR} patched)
set_tests_properties(guest_kernel_sys_pwrite guest_kernel_sys_pwrite_patched PROPERTIES TIMEOUT 20)
if(MINGW)
get_filename_component(kernelSysPwriteRuntimeDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY)
set_tests_properties(guest_kernel_sys_pwrite guest_kernel_sys_pwrite_patched PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${kernelSysPwriteRuntimeDirectory}")
endif()
add_test_executable(guest_kernel_sys_tests tests/GuestKernelSys.cpp)
target_include_directories(guest_kernel_sys_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_kernel_sys_tests PRIVATE libkernel_sys libSceNet libSceAmpr libkernel libc)
@@ -655,13 +683,13 @@ if(BUILD_TESTING)
endif()
add_test_executable(guest_firmware_constant_returns_tests tests/GuestFirmwareConstantReturns.cpp)
target_include_directories(guest_firmware_constant_returns_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_firmware_constant_returns_tests PRIVATE libSceAvSetting libSceComposite libSceFsInternalForVsh libSceHttpCache libScePlayReady libSceSdma libSceSsl libSceVisionManager libmdbg_syscore libkernel libc)
target_link_libraries(guest_firmware_constant_returns_tests PRIVATE libSceAvSetting libSceComposite libSceFsInternalForVsh libSceHttpCache libScePlayReady libScePSNowGkp libSceSdma libSceSsl libSceSystemLogger2 libSceVisionManager libmdbg_syscore libkernel libc)
configure_windows_unwind(guest_firmware_constant_returns_tests)
add_test(NAME guest_firmware_constant_returns COMMAND guest_firmware_constant_returns_tests)
set_tests_properties(guest_firmware_constant_returns PROPERTIES TIMEOUT 20)
if(WIN32)
set_tests_properties(guest_firmware_constant_returns PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAvSetting>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceComposite>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceFsInternalForVsh>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceHttpCache>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePlayReady>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSdma>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSsl>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceVisionManager>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libmdbg_syscore>")
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAvSetting>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceComposite>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceFsInternalForVsh>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceHttpCache>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePlayReady>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePSNowGkp>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSdma>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSsl>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSystemLogger2>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceVisionManager>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libmdbg_syscore>")
endif()
add_test_executable(guest_bemp2sys_tests tests/GuestBemp2sys.cpp)
target_include_directories(guest_bemp2sys_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
@@ -856,6 +884,28 @@ if(BUILD_TESTING)
FAIL_REGULAR_EXPRESSION "did not fault")
endif()
add_test_executable(guest_kernel_sys_wait_tests tests/GuestKernelSysWait.cpp
nid/src/NidCompute.cpp nid/src/Sha1.cpp)
target_include_directories(guest_kernel_sys_wait_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/nid/include)
target_link_libraries(guest_kernel_sys_wait_tests PRIVATE ${CMAKE_DL_LIBS})
add_custom_target(guest_kernel_sys_wait_libraries DEPENDS
${PATCHED_DIR}/libkernel_sys.prx ${PATCHED_DIR}/libkernel.prx ${LIBC_PATCHED})
add_dependencies(guest_kernel_sys_wait_tests guest_kernel_sys_wait_libraries)
configure_windows_unwind(guest_kernel_sys_wait_tests)
if(MINGW)
target_compile_options(guest_kernel_sys_wait_tests PRIVATE -fasynchronous-unwind-tables)
target_link_options(guest_kernel_sys_wait_tests PRIVATE -static -static-libgcc -static-libstdc++)
endif()
foreach(case IN ITEMS wait3 wait4 _wait4)
add_test(NAME guest_kernel_sys_wait_${case} COMMAND guest_kernel_sys_wait_tests ${UNPATCHED_DIR} unpatched ${case})
add_test(NAME guest_kernel_sys_wait_${case}_patched COMMAND guest_kernel_sys_wait_tests ${PATCHED_DIR} patched ${case})
set_tests_properties(guest_kernel_sys_wait_${case} guest_kernel_sys_wait_${case}_patched PROPERTIES TIMEOUT 20)
if(MINGW)
get_filename_component(kernelSysWaitRuntimeDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY)
set_tests_properties(guest_kernel_sys_wait_${case} guest_kernel_sys_wait_${case}_patched PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${kernelSysWaitRuntimeDirectory}")
endif()
endforeach()
add_test_executable(guest_voice_port_attr_tests tests/GuestVoicePortAttr.cpp)
target_include_directories(guest_voice_port_attr_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_voice_port_attr_tests PRIVATE libSceVoice libc)
@@ -1200,7 +1250,7 @@ if(BUILD_TESTING)
add_test_executable(rudp_poll_wait_exception_tests tests/RudpPollWaitException.cpp
prx/libSceRudp/Export.cpp prx/libkernel/Time/TimedWait.cpp)
target_include_directories(rudp_poll_wait_exception_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rudp_poll_wait_exception_tests PRIVATE libc)
target_link_libraries(rudp_poll_wait_exception_tests PRIVATE libSceNet libc)
configure_windows_unwind(rudp_poll_wait_exception_tests)
add_test(NAME rudp_poll_wait_exception COMMAND rudp_poll_wait_exception_tests)
set_tests_properties(rudp_poll_wait_exception PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77 ENVIRONMENT_MODIFICATION
@@ -1330,10 +1380,24 @@ if(BUILD_TESTING)
endif()
add_test(NAME host_thread_local COMMAND host_thread_local_tests)
set_tests_properties(host_thread_local PROPERTIES TIMEOUT 15)
add_test_executable(host_thread_mxcsr_tests tests/HostThreadMxcsr.cpp)
target_include_directories(host_thread_mxcsr_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(host_thread_mxcsr_tests PRIVATE libc)
add_test(NAME host_thread_mxcsr COMMAND host_thread_mxcsr_tests)
if(WIN32)
set_tests_properties(host_thread_mxcsr PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
if(MINGW)
add_test(NAME prx_thread_local_destructors COMMAND ${CMAKE_COMMAND} -DNM=${CMAKE_NM} -DOBJDUMP=${CMAKE_OBJDUMP}
-DMODULES=$<TARGET_FILE_DIR:libc> -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/ThreadLocalDestructors.cmake)
set_tests_properties(prx_thread_local_destructors PROPERTIES TIMEOUT 300)
add_test(NAME test_thread_local_destructors COMMAND ${CMAKE_COMMAND} -DNM=${CMAKE_NM} -DOBJDUMP=${CMAKE_OBJDUMP}
-DPATTERN=*.exe -DMODULES=$<1:${ANYPS5_TEST_OUTPUT_DIRECTORY}> -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/ThreadLocalDestructors.cmake)
set_tests_properties(test_thread_local_destructors PROPERTIES TIMEOUT 300)
add_test(NAME thread_local_destructors_unusable_nm COMMAND ${CMAKE_COMMAND} -DNM=${CMAKE_CURRENT_BINARY_DIR}/missing/nm
-DOBJDUMP=${CMAKE_OBJDUMP} -DPATTERN=ThreadLocalDestructors.cmake -DMODULES=${CMAKE_CURRENT_SOURCE_DIR}/tests
-P ${CMAKE_CURRENT_SOURCE_DIR}/tests/ThreadLocalDestructors.cmake)
set_tests_properties(thread_local_destructors_unusable_nm PROPERTIES WILL_FAIL TRUE TIMEOUT 30)
endif()
add_test_executable(guest_np_cpp_web_api_intrusive_ptr_tests tests/GuestNpCppWebApiIntrusivePtr.cpp)
@@ -1408,6 +1472,17 @@ if(BUILD_TESTING)
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel_sys>")
endif()
add_test_executable(guest_kernel_timer_gettime_bounds_tests tests/GuestKernelTimerGettimeBounds.cpp)
target_include_directories(guest_kernel_timer_gettime_bounds_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_kernel_timer_gettime_bounds_tests PRIVATE libkernel_sys libkernel libc)
configure_windows_unwind(guest_kernel_timer_gettime_bounds_tests)
add_test(NAME guest_kernel_timer_gettime_bounds COMMAND guest_kernel_timer_gettime_bounds_tests)
set_tests_properties(guest_kernel_timer_gettime_bounds PROPERTIES TIMEOUT 20)
if(WIN32)
set_tests_properties(guest_kernel_timer_gettime_bounds PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel_sys>")
endif()
add_test_executable(guest_crt_tests tests/GuestCrt.cpp)
target_include_directories(guest_crt_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_crt_tests PRIVATE libSceAmpr libc)
@@ -1459,10 +1534,15 @@ if(BUILD_TESTING)
add_test(NAME guest_kernel_process_exports_patched COMMAND guest_kernel_process_exports_tests ${PATCHED_DIR} patched)
set_tests_properties(guest_kernel_process_exports guest_kernel_process_exports_patched PROPERTIES TIMEOUT 20)
if(WIN32)
set_tests_properties(guest_kernel_process_exports PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:${UNPATCHED_DIR}")
set_tests_properties(guest_kernel_process_exports_patched PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:${PATCHED_DIR}")
set(processExportsUnpatchedPath "PATH=path_list_prepend:${UNPATCHED_DIR}")
set(processExportsPatchedPath "PATH=path_list_prepend:${PATCHED_DIR}")
if(MINGW)
get_filename_component(processExportsRuntimeDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY)
list(APPEND processExportsUnpatchedPath "PATH=path_list_prepend:${processExportsRuntimeDirectory}")
list(APPEND processExportsPatchedPath "PATH=path_list_prepend:${processExportsRuntimeDirectory}")
endif()
set_tests_properties(guest_kernel_process_exports PROPERTIES ENVIRONMENT_MODIFICATION "${processExportsUnpatchedPath}")
set_tests_properties(guest_kernel_process_exports_patched PROPERTIES ENVIRONMENT_MODIFICATION "${processExportsPatchedPath}")
endif()
add_test_executable(guest_posix_random_tests tests/GuestPosixRandom.cpp)
@@ -1499,6 +1579,17 @@ if(BUILD_TESTING)
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel_sys>")
endif()
add_test_executable(guest_kernel_sys_development_mode_tests tests/GuestKernelSysDevelopmentMode.cpp)
target_include_directories(guest_kernel_sys_development_mode_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_kernel_sys_development_mode_tests PRIVATE libkernel_sys libkernel libc)
configure_windows_unwind(guest_kernel_sys_development_mode_tests)
add_test(NAME guest_kernel_sys_development_mode COMMAND guest_kernel_sys_development_mode_tests)
set_tests_properties(guest_kernel_sys_development_mode PROPERTIES TIMEOUT 20)
if(WIN32)
set_tests_properties(guest_kernel_sys_development_mode PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libkernel_sys>")
endif()
add_test_executable(guest_acm_tests tests/GuestAcm.cpp)
target_include_directories(guest_acm_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_acm_tests PRIVATE libSceAcm libc)
@@ -1558,6 +1649,16 @@ if(BUILD_TESTING)
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceGnmDriverForNeoMode>")
endif()
add_test_executable(guest_agc_driver_unknown_tests tests/GuestAgcDriverUnknown.cpp)
target_include_directories(guest_agc_driver_unknown_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_agc_driver_unknown_tests PRIVATE libSceAgcDriver libc)
configure_windows_unwind(guest_agc_driver_unknown_tests)
add_test(NAME guest_agc_driver_unknown COMMAND guest_agc_driver_unknown_tests)
if(WIN32)
set_tests_properties(guest_agc_driver_unknown PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAgcDriver>")
endif()
add_test_executable(guest_gnm_neo_default_state_tests tests/GuestGnmNeoDefaultState.cpp)
target_include_directories(guest_gnm_neo_default_state_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_gnm_neo_default_state_tests PRIVATE libSceGnmDriverForNeoMode libc)
+9 -1
View File
@@ -1513,7 +1513,15 @@ struct SharePlayConnectionInfo {
std::int32_t visitorUserId;
};
static_assert(sizeof(SharePlayConnectionInfo) == 56 && offsetof(SharePlayConnectionInfo, hostUserId) == 48);
struct NpId { NpOnlineId online_id; std::uint8_t opaque[4]; };
struct NpId {
union {
NpOnlineId handle;
NpOnlineId online_id;
};
std::uint8_t opt[8];
std::uint8_t reserved[8];
};
static_assert(sizeof(NpId) == 36);
struct NpCreateAsyncRequestParameter { std::uint8_t opaque[64]; };
struct NpCheckPremiumParameter { std::uint8_t opaque[64]; };
struct NpCheckPremiumResult { std::uint8_t opaque[64]; };
+6 -1
View File
@@ -307,7 +307,12 @@ private:
rest = {};
}
}
if (node->Entry) throw std::runtime_error("duplicate patched export name: " + entry.Name);
if (node->Entry) {
const bool existingReexport = (node->Entry->Flags & kExportReexport) != 0;
const bool incomingReexport = (entry.Flags & kExportReexport) != 0;
if (existingReexport == incomingReexport) throw std::runtime_error("duplicate patched export name: " + entry.Name);
if (incomingReexport) return;
}
node->Entry = entry;
}
+29 -5
View File
@@ -1,10 +1,12 @@
#include <nid/BinaryPatcherFactory.hpp>
#include <nid/ExportExclusions.hpp>
#include <nid/NativePath.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <system_error>
#include <vector>
namespace {
@@ -16,11 +18,33 @@ std::vector<std::uint8_t> _readFile(const std::string& path) {
}
void _writeFile(const std::string& path, const std::vector<std::uint8_t>& data) {
std::ofstream f(Nid::Internal::NativePath(path), std::ios::binary);
if (!f) throw std::runtime_error("cannot write: " + path);
f.write(reinterpret_cast<const char*>(data.data()), static_cast<std::streamsize>(data.size()));
f.close();
if (!f) throw std::runtime_error("cannot write: " + path);
const std::filesystem::path target = Nid::Internal::NativePath(path);
const auto permissions = std::filesystem::status(target).permissions();
std::filesystem::path pending = target;
pending += ".patching";
std::error_code discarded;
{
std::ofstream f(pending, std::ios::binary);
if (!f) throw std::runtime_error("cannot write: " + path);
f.write(reinterpret_cast<const char*>(data.data()), static_cast<std::streamsize>(data.size()));
f.close();
if (!f) {
std::filesystem::remove(pending, discarded);
throw std::runtime_error("cannot write: " + path);
}
}
std::error_code permissionError;
std::filesystem::permissions(pending, permissions, permissionError);
if (permissionError) {
std::filesystem::remove(pending, discarded);
throw std::runtime_error("cannot preserve permissions: " + path + ": " + permissionError.message());
}
std::error_code renamed;
std::filesystem::rename(pending, target, renamed);
if (renamed) {
std::filesystem::remove(pending, discarded);
throw std::runtime_error("cannot write: " + path + ": " + renamed.message());
}
}
}
+17 -1
View File
@@ -1,4 +1,6 @@
import subprocess
import os
import stat
import signal
import sys
import tempfile
@@ -55,6 +57,19 @@ class NativePathTests(unittest.TestCase):
self.assertFalse(missing.exists())
self.assertEqual(existing.read_bytes(), b"unchanged")
@unittest.skipUnless(os.name == "posix", "requires POSIX file permissions")
def test_patching_preserves_the_input_permissions(self):
for mode in (0o700, 0o750, 0o640):
with self.subTest(mode=oct(mode)), tempfile.TemporaryDirectory() as temporary:
file = Path(temporary) / "library.prx"
file.write_bytes(build_dylib([("_puts_nid_postfix", 0, 0x100)], []))
file.chmod(mode)
result = self.invoke(file)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertEqual(exports_of(file.read_bytes()), {"_" + nid("puts"): (0, 0x100)})
self.assertEqual(stat.S_IMODE(file.stat().st_mode), mode)
self.assertEqual(list(Path(temporary).iterdir()), [file])
@unittest.skipUnless(resource is not None and hasattr(signal, "SIGXFSZ"), "requires POSIX file size limits")
def test_failed_file_write_is_reported_without_success(self):
for limit in (0, 1024):
@@ -70,7 +85,8 @@ class NativePathTests(unittest.TestCase):
result = subprocess.run([str(PATCHER), "libtest", str(file)], capture_output=True,
encoding="utf-8", errors="replace", timeout=10,
preexec_fn=restrict_output)
self.assertEqual(file.stat().st_size, limit)
self.assertEqual(file.read_bytes(), original)
self.assertEqual(sorted(entry.name for entry in file.parent.iterdir()), [file.name])
self.assertEqual(result.returncode, 2, result.stdout + result.stderr)
self.assertIn("cannot write", result.stderr)
self.assertIn(str(file), result.stderr)
+3
View File
@@ -0,0 +1,3 @@
add_library(Party SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(Party PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(Party)
+138
View File
@@ -0,0 +1,138 @@
#include "prx/libc/include/general/ExportMacros.hpp"
#include "prx/Party/include/InventoryExports.hpp"
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
extern "C" {
int APS5_VABI PartyUnknown_0iEKNAvT600_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("0iEKNAvT600", PartyUnknown_0iEKNAvT600_nid_no_patch);
int APS5_VABI PartyUnknown_2cELEBPdYQ0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("2cELEBPdYQ0", PartyUnknown_2cELEBPdYQ0_nid_no_patch);
int APS5_VABI PartyUnknown_5xYxiOtOccA_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("5xYxiOtOccA", PartyUnknown_5xYxiOtOccA_nid_no_patch);
int APS5_VABI PartyUnknown_6W_plus_shIH315Q_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("6W+shIH315Q", PartyUnknown_6W_plus_shIH315Q_nid_no_patch);
int APS5_VABI PartyUnknown_7ilObq815O4_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("7ilObq815O4", PartyUnknown_7ilObq815O4_nid_no_patch);
int APS5_VABI PartyUnknown_7iq7Hfs8HBk_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("7iq7Hfs8HBk", PartyUnknown_7iq7Hfs8HBk_nid_no_patch);
int APS5_VABI PartyUnknown_7kwSdZNDyP0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("7kwSdZNDyP0", PartyUnknown_7kwSdZNDyP0_nid_no_patch);
int APS5_VABI PartyUnknown_AC1FtjqMCL0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("AC1FtjqMCL0", PartyUnknown_AC1FtjqMCL0_nid_no_patch);
int APS5_VABI PartyUnknown_AJ3I035AjIM_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("AJ3I035AjIM", PartyUnknown_AJ3I035AjIM_nid_no_patch);
int APS5_VABI PartyUnknown_AMJZhpC_plus_siY_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("AMJZhpC+siY", PartyUnknown_AMJZhpC_plus_siY_nid_no_patch);
int APS5_VABI PartyUnknown_aq13EdrGdVw_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("aq13EdrGdVw", PartyUnknown_aq13EdrGdVw_nid_no_patch);
int APS5_VABI PartyUnknown_BOW_minus_t_minus_9qJNI_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("BOW-t-9qJNI", PartyUnknown_BOW_minus_t_minus_9qJNI_nid_no_patch);
int APS5_VABI PartyUnknown_E9XkHowt_plus_dY_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("E9XkHowt+dY", PartyUnknown_E9XkHowt_plus_dY_nid_no_patch);
int APS5_VABI PartyUnknown_f3d6tchKw94_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("f3d6tchKw94", PartyUnknown_f3d6tchKw94_nid_no_patch);
int APS5_VABI PartyUnknown_GADjreszOgM_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("GADjreszOgM", PartyUnknown_GADjreszOgM_nid_no_patch);
int APS5_VABI PartyUnknown_Giyg2xGrXDU_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Giyg2xGrXDU", PartyUnknown_Giyg2xGrXDU_nid_no_patch);
int APS5_VABI PartyUnknown_JrVwjbBmqLQ_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("JrVwjbBmqLQ", PartyUnknown_JrVwjbBmqLQ_nid_no_patch);
int APS5_VABI PartyUnknown_KC3y21wrqzc_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("KC3y21wrqzc", PartyUnknown_KC3y21wrqzc_nid_no_patch);
int APS5_VABI PartyUnknown_nVzRzo3Yr_plus_s_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("nVzRzo3Yr+s", PartyUnknown_nVzRzo3Yr_plus_s_nid_no_patch);
int APS5_VABI PartyUnknown_pnz21I6VjDs_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("pnz21I6VjDs", PartyUnknown_pnz21I6VjDs_nid_no_patch);
int APS5_VABI PartyUnknown_Qb8wS4GZUsw_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Qb8wS4GZUsw", PartyUnknown_Qb8wS4GZUsw_nid_no_patch);
int APS5_VABI PartyUnknown_qk043QPsrZU_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("qk043QPsrZU", PartyUnknown_qk043QPsrZU_nid_no_patch);
int APS5_VABI PartyUnknown_QVQ_minus_lvlaJZw_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("QVQ-lvlaJZw", PartyUnknown_QVQ_minus_lvlaJZw_nid_no_patch);
int APS5_VABI PartyUnknown_SjQdzD78RpM_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("SjQdzD78RpM", PartyUnknown_SjQdzD78RpM_nid_no_patch);
int APS5_VABI PartyUnknown_uDGXwUKqi8s_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("uDGXwUKqi8s", PartyUnknown_uDGXwUKqi8s_nid_no_patch);
int APS5_VABI PartyUnknown_YdBvG5Myxzg_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("YdBvG5Myxzg", PartyUnknown_YdBvG5Myxzg_nid_no_patch);
}
+3
View File
@@ -0,0 +1,3 @@
#pragma once
#include "prx/Party/include/InventoryExports.hpp"
@@ -0,0 +1,34 @@
#pragma once
#include "SceTypes.hpp"
extern "C" {
int APS5_VABI PartyUnknown_0iEKNAvT600_nid_no_patch();
int APS5_VABI PartyUnknown_2cELEBPdYQ0_nid_no_patch();
int APS5_VABI PartyUnknown_5xYxiOtOccA_nid_no_patch();
int APS5_VABI PartyUnknown_6W_plus_shIH315Q_nid_no_patch();
int APS5_VABI PartyUnknown_7ilObq815O4_nid_no_patch();
int APS5_VABI PartyUnknown_7iq7Hfs8HBk_nid_no_patch();
int APS5_VABI PartyUnknown_7kwSdZNDyP0_nid_no_patch();
int APS5_VABI PartyUnknown_AC1FtjqMCL0_nid_no_patch();
int APS5_VABI PartyUnknown_AJ3I035AjIM_nid_no_patch();
int APS5_VABI PartyUnknown_AMJZhpC_plus_siY_nid_no_patch();
int APS5_VABI PartyUnknown_aq13EdrGdVw_nid_no_patch();
int APS5_VABI PartyUnknown_BOW_minus_t_minus_9qJNI_nid_no_patch();
int APS5_VABI PartyUnknown_E9XkHowt_plus_dY_nid_no_patch();
int APS5_VABI PartyUnknown_f3d6tchKw94_nid_no_patch();
int APS5_VABI PartyUnknown_GADjreszOgM_nid_no_patch();
int APS5_VABI PartyUnknown_Giyg2xGrXDU_nid_no_patch();
int APS5_VABI PartyUnknown_JrVwjbBmqLQ_nid_no_patch();
int APS5_VABI PartyUnknown_KC3y21wrqzc_nid_no_patch();
int APS5_VABI PartyUnknown_nVzRzo3Yr_plus_s_nid_no_patch();
int APS5_VABI PartyUnknown_pnz21I6VjDs_nid_no_patch();
int APS5_VABI PartyUnknown_Qb8wS4GZUsw_nid_no_patch();
int APS5_VABI PartyUnknown_qk043QPsrZU_nid_no_patch();
int APS5_VABI PartyUnknown_QVQ_minus_lvlaJZw_nid_no_patch();
int APS5_VABI PartyUnknown_SjQdzD78RpM_nid_no_patch();
int APS5_VABI PartyUnknown_uDGXwUKqi8s_nid_no_patch();
int APS5_VABI PartyUnknown_YdBvG5Myxzg_nid_no_patch();
}
+12 -24
View File
@@ -64,10 +64,9 @@ int APS5_VABI libAacsUnknown_0oisD9Dr3FI_nid_no_patch() {
}
APS5_EXPORT("0oisD9Dr3FI", libAacsUnknown_0oisD9Dr3FI_nid_no_patch);
int APS5_VABI libAacsUnknown_12CP5PHvlgs_nid_no_patch() {
int APS5_VABI _ZN12CAacsLoadMgrD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("12CP5PHvlgs", libAacsUnknown_12CP5PHvlgs_nid_no_patch);
int APS5_VABI libAacsUnknown_15QPrQC1usM_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -79,10 +78,9 @@ int APS5_VABI libAacsUnknown_1CNq2v6hoig_nid_no_patch() {
}
APS5_EXPORT("1CNq2v6hoig", libAacsUnknown_1CNq2v6hoig_nid_no_patch);
int APS5_VABI libAacsUnknown_1aMnfYcnn1I_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgrC2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("1aMnfYcnn1I", libAacsUnknown_1aMnfYcnn1I_nid_no_patch);
int APS5_VABI libAacsUnknown_1bzdduTshZ4_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -163,10 +161,9 @@ int APS5_VABI AacsPermissionActivate() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI libAacsUnknown_54hkTYBIxqs_nid_no_patch() {
int APS5_VABI _ZN12CAacsLoadMgraSERKS_() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("54hkTYBIxqs", libAacsUnknown_54hkTYBIxqs_nid_no_patch);
int APS5_VABI AacsBusDecrypt() {
NotImplemented_nid_no_patch(__func__);
@@ -186,10 +183,9 @@ int APS5_VABI libAacsUnknown_6XcWJGADJeU_nid_no_patch() {
}
APS5_EXPORT("6XcWJGADJeU", libAacsUnknown_6XcWJGADJeU_nid_no_patch);
int APS5_VABI libAacsUnknown_753FlqNkJlM_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgrD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("753FlqNkJlM", libAacsUnknown_753FlqNkJlM_nid_no_patch);
int APS5_VABI libAacsUnknown_7ETkLi9auE0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -260,10 +256,9 @@ int APS5_VABI libAacsUnknown_9rQgwWQB9NE_nid_no_patch() {
}
APS5_EXPORT("9rQgwWQB9NE", libAacsUnknown_9rQgwWQB9NE_nid_no_patch);
int APS5_VABI libAacsUnknown_AVRC3P8reF0_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgrC2ERKS_() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("AVRC3P8reF0", libAacsUnknown_AVRC3P8reF0_nid_no_patch);
int APS5_VABI libAacsUnknown_Apl9mjDSCE0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -363,10 +358,9 @@ int APS5_VABI libAacsUnknown_FEi5mHUWB0M_nid_no_patch() {
}
APS5_EXPORT("FEi5mHUWB0M", libAacsUnknown_FEi5mHUWB0M_nid_no_patch);
int APS5_VABI libAacsUnknown_FHWdAzU_minus_rRI_nid_no_patch() {
int APS5_VABI _Z22AacsAuthMgrGetInstancev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("FHWdAzU-rRI", libAacsUnknown_FHWdAzU_minus_rRI_nid_no_patch);
int APS5_VABI libAacsUnknown_Fl0RrZ7B27g_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -423,10 +417,9 @@ int APS5_VABI libAacsUnknown_ILwfo94p_minus_ng_nid_no_patch() {
}
APS5_EXPORT("ILwfo94p-ng", libAacsUnknown_ILwfo94p_minus_ng_nid_no_patch);
int APS5_VABI libAacsUnknown_Iofb1lKwTNA_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgraSERKS_() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Iofb1lKwTNA", libAacsUnknown_Iofb1lKwTNA_nid_no_patch);
int APS5_VABI libAacsUnknown_IxvgFI5JtxE_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -632,10 +625,9 @@ int APS5_VABI libAacsUnknown_SjewOoJlr9c_nid_no_patch() {
}
APS5_EXPORT("SjewOoJlr9c", libAacsUnknown_SjewOoJlr9c_nid_no_patch);
int APS5_VABI libAacsUnknown_TK5prfVU4b0_nid_no_patch() {
int APS5_VABI _ZN12CAacsLoadMgrD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("TK5prfVU4b0", libAacsUnknown_TK5prfVU4b0_nid_no_patch);
int APS5_VABI libAacsUnknown_TQCLQjHkkW0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -756,20 +748,18 @@ int APS5_VABI libAacsUnknown_Z9yhz8_plus_DS3k_nid_no_patch() {
}
APS5_EXPORT("Z9yhz8+DS3k", libAacsUnknown_Z9yhz8_plus_DS3k_nid_no_patch);
int APS5_VABI libAacsUnknown_ZCRVIAxld6o_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgrD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("ZCRVIAxld6o", libAacsUnknown_ZCRVIAxld6o_nid_no_patch);
int APS5_VABI libAacsUnknown_ZEdbi75pkX0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("ZEdbi75pkX0", libAacsUnknown_ZEdbi75pkX0_nid_no_patch);
int APS5_VABI libAacsUnknown_ZUEIg4QZJ_plus_k_nid_no_patch() {
int APS5_VABI _Z22AacsLoadMgrGetInstancev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("ZUEIg4QZJ+k", libAacsUnknown_ZUEIg4QZJ_plus_k_nid_no_patch);
int APS5_VABI libAacsUnknown_ZnJgSGpLzGs_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -974,10 +964,9 @@ int APS5_VABI libAacsUnknown_igIuBDqdlZo_nid_no_patch() {
}
APS5_EXPORT("igIuBDqdlZo", libAacsUnknown_igIuBDqdlZo_nid_no_patch);
int APS5_VABI libAacsUnknown_j0quzCtmBr4_nid_no_patch() {
int APS5_VABI _ZN12CAacsLoadMgrD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("j0quzCtmBr4", libAacsUnknown_j0quzCtmBr4_nid_no_patch);
int APS5_VABI libAacsUnknown_jXZJmZu3ihs_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -1003,10 +992,9 @@ int APS5_VABI libAacsUnknown_kX1hCR9FDo0_nid_no_patch() {
}
APS5_EXPORT("kX1hCR9FDo0", libAacsUnknown_kX1hCR9FDo0_nid_no_patch);
int APS5_VABI libAacsUnknown_kYQis7lBy_plus_U_nid_no_patch() {
int APS5_VABI _ZN12CAacsAuthMgrD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("kYQis7lBy+U", libAacsUnknown_kYQis7lBy_plus_U_nid_no_patch);
int APS5_VABI libAacsUnknown_kaxfKxeOvbU_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
@@ -16,10 +16,10 @@ int APS5_VABI libAacsUnknown__minus_lknLNU2NAU_nid_no_patch();
int APS5_VABI libAacsUnknown__minus_xuQAxlUvmk_nid_no_patch();
int APS5_VABI libAacsUnknown_0bhkzdWU6Y4_nid_no_patch();
int APS5_VABI libAacsUnknown_0oisD9Dr3FI_nid_no_patch();
int APS5_VABI libAacsUnknown_12CP5PHvlgs_nid_no_patch();
int APS5_VABI _ZN12CAacsLoadMgrD0Ev();
int APS5_VABI libAacsUnknown_15QPrQC1usM_nid_no_patch();
int APS5_VABI libAacsUnknown_1CNq2v6hoig_nid_no_patch();
int APS5_VABI libAacsUnknown_1aMnfYcnn1I_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgrC2Ev();
int APS5_VABI libAacsUnknown_1bzdduTshZ4_nid_no_patch();
int APS5_VABI libAacsUnknown_1eNkqOSGM_plus_A_nid_no_patch();
int APS5_VABI libAacsUnknown_1hyWLxCZ_minus_X8_nid_no_patch();
@@ -36,12 +36,12 @@ int APS5_VABI libAacsUnknown_3odIlZa6t2I_nid_no_patch();
int APS5_VABI libAacsUnknown_4IQhgxl103g_nid_no_patch();
int APS5_VABI libAacsUnknown_4r3seYGdIK0_nid_no_patch();
int APS5_VABI AacsPermissionActivate();
int APS5_VABI libAacsUnknown_54hkTYBIxqs_nid_no_patch();
int APS5_VABI _ZN12CAacsLoadMgraSERKS_();
int APS5_VABI AacsBusDecrypt();
int APS5_VABI AacsModuleStop();
int APS5_VABI libAacsUnknown_6ToH2wFRWf4_nid_no_patch();
int APS5_VABI libAacsUnknown_6XcWJGADJeU_nid_no_patch();
int APS5_VABI libAacsUnknown_753FlqNkJlM_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgrD2Ev();
int APS5_VABI libAacsUnknown_7ETkLi9auE0_nid_no_patch();
int APS5_VABI libAacsUnknown_7KCIejRxaB0_nid_no_patch();
int APS5_VABI AacsDecrypt();
@@ -56,7 +56,7 @@ int APS5_VABI libAacsUnknown_9S1fVMePqpI_nid_no_patch();
int APS5_VABI libAacsUnknown_9UJqpmNn494_nid_no_patch();
int APS5_VABI libAacsUnknown_9eTs6_minus_zAOJs_nid_no_patch();
int APS5_VABI libAacsUnknown_9rQgwWQB9NE_nid_no_patch();
int APS5_VABI libAacsUnknown_AVRC3P8reF0_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgrC2ERKS_();
int APS5_VABI libAacsUnknown_Apl9mjDSCE0_nid_no_patch();
int APS5_VABI libAacsUnknown_B10mYlgLwMM_nid_no_patch();
int APS5_VABI libAacsUnknown_BFdZY3ocsJo_nid_no_patch();
@@ -77,7 +77,7 @@ int APS5_VABI libAacsUnknown_EgaEREMnudw_nid_no_patch();
int APS5_VABI libAacsUnknown_FA1OyesdYiA_nid_no_patch();
int APS5_VABI libAacsUnknown_FEgD32GcLdM_nid_no_patch();
int APS5_VABI libAacsUnknown_FEi5mHUWB0M_nid_no_patch();
int APS5_VABI libAacsUnknown_FHWdAzU_minus_rRI_nid_no_patch();
int APS5_VABI _Z22AacsAuthMgrGetInstancev();
int APS5_VABI libAacsUnknown_Fl0RrZ7B27g_nid_no_patch();
int APS5_VABI libAacsUnknown_G4zfSFYC1f8_nid_no_patch();
int APS5_VABI libAacsUnknown_GD6inRSAHfo_nid_no_patch();
@@ -89,7 +89,7 @@ int APS5_VABI libAacsUnknown_HhIFaBlod8A_nid_no_patch();
int APS5_VABI libAacsUnknown_HmdBrUh2Xz4_nid_no_patch();
int APS5_VABI libAacsUnknown_HuTXuHqMrVE_nid_no_patch();
int APS5_VABI libAacsUnknown_ILwfo94p_minus_ng_nid_no_patch();
int APS5_VABI libAacsUnknown_Iofb1lKwTNA_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgraSERKS_();
int APS5_VABI libAacsUnknown_IxvgFI5JtxE_nid_no_patch();
int APS5_VABI libAacsUnknown_JXvlGrRcNlg_nid_no_patch();
int APS5_VABI libAacsUnknown_Jmviii0cDro_nid_no_patch();
@@ -131,7 +131,7 @@ int APS5_VABI libAacsUnknown_RkkCme3dsyo_nid_no_patch();
int APS5_VABI libAacsUnknown_SJ9GmthhZDk_nid_no_patch();
int APS5_VABI libAacsUnknown_SjEjF5V5XHc_nid_no_patch();
int APS5_VABI libAacsUnknown_SjewOoJlr9c_nid_no_patch();
int APS5_VABI libAacsUnknown_TK5prfVU4b0_nid_no_patch();
int APS5_VABI _ZN12CAacsLoadMgrD1Ev();
int APS5_VABI libAacsUnknown_TQCLQjHkkW0_nid_no_patch();
int APS5_VABI libAacsUnknown_TuTNDTTOXHo_nid_no_patch();
int APS5_VABI libAacsUnknown_U2zlEU4AhRk_nid_no_patch();
@@ -156,9 +156,9 @@ int APS5_VABI libAacsUnknown_YDl9jLvW_plus_SM_nid_no_patch();
int APS5_VABI libAacsUnknown_YOlHXj4rrzQ_nid_no_patch();
int APS5_VABI libAacsUnknown_Yqt0NzhE_minus_eU_nid_no_patch();
int APS5_VABI libAacsUnknown_Z9yhz8_plus_DS3k_nid_no_patch();
int APS5_VABI libAacsUnknown_ZCRVIAxld6o_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgrD1Ev();
int APS5_VABI libAacsUnknown_ZEdbi75pkX0_nid_no_patch();
int APS5_VABI libAacsUnknown_ZUEIg4QZJ_plus_k_nid_no_patch();
int APS5_VABI _Z22AacsLoadMgrGetInstancev();
int APS5_VABI libAacsUnknown_ZnJgSGpLzGs_nid_no_patch();
int APS5_VABI libAacsUnknown_a3D2_minus_Eh_minus_DW8_nid_no_patch();
int APS5_VABI libAacsUnknown_aOX5VPrNfqo_nid_no_patch();
@@ -200,13 +200,13 @@ int APS5_VABI libAacsUnknown_iIgtd05IlbA_nid_no_patch();
int APS5_VABI libAacsUnknown_iJ3zPE02P1w_nid_no_patch();
int APS5_VABI libAacsUnknown_iOLQbPwqsJU_nid_no_patch();
int APS5_VABI libAacsUnknown_igIuBDqdlZo_nid_no_patch();
int APS5_VABI libAacsUnknown_j0quzCtmBr4_nid_no_patch();
int APS5_VABI _ZN12CAacsLoadMgrD2Ev();
int APS5_VABI libAacsUnknown_jXZJmZu3ihs_nid_no_patch();
int APS5_VABI libAacsUnknown_jdd4KuD7bOg_nid_no_patch();
int APS5_VABI libAacsUnknown_jpKit8Qv76g_nid_no_patch();
int APS5_VABI AacsPermissionSet();
int APS5_VABI libAacsUnknown_kX1hCR9FDo0_nid_no_patch();
int APS5_VABI libAacsUnknown_kYQis7lBy_plus_U_nid_no_patch();
int APS5_VABI _ZN12CAacsAuthMgrD0Ev();
int APS5_VABI libAacsUnknown_kaxfKxeOvbU_nid_no_patch();
int APS5_VABI libAacsUnknown_keNMJVznBe0_nid_no_patch();
int APS5_VABI libAacsUnknown_kk8ELO4Y2Fo_nid_no_patch();
@@ -0,0 +1,15 @@
add_library(libSceAbstractLocal SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceAbstractLocal PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceAbstractLocal)
if(BUILD_TESTING)
add_test_executable(guest_abstract_local_tests ${LIBS_INCLUDE_DIR}/tests/GuestAbstractLocal.cpp)
target_include_directories(guest_abstract_local_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_abstract_local_tests PRIVATE libSceAbstractLocal libc)
configure_windows_unwind(guest_abstract_local_tests)
add_test(NAME guest_abstract_local COMMAND guest_abstract_local_tests)
if(WIN32)
set_tests_properties(guest_abstract_local PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAbstractLocal>")
endif()
endif()
+86 -148
View File
@@ -1,359 +1,297 @@
#include "prx/libSceAbstractLocal/include/Exports.hpp"
#include <cstddef>
#include <cstdint>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
namespace {
constexpr int SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED = static_cast<int>(0x809E0005);
constexpr int SCE_ABSTRACT_STORAGE_ERROR_809E0002 = static_cast<int>(0x809E0002);
}
extern "C" {
int APS5_VABI sceAbstractLocalUnknown_FEu1f3FzXEs_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder10NewContentERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("FEu1f3FzXEs", sceAbstractLocalUnknown_FEu1f3FzXEs_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_Sggzq_yDkN4_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder12RemoveFolderERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEb() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Sggzq+yDkN4", sceAbstractLocalUnknown_Sggzq_yDkN4_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_G85xANoQtwY_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder12readExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("G85xANoQtwY", sceAbstractLocalUnknown_G85xANoQtwY_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown__hzeczmXprY_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder13RemoveContentERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("-hzeczmXprY", sceAbstractLocalUnknown__hzeczmXprY_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_NWB_BVBCHxk_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder13writeExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("NWB-BVBCHxk", sceAbstractLocalUnknown_NWB_BVBCHxk_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_aZaT3Nyab30_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder4OpenENS_8ItemTypeE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("aZaT3Nyab30", sceAbstractLocalUnknown_aZaT3Nyab30_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_LOS4KcdYH4U_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder5CloseEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("LOS4KcdYH4U", sceAbstractLocalUnknown_LOS4KcdYH4U_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_G2Ny4kfT__U_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder6RemoveEb() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("G2Ny4kfT-+U", sceAbstractLocalUnknown_G2Ny4kfT__U_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_TrIn0pwP01Y_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder8NextItemEPSt10shared_ptrINS_4ItemEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("TrIn0pwP01Y", sceAbstractLocalUnknown_TrIn0pwP01Y_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_8PcGryCtIyc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolder9NewFolderERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_6FolderEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("8PcGryCtIyc", sceAbstractLocalUnknown_8PcGryCtIyc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_uISRjQQphhM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolderC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("uISRjQQphhM", sceAbstractLocalUnknown_uISRjQQphhM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_boWydF6kfCg_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolderC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("boWydF6kfCg", sceAbstractLocalUnknown_boWydF6kfCg_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_P0nRNq2s9yM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolderD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("P0nRNq2s9yM", sceAbstractLocalUnknown_P0nRNq2s9yM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_EUEJ9ApMPBI_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolderD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("EUEJ9ApMPBI", sceAbstractLocalUnknown_EUEJ9ApMPBI_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown__FKZylBFj8Y_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage11LocalFolderD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("-FKZylBFj8Y", sceAbstractLocalUnknown__FKZylBFj8Y_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_CGjnAIJU2b4_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent12readExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("CGjnAIJU2b4", sceAbstractLocalUnknown_CGjnAIJU2b4_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_XArRxgQY_cg_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent13ParseMetadataEPN23sceMetadataReaderWriter8MetadataES3_() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("XArRxgQY+cg", sceAbstractLocalUnknown_XArRxgQY_cg_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_mv0DAYhVdT8_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent13writeExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("mv0DAYhVdT8", sceAbstractLocalUnknown_mv0DAYhVdT8_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_TyTI4dfrUpk_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent4OpenEit() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("TyTI4dfrUpk", sceAbstractLocalUnknown_TyTI4dfrUpk_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown__A0_F3ASPXQ_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent4ReadEPvlPl() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("+A0+F3ASPXQ", sceAbstractLocalUnknown__A0_F3ASPXQ_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_KtO3l4R5GP8_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent5CloseEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("KtO3l4R5GP8", sceAbstractLocalUnknown_KtO3l4R5GP8_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_7_OxGuuZnkM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent5FlushEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("7-OxGuuZnkM", sceAbstractLocalUnknown_7_OxGuuZnkM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_5EbtsmF7TSc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent5WriteEPKvlPl() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("5EbtsmF7TSc", sceAbstractLocalUnknown_5EbtsmF7TSc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown__5ID5YbnNjM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent6RemoveEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("+5ID5YbnNjM", sceAbstractLocalUnknown__5ID5YbnNjM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_wa7RuAVTdZw_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent6RenameERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("wa7RuAVTdZw", sceAbstractLocalUnknown_wa7RuAVTdZw_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_7IQ862KCLk0_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContent8SeekByteEliPl() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("7IQ862KCLk0", sceAbstractLocalUnknown_7IQ862KCLk0_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_uaiGNR0Sbvc_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage12LocalContent8SeekTimeElPl() {
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
APS5_EXPORT("uaiGNR0Sbvc", sceAbstractLocalUnknown_uaiGNR0Sbvc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_DGU0Qg_6p8M_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContentC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("DGU0Qg+6p8M", sceAbstractLocalUnknown_DGU0Qg_6p8M_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_HbbM72T9icI_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContentC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("HbbM72T9icI", sceAbstractLocalUnknown_HbbM72T9icI_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_VpVK5yiU1UE_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContentD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("VpVK5yiU1UE", sceAbstractLocalUnknown_VpVK5yiU1UE_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_Px3PC4lV3pc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContentD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Px3PC4lV3pc", sceAbstractLocalUnknown_Px3PC4lV3pc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_JI2n0DRLfBM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalContentD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("JI2n0DRLfBM", sceAbstractLocalUnknown_JI2n0DRLfBM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_21w78rpNbjY_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService13SearchStorageEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("21w78rpNbjY", sceAbstractLocalUnknown_21w78rpNbjY_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_Dj2WuKEtKsw_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService18append_storagelistERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEb() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Dj2WuKEtKsw", sceAbstractLocalUnknown_Dj2WuKEtKsw_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown__zhp5N_79Zo_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService19isSandBoxRandomWordERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("-zhp5N+79Zo", sceAbstractLocalUnknown__zhp5N_79Zo_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_5GqRsNdzwwQ_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService20GetSandBoxRandomWordEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("5GqRsNdzwwQ", sceAbstractLocalUnknown_5GqRsNdzwwQ_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_xpT59kwSjy0_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService23create_storage_instanceERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("xpT59kwSjy0", sceAbstractLocalUnknown_xpT59kwSjy0_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_S_EGYMBGJq8_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService4StopEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("S+EGYMBGJq8", sceAbstractLocalUnknown_S_EGYMBGJq8_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_eTtdKzNrbjc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalService5StartEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("eTtdKzNrbjc", sceAbstractLocalUnknown_eTtdKzNrbjc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_c8RVn1N_Agc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalServiceC1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("c8RVn1N-Agc", sceAbstractLocalUnknown_c8RVn1N_Agc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_yvJjv5jHQdE_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalServiceC2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("yvJjv5jHQdE", sceAbstractLocalUnknown_yvJjv5jHQdE_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_HrVr0FDsbc8_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalServiceD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("HrVr0FDsbc8", sceAbstractLocalUnknown_HrVr0FDsbc8_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_XmZD0up1Q8Q_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalServiceD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("XmZD0up1Q8Q", sceAbstractLocalUnknown_XmZD0up1Q8Q_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_vPzTqyJy2cE_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalServiceD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("vPzTqyJy2cE", sceAbstractLocalUnknown_vPzTqyJy2cE_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_grDD8PABX2g_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage11DeserializeESt10shared_ptrINS_7ContentEEPS1_INS_4ItemEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("grDD8PABX2g", sceAbstractLocalUnknown_grDD8PABX2g_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_SnBiExt9JLs_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage12readExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("SnBiExt9JLs", sceAbstractLocalUnknown_SnBiExt9JLs_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_sHRmbEWM4rM_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage13GetRootFolderEPSt10shared_ptrINS_6FolderEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("sHRmbEWM4rM", sceAbstractLocalUnknown_sHRmbEWM4rM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_zLrVvtCBBuk_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage13writeExternalESt10shared_ptrINS_7ContentEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("zLrVvtCBBuk", sceAbstractLocalUnknown_zLrVvtCBBuk_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_VxXBo11wZ68_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage12LocalStorage14GetStorageSizeEPlS1_S1_() {
return SCE_ABSTRACT_STORAGE_ERROR_809E0002;
}
APS5_EXPORT("VxXBo11wZ68", sceAbstractLocalUnknown_VxXBo11wZ68_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_FLD7Rf5nyE4_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage15CreateRecursiveERKSbIcSt11char_traitsIcENS_8StlAllocIcEEENS_8ItemTypeEPSt10shared_ptrINS_4ItemEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("FLD7Rf5nyE4", sceAbstractLocalUnknown_FLD7Rf5nyE4_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_QRUnq01DRc0_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage15RemoveRecursiveERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("QRUnq01DRc0", sceAbstractLocalUnknown_QRUnq01DRc0_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_N0CijQdB1Jc_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage5ChModERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEt() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("N0CijQdB1Jc", sceAbstractLocalUnknown_N0CijQdB1Jc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_h6txl_QaLvA_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage7GetItemERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_4ItemEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("h6txl+QaLvA", sceAbstractLocalUnknown_h6txl_QaLvA_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_u_6z_j2wdjk_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage7IsExistERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("u+6z-j2wdjk", sceAbstractLocalUnknown_u_6z_j2wdjk_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_WPyTFrUZMxQ_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorage9SerializeESt10shared_ptrINS_7ContentEES1_INS_4ItemEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("WPyTFrUZMxQ", sceAbstractLocalUnknown_WPyTFrUZMxQ_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_yy12gayUXxw_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorageC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("yy12gayUXxw", sceAbstractLocalUnknown_yy12gayUXxw_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_5yChmiUJqt4_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorageC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("5yChmiUJqt4", sceAbstractLocalUnknown_5yChmiUJqt4_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_GxYlcKD_B44_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorageD0Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("GxYlcKD-B44", sceAbstractLocalUnknown_GxYlcKD_B44_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_gSe1f2ITi7E_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorageD1Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("gSe1f2ITi7E", sceAbstractLocalUnknown_gSe1f2ITi7E_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_8QOmy_K3L2k_nid_no_patch() {
int APS5_VABI _ZN15AbstractStorage12LocalStorageD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("8QOmy+K3L2k", sceAbstractLocalUnknown_8QOmy_K3L2k_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_IrZg5RHoLGQ_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage11LocalFolder10GetServiceEv() {
return 0;
}
APS5_EXPORT("IrZg5RHoLGQ", sceAbstractLocalUnknown_IrZg5RHoLGQ_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_Ul2GZtxXdTk_nid_no_patch() {
int APS5_VABI _ZNK15AbstractStorage11LocalFolder13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("Ul2GZtxXdTk", sceAbstractLocalUnknown_Ul2GZtxXdTk_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_2HZf301Pl98_nid_no_patch() {
int APS5_VABI _ZNK15AbstractStorage11LocalFolder7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("2HZf301Pl98", sceAbstractLocalUnknown_2HZf301Pl98_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_e65fXqnAlg4_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage12LocalContent10GetServiceEv() {
return 0;
}
APS5_EXPORT("e65fXqnAlg4", sceAbstractLocalUnknown_e65fXqnAlg4_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_RdHTTOCg41s_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage12LocalContent13GetCapabilityEv() {
return 0x37C5A;
}
APS5_EXPORT("RdHTTOCg41s", sceAbstractLocalUnknown_RdHTTOCg41s_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_P3BsMTTfmZU_nid_no_patch() {
int APS5_VABI _ZNK15AbstractStorage12LocalContent7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("P3BsMTTfmZU", sceAbstractLocalUnknown_P3BsMTTfmZU_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_oTaaYntc8RM_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage12LocalService14GetServiceTypeEv() {
return 0;
}
APS5_EXPORT("oTaaYntc8RM", sceAbstractLocalUnknown_oTaaYntc8RM_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_5AL8k9c6Poc_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage12LocalStorage10GetServiceEv() {
return 0;
}
APS5_EXPORT("5AL8k9c6Poc", sceAbstractLocalUnknown_5AL8k9c6Poc_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_c72L8ORqV60_nid_no_patch() {
int APS5_VABI _ZNK15AbstractStorage12LocalStorage13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
}
APS5_EXPORT("c72L8ORqV60", sceAbstractLocalUnknown_c72L8ORqV60_nid_no_patch);
int APS5_VABI sceAbstractLocalUnknown_rQhzp0Mu5m0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage12LocalStorage7GetStatEPNS_4StatE() {
return SCE_ABSTRACT_STORAGE_ERROR_809E0002;
}
APS5_EXPORT("rQhzp0Mu5m0", sceAbstractLocalUnknown_rQhzp0Mu5m0_nid_no_patch);
}
@@ -0,0 +1,78 @@
#pragma once
#include "SceTypes.hpp"
extern "C" {
int APS5_VABI _ZN15AbstractStorage11LocalFolder10NewContentERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder12RemoveFolderERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEb();
int APS5_VABI _ZN15AbstractStorage11LocalFolder12readExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder13RemoveContentERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder13writeExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder4OpenENS_8ItemTypeE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder5CloseEv();
int APS5_VABI _ZN15AbstractStorage11LocalFolder6RemoveEb();
int APS5_VABI _ZN15AbstractStorage11LocalFolder8NextItemEPSt10shared_ptrINS_4ItemEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolder9NewFolderERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_6FolderEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolderC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolderC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage11LocalFolderD0Ev();
int APS5_VABI _ZN15AbstractStorage11LocalFolderD1Ev();
int APS5_VABI _ZN15AbstractStorage11LocalFolderD2Ev();
int APS5_VABI _ZN15AbstractStorage12LocalContent12readExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage12LocalContent13ParseMetadataEPN23sceMetadataReaderWriter8MetadataES3_();
int APS5_VABI _ZN15AbstractStorage12LocalContent13writeExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage12LocalContent4OpenEit();
int APS5_VABI _ZN15AbstractStorage12LocalContent4ReadEPvlPl();
int APS5_VABI _ZN15AbstractStorage12LocalContent5CloseEv();
int APS5_VABI _ZN15AbstractStorage12LocalContent5FlushEv();
int APS5_VABI _ZN15AbstractStorage12LocalContent5WriteEPKvlPl();
int APS5_VABI _ZN15AbstractStorage12LocalContent6RemoveEv();
int APS5_VABI _ZN15AbstractStorage12LocalContent6RenameERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalContent8SeekByteEliPl();
int APS5_VABI _ZN15AbstractStorage12LocalContent8SeekTimeElPl();
int APS5_VABI _ZN15AbstractStorage12LocalContentC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalContentC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalContentD0Ev();
int APS5_VABI _ZN15AbstractStorage12LocalContentD1Ev();
int APS5_VABI _ZN15AbstractStorage12LocalContentD2Ev();
int APS5_VABI _ZN15AbstractStorage12LocalService13SearchStorageEv();
int APS5_VABI _ZN15AbstractStorage12LocalService18append_storagelistERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEb();
int APS5_VABI _ZN15AbstractStorage12LocalService19isSandBoxRandomWordERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalService20GetSandBoxRandomWordEv();
int APS5_VABI _ZN15AbstractStorage12LocalService23create_storage_instanceERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalService4StopEv();
int APS5_VABI _ZN15AbstractStorage12LocalService5StartEv();
int APS5_VABI _ZN15AbstractStorage12LocalServiceC1Ev();
int APS5_VABI _ZN15AbstractStorage12LocalServiceC2Ev();
int APS5_VABI _ZN15AbstractStorage12LocalServiceD0Ev();
int APS5_VABI _ZN15AbstractStorage12LocalServiceD1Ev();
int APS5_VABI _ZN15AbstractStorage12LocalServiceD2Ev();
int APS5_VABI _ZN15AbstractStorage12LocalStorage11DeserializeESt10shared_ptrINS_7ContentEEPS1_INS_4ItemEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage12readExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage13GetRootFolderEPSt10shared_ptrINS_6FolderEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage13writeExternalESt10shared_ptrINS_7ContentEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage14GetStorageSizeEPlS1_S1_();
int APS5_VABI _ZN15AbstractStorage12LocalStorage15CreateRecursiveERKSbIcSt11char_traitsIcENS_8StlAllocIcEEENS_8ItemTypeEPSt10shared_ptrINS_4ItemEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage15RemoveRecursiveERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage5ChModERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEt();
int APS5_VABI _ZN15AbstractStorage12LocalStorage7GetItemERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEPSt10shared_ptrINS_4ItemEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage7IsExistERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorage9SerializeESt10shared_ptrINS_7ContentEES1_INS_4ItemEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorageC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorageC2ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage12LocalStorageD0Ev();
int APS5_VABI _ZN15AbstractStorage12LocalStorageD1Ev();
int APS5_VABI _ZN15AbstractStorage12LocalStorageD2Ev();
int APS5_VABI _ZNK15AbstractStorage11LocalFolder10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage11LocalFolder13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage11LocalFolder7GetStatEPNS_4StatE();
int APS5_VABI _ZNK15AbstractStorage12LocalContent10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage12LocalContent13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage12LocalContent7GetStatEPNS_4StatE();
int APS5_VABI _ZNK15AbstractStorage12LocalService14GetServiceTypeEv();
int APS5_VABI _ZNK15AbstractStorage12LocalStorage10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage12LocalStorage13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage12LocalStorage7GetStatEPNS_4StatE();
}
@@ -1 +1,2 @@
#pragma once
#include "prx/libSceAbstractLocal/include/Exports.hpp"
@@ -0,0 +1,15 @@
add_library(libSceAbstractTwitter SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceAbstractTwitter PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceAbstractTwitter)
if(BUILD_TESTING)
add_test_executable(guest_abstract_twitter_tests ${LIBS_INCLUDE_DIR}/tests/GuestAbstractTwitter.cpp)
target_include_directories(guest_abstract_twitter_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_abstract_twitter_tests PRIVATE libSceAbstractTwitter libc)
configure_windows_unwind(guest_abstract_twitter_tests)
add_test(NAME guest_abstract_twitter COMMAND guest_abstract_twitter_tests)
if(WIN32)
set_tests_properties(guest_abstract_twitter PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAbstractTwitter>")
endif()
endif()
+22 -16
View File
@@ -4,6 +4,12 @@
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
namespace {
constexpr int SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED = static_cast<int>(0x809E0005);
}
extern "C" {
@@ -32,15 +38,15 @@ int APS5_VABI _ZN15AbstractStorage13TwitterFolder13RemoveContentERKSbIcSt11char_
}
int APS5_VABI _ZN15AbstractStorage13TwitterFolder4OpenENS_8ItemTypeE() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage13TwitterFolder5CloseEv() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage13TwitterFolder6RemoveEb() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage13TwitterFolder8NextItemEPSt10shared_ptrINS_4ItemEE() {
@@ -92,7 +98,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterContent4OpenEit() {
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent4ReadEPvlPl() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent5CloseEv() {
@@ -100,7 +106,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterContent5CloseEv() {
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent5FlushEv() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent5WriteEPKvlPl() {
@@ -108,7 +114,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterContent5WriteEPKvlPl() {
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent6RemoveEv() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent6RenameERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE() {
@@ -120,7 +126,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterContent8SeekByteEliPl() {
}
int APS5_VABI _ZN15AbstractStorage14TwitterContent8SeekTimeElPl() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage14TwitterContentC1ERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEb() {
@@ -192,7 +198,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterStorage13GetRootFolderEPSt10shared_pt
}
int APS5_VABI _ZN15AbstractStorage14TwitterStorage14GetStorageSizeEPlS1_S1_() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZN15AbstractStorage14TwitterStorage15CreateRecursiveERKSbIcSt11char_traitsIcENS_8StlAllocIcEEENS_8ItemTypeEPSt10shared_ptrINS_4ItemEE() {
@@ -240,7 +246,7 @@ int APS5_VABI _ZN15AbstractStorage14TwitterStorageD2Ev() {
}
int APS5_VABI _ZNK15AbstractStorage13TwitterFolder10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
return 3;
}
int APS5_VABI _ZNK15AbstractStorage13TwitterFolder13GetCapabilityEv() {
@@ -248,27 +254,27 @@ int APS5_VABI _ZNK15AbstractStorage13TwitterFolder13GetCapabilityEv() {
}
int APS5_VABI _ZNK15AbstractStorage13TwitterFolder7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterContent10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
return 3;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterContent13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
return 0x6C0A;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterContent7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterService14GetServiceTypeEv() {
NotImplemented_nid_no_patch(__func__);
return 3;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterStorage10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
return 3;
}
int APS5_VABI _ZNK15AbstractStorage14TwitterStorage13GetCapabilityEv() {
@@ -276,7 +282,7 @@ int APS5_VABI _ZNK15AbstractStorage14TwitterStorage13GetCapabilityEv() {
}
int APS5_VABI _ZNK15AbstractStorage14TwitterStorage7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
return SCE_ABSTRACT_STORAGE_ERROR_NOT_SUPPORTED;
}
}
+32 -32
View File
@@ -81,8 +81,8 @@ int APS5_VABI _ZN15AbstractStorage13YoutubeFolder5CloseEv() {
extern "C" {
int APS5_VABI _ZN15AbstractStorage13YoutubeFolder6RemoveEb() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage13YoutubeFolder6RemoveEb(void*, bool) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage13YoutubeFolderD0Ev() {
@@ -109,32 +109,32 @@ int APS5_VABI _ZN15AbstractStorage14YoutubeContent4OpenEit() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent4ReadEPvlPl() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent4ReadEPvlPl(void*, void*, std::int64_t, std::int64_t*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5CloseEv() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5FlushEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5FlushEv(void*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5WriteEPKvlPl() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent6RemoveEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent6RemoveEv(void*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekByteEliPl() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekTimeElPl() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekTimeElPl(void*, std::int64_t, std::int64_t*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeContentD0Ev() {
@@ -181,8 +181,8 @@ int APS5_VABI _ZN15AbstractStorage14YoutubeServiceD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeStorage14GetStorageSizeEPlS1_S1_() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZN15AbstractStorage14YoutubeStorage14GetStorageSizeEPlS1_S1_(void*, std::int64_t*, std::int64_t*, std::int64_t*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZN15AbstractStorage14YoutubeStorageD0Ev() {
@@ -197,44 +197,44 @@ int APS5_VABI _ZN15AbstractStorage14YoutubeStorageD2Ev() {
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder10GetServiceEv(const void*) {
return 2;
}
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
std::uint64_t APS5_VABI _ZNK15AbstractStorage13YoutubeFolder13GetCapabilityEv(const void*) {
return 0x1000000000;
}
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder7GetStatEPNS_4StatE(const void*, void*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent10GetServiceEv(const void*) {
return 2;
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
std::uint64_t APS5_VABI _ZNK15AbstractStorage14YoutubeContent13GetCapabilityEv(const void*) {
return 0x6C0A;
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent7GetStatEPNS_4StatE(const void*, void*) {
return static_cast<int>(0x809E0005u);
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeService14GetServiceTypeEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage14YoutubeService14GetServiceTypeEv(const void*) {
return 2;
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage10GetServiceEv() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage10GetServiceEv(const void*) {
return 2;
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage13GetCapabilityEv() {
NotImplemented_nid_no_patch(__func__);
std::uint64_t APS5_VABI _ZNK15AbstractStorage14YoutubeStorage13GetCapabilityEv(const void*) {
return 0x180000000000000;
}
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage7GetStatEPNS_4StatE() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage7GetStatEPNS_4StatE(const void*, void*) {
return static_cast<int>(0x809E0005u);
}
}
@@ -4,20 +4,20 @@
extern "C" {
int APS5_VABI _ZN15AbstractStorage13YoutubeFolder6RemoveEb();
int APS5_VABI _ZN15AbstractStorage13YoutubeFolder6RemoveEb(void*, bool);
int APS5_VABI _ZN15AbstractStorage13YoutubeFolderD0Ev();
int APS5_VABI _ZN15AbstractStorage13YoutubeFolderD1Ev();
int APS5_VABI _ZN15AbstractStorage13YoutubeFolderD2Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent11SetMetadataEPN23sceMetadataReaderWriter8MetadataE();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent13ParseMetadataEPN23sceMetadataReaderWriter8MetadataES3_();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent4OpenEit();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent4ReadEPvlPl();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent4ReadEPvlPl(void*, void*, std::int64_t, std::int64_t*);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5CloseEv();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5FlushEv();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5FlushEv(void*);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent5WriteEPKvlPl();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent6RemoveEv();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent6RemoveEv(void*);
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekByteEliPl();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekTimeElPl();
int APS5_VABI _ZN15AbstractStorage14YoutubeContent8SeekTimeElPl(void*, std::int64_t, std::int64_t*);
int APS5_VABI _ZN15AbstractStorage14YoutubeContentD0Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeContentD1Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeContentD2Ev();
@@ -29,20 +29,20 @@ int APS5_VABI _ZN15AbstractStorage14YoutubeServiceC2Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeServiceD0Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeServiceD1Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeServiceD2Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeStorage14GetStorageSizeEPlS1_S1_();
int APS5_VABI _ZN15AbstractStorage14YoutubeStorage14GetStorageSizeEPlS1_S1_(void*, std::int64_t*, std::int64_t*, std::int64_t*);
int APS5_VABI _ZN15AbstractStorage14YoutubeStorageD0Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeStorageD1Ev();
int APS5_VABI _ZN15AbstractStorage14YoutubeStorageD2Ev();
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder7GetStatEPNS_4StatE();
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent7GetStatEPNS_4StatE();
int APS5_VABI _ZNK15AbstractStorage14YoutubeService14GetServiceTypeEv();
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage10GetServiceEv();
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage13GetCapabilityEv();
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage7GetStatEPNS_4StatE();
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder10GetServiceEv(const void*);
std::uint64_t APS5_VABI _ZNK15AbstractStorage13YoutubeFolder13GetCapabilityEv(const void*);
int APS5_VABI _ZNK15AbstractStorage13YoutubeFolder7GetStatEPNS_4StatE(const void*, void*);
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent10GetServiceEv(const void*);
std::uint64_t APS5_VABI _ZNK15AbstractStorage14YoutubeContent13GetCapabilityEv(const void*);
int APS5_VABI _ZNK15AbstractStorage14YoutubeContent7GetStatEPNS_4StatE(const void*, void*);
int APS5_VABI _ZNK15AbstractStorage14YoutubeService14GetServiceTypeEv(const void*);
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage10GetServiceEv(const void*);
std::uint64_t APS5_VABI _ZNK15AbstractStorage14YoutubeStorage13GetCapabilityEv(const void*);
int APS5_VABI _ZNK15AbstractStorage14YoutubeStorage7GetStatEPNS_4StatE(const void*, void*);
int APS5_VABI _ZN15AbstractStorage10YoutubeAPI11SendContentEPKvl();
int APS5_VABI _ZN15AbstractStorage10YoutubeAPI14SetAccessTokenERKSbIcSt11char_traitsIcENS_8StlAllocIcEEE();
int APS5_VABI _ZN15AbstractStorage10YoutubeAPI17GetUploadLocationERKSbIcSt11char_traitsIcENS_8StlAllocIcEEEmS7_RS5_();
+15
View File
@@ -0,0 +1,15 @@
add_library(libSceAc3Enc SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceAc3Enc PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceAc3Enc)
if(BUILD_TESTING)
add_test_executable(guest_ac3_enc_tests ${LIBS_INCLUDE_DIR}/tests/GuestAc3Enc.cpp)
target_include_directories(guest_ac3_enc_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_ac3_enc_tests PRIVATE libSceAc3Enc libc)
configure_windows_unwind(guest_ac3_enc_tests)
add_test(NAME guest_ac3_enc COMMAND guest_ac3_enc_tests)
if(WIN32)
set_tests_properties(guest_ac3_enc PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceAc3Enc>")
endif()
endif()
+12 -11
View File
@@ -4,6 +4,13 @@
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
namespace {
constexpr int SCE_AC3ENC_ERROR_INVALID_HANDLE = static_cast<int>(0x80E00001);
constexpr int SCE_AC3ENC_ERROR_NOT_ENCODING = static_cast<int>(0x80E00009);
}
extern "C" {
int APS5_VABI sceAc3EncCreateEncoder() {
@@ -12,33 +19,27 @@ int APS5_VABI sceAc3EncCreateEncoder() {
}
int APS5_VABI sceAc3EncDeleteEncoder() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_AC3ENC_ERROR_INVALID_HANDLE;
}
int APS5_VABI sceAc3EncEncode() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_AC3ENC_ERROR_INVALID_HANDLE;
}
int APS5_VABI sceAc3EncEncodeAsync() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_AC3ENC_ERROR_INVALID_HANDLE;
}
int APS5_VABI sceAc3EncFlush() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_AC3ENC_ERROR_INVALID_HANDLE;
}
int APS5_VABI sceAc3EncIsEncoding() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceAc3EncWaitEncode() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_AC3ENC_ERROR_NOT_ENCODING;
}
}
+50 -8
View File
@@ -429,11 +429,27 @@ int APS5_VABI sceAcm_Panner(AcmBatchInfo* batch, std::uint32_t sourceCount, cons
int APS5_VABI sceAcmBatchJobPriority(AcmBatchInfo* batch, std::uint32_t priority) {
if (!batch || priority >= 4) return SCE_ACM_ERROR_BAD_POINTER;
const auto offset = batch->offset;
if (offset > batch->buffer_size || batch->buffer_size - offset < 8) return static_cast<int>(0x81940009);
AcmBatchInfo localBatch{};
const int savedErrno = errno;
const bool copiedIn = GuestCopyIn_nid_no_patch(&localBatch, batch, sizeof(localBatch));
errno = savedErrno;
if (!copiedIn) return SCE_ACM_ERROR_BAD_POINTER;
const auto offset = localBatch.offset;
if (offset > localBatch.buffer_size || localBatch.buffer_size - offset < 8) return static_cast<int>(0x81940009);
const int savedErrnoProbe = errno;
const bool batchWritable = GuestCopyOut_nid_no_patch(&batch->offset, &localBatch.offset, sizeof(localBatch.offset));
errno = savedErrnoProbe;
if (!batchWritable) return SCE_ACM_ERROR_BAD_POINTER;
const std::uint64_t job = 0x10 | (static_cast<std::uint64_t>(priority) << 8);
std::memcpy(static_cast<std::byte*>(batch->buffer) + offset, &job, sizeof(job));
batch->offset = offset + sizeof(job);
const int savedErrno2 = errno;
const bool copiedBuf = GuestCopyOut_nid_no_patch(static_cast<std::byte*>(localBatch.buffer) + offset, &job, sizeof(job));
errno = savedErrno2;
if (!copiedBuf) return SCE_ACM_ERROR_BAD_POINTER;
const auto newOffset = offset + sizeof(job);
const int savedErrno3 = errno;
const bool copiedBack = GuestCopyOut_nid_no_patch(&batch->offset, &newOffset, sizeof(newOffset));
errno = savedErrno3;
if (!copiedBack) return SCE_ACM_ERROR_BAD_POINTER;
return 0;
}
@@ -445,8 +461,16 @@ int APS5_VABI sceAcm_IFFT(AcmBatchInfo* batch, std::int32_t transformSize, std::
return EncodeTransforms(batch, true, transformSize, transformCount, inputFormat, inputs, outputFormat, outputs, flags);
}
int APS5_VABI sceAcmBatchJobNotification() {
NotImplemented_nid_no_patch(__func__);
int APS5_VABI sceAcmBatchJobNotification(AcmBatchInfo* batch, std::uint32_t value, void* notification) {
if (value == 0 || !batch || !notification) return SCE_ACM_ERROR_BAD_POINTER;
if (reinterpret_cast<std::uintptr_t>(notification) & 0x7f) return SCE_ACM_ERROR_ALIGNMENT;
const std::uint64_t offset = batch->offset;
const std::uint64_t end = offset + 0x10;
if (end > batch->buffer_size) return SCE_ACM_ERROR_BATCH_FULL;
std::memset(notification, 0, 0x80);
const std::uint64_t words[2] = {0xeu | (static_cast<std::uint64_t>(static_cast<std::uint8_t>(value)) << 24), reinterpret_cast<std::uintptr_t>(notification)};
std::memcpy(static_cast<std::byte*>(batch->buffer) + offset, words, sizeof(words));
batch->offset = end;
return 0;
}
@@ -454,8 +478,26 @@ int APS5_VABI sceAcmBatchJobNotification() {
extern "C" {
int APS5_VABI libSceAcmUnknown_9_plus_f3tPdeyP0_nid_no_patch() {
NotImplemented_nid_no_patch(__func__);
void* APS5_VABI libSceAcmUnknown_9_plus_f3tPdeyP0_nid_no_patch(void* ring) {
if (!ring) return nullptr;
auto* const fields = static_cast<std::byte*>(ring);
std::uint64_t base = 0;
std::uint32_t capacity = 0;
std::uint32_t count = 0;
std::uint32_t index = 0;
std::memcpy(&base, fields, sizeof(base));
std::memcpy(&capacity, fields + 0x8, sizeof(capacity));
std::memcpy(&count, fields + 0xc, sizeof(count));
const std::uint32_t nextCount = std::min(count + 1u, capacity);
std::memcpy(fields + 0xc, &nextCount, sizeof(nextCount));
std::uint32_t next = capacity;
if (count != 0) {
std::memcpy(&index, fields + 0x10, sizeof(index));
next = index + 1u;
}
if (next == capacity) next = 0;
std::memcpy(fields + 0x10, &next, sizeof(next));
return reinterpret_cast<void*>(base + (static_cast<std::uint64_t>(next << 8) << 2));
}
APS5_EXPORT("9+f3tPdeyP0", libSceAcmUnknown_9_plus_f3tPdeyP0_nid_no_patch);
+1 -1
View File
@@ -27,6 +27,6 @@ int APS5_VABI sceAcm_Panner(AcmBatchInfo* batch, std::uint32_t sourceCount, cons
int APS5_VABI sceAcmBatchJobPriority(AcmBatchInfo* batch, std::uint32_t priority);
int APS5_VABI sceAcm_ConvReverb_SharedIr();
int APS5_VABI sceAcm_IFFT(AcmBatchInfo* batch, std::int32_t transformSize, std::uint32_t transformCount, std::int32_t inputFormat, const void* const* inputs, std::int32_t outputFormat, void* const* outputs, std::int32_t flags);
int APS5_VABI sceAcmBatchJobNotification();
int APS5_VABI sceAcmBatchJobNotification(AcmBatchInfo* batch, std::uint32_t value, void* notification);
}
@@ -4,7 +4,7 @@
extern "C" {
int APS5_VABI libSceAcmUnknown_9_plus_f3tPdeyP0_nid_no_patch();
void* APS5_VABI libSceAcmUnknown_9_plus_f3tPdeyP0_nid_no_patch(void* ring);
int APS5_VABI libSceAcmUnknown_DvsnlQr4yyk_nid_no_patch();
int APS5_VABI libSceAcmUnknown_PLNywpi1zR4_nid_no_patch();
int APS5_VABI libSceAcmUnknown_YpYvibqaqz0_nid_no_patch();
+6 -6
View File
@@ -91,13 +91,13 @@ if(BUILD_TESTING)
endif()
endif()
add_test_executable(agc_draw_setup_tests EXCLUDE_FROM_ALL tests/DrawSetup.cpp)
target_include_directories(agc_draw_setup_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(agc_draw_setup_tests PRIVATE libSceAgc libc)
configure_windows_unwind(agc_draw_setup_tests)
add_test_executable(agc_draw_state_tests EXCLUDE_FROM_ALL tests/DrawSetup.cpp)
target_include_directories(agc_draw_state_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(agc_draw_state_tests PRIVATE libSceAgc libc)
configure_windows_unwind(agc_draw_state_tests)
if(BUILD_TESTING)
set_target_properties(agc_draw_setup_tests PROPERTIES EXCLUDE_FROM_ALL OFF)
add_test(NAME agc_draw_setup COMMAND agc_draw_setup_tests)
set_target_properties(agc_draw_state_tests PROPERTIES EXCLUDE_FROM_ALL OFF)
add_test(NAME agc_draw_setup COMMAND agc_draw_state_tests)
if(WIN32)
set_tests_properties(agc_draw_setup PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
@@ -2,6 +2,7 @@
#include "prx/libSceAgc/Command/include/Memory.hpp"
#include "prx/libSceAgc/Command/include/Packet.hpp"
#include <algorithm>
#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
@@ -21,8 +22,8 @@ std::uint32_t* APS5_VABI sceAgcDcbAcquireMem(CommandBuffer* buf, std::uint8_t en
if (!wholeAddressSpace) sizeBytes = (sizeBytes + (requested - address) + 0xffu) & ~0xffull;
wholeAddressSpace = wholeAddressSpace || sizeBytes >= (1ull << 40u);
if (wholeAddressSpace) address = 0;
Agc::Command::Require(pollCycles / 40u <= 0xffffu, __func__, "acquire poll interval overflow");
return Agc::Command::Emit(buf, 0x58u, {(static_cast<std::uint32_t>(engine) << 31u) | cbDbOp, wholeAddressSpace ? 0u : static_cast<std::uint32_t>(sizeBytes >> 8u), 0, static_cast<std::uint32_t>(address >> 8u), 0, pollCycles / 40u, gcrControl}, __func__);
const auto pollWord = std::min<std::uint32_t>(pollCycles >> 4u, 0xffffu);
return Agc::Command::Emit(buf, 0x58u, {(static_cast<std::uint32_t>(engine) << 31u) | cbDbOp, wholeAddressSpace ? 0u : static_cast<std::uint32_t>(sizeBytes >> 8u), 0, static_cast<std::uint32_t>(address >> 8u), 0, pollWord, gcrControl | ((gcrControl & 0x4000u) << 1u)}, __func__);
}
uint32_t APS5_VABI sceAgcDcbAcquireMemGetSize(void) {
+43 -5
View File
@@ -25,6 +25,7 @@
#include "prx/libSceAgc/DcbDraw/include/IndexBuffer.hpp"
#include "prx/libSceAgc/DcbDraw/include/DrawIndexed.hpp"
#include "prx/libSceAgc/DcbDraw/include/DrawNonIndexed.hpp"
#include "prx/libSceAgc/DcbDraw/include/Stats.hpp"
#include "prx/libSceAgc/Cb/include/Registers.hpp"
#include "prx/libSceAgc/Acb/include/Control.hpp"
#include "prx/libSceAgc/Acb/include/Sync.hpp"
@@ -1176,9 +1177,21 @@ void testEventWrite() {
void testAcquireMem() {
Storage storage;
const auto* base = reinterpret_cast<const volatile void*>(0x1234567890ull);
const auto* packet = sceAgcDcbAcquireMem(&storage.buffer, 0, 3, 0x1234u, base, 0x1000, 400);
const std::array<std::uint32_t, 8> expected{0xc0065800u, 3, 0x11, 0, 0x12345678u, 0, 10, 0x1234u};
const auto* packet = sceAgcDcbAcquireMem(&storage.buffer, 0, 0, 0x1234u, base, 0x1000, 400);
const std::array<std::uint32_t, 8> expected{0xc0065800u, 0, 0x11, 0, 0x12345678u, 0, 25, 0x1234u};
check(packet == storage.words.data() && std::equal(expected.begin(), expected.end(), storage.words.begin()), "acquire packet does not round its range outward to 256 bytes");
const std::array<std::pair<std::uint32_t, std::uint32_t>, 18> polls{{{0, 0}, {1, 0}, {15, 0}, {16, 1}, {39, 2}, {40, 2}, {80, 5}, {160, 10}, {400, 25}, {1000, 62}, {4000, 250}, {100000, 6250}, {1000000, 62500}, {0x100000u, 0xffffu}, {0xfffff0u, 0xffffu}, {0x1000000u, 0xffffu}, {0xffffffffu, 0xffffu}, {0x44444444u, 0xffffu}}};
for (const auto& [pollCycles, pollWord] : polls) {
Storage measured;
sceAgcDcbAcquireMem(&measured.buffer, 0, 0, 0x4380u, base, 0x1000, pollCycles);
check(measured.words[6] == pollWord, "acquire poll word is not the poll cycles shifted right by four");
}
const std::array<std::pair<std::uint32_t, std::uint32_t>, 15> controls{{{0, 0}, {1, 1}, {0x80, 0x80}, {0x4000, 0xc000}, {0x4380, 0xc380}, {0x8000, 0x8000}, {0xc380, 0xc380}, {0x1234, 0x1234}, {0x7ffff, 0x7ffff}, {0x4001, 0xc001}, {0x9000, 0x9000}, {0xd000, 0xd000}, {0x4300, 0xc300}, {0x77fff, 0x7ffff}, {0x10000, 0x10000}}};
for (const auto& [gcrControl, gcrWord] : controls) {
Storage measured;
sceAgcDcbAcquireMem(&measured.buffer, 0, 0, gcrControl, base, 0x1000, 0xa0);
check(measured.words[7] == gcrWord, "acquire cache control word does not set bit 15 with bit 14");
}
Storage whole;
sceAgcDcbAcquireMem(&whole.buffer, 0, 0, 0, base, 0xffffffffffffffffull, 0);
check(whole.words[0] == 0xc0065800u && whole.words[2] == 0 && whole.words[4] == 0 && whole.words[6] == 0, "an unbounded acquire did not cover the whole address space");
@@ -1196,7 +1209,7 @@ void testAcquireMem() {
check(roundedUp.words[2] == 0 && roundedUp.words[4] == 0, "an acquire rounded up to 1 TiB did not cover the whole address space");
Storage asynchronous;
sceAgcAcbAcquireMem(&asynchronous.buffer, 0x55u, base, 0x100, 80);
const std::array<std::uint32_t, 8> compute{0xc0065800u, 0x80000000u, 2, 0, 0x12345678u, 0, 2, 0x55u};
const std::array<std::uint32_t, 8> compute{0xc0065800u, 0x80000000u, 2, 0, 0x12345678u, 0, 5, 0x55u};
check(std::equal(compute.begin(), compute.end(), asynchronous.words.begin()), "the asynchronous compute acquire did not select engine 1 with no CB/DB operation");
Storage rejected;
rejected.words.fill(0xa5a5a5a5u);
@@ -1206,11 +1219,35 @@ void testAcquireMem() {
check(rejected.words == rejectedWords && rejected.buffer.cursor_up == rejectedCursor, "a refused packet changed the command buffer");
expectFailure([&] { sceAgcDcbAcquireMem(&rejected.buffer, 0, 0, 0x80000u, base, 0x100, 0); });
check(rejected.words == rejectedWords && rejected.buffer.cursor_up == rejectedCursor, "a refused packet changed the command buffer");
expectFailure([&] { sceAgcDcbAcquireMem(&rejected.buffer, 0, 0, 0, base, 0x100, 40u * 0x10000u); });
check(rejected.words == rejectedWords && rejected.buffer.cursor_up == rejectedCursor, "a refused packet changed the command buffer");
Storage saturatedAsync;
sceAgcAcbAcquireMem(&saturatedAsync.buffer, 0, base, 0x100, 0xffffffffu);
check(saturatedAsync.words[6] == 0xffffu, "the asynchronous compute acquire did not saturate the poll word at 0xffff");
check(sceAgcDcbAcquireMemGetSize() == 32 && sceAgcAcbAcquireMemGetSize() == 32, "acquire packet size");
}
template <typename TWrite>
std::size_t writtenBytes(TWrite write) {
Storage storage;
const auto* start = storage.buffer.cursor_up;
write(storage.buffer);
return static_cast<std::size_t>(storage.buffer.cursor_up - start) * sizeof(std::uint32_t);
}
void testPacketSizes() {
alignas(64) std::uint32_t memory[16]{};
const std::array<std::uint32_t, 3> values{1, 2, 3};
check(writtenBytes([](CommandBuffer& buffer) { sceAgcDcbDrawIndexAuto(&buffer, 17, 0); }) == sceAgcDcbDrawIndexAutoGetSize(), "auto index draw size differs from its packet");
check(writtenBytes([](CommandBuffer& buffer) { sceAgcDcbDrawIndexIndirect(&buffer, 0x40, 0); }) == sceAgcDcbDrawIndexIndirectGetSize(), "indexed indirect draw size differs from its packet");
check(writtenBytes([](CommandBuffer& buffer) { sceAgcDcbDrawIndirectMulti(&buffer, 0x40, 0, 5, nullptr, 16, 0); }) == sceAgcDcbDrawIndirectMultiGetSize(), "indirect multi draw size differs from its packets");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcDcbSetIndexBuffer(&buffer, reinterpret_cast<std::uintptr_t>(memory)); }) == sceAgcDcbSetIndexBufferGetSize(), "index buffer size differs from its packet");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcDcbGetLodStats(&buffer, 0, memory, sizeof(memory), 0, 0, 0, 0); }) == sceAgcDcbGetLodStatsGetSize(), "LOD statistics size differs from its packet");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcDcbCondExec(&buffer, memory, 4); }) == sceAgcDcbCondExecGetSize(), "graphics conditional execution size differs from its packet");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcAcbCondExec(&buffer, memory, 4); }) == sceAgcAcbCondExecGetSize(), "compute conditional execution size differs from its packet");
check(writtenBytes([](CommandBuffer& buffer) { sceAgcAcbRewind(&buffer, 0); }) == sceAgcAcbRewindGetSize(), "compute rewind size differs from its packet");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcCbSetShRegisterRangeDirect(&buffer, 0x90, values.data(), values.size()); }) == sceAgcCbSetShRegisterRangeDirectGetSize(values.size()), "shader register range size differs from its packet");
check(writtenBytes([&](CommandBuffer& buffer) { sceAgcCbSetUcRegisterRangeDirect(&buffer, 0x90, values.data(), values.size()); }) == sceAgcCbSetUcRegisterRangeDirectGetSize(values.size()), "user config register range size differs from its packet");
}
}
int main(int argc, char** argv) {
@@ -1252,6 +1289,7 @@ int main(int argc, char** argv) {
testAtomicGds();
testDebugRaiseException();
testCopyDataAndComputeEvents();
testPacketSizes();
testDefaults();
testDefaultsTypes();
LibcRunShutdown_nid_postfix();
+2 -1
View File
@@ -711,6 +711,7 @@ foreach(agcExecutionTestSource IN LISTS agcExecutionTestSources)
target_link_libraries(${agcExecutionTest} PRIVATE libSceAgcDriver SDL2-static libc)
set_target_properties(${agcExecutionTest} PROPERTIES CXX_EXTENSIONS OFF)
configure_windows_unwind(${agcExecutionTest})
target_compile_definitions(${agcExecutionTest} PRIVATE VK_ENABLE_BETA_EXTENSIONS)
if(agcExecutionTests)
list(GET agcExecutionTests 0 agcExecutionPchTarget)
target_precompile_headers(${agcExecutionTest} REUSE_FROM ${agcExecutionPchTarget})
@@ -1091,7 +1092,7 @@ endif()
if(BUILD_TESTING)
get_directory_property(agcRegisteredTests TESTS)
list(FILTER agcRegisteredTests EXCLUDE REGEX "^(agc_pipeline_journal(_long_paths|_extended_paths)?|agc_driver_pipeline_journal(_undecodable_module)?|agc_pipeline_store_replay_growth)$")
list(FILTER agcRegisteredTests EXCLUDE REGEX "^(agc_pipeline_journal(_long_paths|_extended_paths)?|agc_driver_pipeline_journal(_undecodable_module)?|agc_pipeline_store_replay_growth|agc_pipeline_journal_replay_priority)$")
set_property(TEST ${agcRegisteredTests} APPEND PROPERTY ENVIRONMENT "APS5_NO_PIPELINE_JOURNAL=1")
endif()
@@ -1,4 +1,5 @@
#pragma once
#include "prx/libc/include/HostThread.hpp"
#include "prx/libc/include/Shutdown.hpp"
#include "prx/libc/include/general/LogMacros.hpp"
@@ -205,7 +206,7 @@ private:
LogSink().store(&AsyncLog::Sink, std::memory_order_release);
std::atexit(&AsyncLog::FlushAtEnd);
InitializeWaits();
std::thread([this] { Run(); }).detach();
Libc::StartHostThread([this] { Run(); }).detach();
LibcSetEndFlush_nid_no_patch(&AsyncLog::FlushAtEnd);
}
@@ -1,4 +1,5 @@
#pragma once
#include "prx/libc/include/HostThread.hpp"
#include <array>
#include <chrono>
@@ -8,7 +9,9 @@
#include <fstream>
#include <mutex>
#include <string>
#include <string_view>
#include <thread>
#include <vector>
namespace AgcDriver {
@@ -18,6 +21,49 @@ inline const char* CaptureTracePath() {
return "capture-trace.log";
}
class CaptureTraceFilter {
public:
explicit CaptureTraceFilter(const char* configured) {
std::string_view remaining = configured == nullptr ? "" : configured;
while (!remaining.empty()) {
const auto separator = remaining.find(',');
const auto prefix = remaining.substr(0, separator);
if (!prefix.empty()) prefixes.emplace_back(prefix);
if (separator == std::string_view::npos) break;
remaining.remove_prefix(separator + 1);
}
}
bool Active() const {
return !prefixes.empty();
}
bool Matches(std::string_view record) const {
if (!Active()) return true;
for (const auto& prefix : prefixes) {
if (record.starts_with(prefix)) return true;
}
return false;
}
bool MayMatchFormat(std::string_view format) const {
if (!Active()) return true;
const auto literal = format.substr(0, format.find('%'));
for (const auto& prefix : prefixes) {
if (literal.starts_with(prefix) || std::string_view(prefix).starts_with(literal)) return true;
}
return false;
}
private:
std::vector<std::string> prefixes;
};
inline const CaptureTraceFilter& CaptureTracePrefixes() {
static const CaptureTraceFilter filter(std::getenv("APS5_CAPTURE_TRACE_PREFIXES"));
return filter;
}
class CaptureTrace {
public:
static bool Enabled() {
@@ -28,8 +74,12 @@ public:
template<typename... TArgs>
static void Log(const char* format, TArgs... args) {
if (!Enabled()) return;
const auto& filter = CaptureTracePrefixes();
if (!filter.MayMatchFormat(format)) return;
std::array<char, 2048> line{};
const auto size = std::snprintf(line.data(), line.size(), format, args...);
if (size >= 0 && static_cast<std::size_t>(size) < line.size() &&
!filter.Matches(std::string_view(line.data(), static_cast<std::size_t>(size)))) return;
static CaptureTrace& trace = instance();
if (size < 0 || static_cast<std::size_t>(size) >= line.size()) {
trace.drop();
@@ -62,7 +112,8 @@ private:
return;
}
active = true;
worker = std::thread([this] { run(); });
if (CaptureTracePrefixes().Active()) appendRecord(pending, "capture-trace-filter active=1");
worker = Libc::StartHostThread([this] { run(); });
}
~CaptureTrace() {
@@ -36,6 +36,7 @@ extern "C" void AgcDriverSuspendPoint_nid_postfix();
extern "C" void AgcDriverSerialProgress_nid_postfix(std::uint64_t* accepted, std::uint64_t* completed);
extern "C" bool AgcDriverHoldSettled_nid_postfix(std::int64_t milliseconds);
extern "C" void AgcDriverReleaseSettled_nid_postfix();
extern "C" bool AgcDriverSettledHeld_nid_postfix();
extern "C" bool AgcDriverSettled_nid_postfix();
extern "C" std::size_t AgcDriverAwaitedWaits_nid_postfix(AgcDriver::AwaitedWait* waits, std::size_t capacity);
extern "C" void AgcDriverWaitForPipelineJournal_nid_postfix();
@@ -7,6 +7,7 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
namespace AgcDriver::DriverDetail {
@@ -25,6 +26,11 @@ bool SkipRefusedDraws();
void ReportRefusedDraw(const RefusedDraw& refused);
std::optional<std::size_t> RefusedShaderCount();
bool SkipRefusedDispatches();
void ReportRefusedDispatch(std::uint64_t address, std::string_view reason);
bool RefusedDispatch(std::uint64_t address);
std::size_t MaxComputeSpirvWords();
void require(bool condition, const char* reason);
std::uint32_t readRegister(const Registers& registers, std::uint32_t offset);
@@ -84,6 +84,7 @@ public:
bool WaitIdleUnlessTitleWaitsFor(std::chrono::milliseconds timeout);
bool WaitSettledFor(std::chrono::milliseconds timeout);
void ReleaseSettled();
bool SettledHeld();
bool Settled();
void RegisterVideoOutput(std::uint32_t handle, const std::shared_ptr<IVideoOutput>& output);
void UnregisterVideoOutput(std::uint32_t handle, const std::shared_ptr<IVideoOutput>& output);
@@ -238,6 +239,7 @@ private:
static std::uint32_t drawUserWord(const DrawProgram& program, std::int32_t sgpr);
DrawVerdict draw(QueueState& queue, std::span<const std::uint32_t> packet, const Submission& submission, std::size_t packetOffset, std::string& rejected);
DrawVerdict finishDraw(DrawTail& tail, PerformanceTimer& timing);
void restartFinishedDraw(DrawTail& tail);
void addDriverPhases(DispatchClass which, const std::array<double, DriverPhaseCount>& ms, bool hit, bool validated);
static PendingDispatchPhases& pendingDispatchPhases();
static std::chrono::steady_clock::time_point& packetStartedAt();
@@ -29,6 +29,14 @@ struct PacketProfile {
std::array<std::pair<std::uint64_t, double>, static_cast<std::size_t>(DispatchOutcome::Count)> dispatchOutcomes{};
};
struct DrainEpochs {
static constexpr std::size_t Flip = 256;
std::uint64_t interrupts = 0, queuedInterrupts = 0;
std::array<std::uint64_t, Flip + 1> packets{};
};
DrainEpochs& DrainEpochCounts();
struct PacketTimer {
bool enabled; std::uint32_t key; std::uint32_t queue; PacketProfile& profile; std::chrono::steady_clock::time_point start;
~PacketTimer();
@@ -9,6 +9,10 @@ std::uint64_t WorkerAffinityMask();
void PinWorkerThread(const char* role);
void ReserveCommitterCore();
void ReserveFinisherCore();
}
#endif
@@ -6,6 +6,7 @@
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <memory>
#include <mutex>
#include <span>
#include <string>
@@ -116,6 +117,7 @@ private:
class FrameCaptureReader {
public:
explicit FrameCaptureReader(const std::filesystem::path& directory);
~FrameCaptureReader();
const std::vector<FrameCall>& Calls() const;
const std::vector<FrameMemoryChunk>& Chunks() const;
@@ -126,7 +128,14 @@ public:
std::vector<std::byte> Read(const FrameMemoryChunk& chunk) const;
private:
std::filesystem::path directory;
struct Stream;
std::unique_ptr<Stream> takeStream() const;
void returnStream(std::unique_ptr<Stream> stream) const;
std::filesystem::path memoryPath;
mutable std::mutex streamMutex;
mutable std::vector<std::unique_ptr<Stream>> streams;
std::vector<FrameCall> calls;
std::vector<FrameMemoryChunk> chunks;
std::string header;
@@ -46,9 +46,6 @@ bool EqualsCommittedUnsynced(std::uint64_t address, std::span<const std::byte> b
// space cannot be queried).
enum class Compare : std::uint8_t { Equal, Differs, Unmapped };
Compare CompareMapped(std::uint64_t address, std::span<const std::byte> bytes);
// CompareMapped's walk with a copy in place of the compare: the bytes at `address` are copied into
// `out` (Equal), or Unmapped as CompareMapped answers it (the dispatch-cache validation's masked
// re-read of a differing run).
Compare CopyMapped(std::uint64_t address, std::span<std::byte> out);
void WriteChangedCommitted(std::uint64_t address, std::span<const std::byte> current, std::span<const std::byte> original);
void Write(std::uint64_t address, std::span<const std::byte> source, std::size_t alignment = 1);
@@ -17,6 +17,13 @@ struct HostRequirement {
bool present = false;
};
enum class HostDriverVersionScheme {
Unknown,
Vulkan,
Nvidia,
IntelWindows,
};
struct HostGpuFacts {
std::string name;
std::string type;
@@ -26,6 +33,7 @@ struct HostGpuFacts {
std::uint32_t deviceId = 0;
std::uint32_t apiVersion = 0;
std::uint32_t driverVersion = 0;
HostDriverVersionScheme driverVersionScheme = HostDriverVersionScheme::Unknown;
std::uint32_t subgroupSize = 0;
std::uint64_t deviceLocalMiB = 0;
std::vector<std::string> candidates;
@@ -0,0 +1,14 @@
#ifndef CORE_LIBS_PRX_LIBSCEAGCDRIVER_EXECUTION_INCLUDE_INDEXEDINDIRECTPATCHES_HPP
#define CORE_LIBS_PRX_LIBSCEAGCDRIVER_EXECUTION_INCLUDE_INDEXEDINDIRECTPATCHES_HPP
#include <vulkan/vulkan.h>
namespace AgcDriver {
inline bool IndexedIndirectPatchesUsable(VkDriverId driver) {
return driver != VK_DRIVER_ID_MOLTENVK;
}
}
#endif
@@ -260,7 +260,8 @@ std::optional<OverlayMemory> ParseCommitCharge(std::string_view meminfo);
std::optional<OverlayMemory> ReadCommitCharge();
std::optional<std::uint64_t> ReadPageFaults();
std::optional<std::uint64_t> ReadPhysicalMemoryBytes();
std::int32_t OverlayScale(VkExtent2D extent, const OverlayContent& content);
std::int32_t OverlayScale(VkExtent2D extent, const OverlayContent& content, std::int32_t requested = 0);
std::int32_t OverlayScaleRequest(const char* value);
OverlayLayout LayOutOverlay(const OverlayContent& content, VkExtent2D extent, OverlayCorner corner);
std::array<std::array<float, 4>, OverlayColorCount> OverlayPalette(VkFormat format, VkColorSpaceKHR colorSpace);
@@ -12,6 +12,7 @@
#include <cstdlib>
#include <condition_variable>
#include <exception>
#include "prx/libc/include/RunReport.hpp"
#include <filesystem>
#include <functional>
#include <limits>
@@ -643,13 +644,19 @@ public:
return result;
}
static bool GraphicsTrackScope(const std::string_view scope) {
return scope == "Graphics.RenderPass" || scope == "Graphics.RenderPass.Continued" ||
scope.starts_with("Graphics.RenderPass.Close.") || scope.starts_with("Graphics.Barrier.") ||
scope.starts_with("Graphics.BarrierMerged.") || scope == "Graphics.Copy" || scope == "Graphics.Copy.bytes";
}
static std::string Summary(const TraceSummary& summary, std::span<const TraceThread::Snapshot> threads, std::span<const Clock::time_point> presents) {
const auto count = presents.empty() ? std::size_t{0} : presents.size() - 1;
const auto span = presents.empty() ? Clock::duration{} : presents.back() - presents.front();
std::vector<double> frames;
for (std::size_t index = 1; index < presents.size(); ++index) frames.push_back(milliseconds(presents[index] - presents[index - 1]));
std::sort(frames.begin(), frames.end());
const auto percentile = [&](double fraction) { return frames.empty() ? 0.0 : frames[std::min(frames.size() - 1, static_cast<std::size_t>(fraction * static_cast<double>(frames.size())))]; };
const auto percentile = [&](double fraction) { return RunReport::FramePercentile(frames, fraction); };
const double perPresent = count != 0 ? 1.0 / static_cast<double>(count) : 0.0;
std::string output = "{\"commit\":";
@@ -685,6 +692,7 @@ public:
bool firstWorker = true;
std::map<std::string, Clock::duration> phases;
std::map<std::string, std::uint64_t> ownedCounts;
std::map<std::string, std::uint64_t> graphicsCounts;
bool dropped = summary.ownedDrawUnbound != 0;
if (summary.ownedDrawUnbound != 0) ownedCounts["OwnedDraw.unbound"] = summary.ownedDrawUnbound;
struct DroppedThread {
@@ -707,7 +715,8 @@ public:
for (const auto& total : thread.totals) {
const std::string_view scope = total.scope;
if (total.stage == nullptr && std::find(WorkerBusyScopes.begin(), WorkerBusyScopes.end(), scope) != WorkerBusyScopes.end()) busy += total.length;
if (scope.starts_with("OwnedDraw.") && total.stage == nullptr) ownedCounts[std::string(scope)] += total.count;
if (total.stage == nullptr && GraphicsTrackScope(scope)) graphicsCounts[std::string(scope)] += total.count;
else if (scope.starts_with("OwnedDraw.") && total.stage == nullptr) ownedCounts[std::string(scope)] += total.count;
else if (scope != WorkerWaitScope) phases[Name(total.scope, total.stage)] += total.length;
}
if (!thread.name.starts_with(WorkerPrefix)) continue;
@@ -716,6 +725,14 @@ public:
AppendString(output, thread.name);
output += ':' + number(span != Clock::duration{} ? 100.0 * static_cast<double>(busy.count()) / static_cast<double>(span.count()) : 0.0);
}
output += "},\"phase_totals_ms\":{";
bool firstPhase = true;
for (const auto& [name, length] : phases) {
if (!firstPhase) output += ',';
firstPhase = false;
AppendString(output, name);
output += ':' + number(milliseconds(length));
}
output += "},\"top_phases_ms_per_frame\":{";
std::vector<std::pair<std::string, Clock::duration>> top(phases.begin(), phases.end());
std::stable_sort(top.begin(), top.end(), [](const auto& a, const auto& b) { return a.second > b.second; });
@@ -734,6 +751,15 @@ public:
output += ':' + std::to_string(value);
}
output += '}';
output += ",\"graphics_track\":{";
bool firstGraphics = true;
for (const auto& [name, value] : graphicsCounts) {
if (!firstGraphics) output += ',';
firstGraphics = false;
AppendString(output, name);
output += ':' + std::to_string(value);
}
output += '}';
output += ",\"trace_dropped\":";
output += dropped ? "true" : "false";
if (!droppedList.empty()) {
@@ -903,6 +929,11 @@ public:
if (Recording()) AgcDriverTraceCount_nid_postfix(scope);
}
static void Amount(const char* scope, std::uint64_t amount) {
if (amount == 0 || !Recording()) return;
if (auto* thread = Thread()) thread->Count(scope, amount);
}
static void CountOwnedDraw(const char* scope, std::uint64_t amount = 1);
static std::uint64_t OwnedDrawUnbound();
@@ -1,4 +1,5 @@
#pragma once
#include "prx/libc/include/HostThread.hpp"
#include <array>
#include <atomic>
@@ -21,7 +22,7 @@ class ProfileOutput {
public:
explicit ProfileOutput(std::function<void(std::string_view)> writer, std::size_t capacity = 4 * 1024 * 1024) : writer(std::move(writer)), capacity(capacity) {
if (!this->writer || capacity == 0) throw std::invalid_argument("invalid profile output writer or capacity");
worker = std::thread([this] { run(); });
worker = Libc::StartHostThread([this] { run(); });
}
~ProfileOutput() {
@@ -377,6 +377,7 @@ public:
bool firstInstance;
bool multi;
bool count;
bool indexedPatches;
};
IndirectDrawSupport DrawIndirectSupport() const;
void EnqueueDraw(const Graphics::State& graphics, const Pm4::DrawParameters& draw, std::span<const Graphics::CompiledShader> shaders, std::span<const Graphics::GuestMemorySnapshot> snapshots = {});
@@ -120,8 +120,38 @@ void ReportRefusedDraw(const RefusedDraw& refused) {
std::fprintf(stderr, "[gpu] APS5_SKIP_REFUSED_DRAWS: skipping the draws that use shader 0x%llx: %.*s\n", static_cast<unsigned long long>(refused.address), static_cast<int>(line.size()), line.data());
}
bool SkipRefusedDispatches() {
static const bool skip = std::getenv("APS5_SKIP_REFUSED_DISPATCHES") != nullptr;
return skip;
}
void ReportRefusedDispatch(std::uint64_t address, std::string_view reason) {
auto& shaders = refusedShaders();
{
std::lock_guard lock(shaders.mutex);
if (!shaders.reported.insert(address).second) return;
}
const auto line = reason.substr(0, reason.find('\n'));
std::fprintf(stderr, "[gpu] APS5_SKIP_REFUSED_DISPATCHES: skipping the dispatches that use shader 0x%llx: %.*s\n", static_cast<unsigned long long>(address), static_cast<int>(line.size()), line.data());
}
bool RefusedDispatch(std::uint64_t address) {
if (!SkipRefusedDispatches()) return false;
auto& shaders = refusedShaders();
std::lock_guard lock(shaders.mutex);
return shaders.reported.contains(address);
}
std::size_t MaxComputeSpirvWords() {
static const std::size_t words = [] {
const char* text = std::getenv("APS5_MAX_COMPUTE_SPIRV_WORDS");
return text != nullptr ? static_cast<std::size_t>(std::strtoull(text, nullptr, 10)) : std::size_t{0};
}();
return words;
}
std::optional<std::size_t> RefusedShaderCount() {
if (!SkipRefusedDraws()) return std::nullopt;
if (!SkipRefusedDraws() && !SkipRefusedDispatches()) return std::nullopt;
auto& shaders = refusedShaders();
std::lock_guard lock(shaders.mutex);
return shaders.reported.size();
@@ -13,6 +13,7 @@
#include "prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp"
#include "prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hpp"
#include "prx/libSceAgcDriver/Graphics/include/Recorder.hpp"
#include "prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp"
#include "Optimization/ResourceProgram.hpp"
#include <algorithm>
#include <atomic>
@@ -39,6 +40,13 @@ constexpr std::array<const char*, static_cast<std::size_t>(ItemFallback::Count)>
std::array<std::atomic<std::uint64_t>, static_cast<std::size_t>(ItemFallback::Count)> itemFallbacks{};
std::atomic<std::uint64_t> itemCommits{0};
std::atomic<std::uint64_t> itemRebuilds{0};
std::atomic<std::uint64_t> itemMisses{0};
std::atomic<std::uint64_t> itemRecipeLess{0};
std::atomic<std::uint64_t> itemNotPlain{0};
bool DispatchMissItemsEnabled() {
return Graphics::RuntimeSwitches::Set(Graphics::RuntimeSwitch::PipelineDispatchMisses);
}
void NoteItemFallback(ItemFallback reason) {
itemFallbacks[static_cast<std::size_t>(reason)].fetch_add(1, std::memory_order_relaxed);
@@ -56,7 +64,7 @@ void ReportDispatchItems(bool profile) {
std::snprintf(item, sizeof(item), " %s %llu", ItemFallbackNames[i], static_cast<unsigned long long>(itemFallbacks[i].load(std::memory_order_relaxed)));
drained += item;
}
std::fprintf(stderr, "[dispatch-item] %llu commit items (%llu recipes rebuilt on the committer); drained instead, cumulative:%s\n", static_cast<unsigned long long>(itemCommits.load(std::memory_order_relaxed)), static_cast<unsigned long long>(itemRebuilds.load(std::memory_order_relaxed)), drained.c_str());
std::fprintf(stderr, "[dispatch-item] %llu commit items (%llu recipes rebuilt on the committer, %llu queued after a cache miss, %llu queued without a recipe, %llu cached ones kept off the queue as not plain); drained instead, cumulative:%s\n", static_cast<unsigned long long>(itemCommits.load(std::memory_order_relaxed)), static_cast<unsigned long long>(itemRebuilds.load(std::memory_order_relaxed)), static_cast<unsigned long long>(itemMisses.load(std::memory_order_relaxed)), static_cast<unsigned long long>(itemRecipeLess.load(std::memory_order_relaxed)), static_cast<unsigned long long>(itemNotPlain.load(std::memory_order_relaxed)), drained.c_str());
}
bool CapturedCurrent(std::span<const ShaderRecompiler::MemoryRegion> captured, const ShaderSnapshot& code) {
@@ -81,7 +89,7 @@ bool Driver::pipelineDispatch() {
void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet, const Submission& submission, std::uint64_t indirectArguments) {
PerformanceTimer timing("Driver.Dispatch");
const auto address = (static_cast<std::uint64_t>(readRegister(queue.shader, 0x20c)) << 8u) | (static_cast<std::uint64_t>(readRegister(queue.shader, 0x20d) & 0xffu) << 40u);
if (SkippedShader(address)) return;
if (SkippedShader(address) || RefusedDispatch(address)) return;
auto registeredShader = RegisteredProgram(*submission.shaders, address, {0});
if (!registeredShader) registeredShader = ReadRawShader(address);
const auto& snapshot = *registeredShader;
@@ -317,6 +325,9 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
phaseTiming.Phase(PhaseKey);
timing.Mark("decode_key_device_setup");
bool readsClear = false;
const bool queueMisses = pipelineCandidate && DispatchMissItemsEnabled() && !noDispatchCache && !stampValidate() && !verifyDataHits();
bool lateItem = false;
bool recipeLess = false;
if (pipelineCandidate) {
std::vector<ShaderRecompiler::MemoryRegion> reads;
bool entryFound = false;
@@ -327,7 +338,9 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
for (const auto& variant : found->second->variants) appendEntryRegions(*variant, reads);
}
}
if (!entryFound || noDispatchCache || stampValidate()) {
if (!entryFound && queueMisses) {
lateItem = true;
} else if (!entryFound || noDispatchCache || stampValidate()) {
NoteItemFallback(ItemFallback::Miss);
} else if (verifyDataHits()) {
NoteItemFallback(ItemFallback::Verify);
@@ -335,7 +348,7 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
readsClear = std::none_of(reads.begin(), reads.end(), [](const auto& region) { return DrawPipeline::Queue0().Overlaps(region.guestAddress, region.bytes.size()); });
if (!readsClear) NoteItemFallback(ItemFallback::Reads);
}
if (!readsClear && DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
if (!readsClear && !lateItem && DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
}
if (fromAhead) {
compiledResult = std::move(ahead.compiledResult);
@@ -366,10 +379,14 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
itemWrites = DispatchWriteRanges(*compiledResult, bounded);
pipelined = bounded;
if (!bounded) NoteItemFallback(ItemFallback::Writes);
} else if (queueMisses && cached && keepVariant != nullptr) {
recipeLess = true;
} else if (queueMisses && !cached) {
lateItem = true;
} else {
NoteItemFallback(ItemFallback::NoRecipe);
}
if (!pipelined && DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
if (!pipelined && !recipeLess && !lateItem && DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
}
std::uint64_t forgetAtCapture = 0;
if (cached) {
@@ -408,6 +425,8 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
const auto total = totalMs.fetch_add(elapsed, std::memory_order_relaxed) + elapsed;
if (elapsed > 200) std::fprintf(stderr, "[gpu] compute shader 0x%llx recompile took %.0f ms (%zu SPIR-V words, %zu captured regions, total %.1f s)\n", static_cast<unsigned long long>(address), elapsed, compiledResult->spirv.size(), captured.size(), total / 1000);
}
if (const auto limit = MaxComputeSpirvWords(); limit != 0 && compiledResult->spirv.size() > limit)
throw std::runtime_error(std::to_string(compiledResult->spirv.size()) + " SPIR-V words, above APS5_MAX_COMPUTE_SPIRV_WORDS (" + std::to_string(limit) + ")");
} catch (const std::exception& error) {
std::string dump;
if (dumpShaders) {
@@ -419,6 +438,10 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
std::string reason = error.what();
if (const auto newline = reason.find('\n'); newline != std::string::npos) reason.resize(newline);
if (SkipRefusedDispatches()) {
ReportRefusedDispatch(address, reason);
return;
}
char where[96];
if (dump.empty()) std::snprintf(where, sizeof(where), "compute shader 0x%llx: ", static_cast<unsigned long long>(address));
else std::snprintf(where, sizeof(where), "compute shader 0x%llx (%s): ", static_cast<unsigned long long>(address), dump.c_str());
@@ -506,6 +529,40 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
};
phaseTiming.Phase(PhaseSnapshots);
bool plain = false;
if ((pipelined && DispatchMissItemsEnabled()) || lateItem || recipeLess) {
plain = compiledResult != nullptr && !htileClearCompletion.has_value() && htileMask.bytes == 0u;
if (plain && !partialLastGroup && MatchSgprPatternFill(packet, std::span(snapshot.code).subspan(codeOffset), userData, compute)) plain = false;
if (plain && !partialLastGroup) {
if (const auto clear = Graphics::MatchStorageImageClear(std::span(snapshot.code).subspan(codeOffset), userData, compute, groups)) {
const auto clearAddress = Graphics::StorageImageClearAddress(*clear);
if (clearAddress != 0 && Graphics::DepthSurfaceAt(clearAddress)) plain = false;
}
}
}
if (pipelined && DispatchMissItemsEnabled() && !plain) {
pipelined = false;
itemWrites.clear();
itemNotPlain.fetch_add(1, std::memory_order_relaxed);
if (DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
}
if (lateItem || recipeLess) {
bool queued = plain;
if (queued && lateItem) {
queued = std::none_of(captured.begin(), captured.end(), [](const auto& region) { return DrawPipeline::Queue0().Overlaps(region.guestAddress, region.bytes.size()); });
if (!queued) NoteItemFallback(ItemFallback::Reads);
} else if (!plain) {
NoteItemFallback(lateItem ? ItemFallback::Miss : ItemFallback::NoRecipe);
}
if (queued) {
bool bounded = false;
itemWrites = DispatchWriteRanges(*compiledResult, bounded);
pipelined = bounded;
if (!bounded) NoteItemFallback(ItemFallback::Writes);
}
if (pipelined) (lateItem ? itemMisses : itemRecipeLess).fetch_add(1, std::memory_order_relaxed);
else if (DrawPipeline::Queue0().Busy()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);
}
if (pipelined) {
runCaptureCheckHook();
if (capturedMemoryChanged(captured)) {
@@ -513,11 +570,13 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
dispatch(queue, packet, submission, indirectArguments);
return;
}
const auto recipe = keepVariant->recipe.load(std::memory_order_acquire);
const auto recipe = keepVariant != nullptr ? keepVariant->recipe.load(std::memory_order_acquire) : nullptr;
const auto attach = stampValidate() ? nullptr : keepVariant != nullptr ? keepVariant : attachVariant;
const std::uint64_t prepareThreads = lateItem || recipeLess ? dispatchThreads : 0;
const auto epoch = DrawPipeline::EpochToken().load(std::memory_order_relaxed);
const auto queueId = submission.queue;
itemCommits.fetch_add(1, std::memory_order_relaxed);
DrawPipeline::Queue0().Enqueue(DrawPipeline::CommitKind::Dispatch, [this, localDevice = std::move(localDevice), result = compiledResult, capture, registeredViews, snapshots = std::move(snapshots), liveWords = std::move(liveWords), groups, address, queueId, recipe, keepVariant, dataHit, epoch, htileClearCompletion, htileMask] {
DrawPipeline::Queue0().Enqueue(DrawPipeline::CommitKind::Dispatch, [this, localDevice = std::move(localDevice), result = compiledResult, capture, registeredViews, snapshots = std::move(snapshots), liveWords = std::move(liveWords), groups, address, queueId, recipe, keepVariant, attach, prepareThreads, dataHit, epoch, htileClearCompletion, htileMask] {
DrawPipeline::FollowEpoch(epoch);
GuestMemory::SetCurrentPacket(0x15, queueId);
const auto& compiledCommit = *result;
@@ -528,7 +587,7 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
bool writersNoted = false;
for (;;) {
std::shared_ptr<PreparedDispatch> prepared;
if (recipeHit == nullptr || VulkanDevice::VerifyRecipes() || htileClearCompletion.has_value()) prepared = localDevice->PrepareDispatch(compiledCommit, snapshots, 0, address, htileClearCompletion, registeredViews);
if (recipeHit == nullptr || VulkanDevice::VerifyRecipes() || htileClearCompletion.has_value()) prepared = localDevice->PrepareDispatch(compiledCommit, snapshots, prepareThreads, address, htileClearCompletion, registeredViews);
GuestMemory::TagGpuLockSite(GuestMemory::GpuLockSite::Dispatch);
std::lock_guard gpuLock(GuestMemory::GpuMutex());
recordLabelsForPacket(localDevice.get(), queueId);
@@ -546,7 +605,7 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
continue;
}
} else {
localDevice->Dispatch(compiledCommit, groups[0], groups[1], groups[2], snapshots, address, std::move(prepared), htileClearCompletion.has_value() ? nullptr : &builtRecipe, htileClearCompletion, registeredViews);
localDevice->Dispatch(compiledCommit, groups[0], groups[1], groups[2], snapshots, address, std::move(prepared), htileClearCompletion.has_value() || attach == nullptr ? nullptr : &builtRecipe, htileClearCompletion, registeredViews);
}
if (htileMask.bytes != 0u) localDevice->NoteHtileMask(htileMask);
break;
@@ -558,7 +617,7 @@ void Driver::dispatch(QueueState& queue, std::span<const std::uint32_t> packet,
own->dataWordsHash = Graphics::ShaderResources::DataWordsHash({ShaderRecompiler::ShaderStage::Compute, keepVariant->compiled.get(), 0});
builtRecipe = std::move(own);
}
keepVariant->recipe.store(std::move(builtRecipe), std::memory_order_release);
attach->recipe.store(std::move(builtRecipe), std::memory_order_release);
VulkanDevice::NoteRecipe(VulkanDevice::RecipeEvent::Attach, false);
}
} catch (const std::exception& error) {
@@ -130,6 +130,7 @@ struct DrawTail {
std::chrono::steady_clock::time_point phaseLap{};
DrawPhaseTiming phaseTiming{false, phaseMs, phaseLap};
Pm4::DrawParameters drawParameters{};
Pm4::DrawParameters resolvedParameters{};
bool pipelined = false;
bool traceIndirect = false;
std::uint64_t dumpTarget = 0;
@@ -338,6 +339,7 @@ DrawVerdict Driver::draw(QueueState& queue, std::span<const std::uint32_t> packe
auto& drawParameters = tail.drawParameters;
try {
drawParameters = Pm4::ResolveDraw(packet, queue);
tail.resolvedParameters = drawParameters;
} catch (...) {
TraceDrawAttemptException(traceToken, "resolve-draw", submission.serial, submission.queue, packetOffset, std::current_exception());
throw;
@@ -751,6 +753,9 @@ DrawVerdict Driver::draw(QueueState& queue, std::span<const std::uint32_t> packe
PerformanceTimer finishTiming("Driver.DrawFinish");
try {
if (finishDraw(job, finishTiming) == DrawVerdict::Rejected) throw std::runtime_error(job.ownRejected);
} catch (const RefusedDraw& refused) {
CaptureTrace::Log("draw-refused submission=%llu offset=%zu finisher=1 reason=%.256s", static_cast<unsigned long long>(job.submissionSerial), job.packetOffset, refused.what());
ReportRefusedDraw(refused);
} catch (const std::exception& error) {
CaptureTrace::Log("draw-error submission=%llu offset=%zu finisher=1 reason=%.256s", static_cast<unsigned long long>(job.submissionSerial), job.packetOffset, error.what());
throw std::runtime_error("draw at submission " + std::to_string(job.submissionSerial) + " offset " + std::to_string(job.packetOffset) + " (finished on the draw finisher): " + error.what());
@@ -865,7 +870,11 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
if (program.binary.stage == Stage::Fragment || roles[i] == Role::GeometryBack) return;
decodeReads[i].clear();
vertexInfos[i] = Graphics::DecodeVertexStageInfo(program.binary.header, program.binary.headerAddress, program.userData, &decodeReads[i], false, 8u - program.firstUserSgpr);
if (vertexInfos[i]) vertexInfos[i]->paClVsOutCntl = PositionExportLayout(program.snapshot.get(), program.codeOffset, program.binary.code, tail.reg207, program.tailContinuation.get()) | graphics.layerExports;
if (vertexInfos[i]) {
vertexInfos[i]->paClVsOutCntl = PositionExportLayout(program.snapshot.get(), program.codeOffset, program.binary.code, tail.reg207, program.tailContinuation.get()) | graphics.layerExports;
vertexInfos[i]->depthRemapMode = graphics.depthRemap.mode;
Graphics::ApplyPointSize(graphics, *vertexInfos[i]);
}
};
const auto fold = [&](const ShaderRecompiler::RecompileResult& main, Pm4::DrawParameters& parameters) { FoldDrawOffsets(main, programs.front(), parameters); };
@@ -881,16 +890,33 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
std::memcpy(words.data() + offset, region.bytes.data(), count * sizeof(std::uint32_t));
}
};
const auto joinedRuns = [](const std::vector<std::pair<std::uint64_t, std::uint64_t>>& runs) {
std::vector<std::pair<std::uint64_t, std::uint64_t>> joined;
for (const auto& run : runs) {
if (!joined.empty() && joined.back().second == run.first) joined.back().second = run.second;
else joined.push_back(run);
}
return joined;
};
const auto listRuns = [](const std::vector<std::pair<std::uint64_t, std::uint64_t>>& runs) {
std::string text;
for (std::size_t run = 0; run < runs.size() && run < 4; ++run) {
char item[48];
std::snprintf(item, sizeof(item), " [0x%llx,0x%llx)", static_cast<unsigned long long>(runs[run].first), static_cast<unsigned long long>(runs[run].second));
text += item;
}
return text;
};
const auto verifyDataStage = [&](std::size_t i, const DispatchVariant& kept) {
std::vector<std::pair<std::uint64_t, std::uint64_t>> runs;
std::vector<std::uint32_t> words;
freshRuns(i, runs, words);
const auto& compiled = *stageCaptures[i].compiled;
const char* what = runs != kept.runs ? "runs" : words != kept.words ? "words" : vertexInfos[i].has_value() != (kept.vertexInfo != nullptr) || (vertexInfos[i] && !sameVertexInfo(*vertexInfos[i], *kept.vertexInfo)) ? "vertex stage info" : compiled.variantId != kept.compiled->variantId ? "variant" : compiled.pushConstants != kept.compiled->pushConstants ? "push constants" : nullptr;
const char* what = joinedRuns(runs) != joinedRuns(kept.runs) ? "runs" : words != kept.words ? "words" : vertexInfos[i].has_value() != (kept.vertexInfo != nullptr) || (vertexInfos[i] && !sameVertexInfo(*vertexInfos[i], *kept.vertexInfo)) ? "vertex stage info" : compiled.variantId != kept.compiled->variantId ? "variant" : compiled.pushConstants != kept.compiled->pushConstants ? "push constants" : nullptr;
++dataVerified;
if (what == nullptr) return;
char message[320];
std::snprintf(message, sizeof(message), "APS5_VERIFY_DRAW_DATA_HITS: stage %zu (program 0x%llx) of a data-only hit differs from its full build in its %s (%zu runs / %zu words kept, %zu / %zu fresh; variant 0x%llx / 0x%llx; key 0x%llx, shape 0x%llx)", i, static_cast<unsigned long long>(programs[i].binary.codeAddress), what, kept.runs.size(), kept.words.size(), runs.size(), words.size(), static_cast<unsigned long long>(kept.compiled->variantId), static_cast<unsigned long long>(compiled.variantId), static_cast<unsigned long long>(drawKey), static_cast<unsigned long long>(shapeKey));
char message[640];
std::snprintf(message, sizeof(message), "APS5_VERIFY_DRAW_DATA_HITS: stage %zu (program 0x%llx) of a data-only hit differs from its full build in its %s (%zu runs / %zu words kept, %zu / %zu fresh; variant 0x%llx / 0x%llx; key 0x%llx, shape 0x%llx; kept%s; fresh%s)", i, static_cast<unsigned long long>(programs[i].binary.codeAddress), what, kept.runs.size(), kept.words.size(), runs.size(), words.size(), static_cast<unsigned long long>(kept.compiled->variantId), static_cast<unsigned long long>(compiled.variantId), static_cast<unsigned long long>(drawKey), static_cast<unsigned long long>(shapeKey), listRuns(joinedRuns(kept.runs)).c_str(), listRuns(joinedRuns(runs)).c_str());
throw std::runtime_error(message);
};
const auto verifyStageData = [&](std::size_t i) {
@@ -902,7 +928,7 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
const auto& fresh = *stageCaptures[i].compiled;
const auto& patched = *hit.compiled;
const bool sameBindings = fresh.bindings.size() == patched.bindings.size() && std::equal(fresh.bindings.begin(), fresh.bindings.end(), patched.bindings.begin(), [](const auto& a, const auto& b) { return a.kind == b.kind && a.role == b.role && a.binding == b.binding && a.count == b.count && a.guestDescriptor == b.guestDescriptor; });
const char* what = runs != kept.runs ? "runs" : words != hit.words ? "words" : fresh.variantId != patched.variantId ? "variant" : fresh.pushConstants != patched.pushConstants ? "push constants" : !sameBindings ? "bindings" : nullptr;
const char* what = joinedRuns(runs) != joinedRuns(kept.runs) ? "runs" : words != hit.words ? "words" : fresh.variantId != patched.variantId ? "variant" : fresh.pushConstants != patched.pushConstants ? "push constants" : !sameBindings ? "bindings" : nullptr;
++stageDataVerified;
if (what == nullptr) return;
char message[256];
@@ -1042,6 +1068,7 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
static std::mutex captureMutex;
static std::map<std::pair<std::uint32_t, std::uint32_t>, ShaderRecompiler::RecompileResult> captureShaders;
const auto& geometry = *graphics.stages.tessellationGeometry;
results.reserve(programs.size() + 2u);
{
std::lock_guard captureLock(captureMutex);
auto found = captureShaders.find({geometry.esgsItemSize, geometry.primitivesPerGroup});
@@ -1330,9 +1357,11 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
}
if (pipelined && (!drawParameters.indirect || pipelinedIndirect) && (tail.queue == nullptr || deferredLabels().labels.empty())) {
runCaptureCheckHook();
if (tail.queue != nullptr && capturedMemoryChanged(memory)) {
if (capturedMemoryChanged(memory)) {
const RecaptureScope recapture;
return draw(*tail.queue, tail.packet, submission, tail.packetOffset, rejected);
if (tail.queue != nullptr) return draw(*tail.queue, tail.packet, submission, tail.packetOffset, rejected);
restartFinishedDraw(tail);
return finishDraw(tail, timing);
}
phaseTiming.Phase(DrawRowVectors);
auto writes = drawWriteRanges(graphics, stages);
@@ -1378,6 +1407,69 @@ DrawVerdict Driver::finishDraw(DrawTail& tail, PerformanceTimer& timing) {
return drawn();
}
void Driver::restartFinishedDraw(DrawTail& tail) {
using Stage = ShaderRecompiler::ShaderStage;
using Role = ShaderRecompiler::ProgramRole;
const auto changed = [](const DrawProgram& program) {
return std::any_of(program.memory.begin(), program.memory.end(), [](const ShaderRecompiler::MemoryRegion& region) { return !region.bytes.empty() && GuestMemory::CompareMapped(region.guestAddress, region.bytes) != GuestMemory::Compare::Equal; });
};
if (std::any_of(tail.programs->begin(), tail.programs->end(), changed)) {
if (tail.programs != &tail.writablePrograms) {
tail.writablePrograms = *tail.programs;
tail.programs = &tail.writablePrograms;
}
for (auto& program : tail.writablePrograms) {
if (program.nullPixel || !changed(program)) continue;
auto snapshot = ProgramSnapshot(*tail.submission->shaders, program.binary.codeAddress, {program.snapshot->type});
if (snapshot == program.snapshot) continue;
const auto& fresh = *snapshot;
program.codeOffset = static_cast<std::size_t>((program.binary.codeAddress - fresh.codeAddress) / sizeof(std::uint32_t));
program.binary.code = std::span(fresh.code).subspan(program.codeOffset);
program.binary.headerAddress = fresh.headerAddress;
program.binary.header = fresh.header;
program.memory = {{{fresh.codeAddress, std::as_bytes(std::span(fresh.code))}, {fresh.headerAddress, fresh.header}}};
if (fresh.header.empty()) NoteRawGraphicsDraw(fresh);
program.snapshot = std::move(snapshot);
}
}
const auto& programs = *tail.programs;
const auto& graphics = tail.decode->state;
const auto& roles = tail.decode->roles;
const auto count = programs.size();
tail.drawParameters = tail.resolvedParameters;
tail.memory.clear();
AppendProgramMemory(tail.memory, programs);
tail.results.clear();
tail.compiledStages.clear();
tail.stages.clear();
tail.pushCursorBytes = 0;
tail.programResults.assign(count, nullptr);
tail.stageCaptures.assign(count, {});
tail.matched.assign(count, nullptr);
tail.matchedRegions.assign(count, {});
tail.fresh.assign(count, nullptr);
tail.recompiled.assign(count, false);
tail.dataCandidates.assign(count, {});
tail.reused.assign(count, false);
tail.stageData.assign(count, {});
tail.dataEntry = nullptr;
tail.drawHit = false;
tail.verifyHit = false;
tail.patchedStages = false;
for (std::size_t i = 0; i < count; ++i) {
tail.decodeReads[i].clear();
tail.vertexInfos[i].reset();
const auto& program = programs[i];
if (program.binary.stage == Stage::Fragment || roles[i] == Role::GeometryBack) continue;
tail.vertexInfos[i] = DecodeOrderedVertexStageInfo(program.binary.header, program.binary.headerAddress, program.userData, tail.decodeReads[i], 8u - program.firstUserSgpr);
if (!tail.vertexInfos[i]) continue;
tail.vertexInfos[i]->paClVsOutCntl = PositionExportLayout(program.snapshot.get(), program.codeOffset, program.binary.code, tail.reg207, program.tailContinuation.get()) | graphics.layerExports;
tail.vertexInfos[i]->depthRemapMode = graphics.depthRemap.mode;
Graphics::ApplyPointSize(graphics, *tail.vertexInfos[i]);
}
tail.shaderMemory = std::make_unique<ShaderMemory>(tail.memory, &queryPendingWrite, &observePendingWrite, hookWaitCounter(), &QueryPendingSpan);
}
void Driver::commitDraw(std::shared_ptr<VulkanDevice> localDevice, std::uint32_t queue, const Graphics::State& graphics, const Pm4::DrawParameters& drawParameters, std::span<const Graphics::CompiledShader> stages, std::span<const Graphics::GuestMemorySnapshot> snapshots, const std::shared_ptr<const DrawRecipe>& recipe, const std::vector<std::shared_ptr<DispatchVariant>>& recipeStages, std::uint64_t drawKey, const std::shared_ptr<DrawEntry>& recipeDonor, VulkanDevice::DrawTraceContext trace, std::uint64_t shape) {
const auto* tracePtr = trace.token != 0 ? &trace : nullptr;
GuestMemory::TagGpuLockSite(GuestMemory::GpuLockSite::Draw);
@@ -5,6 +5,8 @@
#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
#include <algorithm>
#include <array>
#include <cstdlib>
#include <string_view>
#include <spirv/unified1/spirv.hpp>
namespace AgcDriver::DriverDetail {
@@ -198,6 +200,11 @@ std::shared_ptr<DrawDecode> Driver::decodeDraw(const QueueState& queue, const Su
Graphics::NormalizeUnusedViewportDepth(product->state, product->pixel);
Graphics::ApplyDepthRemap(context, product->state);
Graphics::ApplyDepthBoundsEmulation(context, product->state, product->pixel);
static const bool readOnlyDepthBoundsCompare = [] {
const auto* value = std::getenv("APS5_READONLY_DEPTH_BOUNDS_COMPARE");
return value != nullptr && std::string_view(value) == "1";
}();
Graphics::ApplyReadOnlyDepthBoundsComparison(product->state, product->pixel, readOnlyDepthBoundsCompare);
product->pixel.targetExportPacking = Graphics::ExportPackings(product->state);
product->pixel.dualSourceBlend = product->state.dualSourceBlend;
product->pixel.reversedBlend = product->state.reversedBlend;
@@ -1,5 +1,7 @@
#include "prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp"
#include "prx/libc/include/HostThread.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Queues/WorkerAffinity.hpp"
#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
#include "prx/libSceAgcDriver/Execution/include/HandoffSpin.hpp"
#include "prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp"
@@ -204,6 +206,7 @@ void DrawFinisher::Enqueue(Job job, Pending held) {
void DrawFinisher::run() {
PerformanceTrace::BindThread("draw finisher");
ReserveFinisherCore();
for (;;) {
Job* job = nullptr;
bool failed = false;
@@ -369,7 +372,7 @@ void DrawPipeline::enqueue(Item item) {
items.push_back(std::move(item));
outstanding.fetch_add(1, std::memory_order_release);
if (!thread.joinable()) {
thread = std::thread([this] {
thread = Libc::StartHostThread([this] {
GuestMemory::MarkProofThread();
run();
});
@@ -431,6 +434,7 @@ void DrawPipeline::report(std::chrono::steady_clock::time_point now) {
void DrawPipeline::run() {
PerformanceTrace::BindThread("draw committer");
ReserveCommitterCore();
StartCommitterSampler();
for (;;) {
Commit* commit = nullptr;
@@ -39,6 +39,7 @@ std::optional<Graphics::IndirectDrawPath> Driver::ClassifyIndirectDraw(const Sha
if ((graphics.stages.path != Graphics::ShaderPath::Vertex || (graphics.rectList && !rectListGpuSide)) && !meshGpuSide) fail(Path::NonVertexPath);
if (indirect.drawIndexEnabled && indirect.drawIndexSgpr >= 0) fail(Path::DrawIndex);
if (indirect.countIndirect && !support.count) fail(Path::FeatureGap);
if (graphics.rectList && drawParameters.indexed && !support.indexedPatches) fail(Path::FeatureGap);
if (indirect.countIndirect && indirect.count > 1 && !support.multi) fail(Path::FeatureGap);
const auto dimension = [&](std::int32_t k, std::int32_t p, bool shared, bool conflict, std::uint32_t x, Rule& rule, std::uint32_t& constant) {
if (p < 0) {
@@ -187,6 +187,10 @@ extern "C" void AgcDriverReleaseSettled_nid_postfix() {
AgcDriver::DriverDetail::Driver::Get().ReleaseSettled();
}
extern "C" bool AgcDriverSettledHeld_nid_postfix() {
return AgcDriver::DriverDetail::Driver::Get().SettledHeld();
}
extern "C" bool AgcDriverSettled_nid_postfix() {
return AgcDriver::DriverDetail::Driver::Get().Settled();
}
@@ -1,4 +1,5 @@
#include "prx/libSceAgcDriver/Execution/include/AsyncLog.hpp"
#include "prx/libc/include/HostThread.hpp"
#include "prx/libSceAgcDriver/Graphics/include/PipelineJournal.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Diagnostics.hpp"
@@ -248,7 +249,7 @@ Driver::Driver() {
}
std::thread host;
try {
host = std::thread(import);
host = Libc::StartHostThread(import);
} catch (const std::system_error& error) {
std::fprintf(stderr, "[gpu] import of GPU memory at its mapping failed: no host thread to run it on: %s\n", error.what());
return;
@@ -327,6 +328,11 @@ bool Driver::WaitSettledFor(std::chrono::milliseconds timeout) {
return done;
}
bool Driver::SettledHeld() {
std::lock_guard lock(mutex);
return captureHold.load(std::memory_order_relaxed);
}
bool Driver::Settled() {
std::lock_guard lock(mutex);
return failure != nullptr || stopping || completed >= accepted || parkedOnTitle();
@@ -68,6 +68,7 @@ bool Driver::preparePacketMemory(const Submission& submission, QueueState& queue
const bool storesNothing = (packet[2] >> 29u) == 0 || (packet[3] | (static_cast<std::uint64_t>(packet[4]) << 32u)) == 0;
if (label.has_value() || storesNothing) {
bumpEpoch(&EpochBumps::drains);
++DrainEpochCounts().interrupts;
GuestMemory::TagGpuLockSite(GuestMemory::GpuLockSite::Label);
std::lock_guard gpuLock(GuestMemory::GpuMutex());
const auto localDevice = device.Load();
@@ -278,6 +279,7 @@ bool Driver::preparePacketMemory(const Submission& submission, QueueState& queue
static const bool unlockedDrain = std::getenv("APS5_NO_UNLOCKED_DRAIN") == nullptr && !drainAll;
bumpEpoch(&EpochBumps::drains);
++DrainEpochCounts().packets[header == FlipPacketHeader ? DrainEpochs::Flip : opcode & 0xffu];
std::shared_ptr<VulkanDevice> draining;
std::uint64_t epoch = 0;
{
@@ -509,7 +511,10 @@ bool Driver::enqueueLabelPacket(std::span<const std::uint32_t> packet, std::uint
bytes.assign(stored.begin(), stored.end());
writes.emplace_back(address, address + bytes.size());
}
if (endOfPipeInterrupt) bumpEpoch(&EpochBumps::drains);
if (endOfPipeInterrupt) {
bumpEpoch(&EpochBumps::drains);
++DrainEpochCounts().queuedInterrupts;
}
auto stored = bytes;
auto labelBytes = bytes;
auto enqueue =[this, queue, opcode, address, bytes = std::move(bytes), interrupt, writes, stored = std::move(stored)]() mutable {
@@ -6,6 +6,11 @@
namespace AgcDriver::DriverDetail {
DrainEpochs& DrainEpochCounts() {
static thread_local DrainEpochs counts;
return counts;
}
PacketTimer::~PacketTimer() {
if (!enabled) return;
const auto now = std::chrono::steady_clock::now();
@@ -51,6 +56,20 @@ PacketTimer::~PacketTimer() {
profile.submissions = 0;
profile.flushMs = 0;
profile.dispatchOutcomes = {};
auto& drains = DrainEpochCounts();
std::vector<std::pair<std::size_t, std::uint64_t>> drained;
for (std::size_t i = 0; i < drains.packets.size(); ++i) {
if (drains.packets[i] != 0) drained.emplace_back(i, drains.packets[i]);
}
std::sort(drained.begin(), drained.end(), [](const auto& a, const auto& b) { return a.second > b.second; });
std::string byPacket;
for (const auto& [packet, count] : drained) {
char text[96];
std::snprintf(text, sizeof(text), " %s x%llu", packet == DrainEpochs::Flip ? "flip" : Pm4::Name(static_cast<std::uint32_t>(packet) << 8u).c_str(), static_cast<unsigned long long>(count));
byPacket += text;
}
AgcDriver::ProfilePrint_nid_no_patch("[drains] queue 0x%x epochs by site (10 s): interrupts %llu, queued label interrupts %llu, by packet:%s\n", queue, static_cast<unsigned long long>(drains.interrupts), static_cast<unsigned long long>(drains.queuedInterrupts), byPacket.c_str());
drains = DrainEpochs{};
}
}
@@ -1,5 +1,6 @@
#include "prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp"
#include "prx/libSceAgcDriver/Execution/include/PerformanceTimer.hpp"
#include "prx/libc/include/HostThread.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Queues/Submission.hpp"
#include "prx/libSceAgcDriver/Execution/include/Driver/Queues/SubmissionRing.hpp"
@@ -232,15 +233,19 @@ bool Driver::copyLink(Submission& submission, const std::uint32_t* guest, std::s
cursor += count;
continue;
}
if (opcode == 0x22u && count == 5) guarded.emplace_back(cursor + count + Pm4::ConditionalWords(std::span(guest + cursor, count)), submission.commands.size());
submission.commands.insert(submission.commands.end(), guest + cursor, guest + cursor + count);
cursor += count;
if (opcode == 0x59u) {
require(count == 2, "a REWIND packet must be two dwords");
require(guarded.empty(), "a REWIND inside a conditional execution range is not implemented");
submission.commands.push_back(header);
submission.commands.push_back(std::atomic_ref<std::uint32_t>(*const_cast<std::uint32_t*>(guest + cursor + 1)).load(std::memory_order_acquire));
cursor += count;
submission.rewindTail = guest + cursor;
submission.rewindWords = words - cursor;
return true;
}
if (opcode == 0x22u && count == 5) guarded.emplace_back(cursor + count + Pm4::ConditionalWords(std::span(guest + cursor, count)), submission.commands.size());
submission.commands.insert(submission.commands.end(), guest + cursor, guest + cursor + count);
cursor += count;
}
reach(words, words);
require(guarded.empty(), "conditional execution range exceeds its command buffer");
@@ -804,7 +809,7 @@ void Driver::enqueue(Submission submission) {
for (const auto dword : submission.labelWrites) ++worker.unfinishedWrites[dword];
worker.pending.push_back(std::move(submission));
worker.queued.fetch_add(1, std::memory_order_acq_rel);
if (!worker.thread.joinable()) worker.thread = std::thread([this, queue] {
if (!worker.thread.joinable()) worker.thread = Libc::StartHostThread([this, queue] {
char role[32];
std::snprintf(role, sizeof(role), "queue 0x%x worker", queue);
try {
@@ -3,7 +3,20 @@
#include "prx/libSceAgcDriver/Execution/include/TracyZone.hpp"
#include "prx/libc/include/CpuTopology.hpp"
#include "prx/libc/include/general/ThreadName.hpp"
#include <array>
#include <cstdlib>
#include <mutex>
#include <optional>
#include <vector>
#ifdef _WIN32
#include <tlhelp32.h>
#elif defined(__linux__)
#include <dirent.h>
#include <string>
#include <sched.h>
#include <unistd.h>
#endif
namespace AgcDriver::DriverDetail {
@@ -21,11 +34,20 @@ std::uint64_t WorkerAffinityMask() {
return mask;
}
#ifdef __linux__
namespace {
void NoteWorkerThread();
}
#endif
void PinWorkerThread(const char* role) {
TracyZone::NameThread(role);
#ifdef _WIN32
const HRESULT nameResult = ThreadName::SetCurrent(role);
if (FAILED(nameResult)) std::fprintf(stderr, "[thread-name] could not name %s (0x%08lx)\n", role, static_cast<unsigned long>(nameResult));
#endif
#ifdef __linux__
NoteWorkerThread();
#endif
const auto mask = WorkerAffinityMask();
if (mask == 0) return;
@@ -37,4 +59,206 @@ void PinWorkerThread(const char* role) {
CpuTopology::PinTraced(role, nullptr, mask);
}
#if defined(_WIN32) || defined(__linux__)
namespace {
struct CoreSwitches {
bool committer = false;
bool finisher = false;
std::optional<unsigned> logical;
};
struct Reservation {
CpuTopology::CpuSet set;
unsigned long thread = 0;
};
constexpr std::size_t CommitterSlot = 0;
constexpr std::size_t FinisherSlot = 1;
std::mutex reservationMutex;
std::array<std::optional<Reservation>, 2> reservations;
#ifdef __linux__
std::vector<unsigned long> workerThreads;
std::vector<std::uint32_t> pipelineCpus;
#endif
const CoreSwitches& Switches() {
static const CoreSwitches switches = [] {
CoreSwitches result;
if (std::getenv("APS5_NO_COMMITTER_CORE") != nullptr) return result;
const char* text = std::getenv("APS5_COMMITTER_CPU");
if (text != nullptr && *text != '\0') result.logical = static_cast<unsigned>(std::strtoul(text, nullptr, 10));
const bool workersPinned = WorkerAffinityMask() != 0;
result.committer = result.logical.has_value() || !workersPinned;
result.finisher = !workersPinned && std::getenv("APS5_NO_FINISHER_CORE") == nullptr;
return result;
}();
return switches;
}
#ifdef _WIN32
std::vector<CpuTopology::CpuSet> SystemCpuSets() {
using GetInformation = BOOL(WINAPI*)(PSYSTEM_CPU_SET_INFORMATION, ULONG, PULONG, HANDLE, ULONG);
static const auto getInformation = ThreadName::Resolve<GetInformation>("GetSystemCpuSetInformation");
std::vector<CpuTopology::CpuSet> sets;
if (getInformation == nullptr) return sets;
ULONG bytes = 0;
getInformation(nullptr, 0, &bytes, GetCurrentProcess(), 0);
std::vector<unsigned char> buffer(bytes);
if (bytes == 0 || !getInformation(reinterpret_cast<PSYSTEM_CPU_SET_INFORMATION>(buffer.data()), bytes, &bytes, GetCurrentProcess(), 0)) return sets;
const auto process = CpuTopology::Get().process;
for (ULONG offset = 0; offset + sizeof(SYSTEM_CPU_SET_INFORMATION) <= bytes;) {
const auto* entry = reinterpret_cast<const SYSTEM_CPU_SET_INFORMATION*>(buffer.data() + offset);
if (entry->Size == 0 || offset + entry->Size > bytes) break;
offset += entry->Size;
if (entry->Type != CpuSetInformation) continue;
const auto& set = entry->CpuSet;
if (set.Group == 0 && process != 0 && (set.LogicalProcessorIndex >= 64 || ((process >> set.LogicalProcessorIndex) & 1u) == 0)) continue;
sets.push_back({set.Id, set.Group, set.LogicalProcessorIndex, set.CoreIndex, set.EfficiencyClass, set.LastLevelCacheIndex, set.Parked != 0});
}
return sets;
}
#else
std::vector<CpuTopology::CpuSet> SystemCpuSets() {
const auto& layout = CpuTopology::Get();
cpu_set_t allowed;
CPU_ZERO(&allowed);
if (sched_getaffinity(0, sizeof(allowed), &allowed) != 0 || CPU_COUNT(&allowed) > __builtin_popcountll(layout.process)) return {};
return CpuTopology::SysfsCpuSets("/sys/devices/system/cpu", layout.process, layout.hybrid ? layout.efficient : 0);
}
unsigned long CurrentThread() {
return static_cast<unsigned long>(gettid());
}
bool PinTo(pid_t thread, const std::vector<std::uint32_t>& cpus) {
cpu_set_t set;
CPU_ZERO(&set);
for (const auto cpu : cpus) CPU_SET(cpu, &set);
return sched_setaffinity(thread, sizeof(set), &set) == 0;
}
bool OwnThread(unsigned long tid) {
return access(("/proc/self/task/" + std::to_string(tid)).c_str(), F_OK) == 0;
}
void NoteWorkerThread() {
std::lock_guard lock(reservationMutex);
workerThreads.push_back(CurrentThread());
if (!pipelineCpus.empty()) static_cast<void>(PinTo(0, pipelineCpus));
}
#endif
bool HoldsReservation(unsigned long thread) {
for (const auto& held : reservations) {
if (held.has_value() && held->thread == thread) return true;
}
return false;
}
void Reserve(std::size_t slot, const char* role, std::optional<unsigned> logical) {
#ifdef _WIN32
using SetCpuSets = BOOL(WINAPI*)(HANDLE, const ULONG*, ULONG);
static const auto setDefault = ThreadName::Resolve<SetCpuSets>("SetProcessDefaultCpuSets");
static const auto setSelected = ThreadName::Resolve<SetCpuSets>("SetThreadSelectedCpuSets");
if (setDefault == nullptr || setSelected == nullptr) return;
#endif
std::lock_guard lock(reservationMutex);
auto& own = reservations[slot];
if (own.has_value()) {
#ifdef _WIN32
own->thread = GetCurrentThreadId();
const ULONG id = own->set.id;
const bool selected = setSelected(GetCurrentThread(), &id, 1) != 0;
#else
own->thread = CurrentThread();
const bool selected = PinTo(0, {own->set.id});
#endif
std::fprintf(stderr, "[affinity] %s tid=%lu -> core %u logical %u, kept from its previous thread (thread %s)\n", role, CpuTopology::ThreadId(nullptr), static_cast<unsigned>(own->set.core), static_cast<unsigned>(own->set.logical), selected ? "set" : "failed");
return;
}
const auto sets = SystemCpuSets();
std::vector<CpuTopology::CpuSet> taken;
for (const auto& held : reservations) {
if (held.has_value()) taken.push_back(held->set);
}
if (slot == FinisherSlot && !reservations[CommitterSlot].has_value() && Switches().committer) {
if (const auto ahead = CpuTopology::ChooseReservedCore(sets, taken, Switches().logical)) taken.push_back(ahead->chosen);
}
const auto reservation = CpuTopology::ChooseReservedCore(sets, taken, logical);
if (!reservation.has_value()) {
if (logical.has_value()) std::fprintf(stderr, "[affinity] %s: APS5_COMMITTER_CPU=%u names no free logical processor of the process, no core reserved\n", role, *logical);
return;
}
std::size_t moved = 0;
#ifdef _WIN32
own = Reservation{reservation->chosen, GetCurrentThreadId()};
const std::vector<ULONG> others(reservation->others.begin(), reservation->others.end());
const ULONG id = reservation->chosen.id;
const bool process = setDefault(GetCurrentProcess(), others.data(), static_cast<ULONG>(others.size())) != 0;
const bool thread = setSelected(GetCurrentThread(), &id, 1) != 0;
if (const HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); snapshot != INVALID_HANDLE_VALUE) {
THREADENTRY32 entry{};
entry.dwSize = sizeof(entry);
const DWORD processId = GetCurrentProcessId();
for (BOOL more = Thread32First(snapshot, &entry); more; more = Thread32Next(snapshot, &entry)) {
if (entry.th32OwnerProcessID != processId || HoldsReservation(entry.th32ThreadID)) continue;
const HANDLE other = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, entry.th32ThreadID);
if (other == nullptr) continue;
if (setSelected(other, others.data(), static_cast<ULONG>(others.size())) != 0) ++moved;
CloseHandle(other);
}
CloseHandle(snapshot);
}
const char* processState = process ? "set" : "failed";
#else
own = Reservation{reservation->chosen, CurrentThread()};
const bool thread = PinTo(0, {reservation->chosen.id});
if (DIR* tasks = opendir("/proc/self/task"); tasks != nullptr) {
while (const dirent* entry = readdir(tasks)) {
char* end = nullptr;
const unsigned long tid = std::strtoul(entry->d_name, &end, 10);
if (end == entry->d_name || *end != '\0' || HoldsReservation(tid)) continue;
if (PinTo(static_cast<pid_t>(tid), reservation->others)) ++moved;
}
closedir(tasks);
}
const char* processState = "set for helper threads";
std::vector<CpuTopology::CpuSet> held;
for (const auto& reserved : reservations) {
if (reserved.has_value()) held.push_back(reserved->set);
}
std::uint64_t unreserved = 0;
for (const auto cpu : reservation->others) unreserved |= std::uint64_t{1} << cpu;
CpuTopology::UnreservedMask().store(unreserved, std::memory_order_release);
pipelineCpus = WorkerAffinityMask() != 0 ? std::vector<std::uint32_t>{} : CpuTopology::PipelineCacheSet(sets, held);
if (!pipelineCpus.empty()) {
std::size_t kept = 0;
for (const auto worker : workerThreads) {
if (!OwnThread(worker)) continue;
kept += PinTo(static_cast<pid_t>(worker), pipelineCpus) ? 1u : 0u;
}
std::fprintf(stderr, "[affinity] %zu queue workers kept on the %zu other CPUs of the reserved cores' last-level cache\n", kept, pipelineCpus.size());
}
#endif
std::fprintf(stderr, "[affinity] %s tid=%lu -> core %u logical %u reserved (process default %s, thread %s, %zu running threads moved to the %zu other CPU sets)\n", role, CpuTopology::ThreadId(nullptr), static_cast<unsigned>(reservation->chosen.core), static_cast<unsigned>(reservation->chosen.logical), processState, thread ? "set" : "failed", moved, reservation->others.size());
}
}
#endif
void ReserveCommitterCore() {
#if defined(_WIN32) || defined(__linux__)
if (Switches().committer) Reserve(CommitterSlot, "draw committer", Switches().logical);
#endif
}
void ReserveFinisherCore() {
#if defined(_WIN32) || defined(__linux__)
if (Switches().finisher) Reserve(FinisherSlot, "draw finisher", std::nullopt);
#endif
}
}
@@ -1,4 +1,5 @@
#include "prx/libc/include/general/LogMacros.hpp"
#include "prx/libc/include/HostThread.hpp"
#include "ControlFlow/GraphBuilder.hpp"
#include "prx/libSceAgcDriver/Execution/include/PerformanceTimer.hpp"
#include "prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp"
@@ -1781,6 +1782,7 @@ private:
#endif
static void* Main(void* argument) {
Libc::SetHostMxcsr();
auto& pool = *static_cast<RegistrationPreparePool*>(argument);
PerformanceTrace::BindThread("shader prepare", TraceThread::DefaultCapacity / 8);
for (;;) {
@@ -2092,24 +2094,24 @@ void Driver::ResolveGraphicsStagesAbi(std::span<const Shader* const> stages, std
{
std::lock_guard lock(mutex);
registry = shaders;
for (const auto* shader : stages) {
const auto fields = GuestShaderFields(shader);
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(fields.code));
require(registry != nullptr && registry->contains(address), "graphics ABI refers to an unregistered shader");
const auto selected = RegisteredHeader(*registry, shader);
require(selected != nullptr, "graphics ABI refers to a replaced shader header");
selectedStages.push_back(selected);
const auto& snapshot = *selected;
require(snapshot.registeredState != nullptr, "registered shader state is missing");
const auto registered = DecodeRegisteredState(snapshot, {});
registered.shader.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.shader.insert_or_assign(offset, value); });
registered.context.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.context.insert_or_assign(offset, value); });
registered.userConfig.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.userConfig.insert_or_assign(offset, value); });
if (fields.type != snapshot.type) {
const std::size_t count = fields.num_sh_registers;
GuestMemory::CheckRange(fields.sh_registers, count * sizeof(ShaderRegister), alignof(ShaderRegister));
for (std::size_t index = 0; index < count; ++index) state.shader.insert_or_assign(fields.sh_registers[index].offset, fields.sh_registers[index].value);
}
}
for (const auto* shader : stages) {
const auto fields = GuestShaderFields(shader);
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(fields.code));
require(registry != nullptr && registry->contains(address), "graphics ABI refers to an unregistered shader");
const auto selected = RegisteredHeader(*registry, shader);
require(selected != nullptr, "graphics ABI refers to a replaced shader header");
selectedStages.push_back(selected);
const auto& snapshot = *selected;
require(snapshot.registeredState != nullptr, "registered shader state is missing");
const auto registered = DecodeRegisteredState(snapshot, {});
registered.shader.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.shader.insert_or_assign(offset, value); });
registered.context.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.context.insert_or_assign(offset, value); });
registered.userConfig.ForEach([&](std::uint32_t offset, std::uint32_t value) { state.userConfig.insert_or_assign(offset, value); });
if (fields.type != snapshot.type) {
const std::size_t count = fields.num_sh_registers;
GuestMemory::CheckRange(fields.sh_registers, count * sizeof(ShaderRegister), alignof(ShaderRegister));
for (std::size_t index = 0; index < count; ++index) state.shader.insert_or_assign(fields.sh_registers[index].offset, fields.sh_registers[index].value);
}
}
for (const auto reg : context) state.context.insert_or_assign(reg.offset, reg.value);
@@ -2241,14 +2243,15 @@ void Driver::ResolveShaderAbi(const Shader* shader, std::span<const ShaderRegist
transaction.Commit();
return;
}
std::shared_ptr<const ShaderSnapshot> snapshot;
std::shared_ptr<const ShaderRegistry> registry;
{
std::lock_guard lock(mutex);
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(fields.code));
require(shaders != nullptr && shaders->contains(address), "static ABI refers to an unregistered shader");
snapshot = RegisteredHeader(*shaders, shader);
require(snapshot != nullptr, "static ABI refers to a replaced shader header");
registry = shaders;
}
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(fields.code));
require(registry != nullptr && registry->contains(address), "static ABI refers to an unregistered shader");
const auto snapshot = RegisteredHeader(*registry, shader);
require(snapshot != nullptr, "static ABI refers to a replaced shader header");
require(snapshot->registeredState != nullptr, "registered shader state is missing");
QueueState state{};
state.shader = snapshot->registeredState->shader.Expand();
@@ -2383,20 +2386,20 @@ void Driver::ResolveGraphicsAbi(const Shader* vertex, const Shader* pixel, std::
if ((primitiveType != 0 && primitiveType != 7 && primitiveType != 17) || pixel == nullptr) return;
ShaderPreparationTransaction transaction;
require(vertex != nullptr && pixel != nullptr, "rectangle ABI requires vertex and fragment shaders");
std::shared_ptr<const ShaderSnapshot> front;
std::shared_ptr<const ShaderSnapshot> fragment;
std::shared_ptr<const ShaderRegistry> registry;
{
std::lock_guard lock(mutex);
const auto lookup = [&](const Shader* shader) {
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(GuestShaderFields(shader).code));
require(shaders != nullptr && shaders->contains(address), "rectangle ABI refers to an unregistered shader");
const auto snapshot = RegisteredHeader(*shaders, shader);
require(snapshot != nullptr, "rectangle ABI refers to a replaced shader header");
return snapshot;
};
front = lookup(vertex);
fragment = lookup(pixel);
registry = shaders;
}
const auto lookup = [&](const Shader* shader) {
const auto address = reinterpret_cast<std::uintptr_t>(const_cast<const void*>(GuestShaderFields(shader).code));
require(registry != nullptr && registry->contains(address), "rectangle ABI refers to an unregistered shader");
const auto snapshot = RegisteredHeader(*registry, shader);
require(snapshot != nullptr, "rectangle ABI refers to a replaced shader header");
return snapshot;
};
const auto front = lookup(vertex);
const auto fragment = lookup(pixel);
require(front != fragment, "rectangle stages refer to the same shader");
const auto localDevice = device.Load();
require(localDevice != nullptr, "shader registration device is missing");
@@ -113,6 +113,7 @@ void Driver::landPendingWaits(std::uint32_t queue) {
}
void Driver::waitMemory(std::span<const std::uint32_t> packet, std::uint32_t queue, const PacketHistory& context, std::uint64_t received, bool heldAtSubmit, bool requireMemory) {
const GuestMemory::ReadSiteScope site(GuestMemory::ReadSite::Wait);
auto start = std::chrono::steady_clock::now();
auto lastDone = packetsDone.load();
@@ -17,8 +17,8 @@ static_assert(std::endian::native == std::endian::little, "frame captures are st
constexpr std::size_t ChunkHeaderBytes = 64;
void requireCapture(bool condition, const std::string& reason) {
if (!condition) throw std::runtime_error("frame capture: " + reason);
void requireCapture(bool condition, std::string_view reason) {
if (!condition) throw std::runtime_error("frame capture: " + std::string(reason));
}
class Encoder {
@@ -361,7 +361,17 @@ std::vector<std::byte> FrameCaptureWriter::compress(std::span<const std::byte> b
return output;
}
FrameCaptureReader::FrameCaptureReader(const std::filesystem::path& directory) : directory(directory) {
struct FrameCaptureReader::Stream {
std::ifstream file;
ZSTD_DCtx* context = nullptr;
std::vector<std::byte> compressed;
~Stream() {
ZSTD_freeDCtx(context);
}
};
FrameCaptureReader::FrameCaptureReader(const std::filesystem::path& directory) : memoryPath(directory / FrameCaptureWriter::MemoryName) {
const auto callsPath = directory / FrameCaptureWriter::CallsName;
const auto callBytes = readFile(callsPath);
if (hasMagic(callBytes, FrameCaptureWriter::CallsMagicV1)) version = 1;
@@ -385,7 +395,6 @@ FrameCaptureReader::FrameCaptureReader(const std::filesystem::path& directory) :
at += 8 + static_cast<std::size_t>(bytes);
}
const auto memoryPath = directory / FrameCaptureWriter::MemoryName;
std::ifstream memory(memoryPath, std::ios::binary);
requireCapture(memory.is_open(), "cannot open " + memoryPath.string());
memory.seekg(0, std::ios::end);
@@ -460,16 +469,17 @@ bool FrameCaptureReader::Truncated() const {
void FrameCaptureReader::Read(const FrameMemoryChunk& chunk, std::span<std::byte> destination) const {
requireCapture(chunk.kind != FrameMemoryKind::Range, "a range chunk has no bytes");
requireCapture(destination.size() == chunk.bytes, "destination size does not match the chunk");
const auto path = directory / FrameCaptureWriter::MemoryName;
std::ifstream memory(path, std::ios::binary);
requireCapture(memory.is_open(), "cannot open " + path.string());
std::vector<std::byte> compressed(chunk.compressedBytes);
memory.seekg(static_cast<std::streamoff>(chunk.offset));
memory.read(reinterpret_cast<char*>(compressed.data()), static_cast<std::streamsize>(compressed.size()));
requireCapture(memory.good(), "cannot read " + path.string());
const auto written = ZSTD_decompress(destination.data(), destination.size(), compressed.data(), compressed.size());
requireCapture(ZSTD_isError(written) == 0, std::string("zstd: ") + ZSTD_getErrorName(written));
requireCapture(written == chunk.bytes, "chunk at " + std::to_string(chunk.address) + " decompressed to the wrong size");
auto stream = takeStream();
const auto compressedBytes = static_cast<std::size_t>(chunk.compressedBytes);
if (stream->compressed.size() < compressedBytes) stream->compressed.resize(compressedBytes);
stream->file.clear();
stream->file.seekg(static_cast<std::streamoff>(chunk.offset));
stream->file.read(reinterpret_cast<char*>(stream->compressed.data()), static_cast<std::streamsize>(compressedBytes));
if (!stream->file.good()) throw std::runtime_error("frame capture: cannot read " + memoryPath.string());
const auto written = ZSTD_decompressDCtx(stream->context, destination.data(), destination.size(), stream->compressed.data(), compressedBytes);
if (ZSTD_isError(written) != 0) throw std::runtime_error(std::string("frame capture: zstd: ") + ZSTD_getErrorName(written));
if (written != chunk.bytes) throw std::runtime_error("frame capture: chunk at " + std::to_string(chunk.address) + " decompressed to the wrong size");
returnStream(std::move(stream));
}
std::vector<std::byte> FrameCaptureReader::Read(const FrameMemoryChunk& chunk) const {
@@ -478,4 +488,28 @@ std::vector<std::byte> FrameCaptureReader::Read(const FrameMemoryChunk& chunk) c
return bytes;
}
FrameCaptureReader::~FrameCaptureReader() = default;
std::unique_ptr<FrameCaptureReader::Stream> FrameCaptureReader::takeStream() const {
{
const std::lock_guard lock(streamMutex);
if (!streams.empty()) {
auto stream = std::move(streams.back());
streams.pop_back();
return stream;
}
}
auto stream = std::make_unique<Stream>();
stream->file.open(memoryPath, std::ios::binary);
if (!stream->file.is_open()) throw std::runtime_error("frame capture: cannot open " + memoryPath.string());
stream->context = ZSTD_createDCtx();
if (stream->context == nullptr) throw std::runtime_error("frame capture: zstd: cannot create a decompression context");
return stream;
}
void FrameCaptureReader::returnStream(std::unique_ptr<Stream> stream) const {
const std::lock_guard lock(streamMutex);
streams.push_back(std::move(stream));
}
}
@@ -677,6 +677,7 @@ std::vector<FrameRecorder::Range> FrameRecorder::committedRanges() {
if (!allocation->readable) continue;
const auto first = allocation->address;
const auto end = first + allocation->bytes;
const auto firstRange = result.size();
const bool host = first < base || end > base + size;
const auto access = FrameRangeAccess::Readable | (allocation->writable ? FrameRangeAccess::Writable : 0u) | (allocation->gpu ? FrameRangeAccess::Gpu : 0u);
for (auto address = first; address < end;) {
@@ -695,7 +696,7 @@ std::vector<FrameRecorder::Range> FrameRecorder::committedRanges() {
else if (info.Type == MEM_PRIVATE) range.kind = GuestMemory::Watched(range.address, static_cast<std::size_t>(range.bytes)) ? FrameRangeKind::Watched : FrameRangeKind::Unwatched;
else range.kind = FrameRangeKind::Section;
auto& last = result.empty() ? range : result.back();
if (!result.empty() && last.address + last.bytes == range.address && last.kind == range.kind && last.protection == range.protection && last.readable == range.readable && last.access == range.access) last.bytes += range.bytes;
if (result.size() > firstRange && last.address + last.bytes == range.address && last.kind == range.kind && last.protection == range.protection && last.readable == range.readable && last.access == range.access) last.bytes += range.bytes;
else result.push_back(range);
}
address = regionEnd;
@@ -712,6 +713,7 @@ std::vector<FrameRecorder::Range> FrameRecorder::committedRanges() {
if (!allocation->readable) continue;
const auto first = allocation->address;
const auto end = first + allocation->bytes;
const auto firstRange = result.size();
const bool host = first < base || end > base + size;
const auto access = FrameRangeAccess::Readable | (allocation->writable ? FrameRangeAccess::Writable : 0u) | (allocation->gpu ? FrameRangeAccess::Gpu : 0u);
HostMapping::Walk(first, end, "frame capture", [&](const HostMapping::Mapping& mapping) {
@@ -729,7 +731,7 @@ std::vector<FrameRecorder::Range> FrameRecorder::committedRanges() {
else if (!mapping.shared && mapping.inode == 0) range.kind = FrameRangeKind::Unwatched;
else range.kind = FrameRangeKind::Section;
auto& last = result.empty() ? range : result.back();
if (!result.empty() && last.address + last.bytes == range.address && last.kind == range.kind && last.protection == range.protection && last.readable == range.readable && last.access == range.access) last.bytes += range.bytes;
if (result.size() > firstRange && last.address + last.bytes == range.address && last.kind == range.kind && last.protection == range.protection && last.readable == range.readable && last.access == range.access) last.bytes += range.bytes;
else result.push_back(range);
};
const auto address = std::max<std::uint64_t>(first, mapping.start);
@@ -7,10 +7,12 @@
#include "prx/libSceAgcDriver/Execution/include/ThreadScratch.hpp"
#include "ThreadOwned.hpp"
#include "prx/libc/include/GuestAllocations.hpp"
#include "prx/libc/include/General.hpp"
#include "prx/libc/include/GuestArena.hpp"
#include "prx/libc/include/GuestWriteWatch.hpp"
#include "prx/libc/include/HostThreadLocal.hpp"
#include "prx/libc/include/HostThreadSlot.hpp"
#include <cerrno>
#include <mutex>
#include <array>
#include <chrono>
@@ -49,9 +51,9 @@
#endif
#include <windows.h>
#else
#include <cerrno>
#include <cstdint>
#include <dlfcn.h>
#include <execinfo.h>
#include <fcntl.h>
#include <fstream>
#ifndef __APPLE__
@@ -514,9 +516,20 @@ std::size_t CaptureCallerOffsets(std::span<unsigned long long> frames, unsigned
}
return captured;
#else
static_cast<void>(skip);
frames[0] = ModuleOffset(__builtin_return_address(0));
return 1;
void* raw[24];
const auto wanted = static_cast<int>(std::min<std::size_t>(frames.size() + 1 + skip, std::size(raw)));
const int captured = backtrace(raw, wanted);
static const auto base = [] {
Dl_info info{};
return dladdr(reinterpret_cast<const void*>(&CaptureCallerOffsets), &info) != 0 ? reinterpret_cast<std::uintptr_t>(info.dli_fbase) : std::uintptr_t{0};
}();
std::size_t written = 0;
for (int i = 1 + static_cast<int>(skip); i < captured && written < frames.size(); ++i) {
Dl_info info{};
const auto address = reinterpret_cast<std::uintptr_t>(raw[i]);
frames[written++] = base != 0 && dladdr(raw[i], &info) != 0 && reinterpret_cast<std::uintptr_t>(info.dli_fbase) == base ? address - base : 0;
}
return written;
#endif
}
@@ -1258,10 +1271,36 @@ std::vector<std::uint64_t> PagesOf(std::span<const std::pair<std::uint64_t, std:
return pages;
}
void HashPages(std::uint64_t first, std::span<const std::pair<std::uint64_t, std::uint64_t>> spans, std::vector<std::uint64_t>& hashes) {
std::vector<std::uint8_t> TrappedPages(std::span<const std::uint64_t> pages) {
std::vector<std::uint8_t> trapped(pages.size(), 0);
#ifdef __APPLE__
std::vector<std::pair<std::uintptr_t, std::uintptr_t>> runs;
for (std::size_t from = 0; from < pages.size();) {
auto to = from + 1;
while (to < pages.size() && pages[to] == pages[to - 1] + WritePageBytes) ++to;
GuestWriteWatch::GuestWriteWatchReadTraps_nid_postfix(static_cast<std::uintptr_t>(pages[from]), (to - from) * WritePageBytes, +[](void* context, std::uintptr_t begin, std::uintptr_t end) { static_cast<std::vector<std::pair<std::uintptr_t, std::uintptr_t>>*>(context)->emplace_back(begin, end); }, &runs);
from = to;
}
if (runs.empty()) return trapped;
std::sort(runs.begin(), runs.end());
for (std::size_t index = 0; index < pages.size(); ++index) {
const auto page = static_cast<std::uintptr_t>(pages[index]);
const auto run = std::partition_point(runs.begin(), runs.end(), [&](const auto& candidate) { return candidate.second <= page; });
trapped[index] = run != runs.end() && run->first < page + WritePageBytes;
}
#endif
return trapped;
}
void HashPages(std::uint64_t first, std::span<const std::pair<std::uint64_t, std::uint64_t>> spans, std::vector<std::uint64_t>& hashes, std::vector<std::uint8_t>& unknown) {
const auto pages = PagesOf(spans);
const auto trapped = TrappedPages(pages);
SplitPages(pages.size(), [&](std::size_t from, std::size_t to) {
for (auto index = from; index < to; ++index) hashes[static_cast<std::size_t>((pages[index] - first) / WritePageBytes)] = HashPage(reinterpret_cast<const std::byte*>(pages[index]));
for (auto index = from; index < to; ++index) {
const auto at = static_cast<std::size_t>((pages[index] - first) / WritePageBytes);
if (trapped[index] != 0) unknown[at] = 1;
else hashes[at] = HashPage(reinterpret_cast<const std::byte*>(pages[index]));
}
});
}
@@ -1270,11 +1309,13 @@ struct WindowCopy {
std::span<const std::uint64_t> hashes;
std::span<const std::byte> image;
StampKind held = StampKind::ImportWindow;
std::span<const std::uint8_t> unknown;
bool Holds(std::uintptr_t page) const {
if (held == StampKind::Driver) return page >= first && page - first <= image.size() && image.size() - (page - first) >= WritePageBytes && CompareMapped(page, image.subspan(page - first, WritePageBytes)) == Compare::Equal;
if (page < first || (page - first) / WritePageBytes >= hashes.size()) return false;
return HashPage(reinterpret_cast<const std::byte*>(page)) == hashes[(page - first) / WritePageBytes];
const auto at = (page - first) / WritePageBytes;
return (at >= unknown.size() || unknown[at] == 0) && HashPage(reinterpret_cast<const std::byte*>(page)) == hashes[at];
}
};
@@ -1899,9 +1940,10 @@ void stampWrittenRun(void* context, std::uintptr_t begin, std::uintptr_t end) {
void stampWindowRuns(StampRuns& runs) {
const auto pages = PagesOf(runs.windowRuns);
const auto trapped = TrappedPages(pages);
std::vector<std::uint8_t> held(pages.size(), 0);
SplitPages(pages.size(), [&](std::size_t from, std::size_t to) {
for (auto index = from; index < to; ++index) held[index] = runs.window->Holds(static_cast<std::uintptr_t>(pages[index]));
for (auto index = from; index < to; ++index) held[index] = trapped[index] == 0 && runs.window->Holds(static_cast<std::uintptr_t>(pages[index]));
});
auto& tracker = runs.tracker;
const auto generation = tracker.generation.load(std::memory_order_relaxed);
@@ -2376,7 +2418,8 @@ bool ImportWatched(std::uint64_t address, std::size_t bytes, const std::function
}
std::vector<std::uint64_t> hashes(static_cast<std::size_t>((stop - first) / page), 0);
for (const auto& [begin, end] : spans) CheckRange(reinterpret_cast<const void*>(begin), static_cast<std::size_t>(end - begin), 1, false);
HashPages(first, spans, hashes);
std::vector<std::uint8_t> unknown(hashes.size(), 0);
HashPages(first, spans, hashes, unknown);
const auto failWalk = importWalkFailureForTest.load(std::memory_order_acquire);
const auto failSpan = importWalkFailureSpanForTest.load(std::memory_order_acquire);
const auto failsWalk = [&](int walk, std::uint64_t begin, std::uint64_t end) {
@@ -2396,7 +2439,7 @@ bool ImportWatched(std::uint64_t address, std::size_t bytes, const std::function
leave(leaving);
if (!runImport()) return false;
bumpSubscriptions(first, stop - first, WriteBumpSource::Import);
const WindowCopy window{first, hashes};
const WindowCopy window{first, hashes, {}, StampKind::ImportWindow, unknown};
leaving.clear();
std::erase_if(spans, [&](const auto& span) {
if (failsWalk(2, span.first, span.second) || !walkWrites(tracker, span.first, span.second, StampKind::Cpu, true, &window)) {
@@ -3535,6 +3578,12 @@ Compare CompareMapped(std::uint64_t address, std::span<const std::byte> bytes) {
Compare CopyMapped(std::uint64_t address, std::span<std::byte> out) {
if (out.empty()) return Compare::Equal;
if (address == 0 || out.size() > std::numeric_limits<std::uintptr_t>::max() - address) return Compare::Unmapped;
#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
const int savedErrno = errno;
const bool copied = GuestCopyInUnsynced_nid_no_patch(out.data(), reinterpret_cast<const void*>(address), out.size());
errno = savedErrno;
return copied ? Compare::Equal : Compare::Unmapped;
#else
auto outcome = Compare::Equal;
const bool queried = describePages(static_cast<std::uintptr_t>(address), out.size(), [&](const PageRun& run) {
if (!run.readable) outcome = Compare::Unmapped;
@@ -3542,6 +3591,7 @@ Compare CopyMapped(std::uint64_t address, std::span<std::byte> out) {
return outcome == Compare::Equal;
});
return queried ? outcome : Compare::Unmapped;
#endif
}
void WriteChangedCommitted(std::uint64_t address, std::span<const std::byte> current, std::span<const std::byte> original) {
@@ -5,22 +5,114 @@
#include <exception>
#include <stdexcept>
#include <string_view>
#ifdef _WIN32
#include <windows.h>
#endif
namespace AgcDriver {
namespace {
#ifdef _WIN32
constexpr UINT Latin1Codepage = 28591;
struct Decoded {
std::wstring text;
UINT codepage;
};
std::wstring decodeWide(const std::string& text, const UINT codepage) {
if (text.empty()) return {};
const auto flags = codepage == CP_UTF8 ? MB_ERR_INVALID_CHARS : 0;
const auto count = ::MultiByteToWideChar(codepage, flags, text.data(), static_cast<int>(text.size()), nullptr, 0);
if (count <= 0) return {};
std::wstring out(static_cast<std::size_t>(count), L'\0');
::MultiByteToWideChar(codepage, flags, text.data(), static_cast<int>(text.size()), out.data(), count);
return out;
}
std::string encodeNarrow(const std::wstring& text, const UINT codepage) {
if (text.empty()) return {};
const int count = ::WideCharToMultiByte(codepage, 0, text.data(), static_cast<int>(text.size()), nullptr, 0, nullptr, nullptr);
if (count <= 0) return {};
std::string out(static_cast<std::size_t>(count), '\0');
::WideCharToMultiByte(codepage, 0, text.data(), static_cast<int>(text.size()), out.data(), count, nullptr, nullptr);
return out;
}
Decoded decodeText(const std::string& text) {
if (text.empty()) return {{}, CP_UTF8};
const UINT codepages[] = {CP_UTF8, CP_ACP};
for (const auto codepage : codepages) {
auto wide = decodeWide(text, codepage);
if (!wide.empty() && encodeNarrow(wide, codepage) == text) return {std::move(wide), codepage};
}
return {decodeWide(text, Latin1Codepage), Latin1Codepage};
}
bool nameCharacter(wchar_t value) {
if (value == L'_') return true;
if (value < 0x80) return std::isalnum(static_cast<unsigned char>(value)) != 0;
WORD type = 0;
if (!::GetStringTypeW(CT_CTYPE1, &value, 1, &type)) return false;
return (type & (C1_ALPHA | C1_DIGIT)) != 0;
}
std::size_t findWideName(const std::wstring& text, const std::wstring& name, std::size_t cursor) {
for (std::size_t at = cursor; at + name.size() <= text.size(); ++at)
if (::CompareStringOrdinal(text.c_str() + at, static_cast<int>(name.size()), name.c_str(), static_cast<int>(name.size()), TRUE) == CSTR_EQUAL) return at;
return std::wstring::npos;
}
std::wstring replaceNames(std::wstring text, const std::vector<std::string>& names, const UINT codepage) {
for (const auto& name : names) {
if (name.empty()) continue;
const auto decoded = decodeWide(name, codepage);
if (decoded.empty()) continue;
std::wstring result;
std::size_t cursor = 0;
for (;;) {
const auto found = findWideName(text, decoded, cursor);
if (found == std::wstring::npos) break;
const auto end = found + decoded.size();
const bool before = found == 0 || !nameCharacter(text[found - 1]);
const bool after = end == text.size() || !nameCharacter(text[end]);
result.append(text, cursor, found - cursor);
if (before && after) result += L"<redacted>";
else result.append(text, found, decoded.size());
cursor = end;
}
result.append(text, cursor, std::wstring::npos);
text = std::move(result);
}
return text;
}
std::string replaceNames(std::string text, const std::vector<std::string>& names) {
const auto decoded = decodeText(text);
const auto encoded = encodeNarrow(replaceNames(decoded.text, names, decoded.codepage), decoded.codepage);
if (encoded.empty() && !text.empty()) return text;
return encoded;
}
#else
bool nameCharacter(unsigned char value) {
return std::isalnum(value) != 0 || value == '_';
}
std::size_t findName(const std::string& text, const std::string& name, const std::size_t cursor) {
return text.find(name, cursor);
}
std::string replaceNames(std::string text, const std::vector<std::string>& names) {
for (const auto& name : names) {
if (name.empty()) continue;
std::string result;
std::size_t cursor = 0;
for (;;) {
const auto found = text.find(name, cursor);
const auto found = findName(text, name, cursor);
if (found == std::string::npos) break;
const auto end = found + name.size();
const bool before = found == 0 || !nameCharacter(static_cast<unsigned char>(text[found - 1]));
@@ -36,6 +128,8 @@ std::string replaceNames(std::string text, const std::vector<std::string>& names
return text;
}
#endif
bool hardwareAddress(const std::string& token) {
if (token.size() != 17) return false;
for (std::size_t index = 0; index < token.size(); ++index) {
@@ -113,6 +207,17 @@ std::string vulkanVersion(std::uint32_t version) {
return std::to_string((version >> 22) & 0x7Fu) + "." + std::to_string((version >> 12) & 0x3FFu) + "." + std::to_string(version & 0xFFFu);
}
std::string driverVersion(HostDriverVersionScheme scheme, std::uint32_t version) {
const auto field = [&](unsigned shift, std::uint32_t mask) { return std::to_string((version >> shift) & mask); };
switch (scheme) {
case HostDriverVersionScheme::Vulkan: return field(22, 0x3FFu) + "." + field(12, 0x3FFu) + "." + field(0, 0xFFFu);
case HostDriverVersionScheme::Nvidia: return field(22, 0x3FFu) + "." + field(14, 0xFFu) + "." + field(6, 0xFFu) + "." + field(0, 0x3Fu);
case HostDriverVersionScheme::IntelWindows: return field(14, 0x3FFFFu) + "." + field(0, 0x3FFFu);
case HostDriverVersionScheme::Unknown: break;
}
return "unknown";
}
std::string join(const std::vector<std::string>& values) {
std::string text;
for (const auto& value : values) {
@@ -299,6 +404,7 @@ std::string FormatHostReport(const HostFacts& original) {
line(output, "vulkan_api", vulkanVersion(gpu.apiVersion));
line(output, "driver", gpu.driverName.empty() ? "unknown" : gpu.driverName);
line(output, "driver_info", gpu.driverInfo.empty() ? "unknown" : gpu.driverInfo);
line(output, "driver_version", driverVersion(gpu.driverVersionScheme, gpu.driverVersion));
line(output, "driver_version_raw", hex(gpu.driverVersion));
line(output, "subgroup_size", std::to_string(gpu.subgroupSize));
line(output, "device_local_mib", std::to_string(gpu.deviceLocalMiB));
@@ -24,6 +24,15 @@ const char* deviceType(VkPhysicalDeviceType type) {
}
}
HostDriverVersionScheme driverVersionScheme(VkDriverId driver) {
switch (driver) {
case VK_DRIVER_ID_NVIDIA_PROPRIETARY: return HostDriverVersionScheme::Nvidia;
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS: return HostDriverVersionScheme::IntelWindows;
case VK_DRIVER_ID_MOLTENVK: return HostDriverVersionScheme::Unknown;
default: return HostDriverVersionScheme::Vulkan;
}
}
const char* presentModeName(VkPresentModeKHR mode) {
switch (mode) {
case VK_PRESENT_MODE_IMMEDIATE_KHR: return "immediate";
@@ -67,6 +76,7 @@ HostGpuFacts CollectHostGpuFacts(const HostGpuQuery& query) {
if (hasDriver) {
gpu.driverName = driver.driverName;
gpu.driverInfo = driver.driverInfo;
gpu.driverVersionScheme = driverVersionScheme(driver.driverID);
}
VkPhysicalDeviceMemoryProperties memory{};
load<PFN_vkGetPhysicalDeviceMemoryProperties>(query, "vkGetPhysicalDeviceMemoryProperties")(query.physical, &memory);
@@ -528,7 +528,9 @@ OverlayContent ComposeOverlayDetails(const OverlayDetailSample& sample) {
}
if (sample.queueWaits) add("Q0 WAIT MS/FRAME: MEM " + value(sample.queueWaits->memoryMs) + " LOCK " + value(sample.queueWaits->lockMs) + " GPU " + value(sample.queueWaits->gpuMs));
joined("RENDER PASSES/FRAME:", {shown(sample.renderPassesPerFrame, value)});
joined("PIPELINES:", {shown(sample.pipelinesCompiling, [&](std::uint64_t pending) { return "COMPILING " + count(static_cast<double>(pending)); }), shown(sample.pipelinesPerSecond, [&](double made) { return "NEW/S " + count(made); })});
std::optional<double> compileSecondsLeft;
if (sample.pipelinesCompiling && sample.pipelinesPerSecond && *sample.pipelinesPerSecond > 0) compileSecondsLeft = static_cast<double>(*sample.pipelinesCompiling) / *sample.pipelinesPerSecond;
joined("PIPELINES:", {shown(sample.pipelinesCompiling, [&](std::uint64_t pending) { return "COMPILING " + count(static_cast<double>(pending)); }), shown(sample.pipelinesPerSecond, [&](double made) { return "NEW/S " + count(made); }), shown(compileSecondsLeft, [&](double seconds) { return "LEFT " + FormatOverlayRate(seconds) + " S"; })});
joined("HIT %:", {shown(sample.drawCacheHitPercent, [&](double percent) { return "DRAW CACHE " + value(percent); }), shown(sample.pipelineCacheHitPercent, [&](double percent) { return "PIPELINES " + value(percent); })});
joined("", {shown(sample.flipsPerSecond, [&](double flips) { return "FLIPS/S: " + rate(flips); }), shown(sample.presentsPerSecond, [&](double presents) { return "PRESENTS/S: " + rate(presents); })});
joined("", {shown(sample.droppedFrames, [&](std::uint64_t dropped) { return "DROPPED/S: " + count(static_cast<double>(dropped)); }), shown(sample.repeatedPresents, [&](std::uint64_t repeated) { return "REPEATED/S: " + count(static_cast<double>(repeated)); })});
@@ -726,19 +728,27 @@ std::optional<std::uint64_t> ReadPhysicalMemoryBytes() {
#endif
}
std::int32_t OverlayScale(VkExtent2D extent, const OverlayContent& content) {
auto scale = std::max<std::int32_t>(1, static_cast<std::int32_t>((extent.height + 240) / 480));
std::int32_t OverlayScale(VkExtent2D extent, const OverlayContent& content, std::int32_t requested) {
auto scale = requested > 0 ? requested : std::max<std::int32_t>(1, static_cast<std::int32_t>((extent.height + 240) / 480));
while (scale > 1 && !fits(extent, content, scale)) --scale;
return scale;
}
std::int32_t OverlayScaleRequest(const char* value) {
if (value == nullptr || value[0] == '\0') return 0;
char* end = nullptr;
const long parsed = std::strtol(value, &end, 10);
if (end == value || *end != '\0' || parsed < 1 || parsed > 8) return 0;
return static_cast<std::int32_t>(parsed);
}
OverlayLayout LayOutOverlay(const OverlayContent& content, VkExtent2D extent, OverlayCorner corner) {
Graphics::Require(extent.width != 0 && extent.height != 0, "the performance overlay needs a destination");
Graphics::Require(content.frameTimes.size() <= OverlayStatistics::FrameHistory, "the performance overlay graph holds at most 120 frames");
Graphics::Require(content.columns > 0, "the performance overlay panel needs at least one column");
Graphics::Require(content.graph ? content.columns * OverlayMetrics::Advance - 1 >= static_cast<std::int32_t>(OverlayStatistics::FrameHistory) : content.frameTimes.empty(), "the performance overlay graph needs a graph row as wide as its 120 frames");
OverlayLayout layout;
const auto scale = OverlayScale(extent, content);
const auto scale = OverlayScale(extent, content, OverlayScaleRequest(std::getenv("ANYPS5_OVERLAY_SCALE")));
layout.scale = scale;
const auto width = panelWidth(content.columns, scale);
const auto height = panelHeight(content, scale);
@@ -975,7 +985,7 @@ void PerformanceOverlay::sampleDetails(OverlayStatistics::Clock::time_point at,
if (context.hostImportAlignment != 0) {
const auto imports = Graphics::HostImportCounters();
detailSample.hostImports = imports.live;
detailSample.hostImportBytes = OverlayMemory{imports.liveBytes, imports.liveBytes + Graphics::HostImportBudgetRemaining(context)};
detailSample.hostImportBytes = OverlayMemory{imports.liveBytes + imports.retiredPinnedBytes, imports.liveBytes + imports.retiredPinnedBytes + Graphics::HostImportBudgetRemaining(context)};
}
detailSample.presentMode = std::string(OverlayPresentModeName(info.presentMode));
if (info.fpsLimit > 0.0) detailSample.fpsLimit = info.fpsLimit;
@@ -10,6 +10,7 @@
#include <memory>
#include <stdexcept>
#include <string>
#include <system_error>
#include <vector>
#ifdef _WIN32
@@ -37,6 +38,26 @@ std::filesystem::path directory() {
return std::filesystem::path(reinterpret_cast<const char8_t*>(basePath.get())) / "anyps5-screenshots";
}
bool triggered() {
static const std::filesystem::path trigger = [] {
#ifdef _WIN32
const wchar_t* configured = _wgetenv(L"APS5_SCREENSHOT_TRIGGER");
#else
const char* configured = std::getenv("APS5_SCREENSHOT_TRIGGER");
#endif
return configured == nullptr ? std::filesystem::path{} : std::filesystem::path(configured);
}();
if (trigger.empty()) return false;
std::error_code error;
const auto status = std::filesystem::symlink_status(trigger, error);
if (status.type() == std::filesystem::file_type::not_found && (!error || error == std::errc::no_such_file_or_directory)) return false;
if (error) throw std::runtime_error("Screenshot: cannot inspect trigger file: " + error.message());
if (!std::filesystem::is_regular_file(status)) throw std::runtime_error("Screenshot: trigger must be a regular file");
const bool consumed = std::filesystem::remove(trigger, error);
if (error) throw std::runtime_error("Screenshot: cannot consume trigger file: " + error.message());
return consumed;
}
std::string localTimestamp() {
const std::time_t now = std::time(nullptr);
std::tm local{};
@@ -107,7 +128,9 @@ void AgcDriver::Screenshot::Request() {
}
bool AgcDriver::Screenshot::Take() {
return requested.exchange(false);
const bool manual = requested.exchange(false);
const bool file = triggered();
return manual || file;
}
std::filesystem::path AgcDriver::Screenshot::Write(std::string_view titleId, std::uint32_t width, std::uint32_t height, std::span<const std::byte> bgra) {
@@ -48,6 +48,7 @@ ShaderDeviceProfile::ShaderDeviceProfile(const ShaderRecompiler::SpirvTarget& ta
Require(!hasCapability(capability) || enabled, std::string("shader device profile advertises a disabled feature: ") + name);
};
checkFeature(spv::CapabilityFloat64, core.shaderFloat64 == VK_TRUE, "shaderFloat64");
checkFeature(spv::CapabilityInt16, core.shaderInt16 == VK_TRUE, "shaderInt16");
checkFeature(spv::CapabilityGeometry, core.geometryShader == VK_TRUE, "geometryShader");
checkFeature(spv::CapabilityTessellation, core.tessellationShader == VK_TRUE, "tessellationShader");
checkFeature(spv::CapabilityImageGatherExtended, core.shaderImageGatherExtended == VK_TRUE, "shaderImageGatherExtended");
@@ -5,6 +5,7 @@
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <ios>
#include <stdexcept>
#include <string>
#include <system_error>
@@ -15,6 +16,14 @@
namespace AgcDriver {
namespace {
void RequireGood(const std::ofstream& output, const char* operation, const std::filesystem::path& path) {
if (!output) throw std::ios_base::failure(std::string(operation) + " " + path.string() + " failed");
}
}
std::filesystem::path TraceFile::Directory() {
#ifdef _WIN32
const wchar_t* directory = _wgetenv(L"APS5_TRACE_DIR");
@@ -32,9 +41,8 @@ void TraceFile::WriteGzip(const std::filesystem::path& path, std::string_view te
z_stream& stream;
~End() { deflateEnd(&stream); }
} end{stream};
std::ofstream output;
output.exceptions(std::ios::badbit | std::ios::failbit);
output.open(path, std::ios::binary | std::ios::trunc);
std::ofstream output(path, std::ios::binary | std::ios::trunc);
RequireGood(output, "opening", path);
const std::array<unsigned char, 10> header{0x1f, 0x8b, 8, 0, 0, 0, 0, 0, 0, 0xff};
output.write(reinterpret_cast<const char*>(header.data()), header.size());
uLong crc = crc32(0, Z_NULL, 0);
@@ -54,6 +62,7 @@ void TraceFile::WriteGzip(const std::filesystem::path& path, std::string_view te
status = deflate(&stream, offset == text.size() ? Z_FINISH : Z_NO_FLUSH);
if (status != Z_OK && status != Z_STREAM_END) throw std::runtime_error("deflate failed with " + std::to_string(status));
output.write(reinterpret_cast<const char*>(chunk.data()), static_cast<std::streamsize>(chunk.size() - stream.avail_out));
RequireGood(output, "writing", path);
}
std::array<unsigned char, 8> trailer{};
const auto size = static_cast<std::uint32_t>(text.size());
@@ -63,6 +72,7 @@ void TraceFile::WriteGzip(const std::filesystem::path& path, std::string_view te
}
output.write(reinterpret_cast<const char*>(trailer.data()), trailer.size());
output.close();
RequireGood(output, "writing", path);
}
void TraceFile::ReplaceGzip(const std::filesystem::path& path, std::string_view text) {
@@ -88,11 +98,11 @@ void TraceFile::ReplaceGzip(const std::filesystem::path& path, std::string_view
}
void TraceFile::AppendLine(const std::filesystem::path& path, std::string_view line) {
std::ofstream output;
output.exceptions(std::ios::badbit | std::ios::failbit);
output.open(path, std::ios::binary | std::ios::app);
std::ofstream output(path, std::ios::binary | std::ios::app);
RequireGood(output, "opening", path);
output.write(line.data(), static_cast<std::streamsize>(line.size()));
output.close();
RequireGood(output, "appending to", path);
}
}
@@ -1,4 +1,5 @@
#include "prx/libSceAgcDriver/Execution/include/ProfileOutput.hpp"
#include "prx/libc/include/HostThread.hpp"
#include "prx/libSceAgcDriver/Execution/include/FrameDumpIo.hpp"
#include "prx/libSceAgcDriver/Graphics/include/PipelineSpecialization.hpp"
#include "prx/libSceAgcDriver/Execution/include/CaptureTrace.hpp"
@@ -29,6 +30,7 @@
#include "prx/libSceAgcDriver/Execution/include/DrawInputsInPlace.hpp"
#include "prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hpp"
#include "prx/libSceAgcDriver/Execution/include/TessellationPipelineCache.hpp"
#include "prx/libSceAgcDriver/Execution/include/IndexedIndirectPatches.hpp"
#include "prx/libSceAgcDriver/Execution/include/SubgroupClock.hpp"
#include "prx/libSceAgcDriver/Execution/include/ShaderDeviceProfile.hpp"
#include "prx/libSceAgcDriver/Execution/include/FrameLimit.hpp"
@@ -74,6 +76,7 @@
#include <windows.h>
#else
#include <unistd.h>
extern char** environ;
#endif
#include <atomic>
#include <chrono>
@@ -112,6 +115,10 @@ void ResetCheckpointSnapshots() noexcept;
#include <vector>
#include <utility>
#ifndef _WIN32
extern char** environ;
#endif
namespace AgcDriver {
std::string SoftwareFallbackWarning(VkPhysicalDeviceType selectedType, std::string_view selectedName, std::string_view hardwareName, PresentationRejection rejection, bool requested) {
@@ -235,6 +242,7 @@ const ShaderRecompiler::DiagnosticSink runReportSink{
.unsupportedInstruction = LibcRunReportUnsupportedInstruction_nid_no_patch,
.imageFormat = LibcRunReportImageFormat_nid_no_patch,
.descriptor = CountDescriptor,
.compileTime = LibcRunReportShaderCompileTime_nid_no_patch,
};
[[maybe_unused]] const bool runReportSinkInstalled = (LibcRunReportSetDescriptorCounters_nid_no_patch(descriptorUse), ShaderRecompiler::SetDiagnosticSink(&runReportSink), true);
@@ -361,7 +369,7 @@ public:
require(pixels.size() <= maxBytes, "a frame dump exceeds the 64 MiB queue");
changed.wait(lock, [&] { return stopping || pixels.size() <= maxBytes - queuedBytes; });
require(!stopping, "frame dump writer has stopped");
if (!worker.joinable()) worker = std::thread([this] { run(); });
if (!worker.joinable()) worker = Libc::StartHostThread([this] { run(); });
const auto bytes = pixels.size();
pending.push_back({index, width, height, screenshot, std::move(pixels)});
queuedBytes += bytes;
@@ -612,6 +620,7 @@ struct VulkanDevice::State {
bool depthClipControl = false;
bool graphicsPipelineLibrary = false;
bool pipelineLinkTimeOptimization = true;
bool dynamicColorWriteMask = false;
bool imageViewMinLod = false;
bool shaderResourceMinLod = false;
bool shaderImageMinLod = false;
@@ -677,6 +686,7 @@ struct VulkanDevice::State {
bool drawIndirectFirstInstance = false;
bool multiDrawIndirect = false;
bool drawIndirectCount = false;
bool indexedIndirectPatches = true;
// The device's resolved entry points (Graphics::DeviceFunctions) and the Graphics::Context
// built once after setup (see graphicsContext); the context's pool reference is dropped before
// the pool at teardown.
@@ -1621,6 +1631,7 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window, bool compileOnly) :
state->individuallyFreeDescriptorSets = driver.driverID == VK_DRIVER_ID_MESA_LLVMPIPE;
state->fusedExactArithmetic = driver.driverID == VK_DRIVER_ID_MOLTENVK;
state->tessellationPipelineCache = TessellationPipelineCacheUsable(driver.driverID);
state->indexedIndirectPatches = IndexedIndirectPatchesUsable(driver.driverID);
state->hostInterpolationFirst = HostInterpolationPreferred(driver.driverID) && std::getenv("APS5_NO_HOST_INTERPOLATION_FIRST") == nullptr;
APS5_LOG_OUT("Pixel interpolation driver=%d hostInterpolationFirst=%d", static_cast<int>(driver.driverID), state->hostInterpolationFirst ? 1 : 0);
state->subgroupControlBarriers = SubgroupControlBarrierUsable(driver.driverID);
@@ -1865,7 +1876,7 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window, bool compileOnly) :
const char* requestedPresentMode = std::getenv("ANYPS5_PRESENT_MODE");
VkPhysicalDevicePresentModeFifoLatestReadyFeaturesKHR fifoLatestReadyFeatures{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_MODE_FIFO_LATEST_READY_FEATURES_KHR};
bool fifoLatestReady = false;
if (requestedPresentMode != nullptr && std::strcmp(requestedPresentMode, "fifo_latest_ready") == 0 && fifoLatestReadyExtension != nullptr) {
if (window != nullptr && requestedPresentMode != nullptr && std::strcmp(requestedPresentMode, "fifo_latest_ready") == 0 && fifoLatestReadyExtension != nullptr) {
VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &fifoLatestReadyFeatures};
state->InstanceFunction<PFN_vkGetPhysicalDeviceFeatures2>("vkGetPhysicalDeviceFeatures2")(selected, &features);
fifoLatestReady = fifoLatestReadyFeatures.presentModeFifoLatestReady == VK_TRUE;
@@ -2052,6 +2063,15 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window, bool compileOnly) :
}
maintenance5Features = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR};
maintenance5Features.maintenance5 = VK_TRUE;
VkPhysicalDeviceExtendedDynamicState3FeaturesEXT dynamicState3Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT};
if (hasExtension(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME)) {
VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &dynamicState3Features};
state->InstanceFunction<PFN_vkGetPhysicalDeviceFeatures2>("vkGetPhysicalDeviceFeatures2")(selected, &features);
state->dynamicColorWriteMask = dynamicState3Features.extendedDynamicState3ColorWriteMask == VK_TRUE && std::getenv("APS5_NO_DYNAMIC_COLOR_WRITE_MASK") == nullptr;
if (state->dynamicColorWriteMask) deviceExtensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
}
dynamicState3Features = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT};
dynamicState3Features.extendedDynamicState3ColorWriteMask = VK_TRUE;
renderingFeatures = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR, nullptr, VK_TRUE};
libraryFeatures = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT, &dynamicStateFeatures, VK_TRUE};
dynamicStateFeatures = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT, &renderingFeatures, VK_TRUE};
@@ -2087,6 +2107,8 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window, bool compileOnly) :
require(available.vertexPipelineStoresAndAtomics && available.fragmentStoresAndAtomics, "graphics shader buffer writes and atomics are unavailable");
VkPhysicalDeviceFeatures enabled{};
enabled.shaderInt64 = VK_TRUE;
enabled.shaderInt16 = available.shaderInt16;
if (enabled.shaderInt16) state->capabilities.push_back(spv::CapabilityInt16);
enabled.shaderFloat64 = available.shaderFloat64 && floatControls.shaderSignedZeroInfNanPreserveFloat64;
if (enabled.shaderFloat64) state->capabilities.push_back(spv::CapabilityFloat64);
state->float64DenormPreserve = enabled.shaderFloat64 && floatControls.shaderDenormPreserveFloat64 == VK_TRUE &&
@@ -2284,6 +2306,10 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window, bool compileOnly) :
maintenance5Features.pNext = const_cast<void*>(deviceInfo.pNext);
deviceInfo.pNext = &maintenance5Features;
}
if (state->dynamicColorWriteMask) {
dynamicState3Features.pNext = const_cast<void*>(deviceInfo.pNext);
deviceInfo.pNext = &dynamicState3Features;
}
if (state->maintenance8) {
maintenance8Features.pNext = const_cast<void*>(deviceInfo.pNext);
deviceInfo.pNext = &maintenance8Features;
@@ -4809,6 +4835,7 @@ Graphics::Context VulkanDevice::buildContext() const {
context.provokingVertexLast = state->provokingVertexLast;
context.graphicsPipelineLibrary = state->graphicsPipelineLibrary;
context.pipelineLinkTimeOptimization = state->pipelineLinkTimeOptimization;
context.dynamicColorWriteMask = state->dynamicColorWriteMask;
context.drawInputsInPlace = state->drawInputsInPlace;
context.discreteGpu = state->properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
context.integratedGpu = state->properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
@@ -4870,7 +4897,7 @@ Graphics::Context VulkanDevice::buildContext() const {
}
VulkanDevice::IndirectDrawSupport VulkanDevice::DrawIndirectSupport() const {
return {state->drawIndirectFirstInstance, state->multiDrawIndirect, state->drawIndirectCount};
return {state->drawIndirectFirstInstance, state->multiDrawIndirect, state->drawIndirectCount, state->indexedIndirectPatches};
}
std::optional<std::string> VulkanDevice::KnownDrawRejection(const Graphics::State& graphics, std::span<const Graphics::CompiledShader> shaders) const {
@@ -1,5 +1,6 @@
#include "prx/libSceAgcDriver/Execution/include/WorkerSampler.hpp"
#include "prx/libSceAgcDriver/Execution/include/Mutex.hpp"
#include "prx/libc/include/HostThread.hpp"
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -311,7 +312,7 @@ struct ProcessSampler {
void StartProcessSampler() {
const auto path = ConfiguredPath(_wgetenv(L"APS5_SAMPLE_THREADS"));
if (!path) return;
processSamplerThread = std::jthread([path = *path](std::stop_token token) {
processSamplerThread = Libc::StartHostJThread([path = *path](std::stop_token token) {
auto sampler = std::make_unique<ProcessSampler>();
sampler->path = path;
sampler->self = GetCurrentThreadId();
@@ -341,7 +342,7 @@ void StartCallingThreadSampler(const std::optional<std::string>& path, std::jthr
sampler->stackHigh = reinterpret_cast<std::uint64_t>(block->StackBase);
}
if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &sampler->target, THREAD_ALL_ACCESS, FALSE, 0)) throw std::system_error(GetLastError(), std::system_category(), "Duplicating sampler thread handle");
slot = std::jthread([sampler = std::move(sampler)](std::stop_token token) {
slot = Libc::StartHostJThread([sampler = std::move(sampler)](std::stop_token token) {
auto flushed = std::chrono::steady_clock::now();
while (!token.stop_requested()) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
+9
View File
@@ -1,5 +1,6 @@
#include "prx/libc/include/general/ExportMacros.hpp"
#include "prx/libSceAgcDriver/include/AgcDriver.hpp"
#include "prx/libkernel/include/Api.hpp"
#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
@@ -261,4 +262,12 @@ int APS5_VABI libSceAgcDriverUnknown_wxdcyVqXJEY_nid_no_patch() {
}
APS5_EXPORT("wxdcyVqXJEY", libSceAgcDriverUnknown_wxdcyVqXJEY_nid_no_patch);
int APS5_VABI sceAgcDriverUnknown_yuO_plus_lNrj_plus_Do(std::int32_t kind, std::int64_t arg) {
if (kind != 1) return static_cast<int>(0x8A6D0003u);
if (arg != 0) return static_cast<int>(0x8A6D0005u);
sceKernelDebugRaiseException(0xA002030A, 0);
return static_cast<int>(0x8A6D0003u);
}
APS5_EXPORT("yuO+lNrj+Do", sceAgcDriverUnknown_yuO_plus_lNrj_plus_Do);
}
Loaded 100 of 2670 files, more files were not shown because too many files have changed in this diff. Show more