Compare commits

..

170 Commits

Author SHA1 Message Date
Ani b266e3d4bf rpcs3_version: Bump to 0.0.35 2025-03-01 00:11:02 +00:00
Zion Nimchuk 4e08242074 Remove ProgramDatabase from libpng and zlib 2025-02-28 18:37:50 +01:00
Zion Nimchuk 0690315d9e Use ccache on Windows CI build 2025-02-28 18:37:50 +01:00
Elad 207ee59acd PPU Analyzer: Firmware/import caller analysis and KLIC finding pass 2025-02-27 12:32:21 +02:00
Zion Nimchuk e97bfecb7f Deploy aarch64 builds via via GitHub Actions instead of Cirrus 2025-02-26 21:59:20 +01:00
Megamouse fe1fd86216 move texture_cache_types implementation to cpp 2025-02-26 19:42:31 +01:00
Megamouse 4f3f155bbf Update zstd to 1.5.7 2025-02-26 14:08:56 +01:00
Megamouse f284849fce Update curl to 8.12.1 2025-02-26 14:08:56 +01:00
Megamouse 527da94dfa Update libpng to 1.6.47 2025-02-26 14:08:56 +01:00
Megamouse 7970c2a6af Update SDL to 2.32.0 2025-02-26 14:08:56 +01:00
Megamouse c61199dd27 Fix signed vs unsigned comparison warning 2025-02-26 14:08:56 +01:00
oltolm 29ad4ecc78 concepts: fix review notes 2025-02-26 11:04:02 +02:00
oltolm ebde5310b9 use concepts instead of std::enable_if 2025-02-26 11:04:02 +02:00
Megamouse 5e6aef5dfd cellMic: fix division by zero 2025-02-26 07:53:33 +01:00
Megamouse cb539579b5 Qt: log microphone list 2025-02-26 07:53:33 +01:00
Megamouse d0d136ede5 github actions: rename jobs 2025-02-25 20:33:03 +01:00
Megamouse 4df1f9fb18 Move permissions to own file 2025-02-25 19:45:43 +01:00
Megamouse 3c576da42f Move debugger functions to emu_utils.cpp 2025-02-25 19:45:43 +01:00
Megamouse 709e3d2822 Move sys_time fmt to date_time.cpp 2025-02-25 19:45:43 +01:00
Megamouse 9082908606 Move is_input_allowed to GSFrameBase 2025-02-25 19:45:43 +01:00
Megamouse 8d801dadc4 Move display sleep functions to emu callbacks 2025-02-25 19:45:43 +01:00
Megamouse 87db82cacd Move check_microphone_permissions to emu callbacks 2025-02-25 19:45:43 +01:00
Megamouse d33d3a9f57 Move cheat_type fmt to cheat_info.cpp 2025-02-25 19:45:43 +01:00
Zion Nimchuk 4794558c08 Fix Azure and Github Actions CI caching 2025-02-24 10:51:09 +01:00
Darkhost1999 a44bd97cda Update QT to 6.8.2
https://code.qt.io/cgit/qt/qtreleasenotes.git/about/qt/6.8.2/release-note.md
2025-02-24 09:23:07 +01:00
Zion Nimchuk 807c5e2240 Add opencv to linux CI and specify which modules we want to use 2025-02-24 08:33:24 +02:00
oltolm b08273b127 Use Microsoft::WRL::ComPtr (#16744) 2025-02-23 15:39:39 +02:00
Elad 796a237128 PKG: Refactor and proper support for IDU 2025-02-22 15:01:47 +02:00
Malcolm Jestadt bd49c6bedb SPU LLVM: Small FCGT optimization 2025-02-22 07:35:14 +02:00
Elad 86a832da29 unpkg: Add support for IDU packages 2025-02-21 17:25:23 +02:00
Ivan Podogov e72cb6801a Add DXT1-5 decompression on ARM 2025-02-20 14:57:57 +03:00
trigger 1e01511ca0 cellMic: Implement SIGSTATE_MICENG 2025-02-20 11:57:41 +02:00
¥IGA 26e0f56bf9 CI: Use windows-2025 Runner 2025-02-20 09:50:36 +02:00
RipleyTom 157e73b67e Add missing NotFound error handling in LeaveRoom reply 2025-02-20 07:58:03 +02:00
RipleyTom 6074480ffb Reset presence when terminating NP 2025-02-19 11:14:55 +02:00
illusion0001 ec3d9a2cae Fix ARM matrix and review comments
Co-authored-by: Megamouse <studienricky89@googlemail.com>
Co-authored-by: Zion <zionnimchuk@gmail.com>
2025-02-17 21:11:39 +00:00
Aleksey Komarov c7c45bf2b8 Add arm64 build, update Qt version and docker image for github actions 2025-02-17 21:11:39 +00:00
illusion0001 49f6c5cdca GitHub Actions CI Port 2025-02-17 21:11:39 +00:00
Elad 52edef0867 Remove xxHash submodule 2025-02-17 18:00:01 +02:00
RipleyTom 0e5014788b Fix SignalingHelper notification 2025-02-17 07:42:33 +02:00
Malcolm Jestadt 7b9aaacc4b RSX: ProgramStateCache logic cleanup and microoptimizations
- Eliminate some redundant checks in fragment and vertex comparison functions
- Add is_any_src_constant optimization, eliminates 1 instruction per loop
2025-02-16 12:28:10 +02:00
Malcolm Jestadt d891b83e4b RSX: Use checksum with rotated inputs for shader hashing instead of FNV
- Raises FPS from ~180 to ~200 in Ninja Gaiden
2025-02-16 12:28:10 +02:00
oltolm 7e10aa57c4 CMakeLists.txt: add option to disable LTO 2025-02-15 20:33:25 +00:00
oltolm e3f57074aa cmake: fix build after 3rdparty updates 2025-02-15 20:33:25 +00:00
RipleyTom a29ecaf1d3 Fix sendto for p2ps packets 2025-02-14 22:28:11 +00:00
Megamouse cefcaaf287 Qt: enable updater for linux arm 2025-02-13 18:49:14 +01:00
Jan Beich 800c0f7a56 CI: drop fragile bundled libc++ on FreeBSD
- RPCS3 still uses C++20 which no longer needs recent Clang/libc++
- FreeBSD releases more frequently, bringing newer Clang/libc++
- bundled libc++ wastes too much limited CI time
2025-02-13 13:37:36 +00:00
Jan Beich 2593077361 CI: only use headers from bundled libc++ on FreeBSD
Linking different versions of libc++ can cause ABI issues but new C++
features are usually limited to headers.

ld: error: undefined symbol: operator new(unsigned long, std::align_val_t)
>>> referenced by string.cpp
>>>               string.cpp.o:(void* std::__1::__libcpp_operator_new[abi:ne190107]<unsigned long, std::align_val_t>(unsigned long, std::align_val_t)) in archive /tmp/cirrus-ci-build/libcxx_prefix/lib/libc++.a
>>> referenced by memory_string_searcher.cpp
>>>               memory_string_searcher.cpp.o:(memory_viewer_panel::OnSearch(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned int)) in archive rpcs3/rpcs3qt/librpcs3_ui.a
>>> referenced by game_list_frame.cpp
>>>               game_list_frame.cpp.o:(stx::auto_typemap<game_list_frame, 0u, 16u>::auto_typemap()) in archive rpcs3/rpcs3qt/librpcs3_ui.a
>>> referenced 23 more times
2025-02-13 13:37:36 +00:00
Jan Beich e4595f63c4 CI: unbreak bundled libc++ on FreeBSD after 363a225554
CMake Error at src/CMakeLists.txt:262 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:libcxx-abi-shared,IMPORTED_LIBNAME>

  Target "libcxx-abi-shared" not found.

CMake Error at libcxx_build/include/cmake_install.cmake:4117 (file):
  file INSTALL cannot find "/tmp/cirrus-ci-build/libcxx_build/include/c++/v1/libcxx.imp": No
  such file or directory.
2025-02-13 13:37:36 +00:00
Jan Beich b7b5774df1 CI: unbreak bundled libc++ on FreeBSD after 67703b49d8
CMake Error at modules/CMakeLists.txt:221 (file):
  file RELATIVE_PATH must be passed a full path to the directory:
  libcxx_prefix/lib
2025-02-13 13:37:36 +00:00
Jan Beich f60fb5a70e CI: upgrade FreeBSD to 13.4
FreeBSD doesn't support /latest and /quarterly package repos on EOL
versions. 13.3 reached EOL on 2024-12-31, so avoid CI breakage.

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

Some files were not shown because too many files have changed in this diff Show More