Compare commits

...

1898 commits

Author SHA1 Message Date
Megamouse
20c9dcd2d6 Remove qstr, sstr and qsv aliases. This does not compile on clang-cl
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 48s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
2025-06-30 08:18:50 +02:00
Megamouse
38ff48595d Fix missing include on clang-cl 2025-06-30 08:18:50 +02:00
Megamouse
c7c206ecdc Fix u32 compile error on clang-cl 2025-06-30 08:18:50 +02:00
Megamouse
bfd2adab5e Fix noexcept warnings in XAudio 2025-06-30 08:18:50 +02:00
Elad
786ac95dc0 RawSPU: Add missing MMIO register reads
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 45s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-29 21:31:52 +03:00
Elad
1660dc24b3 cellSaveData: Order equal elements using the opposing trait
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 47s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
2025-06-27 17:56:26 +03:00
kd-11
aa50b0fbb9 vk: Fix video-out calibration pass inputs
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 48s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
2025-06-25 23:06:04 +03:00
kd-11
3df93dcc19 vk: Fix shader interpreter inputs when textures are not used 2025-06-25 23:06:04 +03:00
kd-11
1f0328c5d5 vk: Fix up binding layouts for some broken shaders 2025-06-25 23:06:04 +03:00
kd-11
3f635033cc vk: Cleanup compiler warnings 2025-06-25 23:06:04 +03:00
kd-11
8130babad3 vk: Fix crash when running MSAA resolve shaders 2025-06-25 23:06:04 +03:00
kd-11
37c4406b23 Remove unused file 2025-06-25 23:06:04 +03:00
kd-11
5d6b8b20c4 vk: Fix binding of arrays 2025-06-25 23:06:04 +03:00
kd-11
396c4bbdd7 vk: Drop obsolete logic around descriptor switching 2025-06-25 23:06:04 +03:00
kd-11
16a0ae6a7b vk: Update shader interpreter to use dynamic binding layout 2025-06-25 23:06:04 +03:00
kd-11
dd28d100d6 vk: Fix crash when running attachment clear pass 2025-06-25 23:06:04 +03:00
kd-11
91e22aa4e4 vk: Fix FS stencil mirror binding location overwrites causing holes in descriptor layout 2025-06-25 23:06:04 +03:00
kd-11
cdc78f81f7 vk: Code improvements 2025-06-25 23:06:04 +03:00
kd-11
91491c7cf3 vk: Drop copy optimization
- The pointer-based nature of write entries, changes invalidate previous data
- Instead of managing scratch, just push to the descriptors built-in management which is quite optimal
2025-06-25 23:06:04 +03:00
kd-11
b3492b73ad vk: Improve pipeline layout validation and fix slot allocation bugs 2025-06-25 23:06:04 +03:00
kd-11
15791cf94e vk: Fix descriptor set update and caching model to support skipped updates 2025-06-25 23:06:04 +03:00
kd-11
5417d4854d vk: Fix edge cases in descriptor update logic 2025-06-25 23:06:04 +03:00
kd-11
bb1c0a5eee rsx/util: Support basic array merge 2025-06-25 23:06:04 +03:00
kd-11
3a65359d59 vk: Fix clang build and resource leak on exit 2025-06-25 23:06:04 +03:00
kd-11
ffa835efac vk: Use shared layout generator for all pipelines
- Common code applying flags uniformly fixes bugs with misconfigured options
2025-06-25 23:06:04 +03:00
kd-11
f241825c73 vk: Update binding model for compute jobs 2025-06-25 23:06:04 +03:00
kd-11
2c8c788d81 vk: Use standard C++ 2025-06-25 23:06:04 +03:00
kd-11
2ae9753d79 vk: Lazy register/derigeter of hot data 2025-06-25 23:06:04 +03:00
kd-11
93e6aa6310 vk: Fix FSR upscaling 2025-06-25 23:06:04 +03:00
kd-11
ae74aa336f vk: Use write commands instead of copy commands to avoid dependencies 2025-06-25 23:06:04 +03:00
kd-11
64866098e7 vk: Respect shader compile flags when linking 2025-06-25 23:06:04 +03:00
kd-11
20b54f3086 vk: Correctly initialize descriptor copy data 2025-06-25 23:06:04 +03:00
kd-11
aac4fbe941 vk: Fix graphical bugs and crashes 2025-06-25 23:06:04 +03:00
kd-11
356b2f5910 vk: Rewrite program binding management to use "separate shader objects" concept. 2025-06-25 23:06:04 +03:00
kd-11
4d493bbb80 vk: Fix build 2025-06-25 23:06:04 +03:00
kd-11
49729086ac vk: Move descriptor management to the pipeline layer
- Frees up callers from managing descriptors themselves (ewww)
- Makes descriptor reuse possible
- Opens up the door to techniques like descriptor_buffer by abstracting away management to an implementation detail
2025-06-25 23:06:04 +03:00
digant73
329655a1bf fix DEBUG mode compilation
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 1m8s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
2025-06-24 05:16:17 +03:00
qurious-pixel
b0067e8934 Windows Clang - libvulkan
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
Fix windows clang libvulkan static lib name
2025-06-22 03:38:16 +03:00
Kuan-Wei Chiu
22d9343f2c Fix invalid comparator in savedata_op sorting
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 1m29s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
According to the C++ standard, comparison functions used in sorting
algorithms such as std::sort must establish a strict weak ordering.
Specifically, the comparator must be irreflexive: for all values x,
comp(x, x) must be false.

The original comparator used >= for descending order, which violates
this requirement in the case of equal values (i.e., when a == b, both
comp(a, b) and comp(b, a) would return true). This can result in
undefined behavior in sorting algorithms, including potential
segmentation faults due to invalid iterator manipulation.

This change replaces >= with > to ensure irreflexivity and compliance
with the standard's requirement for a strict weak ordering.
2025-06-21 20:00:12 +03:00
qurious-pixel
9c93ec0bc3 exclude libusb submodule
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
2025-06-20 09:08:03 +02:00
qurious-pixel
c6c72d3721 install opencv FreeBSD 2025-06-20 09:08:03 +02:00
qurious-pixel
424f9306c4 Use system LibUSB for FreeBSD 2025-06-20 09:08:03 +02:00
qurious-pixel
5d552ca236 Add Timeout to FreeBSD build 2025-06-20 09:08:03 +02:00
Megamouse
28896acb83 CI: Build static OpenAl
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 1m14s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-19 12:09:59 +02:00
Megamouse
6f37be1afd CI/Win/clang: try to fix vulkan support 2025-06-19 09:07:01 +02:00
Megamouse
4fd581b812 Add github actions for linux arm gcc
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 2m12s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-18 16:31:05 +02:00
Marcin Serwin
bad6e99258 Disable -Wold-style-cast diagnostic before including sse2neon
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
2025-06-18 15:52:52 +02:00
Megamouse
27359d3d32 CMake: add more options
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
Build RPCS3 / RPCS3 FreeBSD (push) Has been cancelled
2025-06-16 09:01:00 +02:00
Megamouse
f8f34787b3 CI: Do not checkout zlib 2025-06-16 09:01:00 +02:00
Megamouse
d61c2496b6 hid/input: fix enumerated device comparison 2025-06-16 08:12:13 +02:00
Megamouse
5569c5c803 Win/cmake: Copy test directory to bin
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
2025-06-15 17:12:50 +02:00
Megamouse
d0812ee5a8 CI: build windows clang 2025-06-15 17:12:50 +02:00
Megamouse
9634e58f0a CI: fix branch name and PR number
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
2025-06-14 23:44:06 +02:00
RipleyTom
9610d45ebf
Entitlements are never found (#17306)
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 24s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Minor change, we don't support entitlements atm.
2025-06-14 09:38:38 +03:00
Elad
85c813d84c
RawSPU: Fix race of SPU_MBox_Status_offs (#17303)
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 41s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-13 18:56:35 +03:00
Megamouse
ab55500f01 Add github actions for windows llvm
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 34s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-13 03:31:08 +02:00
Megamouse
af0432a44b Update opencv to 4.11.0
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 1s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
2025-06-13 01:35:28 +02:00
qurious-pixel
2b7161208e
[CI] FreeBSD build (#17293)
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 1m1s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 FreeBSD (push) Has been skipped
Build FreeBSD on Github Actions
2025-06-12 09:33:40 +03:00
Megamouse
5514d7c3d8 input: only copy relevant members to external buttons and sticks
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 41s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
fixes a crash in std::set, which is not thread safe
2025-06-09 11:09:26 +02:00
Elad
823e17288c SPU: Skip PUTLLUC writes of the same data
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 2m35s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
2025-06-08 19:09:22 +03:00
Megamouse
866daf2059 input/macOs: Call hid_close on the main thread
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 2m42s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-06-07 13:03:41 +02:00
Megamouse
ae38cef7b1 input/macOs: Call hid_open_path on the main thread 2025-06-07 13:03:41 +02:00
Megamouse
e36f55ea41 input/macOs: call hid_enumerate on the main thread 2025-06-07 13:03:41 +02:00
Megamouse
819d3dc7a6 input/macOs: Run hidapi pad handlers on a single thread 2025-06-07 13:03:41 +02:00
oltolm
ac99b2036d llvm: fix deprecation warnings 2025-06-07 12:46:48 +03:00
Megamouse
46cce45b13 Fix missing inserted = true in check_for_duplicates_fast
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 1m14s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-06-06 01:07:33 +02:00
Megamouse
d685348644 Update Qt to 6.9.1
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 44s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
- Updates Qt to 6.9.1
2025-06-05 21:57:43 +02:00
Megamouse
d15b7a9955 ci/macOs: run unit tests
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-06-03 21:59:59 +02:00
kd-11
99db73a34f Update VMA vulkan version to 1.2
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 43s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-06-02 17:06:23 +03:00
kd-11
85e4eff571 vk: Raise min API version to 1.2 2025-06-02 17:06:23 +03:00
Megamouse
d8bc2d5c75 input: move copilot code to pad_thread
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 40s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
2025-06-02 09:12:32 +02:00
Megamouse
4704c03209 Fix some static analysis warnings, including c-style cast
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Failing after 2m59s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been skipped
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been skipped
2025-06-01 22:07:03 +02:00
Megamouse
70faef3fdb Logs: use thread_local
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-06-01 20:17:51 +03:00
qurious-pixel
663ff55af9 restore ffmpeg dependencies on linux 2025-06-01 18:45:00 +02:00
Zion Nimchuk
229c1c38a3 Setup build caches to only save on master builds, to ensure PR caches don't take presidence 2025-06-01 13:18:16 +01:00
Ani
68d2573344 rpcs3_version: Bump to 0.0.37
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Mac Intel (push) Waiting to run
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-31 22:05:34 +01:00
Zion Nimchuk
c437fe9ff0 Fixing the two upload commit hashes got switched around 2025-05-31 20:36:04 +01:00
schm1dtmac
c93ee3dc1a thanks vscode 2025-05-31 19:08:04 +01:00
schm1dtmac
0f45c08188 Suggested review changes 2025-05-31 19:08:04 +01:00
schm1dtmac
55aaffb7b3 Readd Homebrew Cache (used to be on Cirrus), silence more warnings 2025-05-31 19:08:04 +01:00
schm1dtmac
aeafbfa2e1 Silence warnings 2025-05-31 19:08:04 +01:00
schm1dtmac
cd7c9a8da4 Move Mac builds to GH Actions 2025-05-31 19:08:04 +01:00
Megamouse
382e62c7d8 input: implement basic copiloting
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-29 20:56:13 +02:00
Megamouse
ae35430c96 multithreaded version_check 2025-05-29 20:56:13 +02:00
Megamouse
c0bfc34a75 Fix codestyle 2025-05-29 20:56:13 +02:00
Marcin Serwin
bda335a505 cmake: add option to use system cubeb
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
2025-05-29 18:30:25 +02:00
oltolm
38289f3bc1 fix Windows build with GCC/Clang 2025-05-29 14:15:54 +02:00
oltolm
3d0a68c9e8 stdafx.h: fix clang warnings 2025-05-29 14:15:54 +02:00
Megamouse
a9df046f21 Update curl to 8.14.0
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-29 02:07:52 +02:00
kd-11
2d9a24d1d6 rsx/util/test: Cover edge cases in address_range test suite
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-27 15:06:32 +03:00
kd-11
45718d7679 rsx: Use address_range64 to simplify MM intersection tests 2025-05-27 15:06:32 +03:00
kd-11
2ea7ff6b14 rsx/util: Split address_range into a sized address_range template 2025-05-27 15:06:32 +03:00
kd-11
4f7c82ba8a utils: Rename address_range to address_range32 to allow implementation of address_range16 and address_range64 2025-05-27 15:06:32 +03:00
kd-11
79bcb7790c rsx/util: Add unit tests for address ranges 2025-05-27 15:06:32 +03:00
kd-11
1ff6bdd777 rsx: Flush MM queue before applying nv3089 block transfers
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-26 00:42:24 +03:00
Megamouse
3e674a896f Minor struct memory layout optimization
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-24 18:24:58 +02:00
Megamouse
3aba805bc9 rsx: Fix use after move warning 2025-05-24 18:24:58 +02:00
Megamouse
09ab5477e8 rsx: use more const ref 2025-05-24 18:24:58 +02:00
Megamouse
da273761d1 Fix some static analysis warnings 2025-05-24 18:24:58 +02:00
FlexBy420
4f2324cae7 Remove roadmap link from README
Roadmap was removed from the website as it wasn't updated in years.
2025-05-24 16:47:47 +02:00
RipleyTom
57207bbe96 Sort bin attributes based on ID
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-23 13:30:39 +02:00
Megamouse
b8a5986504 Update hidapi to 0.15.0 2025-05-23 09:20:09 +02:00
kd-11
b54c2124cf rsx: Refactor CgBinaryProgram to avoid namespace collision with X11
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-21 16:51:11 +03:00
kd-11
9a150b677e rsx-debugger: Extra safety checks for FP decompiler 2025-05-21 16:51:11 +03:00
kd-11
01ec2671b3 rsx-debugger: Show disassembly of the currently active VP and FP 2025-05-21 16:51:11 +03:00
kd-11
dd0004f80d rsx: Use safe memory in RSX assembly decompiler 2025-05-21 16:51:11 +03:00
kd-11
e59c6c3c18 vk: Force VMA to comply with Vulkan 1.0 2025-05-21 16:51:11 +03:00
Megamouse
c27d7db0a7 SDL: do not track emu state when initializing
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-21 07:01:11 +02:00
Megamouse
7e7943f962 Always initialize SDL from main thread 2025-05-21 07:01:11 +02:00
Katharine Chui
cb5fd17635 Logitech G27 log control transfers as todo
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-19 21:14:36 +02:00
Katharine Chui
c5e40dde74 Logitech G27 update bit 86 shifter_pressed behavior 2025-05-19 21:14:36 +02:00
elad335
5deb0fcbc6 PPU debugger: Update CIA unconditionally if "PPU Debug" enabled
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-17 20:14:27 +03:00
Megamouse
62055bed3f Silence clang warning spam
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-15 23:50:32 +02:00
Megamouse
182acfcf3e Fix log level of sdl pad handler log message
I accidentally changed this to error in a prior commit.
2025-05-15 23:50:32 +02:00
Katharine Chui
52aa475581
Logitech G27 update shifter input (#17216)
Based on information provided by Florin9doi
https://github.com/RPCS3/rpcs3/pull/17199#issuecomment-2883934412
2025-05-15 22:58:10 +02:00
Megamouse
64a3e50d6c Fix some warnings
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-15 16:23:47 +02:00
Megamouse
0750574a03 Update VulkanMemoryAllocator to 3.3.0 2025-05-15 16:23:47 +02:00
Megamouse
3dca4dd4bb Update SDL to 3.2.14
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-14 21:07:18 +02:00
Megamouse
410710b02c LG27: Update defaults 2025-05-14 19:52:06 +02:00
Megamouse
48be05e8f1 G27: Make warning label color more dynamic 2025-05-14 19:52:06 +02:00
Megamouse
36e680c603 G27: Improve layout a bit 2025-05-14 19:52:06 +02:00
Megamouse
5da1b44371 Fix emu name in label 2025-05-14 19:52:06 +02:00
Megamouse
9b3ee1ed17 Gui: simplify LogitechG27 settings dialog 2025-05-14 19:52:06 +02:00
elad335
3f2075070a Fix UB
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Reference exists after destructor is called.
2025-05-14 09:44:07 +03:00
elad335
208c4e2af2 SPU: Improved GETLLAR spin detection conditions 2025-05-14 09:44:07 +03:00
Katharine Chui
a9b911750f
Logitech G27 Expand SDL device identification, add mapping note (#17206)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Fanatec windows drivers doesn't mux a single device into a single
software device. Instead they have two identical devices in
terms of vendor and product id. Add a mostly stable way to tell
between the two.

Currently working wheels should not be affected, Fanatec users
please map the wheel again.

Do not save config on reset
2025-05-14 01:31:52 +02:00
Megamouse
8d9ba4329d LogitechG27: use named_thread instead of std::thread 2025-05-14 01:18:32 +03:00
Megamouse
bc18b3592c SDL/input: Log GUID 2025-05-13 21:41:23 +02:00
elad335
fa744121fc Fix CallFromMainThread execution condition
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-13 17:37:13 +03:00
kd-11
f4dc18c872 rsx: Don't trigger surface swap-in/swap-out handlers when replacing self 2025-05-13 15:17:36 +03:00
RipleyTom
d02dea5df2 Make Disable IPv6 text translatable 2025-05-13 13:43:03 +02:00
RipleyTom
b1b02e0425 Bind RPCN client socket only if bind_ip is set
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-12 22:15:56 +02:00
RipleyTom
6854e9b974 Fix building with SDL submodule 2025-05-12 21:40:02 +02:00
RipleyTom
3894c903bc Make IP Binding more global
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-05-10 08:44:05 +03:00
elad335
d21358e91f System: Fix Kill calling duplication
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-09 11:39:53 +03:00
Megamouse
21cdbd90e9 trophies/overlays: treat unlocked hidden trophies just like normal unlocked trophies
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-08 21:20:16 +02:00
elad335
12f4e4fd8c SPU: Evaluated Thread-blocked LR messaging 2025-05-08 20:46:40 +03:00
elad335
3ea3ed6672 Emu: Track game termination progress better
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-08 17:06:47 +03:00
Katharine Chui
4840e3575b remove SDL_INIT_JOYSTICK since SDL_INIT_GAMEPAD implies SDL_INIT_JOYSTICK 2025-05-08 13:41:41 +02:00
Katharine Chui
f0672bdbc9 initialize sdl haptic, log haptic device open errors 2025-05-08 13:41:41 +02:00
Megamouse
2963d10325 cellSysutilCheckCallback: increase read_counter as soon as a callback is about to be called
The game might call sys_process_exit in one of the callbacks.
This might take a couple of seconds and does not increase the counter.
So we have to increase it before in order to give Kill some more time.
2025-05-08 12:58:38 +02:00
Megamouse
501643c10a Use const for present_samples buf argument 2025-05-08 12:58:38 +02:00
Megamouse
73a6141f3f overlays: Allow auto exit in home menu's exit game function
In case the game does not terminate itself properly.
2025-05-08 12:58:38 +02:00
Megamouse
738d1ef682 Emu: Make game termination less confusing 2025-05-08 12:58:38 +02:00
Megamouse
30a4b26306 Add log message when QApplication is being quit 2025-05-08 12:58:38 +02:00
Megamouse
fdc1a51cba Log RPCS3 exit code 2025-05-08 12:58:38 +02:00
Megamouse
9c7d8da298 Add log message if game ignores exit game request 2025-05-08 12:58:38 +02:00
Megamouse
0146b845d9 MSVC: Fix weird std::move on const variable warning... 2025-05-08 12:58:38 +02:00
Megamouse
fc3a905c90 Use string_view for log params 2025-05-08 12:58:38 +02:00
Megamouse
aa79afd7ae StrUtil: Add more unit tests 2025-05-08 12:58:38 +02:00
elad335
f17400092d Fixup SPU Interpreters 2025-05-08 11:54:16 +03:00
Katharine Chui
e1d3cf57c8
Logitech G27 fixes and cleanups (#17170)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
- revamp effect direction to avoid some windows driver issues
- ref: https://github.com/libsdl-org/SDL/issues/7941
- fix possible SDL_SetJoystickLED calls on closed joystick handle
- various comment cleanups
- make now static sdl effect direction a template
- fix formatting, shorten logitech_g27_force_to_level, revamp sawtooth effect abuse logging
- log and handle ramp effects with reversed min/max forces
- remove abandoned functions
2025-05-07 19:20:35 +02:00
Elad
2a50ac1891
PPU Loader: Consume Executable Memory
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-06 21:21:38 +03:00
Megamouse
0724fa3aa9 VS: compile glslang with the solution
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-06 00:43:41 +02:00
Zion Nimchuk
ba46c62500 Remove old OGLCompiler.lib dep 2025-05-06 00:43:41 +02:00
Zion Nimchuk
1276867860 Cleanup what we build in glslang vcxproj 2025-05-06 00:43:41 +02:00
Zion Nimchuk
5249f6cba7 Just build the latest glslang instead of dowloading the precompiled libs 2025-05-06 00:43:41 +02:00
Megamouse
353e0a8400 VS: Add glslang include directory 2025-05-06 00:43:41 +02:00
Zion Nimchuk
ec4e65bdd9 Update glslang to 15.3.0 2025-05-06 00:43:41 +02:00
kd-11
e5d3944726 vk: Limit NV crash workaround to older generations 2025-05-06 00:00:04 +02:00
kd-11
e67beb27dd vk: Fix cyclic dependency problem during physical device init 2025-05-06 00:00:04 +02:00
kd-11
5cfa9fd83e vk: Disable texel buffer update-after-bind on NVIDIA driver 2025-05-06 00:00:04 +02:00
Megamouse
84a4cc01e1 SDL/Input: add DS3 pressure intensity 2025-05-05 23:20:40 +02:00
Megamouse
32ad9988a3 SDL/Input: add new misc buttons 2025-05-05 23:20:40 +02:00
Megamouse
fcdf542c47 Update SDL to 3.2.12
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-05 22:42:28 +02:00
Vestral
3cebfaa648
Atomic utils fixup after ASLR changes (#17168) 2025-05-05 21:48:07 +03:00
Séamus
74fa59590a Update MoltenVK to v1.3.0
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-05 09:04:17 +02:00
kd-11
4958d7a88f rsx: Do not interpolate when performing image reconstruction
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
- Interpolation introduces cross-channel bit-leakage and noise
2025-05-05 01:15:33 +03:00
Katharine Chui
487c58558e Logitech G27 touchups
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
- TODO note and adjust type for housing SDL_CreateHapticEffect return
- fix implementation of command 0x09 Set LED
- fix LED joystick changes handling
2025-05-03 19:43:07 +02:00
Elad
cf1e53f9c8
Fix crash in memory viewer launcher (#17152) 2025-05-03 18:34:42 +03:00
Megamouse
75b728be7e Logitech G27 cleanup
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-03 13:21:34 +02:00
trigger
6428088e46
Qt: "Show in Memory Viewer" context action (#17131) 2025-05-03 08:35:45 +03:00
Katharine Chui
c0a1e8d5a5
virtual Logitech G27 for Gran Turismo 6 (#17135)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-02 21:27:40 +02:00
Megamouse
7a9733dcca CMake: try to fix gcc 2025-05-02 17:18:11 +02:00
Megamouse
9146076e28 Update FAudio to 25.05 2025-05-02 17:18:11 +02:00
kd-11
b25276deec tests: Fix failing test and improve msvc setup
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-02 01:16:21 +03:00
kd-11
947c6ec3e1 test: Add UTs for rsx::simple_array<T> 2025-05-02 01:16:21 +03:00
Megamouse
ea94f44f66 Disable WholeProgramOptimization for unit test
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-01 15:28:52 +02:00
Megamouse
e48797db1a CI: Only run unit tests for pull requests 2025-05-01 15:28:52 +02:00
Megamouse
0439ca67d9 CI: Add windows unit tests
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-01 12:51:39 +02:00
Megamouse
399c871d79 VS: improve unit test project setup 2025-05-01 12:51:39 +02:00
Megamouse
6abe18a4f8 Add unit test for fmt::merge
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-01 00:56:37 +02:00
Megamouse
77f45954d0 Update libpng to 1.6.48 2025-05-01 00:56:37 +02:00
Megamouse
982dac9446 Remove unused fmt::match function 2025-05-01 00:56:37 +02:00
Megamouse
486e93f418 Fix fmt::replace_all with empty from and add unit tests 2025-05-01 00:56:37 +02:00
Megamouse
259768e896 Add submodule version check script 2025-05-01 00:56:37 +02:00
Megamouse
c792db2c60 CMake: Disable unit tests in gcc
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-30 19:40:10 +02:00
Megamouse
b6a3754ee5 CMake: Use existing main for unit tests 2025-04-30 19:40:10 +02:00
Megamouse
e4cc55dc19 Move spellcheck before build
This saves time when there's a syntax error in deploy_linux.sh
2025-04-30 19:40:10 +02:00
Megamouse
eb4c6df609 CI: Add unit tests 2025-04-30 19:40:10 +02:00
Megamouse
05b5f9aa97 VS: Remove unnecessary LinkIncremental to fix some warning
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-30 10:08:16 +02:00
Megamouse
a9d2150b0f VS: Remove unnecessary moc_predefs file to fix a warning 2025-04-30 10:08:16 +02:00
Megamouse
b17078fe1a Fix some warnings 2025-04-30 10:08:16 +02:00
Megamouse
9a5c4aba58 VS: Enable ASLR in unit test 2025-04-30 10:08:16 +02:00
Megamouse
9897a80216 CMake: fix gcc build 2025-04-30 10:08:16 +02:00
Megamouse
19cc93437e CMake: move all rpcs3 cpp files to rpcs3qt 2025-04-30 10:08:16 +02:00
Megamouse
39247fcbc1 CMake: Run unit test during build if requested 2025-04-30 10:08:16 +02:00
Megamouse
3b61613d1b CMake: Create unit test 2025-04-30 10:08:16 +02:00
Megamouse
81b1e5636d CMake: Create static rpcs3_lib 2025-04-30 10:08:16 +02:00
Vestral
e066735fe9 Utils fixes for ASLR
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-30 02:56:23 +02:00
Vestral
63b7134dce Separate segment and function addresses in PPU LLVM 2025-04-30 02:56:23 +02:00
Vestral
e110334c2c Disable SPU asmjit on ARM. Only supported on x86 2025-04-30 02:56:23 +02:00
Vestral
77eef4d783 Don't make assumptions about address format 2025-04-30 02:56:23 +02:00
Vestral
e2df71d87c Enable ASLR 2025-04-30 02:56:23 +02:00
Megamouse
68e7f4e820 fmt: add some unit tests and fix fmt::trim 2025-04-30 00:07:24 +02:00
Megamouse
376ac85029 Add unit test project to VS 2025-04-29 21:09:12 +02:00
Megamouse
b1b9310a50 Update docker to 1.6
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-29 19:21:32 +02:00
Megamouse
024949f17e Move main to main.cpp 2025-04-29 18:42:20 +02:00
Megamouse
74d995aae0 Rename main.cpp to rpcs3.cpp 2025-04-29 18:42:20 +02:00
Megamouse
5b60f0cc11 CI: Use variables for docker artifacts dir 2025-04-29 18:21:29 +02:00
Megamouse
a72f4f0606 Avoid checking out unused submodules 2025-04-29 18:21:29 +02:00
Megamouse
752df0dae7 VS: fix relative 3rdparty paths 2025-04-29 18:21:29 +02:00
Megamouse
2d4ff404bd VS: remove some outdated keywords 2025-04-29 18:21:29 +02:00
Megamouse
62fa074f9f github actions: disable pushes unless it's the RPCS3 master branch 2025-04-29 15:27:25 +02:00
trigger
c8f5659090
Qt: Hex validator for address/instruction inputs (#17113) 2025-04-29 14:42:16 +02:00
elad335
79b63556bb vm_native.cpp: Fix possible weakness of map_self() 2025-04-29 14:54:40 +03:00
elad335
1f81d42416 Fix sys_mmapper_unmap_shared_memory 2025-04-29 14:54:40 +03:00
kd-11
75bfc336fc vk: Prevent header internals from leaking
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-29 03:52:49 +03:00
kd-11
1af67f39ca vk: Stop using internal defines to structure platform-specific code 2025-04-29 03:52:49 +03:00
elad335
2aca213ba1 sys_mmapper: Lazily allocate shared memory descriptors
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-28 18:55:23 +03:00
elad335
730249a887 Embedded SPU Image Search Fixes 2025-04-28 17:44:33 +03:00
trigger
0e1cad4ca9 PPU: HasBreakpoint fast path when empty
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-28 09:28:51 +03:00
kd-11
2afd7707fe vk: Fix more silly mistakes
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-27 17:09:50 +03:00
kd-11
01cf71e49a vk: Fix indexed multidraw 2025-04-27 17:09:50 +03:00
kd-11
2f677ecebd rsx: Silence compiler warnings 2025-04-27 15:07:26 +03:00
kd-11
d958f8291a rsx: simplify simple_array<T>::erase_if 2025-04-27 15:07:26 +03:00
Megamouse
f435225940 Update wolfssl to 5.8.0
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-26 23:15:04 +02:00
Megamouse
e321af4a29 Update miniupnp to 2.3.9 2025-04-26 23:15:04 +02:00
RipleyTom
929a92f6c5 Avoid passing -fuse-ld to non-linking step 2025-04-26 22:48:14 +02:00
Megamouse
39d3754b18 cellVideoOutConvertCursorColor: fix and implement 2025-04-26 21:30:58 +02:00
digant73
d7ef5a85dc fix missing check on swapped item 2025-04-26 21:13:58 +03:00
digant73
519a3b5b79 fix erase_if method 2025-04-26 21:13:58 +03:00
RipleyTom
89dea9bd92 Fix IPv6 support detection
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-25 21:40:36 +02:00
elad335
ab269f6155 Warning fixes 2025-04-25 19:52:38 +03:00
elad335
dcc263ca5d SPU Image Finder Fixes 2025-04-25 19:52:38 +03:00
Megamouse
c2a5ac96cd Fix some warnings
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-25 11:10:07 +02:00
Megamouse
85a4c5eb93 Remove some obsolete pragmas 2025-04-25 11:10:07 +02:00
kd-11
cd2098fad7 vk: Fix copypasta causing incorrect buffer to be released by GC
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-25 04:01:47 +03:00
kd-11
7c538873b6 vk: Properly initialize EXT_multidraw functionality 2025-04-25 04:01:47 +03:00
kd-11
ebcf403f4a vk: Fix a rare GPU timeline UAF when replacing buffer views
- Might fix DEVICE_LOST errors observed on NV cards
2025-04-25 04:01:47 +03:00
kd-11
417cefa059 rsx: Fix static ringbuffer allocator logic 2025-04-25 04:01:47 +03:00
Megamouse
1960b5a605 hotfix: fix parentheses when saving some files
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-04-23 16:27:17 +02:00
kd-11
c401c0f9db vk: Get rid of multidraw indirection buffer 2025-04-23 16:01:17 +03:00
kd-11
a152bb1123 vk: Fix bug preparing multidraw command details 2025-04-23 16:01:17 +03:00
kd-11
7c27b7b727 rsx: Do not consume draw call barrier iterator when executing deps 2025-04-23 16:01:17 +03:00
kd-11
f3f1a2bb5d rsx: Cache draw subranges storage 2025-04-23 16:01:17 +03:00
Megamouse
b2feff7d38 Qt: implement music player dialog for music handler tests
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-23 08:14:59 +02:00
Megamouse
22c184bf75 cellMusic: improve logging 2025-04-23 08:14:59 +02:00
elad335
5ca5b54bf6 Fix sceNpTrophyRegisterContext
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-22 16:29:21 +03:00
kd-11
a928e8a3db types: Fix comment
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-04-20 17:50:01 +02:00
kd-11
2e624789ff vk: Properly initialize multi draw extension 2025-04-20 17:50:01 +02:00
kd-11
ef95fa9f5f rsx: de-uglify buffer upload restructure 2025-04-20 17:50:01 +02:00
NefariousTechSupport
cecf92e5b8
Copy debug self elf properly (#17070)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
In 7de2869a53 this was changed to be a bit more safe, however it was reading from offset 0 instead of where the real elf started, meaning every debug self would just fail to load immediately.
2025-04-20 10:12:19 +03:00
elad335
8437a5f5ac PPU Debugger/Memory: STDCX/STWCX breakpoints, make vm::_ref const
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-19 16:14:00 +03:00
kd-11
564c903fbd rsx: Fix arm64 build
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-19 01:04:00 +03:00
kd-11
268de3cd24 rsx/vk: Retire the concept of heap being in "critical" state
- We waste a lot of time trying to manage that. We just swap out the buffer anyway as long as the client has enough RAM.
- This was more of an issue in early days when corrupt allocation requests were common trying to take gigabytes in one draw.
2025-04-19 01:04:00 +03:00
kd-11
d20f48f876 vk: Fix extension wrangling 2025-04-19 01:04:00 +03:00
kd-11
88e2a3761c vk: Rework multi-heap health checks for performance 2025-04-19 01:04:00 +03:00
kd-11
e136c2eadf vk: Rework heap checks to be explicit 2025-04-19 01:04:00 +03:00
kd-11
b2b50f5e82 vk: Optimize heap check iterator
- Significant boost in some scenarios
2025-04-19 01:04:00 +03:00
kd-11
26a7e9653f rsx: Optimize static heap allocations 2025-04-19 01:04:00 +03:00
kd-11
76948b6364 vk: Use robin_hood for renderpass caches 2025-04-19 01:04:00 +03:00
kd-11
0f57624a61 vk: Rework extension wrangling 2025-04-19 01:04:00 +03:00
kd-11
8aaf2f8577 vk: Implement EXT_multi_draw support 2025-04-19 01:04:00 +03:00
kd-11
8ce8410a5b vk: Use garbage collector to handle buffer views
- Legacy stuff left over from almost a decade ago
2025-04-19 01:04:00 +03:00
kd-11
a0ce9e52fa vk: Refactor the heap manager 2025-04-19 01:04:00 +03:00
kd-11
53288309a5 vk: Add automatic heap management 2025-04-19 01:04:00 +03:00
Nick Renieris
275f7e15c0 PPU: Fix memory write breakpoints for 13 instructions
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Specifically: `STVX`, `STVXL`, `STDBRX`, `STWBRX`, `STFSX`, `STFSUX`, `STFDX`, `STFDUX`, `STHBRX`, `STFS`, `STFSU`, `STFD`, `STFDU`.

Closes https://github.com/RPCS3/rpcs3/issues/17062.
2025-04-18 20:52:37 +02:00
elad335
7de2869a53 Implement sys_spu_image_open_by_fd
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-18 13:53:50 +03:00
elad335
ab7a1a6ec4 sys_spu: Fix sys_spu_image_open 2025-04-18 13:53:50 +03:00
Antonino Di Guardo
b8d1d7cdf1
Fix game list update for auto-detection VFS games folder (#17051)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-17 12:14:54 +02:00
Megamouse
8b2b74c34b Qt: Add checkboxes to vfs list to make selection more user friendly 2025-04-17 07:23:36 +02:00
Ani
a004ebfffb git: Remove unused code
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-16 13:36:56 +03:00
Megamouse
b51d6e9d92 Qt: use image_change_callback function to ensure the member is valid
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-16 03:19:15 +02:00
Megamouse
b96e41285c Qt: use unique_ptr in qt_video_source 2025-04-16 03:19:15 +02:00
Megamouse
9295e6f5c8 Qt: Fix gamelist icon after stopping a movie
Do not set an icon if it's null. This happens because we save memory
by clearing the pixmap of non-movie items.
Also don't stop the movie here, as it should be stopped already anyway.
2025-04-16 03:19:15 +02:00
Megamouse
e80809f629 Qt: fix game list image reset after a movie was stopped
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-15 18:47:54 +02:00
elad335
5ac4db752d sceNpTrophy: Send signals asynchronously
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-14 15:08:01 +03:00
Megamouse
746b438500 Qt/input: accumulate button presses between gui refresh
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Fixes dropped input between gui refreshes
2025-04-14 09:31:52 +02:00
Fredrik Hubinette
0964c0356b Add Menu Key (used by 8bitdo Pro 2 controller 2025-04-14 07:36:17 +02:00
kd-11
7500d16524 rsx: Avoid reallocating scratch buffers every draw call when processing instancing data
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-14 03:16:37 +03:00
kd-11
b3bdff741c rsx: Fix simple_array<T>::erase_if 2025-04-14 03:16:37 +03:00
Megamouse
fcb6bc70f8 evdev: log positive axis config
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-13 11:40:01 +02:00
Megamouse
9c5b3a2300 Update to Qt 6.9.0
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-04-11 23:11:38 +02:00
kd-11
2d7ffaf07f vk: Fix typo in NVIDIA-specific stencil unresolve path
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-11 14:05:28 +03:00
Megamouse
9b7d5cd1a9 Qt: fix visibility check of table widget items
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-04-10 02:23:16 +02:00
RipleyTom
bcb5041df2 use fixed uruntime version 2025-04-10 00:22:04 +02:00
Escary
235707278f
reduce appimage size 2025-04-09 21:17:16 +02:00
Ani
db85595124 rsx: Replace robin_hood with ankerl::unordered_dense 2025-04-09 20:55:35 +02:00
Ani
15758171f0 glext: Update from 2022.05.30 to 2025.02.03 2025-04-09 20:19:42 +02:00
kd-11
d08610882a rsx: Remove superfluous log
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
- Back-to-back range with no barrier will already be logged in draw_call::append
2025-04-09 16:17:51 +03:00
kd-11
21434c471b rsx: Track command barrier types during recording for faster instancing compatibility checks 2025-04-09 16:17:51 +03:00
elad335
87d8bebd0d PPU LLVM: Fixup MTFSF
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-08 11:29:06 +03:00
Ani
e4d84e2c1c Qt: Fix multi package install dialog on Linux
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-08 09:28:10 +02:00
Ani
16036e0419 ppu: Remove redundant checks on MTFSF
Closes #11176
2025-04-08 07:04:37 +02:00
Ani
58714d8c68 docker: Update ffmpeg to 7.1.1 2025-04-08 06:43:28 +02:00
Megamouse
ddf684c4d2 Update curl to 8.13.0
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-07 21:37:59 +02:00
Megamouse
daa76be77e Update soundtouch to 2.4.0 2025-04-07 21:37:59 +02:00
Megamouse
600e460416 Fix compilation with newer Qt 2025-04-07 21:37:59 +02:00
Megamouse
e095904e1b cellMic: Use full device name registration and comparison 2025-04-07 20:38:59 +02:00
Megamouse
599d5c17a0 cellMic: Try to open device with different sample rates 2025-04-07 20:38:59 +02:00
elad335
6f98b8c5ae Silence sys_spu_thread_write_spu_mb
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-07 17:54:27 +03:00
elad335
eb2eb9ccf5 Improve lwmutex_lock error logging 2025-04-07 17:54:27 +03:00
elad335
19d01835d3 sys_spu: Fix HW schedular limits 2025-04-07 17:54:27 +03:00
kd-11
f38a61bdb3 Try msvc workaround
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-07 00:46:09 +03:00
kd-11
ed280cdbfe vk: Use dynamic constant buffer offset via push constant 2025-04-07 00:46:09 +03:00
kd-11
66909168ac vk: Silence compiler warning 2025-04-07 00:46:09 +03:00
kd-11
38a1c8becb vk: Use dynamic constants offset for transform constants 2025-04-07 00:46:09 +03:00
kd-11
1816a1eb34 vk: Switch transform constants from UBO to SSBO 2025-04-07 00:46:09 +03:00
kd-11
dad9a2b916 vk: Add support for dynamic buffer offsets 2025-04-07 00:46:09 +03:00
Ani
b3bbd939e3 appimage: Do not bundle libQt6OpenGL 2025-04-06 19:37:36 +02:00
Ani
cc84ebf8c2 appimage: Do not bundle Qt6VirtualKeyboard 2025-04-06 19:37:36 +02:00
Ani
2438e975e7 appimage: Do not bundle unused Qt6 libraries 2025-04-06 19:37:36 +02:00
elad335
04d833d3e6 Fix #17000
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-06 08:58:24 +03:00
elad335
2f872b3755 vm.cpp: Remove redundant cache hint 2025-04-06 08:58:24 +03:00
elad335
bd1f5ff194 PPU LLVM: Fix VMAXFP, VMINFP 2025-04-06 08:58:24 +03:00
Ani
613212f9e1 .github: Remove outdated pull request template
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-04-04 23:10:21 +02:00
Ani
4aff4a9c82 README: Update VC_redist from 2019 to 2022 2025-04-04 23:10:21 +02:00
Ani
264af550d5 .github: Update log path in issue templates 2025-04-04 23:10:21 +02:00
Ani
822546bf7d Discord: Use vanity URL 2025-04-04 23:10:21 +02:00
nastys
2ac2439c33 Fix macOS SDK path
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-04 05:38:48 +02:00
Megamouse
37dbd77628 Update FAudio to 25.04
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-03 07:59:49 +02:00
Megamouse
733ceada5e Update SDL to 3.2.10 2025-04-03 07:59:49 +02:00
Megamouse
847f92956f Qt: remove discontinued QWinTaskbar code
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Also remove some strange relics from the includes
2025-04-02 10:48:09 +02:00
Megamouse
73f2aaf9d8 Windows: fix updating with unicode user name
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-04-01 14:31:21 +02:00
Zion Nimchuk
c86a250795 Fix mac build with cmake 4.0 2025-04-01 09:02:27 +03:00
Zion Nimchuk
c6170aa4c7 Update Windows ccache version 2025-04-01 09:02:27 +03:00
Zion Nimchuk
89ae495c36 Update docker cmake to 3.28 and update minimum to 3.28, as well as remove uneeded minimum 2025-04-01 09:02:27 +03:00
Megamouse
5526c33d69 Review fixes + warning fixes
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-31 18:27:54 +02:00
Megamouse
e816636676 overlays: play ICON1.PAM in save data list if possible 2025-03-31 18:27:54 +02:00
Megamouse
40e8bc530c overlays: propagate item selection to children 2025-03-31 18:27:54 +02:00
Megamouse
9684467dc0 overlays: implement video overlay class 2025-03-31 18:27:54 +02:00
Megamouse
8e83fd7d50 Qt/overlays: expose qt_video_source_wrapper as emu callback 2025-03-31 18:27:54 +02:00
Megamouse
fac1cc57d7 Overlays: set layouts dirty if children are dirty
This fixes updates of widget items in lists.
Only set text dirty if it changed.
Properly mark spacers as compiled.
2025-03-31 18:27:54 +02:00
Megamouse
6511e0f3e6 cellSaveData: properly initialize SaveDataEntry
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-31 12:21:40 +02:00
Megamouse
9c1c932e68 Update OpenAL to 1.24.3 2025-03-31 12:01:55 +02:00
Megamouse
82c85c1a9c Qt: disable shortcuts completely if disable kb hotkeys is enabled 2025-03-31 11:41:11 +02:00
Megamouse
7cec2d0e18 Qt: set audio hotkey defaults to additionally need Ctrl pressed 2025-03-31 11:41:11 +02:00
Ani
2f8ed1a6bd rpcs3_version: Bump to 0.0.36
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-30 21:45:32 +02:00
Megamouse
781da9dc59 input: disable pad vibration after no new data was sent for 3 seconds
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
This is supposedly how the lib does it.
2025-03-30 20:42:15 +02:00
Vestral
1e6a4dc5c8 Fix discord after #16885 2025-03-30 19:58:28 +02:00
Megamouse
282fbcc3e5 Qt: fix wrong save data movie playing when selecting a different entry
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-30 12:35:16 +02:00
Megamouse
cd9c156937 7z: log error code when opening the file 2025-03-30 12:35:16 +02:00
DH
cd840ef70a LLVM JIT: do not produce broken binaries on crash 2025-03-30 08:18:09 +03:00
Zion Nimchuk
55190c2125 Update Qt to 6.8.3 and update clang compiler
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-29 23:21:54 +01:00
Megamouse
01cdc83aeb Qt: play ICON1.PAM in save data manager details
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-29 15:09:25 +01:00
Megamouse
b9e0a36816 Qt: Add qt video source class for more generic video playback 2025-03-29 15:09:25 +01:00
Megamouse
fccb761ef2 Qt: play ICON1.PAM in save data manager 2025-03-29 12:18:18 +01:00
Megamouse
0ffb4e62e6 Qt: pass game list events to base class 2025-03-29 12:18:18 +01:00
Megamouse
bd1102d3b7 Qt: simplify icon_ready_callback in game list 2025-03-29 12:18:18 +01:00
Megamouse
91427646f5 VulkanMemoryAllocator: Match current master commit
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-28 20:41:41 +01:00
Megamouse
596e6cc2c3 Add VulkanMemoryAllocator v2.3.0 submodule 2025-03-28 20:41:41 +01:00
elad335
9c99e75939 SPU Debug: WrDec and LSA view
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Report the last written value to WrDec.
2025-03-28 19:56:54 +03:00
elad335
047f71b434 PPU/cellSpurs: MGS4: Fix cellSpursAddUrgentCommand race condition
cellSpursAddUrgentCommand searches in 4 slots for an empty slot to put the command at.
At first, it seems to do so unordered.

Meanwhile, on SPU side, it expects an order between all the commands because it pops them it in FIFO manner.
Not keeping track of how many commands are queued in total.

After second observation of cellSpursAddUrgentCommand, something odd comes takes places here.
Usually, reservation loops are individual and are expected to be closed without any changes of the previous loop affected by the proceeding one.
But in this case, after a single failure, the entire operayion is reset, a loop of 4 reservation operations suddenly is reset completely.

This makes one wonder if it the HW expects sometjing else here, perhaps it caches the reservation internally here?
After some adjustments to LDARX and STDCX to cache the reservation between succeeding loops, Metal Gear Solid 4 no longer freezes!
2025-03-28 19:56:54 +03:00
elad335
91b1ec6d5c SPU LLVM: Dump some funcs 2025-03-28 19:56:54 +03:00
Ani
a7df3cfb40 config: Set default Driver Wake-Up Delay to 0 2025-03-28 18:46:41 +03:00
Megamouse
949a80dc0a Loader: deny boot if the firmware is too old 2025-03-28 18:18:09 +03:00
Ian Carpenter
095c884331 unpkg: Restore support for PSP/Vita packages 2025-03-28 14:43:38 +03:00
Ani
32a8bcf525 config: Increase max vblank rate to 6000
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-28 10:47:23 +03:00
Megamouse
a469bfd4da overlays: hide friends list in home menu if rpcn is not configured
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-27 18:08:30 +01:00
Megamouse
6921684cd9 Update Qt to 6.8.3
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-27 09:25:02 +01:00
Megamouse
76c069e8bf VS/MSVC: Move LTCG and GL to CI only
This was taking too long on my local builds after simple code changes.
2025-03-27 04:35:27 +01:00
Megamouse
b571978f24 Windows/Qt: do not deploy dx and ffmpeg libs
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-27 02:33:32 +01:00
Megamouse
b8236e183c cellMic: log ALCenum error string 2025-03-27 00:51:15 +01:00
Megamouse
2a7e957c61 Qt: fix custom icons when "Prefer game data icons" is set
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-26 18:33:51 +01:00
Megamouse
467c4ba2cf Qt: add option to prefer game data icons in the game list 2025-03-26 12:07:59 +01:00
RipleyTom
324af04426 Set PSN to disconnected when net status is disconnected
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-25 21:46:38 +01:00
Megamouse
1b5d9a34df overlays/rpcn: Create list even if rpcn connection failed 2025-03-25 18:40:25 +01:00
Malcolm Jestadt
c52920755a SPU LLVM: Don't use vperm2b256to128 outside of CPUTranslator.h
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
- The vperm2b function uses vperm2b256to128 when it's ideal
2025-03-25 10:42:02 +02:00
Megamouse
faef63e8a7 patches: fix c_utf8 validation
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-24 21:44:23 +01:00
kd-11
ff135384ef Fix for GCC builds
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-24 17:00:07 +03:00
kd-11
a51602018e rsx: Code cleanup and fix fragment texture dirty trigger 2025-03-24 17:00:07 +03:00
kd-11
1616942943 rsx: Always execute pre-draw pipeline analysis regardless of flags 2025-03-24 17:00:07 +03:00
kd-11
ba7b7b65a1 rsx: Bypass sampling cache logic when dealing with host generated textures 2025-03-24 17:00:07 +03:00
RipleyTom
40ff182c31 Fix p2p binding to vport 0
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-03-23 06:08:09 +01:00
Whatcookie
d9071abd8b
Utils: Remove AVX10-256 detection (#16904)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
- Intel recently removed 256b AVX10 from the AVX10 spec.
2025-03-22 13:28:45 +02:00
Megamouse
b4f453f687 overlays: don't check for hdd dirs if we play a disc game
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-21 20:47:45 +01:00
Megamouse
4c742f7742 Fix typo 2025-03-21 20:47:45 +01:00
Megamouse
fda51920b7 overlays: prefer overlay_picture over content_icon 2025-03-21 20:47:45 +01:00
Megamouse
4905fda371 Qt: Don't fetch ICON0.PNG from game data for disc games
ICON0.PNG is not supposed to be updateable, so we can ignore the hdd0 dir for disc games in that case
2025-03-21 20:47:45 +01:00
Megamouse
1ae1288a88 overlays: Look for the overlay in the same dir as the background 2025-03-21 20:47:45 +01:00
Megamouse
6fb0e991ea overlays: Don't use ICON0.PNG from hdd0 if the game is a disc game
ICON0.PNG is not supposed to be updateable, so we can ignore the hdd0 dir for disc games in that case
2025-03-21 20:47:45 +01:00
Megamouse
650176fac7 overlays: Simplify game content search 2025-03-21 20:47:45 +01:00
Megamouse
95aad6ceb5 overlays: adjust size and position of overlay image 2025-03-21 20:47:45 +01:00
Megamouse
7cd5d812d2 overlays: add background overlay image 2025-03-21 20:47:45 +01:00
Megamouse
b2ff24453c overlays: fix background image logic
Also make the path getter more generic
2025-03-21 20:47:45 +01:00
Megamouse
12eacfa67b overlays: use std::string instead of raw path argument
It will be converted to string anyway
2025-03-21 20:47:45 +01:00
Megamouse
cd25e91321 VS/MSVC: Enable LTCG and GL on release builds 2025-03-21 16:35:53 +01:00
Megamouse
518bfeca3f Update libusb to 1.0.28
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-20 23:52:10 +01:00
Megamouse
76495f07b8 Qt: Remove supporters from translations 2025-03-20 08:52:08 +01:00
Megamouse
ccecd1a627 Qt: only show shortcut confirmation once 2025-03-20 08:52:08 +01:00
Megamouse
8f3eff293d Remove unnecessary localization 2025-03-20 08:52:08 +01:00
Megamouse
806c9230cd Fix typo 2025-03-20 08:52:08 +01:00
Megamouse
24b6b6cad5 Qt: fix handler not found in pad settings after changing language 2025-03-20 08:52:08 +01:00
Megamouse
971fd40353 Remove some useless translations 2025-03-20 08:52:08 +01:00
Megamouse
2aba8c639e Fix typo 2025-03-20 08:52:08 +01:00
Megamouse
1a51ce1e66 SPU: Add Disable SPU GETLLAR Spin Optimization checkbox 2025-03-18 09:30:28 +02:00
Hugo Locurcio
1398e7702b Improve BUILDING.md documentation
- Add llvm-devel dependency to Fedora (required to compile).
- Recommend using the Ninja generator on Linux to speed up compilation
  (and mention it in the package installation lists).
- Use shorter CMake commands and use the standard `build` folder as a target.
- Use `--recursive` in Git clone to automatically fetch submodules.
- Fix path of output binary file on Linux.
2025-03-18 02:54:49 +01:00
Vestral
a45f604cd8 Fix discord-rpc build when ASLR is enabled 2025-03-18 02:32:05 +01:00
Megamouse
ec29650029 Fix warning 2025-03-17 23:11:31 +01:00
Megamouse
4b31e34ea4 Qt: use white checkmarks in Darker Style 2025-03-17 23:11:31 +01:00
Megamouse
ae83c28bc8 Qt: Simplify hover movie code 2025-03-17 14:41:08 +01:00
Megamouse
58327ca23c Qt/optimization: Don't look for PAM files if the game has a hover gif 2025-03-17 14:41:08 +01:00
Megamouse
5b540aed73 Qt: Do not use gamedata icon if game has custom icon 2025-03-17 14:41:08 +01:00
Megamouse
6e080044a0 Qt: fix code style of some variables 2025-03-17 14:41:08 +01:00
Megamouse
42ba0b6271 Qt: Use localized game icons and titles 2025-03-17 00:47:43 +01:00
kd-11
a1fa8dd701 config: Revert default shader compiler to async with draw-skip 2025-03-16 16:48:20 +01:00
kd-11
aea1efd5f2 rsx: Fix instancing constants lookup layout when running interpreter 2025-03-16 16:33:39 +03:00
kd-11
5ae05e26c4 vk: Implement instancing when running in interpreter mode 2025-03-16 16:33:39 +03:00
kd-11
023221bd3b gl: Reimplement driver capabilities detection in a more sane way 2025-03-16 16:33:39 +03:00
kd-11
14575f3efd rsx: Always initialize CC register in FP interpreter 2025-03-16 16:33:39 +03:00
kd-11
9f3eb33d80 gl: Double instancing buffer size to improve frametimes 2025-03-16 16:33:39 +03:00
kd-11
225d0b9482 gl: Support transform instancing in the shader interpreter 2025-03-16 16:33:39 +03:00
kd-11
65c0d3d425 gl: Add support for hardware instancing 2025-03-16 16:33:39 +03:00
kd-11
3d3fc2f3cd rsx: Fix cache invalidation when instancing state changes 2025-03-16 16:33:39 +03:00
Malcolm Jestadt
f9a72e8d75 SPU LLVM: Preserve sign on inf to NaN conversion in spu_re_acc with vfixupimmps 2025-03-15 10:46:08 +02:00
Attila Fidan
7b212e0e57 sys_usbd: Fix null pointer deref on destruction 2025-03-13 01:36:09 +01:00
Jan Beich
a108ce8015 CI: upgrade FreeBSD to 13.5
FreeBSD doesn't support /latest and /quarterly package repos on EOL
versions. 13.4 reaches EOL on 2025-06-30, so avoid CI breakage.
2025-03-12 23:35:59 +01:00
Megamouse
ff21a05c96 Always run Actions, we need them for merges 2025-03-12 20:26:06 +01:00
Megamouse
25eb869d5f Readme: Improve build tags 2025-03-12 20:26:06 +01:00
Megamouse
ff40128df6 Qt: Detach markup from dialog translations 2025-03-12 18:49:24 +01:00
kd-11
b2ed787c3a rsx: Invalidate program cache hint if the current vertex or fragment program is re-evaluated 2025-03-12 15:36:29 +03:00
Megamouse
ec5b2bc8d2 Fix missing enum in switch case 2025-03-12 01:08:49 +01:00
Megamouse
3a71da35a9 Fix redundant forward declaration warning 2025-03-12 01:08:49 +01:00
Megamouse
4c788abad1 Use named_thread in gui_pad_thread 2025-03-12 01:08:49 +01:00
Megamouse
3737cc37f6 Qt: Hide interpreter_only unless it is selected or the debug mode is active 2025-03-11 06:58:23 +01:00
Megamouse
d0c2cb7ae1 main: Fix some warning 2025-03-11 06:58:23 +01:00
DH
db945f6aed android: do not invalidate swapchain on VK_SUBOPTIMAL_KHR
Workaround
2025-03-10 21:09:27 +01:00
Megamouse
b3f5ed55a1 Set vulkan to default renderer whenever we have vulkan support 2025-03-10 21:09:27 +01:00
Megamouse
fa5a16e9fc hid_init: use hid_error in log message 2025-03-10 21:09:27 +01:00
DH
0c233c6578 [android] hid: enumerate by vendor/product ids 2025-03-10 21:09:27 +01:00
DH
8100779512 hid: add support of android devices 2025-03-10 21:09:27 +01:00
DH
d766baef12 fs::file: implement release_handle
cleanup
2025-03-10 21:09:27 +01:00
DH
95d0cb18e4 Coding style issues fixes
Thanks @Megamouse
2025-03-10 21:09:27 +01:00
DH
976b0a8f1d cpu stats: do not try parse /proc/stat on android 2025-03-10 21:09:27 +01:00
DH
919cb8e05c android: atomic: do not test SYS_futex_waitv syscall 2025-03-10 21:09:27 +01:00
DH
cac068dad9 rsx: implement android swapchain 2025-03-10 21:09:27 +01:00
DH
7520c09087 rsx: reduce shaders_cache::unpacked_type size for android 2025-03-10 21:09:27 +01:00
DH
edf096fc13 vm: do not check overcommit_memory on android 2025-03-10 21:09:27 +01:00
DH
2ebf257f84 vm: removed c_page_size, it cannot be used by globals 2025-03-10 21:09:27 +01:00
DH
57e7cee84e android: cfg: vulkan renderer is default 2025-03-10 21:09:27 +01:00
DH
adaf24310d add missed include to PUP.h 2025-03-10 21:09:27 +01:00
DH
94f52d6dc0 android: jit: teach fallback_cpu_detection provide meaningful results for aarch64 2025-03-10 21:09:27 +01:00
DH
3080b55d02 cfg: remove string::get() 2025-03-10 21:09:27 +01:00
DH
bbb682a440 unpkg: allow package_reader creation with provided fs::file 2025-03-10 21:09:27 +01:00
DH
f3d988d8ab fs::file: add from_native_handle constructor
fs::get_*_dir tweaks for android
2025-03-10 21:09:27 +01:00
DH
2c122a4401 llvm: disable extra targets for android
explicitly specify native target, llvm determines wrongly if cross compiler used
2025-03-10 21:09:27 +01:00
DH
26ce38a4ac 3rdparty/fusion: Always do build in release mode
this library has python numpy dependency in debug build
2025-03-10 21:09:27 +01:00
DH
5084fb82b8 Android stuff 2 2025-03-10 21:09:27 +01:00
DH
798c194025 android stuff 2025-03-10 21:09:27 +01:00
kd-11
11e214f332 rsx: Handle out-of-bounds read/writes from FIFO register IO 2025-03-10 16:07:26 +03:00
AniLeo
ddd3ac3663 Settings: Move 'Max Shader Compile Threads' next to the equivalent LLVM setting 2025-03-10 08:16:19 +01:00
AniLeo
bacce9bb37 Settings: Move 'Vulkan Queue Scheduler' to Debug 2025-03-10 08:16:19 +01:00
AniLeo
aa819c8b97 Settings: Move 'Disable On-Disk Shader Cache' to Debug 2025-03-10 08:16:19 +01:00
AniLeo
af768d5c22 Settings: Move 'Disable Asynchronous Memory Manager' to Debug 2025-03-10 08:16:19 +01:00
AniLeo
2bf5ae3272 Settings: Move 'SPU Profiler' to Debug 2025-03-10 08:16:19 +01:00
AniLeo
a074b14631 Settings: Move 'PPU Vector NaN Fixup' to Debug 2025-03-10 08:16:19 +01:00
AniLeo
ac7d53cc37 Settings: Specify FSR 1 2025-03-10 08:16:19 +01:00
AniLeo
6d46d45983 Settings: Default 'Shader Mode' to Async with Interpreter 2025-03-10 08:16:19 +01:00
AniLeo
eea2f19d82 Settings: Move 'SPU Block Size' to the middle column 2025-03-10 08:16:19 +01:00
kd-11
2dfbab457a rsx: Reupload surface if the surface cache denies knowledge of it 2025-03-09 22:01:49 +03:00
Zion Nimchuk
5e5f82d1a2 Set CI msbuild verbosity to minimal to reduce spam 2025-03-09 11:02:57 +02:00
Elad
5e4637e15c SPU LLVM: Subtract Timebase from decrementer 2025-03-09 07:42:59 +02:00
FlexBy420
a3d2e93b14 move script to .ci/generate-qt-ts.sh 2025-03-08 23:47:04 +01:00
FlexBy420
100454398c Make suggested changes and remove unnecessary package 2025-03-08 23:47:04 +01:00
FlexBy420
cce43beeae Apply suggestions from code review
Co-authored-by: Megamouse <studienricky89@googlemail.com>
2025-03-08 23:47:04 +01:00
FlexBy420
ebcb61b34b fix the branch name in qt-ts.yml 2025-03-08 23:47:04 +01:00
FlexBy420
47b880fa8d Move ts generator job to seperate workflow file 2025-03-08 23:47:04 +01:00
FlexBy420
cd76f05a86 Create qt-ts.yml 2025-03-08 23:47:04 +01:00
FlexBy420
9173fc9815 fix branch name in .ts job 2025-03-08 23:47:04 +01:00
FlexBy420
7df5cb84b5 add a job for generating translation template file (.ts) 2025-03-08 23:47:04 +01:00
kd-11
e6b3c2061e rsx: Fix boundary seek logic for FIFO addresses 2025-03-09 01:36:26 +03:00
schm1dtmac
563a3d3587 Target macOS 14 instead of 13 (fixes camera) 2025-03-09 01:02:49 +03:00
kd-11
3be1e0b6ff rsx: Clean up and simplify texture register manipulation tests 2025-03-08 22:10:55 +03:00
kd-11
93899bf5a9 rsx/FIFO: Reimplement grabbing command args as a contiguous pointer
- Allows grabbing indefinite size of buffer as long as the data is contiguously mapped.
2025-03-08 22:10:55 +03:00
kd-11
ec120d1cbb rsx: Add stubs for FP rehash checks on barrier acquire 2025-03-08 22:10:55 +03:00
kd-11
df7a2ab467 rsx: Unify fragment texture config changes dirty bit tracking
- Reverts unnecessary changes to dirty tracking.
- The GPU keeps a separate set of details, so all dirty bits are treated equal.
2025-03-08 22:10:55 +03:00
kd-11
a39a743abe rsx/prog: Fix compiler warning 2025-03-08 22:10:55 +03:00
kd-11
eca86ad449 rsx: Add program cache lookup ellision rate to overlay 2025-03-08 22:10:55 +03:00
kd-11
a1c8f3a528 rsx/prog: Use a proper cache hint key instead of disjointed counters 2025-03-08 22:10:55 +03:00
Elad
26495a8455 SPU: Fixup 2025-03-08 14:21:57 +02:00
Elad
32df7315be RSX: Do not invalidate FP analysis on same register writes 2025-03-08 14:21:57 +02:00
Elad
7995181235 RSX: Return FP shader as is if no changes were made 2025-03-08 14:21:57 +02:00
Elad
75dc2a12e2 RSX: Return VP shader as is if no changes were made 2025-03-08 14:21:57 +02:00
Elad
ae39c5b8cb RSX: Optimize vertex program ucode invalidation 2025-03-08 14:21:57 +02:00
Megamouse
eb43fbbb2a Update SDL to 3.2.8 2025-03-08 10:03:00 +01:00
Elad
e4ed5c47a3 Fixup 2025-03-08 10:48:21 +02:00
Elad
e4b9a21acc SPU Analyzer: Fix for value propagation 2025-03-08 10:36:26 +02:00
Whatcookie
bfb9dfea7e
RSX: ProgramStateCache loops optimizations 2025-03-07 09:54:12 +02:00
Elad
8ed2089070 RSX: Fix UB in FIFO_control::get_current_arg_ptr() 2025-03-07 09:41:52 +02:00
JoãoPaulo
583ec5d819
Update FW 4.92 Latest Version (#16811)
Update FW 4.92 Latest Version
Updates the latest FW version according to: https://www.playstation.com/en-us/support/hardware/ps3/system-software/
List of changes:
This system software update improves system performance.
2025-03-05 15:00:07 +02:00
kd-11
59280a133c vk: Do not force strict query scopes by default 2025-03-05 14:40:35 +03:00
Megamouse
ba12de867e static analysis: fix memory leak in decompress
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-03-05 00:12:30 +01:00
Megamouse
ca3d02fc61 static analysis: ensure is always false 2025-03-05 00:12:30 +01:00
Megamouse
a49c4c7682 static analysis: duplicate assignment 2025-03-05 00:12:30 +01:00
Megamouse
4f52c67566 static analysis: suspicious code 2025-03-05 00:12:30 +01:00
Megamouse
7a6a96254c static analysis: remove unused overrides 2025-03-05 00:12:30 +01:00
Megamouse
6abb863a54 static analysis: std::move 2025-03-05 00:12:30 +01:00
Megamouse
e8463403f5 static analysis: uninitialized variables 2025-03-05 00:12:30 +01:00
Megamouse
815a4e7dc1 static analysis: less references 2025-03-05 00:12:30 +01:00
Megamouse
df2f68da44 static analysis: more const ref 2025-03-05 00:12:30 +01:00
Megamouse
a8fc3f5f74 static analysis: more const 2025-03-05 00:12:30 +01:00
Megamouse
d3c5cc7b13 ci: Use more variables for LLVM and QT 2025-03-04 23:44:45 +01:00
Megamouse
760e43ad2c VS: move LLVM AdditionalDependencies to rpcs3_default.props 2025-03-04 23:44:45 +01:00
Megamouse
229734e45f VS: add some missing filters 2025-03-04 23:44:45 +01:00
RipleyTom
66952fe301 Add memory breakpoints
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
RPCS3 needs to be compiled with -DHAS_MEMORY_BREAKPOINTS=ON for it to be available
2025-03-04 15:41:36 +01:00
Megamouse
cb659474d9 overlays: fix friends/trophy list input on paused emulation
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-03 18:21:35 +01:00
Megamouse
d429776418 Qt/patches: Only consider bootable games 2025-03-03 17:49:31 +01:00
Megamouse
d034f6a77f Qt/patches: move game list loop to patch manager
This deduplicates some code
2025-03-03 17:49:31 +01:00
Malcolm Jestadt
1920aee415 RSX: Fix issue where linux builds could hit illegal instruction on machines without AVX-512
- Place avx-512 function attributes in their own functions
2025-03-03 15:58:55 +03:00
Elad
783079266e Emulator: Implement config CLI args, add barrier for host CLI args
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-03 06:54:00 +02:00
Megamouse
bd41774960 overlays/osk: implement horizontal scroll
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-02 23:44:08 +01:00
Megamouse
4aa25285a3 overlays: use thread local static vector in get_glyph_data 2025-03-02 23:44:08 +01:00
Megamouse
7fd1f5b5d3 Fix some warning 2025-03-02 23:44:08 +01:00
Megamouse
72ee5ed10d overlays: add ability to hide hidden trophies 2025-03-02 23:02:22 +01:00
Megamouse
048a44cbe5 overlays: add getter for selected entry 2025-03-02 23:02:22 +01:00
Megamouse
6f5f7ece06 overlays: fix and optimize layout exit loops 2025-03-02 23:02:22 +01:00
Zion Nimchuk
b3d28e2309 Switch Windows and Linux x64 builds and deployments to GitHub Actions 2025-03-02 22:35:04 +01:00
trigger
1dc3ebf891
SPU Analyzer: A fixup for crash, TODO: proper fix
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-02 10:24:42 +02:00
Malcolm Jestadt
6bd1ab576c RSX: Use AVX-512-ICL code in get_vertecx_program_ucode_hash and in vertex_program_compare
- Code is about 4 times as fast on my zen4 machine
- Should be twice as fast on zen5 machines with full width AVX-512
2025-03-02 09:07:07 +02:00
trigger
8e6272bfee Qt: Fix boot failed dialog
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-01 20:00:21 +01:00
kd-11
0aca5e222f vk: Fix MacOS build 2025-03-01 18:02:32 +03:00
kd-11
b8411a90cd vk/swapchain: Fix WSI swapchain configuration overrides 2025-03-01 18:02:32 +03:00
kd-11
4e9365f76b vk/swapchain: Consolidate native swapchain implementation for platforms where it is not implemented
- NATIVE swapchain only matters in headless scenarios or where we otherwise cannot access WSI properly.
- It is now optional, with a stub provided when WSI is not available.
2025-03-01 18:02:32 +03:00
kd-11
602fe15641 vk/swapchain: Move platform-specific code to appropriate headers 2025-03-01 18:02:32 +03:00
kd-11
8b2e792d31 vk: Refactor swapchain into separate platform headers 2025-03-01 18:02:32 +03:00
kd-11
aca1cdf0b6 vk: Refactor instance management header 2025-03-01 18:02:32 +03:00
trigger
af23df842d
PPU: Report encrypted modules with KLIC in main file, opportunistic compilation at exit-spawn (#16743)
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-01 11:45:03 +02:00
Ani
b266e3d4bf rpcs3_version: Bump to 0.0.35
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-03-01 00:11:02 +00:00
Zion Nimchuk
4e08242074 Remove ProgramDatabase from libpng and zlib
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
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
Some checks failed
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
2025-02-27 12:32:21 +02:00
Zion Nimchuk
e97bfecb7f Deploy aarch64 builds via via GitHub Actions instead of Cirrus
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
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
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
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
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
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
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
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
Some checks failed
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.1, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.1, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.1, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Windows_Build (push) Has been cancelled
2025-02-24 10:51:09 +01:00
Darkhost1999
a44bd97cda Update QT to 6.8.2
Some checks are pending
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.1, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.1, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.1, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Windows_Build (push) Waiting to run
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)
Some checks are pending
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.0, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Windows_Build (push) Waiting to run
2025-02-23 15:39:39 +02:00
Elad
796a237128 PKG: Refactor and proper support for IDU
Some checks are pending
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.0, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Windows_Build (push) Waiting to run
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
Some checks failed
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.0, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Windows_Build (push) Has been cancelled
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
Some checks are pending
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.0, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / Windows_Build (push) Waiting to run
2025-02-19 11:14:55 +02:00
illusion0001
ec3d9a2cae Fix ARM matrix and review comments
Some checks failed
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.0, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Linux_Build (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.0, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / Windows_Build (push) Has been cancelled
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
Megamouse
1cff5b35d4 input: add vibration multiplier 2025-01-21 08:44:38 +01:00
MSuih
9c5584956e Update minimum pugixml version to 1.15 2025-01-20 17:18:09 +01:00
kd-11
2af497efbb rsx: Fix texcoord transformation bug caused by incorrect BFE usage 2025-01-19 19:31:59 +03:00
kd-11
58a09e6838 vk: Use common pipeline layout in interpreter
- Avoids the layouts going out of sync every time something changes
2025-01-19 19:31:59 +03:00
kd-11
b5b93e962b vk: Factor out common pipeline layout generator into reusable parts 2025-01-19 19:31:59 +03:00
Emma
10e0fb2b54
sys_prx: implement get_module_id_by_name, module_info_v2 (#16573) 2025-01-18 15:16:38 +02:00
Megamouse
0a6f9ed967 windows: Ignore OneDrive in PATH. It leads to false positives 2025-01-17 00:32:54 +01:00
Megamouse
a7edfa221e windows: move logs to log dir 2025-01-16 21:33:33 +01:00
Megamouse
451e953d26 windows: move config.yml and games.yml to /config/ 2025-01-16 21:33:33 +01:00
Megamouse
5c2c4a6649 input: issue basic mouse move event on window leave
This may help with moving the mouse to the screen borders in windowed mode
2025-01-16 18:27:16 +01:00
kd-11
09580594e6 rsx: Fix shader cache loading 2025-01-16 02:43:33 +03:00
kd-11
efc9ae98ed vk: Fix out-of-bounds write when emitting MSAA unresolve clear command for NVIDIA fallback 2025-01-15 11:27:04 +03:00
kd-11
7da0822419 rsx/shaders: Fix MSAA coords wrapping when input is negative 2025-01-15 11:27:04 +03:00
kd-11
e1c6df0df3 rsx: Fix dynamic constants patching when draw call is skipped
- Also adds an optimization to skip reuploads when patch occurs outside our critical range.
2025-01-15 11:27:04 +03:00
kd-11
7965a0313c rsx: Improved shader interpreter support when hw instancing is active 2025-01-15 11:27:04 +03:00
Megamouse
0cc61d0ef0 windows: check for OneDrive paths 2025-01-14 23:32:02 +01:00
Megamouse
1966171838 Use string_view in rXml 2025-01-14 21:35:57 +01:00
Megamouse
2643fbdea4 Update pugixml to 1.15 2025-01-14 21:35:57 +01:00
Megamouse
82bbb0cc05 Update libpng to 1.6.45 2025-01-14 21:35:57 +01:00
Megamouse
d91927ee97 Qt/input: allow keypresses in raw mouse handler 2025-01-14 15:52:46 +01:00
capriots
ae670c35f7 cellAtracXdec: use lv2 mutexes + conds 2025-01-14 11:32:32 +02:00
Megamouse
d1ccadbac2 cellGem: ignore intercepted input 2025-01-14 08:53:36 +01:00
Megamouse
78a661db79 input: simplify raw mouse button press handling 2025-01-14 00:00:50 +01:00
Megamouse
b65f977c54 Qt/input: fix raw mouse button assignment 2025-01-14 00:00:50 +01:00
Megamouse
1b87e186c4 cellGem: fix initial tracker done state 2025-01-10 21:53:37 +01:00
Megamouse
3eb1e6303c cellGem: Use wait_on, fix fake/mouse move tracker wait 2025-01-10 21:53:37 +01:00
Megamouse
3b8efecc52 cellGem: Use atomic wait instead of wait_for 2025-01-10 21:53:37 +01:00
Megamouse
6716d555ff cellGem: Update controllers at 10 Hz in separate thread
Some games don't use cellGemGetInfo.
Which means we had to reboot the game if the controller wasn't
connected on boot.
Updating controllers outside of the cell functions fixes this problem.
2025-01-10 21:53:37 +01:00
kd-11
27c56cde22 rsx/shaders: Track active MRT count per shader
- Also use more robust hashing to avoid collisions
2025-01-10 04:34:28 +03:00
kd-11
a635e24fc2 rsx: Default initialize vertex program fields
- Fixes a crash when RSXVertexProgram is default-initialized. This
  probably also fixes a whole class of crashes that occur when
  shader interpreter is in use since that pipeline uses a
  default-initialized stub.
2025-01-10 04:34:28 +03:00
kd-11
dce0abc8b9 rsx/fp: Re-design register write tracking
- Always collapse register writes when exporting FS outputs
2025-01-10 04:34:28 +03:00
kd-11
88e13d8326 rsx: Don't crash when invalid buffer is allocated for a shader 2025-01-10 04:34:28 +03:00
Megamouse
061be74cdb Qt: add mouse config legend to mouse move dialog 2025-01-10 00:50:02 +01:00
Megamouse
d6f2f66f2b Qt/Input: use empty string for pad_button_max_enum
Also shorten translated mouse button strings
2025-01-10 00:50:02 +01:00
Megamouse
b8d0396f71 Fix self assignment warning 2025-01-10 00:50:02 +01:00
Megamouse
a0df1e09a6 ps move: allow to configure mouse move handler buttons 2025-01-10 00:50:02 +01:00
Megamouse
7e03828f35 input: Allow mapping keys to basic mouse buttons 2025-01-09 21:59:01 +01:00
Megamouse
9407974c10 cellGem: Add more camera image conversions 2025-01-09 09:38:36 +01:00
Megamouse
3381a884d0 Fix some warnings 2025-01-08 20:02:33 +01:00
Megamouse
415c2d0795 fake move: add gyro support 2025-01-08 20:02:33 +01:00
Megamouse
92d0707291 Decrease mouse move assignment distance 2025-01-07 21:11:46 +01:00
Elad
c6f3737c2a PPU LLVM: Fixup patches enlisting in analyzer 2025-01-07 20:42:45 +02:00
Antonino Di Guardo
ec77f2ab92
Minor cleanup (#16519)
* Minor cleanup
2025-01-07 19:46:13 +03:00
Elad
0b784ff2c1 PPU LLVM: Function table dependent resolver hashing 2025-01-07 15:43:41 +02:00
Megamouse
c443326fb1 Do not re-use the old game window if the renderer changed 2025-01-06 15:49:09 +01:00
Megamouse
2ac171a30f move error_report to ErrorCodes.cpp 2025-01-06 15:49:09 +01:00
Megamouse
7369169331 Disable continuous mode if a savestate is not possible 2025-01-06 15:49:09 +01:00
Megamouse
d5470d92ec Keep game window open when loading the last savestate 2025-01-06 15:49:09 +01:00
Megamouse
cc7e7300ce Clean up old game window in case of unexpected errors 2025-01-06 15:49:09 +01:00
Megamouse
3ce4c95e61 Show message while creating savestate in continuous mode 2025-01-06 15:49:09 +01:00
Megamouse
1ab3a0bd73 RSX/Qt: Reuse gs_frame if possible 2025-01-06 15:49:09 +01:00
Megamouse
99f1f4c22a cheats: add float32 gui support 2025-01-06 10:48:00 +01:00
oltolm
41a4dd4c1c cmake: fix wolfssl 2025-01-05 23:03:00 +01:00
oltolm
1080969b51 cmake: remove "--no-quick" from windeployqt 2025-01-05 23:03:00 +01:00
Elad
6165c2d8b3 Thread.h: Fix a bug by adding thread_state::destroying_context 2025-01-05 10:01:35 +02:00
Elad
036693a14d Fix sys_config_unregister_service 2025-01-05 10:01:35 +02:00
Aleksey Komarov
c9d39ce7ae vk: Support panvk, allow creating device without textureCompressionBC
panvk supports BC1-BC3 which is all RPCS3 require, support is reported as
false since not all formats are supported
2025-01-04 20:22:05 +02:00
Aleksey Komarov
da84326bd0 vk: Add driver vendor PANVK (Mali GPU on Mesa) 2025-01-04 20:22:05 +02:00
Megamouse
f255392a75 patches: create patch path on update 2025-01-04 15:45:22 +01:00
Megamouse
af3154a0d4 Qt: delete settings_dialog 2025-01-04 15:45:22 +01:00
Megamouse
d2b96636db Qt: delete batch progress dialog after user closed it (as originally intended) 2025-01-04 11:31:25 +01:00
Megamouse
635eac7704 Qt: fix batch compilation after a game was already running
Batch compilation wasn't working if g_system_progress_canceled wasn't reset
2025-01-04 11:31:25 +01:00
Megamouse
51417cc8c3 Qt: stop batch compilation immediately on cancel 2025-01-04 11:31:25 +01:00
Elad
2614450e4b Fix IDM image serialization 2025-01-04 09:29:09 +02:00
Megamouse
8ea27b0aca Qt: workaround for crash in long accepted slot 2025-01-03 20:21:56 +01:00
Megamouse
4f76aec6b3 VS: Fix compilation with new wolfssl version 2025-01-03 20:21:56 +01:00
Megamouse
dfdb33befb Update xxHash to 0.8.3 2025-01-03 20:21:56 +01:00
Megamouse
e76bd11f53 Update Wolfssl to 5.7.6 2025-01-03 20:21:56 +01:00
Megamouse
4b4399f63f Update FAudio to 25.01 2025-01-03 20:21:56 +01:00
Megamouse
796189ce68 Update SDL to 2.30.11 2025-01-03 20:21:56 +01:00
Elad
a8f80ebfe9 sys_time.cpp: Anti TSC measures 2025-01-03 16:26:21 +02:00
Andrew Griffiths
cb3662cc4d MacOS: fix for crash in SDL_Quit w/ gamepad input 2025-01-02 18:58:24 +01:00
Megamouse
fb237dd568 Audio: Add mute/unmute and volume shortcuts
Also add auto repeat to volume shortcuts
2025-01-02 09:34:47 +01:00
Aleksey Komarov
799cb79612 qt6: QT_MIN_VER should be 6.7 because of QCheckBox::checkStateChanged
Check: https://doc.qt.io/qt-6/qcheckbox.html
2025-01-01 23:04:56 +01:00
Megamouse
1c22cc2f52 overlays: add trophy list dialog 2025-01-01 13:42:21 +01:00
kd-11
0bb2f72ee2 rsx: Flush MM queue before memory is unmapped 2024-12-31 01:52:58 +03:00
schm1dtmac
b16d267f9d Fix types 2 2024-12-30 07:29:31 +02:00
schm1dtmac
9ffa923da6 Use corresponding SI/IEC units 2024-12-30 07:29:31 +02:00
schm1dtmac
8feccffec0 Fix types 2024-12-30 07:29:31 +02:00
schm1dtmac
3a16b2e92c Report filesizes on macOS as decimal multiples
i.e. multiples of 1000
2024-12-30 07:29:31 +02:00
Elad
a8bfa6a16c SPU: Operating system LR memory signals 2024-12-29 21:01:17 +02:00
kd-11
e135012acd rsx: Properly track changes in instancing state 2024-12-29 20:53:05 +03:00
kd-11
9de6a38e13 rsx: Test vertex program flags on each draw 2024-12-29 20:53:05 +03:00
kd-11
0baf873534 Cosmetic improvements 2024-12-29 20:53:05 +03:00
kd-11
35a66fe776 rsx: Do not use global registers object in logical "firmware" units 2024-12-29 20:53:05 +03:00
kd-11
0be8a5f9f4 rsx: Handle dangling execution barriers 2024-12-29 20:53:05 +03:00
kd-11
01fe39fbb9 rsx: Fix rare crash in vertex program decompiler
- This whole decompiler mess needs a rewrite
2024-12-29 20:53:05 +03:00
kd-11
cfc124fabf rsx: Fix instancing bug when indexed addressing is used to read constants 2024-12-29 20:53:05 +03:00
kd-11
15961b353a vk: Add support for hardware instanced draws 2024-12-29 20:53:05 +03:00
kd-11
d4573e233a rsx: Fix vertex program compiler crash 2024-12-29 20:53:05 +03:00
kd-11
9307abe7f5 rsx: Move more functions from rsx thread to the draw command processor 2024-12-29 20:53:05 +03:00
kd-11
05bab8ec4c rsx: Move draw call related functions to their own class 2024-12-29 20:53:05 +03:00
kd-11
9e9ae54455 rsx: Add GLSL support for instanced rendering 2024-12-29 20:53:05 +03:00
kd-11
e696d9b324 rsx: Add code to detect instanced draw commands 2024-12-29 20:53:05 +03:00
kd-11
43e04f3fc7 Revert "rsx/vk: Implement hardware instancing (#16466)"
This reverts commit 62701154f1.
2024-12-29 20:53:05 +03:00
kd-11
62701154f1
rsx/vk: Implement hardware instancing (#16466)
* rsx: Add code to detect instanced draw commands

* rsx: Add GLSL support for instanced rendering

* rsx: Move draw call related functions to their own class

* rsx: Move more functions from rsx thread to the draw command processor

* rsx: Fix vertex program compiler crash

* vk: Add support for hardware instanced draws

* rsx: Fix instancing bug when indexed addressing is used to read constants

* rsx: Fix rare crash in vertex program decompiler

- This whole decompiler mess needs a rewrite

* rsx: Handle dangling execution barriers

* rsx: Do not use global registers object in logical "firmware" units

* Cosmetic improvements

* rsx: Test vertex program flags on each draw

* rsx: Properly track changes in instancing state
2024-12-29 17:39:47 +02:00
Megamouse
15f29eedee
Fix atomic_ptr value constructing overloads (#16473)
* Fix idm remove

idm::remove calls shared_ptr::exchange with a null_ptr.
This calls the stored object's constructor with null args.

---------

Co-authored-by: Elad <18193363+elad335@users.noreply.github.com>
2024-12-29 14:53:04 +02:00
Elad
439d665096
CELL: Fix reservation notifications 2024-12-29 11:06:44 +02:00
Megamouse
418a99a62b VS: add some missing files to solution filters 2024-12-28 23:09:51 +01:00
Megamouse
1eac13b6bf Windows: log command line args in utf8 2024-12-28 23:09:51 +01:00
Darkhost1999
e58bd419f6
Add empty hdd tmp to UI (#16462)
This option is need for those using sprx mods and amongst other homebrew reasons such as apollo savedata.
2024-12-28 22:20:22 +01:00
Megamouse
5e176a390f MacOS: silence some warnings 2024-12-28 19:58:59 +01:00
Megamouse
a49cfc5a91 Simplify some ternaries 2024-12-28 19:58:59 +01:00
Megamouse
d3fedffa6a VS: Add sysinfo_darwin.mm to filters 2024-12-28 19:58:59 +01:00
Megamouse
33c3e3fb0f fix some warning 2024-12-28 18:10:06 +01:00
Megamouse
1d23be8429 Qt: Add Operating system category 2024-12-28 18:10:06 +01:00
Elad
7a4e88c146 Savestates: Fix main_ppu_module definition 2024-12-27 22:08:28 +02:00
Elad
cfeb022340 shared_ptr.hpp: Rewrite shared_ptr to single_ptr conversion
Logic felt non-intuitive and this method should be very explicit.
2024-12-27 22:08:28 +02:00
Elad
0cc655074d serialzation.hpp: Fix add_padding 2024-12-27 22:08:28 +02:00
Elad
a5ba96e991 Fixup lv2_socket 2024-12-27 22:08:28 +02:00
kd-11
b2949f114b vk: Wrap device fault handler in SEH2 2024-12-25 01:41:23 +03:00
kd-11
e3df7bccac vk: Selectively enable extended device fault features in logical device creation step 2024-12-25 01:41:23 +03:00
kd-11
2c45438422 vk: Minor improvements to extended fault output 2024-12-25 01:41:23 +03:00
kd-11
4ef1d48c0c vk: Properly initialize device fault counts structure 2024-12-25 01:41:23 +03:00
kd-11
7b6a672c64 vk: Fix device fault extension loading 2024-12-25 01:41:23 +03:00
kd-11
883529eaf3 vk: Add support for spec-compliant query scopes 2024-12-25 01:41:23 +03:00
kd-11
afc10ea112 vk: Workaround for older SDK header versions 2024-12-25 01:41:23 +03:00
kd-11
488e5d9eb5 vk: Register honeykrisp as known driver in RTT quirks check 2024-12-25 01:41:23 +03:00
kd-11
6d976b5d90 vk: Fix build 2024-12-25 01:41:23 +03:00
kd-11
b44e2d3b30 vk: Add basic support for honeykrisp driver 2024-12-25 01:41:23 +03:00
kd-11
a196bbcbcd vk: Remove unnecessary workaround for older SDK versions 2024-12-25 01:41:23 +03:00
kd-11
6000e3a47d vk: Add support for extended device fault information 2024-12-25 01:41:23 +03:00
Elad
623f5822b3 Fix Emulator::Pause() segfault 2024-12-24 21:31:57 +02:00
Elad
c6dadc537b Add some FXO init checks 2024-12-24 21:31:57 +02:00
Elad
98a0c76a08 StrFmt.cpp: Make function printing shorter 2024-12-24 21:31:57 +02:00
Elad
a2d5b5a0e2 Fixup GDB 2024-12-24 21:31:57 +02:00
Elad
d376ba5994 Remove lv2_socket_native destructor 2024-12-24 21:31:57 +02:00
Elad
6a4b9430c0 Thread.h: Add a few noexcept 2024-12-24 21:31:57 +02:00
Elad
3bf735161f sys_config: Move cleanup to IDM abort 2024-12-24 21:31:57 +02:00
Elad
4d0c835df3 util/shared_ptr.hpp: STX pointers library fixes 2024-12-24 21:31:57 +02:00
Elad
6eb4138595 Fixup sys_process 2024-12-24 21:31:57 +02:00
Megamouse
53817dcc90 Fix fs::file log formatting 2024-12-23 11:29:13 +01:00
Megamouse
99044ce6c6 Qt: allow to skip further automatic update notifications for a single version 2024-12-23 01:56:39 +01:00
Elad
575a245f8d
IDM: Implement lock-free smart pointers (#16403)
Replaces `std::shared_pointer` with `stx::atomic_ptr` and `stx::shared_ptr`.

Notes to programmers:

* This pr kills the use of `dynamic_cast`, `std::dynamic_pointer_cast` and `std::weak_ptr` on IDM objects, possible replacement is to save the object ID on the base object, then use idm::check/get_unlocked to the destination type via the saved ID which may be null. Null pointer check is how you can tell type mismatch (as dynamic cast) or object destruction (as weak_ptr locking).
* Double-inheritance on IDM objects should be used with care, `stx::shared_ptr` does not support constant-evaluated pointer offsetting to parent/child type.
* `idm::check/get_unlocked` can now be used anywhere.

Misc fixes:
* Fixes some segfaults with RPCN with interaction with IDM.
* Fix deadlocks in access violation handler due locking recursion.
* Fixes race condition in process exit-spawn on memory containers read.
* Fix bug that theoretically can prevent RPCS3 from booting - fix `id_manager::typeinfo` comparison to compare members instead of `memcmp` which can fail spuriously on padding bytes.
* Ensure all IDM inherited types of base, either has `id_base` or `id_type` defined locally, this allows to make getters such as `idm::get_unlocked<lv2_socket, lv2_socket_raw>()` which were broken before. (requires save-states invalidation)
* Removes broken operator[] overload of `stx::shared_ptr` and `stx::single_ptr` for non-array types.
2024-12-22 20:59:48 +02:00
Whatcookie
385710672f
SPU LLVM: Recognize ROTYQBYI and ROTQBI rotation pattern (#16409)
Co-authored-by: Elad <18193363+elad335@users.noreply.github.com>
2024-12-22 10:29:15 +02:00
Megamouse
beb3565001 ps move tracker: draw sphere size range into live image 2024-12-21 14:36:24 +01:00
Megamouse
ec7f50d925 ps move tracker: set max of radii to 50%
It makes no sense to have a larger radius than half of the image size
2024-12-21 14:36:24 +01:00
Megamouse
1a479e9bda ps move tracker: fix min and max radius labels 2024-12-21 14:36:24 +01:00
Megamouse
19cc363b09 ps move tracker: fix some data types 2024-12-21 14:36:24 +01:00
kd-11
760b49bc6c Cleanup 2024-12-21 15:24:15 +03:00
kd-11
70eca8cb24 vk: Fix border color swizzling behavior 2024-12-21 15:24:15 +03:00
Megamouse
ff0249d662 ps move: ignore second half frame in ZCM1
These values have high noise on my model and make it unusable.
2024-12-21 03:24:32 +01:00
Megamouse
d450a5ee95 cellGem: add magnetometer support 2024-12-21 03:24:32 +01:00
Megamouse
1cf927aef9 cellGem: request orientation reset during calibration 2024-12-21 00:48:52 +01:00
Megamouse
8678402c25 cellGem: fix some data types 2024-12-20 17:30:25 +01:00
Megamouse
ee2ea0cb02 cellGem: invalidate hue and tracking in cellGemInvalidateCalibration
This fixes the cursor color in OVERKILL
2024-12-20 17:30:25 +01:00
Megamouse
cf0b4d4ed4 cellGem: split status_flags into calibration flags and runtime flags 2024-12-20 17:30:25 +01:00
Megamouse
cc50049bca cellGem: implement cellGemSetRumble 2024-12-20 17:30:25 +01:00
Megamouse
c6a76eb9af cellGem: add setting to let the game actually set the device hues
This is not very useful at the moment since the tracker can't really
handle random hues yet.
2024-12-20 17:30:25 +01:00
Megamouse
67e8e373a7 cellGem: set sphere RGB when a hue is set and vice versa 2024-12-20 17:30:25 +01:00
Megamouse
304964ba71 cellGem: add debug setting for painting spheres into the live image 2024-12-20 17:30:25 +01:00
Megamouse
d2c58765cd cellGem: fix some data types 2024-12-20 17:30:25 +01:00
Megamouse
385d21e6dc Fix some warnings 2024-12-20 17:30:25 +01:00
Megamouse
0fd6956bb0 cellPhotoDecode: allow dev_bdvd paths 2024-12-19 18:01:10 +01:00
Megamouse
5073477415 cellGem: Split horizontal and vertical mouse rotation cone setting 2024-12-19 16:55:39 +01:00
Megamouse
c56147e04b Qt: fix settings_dialog opening on wrong tab
The dialog now uses open instead of exec, so we have to override open.
2024-12-19 13:49:43 +01:00
Megamouse
79fc366f23 Qt: fix flow_layout segfault 2024-12-19 13:49:43 +01:00
capriots
9d4ff13c2b
cellAdec implementation part 2: LPCM decoder (#16381)
* cellAdec: savestate fixup

* simd.hpp: add some intrinsics

* cellAdec implementation part 2: LPCM decoder

* cellAdec: set to HLE by default

* cellAdec: review fixes

---------

Co-authored-by: Elad <18193363+elad335@users.noreply.github.com>
2024-12-18 20:21:56 +02:00
Megamouse
e18ae5abd6 cellGem: expose rotation cone to settings 2024-12-18 09:14:04 +01:00
Megamouse
f3ef4f3658 cellCamera: try to fix internal state on stop
When stopping, the camera is supposed to be open still.
Add an expected state to check the camera signal does what it should.
2024-12-18 03:54:25 +01:00
Megamouse
73a62b4bf6 Update SDL to 2.30.10 2024-12-17 22:44:46 +01:00
Megamouse
cd47113ed8 Update curl to 8.11.1 2024-12-17 22:44:46 +01:00
Megamouse
8793e6ded7 Update 7zip to 24.09 2024-12-17 22:44:46 +01:00
Megamouse
29a3c36e26 Update OpenAL to 1.24.1 2024-12-17 22:44:46 +01:00
Megamouse
141ac0d09f Update FAudio to 24.12 2024-12-17 22:44:46 +01:00
Megamouse
657ab4261c Fix some static analysis warnings 2024-12-17 20:46:07 +01:00
Megamouse
5491fbee5b Fix warning 2024-12-17 20:46:07 +01:00
RipleyTom
18f82f0006 Fix unused p2p socket closing 2024-12-17 15:09:59 +02:00
kd-11
30ca2370ab rsx: Improve MM synchronization 2024-12-16 19:00:08 +03:00
kd-11
21eaee0e23 rsx: Revert bounds optimization on RO texture load 2024-12-16 19:00:08 +03:00
kd-11
cd7e1e1e2b rsx: Improve performance even more when async MM is active 2024-12-16 19:00:08 +03:00
kd-11
4b30e82aee rsx: Restore previous (incorrect) low-precision format handling 2024-12-16 19:00:08 +03:00
kd-11
83c0212b59 rsx/qt: Add option to disable async host MM to GUI 2024-12-16 19:00:08 +03:00
kd-11
4eb0ee23db Fix linux build 2024-12-16 19:00:08 +03:00
kd-11
b4a72b6223 rsx: Fix texture renormalization flag and fix windows build 2024-12-16 19:00:08 +03:00
kd-11
c9a7abdd09 rsx: Fix OpenGL deadlock 2024-12-16 19:00:08 +03:00
kd-11
49d11b2e36 rsx: Make the deferred mm flush option usable with OpenGL 2024-12-16 19:00:08 +03:00
kd-11
83764fbbb4 rsx/vk: Implement asynchronous host memory management. 2024-12-16 19:00:08 +03:00
schm1dtmac
64ec19f018 Fixup Intel macOS builds
oops
2024-12-15 15:04:46 +01:00
schm1dtmac
692c88f0e9 Revert Qt to 6.7.3 for macOS 2024-12-14 00:01:17 +01:00
Megamouse
8dbe88782c cellGem: Improve mouse handler orientation
This also makes it easily configurable with the CONE setting in the future
2024-12-13 08:55:52 +01:00
Megamouse
b08829817f PS Move: fix calibration logging 2024-12-13 08:55:52 +01:00
Megamouse
585f47c2d9 PS Move: Disable Fusion gain (no more drift) 2024-12-13 08:55:52 +01:00
Megamouse
56a254ba9c move tracker: ignore sporadic shape and position changes
The tracker may get a random result for a couple of frames occasionally.
Just report the last known position and shape instead.
2024-12-12 16:52:47 +01:00
Megamouse
55ead61ea8 move tracker: ignore sporadic invalid results
The tracker may fail for a couple of frames occasionally.
Just report the last known position instead.
2024-12-12 16:52:47 +01:00
Megamouse
f96cfe08f4 cellGem: lock tracker mutex in get_info
This may reduce the possibility of unexpected tracking results
2024-12-12 16:52:47 +01:00
Megamouse
49081d0d82 Qt 6.8.1 2024-12-12 02:20:01 +01:00
Megamouse
a31ebc248e cellGem: implement quaternion transformation 2024-12-11 18:56:53 +01:00
Megamouse
3d11b6efa3 cellGem: try to map accelerometer and gyro 2024-12-11 18:56:53 +01:00
Megamouse
13cd461a1f sys_rsx_context_attribute: Improve errors 2024-12-11 18:56:53 +01:00
Antonino Di Guardo
68b7e5971d
Welcome Dialog: Reject users that reject our TOS
* Improved welcome dialog

* "show at startup" checkbox always changeable
2024-12-07 20:56:05 +02:00
Antonino Di Guardo
24655fd975
fix dark theme switching on initial welcome dialog (#16373) 2024-12-06 20:14:35 +01:00
Darkhost1999
05d12f68ad Test
Works on my machine
2024-12-05 12:55:23 +02:00
Elad
d84fe592c8 PRX: Do not check exported function code address 2024-12-03 19:01:17 +02:00
Elad
b4505600c7 PPU: Notify SPUs while waiting for its own state 2024-11-30 18:06:34 +02:00
Elad
a4ea71d18f CELL: Rewrite reservation notification postponing 2024-11-30 18:06:34 +02:00
Megamouse
729826ec40 cellGem: fix HUE_NOT_SET 2024-11-29 05:39:11 +01:00
Megamouse
a8b0c0be07 cellGem: calculate distance from sphere to camera 2024-11-29 05:39:11 +01:00
Elad
926de68a79 Debugger: Dump related thread information on crash 2024-11-28 13:32:52 +02:00
Elad
cf850598eb System.cpp: Do not hold on fs::dir handle 2024-11-28 05:47:40 +02:00
Elad
2b9f076024 fs: Minor fix of fs::dir::open
Did not close previous handle on fs::dir::open like on fs::file
2024-11-28 05:47:40 +02:00
Elad
d63e643081 Emu: Fixup 2024-11-28 05:47:40 +02:00
Elad
9a2bcd2508 System.cpp: Fix Kill() on bad app startup 2024-11-27 16:00:40 +02:00
Elad
f3b9d64df7 Add some asserts for g_fxo->init<> 2024-11-27 16:00:40 +02:00
Elad
68c58281e5 System.cpp: Add system_state::loading 2024-11-27 16:00:40 +02:00
Elad
07df91d4e8 Fix Emulation boot recursion 2024-11-27 16:00:40 +02:00
Elad
378a69ea85 Qt: Deprecate processEvents() part 2 2024-11-27 16:00:40 +02:00
Elad
191e132c6c util/types.hpp: Rewrite narrow<> 2024-11-27 16:00:40 +02:00
Elad
fce07bbeab Qt: Deprecate proccessEvents() usage 2024-11-26 03:33:24 +02:00
kd-11
3e427c57f0 rsx: Use strict bounds testing when replacing memory via blit engine 2024-11-25 22:21:07 +03:00
kd-11
9afebfdd72 rsx/texture-cache: Rework invalidation cause object to have more granular controls 2024-11-25 22:21:07 +03:00
kd-11
109b841d8d rsx/util: Change the filter function to an in-place erase-if operation 2024-11-25 22:21:07 +03:00
Darkhost1999
b94ddb0cd3
Migrate Savestates Home Menu (#16340) 2024-11-23 21:29:07 +02:00
Elad
b073d08a52 LLVM: Implement Recursive Intrinsics 2024-11-23 20:22:58 +02:00
capriots
fcf0b74c79
VS: add quotes around paths
Fixes use with paths that contain spaces.
2024-11-23 18:10:29 +02:00
capriots
e7fd4224ad cellDmuxPamf: add module + stubs 2024-11-23 17:01:25 +02:00
capriots
8778e69f9d cellAdec: make AdecContext and AdecFrame trivial classes 2024-11-23 17:01:25 +02:00
capriots
108247dccc Invalidate savestates 2024-11-23 17:01:25 +02:00
capriots
9b3b9562c0 cellAdec: review + warning fixes 2024-11-23 17:01:25 +02:00
capriots
e7f1a34fe1 cellAdec implementation part 1: abstraction layer 2024-11-23 17:01:25 +02:00
capriots
0a29ca2946 Fix HLE PPU callback stack arguments 2024-11-23 17:01:25 +02:00
RipleyTom
0e8f1a9bf9 sys_net: Remove lingering ppu_to_awake from queue on timeout 2024-11-22 18:44:01 +02:00
Megamouse
a9f6b012b8 Qt 6.8.0 2024-11-22 15:48:16 +01:00
Megamouse
4ba4bddb09 Fix some warnings 2024-11-22 15:48:16 +01:00
Megamouse
3b51368be2 Qt: Use inplace image mirroring in video sink 2024-11-22 15:48:16 +01:00
FlexBy420
0111fd0d0e
Make error message for temporary and archive translatable (#16331) 2024-11-20 16:54:31 +02:00
Elad
cc86e01df9 lockless.h: Fox 2024-11-18 18:45:34 +02:00
Elad
1dfee5fbfa lockless.h: Fixup addressing 2024-11-18 18:45:34 +02:00
Elad
21f65f087d lockless.h: Fixup lf_array assert 2024-11-18 18:45:34 +02:00
Elad
ac849b958f Progress: Dialog: Fixup memory management 2024-11-18 18:45:34 +02:00
Megamouse
806a1202c5 VS: ignore opencv debug build guard (fix debug build) 2024-11-16 23:31:54 +01:00
Megamouse
2ee1770383 ci: Don't fetch opencv submodule unless on windows 2024-11-16 17:36:56 +01:00
digant
21da04364d gitignore cleanup
These files and folders are all deprecated
2024-11-16 17:36:56 +01:00
digant73
a66ba27791 added missing -p option 2024-11-16 17:36:56 +01:00
digant73
3fa3298a31 fixed CI for building on windows 2024-11-16 17:36:56 +01:00
digant
eccb3f6d0b Improve and fix sln solution 2024-11-16 17:36:56 +01:00
Megamouse
29901d65ed More constexpr 2024-11-16 15:10:20 +01:00
Megamouse
0bb83ed5e9 Fix warning 2024-11-16 15:10:20 +01:00
Megamouse
2d14742a05 Add opencv to cmake 2024-11-16 15:10:20 +01:00
Megamouse
6eaaadec71 Move opencv submodule to subdirectoty 2024-11-16 15:10:20 +01:00
Megamouse
b89f7515fd Qt: show warning if ps move tracking is not supported 2024-11-16 15:10:20 +01:00
Elad
05096854bc Update vm_native.cpp 2024-11-16 13:53:25 +02:00
Elad
68d74bc28a Progress Dialog: Fix recursion and concurrency use of text updates 2024-11-16 12:22:23 +02:00
Elad
1475625705 Implement lf_array::for_each 2024-11-16 12:22:23 +02:00
Elad
935e83a490 Utilities\lockless.h: Flatten recusrion in lf_array
Add assert for sane index access.
2024-11-16 12:22:23 +02:00
Megamouse
4df58494a0 Fix compilation 2024-11-16 09:45:31 +01:00
Megamouse
f16dfd8ca2 Add HAVE_OPENCV preprocessor flag 2024-11-16 09:45:31 +01:00
Megamouse
72dc5b3489 Windows: Add and deploy opencv files 2024-11-16 09:45:31 +01:00
Megamouse
b89cc9b973 cellGem: implement real ps move handler 2024-11-16 09:45:31 +01:00
Elad
e7faec6b0e
util/vm_native.cpp: Fix memory leak 2024-11-15 14:00:30 +02:00
Megamouse
7866dc2e34 overlays: localize RPCS3 progress dialog 2024-11-15 09:48:12 +01:00
Megamouse
070add461f overlays: get localized values in home menu settings 2024-11-15 09:48:12 +01:00
Megamouse
1211acd59c Qt: Add std::string GetSettingOptions
This has the potential for some minor optimizations
2024-11-15 09:48:12 +01:00
Megamouse
d78c39b3ab overlays: add more overlay hint option to home menu settings 2024-11-14 23:23:36 +01:00
Megamouse
81bb4b5951 overlays: remove unnecessary text logging 2024-11-14 23:23:36 +01:00
Megamouse
9461294ffc overlays: add input debug overlay to home menu settings 2024-11-14 23:23:36 +01:00
Megamouse
7087582a36 overlays: translate home menu settings
Also fix potential lambda text capture issue
2024-11-14 23:23:36 +01:00
overwriter
201be08a85 fix: cannot copy OpenAl32.dll with CMake 2024-11-14 21:44:59 +01:00
Megamouse
c3729d06d0 Qt: Replace some instances of QMap, QPair and QList 2024-11-14 20:50:33 +01:00
Megamouse
e8f730e61f Update curl to 8.11.0 2024-11-14 20:50:33 +01:00
Elad
c5bbee7a0a SPU: Fixup code comparison 2024-11-14 13:43:01 +02:00
Elad
8c00842614 Fixup std::vector to std::span 2024-11-14 13:43:01 +02:00
Elad
72437b50b4 LV2: Fix thread notifications regression 2024-11-12 15:00:35 +02:00
Elad
e9b24eba85
SPU Analyzer: Fix programs code caching 2024-11-12 11:11:37 +02:00
oltolm
2b0f786b2d
Fix std::basic_string warnings (#16261) 2024-11-11 21:54:44 +02:00
Megamouse
2262ac1684 Qt: Replace QMap with std::map
This should reduce the amount of string conversions during list refreshes
2024-11-06 09:34:32 +01:00
RipleyTom
c68f42e0ee Fix sceNpScoreGetRankingByNpId when no score is registered 2024-11-05 20:48:05 +01:00
Joshua de Reeper
73cee9a43d sys_usbd: Better Dimensions Move Handling 2024-11-05 18:17:05 +01:00
NicknineTheEagle
6d766ccbb5
cellSaveData: Add autosave indicator (#15720) 2024-11-04 21:53:34 +01:00
Elad
bcf581dc82 Fixup Emulator::GetBackgroundPicturePath() 2024-11-04 14:59:21 +02:00
Elad
c782b45b97 High-Resolution Game Background for loading 2024-11-04 10:59:45 +02:00
Megamouse
7858053bb9 Update SDL to 2.30.9 2024-11-04 08:31:03 +01:00
Megamouse
2d0d4119f4 Update FAudio to 24.11 2024-11-04 08:31:03 +01:00
Megamouse
d2d76bb560 Update wolfssl to 5.7.4 2024-11-03 17:05:11 +01:00
Elad Ashkenazi
bc22df8ba8 SPU: Optimize cellSpurs reservations 2024-11-03 11:13:54 +02:00
Elad
b053b1e200 Another attempt to fix fs::pending_file for hardlinks 2024-11-02 21:43:35 +02:00
Elad
d3c0ec5651 Print last system error on fs::error::unknown 2024-11-02 21:43:35 +02:00
Elad
695799c39a GUI: Fix welcome_dialog dereference 2024-11-02 21:43:35 +02:00
Elad
85d1649696 utils/atomic.hpp: Make atomic_op reject non-non-const lvalue 2024-11-02 21:43:35 +02:00
Elad
1417f9b7de utils/atomic.cpp: Fixup utils::get_unique_tsc()
It was reading s_min_tsc again inside the atomic operation.
Also optimize it a bit.
2024-11-02 21:43:35 +02:00
Elad
0e31aafc09 Fixup GCM unmap event sending 2024-11-02 21:43:35 +02:00
Ani
17e78a9e6f rpcs3_version: Bump to 0.0.34 2024-11-01 23:22:32 +00:00
oltolm
42751cc8fb SPULLVMRecompiler: remove unnecessary bitcast 2024-11-01 16:31:14 +02:00
Elad
e67d090c35 Fixup sys_event_port_send 2024-11-01 10:43:46 +02:00
Elad
ddd0494cf4 Silence sys_ss_access_control_engine 2024-11-01 10:43:46 +02:00
Elad
2222807624 RSX/GCM: Fix memory unmapping for HLE GCM 2024-11-01 10:43:46 +02:00
Elad
488814bb2d rsx/vm: Exclude events from VM mutex
Fixes a deadlock from a recent pull request, perhaps also some deadlocks with locking both IDM and VM mutex.
2024-11-01 07:37:57 +02:00
Elad
4206b022b6 Win32/File.cpp: Use ReplaceFile for hardlink overwrite 2024-11-01 07:37:57 +02:00
Elad
b87c891ec4 Fixup sys_event to check EBUSY only for PPU->PPU signals 2024-11-01 07:37:57 +02:00
Hasster
5eb4691cd6 Specify that you only need the qtmultimedia when using aqt 2024-10-31 03:45:12 +02:00
Hasster
bfcbc13b8a Add more info about Qt in BUILDING.md
Specify that Qt needs a "qtmultimedia" module and provide a link to an alternative download
2024-10-31 03:45:12 +02:00
Elad
5c5edb4785 sys_event: Implement EBUSY for disconnection 2024-10-30 21:15:16 +02:00
Elad
edfe940543 utils/sysinfo.cpp: Yield CPU time when measuring TSC freq 2024-10-30 10:06:49 +02:00
elad335
8b8396b945 Filesystem/Win32: Recreate hardlinks on fs::pending_file 2024-10-29 19:26:33 +02:00
elad335
97f2b6b701 Fix get_system_time() 2024-10-29 19:26:33 +02:00
elad335
92bf6ed0a7 Replace rsx::uclock with get_system_time() 2024-10-29 19:26:33 +02:00
elad335
29c1c3df1f sys_event_flag_set: Minor improvement 2024-10-29 19:26:33 +02:00
oltolm
cd8954db14 fix deprecation warnings in Qt 6.8 2024-10-28 23:42:02 +01:00
Megamouse
431221f172 Don't log "always" messages in fatal_error_listener until enabled
Opening the console breaks Qt cli popups
2024-10-25 20:10:46 +02:00
elad335
3ecb14dcda sys_event_flag_set: Break atomic operation dependencies 2024-10-25 15:53:53 +03:00
elad335
a325eb52bd Compilation hotfix 2024-10-25 13:21:49 +03:00
elad335
84217917d5 utils/sysinfo.cpp: New TSC calibration technique 2024-10-25 10:00:21 +03:00
elad335
af052b0627 RawSpu: Optimize START register/commands
START MFC proxy commands can be common even after their need, optimize their usage.
2024-10-24 21:03:06 +03:00
elad335
c70c08bb07 utils: Make get_tsc_freq() inlined and non-blocking 2024-10-24 21:03:06 +03:00
elad335
2e8029a45b get_system_time(): Add fast TSC-based path 2024-10-24 21:03:06 +03:00
elad335
a9a454faf7 asm: Fix utils::rational_mul optimization 2024-10-24 21:03:06 +03:00
Elad
3378b03c1f Optimize get_system_time using 128 bit math 2024-10-24 21:03:06 +03:00
elad335
8d9911e383 Implement u64_x_u64_=_u128 optimization 2024-10-24 21:03:06 +03:00
kd-11
60ae4c1121 rsx: Fix crash when host labels option is disabled 2024-10-23 19:28:32 +02:00
kd-11
5ed7d043c4 Fix build and cleanup 2024-10-23 16:33:44 +03:00
kd-11
c28ec457fd gl: Silence compiler warnings 2024-10-23 16:33:44 +03:00
kd-11
a79ef1efb2 gl: Fix check_state compilation error 2024-10-23 16:33:44 +03:00
kd-11
1299aa68b3 cmake: Update build files for GL DMA 2024-10-23 16:33:44 +03:00
kd-11
681debd8f6 gl: Finalize host labels implementation 2024-10-23 16:33:44 +03:00
kd-11
0db06964dc Whitespace 2024-10-23 16:33:44 +03:00
kd-11
6ce1816e3f rsx: Move the host job management into common code to share with GL 2024-10-23 16:33:44 +03:00
kd-11
7fdfbe3c52 gl: Implement basic DMA layer using AMD_pinned_memory 2024-10-23 16:33:44 +03:00
Elad Ashkenazi
3e516df214 SPU: Reimplement SPURS limiter 2024-10-17 13:59:56 +03:00
Zion Nimchuk
899b4aaeec Use system SDL by default since we don't properly support building with just builtin SDL 2024-10-17 09:01:46 +02:00
Zion Nimchuk
d2612bed3a Switch to focal for aarch64, update Qt 2024-10-17 09:01:46 +02:00
Zion Nimchuk
42b255a4a2 Fix checkrt bundling and remove legacy deploy script 2024-10-17 09:01:46 +02:00
Antonino Di Guardo
18c01f7151
Fixed compilation with cmake on Windows (#16184)
* Fixed compilation with cmake on Windows
* cleanup on post build actions for Windows on cmake solution + minor cleanup
* fix link error on IntelJITEvents
2024-10-15 17:53:31 +02:00
shinra-electric
4cd1d639ed
3rd Party: Bump MoltenVK to 1.2.11 (Vulkan SDK 1.3.296) (#16190) 2024-10-15 16:40:45 +02:00
Megamouse
2732d6c3dc Qt: Make sure that table columns and their actions have the same state after restoring the layout 2024-10-15 12:59:37 +02:00
nastys
8e4f5cc7b3 Update build-mac.sh 2024-10-15 10:28:00 +02:00
Elad Ashkenazi
e58a3ab7e0 sys_spu: Fix order of some checks 2024-10-15 10:42:22 +03:00
Elad Ashkenazi
e0e1c729cd Fix sys_spu_thread_group_disconnect_event 2024-10-15 10:42:22 +03:00
Elad Ashkenazi
7c6b558647 Improve sys_spu_thread_initialize 2024-10-15 09:36:36 +03:00
Elad Ashkenazi
217c924d42 Fix sys_vm_memory_map 2024-10-15 09:36:36 +03:00
Megamouse
7b92cbcb9a input: use std::array for sticks, sensors and motors
We always have the same amount of those.
So using a vector has always been a bit confusing.
2024-10-15 01:50:22 +02:00
Megamouse
c882f0baf0 input: fix segfault caused by lockless std::move of stick vector
The copy assignment seems to fix this
2024-10-15 01:50:22 +02:00
nastys
f1f124dcbf
macOS arm64 CI: Fix packages requiring curl, and fix Ventura (#16193) 2024-10-15 00:01:13 +02:00
Megamouse
d4ce5b86ec Improve log file creation error message
Early out in file_writer ctor instead of large if else
2024-10-14 21:29:51 +02:00
Megamouse
16c1b9ed73 Fix some narrowing warnings 2024-10-14 21:29:51 +02:00
Elad Ashkenazi
42ee2463c7 Initialize some spu_thread members 2024-10-14 20:15:14 +03:00
Elad Ashkenazi
2fc9ae5d28 sys_vm: Argument checking fixes 2024-10-14 20:15:14 +03:00
Elad Ashkenazi
28dc7356a8 sys_memory: Fix argument size type 2024-10-14 20:15:14 +03:00
Elad Ashkenazi
f6c585902a sys_spu: Fix SPU queue index type 2024-10-14 20:15:14 +03:00
Elad Ashkenazi
693cf9950f sys_spu: Minor fixes 2024-10-14 20:15:14 +03:00
Elad Ashkenazi
cef3ee2d80 SPU: More SPURS limiter fixes 2024-10-14 06:30:05 +03:00
Elad Ashkenazi
8fac136056 SPU: SPURS pause based average task order duration 2024-10-11 17:41:34 +03:00
Elad Ashkenazi
fa707047e6 SPU: Remove illegal SPURS setting value 2024-10-11 07:28:28 +03:00
Elad
c009215983 SPU: Fix "Max SPURS Threads" performance 2024-10-11 07:28:28 +03:00
Elad Ashkenazi
d51d5ce86d SPURS limiter tweaks 2024-10-07 15:02:23 +03:00
RipleyTom
36da83592a Improve AMD cpu detection 2024-10-07 05:36:19 +02:00
Megamouse
0a57c459b6 overlays: add friends list to home menu 2024-10-06 09:57:20 +02:00
Megamouse
73fe420d09 RPCN: add overlay messages on friend requests 2024-10-06 06:35:48 +02:00
Megamouse
a85cdb5947 Update FAudio to 24.10 2024-10-05 22:50:30 +02:00
Megamouse
511f8a91f1 Update SDL to 2.30.8 2024-10-05 22:50:30 +02:00
Megamouse
2d1da95bc1 VS: Fix zstd debug lib 2024-10-05 22:50:30 +02:00
Malcolm Jestadt
967adaf9db SPU LLVM: Compute frest exponent at runtime rather than using the lookup table
- Provides a small speedup and smaller codesize
2024-10-05 20:44:23 +03:00
Malcolm Jestadt
8ca60df1ab SPU LLVM: Add optimized path for spu_re_acc special cases
- Uses vfixupimmps (AVX-512), 5 instructions down to 1
2024-10-05 20:44:23 +03:00
RipleyTom
4832267307 Fixes audio buffering on non-windows platforms 2024-10-05 11:44:15 +03:00
Megamouse
6bb01066fb VS: Add new build scripts to filters 2024-10-03 15:35:20 +02:00
Megamouse
522124d695 Remove unused SPIRV submodules 2024-10-03 15:35:20 +02:00
Megamouse
d9c4e14c40 VS: fix debug builds 2024-10-03 15:35:20 +02:00
Megamouse
00944a5d71 VS: Add buildfiles to filter 2024-10-03 15:35:20 +02:00
kd-11
e9bc99253d rsx: Verify that channel remap is initialized before applying swizzles 2024-10-03 15:02:09 +03:00
kd-11
e9a45a6d06 rsx: Clarify OGL and VK difference when handling border texels 2024-10-03 15:02:09 +03:00
kd-11
497b9ba55b rsx: Make use of remapped border colors 2024-10-03 15:02:09 +03:00
kd-11
d1d04b1b32 rsx: Implement texture border color decode to remapped rgba 2024-10-03 15:02:09 +03:00
kd-11
826f805902 rsx: Use a proper struct to wrap around channel remap operations 2024-10-03 15:02:09 +03:00
kd-11
b1b0ac4433 rsx/vs: Restructure filters into functional units 2024-10-03 15:02:09 +03:00
kd-11
3f28f88a35 vk: Add support for explicit border colors 2024-10-03 15:02:09 +03:00
Zion
938306a7bc Bump linux x64 docker to 1.7.1, Qt 6.7.3 2024-10-02 07:09:02 +02:00
kd-11
1568366d9c Do not link intel JIT events when compiling LLVM for ARM64 2024-10-01 19:20:26 +03:00
kd-11
79614562b9 Move x64 appimage builder to its own legacy script 2024-10-01 19:20:26 +03:00
Megamouse
96e495c61d Qt/Overlays: Add home menu shortcut to game window 2024-10-01 03:25:36 +02:00
kd-11
e4dd957bbc linux/aarch64: Fix CI release upload 2024-10-01 03:03:14 +03:00
kd-11
aace685202 Typo fix 2024-10-01 01:14:40 +03:00
kd-11
fa6f999754 linux: Fix steam deck issues 2024-10-01 01:14:40 +03:00
kd-11
f18649567f Include compositor module in appimage for shell integrations 2024-09-30 18:33:54 +03:00
kd-11
ae580c7749 Enable artifact upload 2024-09-30 18:33:54 +03:00
kd-11
c711764850 Update building instructions for linux arm64 2024-09-30 18:33:54 +03:00
kd-11
7d5dc101fa Fix shellcheck 2024-09-30 18:33:54 +03:00
kd-11
252e69a6ba Add different suffix per architecture 2024-09-30 18:33:54 +03:00
kd-11
c4be603279 Deploy aarch64 linux appimages 2024-09-30 18:33:54 +03:00
kd-11
90bf35bb1e Fix deploy script 2024-09-30 18:33:54 +03:00
kd-11
47fb653044 Fix aarch64 build script 2024-09-30 18:33:54 +03:00
kd-11
4fe306c9ad aarch64: linux CI 2024-09-30 18:33:54 +03:00
kd-11
03a58d36da Do not attempt to link in intel JIT events 2024-09-30 18:33:54 +03:00
Megamouse
d379dd4c8d overlays: Ignore 14 in anisotropic settings
This value has no CELL equivalent
2024-09-29 19:17:39 +02:00
Megamouse
7fc31e20b3 Fix 120 fps frame limit 2024-09-29 19:17:39 +02:00
schm1dt ‎
d11fe09419 Use native theme on macOS, hide Dark Mode toggle 2024-09-29 13:49:28 +02:00
RipleyTom
c49ff490bc Fix scenp_score_record_score param check 2024-09-29 12:09:11 +03:00
Antonino Di Guardo
3f66297593
Fix crash on VFS Tool (#16146) 2024-09-29 03:11:27 +03:00
schm1dtxbox
37d2317b68 Update shortcut_utils.cpp 2024-09-28 13:14:18 +02:00
schm1dtxbox
a1d55e5a54 Update azure-pipelines.yml 2024-09-28 13:14:18 +02:00
Megamouse
0ba0f11c4a Qt: Try to fix classic stylesheet after Qt 6.7.3 update 2024-09-28 01:39:33 +02:00
Elad
f0c60b42c2
SPURS Task limit hotfix (#16140) 2024-09-27 22:15:06 +03:00
RipleyTom
88adaa9d2d Add some extra param handling for cellNetCtlGetInfo 2024-09-27 19:14:09 +02:00
RipleyTom
56099e79da Fix for clang 19 2024-09-27 19:14:09 +02:00
Megamouse
4ba4268282 Qt/shortcuts: add handler id to log messages 2024-09-27 17:57:49 +02:00
Megamouse
2661b6a71c Qt: Try to improve default stylesheet after Qt 6.7.3 update 2024-09-27 17:57:49 +02:00
Megamouse
e58a89af2d Qt: Enable game window shortcuts 2024-09-27 17:57:49 +02:00
Megamouse
ad3d8675e7 Qt 6.7.3 2024-09-27 15:06:40 +02:00
Megamouse
18d9ca5928 Qt 6.7.2 2024-09-27 15:06:40 +02:00
Megamouse
5ab955d9c4 Qt 6.7.1 2024-09-27 15:06:40 +02:00
Megamouse
2b4a90781a Qt 6.7.0
Also fix new stylesheet issue: windows11 style is now default.
This currently breaks custom stylesheets.
Use windowsvista style as default
2024-09-27 15:06:40 +02:00
Elad
10dece1c80 SPU: Improve SPURS Task limit algorithm 2024-09-27 12:43:44 +03:00
RipleyTom
9dd0b055d0 Fake sceNpMatching2GetLobbyInfoList 2024-09-26 21:12:10 +02:00
Megamouse
9e460ebe0a MacOs/Arm64/Shortcuts: Add more plist entries 2024-09-26 19:48:40 +02:00
Megamouse
7106bfcfb9 Shortcuts: Try to create shortcut link path if it doesn't exist 2024-09-26 19:48:40 +02:00
Megamouse
c936de7c20 VS: add mac and linux hidapi files for improved input debugging 2024-09-26 19:48:40 +02:00
Elad Ashkenazi
60b5adab63 SPU: SPURS limit update 2024-09-26 06:59:20 +03:00
Elad Ashkenazi
e3c8b3d524 GUI: Add SPURS limit to home menu 2024-09-26 06:59:20 +03:00
Elad Ashkenazi
8b79fd3da1 SPU: Make SPURS limit a dynamic setting 2024-09-26 06:59:20 +03:00
Megamouse
feedc183a4 Qt: Tiny improvements to Cam/Mic permissions 2024-09-25 20:09:39 +02:00
Megamouse
c4282e63fb Qt: Simplify some string conversion bloat 2024-09-25 20:09:39 +02:00
kd-11
82f97d33d1 aarch64: Correctly implement the null function trap 2024-09-25 15:48:36 +03:00
schm1dtxbox
c1d43aff05 Brute-force Qt cache invalidation
Needed for qtimageformats changes to kick in
2024-09-25 09:11:28 +02:00
schm1dtxbox
a14c166aab Ditto, but for arm64 ci 2024-09-25 09:11:28 +02:00
schm1dtxbox
7d39ac4e1e Download qtimageformats so that shortcut icons create successfully 2024-09-25 09:11:28 +02:00
schm1dtxbox
f40d8b669c Fix camera permission prompts
Apparently calling qt_finalize_target in the CMake list is needed for permissions-related stuff to work.
2024-09-25 09:11:28 +02:00
Elad Ashkenazi
4b0a5bd1b8 SPU: Fix callback leak 2024-09-24 10:31:37 +03:00
Elad Ashkenazi
6995467ff6 SPU: SPURS limiter algorithm update 2024-09-24 10:31:37 +03:00
Elad Ashkenazi
ad42a2b89a SPU: Task-based SPURS limiter 2024-09-24 10:31:37 +03:00
Megamouse
c4334f5142 Add AArch64 files to VS Project 2024-09-23 23:00:58 +02:00
Megamouse
4c3d243672 MacOs/Arm64: Fix warning 2024-09-23 23:00:58 +02:00
Megamouse
340c17f422 Update curl to 8.10.1 2024-09-23 21:59:01 +02:00
Megamouse
18a99a7d8f input: use static hid singleton for init and exit 2024-09-23 21:59:01 +02:00
Megamouse
31b133b012 Fix yet another warning 2024-09-23 21:59:01 +02:00
nastys
eb9acd9b56
macOS arm64 CI (#16070)
* Merge MacOS jobs
* Code signing
* rpath hack
* Upgrade macOS VM to 13
* Update llvm compiler
* Update to macOS Sonoma
* Update build-mac.sh
* Remove unnecessary version check
* Disable Homebrew cache
* Use macosx_version_min
* Downgrade min version and VM to 13
* Force -D__MAC_OS_X_VERSION_MIN_REQUIRED=130000
* Ignore -Welaborated-enum-base in display_sleep
* Move compiler version to env variable
* Enable auto-updater on macOS ARM64
2024-09-22 20:39:43 +02:00
Ani
02362a4807 spu: Do not apply a Max SPURS Threads limit to libSail
On all the tested games (e.g. Naruto Ultimate Ninja Storm, Catherine),
limiting SPURS threads for "_libsailCellSpursKernelGroup" causes video
playback to hang and the game to permanently freeze. These games still
function properly while limiting the other CellSpursKernelGroup groups,
as I've confirmed through manual thread pausing.

I have not found a single example that shows that 
_libsailCellSpursKernelGroup threads can be limited without the game 
freezing.

This allows the Max SPURS Threads setting to work with more games, or to 
work with a lower thread limit count for games where it already works.
2024-09-21 15:02:41 +02:00
Elad Ashkenazi
466a93dca5 Debugger: Fix thread-selection and refactoring 2024-09-20 23:52:37 +03:00
Megamouse
c89e30b3d9 cellMsgDialog: only abort dialogs that were actually spawned by cellMsgDialog 2024-09-20 20:43:57 +02:00
Megamouse
d88b7f6fde cellSaveData: improve logging for overlays 2024-09-20 20:43:57 +02:00
Megamouse
d0a13c1a5a Improve logging during RPCS3 updates 2024-09-20 15:53:00 +02:00
Antonino Di Guardo
df9275819e
Added reconciliation functions for game list file (games.yml) (#16061) 2024-09-20 08:46:51 +02:00
nastys
5b5bfaf696
Updater API V3 (macOS only) (#16086) 2024-09-19 21:58:00 +02:00
RipleyTom
3d9c8a670e Implement old matching API 2024-09-19 20:34:56 +02:00
Elad Ashkenazi
cf65571be7 SPU Analyzer Hotfix 2024-09-19 10:00:18 +03:00
capriots
66eae05e75 cellAtracXdec: fix FFmpeg warning 2024-09-18 07:57:10 +02:00
Antonino Di Guardo
d1648dd707
[TESTERS NEEDED] Improved contextual menu (#16038) 2024-09-14 21:51:42 +02:00
capriots
7f2534819e cellAtracXdec: review fixes 2024-09-14 19:37:21 +02:00
capriots
e678931cee cellAtracXdec: review fixes 2024-09-14 19:37:21 +02:00
capriots
965dbf2c12 cellAtracXdec: review fixes 2024-09-14 19:37:21 +02:00
capriots
624f34ae13 cellAtracXdec: review fixes 2024-09-14 19:37:21 +02:00
capriots
d60eced317 cellAtracXdec: set to HLE by default 2024-09-14 19:37:21 +02:00
capriots
c813c5e953 cellAtracXdec implementation 2024-09-14 19:37:21 +02:00
capriots
5ce9c5b09f cellAdec: add internal datatypes 2024-09-14 19:37:21 +02:00
Megamouse
7df33bc8c0 Update curl to 8.10.0 2024-09-14 18:12:02 +02:00
Megamouse
0abaac90a8 Update libpng to 1.6.44 2024-09-14 18:12:02 +02:00
Megamouse
e5a526e4d6 input: enable squircle settings in keyboard pad handler
Clamp squircled values to radius 1.
Also set kb and evdev default to 8000 as the others
2024-09-14 17:20:07 +02:00
Elad Ashkenazi
8131f40269 SPU Analyzer: Fix dereferencing freed reference 2024-09-13 19:32:15 +03:00
Elad Ashkenazi
743f9a9f51 rsx: Add 120fps and monitor refresh-rate frame limits 2024-09-12 13:49:03 +03:00
Megamouse
0a54e34a9b Update FFMPEG to properly rebased branch
The prior FFMPEG merge was not properly rebased to Vita3K master.
I created a backup branch arm64_old on the current commit.
I reset master to vita3k master and cherry picked our 5 commits.
Then I squashed the last 2 commits because one of them was obsolete.
2024-09-08 21:01:43 +02:00
Megamouse
53c84577c0 Set cellSysutilAvcExtInitOptionParam to notice 2024-09-08 20:04:30 +02:00
Megamouse
00e5d54be7 cellSysutilAvc: fix cellSysutilAvcEnumPlayers error check 2024-09-08 20:04:30 +02:00
Megamouse
d13acdb484 Fix some warning 2024-09-08 20:04:30 +02:00
kd-11
92c1a8c45d sysinfo/arm64: Improve code around registry access and document the fields 2024-09-08 17:41:29 +03:00
kd-11
939479f55e ci: Fix clang linux failure 2024-09-08 17:41:29 +03:00
kd-11
d19d0cb70d windows/arm64: Implement fallback OS version detection 2024-09-08 17:41:29 +03:00
kd-11
31ce32709e build: Disble fixed base for windows-on-arm 2024-09-08 17:41:29 +03:00
kd-11
4f27af9949 Fix compilation warning 2024-09-08 17:41:29 +03:00
kd-11
b31280e387 Fix GCC compilation for windows 2024-09-08 17:41:29 +03:00
Elad Ashkenazi
03980304cf SPU Analyser: Fix source termination of starting block 2024-09-08 06:51:57 +03:00
Ani
c852ae1a22 ffmpeg: Update submodule, supports linux arm64
Enables compatibility with linux arm64
2024-09-07 18:19:06 +02:00
schm1dtxbox
58f3841383 Fix arm64 RPCS3 being reported by macOS as an iOS app
macOS/Mac OS X reports arm64-only app bundles (so not Intel only or Universal) as being iOS apps in various places like Settings and System Information unless the bundle's Info.plist explicitly specifies it is only supported on Mac OS X.
2024-09-07 16:26:19 +02:00
Elad Ashkenazi
9385f0673b Debugger: Non-blocking thread list refresh 2024-09-06 20:28:11 +03:00
Megamouse
2bc0d19c9d cellSysutilAvcExt: add some param checks 2024-09-06 17:17:17 +02:00
Megamouse
fe1fa45956 cellSysutilAvcExt: fix some params and size of long (the disassembly makes zero sense with s64) 2024-09-06 17:17:17 +02:00
Megamouse
6fa993645e cellSysutilAvc: add param checks 2024-09-06 17:17:17 +02:00
Megamouse
144ff82402 Stub cellSysutilAvc 2024-09-06 17:17:17 +02:00
Megamouse
f285b0c053 Update FAudio to 24.09 2024-09-06 17:17:17 +02:00
Megamouse
7e9cf297ac cellPad: Remove obsolete comment 2024-09-06 17:17:17 +02:00
Megamouse
d780355784 cellPad: draw debug overlay for basic input debugging of port 0 2024-09-06 08:33:55 +02:00
Megamouse
b0194ba6af cellPad: scale emulated skateboard IR input down 2024-09-06 08:33:55 +02:00
Megamouse
deba582353 Qt: Force reset of debugger when a different game is running 2024-09-06 05:05:54 +03:00
Megamouse
303c6715dd Qt: Don't start the debug update timer in the constructor
This caused the timer to be active even when the debugger is initially hidden.
2024-09-06 05:05:54 +03:00
552eden
b4ff988bd8 Add support for SHRED dongle
changed support from ride dongle to ride + shred dongle
2024-09-05 18:23:51 +02:00
kd-11
7e3b8b5cdb c++-ify empty return 2024-09-04 07:49:49 +03:00
kd-11
7353696014 cpu: Format additions to sse2neon to match the rest of the file 2024-09-04 07:49:49 +03:00
kd-11
a60eab6e36 aarch64: Fix compilation for windows-on-arm 2024-09-04 07:49:49 +03:00
Megamouse
23f9eb57e5 patch_manager: set config_key_role to current key after handle_item_selected
The key was never changed if you selected different configurables in the same item.
This means that all configurables used the same value list.
2024-09-04 01:03:33 +02:00
snake
ad1eb93a05
cellMic: add 16-bit PCM to 32-bit float conversion for DSP stream (#16030) 2024-09-03 23:25:24 +02:00
Megamouse
2fb0c499ea Update SDL to 2.30.7 2024-09-03 03:18:21 +02:00
Megamouse
fbebdc09b7 Qt: ignore double clicks unless they are left clicks 2024-09-02 23:26:56 +02:00
Ani
e56164f1e3 rpcs3_version: Bump to 0.0.33 2024-08-31 21:46:33 +02:00
Ani
ff870ca088 BUILDING: Bump gcc/clang versions to the ones used in rpcs3-docker
gcc: 11 -> 13
clang: 12 -> 17
2024-08-31 17:54:48 +02:00
Ani
52d91c4772 BUILDING: Add qt6-svg for archlinux systems 2024-08-31 17:54:48 +02:00
kd-11
c80342e8d4 aarch64: Support calloc patch blocks 2024-08-31 13:55:58 +03:00
kd-11
4d193ecb6a Block parallel JIT allocation on macos 2024-08-29 13:08:23 +03:00
kd-11
ce9024efc5 Fix overlapping addresses returned by mmap 2024-08-29 13:08:23 +03:00
kd-11
23788b04c6 Restore comment 2024-08-29 13:08:23 +03:00
kd-11
c0e577c4dc Allow overcommit on macos 2024-08-29 13:08:23 +03:00
kd-11
00a0c4e69d rsx: Silence compiler warnings 2024-08-29 13:08:23 +03:00
kd-11
81f91e2095 Fix GL stencil tracking 2024-08-29 13:08:23 +03:00
Megamouse
3b36df48e9 Vk/Gl/Overlays: Do not blend the alpha channel when rendering overlays
When blending a source pixel with alpha less than 1 onto a texture, we will end up having even less alpha than before.
This can lead to ugly "holes" in the overlays, especially on the edges of glyphs with smooth fonts for example.
We can fix this by only blending the RGB values while keeping the destination's alpha value.
I haven't really seen this happen in RPCS3, but it's better to be safe than sorry.
2024-08-28 01:19:15 +03:00
Elad Ashkenazi
d1bfa9cd9c RSX: Fix RSX Captures 2024-08-27 06:51:55 +03:00
Megamouse
e5b03d9cbd Qt: check microphone permissions 2024-08-26 07:42:22 +02:00
Megamouse
3420cb0365 Qt: ask for camera permissions 2024-08-26 07:42:22 +02:00
Megamouse
4a4762654b Qt: sync gui settings by default after setting or removing values 2024-08-26 06:28:47 +02:00
kd-11
56d35bf409 Fix crash in JIT when compiling LLVM blocks 2024-08-25 22:04:45 +03:00
kd-11
4f97ea8da7 macos - Fix crash when running native arm64 LLVM 2024-08-25 22:04:45 +03:00
kd-11
f367703574 Use sysctlbyname 2024-08-25 22:04:45 +03:00
kd-11
8c64192ac7 Implement basic system info detection on macos using sysctl 2024-08-25 22:04:45 +03:00
Elad Ashkenazi
11e3aa660e SPU: Remove condition from GETLLAR spin detection 2024-08-25 18:29:30 +03:00
RipleyTom
3dc75dc3d1 Handle WSAENETRESET error 2024-08-25 13:04:44 +03:00
kd-11
be0ef0cc28 macos - Fix crash executing resolver 2024-08-24 14:13:14 +03:00
kd-11
470f8674df aarch64 - Support for apple exceptions 2024-08-24 14:13:14 +03:00
kd-11
4da30e9eca Add proper transform pass management 2024-08-24 14:13:14 +03:00
kd-11
09ea858dbf Minor fixes 2024-08-24 02:07:00 +03:00
kd-11
296c931d55 Fix v3dv workaround 2024-08-24 02:07:00 +03:00
kd-11
94b6e4598c Fix aarch64 compilation on macOS 2024-08-24 02:07:00 +03:00
kd-11
f5173ca9bf aarch64 - Decode CPU brand information 2024-08-24 02:07:00 +03:00
Elad Ashkenazi
1c16ada670 Debugger: Pointer comparison bugfix 2024-08-22 12:21:55 +03:00
Ani
67308bcf6f vk: Only allow unsupported textureCompressionBC for v3dv 2024-08-21 23:07:13 +03:00
Ani
0649da4cfb vk: Add driver vendor V3DV (Broadcom on Mesa)
VK_DRIVER_ID_MESA_V3DV
2024-08-21 23:07:13 +03:00
Ani
18df24d390 vk: Support v3dv, allow creating device without textureCompressionBC
v3dv supports BC1-BC3 which is all we require, support is reported as 
false since not all formats are supported
2024-08-21 23:07:13 +03:00
Ani
c2b275ddbc spu: Workaround GCC 14.1 compiler bug
Stumbled upon this issue with gcc 14.1.1+r1+g43b730b9134-1 on aarch64, 
failing compilation due to implicit fallthrough warnings being treated 
as errors
2024-08-21 21:48:53 +03:00
Ani
fc85c1a0c1 config: Set minimum allowed resolution scale to 25% 2024-08-21 21:48:53 +03:00
oltolm
7f30e52fda cmake: fix EGL and add USE_SYSTEM_CURL 2024-08-21 20:33:40 +03:00
kd-11
042a5481ca Formatting 2024-08-21 16:16:28 +03:00
kd-11
4bb79b6c31 Rework aarch64 signal handling 2024-08-21 16:16:28 +03:00
Elad Ashkenazi
d6acdc77e0 Debugger/SPU: Implement SPU Disassembler 2024-08-21 13:32:45 +03:00
Elad Ashkenazi
7c898c3e4e SPU: Improve some logging 2024-08-21 13:32:45 +03:00
kd-11
3ea24183b9 Improve "write" instruction detection. 2024-08-20 05:18:53 +03:00
kd-11
d0dbdb1ab5 Fix hang when compiling leaf blocks 2024-08-20 05:18:53 +03:00
kd-11
c2f5de1c55 Fix compiler warnings about unused args for aarch64 2024-08-20 05:18:53 +03:00
kd-11
fbcd8e32b8 Cleanup 2024-08-18 18:27:52 +03:00
kd-11
ca4fa1ac74 Use return-oriented trap approach 2024-08-18 18:27:52 +03:00
kd-11
fc415cf32a Move to a assembler wrapper for injected asm to better handle dependencies 2024-08-18 18:27:52 +03:00
kd-11
2faa61ac31 Refactor aarch64 JIT code 2024-08-18 18:27:52 +03:00
Megamouse
fd6ebe2895 Qt/input: Don't report two direction trigger values unless actually requested
Fixes a bug where you could map LT- even if you weren't pressing ALT before.
2024-08-18 10:49:26 +02:00
Megamouse
08f81160cc Input: Abbreviate some variable names and add min output interval
The abbreviation allows for easier diff between handlers.
2024-08-18 10:49:26 +02:00
Megamouse
9a071746ed input: log send_output_report hid error
Maybe helps to figure out some issues
2024-08-18 10:49:26 +02:00
Elad Ashkenazi
bd5fd66408 SPU: Reduce some logging 2024-08-17 06:38:49 +03:00
Elad Ashkenazi
1bd4565186 Implement thread_ctrl::wait_until() 2024-08-17 06:38:49 +03:00
Megamouse
b2877365de Qt: fix pad settings latency
Increase input timers back to 1000Hz. The DS4 lags if it's slower.
Decrease all pad UI update timers from 1000Hz to 100 Hz.
2024-08-16 09:06:42 +02:00
Elad Ashkenazi
981a1c56fb SPU: Disable transfer locking for RSX addresses 2024-08-15 14:05:25 +03:00
Elad Ashkenazi
ce92341e75 SPU: Unlock RSX list transfers 2024-08-15 14:05:25 +03:00
Elad Ashkenazi
46ceeed10d Debugger/PPU: Minor bugfix in CR register dump 2024-08-15 14:05:25 +03:00
Megamouse
456ff10f02 Qt/patches: don't allow duplicate app versions 2024-08-15 09:35:58 +02:00
Megamouse
dedda09560 Qt/patches: fix multi app version entry in patch creator 2024-08-15 09:35:58 +02:00
Megamouse
8371c445ce Qt/patches: check if app version is 5 characters long and like 01.00 2024-08-15 09:35:58 +02:00
Megamouse
93424d1adc Qt/patches: check if serial is 9 characters long and alphanumeric 2024-08-15 09:35:58 +02:00
Megamouse
d05d803f5e patches: use more std::move 2024-08-15 09:35:58 +02:00
Megamouse
963e283db5 Qt/patches: Use YAML emitter to escape characters 2024-08-15 09:35:58 +02:00
Megamouse
b78d76e1bb Qt/patches: allow to select text with the mouse
Lets you copy paste stuff
2024-08-15 09:35:58 +02:00
RipleyTom
50446e425d evdev: don't warn on disabled motion device 2024-08-15 08:58:09 +03:00
Megamouse
72cd146665 Qt: vfs tool dialog 2024-08-15 00:45:48 +02:00
Megamouse
f5d8786ffd Update 7zip to 24.08 2024-08-15 00:45:48 +02:00
Megamouse
ce5ae56f67 Qt/patches: delete message boxes on close 2024-08-14 20:21:55 +02:00
Megamouse
76c0df849a patches: improve error logging: add file paths to all errors 2024-08-14 20:21:55 +02:00
Megamouse
f64f0b2e33 Qt/patches: use show instead of exec 2024-08-14 20:21:55 +02:00
Megamouse
4051988403 Qt/patches: improve value validation 2024-08-14 20:21:55 +02:00
Megamouse
db102a5237 Qt/patches: uze const ref for YAML::Node params 2024-08-14 20:21:55 +02:00
Elad Ashkenazi
7f92d6003d sceNp: Silence a few functions 2024-08-14 11:53:00 +03:00
Elad Ashkenazi
6fb05be9da CELL: Remove performance hack for reservation
With the new notification method, we can remove this hack with micro-consequences. (though it comes with benefit of not breaking current reservations spuriously)
2024-08-14 11:53:00 +03:00
Elad Ashkenazi
d0ebba6c5e CELL: New reservation notifications mechanism 2024-08-14 11:53:00 +03:00
Elad Ashkenazi
29b0298f1e Fix sys_io thread deadlock
Co-Authored-By: Megamouse <23019877+Megamouse@users.noreply.github.com>
2024-08-14 08:56:40 +03:00
Megamouse
4d5897d519 keyboard: only map single buttons
key combos are not really supported at the moment
2024-08-13 20:58:04 +02:00
Megamouse
7bcaab4f3a Remove unused using declaration 2024-08-13 20:14:30 +02:00
Megamouse
93c21103aa xinput: allow to map triggers as positive or negative 2024-08-13 20:14:30 +02:00
kd-11
26a1a4418e rsx: Fix crash when CPU blit is enabled 2024-08-13 19:23:47 +03:00
kd-11
0b62385ddb aarch64/llvm: Handle processing of leaf nodes 2024-08-13 18:25:26 +03:00
Elad Ashkenazi
6535d461be Fix vm::reservation_update 2024-08-13 10:56:33 +03:00
Elad Ashkenazi
3fa8994f4e SPU: Fix "SPU Accurate Reservations" off 2024-08-13 10:56:33 +03:00
Megamouse
ff6a4bb72d Qt/input: add shortcut for toggling emulated mouse and keyboard 2024-08-12 23:19:23 +02:00
Megamouse
ff84e7c6e2 Fix overflow warning 2024-08-12 21:04:10 +02:00
Megamouse
3716ba2ba2 Qt: refactor pad preview updates to reduce duplicate code 2024-08-12 21:04:10 +02:00
kd-11
c7b2a21fcb Fix OpenGL behavior under wayland-egl 2024-08-12 04:55:26 +03:00
Ninetime
b0d07a75e5 Enable users to reject friend requests 2024-08-11 19:19:32 +03:00
Elad Ashkenazi
60b7448d8a SPU LLVM: Enable PUTLLC16 if accurate reservations is off 2024-08-11 17:55:56 +03:00
Elad Ashkenazi
f980c59860 Do not add usage stats for unused SPU programs 2024-08-11 17:55:56 +03:00
Elad Ashkenazi
6c791541ee SPU: Fix bug in GETLLAR 2024-08-11 17:55:56 +03:00
Megamouse
72cccb691c Qt/input: update buttons at 100 hz instead of 1000 hz.
This reduces cpu usage without any noticeable drawback.
2024-08-11 00:56:07 +02:00
Megamouse
cb122819ae evdev: try to fix first call behaviour
We don't have all the events in the first call to get_next_button_press.
So we have to set all the buttons to max on the first call.
We also have to make sure that we don't manipulate the values if we just
want to know the connection status.
2024-08-11 00:56:07 +02:00
Megamouse
0dfc622b58 Fix unused function warning 2024-08-11 00:56:07 +02:00
Ninetime
7d84d084a4
Enable user to change country code (#15884) 2024-08-10 22:33:38 +02:00
Megamouse
f2ef0966eb input: add analog limiter 2024-08-10 12:07:57 +02:00
Megamouse
2806348f73 evdev: simplify get_next_button_press 2024-08-09 20:01:50 +02:00
Megamouse
b95aa7a28c mmjoy: simplify get_next_button_press 2024-08-09 20:01:50 +02:00
Megamouse
961239ac8d Qt/input: make touch_threshold a member
Maybe we need will need it for a different handler in the future
2024-08-09 20:01:50 +02:00
Megamouse
326375ad9a Qt/input: clear min_button_values if we want to get the blacklist 2024-08-09 20:01:50 +02:00
Megamouse
16a6915525 Qt/input: ignore button press values unless they increase 2024-08-09 20:01:50 +02:00
Megamouse
28781d9bfb Qt/input: move preview_values into callback 2024-08-09 20:01:50 +02:00
kd-11
3ef8046f5c rsx: Fix fragment constants decoding for non-x86 platforms 2024-08-09 15:09:26 +03:00
Megamouse
03a612487d cellGem: Only allow each button to be used for one action unless it's the combo button. 2024-08-08 22:34:20 +02:00
Megamouse
60b90075ac input: ignore mouse handler events until initialized
And revert the now obsolete reload requests
2024-08-08 22:34:20 +02:00
Megamouse
bc23615508 Input: fix initial mouse config reload 2024-08-08 22:34:20 +02:00
Megamouse
548cc074f4 input: log all config file content if used 2024-08-08 22:34:20 +02:00
Darkhost1999
3970b7b754
Class "llvm:StringRef" has no member 'Startswith' (#15898) 2024-08-08 21:40:52 +02:00
Jérémy Francart
20598960a5
PINE: Fix socket naming for Mac and Linux to match protocol specification (#15906)
This commit fixes the socket file name for Mac and Linux users.
Essentially, the port is now only concatenated to the socket name if it
is different than the default port.
This change was made to match with the specification of the PINE
protocol and the other emulators implementing it.
2024-08-08 20:08:28 +02:00
kd-11
1200bbe7cc Address review comments 2024-08-08 13:40:07 +03:00
kd-11
fa7e0e4758 Do not include arm sources by default 2024-08-08 13:40:07 +03:00
kd-11
9d87e444ac Clear hv context 2024-08-08 13:40:07 +03:00
kd-11
294bebb4a7 Fix SPU compilation 2024-08-08 13:40:07 +03:00
kd-11
140fddbba8 Initial SPU bringup 2024-08-08 13:40:07 +03:00
kd-11
bc1b0eb41b Improve comments 2024-08-08 13:40:07 +03:00
kd-11
42d47b61a0 Fix dependency injection on terminators 2024-08-08 13:40:07 +03:00
kd-11
839a25e129 Bump scratch to 8k 2024-08-08 13:40:07 +03:00
kd-11
7979c5d9eb Finalize PPU migration to the frame pass system 2024-08-08 13:40:07 +03:00
kd-11
cba658baba Complete PPU support 2024-08-08 13:40:07 +03:00
kd-11
34549445a8 Migrate PPU to post-process execution model 2024-08-08 13:40:07 +03:00
kd-11
a976ac3353 jit: Add aarch64 JIT backend for pre-codegen transforms 2024-08-08 13:40:07 +03:00
kd-11
52c8b1ecbb Silence compiler noise on non-x86 architectures 2024-08-08 13:40:07 +03:00
kd-11
56cc5d9355 Initial PPU LLVM implementation for aarch64 2024-08-08 13:40:07 +03:00
Megamouse
a5f9256ac6 cellMic: skip alcCaptureSamples loop if num_samples is 0
Also use early out instead of ensure in get_data
2024-08-08 01:39:43 +02:00
Megamouse
9505f8116b cellMic: only allocate temp_buf if needed 2024-08-08 01:39:43 +02:00
Megamouse
a5bd22b0cf cellMic: free temp_buf if on mic close 2024-08-08 01:39:43 +02:00
Megamouse
1b5ec785f5 cellMic: do not copy samples to intermediate buffer unless necessary 2024-08-08 01:39:43 +02:00
Megamouse
80e1b1adf4 cellMic: only call get_data once 2024-08-08 01:39:43 +02:00
Megamouse
6a6cd82070 cellMic: simplify BE translation loop
We are looping over each channel of each sample without gaps.
So we can just make it a single loop.
2024-08-08 01:39:43 +02:00
Megamouse
161edbf2f6 cellMic: make bit_resolution and channel_size constexpr
This allows us to optimize and inline variable_byteswap
2024-08-08 01:39:43 +02:00
Megamouse
667db0f2de cellMic: remove duplicate code and add size checks 2024-08-08 01:39:43 +02:00
Megamouse
f09d22a00d cellMic: check device ptr and log openal error codes 2024-08-08 01:39:43 +02:00
Joshua de Reeper
f1d4e500ba sys_usbd: Default replies for Dimensions Color Commands 2024-08-06 20:42:28 +02:00
Megamouse
b5aac6d802 cellMic: fix type conversion warning 2024-08-06 00:42:24 +02:00
Megamouse
43c3a15a50 MSVC: Fix openal import warnings
Fixes warnings like: symbol 'alcGetString' defined in ... is imported by ...
2024-08-06 00:42:24 +02:00
Elad Ashkenazi
9f8d9c5d10 SPU LLVM: Revert store postponing restrictrictions 2024-08-05 19:36:26 +02:00
Megamouse
4084e6f584 Dimensions: default init figures 2024-08-05 16:07:55 +02:00
Megamouse
7fa2987bb9 Infinity: Early out instead of scope 2024-08-05 16:07:55 +02:00
Megamouse
09ead1b6ea Dimensions: try to fix out of bounds array access 2024-08-05 16:07:55 +02:00
Megamouse
bc07b9e659 Dimensions improve locks (maybe) 2024-08-05 16:07:55 +02:00
Megamouse
5bd2fd3391 Dimensions: make some functions static 2024-08-05 16:07:55 +02:00
kd-11
4030193f31
Case-insensitive path compare for module verifier (#15889) 2024-08-04 15:46:08 +02:00
Megamouse
a1dcf1f717 Qt/trophies: allow to delete a game's trophy directory 2024-08-04 11:46:16 +02:00
Megamouse
f0ce40dff3 Qt/savedata: remove call with unreachable case
The function does an early out if the index is -1 anyway.
2024-08-04 11:46:16 +02:00
kd-11
f6b5511546 Improved wayland support 2024-08-04 02:59:03 +03:00
kd-11
0be1c41e63 Improve AMD CPU detection 2024-08-03 21:35:10 +03:00
kd-11
c8e81a2dad Return zen4 for zen5+ until LLVM upgrade 2024-08-03 21:35:10 +03:00
kd-11
dd708166aa Improve intel and apple detection 2024-08-03 21:35:10 +03:00
kd-11
3e7c1e207d Add fallback CPU detection when llvm is not aware of the CPU model 2024-08-03 21:35:10 +03:00
future-figs
8f51b0907a
change PSMove mouse button bindings (#15860) 2024-08-02 23:59:51 +02:00
Megamouse
c4160a3887 Update MSVC redistributable URL 2024-08-02 21:40:30 +02:00
Megamouse
b76fd38854 Run platform sanity checks after creating the log and log windows path 2024-08-02 21:40:30 +02:00
Daniel López Guimaraes
9db68e7d39 cellMic: Handle value 0 on CELLMIC_DEVATTR_CHANVOL
If arg1 is zero, all channels of the device are affected.
2024-08-02 19:29:42 +02:00
Daniel López Guimaraes
ba3d16b48b cellMic: Fix CELLMIC_DEVATTR_CHANVOL handling
The microphone index given in `arg1` is 1-indexed, so we have to
subtract 1 from the index to access the proper value.

This wasn't caught up before since we were doing direct access of the
array instead of using `::at32` which wouldn't check that the value is
within bounds.

This allows the original SingStar game to boot up again, as it would
otherwise crash then trying to set the volume to the second channel due
to the index being out of bounds.
2024-08-02 19:29:42 +02:00
Megamouse
c8ad075372 Update SDL to 2.30.6 2024-08-02 17:31:13 +02:00
Megamouse
9912552a85 Update FAudio to 24.08 2024-08-02 17:31:13 +02:00
Megamouse
0088c0375a Update curl to 8.9.1 2024-08-02 17:31:13 +02:00
Elad Ashkenazi
70502a698e
types.hpp: Format C arrays too for assert errors 2024-08-02 14:11:05 +03:00
kd-11
a323e753ff gl: Fix hang on windows 2024-08-01 20:17:16 +03:00
Megamouse
e58ce626d5 Video Encode: do not set the frame_number
Fixes a deprecation warning, and it is supposed to be set by ffmpeg anyway.
2024-08-01 18:04:47 +02:00
Megamouse
106bf5145b Fix ffmpeg deprecation warnings 2024-08-01 18:04:47 +02:00
Elad Ashkenazi
c5c51ec0c1 types.hpp: Add argument formatter to assert errors 2024-08-01 16:32:09 +03:00
kd-11
f64c912d02 gl: Fixes for asahi linux 2024-08-01 14:14:56 +03:00
Megamouse
7884bcc21d Fix unused function warning 2024-08-01 02:44:01 +02:00
Megamouse
7ebfe5ce69 Remove unused variable 2024-08-01 02:44:01 +02:00
Megamouse
08168c39c8 Fix std::move warning 2024-08-01 02:44:01 +02:00
Megamouse
319c533196 Silence deprecation warnings on MacOs 2024-08-01 02:44:01 +02:00
Megamouse
56b6b7e732 raw_mouse: Fix button map out of bounds access
- Reload the mouse config when the index changes.
- Clear the button map before reloading the config.
- Check if the button really is in the map.
2024-08-01 01:17:01 +02:00
Megamouse
30f49a61df DS4/DualSense/SDL: add touchpad support 2024-07-31 08:45:25 +02:00
Joshua de Reeper
12fbff22b2
sys_usbd: Allow 'Moving' figure to same slot on Dimensions Toypad (#15850) 2024-07-29 17:50:20 +02:00
Elad Ashkenazi
02aac2c52e sys_fs: Non-existant overflow bugfix
It would technically never overflow.. but this add minimal protection against adding beyond [PPU thread-count + entries count]
This does not induce an atomic loop which limits until entries.size() but is slower.
2024-07-28 12:36:42 +03:00
Elad Ashkenazi
faabb9e111 Add SPU usage for program dump 2024-07-28 12:36:42 +03:00
Elad Ashkenazi
b639599ade reduce logging 2024-07-28 12:36:42 +03:00
Elad Ashkenazi
91b4aaf9e1 PPU: Fix potential overflow 2024-07-28 12:36:42 +03:00
Elad Ashkenazi
700334753d cellMic: Fix potential overflow 2024-07-28 12:36:42 +03:00
Elad Ashkenazi
d451c0867c Remove welcome dialog shortcut 2024-07-28 12:36:42 +03:00
Daniel López Guimaraes
501e9260b2 cellMic: Wake up upon registering emulated SingStar microphone
When using the emulated SingStar microphone, the device is only
registered when initializing `cellMic`. However, the `mic_context`
thread is only woken up when calling `register_device`. The registration
happens before initializing `cellMic`, so the thread is never woken up
after registering the device.

Add call to `wake_up` in `load_config_and_init` inside the emulated
SingStar microphone specific code to fix this issue, allowing the thread
to detect the device and update the microphone data.

This allows SingStar to receive the microphone data when using the
emulated SingStar microphone that it previously wasn't receiving.
2024-07-26 09:44:00 +03:00
kd-11
27047bb3dc vk: Fix VEGA float16 workaround 2024-07-25 14:23:36 +03:00
Megamouse
953af7589c Paint icons into rpcn status circles 2024-07-24 09:21:15 +02:00
Megamouse
14dea78ddc Add missing QPainter::end calls 2024-07-24 09:21:15 +02:00
Megamouse
5737ed3bce Fix some msvc warnings 2024-07-24 09:21:15 +02:00
Megamouse
82de139be5 Qt: Fix resolution dropdown if resolution flags of game are empty
Fixes custom config creation error for games that have no resolution.
Fixes empty dropdowns if resolution flags are 0 by adding all resolutions.
Make sure to keep 720p as option if the dropdown would be empty after all.
2024-07-22 23:41:40 +02:00
Megamouse
c533dc969d input: reload gui settings when the visibility or the active window changes 2024-07-22 22:44:42 +02:00
Megamouse
34506daff6 input: log used pad config 2024-07-22 22:44:42 +02:00
Silent
c0808448be sceNp: Fix sending partial results from sceNpScoreRecordGameData
Fixes Ghost Data in Ridge Racer 7
2024-07-22 21:52:33 +02:00
Megamouse
f8a729f4b4 Improve dimensions dialog layout 2024-07-22 20:52:40 +02:00
Megamouse
c021165483 Disable stereo render combobox if other resolutions than 720p are selected
Also move to custom configuration
2024-07-22 19:49:28 +02:00
Megamouse
a21740f260 Rename resolutions to better convey irrelevance of aspect ratio 2024-07-22 19:49:28 +02:00
Pierrick Bouvier
3ab8922143 Fixed compilation
missing optional header (from commmit 500bf0f3f5)
2024-07-21 08:43:12 +02:00
shinra-electric
c0edd1bf7a Bump mvk to 1.2.10 2024-07-20 22:41:49 +02:00
shinra-electric
25d71d818a Bump mvk to 1.2.10 in build script 2024-07-20 22:41:49 +02:00
Megamouse
5dc7a6a815 Fix MSVC filters 2024-07-20 07:37:17 +03:00
Megamouse
e0fce6cc5b Fix some warnings 2024-07-20 07:37:17 +03:00
Florin9doi
7fba56f27b USB: Replace if/else with switch 2024-07-19 22:10:11 +02:00
Florin9doi
33d2b27b91 USB: Top Shot Fearmaster device emulation 2024-07-19 22:10:11 +02:00
Florin9doi
088b594fa8 USB: Top Shot Elite device emulation 2024-07-19 22:10:11 +02:00
Florin9doi
a1a38b7b39 USB: Move uDraw GameTablet config from IO to Pads 2024-07-19 22:10:11 +02:00
Joshua de Reeper
500bf0f3f5 sys_usbd: Emulate Dimensions Toypad 2024-07-19 20:29:19 +02:00
Elad Ashkenazi
a2534263fe Savestates/PPU: Ensure correct PPU state on MMIO 2024-07-19 14:31:19 +03:00
Elad Ashkenazi
77e8f9a8ab SPU: Utilize Operating System sleep in detected RCHCNT loop 2024-07-19 14:31:19 +03:00
Silent
f3ceebabd9 sceNp: Improve SceNpCommunicationId logging 2024-07-18 21:42:07 +03:00
Silent
9e094fded6 Do not set the data size in sceNpBasicGetEvent for SCE_NP_BASIC_EVENT_OFFLINE
There is no data associated with this event,
size is not supposed to be set.
2024-07-18 21:42:07 +03:00
MSuih
ebcb403411 Remove Alipay link from FUNDING.yml 2024-07-18 20:44:04 +03:00
RipleyTom
dd9b3c651f Support old sceNpScoreRankData 2024-07-18 18:29:49 +02:00
oltolm
065a64371e improve CMake files
Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
2024-07-13 15:39:29 +02:00
Megamouse
99b44cf33a Update FAudio to 24.07 2024-07-09 19:15:50 +02:00
Megamouse
d6380a1084 Update Wolfssl to 5.7.2 2024-07-09 19:15:50 +02:00
Megamouse
dd4fde9599 Update SDL to 2.30.5 2024-07-09 19:15:50 +02:00
Megamouse
8236b58a29 cellGem: fix camera format conversions
Use interleaved RGBA format and get rid of BE/LE differences.
2024-07-08 23:11:03 +02:00
Megamouse
7ea64b53ad Qt: Fix camera id and format when default is selected 2024-07-08 20:16:23 +02:00
Megamouse
441b324afe Qt: Fix camera string comparison in settings_dialog
The id() contains a QByteArray, not a QString.
2024-07-08 20:16:23 +02:00
Elad Ashkenazi
669ce1faca Fixup compilation
And reduce limit for PUTLLC16 block scan
2024-07-08 10:06:56 +03:00
Elad Ashkenazi
f08d4a53b3 SPU: Make users tell what games matter for channel pattern 2024-07-08 10:06:56 +03:00
Elad Ashkenazi
7f8eec9dca Disable PUTLLC16 again 2024-07-08 10:06:56 +03:00
Elad Ashkenazi
8333830bd7 Progress Dialog: Stabilize remaining time 2024-07-08 10:06:56 +03:00
Elad Ashkenazi
2ca5d23aac SPU Analyzer: Make register state evaluation shorter 2024-07-08 10:06:56 +03:00
Elad Ashkenazi
aa5284c8f1 [WIP] SPU: Channel Loop Pattern Detection 2024-07-08 10:06:56 +03:00
Florin9doi
a1d2a72a78 USB: GunCon3 updates
-Process the mouse buttons even when x/y_max aren't yet determined.
 -Allows to start the calibration without shaking the mouse before.
-Extend support to 4 players. The games can't use more than 2, but it
allows more flexibility to mix DS3 and GC3.
-Avoid OOB for unsupported Pads
2024-07-07 18:34:52 +02:00
Florin9doi
58d27a9438 Pad: Simplify is_fake_pad logic 2024-07-07 18:34:52 +02:00
MSuih
b4e4aa9822
Improve error message when update cannot be installed due to version mismatch (#15773)
* Show the relevant versions whenever update fails to install due to version difference
2024-07-07 15:23:25 +02:00
Megamouse
856d8c303d Fix some visual studio filters 2024-07-07 01:09:45 +02:00
Megamouse
f0713c8940 Input/Overlays: show pressure intensity toggle hint 2024-07-06 19:58:53 +02:00
Megamouse
d23ac6f598 input: move player_id to pad struct 2024-07-06 19:58:53 +02:00
Megamouse
6948c0a30a Qt: disable battery LED settings if the pad handler doesn't support it 2024-07-06 18:55:48 +02:00
Megamouse
4c11554d2c Qt: fix player LED groupbox label 2024-07-06 18:55:48 +02:00
Megamouse
20f906bf9b input: add battery LED flag and some getters 2024-07-06 18:55:48 +02:00
Megamouse
1a61a7a39f input: allow running pad thread without emulation 2024-07-06 18:55:48 +02:00
Megamouse
0db7ab64ee Camera: copy JPG and RGBA data if needed 2024-07-06 18:55:48 +02:00
Elad Ashkenazi
33851d51ab Fixup and Improve CELL reservation notifications 2024-07-01 18:59:26 +03:00
5kft
6ddb21ab95
revert pull request #15618 2024-07-01 07:35:59 +03:00
Megamouse
289b70d276 input: implement HidDevice::close
Preparing for further ps move additions down the line.
2024-06-30 12:51:24 +02:00
Megamouse
eab1c1260c cellGem: Implement cellGemEnableMagnetometer2 2024-06-30 12:51:24 +02:00
Megamouse
61435d26dc VS: fix MouseHandler.cpp filter 2024-06-30 12:02:37 +02:00
Megamouse
fc0878e688 Fix midi drum config loading 2024-06-30 12:02:37 +02:00
Megamouse
352229efbd Fix some warnings 2024-06-30 12:02:37 +02:00
Megamouse
44e4e67aa8 Simplify duplicate mouse handler init code 2024-06-30 12:02:37 +02:00
Megamouse
c9a082614d input: ignore raw mouse double click when used as move handler 2024-06-30 12:02:37 +02:00
Elad Ashkenazi
f948a80242 CELL: More efficient reservation notificatins 2024-06-30 07:46:14 +03:00
Elad Ashkenazi
c71edc0719 Remove check_state() inside thread notifiatios
This was a flawed concept due to risk of deadlocks.
Worst case some we will focus o performanc regressins indvidually as we should and not accept this bug.
2024-06-29 14:02:12 +03:00
kd-11
71524271e9 rsx: Fix codegen when depth-conversion is enabled 2024-06-28 12:13:33 +02:00
Megamouse
d5923ef808 Fix weird new gcc namespace warning 2024-06-28 00:24:07 +02:00
kd-11
ef136acb6c Whitespace fix 2024-06-27 22:55:56 +02:00
kd-11
a5956cfa82 rsx: Fix wrapped/clamped MSAA sampling behavior with dynamic flags 2024-06-27 22:55:56 +02:00
Megamouse
703de01ebf input: actually initialize midi drum notes and combos 2024-06-27 22:14:35 +02:00
Megamouse
8343e35146 cellCamera: improve error logging 2024-06-27 19:12:34 +02:00
Megamouse
0679b502f2 input: allow dynamic change of midi drum config 2024-06-27 19:12:34 +02:00
Megamouse
e790842007 input: allow dynamic change of mouse configs 2024-06-27 19:12:34 +02:00
Elad Ashkenazi
a9d53e98de SPU LLVM: Fix LSA masking for PUTLLC16, disable RTIME checks 2024-06-27 16:58:23 +03:00
Elad Ashkenazi
908082e7c3 Silence some cellGem logging 2024-06-27 16:58:23 +03:00
Elad Ashkenazi
8ec6187dc7 SPU Analyzer: Fix support for multi-block value merge 2024-06-27 16:58:23 +03:00
shinra-electric
50ce4cbea5 Update build script to MoltenVK 1.2.9
Updates from 1.2.7 to 1.2.9
Homebrew had issues with 1.2.8, so we skipped that version.
2024-06-27 03:52:09 +02:00
shinra-electric
3904900243 Update MoltenVK
Updates from 1.2.7 to 1.2.9
Homebrew had problems with 1.2.8, so skip that version.
2024-06-27 03:52:09 +02:00
SuperSamus
33d6e6ce6c skylander_dialog: Fix Drill Sergeant's name 2024-06-27 03:13:17 +02:00
Megamouse
363a4dbdef Fix warning: dangling pointer (construct string_view from temporary string) 2024-06-27 03:21:35 +03:00
Megamouse
e635abe552 Fix warning: std::move of const variables 2024-06-27 03:21:35 +03:00
Megamouse
df6bec236f input: Use same dualsense gyro values as linux kernel 2024-06-27 01:15:23 +02:00
Megamouse
78cb7963fb input: invalidate ds4/dualsense calibration instead of disabling the controller 2024-06-27 01:15:23 +02:00
Megamouse
b251d81065 input: fix minimum turntable input
DJ Hero does not register input if the turntable is 0, so force it to 1.
This will happen if you map it to the left stick and push it all the way down,
or if you use a keyboard, which sends the max value on key press.
2024-06-26 23:45:00 +02:00
Megamouse
11ee80a070 input: add missing lock to keyboard handler ReleaseAllKeys
This should fix a segfault I encountered when closing a game.
I think the consumers were removed while the window went out of focus.
2024-06-26 22:19:56 +02:00
Megamouse
8050e1f853 input: fix ds3 gyro offset 2024-06-26 17:19:06 +02:00
Elad Ashkenazi
f18e3be4f2
Cut scenNpDrmIsAvailable sleep time by half 2024-06-25 10:02:53 +03:00
Elad Ashkenazi
87f5368d3c PPU: Fix access violation on logging 2024-06-23 19:29:13 +03:00
Megamouse
945bfaf0ea input: differentiate between left and right modifier keys 2024-06-23 15:54:13 +02:00
Megamouse
1cef7df006 input: add missing control key to basic keyboard
The meta key logic changed, so we now have to add it.
2024-06-23 15:54:13 +02:00
Megamouse
c2899ad4cb Replace sys_io log channel with cell module log channels
For more granular log filtering
2024-06-23 15:54:13 +02:00
MSuih
7e274a1ff4 Fix locale on linux 2024-06-23 12:15:42 +02:00
Megamouse
7e27e1420e input: try to fix macOS SDL crash 2024-06-23 09:31:48 +02:00
Megamouse
7367f72f4a Update SDL to 2.30.4 2024-06-23 08:25:45 +02:00
Megamouse
81f1f49d5d Update 7zip to 24.07 2024-06-23 08:25:45 +02:00
Elad Ashkenazi
bceaf46e2f Savestates/Mouse: Fix Mouse handler use 2024-06-20 20:25:07 +03:00
Elad Ashkenazi
649714429b SPU: Notify threads on RdEventStat properly 2024-06-20 00:51:51 +03:00
Elad Ashkenazi
dbb02241c5 SPU: Cleanup GETLLAR 2024-06-20 00:51:51 +03:00
Elad Ashkenazi
f228ca7961 SPU LLVM: Avoid sinking stores out of non-loops 2024-06-20 00:51:51 +03:00
Elad Ashkenazi
5b973448bf SPU: Better GETLLAR spin detection 2024-06-15 22:41:52 +03:00
Elad Ashkenazi
d5935a37bb SPU: Notify threads if data changed in RdEventStat 2024-06-15 22:41:52 +03:00
Elad Ashkenazi
5693cc9eb3 SPU: smart GETLLAR spin detection 2024-06-15 22:41:52 +03:00
RipleyTom
feff2ba09e Fix race in sys_net select and poll 2024-06-14 10:52:34 +03:00
Elad Ashkenazi
caf81f1367 LV2: Race condition fixup 2024-06-12 12:41:15 +03:00
Elad Ashkenazi
f58b418b7d LV2: Optimization for timeout 2024-06-12 11:31:56 +03:00
Elad Ashkenazi
cec976b70a Minor fix of sys_lwmutex_destroy 2024-06-12 11:31:56 +03:00
Elad Ashkenazi
1e5f6ba39c Fix sys_lwmutex_lock for SYS_SYNC_RETRY 2024-06-12 11:31:56 +03:00
Megamouse
b8452d29d6 input: move pad_state_notify_state_change to pad_thread 2024-06-12 08:24:12 +02:00
Megamouse
b0d4858e42 vm_ptr: return nullptr and add some nullptr deref checks 2024-06-12 06:48:48 +03:00
kd-11
8d6c957cbc rsx: Fix simple_array<T>::map 2024-06-12 04:02:12 +03:00
Megamouse
1e5cd7f140 sceNp: fix print_get_roomdata_external_list_resp pointer checks 2024-06-12 00:18:37 +02:00
Megamouse
e64d09b6f7 sceNpCommerce2: check sku_ids 2024-06-12 00:18:37 +02:00
Megamouse
4d09ba5080 sceNp: add some more rpcn array pointer checks
These probably return an error on real firmware...
2024-06-12 00:18:37 +02:00
Megamouse
c8e2b9cb99 sceNp: add some more array pointer checks 2024-06-12 00:18:37 +02:00
Megamouse
be863e763f sceNp: add array sanity checks to print functions 2024-06-12 00:18:37 +02:00
Megamouse
cc19685207 Qt: log error cause on shortcut icon creation 2024-06-11 22:31:47 +02:00
Megamouse
461862be46 rsx: make some functions const 2024-06-11 20:35:49 +02:00
Megamouse
1c7850de17 rsx: fix warnings and add missing default cases 2024-06-11 20:35:49 +02:00
Megamouse
f4622fac41 Fix yet another warning 2024-06-11 20:35:49 +02:00
Megamouse
244e9c96ad ds3: use input_report struct 2024-06-11 00:09:38 +02:00
Megamouse
645621b243 Dualsense/DS4: Replace buffers with human readable structs
Also don't turn off the lights when the game closes.
2024-06-11 00:09:38 +02:00
kd-11
2647a09790 rsx: Avoid the complex remapper checks if the texture isn't in the XINT8 group 2024-06-10 20:41:45 +03:00
kd-11
bee14cad16 rsx: Do not apply texture remapping operations to "1" overrides. 2024-06-10 20:41:45 +03:00
kd-11
e966289ddb rsx: Drop hard requirement for GL_EXT_shader_integer_mix 2024-06-10 20:41:45 +03:00
kd-11
32a5641ace Annotations 2024-06-10 20:41:45 +03:00
kd-11
d6ed56aed6 rsx: Fix refactoring mess 2024-06-10 20:41:45 +03:00
kd-11
14e1214645 rsx: Properly implement 8-bit signed renormalization for textures 2024-06-10 20:41:45 +03:00
Elad Ashkenazi
0b22423ab8 Minor fs::file usage fixes
Do not crash on file creation failure. Make some config writes atomic.
2024-06-10 13:45:23 +03:00
Elad Ashkenazi
4c9296c07f Game List: Add shortcut to open cache dir
Enabled whenever debug tab is in order to protect important caches such as PPU from accidental deletion.
2024-06-10 13:45:23 +03:00
Elad Ashkenazi
8b1e7c6a48 SPU: Enable PUTLLC16 with RTIME checks 2024-06-10 09:17:38 +03:00
brian218
c73302f715 sys_ppu_thread: Fixed up sys_ppu_thread_join()'s check for detached threads
sys_game: Corrected sys_game_set_system_sw_version()'s error code
2024-06-10 07:44:49 +03:00
Elad Ashkenazi
6fff22391c PPU Analyzer: Utilize exported functions 2024-06-08 14:09:37 +03:00
Elad Ashkenazi
6d280c5f3c Ensure PPU Compilation Hint is refreshed 2024-06-08 14:09:37 +03:00
Elad Ashkenazi
929be0b4e6 PPU LLVM: Implement OE for few instructions 2024-06-08 14:09:37 +03:00
Elad Ashkenazi
4e8e5a7fed PPU Debug: Dump decrypted PRX 2024-06-08 14:09:37 +03:00
Elad Ashkenazi
721e55458c PPU Analyzer: Fixes 2024-06-08 14:09:37 +03:00
Megamouse
5a13c02774 SPU: Silence some warnings 2024-06-08 01:54:24 +03:00
Megamouse
c15121377f Input: Implement anti deadzone 2024-06-07 21:18:37 +02:00
Megamouse
5b6f340a7b openal: add headers to msvc 2024-06-07 21:18:37 +02:00
Megamouse
b52deed4dd cellGem: Fix raw mouse connection state 2024-06-07 00:25:49 +02:00
Megamouse
2199aa0635 Fix some tooltips 2024-06-07 00:25:49 +02:00
Elad Ashkenazi
5c1a1a30ee SPU Analyzer: Fix BRA instruction targets 2024-06-06 21:13:24 +03:00
Elad Ashkenazi
47fe955d35 SPU LLVM: Ensure programs are written to disk irregardless of failure 2024-06-06 21:13:24 +03:00
Elad Ashkenazi
ac5d907002 SPU: Remove inaccurate GETLLAR option 2024-06-06 19:27:52 +03:00
Elad Ashkenazi
55ed95b42c SPU Analyzer: Minor PUTLLC16 bugfixes 2024-06-06 19:27:52 +03:00
RipleyTom
1ec523b018 Fix stb cmake build 2024-06-06 15:02:47 +02:00
Megamouse
d5747a61f1 Add stb submodule 2024-06-06 15:02:47 +02:00
Megamouse
eb574e8a35 Fix config_mouse.yml path on windows 2024-06-06 15:02:47 +02:00
Megamouse
ff3fb3da65 Use openal-soft submodule and link statically 2024-06-06 15:02:47 +02:00
Megamouse
57375ca13f zstd: fix msvc ProjectName 2024-06-06 15:02:47 +02:00
Megamouse
de48646581 Update FAudio to 24.06 2024-06-06 15:02:47 +02:00
Megamouse
f4bb7a9d29 Update 7zip to 24.06 2024-06-06 15:02:47 +02:00
Ani
bd8590212d OpenAL: Fix crash when loading certain audio devices
Updates the OpenAL binary from 1.19.1 to 1.23.1, the headers/libraries were updated in the past but the binary was forgotten. This fixes https://github.com/RPCS3/rpcs3/issues/14502.
2024-06-06 01:19:10 +02:00
Ani
c475c72ead Cirrus: Update to FreeBSD 13.3 2024-06-06 00:19:00 +02:00
Sanjay Govind
d9ec33f51e
USB: If a Santroller device is in use elsewhere, don't send it commands (#15655) 2024-06-04 01:17:33 +02:00
Elad Ashkenazi
64127b5c1b buffer_stream.hpp: Try to fix MacOS compilation 2024-06-03 09:55:24 +03:00
Elad Ashkenazi
4f1db9a00f Unix/Savestates: Fix savestates destination 2024-06-03 09:55:24 +03:00
trigger
ba29a37871 sys_net: properly return error in sendto 2024-06-03 04:31:45 +03:00
Elad Ashkenazi
e5ce88f007 SPU LLVM: Disable PUTLLC16 temporarily 2024-05-31 16:10:15 +03:00
kd-11
53b81af704 vk: Dump diagnostic messages if device creation fails 2024-05-30 21:16:12 +03:00
Elad Ashkenazi
67893fb8f8 PPU Progress Hint: Show it as long as it needs 2024-05-30 11:41:24 +03:00
Elad Ashkenazi
8fa23436f9 PPU Analyzer: Unuse per-instruction compilation on fallback 2024-05-30 11:41:24 +03:00
Elad Ashkenazi
e75eec7392 System.cpp: Fix crash on fatal error during Ready state
Also remove the assert from BlockingCallFromMainThread, in some cases it may even be correct. Each case needs to be inspected alone.
2024-05-30 11:41:24 +03:00
Elad Ashkenazi
26b21ed031 LLVM: Prevent crash on disk space shortage 2024-05-30 11:41:24 +03:00
Elad Ashkenazi
c556322fc5 LLVM: Fix nullptr deref when accessing broken cache files 2024-05-30 11:41:24 +03:00
Elad Ashkenazi
a6b2bf69f1 SPU Debug: Fix crash on missing directory 2024-05-30 11:41:24 +03:00
Elad Ashkenazi
0da51d25bc SPU: Add block prefix to log if available 2024-05-30 11:41:24 +03:00
KF
c47212ff90 fix typo from PR 15636 2024-05-29 14:14:13 +03:00
kd-11
9fb79b8930 vk: Fix typo 2024-05-29 03:28:18 +03:00
kd-11
d545aa01b2 vk: Add support for NVK driver 2024-05-29 03:28:18 +03:00
kd-11
2162b7e67f vk: Use std::set 2024-05-29 03:28:18 +03:00
kd-11
93040fc757 vk: Don't always preserve the renderpass for all drivers when doing transform hot-patch 2024-05-29 03:28:18 +03:00
Megamouse
a3457c29cb Overlays: allow ldd input even if len is 0
Rock Band 3 doesn't seem to care about the len. It's always 0.
2024-05-26 10:54:12 +02:00
Megamouse
c0ed56cba0 cellKbCnvRawCode: don't use caps lock as shift lock unless we are using the qwertz or azerty layout 2024-05-26 08:32:32 +02:00
Megamouse
4bc719470c osk: use cell key code in CellOskDialogKeyMessage (🤦 we don't need the Qt code) 2024-05-26 08:32:32 +02:00
Megamouse
c01f0bffde cellKb: Clarify cellKbCnvRawCode alphabet conversion 2024-05-26 08:32:32 +02:00
Megamouse
0e32f19de8 input: remove unused parameter 2024-05-25 22:23:15 +02:00
Megamouse
ab15584eed Add 7zip submodule 2024-05-25 22:23:15 +02:00
Megamouse
ed579fbb9c Remove 7z copy pasta repo 2024-05-25 22:23:15 +02:00
Megamouse
21c03b74b6 input: only unregister devices if there is no other handler registered
Also center mouse if a new device was added
2024-05-25 00:51:05 +02:00
Megamouse
657acc90e4 input: fix ingame raw mouse enumeration 2024-05-25 00:51:05 +02:00
Megamouse
fa144d3307 input/qt: enumerate raw mouse devices once a seconds in the config dialog 2024-05-25 00:51:05 +02:00
Megamouse
5cc05d082d qt: ignore right click to clear input config button if the button is disabled 2024-05-25 00:51:05 +02:00
Megamouse
49712f8f4e input/qt: increase max raw mouse devices to 16 2024-05-25 00:51:05 +02:00
Megamouse
b0550027c3 input: implement raw mouse hot swap 2024-05-25 00:51:05 +02:00
Megamouse
c78e717ef6 input: add mutex for raw mice 2024-05-25 00:51:05 +02:00
Megamouse
9c2e6a8f31 input: only unregister raw mouse devices if they were registered 2024-05-25 00:51:05 +02:00
Megamouse
898c92045d input: add all mice that were requested. only connect the ones that exist 2024-05-25 00:51:05 +02:00
Megamouse
b3df439c51 input: add timer to raw mouse enumeration 2024-05-25 00:51:05 +02:00
Megamouse
b56f9490f5 input: move raw mouse register logic to own function 2024-05-25 00:51:05 +02:00
Elad Ashkenazi
3dfbd14de2 SPU LLVM: Implement PUTLLC16 for accurate RSX reservations 2024-05-24 14:14:42 +03:00
Megamouse
e8899bf9fc Update curl to 8.8.0 2024-05-24 00:12:59 +02:00
Elad Ashkenazi
e94928318e SPU LLVM: Disable PUTLLC16 optimization on accurate RSX reservations 2024-05-23 19:38:31 +03:00
Elad Ashkenazi
d3ab62c4b1 RSX/SPU: Import and improve RSX accurate reservations functionality 2024-05-23 19:38:31 +03:00
Elad Ashkenazi
b3c9f7647f Savestates/SPU LLVM: Fix sinking store finally 2024-05-22 12:58:43 +03:00
Megamouse
5d6d42d15d input: fix now_connect in raw mouse handler 2024-05-21 23:35:35 +02:00
Megamouse
58863c0c41 input/qt: Keep configured raw mouse device in list even if it is not connected 2024-05-21 23:35:35 +02:00
Megamouse
13673d2c79 input/qt: fix out of bounds exception when using button ids in raw mouse config dialog 2024-05-21 23:35:35 +02:00
Megamouse
2978a9aa40 input: fix reading mouse buttons from guncon cfg 2024-05-21 23:35:35 +02:00
Megamouse
9ceacd4867 input: remove No Button string from raw mouse config 2024-05-21 23:35:35 +02:00
Megamouse
32a938abd2 input/qt: allow to map mouse buttons in the guncon config 2024-05-21 23:35:35 +02:00
Megamouse
5a08ae4f41 input/qt: let user choose raw mouse device 2024-05-21 23:35:35 +02:00
Megamouse
dae4eb2d0e raw_mouse: fix out of bounds error 2024-05-21 23:35:35 +02:00
Megamouse
1600ca2c03 input: add horizontal mouse scroll/tilt to mouse handlers 2024-05-21 23:35:35 +02:00
Megamouse
bf85902485 input: move mouse handler code to cpp 2024-05-21 23:35:35 +02:00
Megamouse
7ffb61f650 Qt: use mouse input to map basic mouse buttons 2024-05-21 23:35:35 +02:00
Megamouse
eb8ab8ef15 implement mouse handler config 2024-05-21 23:35:35 +02:00
deReeperJosh
3ba4c8a1c7 Add 2 more slots for Power Discs on Infinity Base 2024-05-21 18:59:55 +03:00
Elad Ashkenazi
afa7a27f33 SPU Analyzer: Minor bugfix 2024-05-21 16:37:54 +03:00
Elad Ashkenazi
e1a0887f51 SPU Analyzer: Implement loop analysis 2024-05-21 16:37:54 +03:00
Eladash
ff42459239 SPU Analyzer: Improve value propagation 2024-05-21 16:37:54 +03:00
Eladash
71dd22a55d SPU LLVM: Avoid notifications in cellSync SPU functions
Identify them using their unique error codes.
2024-05-21 16:37:54 +03:00
Eladash
f9345c7699 SPU LLVM: PUTLLC 16 Optimization
Also, do not check LR event if already raised in PUTLLC
2024-05-21 16:37:54 +03:00
Elad Ashkenazi
a2dcbb9c13 Replace src_loc with std::soource_location 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
2d32ba5ca2 Rename Suspsend to Anti-Cheat Savestates
The original naming was derived from the Developer perspective, but it does not help the actual user.
2024-05-21 14:19:12 +03:00
Elad Ashkenazi
7b3c9bea58 StrFmt.h: Fix throw_exception log message 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
351bf49d9f SPU Debug: Fix GUI thread halt on log massive messages 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
164c3fa9cb sys_tty: Reduce thread dump log spam
Some games just log random errors.
2024-05-21 14:19:12 +03:00
Elad Ashkenazi
89299eb1f7 Reduce logging of some SPU debug data 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
dae83c53fb rsx/vk: Derstroy shader workers on thread exit 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
ad41796ddb Settings: Tell the user how to disable log limit 2024-05-21 14:19:12 +03:00
RipleyTom
e42ba05883 Improve match2 ctx context start 2024-05-19 20:06:49 +02:00
RipleyTom
b83f1e7694 Improve CB accuracy for Avc2 2024-05-19 19:16:30 +02:00
Elad Ashkenazi
6fbe4c3e2e cellSysutil: Implement dispatcher callback unloading 2024-05-19 09:26:26 +03:00
Piotr Paweł Stefaniak
fe9bb31b09 Avoid repeating the -march flag
Under the right circumstances, both -march=armv8.1-a and -march=native
were added. But it only makes sense to use one or the other.
2024-05-19 02:49:00 +02:00
Megamouse
8dac5e34be Fix GunCon3 encoding 2024-05-18 19:17:08 +02:00
Megamouse
9a8ed80026 memory_viewer_panel: use existing thread_class instead of extra enum 2024-05-18 16:16:08 +02:00
Megamouse
ee7726c4ec fix GunCon3 warnings 2024-05-18 16:16:08 +02:00
Megamouse
99eb84c104 Fix some warnings 2024-05-18 16:16:08 +02:00
Megamouse
25ce3880c4 Replace get_thread_class with static cast for performance reasons 2024-05-18 16:16:08 +02:00
Megamouse
b8f8d09f97 Fix spu_thread audit check 2024-05-18 16:16:08 +02:00
Megamouse
ab923bc2c3 Add comment for thread_scheduler_mode::old to get_affinity_mask 2024-05-18 16:16:08 +02:00
Megamouse
10d85d4f51 CPUThread: remove m_class member due to bad ppu cache design 2024-05-18 16:16:08 +02:00
Megamouse
2637dc35a7 rsx: Initialize some uninitialized members 2024-05-18 16:16:08 +02:00
Megamouse
dfee5b9a6c threads: replace magic number id_type with thread_class 2024-05-18 16:16:08 +02:00
Megamouse
aff2588cce overlays/input: allow ldd pad input 2024-05-18 14:34:08 +02:00
Florin9doi
dc05d38867 PAD: Fix ldd_data transfer 2024-05-18 12:30:15 +02:00
Joshua de Reeper
9ceb22a2c0 Add Skylander Dump File Types 2024-05-17 10:03:58 +02:00
Florin9doi
db89c1d8b8 USB: Add GunCon 3 config window 2024-05-17 08:58:14 +02:00
Florin9doi
ecedbc38ec Consolidate input products in a single place 2024-05-17 08:58:14 +02:00
RipleyTom
3e7ff4059e Add matching2 option handling 2024-05-16 22:38:11 +02:00
Megamouse
ba379ceba2 spullvm: fix compilation: reference to local binding 'b2' declared in enclosing function
Also optimize some unnecessary vector lookups
2024-05-16 03:05:17 +03:00
RipleyTom
0a956906de fix size calculation in get_member_and_attrs 2024-05-15 17:57:12 +03:00
kd-11
75d6765adc gl: Handle GCM_FORMAT_G8B8 readback compatibility check 2024-05-15 04:18:12 +03:00
Elad Ashkenazi
6bceebbb1a CMake fixes
Thanks to @RipleyTom

Co-Authored-By: RipleyTom <RipleyTom@users.noreply.github.com>
2024-05-14 19:36:48 +03:00
Elad Ashkenazi
6d8575d0d0 Savestates: Warn on invalid SPU save state 2024-05-14 19:36:48 +03:00
Elad Ashkenazi
32e01b5f1a Savestates/SPU LLVM: Fix sinking stores
Found thanks to mr spaces.
2024-05-14 19:36:48 +03:00
Elad Ashkenazi
302fe53704 Log SPU access violation in always-level 2024-05-14 19:36:48 +03:00
Elad Ashkenazi
66008d5ca4 Savestates: Multi-threaded compression, use ZSTD 2024-05-14 19:36:48 +03:00
Elad Ashkenazi
7c313703a2 Savestates: Fix SPU pause from access violation handler 2024-05-14 19:36:48 +03:00
Elad Ashkenazi
2eabc77deb Hide Game Window as soon as emulation closes 2024-05-14 19:36:48 +03:00
Elad Ashkenazi
22b566cb15 Progress Dialog: Extremely important text fix
Thanks to mr spaces.
2024-05-14 19:36:48 +03:00
Eladash
2243e22630 sys_fs: Fix race in file stream API 2024-05-14 19:36:48 +03:00
kd-11
781c5a76d9 rsx: Fix processing of deferred indexed draw parameter updates 2024-05-14 16:32:41 +03:00
Florin9doi
0e3fd6a582 Remove duplicated code for USB connection/disconnection 2024-05-14 09:05:03 +02:00
Florin9doi
d1b4d4b599 Remove the redundant config for GunCon3 2024-05-14 09:05:03 +02:00
Florin9doi
65455b454e Hotplug support for emulated devices 2024-05-14 09:05:03 +02:00
Florin9doi
941c87f6d7 Create a device class for GunCon3 which is ignored by cellPad 2024-05-14 09:05:03 +02:00
Florin9doi
aa8fbf8102 Rename is_fake_move to fit other devices 2024-05-14 09:05:03 +02:00
RipleyTom
a50683d6ca
sys_net improvements (#15584)
Also remove redundant ensures
2024-05-13 05:35:08 +03:00
kd-11
fc92aef4d1 vk: Perform the buffer update without splitting the renderpasses 2024-05-12 21:26:25 +03:00
kd-11
62eb9c2012 vk: Allow barriers to optionally skip renderpass splitting
- This is allowed by spec when we don't care about what happens outside the renderpass
2024-05-12 21:26:25 +03:00
kd-11
37c9392e59 rsx: Initialize some vars 2024-05-12 21:26:25 +03:00
kd-11
0d0fc23f9e rsx: Use range intersection to speed up xform constants patching 2024-05-12 21:26:25 +03:00
kd-11
b0375d9c9a rsx: Add a base class for vertex programs and implement range intersection for constant IDs 2024-05-12 21:26:25 +03:00
kd-11
cc313bfba1 gl: Implement transform constants patching 2024-05-12 21:26:25 +03:00
kd-11
4cf7b7022e gl: Memoize the bound range for a buffer 2024-05-12 21:26:25 +03:00
kd-11
3ef1eb8529 vk: Minor cleanup 2024-05-12 21:26:25 +03:00
kd-11
3a466d6fd2 vk: Whitespace fix 2024-05-12 21:26:25 +03:00
kd-11
3fa6064068 vk: Silence some warnings 2024-05-12 21:26:25 +03:00
kd-11
a09111052a rsx/vk: Implement batched transform constant updates 2024-05-12 21:26:25 +03:00
kd-11
ac6f77a744 rsx: Provide a supplementary argument to the command barriers 2024-05-12 21:26:25 +03:00
kd-11
9e1019b1cf rsx: Start splitting off some stuff into the graph backend class 2024-05-12 21:26:25 +03:00
kd-11
77b9e6560b vk: Fix a spec violation 2024-05-12 21:26:25 +03:00
kd-11
279393337e vk: Implement dynamic transform constant updates 2024-05-12 21:26:25 +03:00
kd-11
96793193b5 rsx: Implement deferred request size io buffer where we do not know the size beforehand. 2024-05-12 21:26:25 +03:00
kd-11
406a519400 rsx: Implement deferred transform constants load 2024-05-12 21:26:25 +03:00
Megamouse
70e40ce857 cellPad: don't report fake move pads as connected 2024-05-12 18:40:51 +02:00
Megamouse
5fb6be4bf6 vfs_directory: try to fix compilation on gcc 14.1 2024-05-11 18:40:55 +02:00
Florin9doi
7ac097255e USB: Disconnect the virtual device only for TRANSFER_NO_DEVICE error
Resolve: #15565
2024-05-10 06:56:02 +03:00
Megamouse
c02aae417a Update SDL to 2.30.3 2024-05-09 08:16:26 +02:00
Megamouse
068642e53b Update FAudio to 24.05 2024-05-09 08:16:26 +02:00
RipleyTom
b7a882f42b Split normal sockets and p2p sockets handling v2 2024-05-08 20:04:23 +03:00
Megamouse
04d6ff274b Move cache dir code to utils 2024-05-07 08:47:29 +02:00
Megamouse
c11c286206 Adust vsh cache dir criteria 2024-05-07 08:47:29 +02:00
Megamouse
bdeeae47a2 Qt: disable vsh removal options if vsh is running 2024-05-07 08:47:29 +02:00
Megamouse
453bb43629 Qt: allow to remove vsh cache in context menu 2024-05-07 08:47:29 +02:00
Megamouse
e35b2e5daa Qt: allow to batch remove vsh cache 2024-05-07 08:47:29 +02:00
Megamouse
f418ad74f5 VSH: move cache to /cache/vsh/ 2024-05-07 08:47:29 +02:00
oltolm
587d0b2c36 merge qt_music_error_handler into qt_music_handler 2024-05-06 01:57:52 +02:00
oltolm
86f86f516a merge qt_camera_error_handler into qt_camera_handler 2024-05-06 01:57:52 +02:00
Megamouse
11562c430a Qt: replace m_progress_dialog_timer with setMinimumDuration
No idea why this was done so complicated xD
2024-05-05 08:31:13 +02:00
Megamouse
5745862fa8 Qt: properly hide and show progress indicator
This was previously always shown, since we never really re-used the progress dialogs.
2024-05-05 08:31:13 +02:00
Megamouse
281f248d91 Qt: remove seemingly obsolete processEvents
Replace them with early outs on cancel.
The processEvents was probably added to allow user interaction.
But it works fine without it as far as I can tell.
2024-05-05 08:31:13 +02:00
Megamouse
d6d6ce9c5f Qt: Keep progress dialog alive to fix rare segfaults 2024-05-05 08:31:13 +02:00
Elad Ashkenazi
3856b77e15 Savestates: Fix avconf serialization 2024-05-05 06:57:11 +03:00
Elad Ashkenazi
91a54c11eb Savestates: Fixup file write 2024-05-05 06:57:11 +03:00
Megamouse
0fcb0b7d8e cellVideoOutGetDeviceInfo: Fix Interlace typo for 1080p 2024-05-05 01:38:54 +02:00
Megamouse
9f90ca1b48 Rename enum values to be more precise 2024-05-05 01:38:54 +02:00
Megamouse
ee8629835b Hide interlaced resolutions from the settings dialog 2024-05-05 01:38:54 +02:00
Megamouse
e164d462b4 cellVideoOut: support interlaced scan modes 2024-05-05 01:38:54 +02:00
Megamouse
8e5fec785e Remove p from resolution strings. The Param.sfo doesn't specificy progressive/interlaced 2024-05-05 01:38:54 +02:00
Megamouse
cebf6dcd01 Allow any 1080p selection if the game supports 1080p 2024-05-05 01:38:54 +02:00
Megamouse
4aa83d1350 sys: force resolution to 720p if the game does not support the configuration
Maybe prevents some issues with global config.
2024-05-05 01:38:54 +02:00
Megamouse
96104688e1 Qt: Replace custom config resolution string logic with enum values 2024-05-05 01:38:54 +02:00
Megamouse
32666b5ae8 HLE: use original filename for media exports
No idea what's the real logic here.
I was just winging it with the title before.
It's most likely just meant for metadata.
2024-05-04 22:18:44 +02:00
Elad Ashkenazi
6a776624ac Qt/Logs: Fixing spaces, optimize string to html conversion 2024-05-04 14:15:51 +03:00
Elad Ashkenazi
4fc7e27417 Add SPRX booting option 2024-05-04 14:15:51 +03:00
Elad Ashkenazi
e74cceb3f4 Add logging of exported SPRX functions on dummy load 2024-05-04 14:15:51 +03:00
Eladash
7bd4cfc5b3 Logging fix 2024-05-04 14:15:51 +03:00
Eladash
0791349455 Avoid calling std::vector::data() if empty 2024-05-04 14:15:51 +03:00
Eladash
b83e39a540 Fix some warnings 2024-05-04 14:15:51 +03:00
Eladash
4905cd425f Thread.cpp: Prevent repeatedly halting the debugger 2024-05-04 14:15:51 +03:00
Eladash
bef832f4e0 llvm_calli fix 2024-05-04 14:15:51 +03:00
Eladash
b55f38290b Win32: Fix deadlock on std::cerr usage 2024-05-04 14:15:51 +03:00
Eladash
51e1598e42 Savestates: Fix rare race 2024-05-04 14:15:51 +03:00
Eladash
6b906b9a9c Fixup SPU Profiler 2024-05-04 14:15:51 +03:00
Florin9doi
f1ef3bdcd7 USB: Allow UsbPspCm passthrough 2024-05-02 10:12:38 +03:00
Ani
c16e176fbe rpcs3_version: Bump to 0.0.32 2024-05-01 17:01:10 +02:00
Florin9doi
55fccf03fa USB: Update GameTablet 2024-05-01 09:52:30 +02:00
Florin9doi
d3f9ae4868 USB: GunCon 3 emulation 2024-05-01 09:52:30 +02:00
Florin9doi
debeafa36b USB: Update GameTablet
- Allows to use rawinput handler
- Use a struct to access the input data
2024-05-01 09:52:30 +02:00
Ani
39e946630d syscall: Register syscall 149 sys_time_get_system_time 2024-04-29 10:25:21 -07:00
RipleyTom
8d815e8ee0 Clamp spu_fi results 2024-04-29 05:21:49 +03:00
Elad Ashkenazi
430b57833d SPU LLVM: Remove wrong zero sign fixup 2024-04-28 20:39:57 +03:00
Megamouse
e32c48d0dd Camera: optimize some loops
Factor out some conditions in RAW8 loop.
Use floats YUV loop.
Replace pixel getters with simple pointers.
2024-04-27 14:23:56 +02:00
capriots
e2402b1c8f cellRtc: review fixes 2024-04-27 13:33:09 +02:00
capriots
36abdd7114 sys_time: review fixes 2024-04-27 13:33:09 +02:00
capriots
79f54771b5 cellRtc: set to HLE by default 2024-04-27 13:33:09 +02:00
capriots
2556f84752 cellRtc: replace vm::check_addr() with sys_memory_get_page_attribute() 2024-04-27 13:33:09 +02:00
capriots
c8e624850b cellRtc: improvements 2024-04-27 13:33:09 +02:00
capriots
56692e23f5 lv2: stub sys_time syscalls, add error code to sys_ss 2024-04-27 13:33:09 +02:00
RipleyTom
b38ce9452d Revert "Split normal sockets and p2p sockets handling"
This reverts commit 08c3a38b67.
2024-04-27 10:45:14 +02:00
Megamouse
fcba193a3c input: use keyboard consumers to seperate cell and overlay logic 2024-04-27 01:03:23 +02:00
RipleyTom
6fc7fa3b13 Logging improvements 2024-04-27 00:12:14 +02:00
Elad Ashkenazi
ad4216a3fc PPU LLVM: Do not crash on linkage of garbage code 2024-04-26 18:55:50 +03:00
RipleyTom
08c3a38b67 Split normal sockets and p2p sockets handling 2024-04-24 14:15:17 +03:00
Megamouse
b8165af054 rsx: optimize some loops 2024-04-24 12:16:45 +03:00
Elad Ashkenazi
90b6912daa
Compile AUDIT on release builds
In Release, compile the code in constexpr-disabled context. this way it does not risk generating actual code but still compiles.
2024-04-23 17:24:22 +03:00
oltolm
862727e9bf simplify template code like std::invoke_result<T>::type 2024-04-21 18:15:17 +03:00
oltolm
9e9a3262eb simplify template code like std::is_same<T>::value 2024-04-21 18:15:17 +03:00
Florin9doi
c268189e38 Don't crash the game if only a LDD controller is present 2024-04-21 12:05:24 +03:00
Megamouse
94431a7a33 Fix include on linux 2024-04-20 19:46:05 +02:00
Megamouse
b4d5b44e00 Don't create perf map files in linux unless enabled 2024-04-20 19:46:05 +02:00
Megamouse
16f006362e Move freopen to console.h 2024-04-20 17:23:10 +03:00
capriots
dfec577417
cellRtc: implement remaining parsers, improve formatters (#15451) 2024-04-20 15:41:42 +02:00
RipleyTom
33e2f8766a Update spurs_test.self 2024-04-20 13:31:12 +02:00
RipleyTom
31a080a9cb Warning cleanup 2024-04-20 13:31:12 +02:00
Megamouse
14e9c8954c cellMusic 2024-04-20 11:55:49 +02:00
Megamouse
dff7352e2e llvm: silence warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing] 2024-04-20 01:38:11 +02:00
Megamouse
30bb6c9fb9 cellSysutilAvc2MicRead: Fix some nonsensical nullptr deref warning 2024-04-20 01:38:11 +02:00
Megamouse
7485ec2223 cellKb: fix missing slashes and brackets on japanese layout 2024-04-19 23:47:59 +02:00
Megamouse
60082864a6 cellKb: actually set the arrange member 2024-04-19 23:47:59 +02:00
Megamouse
dcb8f21b2b Use unordered map to store keyboard keys
This potentially reduces latency ever so slightly.
2024-04-19 23:47:59 +02:00
Eladash
b18a97e777 SPU Analyzer: Filter calls to calls 2024-04-19 20:51:37 +03:00
Eladash
c7d93bd470 PPU Analyzer: Look for functions using callers (fallback) 2024-04-19 20:51:37 +03:00
Eladash
7bf8917c08 PPU LLVM: Fix crash in Unity games 2024-04-19 20:51:37 +03:00
Eladash
093198e3d5 savestate_utils.cpp: Fixup a tiny bug 2024-04-19 20:51:37 +03:00
Megamouse
e48bd29584 Qt: try to fix sound effects
Don't re-use sound effect objects.
Allow 3 sounds simultaneously.
2024-04-19 17:29:40 +02:00
Megamouse
1444981bdc overlays/osk: Don't use meta out key code in the osk overlay
The out key code is simply used to store the meta key ID.
It is not meant to be a real key code.
2024-04-19 01:29:22 +02:00
Megamouse
e3f6bbfcc9 fix some warnings and typos 2024-04-19 01:29:22 +02:00
Megamouse
89922b254c cellSysutilAvc2: improve unload and some more stuff 2024-04-18 13:22:45 +02:00
Florin9doi
ea8918291b uDraw emulation [3] 2024-04-18 09:39:02 +02:00
Florin9doi
21445fa01a uDraw emulation [2] 2024-04-18 09:39:02 +02:00
Florin9doi
8d340eecc1 Sort IO files 2024-04-18 09:39:02 +02:00
Florin9doi
463826bf13 uDraw emulation 2024-04-18 09:39:02 +02:00
kd-11
40eda1b972 rsx: Make const explicitly unsigned
- Can silence some GLSL compiler noise in mesa
2024-04-17 22:22:37 +03:00
kd-11
a5c3e303c7 rsx: Improve ROP output rounding precision
- Lower 12 bits seem to be unused based on empirical sampling
2024-04-17 22:22:37 +03:00
Ikko Eltociear Ashimine
270a21ebae Fix typo in System.cpp
Enfore -> Enforce
2024-04-16 17:17:26 +02:00
trigger
6aa96e5f81 Fix OVL patching 2024-04-16 06:15:10 +03:00
kd-11
1792714901 rsx: Fix intra-draw-call barrier queueing
- Ignore latch since we may have another barrier queued. Barriers cost essentially nothing so there is no problem with extra pushes.
- Remove unnecessary use of "else" statements.
2024-04-16 04:38:49 +03:00
Florin9doi
54ab16ab35 Buzz update 2024-04-16 01:46:01 +02:00
Megamouse
c58959eba2 Fix some msvc for loop warning 2024-04-15 19:28:28 +02:00
Megamouse
2f53d58cd9 fix some warnings 2024-04-15 19:28:28 +02:00
Florin9doi
e0d6f8a311 Set a unique System Name 2024-04-15 08:06:21 +03:00
kd-11
e48ec75896 rsx: Fix vertex texture invalidation 2024-04-14 22:37:07 +03:00
kd-11
58d8c65990 rsx: Fix some broken latch checks 2024-04-14 22:37:07 +03:00
kd-11
dd66380132 vk: Always initialize internal objects 2024-04-14 22:37:07 +03:00
Zion
92dd801ecd Attempt at bundling wayland libraries 2024-04-13 20:57:11 +03:00
Eladash
fba1db29b3 Savestates: Fixup 2024-04-13 20:14:49 +03:00
Eladash
1111c1952b SPU: Add debug information when logging analyzer failures 2024-04-13 20:14:49 +03:00
Eladash
7833862342 Add SPU Profiler to GUI 2024-04-13 13:48:00 +03:00
Eladash
78c1a6f326 CPUThread.cpp: Add reservation sampling 2024-04-13 13:48:00 +03:00
Eladash
060ddca1ab SPU: Fixup breakpoints 2024-04-13 13:48:00 +03:00
Eladash
a9fd2f76d2 Savestates: serilialize avc2_settings 2024-04-13 13:48:00 +03:00
Eladash
d1837b54b4 Savestates: Add save stage names 2024-04-13 13:48:00 +03:00
Eladash
26746ac9ee Progress Dialog: Force update every 20 seconds 2024-04-13 13:48:00 +03:00
Eladash
c019b10aa8 savestate_utils.cpp: Fix out-of-range bug 2024-04-13 13:48:00 +03:00
Eladash
0cd316116b Savestates: Make non-existing versions 0 2024-04-13 13:48:00 +03:00
RipleyTom
c92a556093 Default constructor for avc2_settings 2024-04-13 05:40:10 +03:00
kd-11
d6f6752af0 Add missing newline 2024-04-13 03:29:57 +03:00
kd-11
d7e04e9b0a Update CMakelists.txt 2024-04-13 03:29:57 +03:00
kd-11
c1aaa1bcf6 Get reworked RSX to compile 2024-04-13 03:29:57 +03:00
kd-11
10fe14e783 rsx: Separate register context from RSX thread 2024-04-13 03:29:57 +03:00
RipleyTom
0231902a69 fix CellSysutilAvc2InitParam 2024-04-13 01:41:41 +02:00
Megamouse
dbeb8cfbec cellSysutilAvc2Load_shared: simplify max_video_windows check 2024-04-12 23:04:43 +02:00
Megamouse
96bd150518 cellSysutilAvc2Load_shared: re-arrange streaming_mode checks 2024-04-12 23:04:43 +02:00
Megamouse
cb1fb19dea cellSysutilAvc2Load_shared: review fixes 2024-04-12 23:04:43 +02:00
Megamouse
3b37f5b156 cellSysutilAvc2Load_shared: use utils::align for total_bitrate 2024-04-12 23:04:43 +02:00
Megamouse
a989634ba5 cellSysutilAvc2Load_shared: fix compilation 2024-04-12 23:04:43 +02:00
Megamouse
d865186f23 Only send cellSysutilAvc2LoadAsync callback with CELL_SYSUTIL_AVC2_VOICE_CHAT 2024-04-12 23:04:43 +02:00
Megamouse
e63245a6dc Fix callback_func check for CELL_SYSUTIL_AVC2_VIDEO_CHAT
This mode doesn't allow for the callback
2024-04-12 23:04:43 +02:00
Megamouse
682fd15441 move cellSysutilAvc2LoadAsync to cellSysutilAvc2Load 2024-04-12 23:04:43 +02:00
Megamouse
bbd81b9395 cellSysutilAvc2Load: param checks 2024-04-12 23:04:43 +02:00
RipleyTom
cb6186ea60 Initialize CB in cellSysutilAvc2Load 2024-04-12 21:16:11 +03:00
Eladash
12bfc7d56a SPU/Debugger: Use bitset for breakpoints 2024-04-12 17:13:11 +03:00
Eladash
7dc4ccc87d SPU: Use bitset to reduce memory for compiler instance 2024-04-12 17:13:11 +03:00
Eladash
622894a7e3 Logs: output always message level to debuggers 2024-04-12 09:58:30 +03:00
Eladash
965ec8ec81 GUI/CLI: Add setting to attach command line (Win32) 2024-04-12 09:58:30 +03:00
Eladash
103b2fe5fd PPU/reservations: send thread notification only if data changed 2024-04-12 09:58:30 +03:00
Florin9doi
b6bfde6d64 Handle R16G16B16X16_FLOAT
Fix Super Hero Squad
2024-04-12 01:01:14 +03:00
capriots
1ec2752ed2 cellRtc: review + warning fixes 2024-04-11 22:09:00 +02:00
capriots
a5b6b2e9b5 cellRtc: tick conversion improvements 2024-04-11 22:09:00 +02:00
Eladash
f51b100a8c SPU Analyzer: Do not terminate blocks on BRA 2024-04-09 06:26:03 +03:00
Megamouse
412db758e8 cellRtc: review fixes 2024-04-08 13:50:58 +02:00
Megamouse
f617f69be8 cellRtc: remove wrong duplicate pos++
This would have increased pos by one too many.
2024-04-08 13:50:58 +02:00
Megamouse
b81d278aee cellRtc: implement Rfc3339 part of cellRtcParseDateTime 2024-04-08 13:50:58 +02:00
Megamouse
aee4bfa369 cellRtc: simplify some disassembly code 2024-04-08 13:50:58 +02:00
nastys
517f0e1bac
Remove git brew package from macOS CI script (#15407) 2024-04-06 01:47:08 +02:00
Megamouse
08837d2cd0 cellGame: add some more error checks 2024-04-05 23:36:37 +02:00
Megamouse
9a4c823366 cellCamera: fix config from_string 2024-04-05 20:22:45 +02:00
Megamouse
7f3ad4fc2c lv2_socket: reset queue after move 2024-04-05 19:41:41 +02:00
Megamouse
9e7b759236 cellGame: Enable disc insert/eject based on disc mount state 2024-04-05 14:45:10 +02:00
Megamouse
67853b464c Update curl to 8.7.1 2024-04-05 01:51:08 +02:00
Megamouse
51ffd4a377 Update soundtouch to 2.3.3 2024-04-05 01:51:08 +02:00
Megamouse
dada2e85a2 Update SDL to 2.30.2 2024-04-05 01:51:08 +02:00
Megamouse
2a53824b02 Update FAudio to 20.04 2024-04-05 01:51:08 +02:00
Elad Ashkenazi
3dc1dfa4a2
Fix typo in lv2_socket_native 2024-04-04 22:47:01 +02:00
RipleyTom
95e0d1a560 Fix changelog size hack 2024-04-04 22:31:29 +03:00
Eladash
8effbf7e4d Savestates/Network: Feign connection failure on startup 2024-04-04 17:28:46 +03:00
RipleyTom
72ad1abd39 Fix updater message 2024-04-04 07:45:08 +03:00
Eladash
2a89d87fab Savestates/SPU: Fix MFC commands abort 2024-04-03 15:03:39 +03:00
Eladash
33eeee0ff2 SPU Debugger: Implement viewing block hash on request 2024-04-03 15:03:39 +03:00
Eladash
3c46388be5 SPU LLVM: Fix store elimination within common blocks
GPR register barriers were ignored in that case.
2024-04-03 15:03:39 +03:00
Eladash
d37b9497a2 Replace some URLs 2024-04-03 15:03:39 +03:00
Eladash
17512f2a28 Updater: Add RPCS3's Patreon link to update dialog 2024-04-02 21:48:08 +03:00
Eladash
597a9f6dd6 PPU Loader: Fix unload of HLEd PRX modules 2024-04-01 12:20:38 +03:00
Eladash
e90b399329 PPU LLVM: Fix leak of modules outside dev_flash/sys/internal
Cache path was not matching on removal
2024-03-30 21:58:26 +03:00
Eladash
7c8be662c6 SPU LLVM: Postpone runtime worker threads init
They may not be active at all unless a ps3 application is booted.
2024-03-30 21:58:26 +03:00
Eladash
e38b005a8b PPU LLVM: Unify memory limit for PRX and Overlay files 2024-03-30 21:58:26 +03:00
Eladash
f0abb4473e PPU LLVM: Fix memory leak on precompilation 2024-03-30 21:58:26 +03:00
oltolm
d62e90f5b4 use the pass manager instead of the legacy one 2024-03-30 05:06:29 +03:00
Eladash
4ecf8ecd06 Fix savestate reload functionality 2024-03-29 13:25:51 +03:00
Eladash
9a3b72f762 Savestates/SPU: Partially publicize SPU-Compatible functionality 2024-03-29 13:25:51 +03:00
Eladash
7285af4771 SaveStates: Add error messages on screen 2024-03-29 13:25:51 +03:00
kd-11
ec37e8f0dc rsx: Fix loading mid-draw call savestates 2024-03-29 08:15:38 +03:00
Eladash
41f05f6864 LV2: Silence logging of semaphore 2024-03-28 16:24:47 +02:00
Eladash
cc2fa94fa1 PPU: Fix logging of sys_interrupt syscalls 2024-03-28 16:24:47 +02:00
Eladash
2f579311b8 LV2: Silence logging of mutex and cond syscalls 2024-03-28 16:24:47 +02:00
oltolm
ac034040ce workaround Clang 18.1 crash 2024-03-28 08:45:20 +01:00
oltolm
59410b9d62 fix compiler warnings 2024-03-28 08:45:20 +01:00
oltolm
6f665da016 main.cpp: remove outdated code for MSVC 19.27 2024-03-28 08:45:20 +01:00
oltolm
c567c92d4b fix GCC warnings 2024-03-28 08:45:20 +01:00
oltolm
75b2dfa66d cmake: fix MSVC build 2024-03-28 08:45:20 +01:00
oltolm
c40826c140 llvm: update to 18 2024-03-28 08:45:20 +01:00
kd-11
175aa510c8 rsx: Make overlay manager default lock-state exclusive 2024-03-28 08:08:21 +01:00
kd-11
236ac7d062 rsx: Fix race conditions on removals 2024-03-28 08:08:21 +01:00
kd-11
00f1b2bfa7 rsx: Rewrite fragment shader invalidation test 2024-03-28 08:08:21 +01:00
kd-11
a9fad83971 rsx: Fix memory range invalidation 2024-03-28 08:08:21 +01:00
kd-11
1550dc7f1f Fix audit crash in games where hash strategy is heavily used 2024-03-28 08:08:21 +01:00
Megamouse
bbb4c109d7 audio: allow to choose channel layouts 2024-03-28 07:17:26 +01:00
Eladash
a6fa091ab3 Savestates/RSX: Save pending flip 2024-03-27 19:59:22 +02:00
Eladash
6a1fa88e15 PPU: Fixup savestate prio bit usage 2024-03-27 19:59:22 +02:00
Eladash
787e79c687 util\serialization_ext.cpp: Fixup 2024-03-27 19:59:22 +02:00
Eladash
7468d96c51 Savestates: safe saving while cellSaveData is active 2024-03-27 19:59:22 +02:00
Eladash
9c9ece3d95 SPU LLVM: Fix Forwarding GPR stores savestate safety 2024-03-27 19:59:22 +02:00
Eladash
316b3a8851 Thread.cpp: Reduce logging 2024-03-27 19:59:22 +02:00
Eladash
2023057fbb Savestates: Reduce logging 2024-03-27 19:59:22 +02:00
Eladash
94c048d018 SPU LLVM: Add assert for MFC abort 2024-03-27 19:59:22 +02:00
Eladash
e126af63ed Silence cellGemGetState 2024-03-27 19:59:22 +02:00
Eladash
750359d780 Fixup emulation stopping 2024-03-27 19:59:22 +02:00
Eladash
8588b2b11a vm: Fix writer lock leak 2024-03-27 19:59:22 +02:00
kd-11
4594c912a6
rsx: Move SPIRV stuff into common code 2024-03-27 19:20:21 +02:00
Megamouse
afcfd81496 GL: fix segfault in GLGSRender::flip 2024-03-27 16:44:52 +01:00
Megamouse
aa06aaab8e Add Legacy plugin to Building.md 2024-03-27 15:09:57 +01:00
Megamouse
fdca881e34 Remove Windows 7 reference 2024-03-27 15:09:57 +01:00
Megamouse
81de7a5863 Qt 6.6.3 2024-03-27 11:43:55 +01:00
Eladash
efbf044ea0 Savestates/PPU: Fix PRX relocations 2024-03-26 21:35:53 +02:00
Eladash
46a1c09abe Savestates: Minor logging message 2024-03-26 21:35:53 +02:00
Eladash
6a3e795d73 Fix shutting down emulation while save-stating 2024-03-26 21:35:53 +02:00
Eladash
e0f08cd5c1 SPU: Make STOP a safe return instruction 2024-03-26 21:35:53 +02:00
Eladash
a539308545 Savestates: Make locking SPU threads more reasonable
Avoid locking in hopeless cases. Extend waiting time to more than 2 seconds.
2024-03-26 21:35:53 +02:00
Eladash
3364a46139 PPU LLVM: Remove cast to constant 2024-03-26 21:35:53 +02:00
Eladash
fb4e64d15e Savestates/SPU: Extend RCHCNT safe returns 2024-03-26 21:35:53 +02:00
Eladash
68349e48cd Savestates: Save PPU running order 2024-03-26 21:35:53 +02:00
Eladash
4dff8b16f1 Silence logging of cellScreenShot 2024-03-26 21:35:53 +02:00
Megamouse
9245565085 cellAudio: log backend channel count 2024-03-26 16:56:17 +01:00
Megamouse
86ca381a3c Qt: Rename Navigation controller to PS Move Navigation 2024-03-26 16:56:17 +01:00
Megamouse
a7952e15c7 cellPad: simplify for loops 2024-03-26 16:56:17 +01:00
Megamouse
643f81b5db cellPad: move getters to where they are actually needed 2024-03-26 16:56:17 +01:00
Megamouse
cf5a66a204 cellMic: add nullptr check for data in cell_mic_read
Also rename S to Size for readability
2024-03-26 13:50:43 +01:00
Megamouse
e05239f3d9 Fix some warnings 2024-03-26 12:26:26 +01:00
Megamouse
0e73b58abf Update miniupnpd to 2.3.6 2024-03-26 12:26:26 +01:00
Megamouse
59dc5dcd54 Update wolfssl to 5.7.0 2024-03-26 12:26:26 +01:00
Elad Ashkenazi
adedc7c667 Savestates/SPU: Add RCHCNT as a safe return in compatiblity mode 2024-03-25 12:05:24 +02:00
Elad Ashkenazi
29ad568791 Fix ppu_thread::serialize_common 2024-03-25 12:05:24 +02:00
Elad Ashkenazi
453a3c4852 Fixup Savestate Segfault 2024-03-25 12:05:24 +02:00
Elad Ashkenazi
2e824827b7 Fixup Savestate Progress 2024-03-24 20:58:51 +02:00
Eladash
3393d13b67 Reduce compression level to 8 for faster compression 2024-03-24 16:19:06 +02:00
Eladash
1da7689526 util\serialization_ext.cpp: Fix queued data with no output 2024-03-24 16:19:06 +02:00
Eladash
806758d06f Fix NPD files decryption in decryption tool 2024-03-24 16:19:06 +02:00
Eladash
580f9bf03a GUI: Progress Dialog On Save State Creation 2024-03-24 16:19:06 +02:00
Eladash
707a648a4c utils: Fix shared_ptr::store/exchange 2024-03-24 16:19:06 +02:00
Eladash
213a19c9f3 Add logging for CallFromMainThread 2024-03-24 16:19:06 +02:00
Elad.Ash
e32ed90d21
PPU LLVM: Remove one external symbol resolve for BLR 2024-03-21 15:56:31 +02:00
Eladash
2f822abb47 PPU LLVM: Use symbol resolver function to resolve functions 2024-03-20 12:48:31 +02:00
Eladash
1ca83bc629 PPU DisAsm: Fixup conditional indirect branches disasm 2024-03-20 12:48:31 +02:00
RipleyTom
77485747f1 Enable WOLFSSL_ALT_CERT_CHAINS 2024-03-17 05:59:23 +02:00
Eladash
40adf4b944 HLE: clear lower bits of Free Disk Space value 2024-03-14 11:10:45 +01:00
Megamouse
2aad5a7f3a Qt: add search bar to save manager 2024-03-13 18:42:42 +01:00
Megamouse
0f29a5be9f Qt: replace refresh progress slot with timer
For some reason setValue crashes in the progressValueChanged slot for no apparent reason
2024-03-13 00:24:42 +01:00
RipleyTom
397c2698ae Fix sceNpScoreGetRankingByNpId 2024-03-12 09:36:31 +02:00
Megamouse
0f00bb77fe Qt: only connect refresh watcher signals once 2024-03-11 23:04:09 +01:00
Megamouse
a73303a047 Qt: remove redundant progress dialog code. This already happens in Refresh 2024-03-11 23:04:09 +01:00
Ani
0334243a69 appimage: Do not bundle libvulkan.so
Causes issues with gamescope, see 
https://github.com/RPCS3/rpcs3/issues/14917
2024-03-11 21:03:19 +01:00
Megamouse
bb809c865f VS: move libpng, libusb and hidapi lib output to proper build configiguration dir
This allows us to properly build debug and release without having to delete the libs in between
2024-03-11 12:39:39 +01:00
Megamouse
20750c260e VS: Fix libpng build configuration names 2024-03-11 12:39:39 +01:00
Megamouse
37dd1b3ed0 VS: fix linking XAudio in debug builds 2024-03-11 09:02:01 +01:00
Megamouse
f3ac3476cb VS: use MultiThreadedDebugDLL in debug builds
This fixes heap assertions caused by mixing static builds and dynamic Qt
2024-03-11 09:02:01 +01:00
Megamouse
67ae1c9f69 VS: use common RuntimeLibrary settings in 3rdparty 2024-03-11 09:02:01 +01:00
RipleyTom
fd583dbbc3 Cleanup and set -Werror=delete-non-virtual-dtor 2024-03-11 02:30:18 +02:00
Megamouse
d8d0af2bb3 rsx: Fix invalid iterator comparison (asserts on debug builds)
Also make ranged_map::count const
2024-03-11 00:03:00 +01:00
Megamouse
b176085e14 GL: fix debug build: creation of QOffscreenSurface sends signals from wrong thread 2024-03-11 00:03:00 +01:00
Elad.Ash
4cfdb71d3a
LV2: Longer thread creation delay for low prio threads 2024-03-09 23:37:35 +02:00
Megamouse
38590e321e Qt: accept downloader progress dialog instead of closing it
Otherwise we get the canceled signal which is only meant for user interaction
2024-03-09 20:07:37 +01:00
Megamouse
a09900a64f Qt: make sure to actually delete the progress dialog when it is closed
Also add some more cleanup code for the gamelist refresh progress dialog
2024-03-09 20:07:37 +01:00
Megamouse
4a7d982a2b Qt: make sure the gamelist refresh progress dialog runs on the main thread 2024-03-09 20:07:37 +01:00
Megamouse
ee69468104 Qt: replace sstr with regular toStdString 2024-03-09 20:07:37 +01:00
Megamouse
4739ab58cc Qt: fix weird return value warning on VS 2024-03-09 20:07:37 +01:00
Megamouse
be5b982e45 Qt: don't close the progress dialog if it is already being closed anyway
Maybe this fixes some strange crashes that appear for some people.
2024-03-09 15:18:20 +01:00
Megamouse
86ad4ed6c1 Qt: check for updates if the update message is empty
This happens for example if the user canceled the earlier check
after the update was already known, leaving us in a somewhat dirty state.
2024-03-09 15:18:20 +01:00
Megamouse
3056a4db83 Qt: don't deleteLater the progress_dialog
It's already deleted on close by Qt anyway.
Also, remove QObject from curl_handle.
2024-03-09 15:18:20 +01:00
Eladash
adc8a360ad SPU LLVM: More compilation threads 2024-03-08 11:40:38 +02:00
Eladash
719dafa679 SPU LLVM: Notify workers prematurely if there is considerable excess 2024-03-08 07:21:48 +02:00
Eladash
ecf7d4e59d SPU LLVM: Postpone cache writes until compiled 2024-03-08 07:21:48 +02:00
Eladash
45863bc7c5 SPU analyzer: Detect 'argument passing' block before the function 2024-03-07 18:46:51 +02:00
Eladash
ea0545779a SPU: Include BRSL following code in is_exec_code() 2024-03-07 18:46:51 +02:00
Eladash
e625bab7eb SPU Analyzer: Detect more tail calls by examining called code 2024-03-07 18:46:51 +02:00
Eladash
2930d609ea SPU: Detect invalid STOP codes (code mining) 2024-03-07 18:46:51 +02:00
Eladash
069ca214ff SPU: Improve compilation message 2024-03-07 18:46:51 +02:00
Eladash
d699db2d19 SPU Analyser: Detect invalid relative branches 2024-03-07 18:46:51 +02:00
Eladash
8e15de5c83 sys_tty: Try to avoid logging single newlines to log 2024-03-07 14:31:41 +02:00
Eladash
69a90ef9e7 rsx/cpu_thread: Fix cpu_thread::get_name() for RSX 2024-03-07 14:31:41 +02:00
Eladash
d39361705a report_fatal_error: Minor cleanup and improvement 2024-03-06 20:32:22 +02:00
Eladash
4512c10ce5 init_mutex.hpp: More fixes 2024-03-06 20:32:22 +02:00
Megamouse
5e24167d6c Update submodules 2024-03-06 18:58:23 +01:00
Ordinary205
64d28ba435 Increase vblank rate 2024-03-06 18:50:51 +02:00
nastys
7febbdf52b macOS CI: Don't upgrade installed dependents
This should speed up builds, and possibly prevent conflicts.
2024-03-06 17:04:43 +02:00
Eladash
b64b98490e init_mutex.hpp: Fixup 2024-03-06 16:06:04 +02:00
Eladash
f40602cc59 cellGame: Fix PPU deadlocks on concurrent execution 2024-03-06 09:45:37 +02:00
1334 changed files with 97682 additions and 126608 deletions

View file

@ -1,23 +1,10 @@
#!/bin/sh -ex
# Pull all the submodules except llvm
# Pull all the submodules except some
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ && !/SPIRV/ { 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"
git config --global --add safe.directory .
git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ && !/opencv/ && !/libpng/ && !/libsdl-org/ && !/curl/ && !/zlib/ && !/libusb/ { print $3 }' .gitmodules)
CONFIGURE_ARGS="
-DWITH_LLVM=ON
@ -27,8 +14,13 @@ CONFIGURE_ARGS="
-DUSE_SYSTEM_FFMPEG=ON
-DUSE_SYSTEM_CURL=ON
-DUSE_SYSTEM_LIBPNG=ON
-DUSE_SYSTEM_LIBUSB=ON
-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

55
.ci/build-linux-aarch64.sh Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh -ex
cd rpcs3 || exit 1
shellcheck .ci/*.sh
git config --global --add safe.directory '*'
# Pull all the submodules except some
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ && !/zlib/ { print $3 }' .gitmodules)
mkdir build && cd build || exit 1
if [ "$COMPILER" = "gcc" ]; then
# These are set in the dockerfile
export CC="${GCC_BINARY}"
export CXX="${GXX_BINARY}"
export LINKER=gold
else
export CC="${CLANG_BINARY}"
export CXX="${CLANGXX_BINARY}"
export LINKER="${LLD_BINARY}"
fi
export LINKER_FLAG="-fuse-ld=${LINKER}"
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_EXE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LINKER_FLAG}" \
-DUSE_SYSTEM_CURL=ON \
-DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_FFMPEG=OFF \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
-DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-G Ninja
ninja; build_status=$?;
cd ..
# If it compiled succesfully let's deploy.
if [ "$build_status" -eq 0 ]; then
.ci/deploy-linux.sh "aarch64"
fi

View file

@ -1,15 +1,15 @@
#!/bin/sh -ex
if [ -z "$CIRRUS_CI" ]; then
cd rpcs3 || exit 1
fi
cd rpcs3 || exit 1
shellcheck .ci/*.sh
git config --global --add safe.directory '*'
# Pull all the submodules except llvm
# Pull all the submodules except some
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules)
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ && !/zlib/ { print $3 }' .gitmodules)
mkdir build && cd build || exit 1
@ -30,7 +30,7 @@ else
export RANLIB=/usr/bin/llvm-ranlib-"$LLVMVER"
fi
export CFLAGS="$CFLAGS -fuse-ld=${LINKER}"
export LINKER_FLAG="-fuse-ld=${LINKER}"
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
@ -38,28 +38,29 @@ cmake .. \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_AR="$AR" \
-DCMAKE_RANLIB="$RANLIB" \
-DUSE_SYSTEM_CURL=ON \
-DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_FFMPEG=OFF \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
-DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-G Ninja
ninja; build_status=$?;
cd ..
shellcheck .ci/*.sh
# If it compiled succesfully let's deploy.
# Azure and Cirrus publish PRs as artifacts only.
{ [ "$CI_HAS_ARTIFACTS" = "true" ];
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
.ci/deploy-linux.sh
if [ "$build_status" -eq 0 ]; then
.ci/deploy-linux.sh "x86_64"
fi

121
.ci/build-mac-arm64.sh Executable file
View file

@ -0,0 +1,121 @@
#!/bin/sh -ex
# shellcheck disable=SC2086
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
/opt/homebrew/bin/brew install -f --overwrite --quiet nasm ninja p7zip ccache pipenv gnutls freetype googletest #create-dmg
/opt/homebrew/bin/brew install -f --quiet ffmpeg@5
/opt/homebrew/bin/brew install --quiet "llvm@$LLVM_COMPILER_VER" glew cmake sdl3 vulkan-headers coreutils
/opt/homebrew/bin/brew link -f --quiet "llvm@$LLVM_COMPILER_VER" ffmpeg@5
# moltenvk based on commit for 1.3.0 release
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/7255441cbcafabaa8950f67c7ec55ff499dbb2d3/Formula/m/molten-vk.rb
/opt/homebrew/bin/brew install -f --overwrite --formula --quiet ./molten-vk.rb
export CXX=clang++
export CC=clang
export BREW_PATH;
BREW_PATH="$(brew --prefix)"
export BREW_BIN="/opt/homebrew/bin"
export BREW_SBIN="/opt/homebrew/sbin"
export CMAKE_EXTRA_OPTS='-DLLVM_TARGETS_TO_BUILD=arm64'
export WORKDIR;
WORKDIR="$(pwd)"
# Get Qt
if [ ! -d "/tmp/Qt/$QT_VER" ]; then
mkdir -p "/tmp/Qt"
git clone https://github.com/engnr/qt-downloader.git
cd qt-downloader
git checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597
# nested Qt 6.9.1 URL workaround
# sed -i '' "s/'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/'qt{0}_{0}{1}{2}'.format(major, minor, patch), 'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/g" qt-downloader
# sed -i '' "s/'{}\/{}\/qt{}_{}\/'/'{0}\/{1}\/qt{2}_{3}\/qt{2}_{3}\/'/g" qt-downloader
# archived Qt 6.7.3 URL workaround
sed -i '' "s/official_releases/archive/g" qt-downloader
cd "/tmp/Qt"
arch -arm64 "$BREW_PATH/bin/pipenv" run pip3 uninstall py7zr requests semantic_version lxml
arch -arm64 "$BREW_PATH/bin/pipenv" run pip3 install py7zr requests semantic_version lxml --no-cache
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.9.1 workaround
arch -arm64 "$BREW_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
cd "$WORKDIR"
ditto "/tmp/Qt/$QT_VER" "qt-downloader/$QT_VER"
export Qt6_DIR="$WORKDIR/qt-downloader/$QT_VER/clang_64/lib/cmake/Qt$QT_VER_MAIN"
export SDL3_DIR="$BREW_PATH/opt/sdl3/lib/cmake/SDL3"
export PATH="$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/bin:$WORKDIR/qt-downloader/$QT_VER/clang_64/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH"
export LDFLAGS="-L$BREW_PATH/lib $BREW_PATH/opt/ffmpeg@5/lib/libavcodec.dylib $BREW_PATH/opt/ffmpeg@5/lib/libavformat.dylib $BREW_PATH/opt/ffmpeg@5/lib/libavutil.dylib $BREW_PATH/opt/ffmpeg@5/lib/libswscale.dylib $BREW_PATH/opt/ffmpeg@5/lib/libswresample.dylib $BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/lib/c++/libc++.1.dylib $BREW_PATH/lib/libSDL3.dylib $BREW_PATH/lib/libGLEW.dylib $BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/lib/unwind/libunwind.1.dylib -Wl,-rpath,$BREW_PATH/lib"
export CPPFLAGS="-I$BREW_PATH/include -I$BREW_PATH/include -no-pie -D__MAC_OS_X_VERSION_MIN_REQUIRED=140000"
export CFLAGS="-D__MAC_OS_X_VERSION_MIN_REQUIRED=140000"
export LIBRARY_PATH="$BREW_PATH/lib"
export LD_LIBRARY_PATH="$BREW_PATH/lib"
export VULKAN_SDK
VULKAN_SDK="$BREW_PATH/opt/molten-vk"
ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib" || true
export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json"
export LLVM_DIR
LLVM_DIR="$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER"
# exclude ffmpeg, LLVM, opencv, and sdl from submodule update
# shellcheck disable=SC2046
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/ffmpeg/ && !/llvm/ && !/opencv/ && !/SDL/ { print $3 }' .gitmodules)
# 3rdparty fixes
sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c
mkdir build && cd build || exit 1
export MACOSX_DEPLOYMENT_TARGET=14.0
"$BREW_PATH/bin/cmake" .. \
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-DUSE_SDL=ON \
-DUSE_DISCORD_RPC=ON \
-DUSE_VULKAN=ON \
-DUSE_ALSA=OFF \
-DUSE_PULSE=OFF \
-DUSE_AUDIOUNIT=ON \
-DUSE_SYSTEM_FFMPEG=ON \
-DLLVM_CCACHE_BUILD=OFF \
-DLLVM_BUILD_RUNTIME=OFF \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_TOOLS=OFF \
-DLLVM_INCLUDE_UTILS=OFF \
-DLLVM_USE_PERF=OFF \
-DLLVM_ENABLE_Z3_SOLVER=OFF \
-DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_SYSTEM_MVK=ON \
-DUSE_SYSTEM_FAUDIO=OFF \
-DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_OPENCV=ON \
"$CMAKE_EXTRA_OPTS" \
-DLLVM_TARGET_ARCH=arm64 \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_IGNORE_PATH="$BREW_PATH/lib" \
-DCMAKE_IGNORE_PREFIX_PATH=/opt/homebrew/opt \
-DCMAKE_CXX_FLAGS="-D__MAC_OS_X_VERSION_MIN_REQUIRED=140000" \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_OSX_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)" \
-G Ninja
"$BREW_PATH/bin/ninja"; build_status=$?;
cd ..
# If it compiled succesfully let's deploy.
if [ "$build_status" -eq 0 ]; then
.ci/deploy-mac-arm64.sh
fi

View file

@ -1,27 +1,26 @@
#!/bin/sh -ex
# shellcheck disable=SC2086
export HOMEBREW_NO_AUTO_UPDATE=1
brew install -f --overwrite nasm ninja git p7zip ccache pipenv #create-dmg
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
#/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install -f --overwrite python@3.12 || arch -x86_64 /usr/local/bin/brew link --overwrite python@3.12
arch -x86_64 /usr/local/bin/brew update
arch -x86_64 /usr/local/bin/brew uninstall -f --ignore-dependencies ffmpeg
arch -x86_64 /usr/local/bin/brew install -f --build-from-source ffmpeg@5
arch -x86_64 /usr/local/bin/brew reinstall -f --build-from-source gnutls freetype
arch -x86_64 /usr/local/bin/brew install llvm@16 glew cmake sdl2 vulkan-headers coreutils
arch -x86_64 /usr/local/bin/brew link -f llvm@16 ffmpeg@5
arch -x86_64 /usr/local/bin/brew install -f --overwrite --quiet python || arch -x86_64 /usr/local/bin/brew link --overwrite python
arch -x86_64 /usr/local/bin/brew install -f --overwrite --quiet nasm ninja p7zip ccache pipenv gnutls freetype #create-dmg
arch -x86_64 /usr/local/bin/brew install -f --quiet ffmpeg@5
arch -x86_64 /usr/local/bin/brew install --quiet "llvm@$LLVM_COMPILER_VER" glew cmake sdl3 vulkan-headers coreutils
arch -x86_64 /usr/local/bin/brew link -f --quiet "llvm@$LLVM_COMPILER_VER" ffmpeg@5
# moltenvk based on commit for 1.2.7 release
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/05a8770c483cfddf5b077667a392d846bc2ad719/Formula/m/molten-vk.rb
arch -x86_64 /usr/local/bin/brew install -f --overwrite ./molten-vk.rb
#export MACOSX_DEPLOYMENT_TARGET=12.0
# moltenvk based on commit for 1.3.0 release
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/7255441cbcafabaa8950f67c7ec55ff499dbb2d3/Formula/m/molten-vk.rb
arch -x86_64 /usr/local/bin/brew install -f --overwrite --formula --quiet ./molten-vk.rb
export CXX=clang++
export CC=clang
export BREW_PATH;
BREW_PATH="$(brew --prefix)"
export BREW_X64_PATH;
BREW_X64_PATH="$("/usr/local/bin/brew" --prefix)"
export BREW_BIN="/usr/local/bin"
@ -37,21 +36,28 @@ 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.9.1 URL workaround
# sed -i '' "s/'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/'qt{0}_{0}{1}{2}'.format(major, minor, patch), 'qt{0}_{0}{1}{2}'.format(major, minor, patch)]))/g" qt-downloader
# sed -i '' "s/'{}\/{}\/qt{}_{}\/'/'{0}\/{1}\/qt{2}_{3}\/qt{2}_{3}\/'/g" qt-downloader
# archived Qt 6.7.3 URL workaround
sed -i '' "s/official_releases/archive/g" qt-downloader
cd "/tmp/Qt"
"$BREW_X64_PATH/bin/pipenv" run pip3 install py7zr requests semantic_version lxml
arch -x86_64 "$BREW_X64_PATH/bin/pipenv" --python "$BREW_X64_PATH/bin/python3" run pip3 install py7zr requests semantic_version lxml
mkdir -p "$QT_VER/macos" ; ln -s "macos" "$QT_VER/clang_64"
"$BREW_X64_PATH/bin/pipenv" run "$WORKDIR/qt-downloader/qt-downloader" macos desktop "$QT_VER" clang_64 --opensource --addons qtmultimedia
# sed -i '' 's/args\.version \/ derive_toolchain_dir(args) \/ //g' "$WORKDIR/qt-downloader/qt-downloader" # Qt 6.9.1 workaround
arch -x86_64 "$BREW_X64_PATH/bin/pipenv" --python "$BREW_X64_PATH/bin/python3" run "$WORKDIR/qt-downloader/qt-downloader" macos desktop "$QT_VER" clang_64 --opensource --addons qtmultimedia qtimageformats # -o "$QT_VER/clang_64"
fi
cd "$WORKDIR"
ditto "/tmp/Qt/$QT_VER" "qt-downloader/$QT_VER"
export Qt6_DIR="$WORKDIR/qt-downloader/$QT_VER/clang_64/lib/cmake/Qt$QT_VER_MAIN"
export SDL2_DIR="$BREW_X64_PATH/opt/sdl2/lib/cmake/SDL2"
export SDL3_DIR="$BREW_X64_PATH/opt/sdl3/lib/cmake/SDL3"
export PATH="$BREW_X64_PATH/opt/llvm@16/bin:$WORKDIR/qt-downloader/$QT_VER/clang_64/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH"
export PATH="$BREW_X64_PATH/opt/llvm@$LLVM_COMPILER_VER/bin:$WORKDIR/qt-downloader/$QT_VER/clang_64/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH"
export LDFLAGS="-L$BREW_X64_PATH/lib -Wl,-rpath,$BREW_X64_PATH/lib"
export CPPFLAGS="-I$BREW_X64_PATH/include -msse -msse2 -mcx16 -no-pie"
export CPPFLAGS="-I$BREW_X64_PATH/include -msse -msse2 -mcx16 -no-pie -D__MAC_OS_X_VERSION_MIN_REQUIRED=140000"
export CFLAGS="-D__MAC_OS_X_VERSION_MIN_REQUIRED=140000"
export LIBRARY_PATH="$BREW_X64_PATH/lib"
export LD_LIBRARY_PATH="$BREW_X64_PATH/lib"
@ -61,17 +67,21 @@ ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib"
export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json"
export LLVM_DIR
LLVM_DIR="BREW_X64_PATH/opt/llvm@16"
# exclude ffmpeg, SPIRV and LLVM, and sdl from submodule update
LLVM_DIR="BREW_X64_PATH/opt/llvm@$LLVM_COMPILER_VER"
# exclude ffmpeg, LLVM, opencv, and sdl from submodule update
# shellcheck disable=SC2046
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/ffmpeg/ && !/llvm/ && !/SPIRV/ && !/SDL/ { print $3 }' .gitmodules)
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/ffmpeg/ && !/llvm/ && !/opencv/ && !/SDL/ { print $3 }' .gitmodules)
# 3rdparty fixes
sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c
mkdir build && cd build || exit 1
export MACOSX_DEPLOYMENT_TARGET=14.0
"$BREW_X64_PATH/bin/cmake" .. \
-DBUILD_RPCS3_TESTS=OFF \
-DRUN_RPCS3_TESTS=OFF \
-DUSE_SDL=ON \
-DUSE_DISCORD_RPC=ON \
-DUSE_VULKAN=ON \
@ -93,19 +103,22 @@ mkdir build && cd build || exit 1
-DUSE_SYSTEM_MVK=ON \
-DUSE_SYSTEM_FAUDIO=OFF \
-DUSE_SYSTEM_SDL=ON \
$CMAKE_EXTRA_OPTS \
-DUSE_SYSTEM_OPENCV=ON \
"$CMAKE_EXTRA_OPTS" \
-DLLVM_TARGET_ARCH=X86_64 \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_IGNORE_PATH="$BREW_PATH/lib" \
-DCMAKE_IGNORE_PATH="$BREW_X64_PATH/lib" \
-DCMAKE_IGNORE_PREFIX_PATH=/usr/local/opt \
-DCMAKE_CXX_FLAGS="-D__MAC_OS_X_VERSION_MIN_REQUIRED=140000" \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_OSX_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)" \
-G Ninja
"$BREW_PATH/bin/ninja"; build_status=$?;
"$BREW_X64_PATH/bin/ninja"; build_status=$?;
cd ..
{ [ "$CI_HAS_ARTIFACTS" = "true" ];
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
# If it compiled succesfully let's deploy.
if [ "$build_status" -eq 0 ]; then
.ci/deploy-mac.sh
fi

View file

@ -0,0 +1,61 @@
#!/bin/sh -ex
git config --global --add safe.directory '*'
# Pull all the submodules except some
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/ffmpeg/ && !/curl/ && !/FAudio/ && !/zlib/ { print $3 }' .gitmodules)
mkdir build && cd build || exit 1
export CC="clang"
export CXX="clang++"
export LINKER=lld
export LINKER_FLAG="-fuse-ld=${LINKER}"
if [ -n "$LLVMVER" ]; then
export AR="llvm-ar-$LLVMVER"
export RANLIB="llvm-ranlib-$LLVMVER"
else
export AR="llvm-ar"
export RANLIB="llvm-ranlib"
fi
cmake .. \
-DCMAKE_PREFIX_PATH=/clang64 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LINKER_FLAG}" \
-DCMAKE_AR="$AR" \
-DCMAKE_RANLIB="$RANLIB" \
-DUSE_SYSTEM_CURL=ON \
-DUSE_FAUDIO=OFF \
-DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=OFF \
-DUSE_SYSTEM_FFMPEG=ON \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_SYSTEM_OPENAL=OFF \
-DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \
-DWITH_LLVM=ON \
-DLLVM_DIR=/clang64/lib/cmake/llvm \
-DVulkan_LIBRARY=/clang64/lib/libvulkan-1.dll.a \
-DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS=OFF \
-DRUN_RPCS3_TESTS=OFF \
-G Ninja
ninja; build_status=$?;
cd ..
# If it compiled succesfully let's deploy.
if [ "$build_status" -eq 0 ]; then
.ci/deploy-windows-clang.sh "x86_64"
fi

View file

@ -2,33 +2,51 @@
cd build || exit 1
CPU_ARCH="${1:-x86_64}"
if [ "$DEPLOY_APPIMAGE" = "true" ]; then
DESTDIR=AppDir ninja install
curl -fsSLo /usr/bin/linuxdeploy https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
curl -fsSLo /usr/bin/linuxdeploy "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$CPU_ARCH.AppImage"
chmod +x /usr/bin/linuxdeploy
curl -fsSLo /usr/bin/linuxdeploy-plugin-qt https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
curl -fsSLo /usr/bin/linuxdeploy-plugin-qt "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-$CPU_ARCH.AppImage"
chmod +x /usr/bin/linuxdeploy-plugin-qt
curl -fsSLo linuxdeploy-plugin-checkrt.sh https://github.com/linuxdeploy/linuxdeploy-plugin-checkrt/releases/download/continuous/linuxdeploy-plugin-checkrt-x86_64.sh
curl -fsSLo linuxdeploy-plugin-checkrt.sh https://github.com/darealshinji/linuxdeploy-plugin-checkrt/releases/download/continuous/linuxdeploy-plugin-checkrt.sh
chmod +x ./linuxdeploy-plugin-checkrt.sh
EXTRA_QT_PLUGINS="svg;" APPIMAGE_EXTRACT_AND_RUN=1 linuxdeploy --appdir AppDir --plugin qt
export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so"
export EXTRA_QT_PLUGINS="svg;wayland-decoration-client;wayland-graphics-integration-client;wayland-shell-integration;waylandcompositor"
APPIMAGE_EXTRACT_AND_RUN=1 linuxdeploy --appdir AppDir --plugin qt --plugin checkrt
# Remove libwayland-client because it has platform-dependent exports and breaks other OSes
rm -f ./AppDir/usr/lib/libwayland-client.so*
# Remove libvulkan because it causes issues with gamescope
rm -f ./AppDir/usr/lib/libvulkan.so*
# Remove unused Qt6 libraries
rm -f ./AppDir/usr/lib/libQt6VirtualKeyboard.so*
rm -f ./AppDir/usr/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so*
# Remove git directory containing local commit history file
rm -rf ./AppDir/usr/share/rpcs3/git
./linuxdeploy-plugin-checkrt.sh --appdir AppDir
curl -fsSLo /uruntime "https://github.com/VHSgunzo/uruntime/releases/download/v0.3.4/uruntime-appimage-dwarfs-$CPU_ARCH"
chmod +x /uruntime
/uruntime --appimage-mkdwarfs -f --set-owner 0 --set-group 0 --no-history --no-create-timestamp \
--compression zstd:level=22 -S26 -B32 --header /uruntime -i AppDir -o RPCS3.AppImage
linuxdeploy --appimage-extract
./squashfs-root/plugins/linuxdeploy-plugin-appimage/usr/bin/appimagetool AppDir -g
APPIMAGE_SUFFIX="linux_${CPU_ARCH}"
if [ "$CPU_ARCH" = "x86_64" ]; then
# Preserve back compat. Previous versions never included the full arch.
APPIMAGE_SUFFIX="linux64"
fi
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)"
RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage"
RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_${APPIMAGE_SUFFIX}.AppImage"
mv ./RPCS3*.AppImage "$RPCS3_APPIMAGE"

20
.ci/deploy-llvm.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/sh -ex
# First let's 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"
BUILD="llvmlibs_mt.7z"
# Package artifacts
7z a -m0=LZMA2 -mx9 "$BUILD" ./build/lib/Release-x64/llvm_build
# Generate sha256 hashes
# Write to file for GitHub releases
sha256sum "$BUILD" | awk '{ print $1 }' | tee "$BUILD.sha256"
echo "$(cat "$BUILD.sha256");$(stat -c %s "$BUILD")B" > GitHubReleaseMessage.txt
# Move files to publishing directory
cp -- "$BUILD" "$ARTIFACT_DIR"
cp -- "$BUILD.sha256" "$ARTIFACT_DIR"

74
.ci/deploy-mac-arm64.sh Executable file
View file

@ -0,0 +1,74 @@
#!/bin/sh -ex
# shellcheck disable=SC2086
cd build || exit 1
# 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)
COMM_HASH=$(git rev-parse --short=8 HEAD)
AVVER="${COMM_TAG}-${COMM_COUNT}"
# AVVER is used for GitHub releases, it is the version number.
echo "AVVER=$AVVER" >> ../.ci/ci-vars.env
cd bin
mkdir "rpcs3.app/Contents/lib/" || true
cp "$(realpath /opt/homebrew/opt/llvm@$LLVM_COMPILER_VER/lib/c++/libc++abi.1.0.dylib)" "rpcs3.app/Contents/Frameworks/libc++abi.1.dylib"
cp "$(realpath /opt/homebrew/lib/libsharpyuv.0.dylib)" "rpcs3.app/Contents/lib/libsharpyuv.0.dylib"
cp "$(realpath /opt/homebrew/lib/libintl.8.dylib)" "rpcs3.app/Contents/lib/libintl.8.dylib"
rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \
"rpcs3.app/Contents/Frameworks/QtQml.framework" \
"rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \
"rpcs3.app/Contents/Frameworks/QtQuick.framework" \
"rpcs3.app/Contents/Frameworks/QtVirtualKeyboard.framework" \
"rpcs3.app/Contents/Plugins/platforminputcontexts" \
"rpcs3.app/Contents/Plugins/virtualkeyboard" \
"rpcs3.app/Contents/Resources/git"
../../.ci/optimize-mac.sh rpcs3.app
# Hack
install_name_tool \
-delete_rpath /opt/homebrew/lib \
-delete_rpath /opt/homebrew/opt/llvm@$LLVM_COMPILER_VER/lib RPCS3.app/Contents/MacOS/rpcs3
#-delete_rpath /opt/homebrew1/Cellar/sdl3/3.2.8/lib
# Need to do this rename hack due to case insensitive filesystem
mv rpcs3.app RPCS3_.app
mv RPCS3_.app RPCS3.app
# NOTE: "--deep" is deprecated
codesign --deep -fs - RPCS3.app
echo "[InternetShortcut]" > Quickstart.url
echo "URL=https://rpcs3.net/quickstart" >> Quickstart.url
echo "IconIndex=0" >> Quickstart.url
#DMG_FILEPATH="$BUILD_ARTIFACTSTAGINGDIRECTORY/rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_macos_arm64.dmg"
#"$BREW_X64_PATH/bin/create-dmg" --volname RPCS3 \
#--window-size 800 400 \
#--icon-size 100 \
#--icon rpcs3.app 200 190 \
#--add-file Quickstart.url Quickstart.url 400 20 \
#--hide-extension rpcs3.app \
#--hide-extension Quickstart.url \
#--app-drop-link 600 185 \
#--skip-jenkins \
#--format ULMO \
#"$DMG_FILEPATH" \
#RPCS3.app
#FILESIZE=$(stat -f %z "$DMG_FILEPATH")
#SHA256SUM=$(shasum -a 256 "$DMG_FILEPATH" | awk '{ print $1 }')
ARCHIVE_FILEPATH="$BUILD_ARTIFACTSTAGINGDIRECTORY/rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_macos_arm64.7z"
"$BREW_PATH/bin/7z" a -mx9 "$ARCHIVE_FILEPATH" RPCS3.app Quickstart.url
FILESIZE=$(stat -f %z "$ARCHIVE_FILEPATH")
SHA256SUM=$(shasum -a 256 "$ARCHIVE_FILEPATH" | awk '{ print $1 }')
cd ..
echo "${SHA256SUM};${FILESIZE}B" > "$RELEASE_MESSAGE"
cd bin

View file

@ -1,5 +1,6 @@
#!/bin/sh -ex
# shellcheck disable=SC2086
cd build || exit 1
# Gather explicit version number and number of commits
@ -15,7 +16,7 @@ echo "AVVER=$AVVER" >> ../.ci/ci-vars.env
cd bin
mkdir "rpcs3.app/Contents/lib/"
cp "/usr/local/opt/llvm@16/lib/c++/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib"
cp "/usr/local/opt/llvm@$LLVM_COMPILER_VER/lib/c++/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib"
cp "$(realpath /usr/local/lib/libsharpyuv.0.dylib)" "rpcs3.app/Contents/lib/libsharpyuv.0.dylib"
cp "$(realpath /usr/local/lib/libintl.8.dylib)" "rpcs3.app/Contents/lib/libintl.8.dylib"
@ -28,10 +29,21 @@ rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \
"rpcs3.app/Contents/Plugins/virtualkeyboard" \
"rpcs3.app/Contents/Resources/git"
../../.ci/optimize-mac.sh rpcs3.app
# Need to do this rename hack due to case insensitive filesystem
mv rpcs3.app RPCS3_.app
mv RPCS3_.app RPCS3.app
# Hack
install_name_tool \
-delete_rpath /usr/local/lib \
-delete_rpath /usr/local/opt/llvm@$LLVM_COMPILER_VER/lib RPCS3.app/Contents/MacOS/rpcs3
#-delete_rpath /usr/local/Cellar/sdl3/3.2.8/lib
# NOTE: "--deep" is deprecated
codesign --deep -fs - RPCS3.app
echo "[InternetShortcut]" > Quickstart.url
echo "URL=https://rpcs3.net/quickstart" >> Quickstart.url
echo "IconIndex=0" >> Quickstart.url

View file

@ -0,0 +1,38 @@
#!/bin/sh -ex
# source ci-vars.env
# shellcheck disable=SC1091
. .ci/ci-vars.env
cd build || exit 1
CPU_ARCH="${1:-x86_64}"
echo "Deploying rpcs3 windows clang $CPU_ARCH"
# BUILD_blablabla is CI specific, so we wrap it for portability
ARTIFACT_DIR=$(cygpath -u "$BUILD_ARTIFACTSTAGINGDIRECTORY")
MSYS2_CLANG_BIN=$(cygpath -w /clang64/bin)
MSYS2_USR_BIN=$(cygpath -w /usr/bin)
echo "Installing dependencies of: ./bin/rpcs3.exe (MSYS2 dir is '$MSYS2_CLANG_BIN', usr dir is '$MSYS2_USR_BIN')"
cmake -DMSYS2_CLANG_BIN="$MSYS2_CLANG_BIN" -DMSYS2_USR_BIN="$MSYS2_USR_BIN" -Dexe=./bin/rpcs3.exe -P ../buildfiles/cmake/CopyRuntimeDependencies.cmake
# Prepare compatibility and SDL database for packaging
mkdir ./bin/config
mkdir ./bin/config/input_configs
curl -fsSL 'https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt' 1> ./bin/config/input_configs/gamecontrollerdb.txt
curl -fsSL 'https://rpcs3.net/compatibility?api=v1&export' | iconv -t UTF-8 1> ./bin/GuiConfigs/compat_database.dat
# Package artifacts
7z a -m0=LZMA2 -mx9 "$BUILD" ./bin/*
# Generate sha256 hashes
# Write to file for GitHub releases
sha256sum "$BUILD" | awk '{ print $1 }' | tee "$BUILD.sha256"
echo "$(cat "$BUILD.sha256");$(stat -c %s "$BUILD")B" > GitHubReleaseMessage.txt
# Move files to publishing directory
mkdir -p "$ARTIFACT_DIR"
cp -- "$BUILD" "$ARTIFACT_DIR"
cp -- "$BUILD.sha256" "$ARTIFACT_DIR"

View file

@ -1,11 +1,13 @@
#!/bin/sh -ex
# BUILD_blablabla is Azure specific, so we wrap it for portability
# First let's print some info about our caches
"$(cygpath -u "$CCACHE_BIN_DIR")"/ccache.exe --show-stats -v
# BUILD_blablabla is CI specific, so we wrap it for portability
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
# Remove unecessary files
rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb ./bin/vc_redist.x64.exe
rm -rf ./bin/git
# Prepare compatibility and SDL database for packaging
mkdir ./bin/config

View file

@ -1,5 +1,4 @@
# Variables set by Azure Pipelines
CI_HAS_ARTIFACTS
# Variables set by CI
BUILD_REASON
BUILD_SOURCEVERSION
BUILD_ARTIFACTSTAGINGDIRECTORY
@ -8,6 +7,7 @@ BUILD_SOURCEBRANCHNAME
APPDIR
ARTDIR
RELEASE_MESSAGE
RUN_UNIT_TESTS
# Variables for build matrix
COMPILER
DEPLOY_APPIMAGE

View file

@ -1,13 +0,0 @@
#!/bin/sh -e
# Export variables for later stages of the Azure pipeline
# Values done in this manner will appear as environment variables
# in later stages.
# From pure-sh-bible
# Setting 'IFS' tells 'read' where to split the string.
while IFS='=' read -r key val; do
# Skip over lines containing comments.
[ "${key##\#*}" ] || continue
echo "##vso[task.setvariable variable=$key]$val"
done < ".ci/ci-vars.env"

View file

@ -1,13 +0,0 @@
#!/bin/sh -e
# Export variables for later stages of the Cirrus pipeline
# Values done in this manner will appear as environment variables
# in later stages.
# From pure-sh-bible
# Setting 'IFS' tells 'read' where to split the string.
while IFS='=' read -r key val; do
# Skip over lines containing comments.
[ "${key##\#*}" ] || continue
export "$key"="$val"
done < ".ci/ci-vars.env"

13
.ci/generate-qt-ts.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh -ex
mkdir -p ../translations
LUPDATE_PATH=$(find /usr -name lupdate -type f 2>/dev/null | head -n 1)
if [ -z "$LUPDATE_PATH" ]; then
echo "Error: lupdate not found!"
exit 1
else
echo "lupdate found at: $LUPDATE_PATH"
$LUPDATE_PATH -recursive . -ts ../translations/rpcs3_template.ts
sed -i 's|filename="\.\./|filename="./|g' ../translations/rpcs3_template.ts
fi

3
.ci/get_keys-windows.sh Normal file → Executable file
View file

@ -1,4 +1,3 @@
#!/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 "./glslang.lock" "https://github.com/RPCS3/glslang/releases/download/custom-build-win/glslanglibs_mt.7z.sha256"
curl -fLo "./llvm.lock" "https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-${LLVM_VER}/llvmlibs_mt.7z.sha256"

View file

@ -8,11 +8,11 @@ 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 "llvm$LLVM_COMPILER_VER"
# Mandatory dependencies (qt6-base is pulled via qt6-multimedia)
pkg install git ccache cmake ninja qt6-multimedia qt6-svg glew openal-soft ffmpeg
# Mandatory dependencies (qtX-base is pulled via qtX-multimedia)
pkg install git ccache cmake ninja "qt$QT_VER_MAIN-multimedia" "qt$QT_VER_MAIN-svg" glew openal-soft ffmpeg
# Optional dependencies (libevdev is pulled by qt6-base)
pkg install pkgconf alsa-lib pulseaudio sdl2 evdev-proto vulkan-headers vulkan-loader
# Optional dependencies (libevdev is pulled by qtX-base)
pkg install pkgconf alsa-lib pulseaudio sdl3 evdev-proto vulkan-headers vulkan-loader opencv

21
.ci/optimize-mac.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
file_path=$(find "$1/Contents/MacOS" -type f -print0 | head -n 1)
if [ -z "$file_path" ]; then
echo "No executable file found in $1/Contents/MacOS" >&2
exit 1
fi
target_architecture="$(lipo "$file_path" -archs)"
if [ -z "$target_architecture" ]; then
exit 1
fi
# shellcheck disable=SC3045
find "$1" -type f -print0 | while IFS= read -r -d '' file; do
echo Thinning "$file" -> "$target_architecture"
lipo "$file" -thin "$target_architecture" -output "$file" || true
done

63
.ci/setup-llvm.sh Normal file
View file

@ -0,0 +1,63 @@
#!/bin/sh -ex
# Resource/dependency URLs
CCACHE_URL="https://github.com/ccache/ccache/releases/download/v4.11.2/ccache-4.11.2-windows-x86_64.zip"
DEP_URLS=" \
$CCACHE_URL"
# CI doesn't make a cache dir if it doesn't exist, so we do it manually
[ -d "$DEPS_CACHE_DIR" ] || mkdir "$DEPS_CACHE_DIR"
# Pull the llvm submodule
# shellcheck disable=SC2046
git submodule -q update --init --depth=1 -- 3rdparty/llvm
# Git bash doesn't have rev, so here it is
rev()
{
echo "$1" | awk '{ for(i = length($0); i != 0; --i) { a = a substr($0, i, 1); } } END { print a }'
}
# Usage: download_and_verify url checksum algo file
# Check to see if a file is already cached, and the checksum matches. If not, download it.
# Tries up to 3 times
download_and_verify()
{
url="$1"
correctChecksum="$2"
algo="$3"
fileName="$4"
for _ in 1 2 3; do
[ -e "$DEPS_CACHE_DIR/$fileName" ] || curl -fLo "$DEPS_CACHE_DIR/$fileName" "$url"
fileChecksum=$("${algo}sum" "$DEPS_CACHE_DIR/$fileName" | awk '{ print $1 }')
[ "$fileChecksum" = "$correctChecksum" ] && return 0
done
return 1;
}
# Some dependencies install here
[ -d "./build/lib_ext/Release-x64" ] || mkdir -p "./build/lib_ext/Release-x64"
for url in $DEP_URLS; do
# Get the filename from the URL and remove query strings (?arg=something).
fileName="$(rev "$(rev "$url" | cut -d'/' -f1)" | cut -d'?' -f1)"
[ -z "$fileName" ] && echo "Unable to parse url: $url" && exit 1
# shellcheck disable=SC1003
case "$url" in
*ccache*) checksum=$CCACHE_SHA; algo="sha256"; outDir="$CCACHE_BIN_DIR" ;;
*) echo "Unknown url resource: $url"; exit 1 ;;
esac
download_and_verify "$url" "$checksum" "$algo" "$fileName"
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

View file

@ -0,0 +1,39 @@
#!/bin/sh -ex
CPU_ARCH="${1:-win64}"
COMPILER="${2:-msvc}"
# These are CI specific, so we wrap them for portability
REPO_NAME="$BUILD_REPOSITORY_NAME"
REPO_BRANCH="$BUILD_SOURCEBRANCHNAME"
PR_NUMBER="$BUILD_PR_NUMBER"
# 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)
COMM_HASH=$(git rev-parse --short=8 HEAD)
# Format the above into filenames
if [ -n "$PR_NUMBER" ]; then
AVVER="${COMM_TAG}-${COMM_HASH}"
BUILD_RAW="rpcs3-v${AVVER}_${CPU_ARCH}_${COMPILER}"
BUILD="${BUILD_RAW}.7z"
else
AVVER="${COMM_TAG}-${COMM_COUNT}"
BUILD_RAW="rpcs3-v${AVVER}-${COMM_HASH}_${CPU_ARCH}_${COMPILER}"
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}"
# SC2129
{
echo "BRANCH=$BRANCH"
echo "BUILD=$BUILD"
echo "BUILD_RAW=$BUILD_RAW"
echo "AVVER=$AVVER"
} >> .ci/ci-vars.env

View file

@ -1,27 +1,22 @@
#!/bin/sh -ex
# These are Azure specific, so we wrap them for portability
REPO_NAME="$BUILD_REPOSITORY_NAME"
REPO_BRANCH="$SYSTEM_PULLREQUEST_SOURCEBRANCH"
PR_NUMBER="$SYSTEM_PULLREQUEST_PULLREQUESTID"
# Resource/dependency URLs
# Qt mirrors can be volatile and slow, so we list 2
#QT_HOST="http://mirrors.ocf.berkeley.edu/qt/"
QT_HOST="http://qt.mirror.constant.com/"
QT_URL_VER=$(echo "$QT_VER" | sed "s/\.//g")
QT_VER_MSVC_UP=$(echo "${QT_VER_MSVC}" | tr '[:lower:]' '[:upper:]')
QT_PREFIX="online/qtsdkrepository/windows_x86/desktop/qt${QT_VER_MAIN}_${QT_URL_VER}/qt.qt${QT_VER_MAIN}.${QT_URL_VER}."
QT_PREFIX="online/qtsdkrepository/windows_x86/desktop/qt${QT_VER_MAIN}_${QT_URL_VER}/qt${QT_VER_MAIN}_${QT_URL_VER}/qt.qt${QT_VER_MAIN}.${QT_URL_VER}."
QT_PREFIX_2="win64_${QT_VER_MSVC}_64/${QT_VER}-0-${QT_DATE}"
QT_SUFFIX="-Windows-Windows_10_22H2-${QT_VER_MSVC_UP}-Windows-Windows_10_22H2-X86_64.7z"
QT_SUFFIX="-Windows-Windows_11_23H2-${QT_VER_MSVC_UP}-Windows-Windows_11_23H2-X86_64.7z"
QT_BASE_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qtbase${QT_SUFFIX}"
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'
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"
LLVMLIBS_URL="https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-${LLVM_VER}/llvmlibs_mt.7z"
VULKAN_SDK_URL="https://www.dropbox.com/scl/fi/sjjh0fc4ld281pjbl2xzu/VulkanSDK-${VULKAN_VER}-Installer.exe?rlkey=f6wzc0lvms5vwkt2z3qabfv9d&dl=1"
CCACHE_URL="https://github.com/ccache/ccache/releases/download/v4.11.2/ccache-4.11.2-windows-x86_64.zip"
DEP_URLS=" \
$QT_BASE_URL \
@ -30,16 +25,16 @@ DEP_URLS=" \
$QT_MM_URL \
$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"
# CI doesn't make a cache dir if it doesn't exist, so we do it manually
[ -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
# shellcheck disable=SC2046
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/FAudio/ && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules)
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/FAudio/ && !/llvm/ { print $3 }' .gitmodules)
# Git bash doesn't have rev, so here it is
rev()
@ -58,17 +53,16 @@ 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;
}
# Some dependencies install here
[ -d "./lib" ] || mkdir "./lib"
[ -d "./build/lib_ext/Release-x64" ] || mkdir -p "./build/lib_ext/Release-x64"
for url in $DEP_URLS; do
# Get the filename from the URL and remove query strings (?arg=something).
@ -77,14 +71,14 @@ for url in $DEP_URLS; do
# shellcheck disable=SC1003
case "$url" in
*qt*) checksum=$(curl -fL "${url}.sha1"); algo="sha1"; outDir='C:\Qt\' ;;
*llvm*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./3rdparty/llvm" ;;
*glslang*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./lib/Release-x64" ;;
*qt*) checksum=$(curl -fL "${url}.sha1"); algo="sha1"; outDir="$QTDIR/" ;;
*llvm*) 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,27 +86,11 @@ 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
# 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)
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"
else
AVVER="${COMM_TAG}-${COMM_COUNT}"
BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z"
fi
# BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp.
# BUILD is the name of the release artifact
# 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
# 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

View file

@ -1,150 +0,0 @@
env:
CIRRUS_CLONE_DEPTH: 0 # Unshallow clone to obtain proper GIT_VERSION
BUILD_REPOSITORY_NAME: $CIRRUS_REPO_FULL_NAME
SYSTEM_PULLREQUEST_SOURCEBRANCH: $CIRRUS_BRANCH
SYSTEM_PULLREQUEST_PULLREQUESTID: $CIRRUS_PR
BUILD_SOURCEVERSION: $CIRRUS_CHANGE_IN_REPO
BUILD_SOURCEBRANCHNAME: $CIRRUS_BRANCH
RPCS3_TOKEN: ENCRYPTED[!a4c3850e29ab150692286a74bec29819d25971a7ec431b86de2a35f7ed90c5b2ab3c93469f9298e30924d843599110e9!]
QT_VER_MAIN: '6'
QT_VER: '6.6.2'
# windows_task:
# matrix:
# - name: Cirrus Windows
# windows_container:
# image: cirrusci/windowsservercore:visualstudio2019
# cpu: 8
# memory: 16G
# env:
# CIRRUS_SHELL: "bash"
# COMPILER: msvc
# BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}\artifacts\
# QT_VER_MSVC: 'msvc2019'
# QT_DATE: '202402121135'
# 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"
# UPLOAD_COMMIT_HASH: 7d09e3be30805911226241afbb14f8cdc2eb054e
# UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-win"
# deps_cache:
# folder: "./cache"
# #obj_cache:
# # folder: "./tmp"
# #obj2_cache:
# # folder: "./rpcs3/x64"
# setup_script:
# - './.ci/get_keys-windows.sh'
# - './.ci/setup-windows.sh'
# rpcs3_script:
# - export PATH=${PATH}:"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
# - msbuild.exe rpcs3.sln //p:Configuration=Release //m
# deploy_script:
# - mkdir artifacts
# - source './.ci/export-cirrus-vars.sh'
# - './.ci/deploy-windows.sh'
# artifacts:
# name: Artifact
# path: "*.7z*"
# push_script: |
# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
# source './.ci/export-cirrus-vars.sh'
# './.ci/github-upload.sh'
# fi;
# linux_task:
# container:
# image: rpcs3/rpcs3-ci-focal:1.6
# cpu: 4
# memory: 16G
# 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: d812f1254a1157c80fd402f94446310560f54e5f
# UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux"
# DEPLOY_APPIMAGE: true
# APPDIR: "./appdir"
# RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
# ccache_cache:
# folder: "/tmp/ccache_dir"
# matrix:
# - name: Cirrus Linux GCC
# env:
# COMPILER: gcc
# gcc_script:
# - mkdir artifacts
# - ".ci/build-linux.sh"
# - name: Cirrus Linux Clang
# env:
# COMPILER: clang
# clang_script:
# - mkdir artifacts
# - ".ci/build-linux.sh"
# artifacts:
# name: Artifact
# path: "artifacts/*"
# push_script: |
# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ] && [ "$COMPILER" = "gcc" ]; 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;
freebsd_task:
matrix:
- name: Cirrus FreeBSD
freebsd_instance:
image_family: freebsd-13-2
cpu: 8
memory: 8G
env:
CCACHE_MAXSIZE: 300M # 3x clean build, rounded
CCACHE_DIR: /tmp/ccache_dir
ccache_cache:
folder: /tmp/ccache_dir
install_script: "sh -ex ./.ci/install-freebsd.sh"
script: "./.ci/build-freebsd.sh"
# macos_task:
# timeout_in: 12000m
# homebrew_cache:
# folder: /Users/admin/Library/Caches/Homebrew
# qt_cache:
# folder: /tmp/Qt
# ccache_cache:
# folder: /tmp/ccache_dir
# matrix:
# - name: Cirrus macOS
# macos_instance:
# image: ghcr.io/cirruslabs/macos-monterey-xcode:latest
# mac_script:
# - mkdir artifacts
# - chmod +x ".ci/build-mac.sh"
# - chmod +x ".ci/deploy-mac.sh"
# - ".ci/build-mac.sh"
# 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: 51ae32f468089a8169aaf1567de355ff4a3e0842
# UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-mac"
# RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
# artifacts:
# name: Artifact
# path: "artifacts/*"
# push_script: |
# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
# source './.ci/export-cirrus-vars.sh'
# .ci/github-upload.sh
# fi;

View file

@ -16,4 +16,4 @@ Submitting your test results for Commercial Games must be done on our forums. Pl
# Contributing
Check the [Coding Style Guidelines](https://github.com/RPCS3/rpcs3/wiki/Coding-Style) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information). If you have any questions, hit us up on our [Discord Server](https://discord.me/RPCS3) in the **#development** channel.
Check the [Coding Style Guidelines](https://github.com/RPCS3/rpcs3/wiki/Coding-Style) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information). If you have any questions, hit us up on our [Discord Server](https://discord.gg/rpcs3) in the **#development** channel.

1
.github/FUNDING.yml vendored
View file

@ -1,2 +1 @@
patreon: Nekotekina
custom: https://rpcs3.net/alipay

View file

@ -7,7 +7,7 @@ body:
attributes:
value: |
# Summary
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.gg/rpcs3) or [forums](https://forums.rpcs3.net/) instead.
- type: textarea
id: quick-summary
attributes:
@ -50,7 +50,7 @@ body:
* Completely close RPCS3 and locate the log file.
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
* On Windows it will be in the RPCS3 directory near the executable
* On Windows it will be in the ```log``` folder inside your RPCS3 folder.
* On Linux it will be in ```~/.cache/rpcs3/```
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.
- type: textarea

View file

@ -7,7 +7,7 @@ body:
attributes:
value: |
# Summary
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.gg/rpcs3) or [forums](https://forums.rpcs3.net/) instead.
- type: textarea
id: quick-summary
attributes:
@ -36,7 +36,7 @@ body:
* Completely close RPCS3 and locate the log file.
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
* On Windows it will be in the RPCS3 directory near the executable
* On Windows it will be in the ```log``` folder inside your RPCS3 folder.
* On Linux it will be in ```~/.cache/rpcs3/```
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.
- type: textarea

View file

@ -6,7 +6,7 @@ body:
- type: markdown
attributes:
value: |
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.gg/rpcs3) or [forums](https://forums.rpcs3.net/) instead.
- type: textarea
id: quick-summary
attributes:
@ -31,6 +31,6 @@ body:
* If this feature is something that a game is trying to use, upload a log file for it.
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
* On Windows it will be in the RPCS3 directory near the executable
* On Windows it will be in the ```log``` folder inside your RPCS3 folder.
* On Linux it will be in ```~/.cache/rpcs3/```
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.

View file

@ -7,7 +7,7 @@ assignees: ''
---
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.gg/rpcs3) or [forums](https://forums.rpcs3.net/) instead.
You're using the advanced template. You're expected to know what to write in order to fill in all the required information for proper report.

View file

@ -4,7 +4,7 @@ contact_links:
url: https://rpcs3.net/quickstart
about: Everything you need to know to install and configure emulator, and add games
- name: Ask for help
url: https://discord.me/RPCS3
url: https://discord.gg/rpcs3
about: If you have some questions or need help, please use our Discord server instead of GitHub
- name: Report game compatibility
url: https://forums.rpcs3.net/thread-196671.html

18
.github/PR-BUILD.md vendored
View file

@ -1,18 +0,0 @@
## How to test a PR build
Please take into account, that RPCS3 build usually takes some time (about 15 mins), so you can't access a build if a PR was just submitted.
- Open a PR you want to test
- Scroll to the very bottom and locate the **Checks** section
- Click on **Show all checks**
You are supposed to see something like this
![image](https://user-images.githubusercontent.com/10283761/116630952-2cd99e00-a94c-11eb-933e-986d6020ca92.png)
- Click on __Details__ on either **Cirrus Linux GCC** or **Cirrus Windows**
- Click **View more details on Cirrus CI** at the very bottom
![image](https://user-images.githubusercontent.com/10283761/116631111-5e526980-a94c-11eb-95f7-751e6f15e1ea.png)
- Click on the download button for **Artifact** on the **Artifacts** block
![image](https://user-images.githubusercontent.com/10283761/116631322-bee1a680-a94c-11eb-89a3-be365783582e.png)
- Congratulations! You are now downloading an RPCS3 build for that specific PR.
__Please note that PR builds are not supposed to be stable because they contain new changesets.__

View file

@ -1,3 +0,0 @@
<!-- Please include a summary of the change and which issue is fixed. -->
[How to test this PR](.github/PR-BUILD.md)

72
.github/workflows/llvm.yml vendored Normal file
View file

@ -0,0 +1,72 @@
name: Build LLVM
defaults:
run:
shell: bash
on:
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
env:
BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/
jobs:
Windows_Build:
if: github.event_name == 'workflow_dispatch'
name: LLVM Windows (MSVC)
runs-on: windows-2025
env:
COMPILER: msvc
CCACHE_SHA: '1f39f3ad5aae3fe915e99ad1302633bc8f6718e58fa7c0de2b0ba7e080f0f08c'
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: Restore Dependencies Cache
uses: actions/cache/restore@main
id: restore-dependencies-cache
with:
path: ${{ env.DEPS_CACHE_DIR }}
key: "${{ runner.os }}-${{ env.COMPILER }}-llvm-${{ env.CCACHE_SHA }}"
restore-keys: ${{ runner.os }}-${{ env.COMPILER }}-llvm
- name: Download and unpack dependencies
run: .ci/setup-llvm.sh
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@main
- name: Compile LLVM
shell: pwsh
run: msbuild 3rdparty\llvm\llvm_build.vcxproj /p:SolutionDir="$(pwd)/" /p:Configuration=Release /v:minimal /p:Platform=x64 /p:PreferredToolArchitecture=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_only.targets"
- name: Pack up build artifacts
run: |
mkdir -p "${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}"
.ci/deploy-llvm.sh
- name: Upload artifacts (7z)
uses: actions/upload-artifact@main
with:
name: LLVM for Windows (MSVC)
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
compression-level: 0
if-no-files-found: error
- name: Save Dependencies Cache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.DEPS_CACHE_DIR }}
key: ${{ steps.restore-dependencies-cache.outputs.cache-primary-key }}

34
.github/workflows/qt-ts.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: Generate Translation Template
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'rpcs3/**'
jobs:
Generate_Translation_Template:
name: Generate Translation Template
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Install Qt Tools
run: |
sudo apt update
sudo apt install -y qt6-l10n-tools
- name: Generate .ts file using lupdate (Qt)
working-directory: rpcs3
run: |
../.ci/generate-qt-ts.sh
- name: Upload translation template
uses: actions/upload-artifact@main
with:
name: RPCS3_Translation_Template
path: translations/rpcs3_template.ts
compression-level: 0

444
.github/workflows/rpcs3.yml vendored Normal file
View file

@ -0,0 +1,444 @@
name: Build RPCS3
defaults:
run:
shell: bash
on:
push:
branches:
- master # Only trigger push event on 'master' branch
pull_request:
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_PR_NUMBER: ${{ github.event.pull_request.number }}
BUILD_SOURCEVERSION: ${{ github.sha }}
BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/
jobs:
Linux_Build:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
docker_img: "rpcs3/rpcs3-ci-jammy:1.6"
build_sh: "/rpcs3/.ci/build-linux.sh"
compiler: clang
UPLOAD_COMMIT_HASH: d812f1254a1157c80fd402f94446310560f54e5f
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux"
- os: ubuntu-24.04
docker_img: "rpcs3/rpcs3-ci-jammy:1.6"
build_sh: "/rpcs3/.ci/build-linux.sh"
compiler: gcc
- os: ubuntu-24.04-arm
docker_img: "rpcs3/rpcs3-ci-jammy-aarch64:1.6"
build_sh: "/rpcs3/.ci/build-linux-aarch64.sh"
compiler: clang
UPLOAD_COMMIT_HASH: a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux-arm64"
- os: ubuntu-24.04-arm
docker_img: "rpcs3/rpcs3-ci-jammy-aarch64:1.6"
build_sh: "/rpcs3/.ci/build-linux-aarch64.sh"
compiler: gcc
name: RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
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 }}
RUN_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF'
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Restore build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
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 ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}:${{ env.ARTDIR }} \
${{ 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'
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
- name: Save build Ccache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}
Mac_Build:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
strategy:
fail-fast: false
matrix:
include:
- name: Intel
build_sh: "arch -X86_64 .ci/build-mac.sh"
UPLOAD_COMMIT_HASH: 51ae32f468089a8169aaf1567de355ff4a3e0842
UPLOAD_REPO_FULL_NAME: rpcs3/rpcs3-binaries-mac
- name: Apple Silicon
build_sh: .ci/build-mac-arm64.sh
UPLOAD_COMMIT_HASH: 8e21bdbc40711a3fccd18fbf17b742348b0f4281
UPLOAD_REPO_FULL_NAME: rpcs3/rpcs3-binaries-mac-arm64
name: RPCS3 Mac ${{ matrix.name }}
runs-on: macos-14
env:
CCACHE_DIR: /tmp/ccache_dir
QT_VER: '6.7.3'
QT_VER_MAIN: '6'
LLVM_COMPILER_VER: '19'
RELEASE_MESSAGE: ../GitHubReleaseMessage.txt
UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }}
UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }}
RUN_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF'
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Restore Build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ matrix.name }}-${{github.run_id}}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.name }}-
- name: Restore Qt Cache
uses: actions/cache/restore@main
id: restore-qt-cache
with:
path: /tmp/Qt
key: ${{ runner.os }}-qt-${{ matrix.name }}-${{ env.QT_VER }}
restore-keys: ${{ runner.os }}-qt-${{ matrix.name }}-${{ env.QT_VER }}
- name: Build
run: ${{ matrix.build_sh }}
- name: Upload artifacts
uses: actions/upload-artifact@main
with:
name: RPCS3 for Mac (${{ matrix.name }})
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
compression-level: 0
- name: Export Variables
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: Deploy master build to GitHub Releases
if: |
github.event_name != 'pull_request' &&
github.repository == 'RPCS3/rpcs3' &&
github.ref == 'refs/heads/master'
env:
RPCS3_TOKEN: ${{ secrets.RPCS3_TOKEN }}
run: .ci/github-upload.sh
- name: Save Build Ccache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}
- name: Save Qt Cache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: /tmp/Qt
key: ${{ steps.restore-qt-cache.outputs.cache-primary-key }}
Windows_Build:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
name: RPCS3 Windows
runs-on: windows-2025
env:
COMPILER: msvc
QT_VER_MAIN: '6'
QT_VER: '6.9.1'
QT_VER_MSVC: 'msvc2022'
QT_DATE: '202505291653'
LLVM_VER: '19.1.7'
VULKAN_VER: '1.3.268.0'
VULKAN_SDK_SHA: '8459ef49bd06b697115ddd3d97c9aec729e849cd775f5be70897718a9b3b9db5'
CCACHE_SHA: '1f39f3ad5aae3fe915e99ad1302633bc8f6718e58fa7c0de2b0ba7e080f0f08c'
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"
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup NuGet
uses: nuget/setup-nuget@v2
- name: Restore NuGet packages
run: nuget restore rpcs3.sln
- name: Setup env
shell: pwsh
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
run: .ci/get_keys-windows.sh
- name: Restore Build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
with:
path: ${{ env.CCACHE_DIR }}
key: "${{ runner.os }}-ccache-${{ env.COMPILER }}-${{github.run_id}}"
restore-keys: ${{ runner.os }}-ccache-${{ env.COMPILER }}-
- name: Restore Dependencies Cache
uses: actions/cache/restore@main
id: restore-dependencies-cache
with:
path: ${{ env.DEPS_CACHE_DIR }}
key: "${{ runner.os }}-${{ env.COMPILER }}-${{ env.QT_VER }}-${{ env.VULKAN_SDK_SHA }}-${{ env.CCACHE_SHA }}-${{ hashFiles('llvm.lock') }}"
restore-keys: ${{ runner.os }}-${{ env.COMPILER }}-
- name: Download and unpack dependencies
run: |
.ci/setup-windows.sh
.ci/setup-windows-ci-vars.sh win64 msvc
- name: Export Variables
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
shell: pwsh
run: msbuild rpcs3.sln /p:Configuration=Release /v:minimal /p:Platform=x64 /p:PreferredToolArchitecture=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_only.targets"
- name: Run Unit Tests
if: github.event_name == 'pull_request'
shell: pwsh
run: build\lib\Release-x64\rpcs3_test.exe
- name: Pack up build artifacts
run: |
mkdir -p "${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}"
.ci/deploy-windows.sh
- name: Upload artifacts (7z)
uses: actions/upload-artifact@main
with:
name: RPCS3 for Windows (MSVC)
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
compression-level: 0
if-no-files-found: error
- name: Deploy master build to GitHub Releases
if: |
github.event_name != 'pull_request' &&
github.repository == 'RPCS3/rpcs3' &&
github.ref == 'refs/heads/master'
env:
RPCS3_TOKEN: ${{ secrets.RPCS3_TOKEN }}
run: .ci/github-upload.sh
- name: Save Build Ccache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}
- name: Save Dependencies Cache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.DEPS_CACHE_DIR }}
key: ${{ steps.restore-dependencies-cache.outputs.cache-primary-key }}
Windows_Build_Clang:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
name: RPCS3 Windows Clang
runs-on: windows-2025
strategy:
matrix:
include:
- msys2: clang64
compiler: clang
arch: win64
env:
CCACHE_DIR: 'C:\ccache'
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msys2 }}
update: true
cache: true
install: |
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-ccache
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-lld
mingw-w64-clang-x86_64-ninja
mingw-w64-clang-x86_64-llvm
mingw-w64-clang-x86_64-ffmpeg
mingw-w64-clang-x86_64-opencv
mingw-w64-clang-x86_64-glew
mingw-w64-clang-x86_64-vulkan
mingw-w64-clang-x86_64-vulkan-headers
mingw-w64-clang-x86_64-vulkan-loader
mingw-w64-clang-x86_64-gtest
mingw-w64-clang-x86_64-qt6-base
mingw-w64-clang-x86_64-qt6-declarative
mingw-w64-clang-x86_64-qt6-multimedia
mingw-w64-clang-x86_64-qt6-svg
base-devel
curl
git
p7zip
- name: Restore build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
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: Build RPCS3
shell: msys2 {0}
run: |
export CCACHE_DIR=$(cygpath -u "$CCACHE_DIR")
echo "CCACHE_DIR=$CCACHE_DIR"
.ci/setup-windows-ci-vars.sh ${{ matrix.arch }} ${{ matrix.compiler }}
.ci/build-windows-clang.sh
- name: Save build Ccache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}
- name: Upload artifacts
uses: actions/upload-artifact@main
with:
name: RPCS3 for Windows (${{ runner.arch }}, ${{ matrix.compiler }})
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
compression-level: 0
if-no-files-found: error
FreeBSD_Build:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
name: RPCS3 FreeBSD
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
QT_VER_MAIN: '6'
LLVM_COMPILER_VER: '19'
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Restore Build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
with:
path: ${{ env.CCACHE_DIR }}
key: FreeBSD-ccache-${{github.run_id}}
restore-keys: FreeBSD-ccache-
- name: FreeBSD build
id: root
uses: vmactions/freebsd-vm@v1
with:
envs: 'QT_VER_MAIN LLVM_COMPILER_VER CCACHE_DIR'
usesh: true
run: .ci/install-freebsd.sh && .ci/build-freebsd.sh
- name: Save Build Ccache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}

23
.gitignore vendored
View file

@ -35,6 +35,7 @@
/lib
/tmp
/ipch
/packages
/rpcs3/Debug
/rpcs3/Release
@ -55,9 +56,6 @@
/bin/GuiConfigs/*.dat
/bin/GuiConfigs/*.dat.*
# Some data from git
!/bin/git/
# Visual Studio Files
.vs/*
.vscode/*
@ -117,28 +115,9 @@ CMakeLists.txt.user
# macOS
.DS_Store
# 7zlib
/3rdparty/7z/**/*.lib
# yaml-cpp
yaml-cpp.pc
# libusb
/3rdparty/libusb_cmake/config.h
/3rdparty/libusb_cmake/libusb-1.0.pc
# miniupnp
/3rdparty/miniupnp/x64/*
# llvm
/3rdparty/llvm/llvm_build
# legacy llvm
/llvm_build
# ssl certificate
cacert.pem
_ReSharper.*/
CMakeUserPresets.json

44
.gitmodules vendored
View file

@ -15,14 +15,6 @@
path = 3rdparty/glslang/glslang
url = ../../KhronosGroup/glslang.git
ignore = dirty
[submodule "3rdparty/SPIRV-Tools"]
path = 3rdparty/SPIRV/SPIRV-Tools
url = ../../KhronosGroup/SPIRV-Tools.git
ignore = dirty
[submodule "3rdparty/SPIRV-Headers"]
path = 3rdparty/SPIRV/SPIRV-Headers
url = ../../KhronosGroup/SPIRV-Headers.git
ignore = dirty
[submodule "3rdparty/zlib"]
path = 3rdparty/zlib/zlib
url = ../../madler/zlib
@ -36,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
@ -88,3 +76,35 @@
path = 3rdparty/rtmidi/rtmidi
url = ../../thestk/rtmidi
ignore = dirty
[submodule "3rdparty/zstd/zstd"]
path = 3rdparty/zstd/zstd
url = ../../facebook/zstd
ignore = dirty
[submodule "3rdparty/7zip/7zip"]
path = 3rdparty/7zip/7zip
url = ../../ip7z/7zip.git
ignore = dirty
[submodule "3rdparty/OpenAL/openal-soft"]
path = 3rdparty/OpenAL/openal-soft
url = ../../kcat/openal-soft.git
ignore = dirty
[submodule "3rdparty/stblib/stb"]
path = 3rdparty/stblib/stb
url = ../../nothings/stb.git
ignore = dirty
[submodule "3rdparty/opencv/opencv"]
path = 3rdparty/opencv/opencv
url = ../../Megamouse/opencv_minimal.git
ignore = dirty
[submodule "3rdparty/fusion/fusion"]
path = 3rdparty/fusion/fusion
url = ../../xioTechnologies/Fusion.git
ignore = dirty
[submodule "3rdparty/discord-rpc/discord-rpc"]
path = 3rdparty/discord-rpc/discord-rpc
url = ../../Vestrel/discord-rpc
ignore = dirty
[submodule "3rdparty/GPUOpen/VulkanMemoryAllocator"]
path = 3rdparty/GPUOpen/VulkanMemoryAllocator
url = ../../GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
ignore = dirty

View file

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="src\7z.h" />
<ClInclude Include="src\7zAlloc.h" />
<ClInclude Include="src\7zBuf.h" />
<ClInclude Include="src\7zCrc.h" />
<ClInclude Include="src\7zFile.h" />
<ClInclude Include="src\7zTypes.h" />
<ClInclude Include="src\7zVersion.h" />
<ClInclude Include="src\7zWindows.h" />
<ClInclude Include="src\Aes.h" />
<ClInclude Include="src\Alloc.h" />
<ClInclude Include="src\Bcj2.h" />
<ClInclude Include="src\Blake2.h" />
<ClInclude Include="src\Bra.h" />
<ClInclude Include="src\BwtSort.h" />
<ClInclude Include="src\Compiler.h" />
<ClInclude Include="src\CpuArch.h" />
<ClInclude Include="src\Delta.h" />
<ClInclude Include="src\DllSecur.h" />
<ClInclude Include="src\HuffEnc.h" />
<ClInclude Include="src\LzFind.h" />
<ClInclude Include="src\LzFindMt.h" />
<ClInclude Include="src\LzHash.h" />
<ClInclude Include="src\Lzma2Dec.h" />
<ClInclude Include="src\Lzma2DecMt.h" />
<ClInclude Include="src\Lzma2Enc.h" />
<ClInclude Include="src\Lzma86.h" />
<ClInclude Include="src\LzmaDec.h" />
<ClInclude Include="src\LzmaEnc.h" />
<ClInclude Include="src\LzmaLib.h" />
<ClInclude Include="src\MtCoder.h" />
<ClInclude Include="src\MtDec.h" />
<ClInclude Include="src\Ppmd.h" />
<ClInclude Include="src\Ppmd7.h" />
<ClInclude Include="src\Ppmd8.h" />
<ClInclude Include="src\Precomp.h" />
<ClInclude Include="src\RotateDefs.h" />
<ClInclude Include="src\Sha1.h" />
<ClInclude Include="src\Sha256.h" />
<ClInclude Include="src\Sort.h" />
<ClInclude Include="src\SwapBytes.h" />
<ClInclude Include="src\Threads.h" />
<ClInclude Include="src\Xz.h" />
<ClInclude Include="src\XzCrc64.h" />
<ClInclude Include="src\XzEnc.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\7zAlloc.c" />
<ClCompile Include="src\7zArcIn.c" />
<ClCompile Include="src\7zBuf.c" />
<ClCompile Include="src\7zBuf2.c" />
<ClCompile Include="src\7zCrc.c" />
<ClCompile Include="src\7zCrcOpt.c" />
<ClCompile Include="src\7zDec.c" />
<ClCompile Include="src\7zFile.c" />
<ClCompile Include="src\7zStream.c" />
<ClCompile Include="src\Aes.c" />
<ClCompile Include="src\AesOpt.c" />
<ClCompile Include="src\Alloc.c" />
<ClCompile Include="src\Bcj2.c" />
<ClCompile Include="src\Bcj2Enc.c" />
<ClCompile Include="src\Blake2s.c" />
<ClCompile Include="src\Bra.c" />
<ClCompile Include="src\Bra86.c" />
<ClCompile Include="src\BraIA64.c" />
<ClCompile Include="src\BwtSort.c" />
<ClCompile Include="src\CpuArch.c" />
<ClCompile Include="src\Delta.c" />
<ClCompile Include="src\DllSecur.c" />
<ClCompile Include="src\HuffEnc.c" />
<ClCompile Include="src\LzFind.c" />
<ClCompile Include="src\LzFindMt.c" />
<ClCompile Include="src\LzFindOpt.c" />
<ClCompile Include="src\Lzma2Dec.c" />
<ClCompile Include="src\Lzma2DecMt.c" />
<ClCompile Include="src\Lzma2Enc.c" />
<ClCompile Include="src\Lzma86Dec.c" />
<ClCompile Include="src\Lzma86Enc.c" />
<ClCompile Include="src\LzmaDec.c" />
<ClCompile Include="src\LzmaEnc.c" />
<ClCompile Include="src\LzmaLib.c" />
<ClCompile Include="src\MtCoder.c" />
<ClCompile Include="src\MtDec.c" />
<ClCompile Include="src\Ppmd7.c" />
<ClCompile Include="src\Ppmd7aDec.c" />
<ClCompile Include="src\Ppmd7Dec.c" />
<ClCompile Include="src\Ppmd7Enc.c" />
<ClCompile Include="src\Ppmd8.c" />
<ClCompile Include="src\Ppmd8Dec.c" />
<ClCompile Include="src\Ppmd8Enc.c" />
<ClCompile Include="src\Sha1.c" />
<ClCompile Include="src\Sha1Opt.c" />
<ClCompile Include="src\Sha256.c" />
<ClCompile Include="src\Sha256Opt.c" />
<ClCompile Include="src\Sort.c" />
<ClCompile Include="src\SwapBytes.c" />
<ClCompile Include="src\Threads.c" />
<ClCompile Include="src\Xz.c" />
<ClCompile Include="src\XzCrc64.c" />
<ClCompile Include="src\XzCrc64Opt.c" />
<ClCompile Include="src\XzDec.c" />
<ClCompile Include="src\XzEnc.c" />
<ClCompile Include="src\XzIn.c" />
</ItemGroup>
</Project>

View file

@ -1,70 +0,0 @@
# 7z sdk
if(WIN32 OR APPLE)
add_library(3rdparty_7z STATIC EXCLUDE_FROM_ALL
src/7zAlloc.c
src/7zArcIn.c
src/7zBuf.c
src/7zBuf2.c
src/7zCrc.c
src/7zCrcOpt.c
src/7zDec.c
src/7zFile.c
src/7zStream.c
src/Aes.c
src/AesOpt.c
src/Alloc.c
src/Bcj2.c
src/Bcj2Enc.c
src/Blake2s.c
src/Bra.c
src/Bra86.c
src/BraIA64.c
src/BwtSort.c
src/CpuArch.c
src/Delta.c
src/DllSecur.c
src/HuffEnc.c
src/LzFind.c
src/LzFindMt.c
src/LzFindOpt.c
src/Lzma2Dec.c
src/Lzma2DecMt.c
src/Lzma2Enc.c
src/Lzma86Dec.c
src/Lzma86Enc.c
src/LzmaDec.c
src/LzmaEnc.c
src/LzmaLib.c
src/MtCoder.c
src/MtDec.c
src/Ppmd7.c
src/Ppmd7aDec.c
src/Ppmd7Dec.c
src/Ppmd7Enc.c
src/Ppmd8.c
src/Ppmd8Dec.c
src/Ppmd8Enc.c
src/Sha1.c
src/Sha1Opt.c
src/Sha256.c
src/Sha256Opt.c
src/Sort.c
src/SwapBytes.c
src/Threads.c
src/Xz.c
src/XzCrc64.c
src/XzCrc64Opt.c
src/XzDec.c
src/XzEnc.c
src/XzIn.c)
target_include_directories(3rdparty_7z INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:/src>)
target_include_directories(3rdparty_7z INTERFACE 7z)
set_property(TARGET 3rdparty_7z PROPERTY FOLDER "3rdparty/")
else()
add_library(3rdparty_7z INTERFACE)
endif()

204
3rdparty/7z/src/7z.h vendored
View file

@ -1,204 +0,0 @@
/* 7z.h -- 7z interface
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_7Z_H
#define ZIP7_INC_7Z_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define k7zStartHeaderSize 0x20
#define k7zSignatureSize 6
extern const Byte k7zSignature[k7zSignatureSize];
typedef struct
{
const Byte *Data;
size_t Size;
} CSzData;
/* CSzCoderInfo & CSzFolder support only default methods */
typedef struct
{
size_t PropsOffset;
UInt32 MethodID;
Byte NumStreams;
Byte PropsSize;
} CSzCoderInfo;
typedef struct
{
UInt32 InIndex;
UInt32 OutIndex;
} CSzBond;
#define SZ_NUM_CODERS_IN_FOLDER_MAX 4
#define SZ_NUM_BONDS_IN_FOLDER_MAX 3
#define SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX 4
typedef struct
{
UInt32 NumCoders;
UInt32 NumBonds;
UInt32 NumPackStreams;
UInt32 UnpackStream;
UInt32 PackStreams[SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX];
CSzBond Bonds[SZ_NUM_BONDS_IN_FOLDER_MAX];
CSzCoderInfo Coders[SZ_NUM_CODERS_IN_FOLDER_MAX];
} CSzFolder;
SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd);
typedef struct
{
UInt32 Low;
UInt32 High;
} CNtfsFileTime;
typedef struct
{
Byte *Defs; /* MSB 0 bit numbering */
UInt32 *Vals;
} CSzBitUi32s;
typedef struct
{
Byte *Defs; /* MSB 0 bit numbering */
// UInt64 *Vals;
CNtfsFileTime *Vals;
} CSzBitUi64s;
#define SzBitArray_Check(p, i) (((p)[(i) >> 3] & (0x80 >> ((i) & 7))) != 0)
#define SzBitWithVals_Check(p, i) ((p)->Defs && ((p)->Defs[(i) >> 3] & (0x80 >> ((i) & 7))) != 0)
typedef struct
{
UInt32 NumPackStreams;
UInt32 NumFolders;
UInt64 *PackPositions; // NumPackStreams + 1
CSzBitUi32s FolderCRCs; // NumFolders
size_t *FoCodersOffsets; // NumFolders + 1
UInt32 *FoStartPackStreamIndex; // NumFolders + 1
UInt32 *FoToCoderUnpackSizes; // NumFolders + 1
Byte *FoToMainUnpackSizeIndex; // NumFolders
UInt64 *CoderUnpackSizes; // for all coders in all folders
Byte *CodersData;
UInt64 RangeLimit;
} CSzAr;
UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex);
SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex,
ILookInStreamPtr stream, UInt64 startPos,
Byte *outBuffer, size_t outSize,
ISzAllocPtr allocMain);
typedef struct
{
CSzAr db;
UInt64 startPosAfterHeader;
UInt64 dataPos;
UInt32 NumFiles;
UInt64 *UnpackPositions; // NumFiles + 1
// Byte *IsEmptyFiles;
Byte *IsDirs;
CSzBitUi32s CRCs;
CSzBitUi32s Attribs;
// CSzBitUi32s Parents;
CSzBitUi64s MTime;
CSzBitUi64s CTime;
UInt32 *FolderToFile; // NumFolders + 1
UInt32 *FileToFolder; // NumFiles
size_t *FileNameOffsets; /* in 2-byte steps */
Byte *FileNames; /* UTF-16-LE */
} CSzArEx;
#define SzArEx_IsDir(p, i) (SzBitArray_Check((p)->IsDirs, i))
#define SzArEx_GetFileSize(p, i) ((p)->UnpackPositions[(i) + 1] - (p)->UnpackPositions[i])
void SzArEx_Init(CSzArEx *p);
void SzArEx_Free(CSzArEx *p, ISzAllocPtr alloc);
UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder);
int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize);
/*
if dest == NULL, the return value specifies the required size of the buffer,
in 16-bit characters, including the null-terminating character.
if dest != NULL, the return value specifies the number of 16-bit characters that
are written to the dest, including the null-terminating character. */
size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest);
/*
size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex);
UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex, UInt16 *dest);
*/
/*
SzArEx_Extract extracts file from archive
*outBuffer must be 0 before first call for each new archive.
Extracting cache:
If you need to decompress more than one file, you can send
these values from previous call:
*blockIndex,
*outBuffer,
*outBufferSize
You can consider "*outBuffer" as cache of solid block. If your archive is solid,
it will increase decompression speed.
If you use external function, you can declare these 3 cache variables
(blockIndex, outBuffer, outBufferSize) as static in that external function.
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
*/
SRes SzArEx_Extract(
const CSzArEx *db,
ILookInStreamPtr inStream,
UInt32 fileIndex, /* index of file */
UInt32 *blockIndex, /* index of solid block */
Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
size_t *outBufferSize, /* buffer size for output buffer */
size_t *offset, /* offset of stream for required file in *outBuffer */
size_t *outSizeProcessed, /* size of file in *outBuffer */
ISzAllocPtr allocMain,
ISzAllocPtr allocTemp);
/*
SzArEx_Open Errors:
SZ_ERROR_NO_ARCHIVE
SZ_ERROR_ARCHIVE
SZ_ERROR_UNSUPPORTED
SZ_ERROR_MEM
SZ_ERROR_CRC
SZ_ERROR_INPUT_EOF
SZ_ERROR_FAIL
*/
SRes SzArEx_Open(CSzArEx *p, ILookInStreamPtr inStream,
ISzAllocPtr allocMain, ISzAllocPtr allocTemp);
EXTERN_C_END
#endif

View file

@ -1,89 +0,0 @@
/* 7zAlloc.c -- Allocation functions for 7z processing
2023-03-04 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <stdlib.h>
#include "7zAlloc.h"
/* #define SZ_ALLOC_DEBUG */
/* use SZ_ALLOC_DEBUG to debug alloc/free operations */
#ifdef SZ_ALLOC_DEBUG
/*
#ifdef _WIN32
#include "7zWindows.h"
#endif
*/
#include <stdio.h>
static int g_allocCount = 0;
static int g_allocCountTemp = 0;
static void Print_Alloc(const char *s, size_t size, int *counter)
{
const unsigned size2 = (unsigned)size;
fprintf(stderr, "\n%s count = %10d : %10u bytes; ", s, *counter, size2);
(*counter)++;
}
static void Print_Free(const char *s, int *counter)
{
(*counter)--;
fprintf(stderr, "\n%s count = %10d", s, *counter);
}
#endif
void *SzAlloc(ISzAllocPtr p, size_t size)
{
UNUSED_VAR(p)
if (size == 0)
return 0;
#ifdef SZ_ALLOC_DEBUG
Print_Alloc("Alloc", size, &g_allocCount);
#endif
return malloc(size);
}
void SzFree(ISzAllocPtr p, void *address)
{
UNUSED_VAR(p)
#ifdef SZ_ALLOC_DEBUG
if (address)
Print_Free("Free ", &g_allocCount);
#endif
free(address);
}
void *SzAllocTemp(ISzAllocPtr p, size_t size)
{
UNUSED_VAR(p)
if (size == 0)
return 0;
#ifdef SZ_ALLOC_DEBUG
Print_Alloc("Alloc_temp", size, &g_allocCountTemp);
/*
#ifdef _WIN32
return HeapAlloc(GetProcessHeap(), 0, size);
#endif
*/
#endif
return malloc(size);
}
void SzFreeTemp(ISzAllocPtr p, void *address)
{
UNUSED_VAR(p)
#ifdef SZ_ALLOC_DEBUG
if (address)
Print_Free("Free_temp ", &g_allocCountTemp);
/*
#ifdef _WIN32
HeapFree(GetProcessHeap(), 0, address);
return;
#endif
*/
#endif
free(address);
}

View file

@ -1,19 +0,0 @@
/* 7zAlloc.h -- Allocation functions
2023-03-04 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_7Z_ALLOC_H
#define ZIP7_INC_7Z_ALLOC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
void *SzAlloc(ISzAllocPtr p, size_t size);
void SzFree(ISzAllocPtr p, void *address);
void *SzAllocTemp(ISzAllocPtr p, size_t size);
void SzFreeTemp(ISzAllocPtr p, void *address);
EXTERN_C_END
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,36 +0,0 @@
/* 7zBuf.c -- Byte Buffer
2017-04-03 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "7zBuf.h"
void Buf_Init(CBuf *p)
{
p->data = 0;
p->size = 0;
}
int Buf_Create(CBuf *p, size_t size, ISzAllocPtr alloc)
{
p->size = 0;
if (size == 0)
{
p->data = 0;
return 1;
}
p->data = (Byte *)ISzAlloc_Alloc(alloc, size);
if (p->data)
{
p->size = size;
return 1;
}
return 0;
}
void Buf_Free(CBuf *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->data);
p->data = 0;
p->size = 0;
}

View file

@ -1,35 +0,0 @@
/* 7zBuf.h -- Byte Buffer
2023-03-04 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_7Z_BUF_H
#define ZIP7_INC_7Z_BUF_H
#include "7zTypes.h"
EXTERN_C_BEGIN
typedef struct
{
Byte *data;
size_t size;
} CBuf;
void Buf_Init(CBuf *p);
int Buf_Create(CBuf *p, size_t size, ISzAllocPtr alloc);
void Buf_Free(CBuf *p, ISzAllocPtr alloc);
typedef struct
{
Byte *data;
size_t size;
size_t pos;
} CDynBuf;
void DynBuf_Construct(CDynBuf *p);
void DynBuf_SeekToBeg(CDynBuf *p);
int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAllocPtr alloc);
void DynBuf_Free(CDynBuf *p, ISzAllocPtr alloc);
EXTERN_C_END
#endif

View file

@ -1,52 +0,0 @@
/* 7zBuf2.c -- Byte Buffer
2017-04-03 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <string.h>
#include "7zBuf.h"
void DynBuf_Construct(CDynBuf *p)
{
p->data = 0;
p->size = 0;
p->pos = 0;
}
void DynBuf_SeekToBeg(CDynBuf *p)
{
p->pos = 0;
}
int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAllocPtr alloc)
{
if (size > p->size - p->pos)
{
size_t newSize = p->pos + size;
Byte *data;
newSize += newSize / 4;
data = (Byte *)ISzAlloc_Alloc(alloc, newSize);
if (!data)
return 0;
p->size = newSize;
if (p->pos != 0)
memcpy(data, p->data, p->pos);
ISzAlloc_Free(alloc, p->data);
p->data = data;
}
if (size != 0)
{
memcpy(p->data + p->pos, buf, size);
p->pos += size;
}
return 1;
}
void DynBuf_Free(CDynBuf *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->data);
p->data = 0;
p->size = 0;
p->pos = 0;
}

View file

@ -1,340 +0,0 @@
/* 7zCrc.c -- CRC32 calculation and init
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "7zCrc.h"
#include "CpuArch.h"
#define kCrcPoly 0xEDB88320
#ifdef MY_CPU_LE
#define CRC_NUM_TABLES 8
#else
#define CRC_NUM_TABLES 9
UInt32 Z7_FASTCALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 Z7_FASTCALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
#ifndef MY_CPU_BE
UInt32 Z7_FASTCALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 Z7_FASTCALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
/*
extern
CRC_FUNC g_CrcUpdateT4;
CRC_FUNC g_CrcUpdateT4;
*/
extern
CRC_FUNC g_CrcUpdateT8;
CRC_FUNC g_CrcUpdateT8;
extern
CRC_FUNC g_CrcUpdateT0_32;
CRC_FUNC g_CrcUpdateT0_32;
extern
CRC_FUNC g_CrcUpdateT0_64;
CRC_FUNC g_CrcUpdateT0_64;
extern
CRC_FUNC g_CrcUpdate;
CRC_FUNC g_CrcUpdate;
UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
UInt32 Z7_FASTCALL CrcUpdate(UInt32 v, const void *data, size_t size)
{
return g_CrcUpdate(v, data, size, g_CrcTable);
}
UInt32 Z7_FASTCALL CrcCalc(const void *data, size_t size)
{
return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL;
}
#if CRC_NUM_TABLES < 4 \
|| (CRC_NUM_TABLES == 4 && defined(MY_CPU_BE)) \
|| (!defined(MY_CPU_LE) && !defined(MY_CPU_BE))
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
UInt32 Z7_FASTCALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 Z7_FASTCALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
const Byte *pEnd = p + size;
for (; p != pEnd; p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
#endif
/* ---------- hardware CRC ---------- */
#ifdef MY_CPU_LE
#if defined(MY_CPU_ARM_OR_ARM64)
// #pragma message("ARM*")
#if defined(_MSC_VER)
#if defined(MY_CPU_ARM64)
#if (_MSC_VER >= 1910)
#ifndef __clang__
#define USE_ARM64_CRC
#include <intrin.h>
#endif
#endif
#endif
#elif (defined(__clang__) && (__clang_major__ >= 3)) \
|| (defined(__GNUC__) && (__GNUC__ > 4))
#if !defined(__ARM_FEATURE_CRC32)
#define __ARM_FEATURE_CRC32 1
#if defined(__clang__)
#if defined(MY_CPU_ARM64)
#define ATTRIB_CRC __attribute__((__target__("crc")))
#else
#define ATTRIB_CRC __attribute__((__target__("armv8-a,crc")))
#endif
#else
#if defined(MY_CPU_ARM64)
#define ATTRIB_CRC __attribute__((__target__("+crc")))
#else
#define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
#endif
#endif
#endif
#if defined(__ARM_FEATURE_CRC32)
#define USE_ARM64_CRC
#include <arm_acle.h>
#endif
#endif
#else
// no hardware CRC
// #define USE_CRC_EMU
#ifdef USE_CRC_EMU
#pragma message("ARM64 CRC emulation")
Z7_FORCE_INLINE
UInt32 __crc32b(UInt32 v, UInt32 data)
{
const UInt32 *table = g_CrcTable;
v = CRC_UPDATE_BYTE_2(v, (Byte)data);
return v;
}
Z7_FORCE_INLINE
UInt32 __crc32w(UInt32 v, UInt32 data)
{
const UInt32 *table = g_CrcTable;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
return v;
}
Z7_FORCE_INLINE
UInt32 __crc32d(UInt32 v, UInt64 data)
{
const UInt32 *table = g_CrcTable;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
return v;
}
#endif // USE_CRC_EMU
#endif // defined(MY_CPU_ARM64) && defined(MY_CPU_LE)
#if defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
#define T0_32_UNROLL_BYTES (4 * 4)
#define T0_64_UNROLL_BYTES (4 * 8)
#ifndef ATTRIB_CRC
#define ATTRIB_CRC
#endif
// #pragma message("USE ARM HW CRC")
ATTRIB_CRC
UInt32 Z7_FASTCALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table);
ATTRIB_CRC
UInt32 Z7_FASTCALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
UNUSED_VAR(table);
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_32_UNROLL_BYTES - 1)) != 0; size--)
v = __crc32b(v, *p++);
if (size >= T0_32_UNROLL_BYTES)
{
const Byte *lim = p + size;
size &= (T0_32_UNROLL_BYTES - 1);
lim -= size;
do
{
v = __crc32w(v, *(const UInt32 *)(const void *)(p));
v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
v = __crc32w(v, *(const UInt32 *)(const void *)(p));
v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
}
while (p != lim);
}
for (; size != 0; size--)
v = __crc32b(v, *p++);
return v;
}
ATTRIB_CRC
UInt32 Z7_FASTCALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table);
ATTRIB_CRC
UInt32 Z7_FASTCALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
UNUSED_VAR(table);
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_64_UNROLL_BYTES - 1)) != 0; size--)
v = __crc32b(v, *p++);
if (size >= T0_64_UNROLL_BYTES)
{
const Byte *lim = p + size;
size &= (T0_64_UNROLL_BYTES - 1);
lim -= size;
do
{
v = __crc32d(v, *(const UInt64 *)(const void *)(p));
v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
v = __crc32d(v, *(const UInt64 *)(const void *)(p));
v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
}
while (p != lim);
}
for (; size != 0; size--)
v = __crc32b(v, *p++);
return v;
}
#undef T0_32_UNROLL_BYTES
#undef T0_64_UNROLL_BYTES
#endif // defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
#endif // MY_CPU_LE
void Z7_FASTCALL CrcGenerateTable(void)
{
UInt32 i;
for (i = 0; i < 256; i++)
{
UInt32 r = i;
unsigned j;
for (j = 0; j < 8; j++)
r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
g_CrcTable[i] = r;
}
for (i = 256; i < 256 * CRC_NUM_TABLES; i++)
{
const UInt32 r = g_CrcTable[(size_t)i - 256];
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
}
#if CRC_NUM_TABLES < 4
g_CrcUpdate = CrcUpdateT1;
#elif defined(MY_CPU_LE)
// g_CrcUpdateT4 = CrcUpdateT4;
#if CRC_NUM_TABLES < 8
g_CrcUpdate = CrcUpdateT4;
#else // CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT8;
/*
#ifdef MY_CPU_X86_OR_AMD64
if (!CPU_Is_InOrder())
#endif
*/
g_CrcUpdate = CrcUpdateT8;
#endif
#else
{
#ifndef MY_CPU_BE
UInt32 k = 0x01020304;
const Byte *p = (const Byte *)&k;
if (p[0] == 4 && p[1] == 3)
{
#if CRC_NUM_TABLES < 8
// g_CrcUpdateT4 = CrcUpdateT4;
g_CrcUpdate = CrcUpdateT4;
#else // CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT8;
g_CrcUpdate = CrcUpdateT8;
#endif
}
else if (p[0] != 1 || p[1] != 2)
g_CrcUpdate = CrcUpdateT1;
else
#endif // MY_CPU_BE
{
for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
{
const UInt32 x = g_CrcTable[(size_t)i - 256];
g_CrcTable[i] = Z7_BSWAP32(x);
}
#if CRC_NUM_TABLES <= 4
g_CrcUpdate = CrcUpdateT1;
#elif CRC_NUM_TABLES <= 8
// g_CrcUpdateT4 = CrcUpdateT1_BeT4;
g_CrcUpdate = CrcUpdateT1_BeT4;
#else // CRC_NUM_TABLES > 8
g_CrcUpdateT8 = CrcUpdateT1_BeT8;
g_CrcUpdate = CrcUpdateT1_BeT8;
#endif
}
}
#endif // CRC_NUM_TABLES < 4
#ifdef MY_CPU_LE
#ifdef USE_ARM64_CRC
if (CPU_IsSupported_CRC32())
{
g_CrcUpdateT0_32 = CrcUpdateT0_32;
g_CrcUpdateT0_64 = CrcUpdateT0_64;
g_CrcUpdate =
#if defined(MY_CPU_ARM)
CrcUpdateT0_32;
#else
CrcUpdateT0_64;
#endif
}
#endif
#ifdef USE_CRC_EMU
g_CrcUpdateT0_32 = CrcUpdateT0_32;
g_CrcUpdateT0_64 = CrcUpdateT0_64;
g_CrcUpdate = CrcUpdateT0_64;
#endif
#endif
}
#undef kCrcPoly
#undef CRC64_NUM_TABLES
#undef CRC_UPDATE_BYTE_2

View file

@ -1,27 +0,0 @@
/* 7zCrc.h -- CRC32 calculation
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_7Z_CRC_H
#define ZIP7_INC_7Z_CRC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
extern UInt32 g_CrcTable[];
/* Call CrcGenerateTable one time before other CRC functions */
void Z7_FASTCALL CrcGenerateTable(void);
#define CRC_INIT_VAL 0xFFFFFFFF
#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL)
#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
UInt32 Z7_FASTCALL CrcUpdate(UInt32 crc, const void *data, size_t size);
UInt32 Z7_FASTCALL CrcCalc(const void *data, size_t size);
typedef UInt32 (Z7_FASTCALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
EXTERN_C_END
#endif

View file

@ -1,117 +0,0 @@
/* 7zCrcOpt.c -- CRC32 calculation
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "CpuArch.h"
#ifndef MY_CPU_BE
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
UInt32 Z7_FASTCALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 Z7_FASTCALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
for (; size >= 4; size -= 4, p += 4)
{
v ^= *(const UInt32 *)(const void *)p;
v =
(table + 0x300)[((v ) & 0xFF)]
^ (table + 0x200)[((v >> 8) & 0xFF)]
^ (table + 0x100)[((v >> 16) & 0xFF)]
^ (table + 0x000)[((v >> 24))];
}
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
UInt32 Z7_FASTCALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 Z7_FASTCALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
for (; size >= 8; size -= 8, p += 8)
{
UInt32 d;
v ^= *(const UInt32 *)(const void *)p;
v =
(table + 0x700)[((v ) & 0xFF)]
^ (table + 0x600)[((v >> 8) & 0xFF)]
^ (table + 0x500)[((v >> 16) & 0xFF)]
^ (table + 0x400)[((v >> 24))];
d = *((const UInt32 *)(const void *)p + 1);
v ^=
(table + 0x300)[((d ) & 0xFF)]
^ (table + 0x200)[((d >> 8) & 0xFF)]
^ (table + 0x100)[((d >> 16) & 0xFF)]
^ (table + 0x000)[((d >> 24))];
}
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
#endif
#ifndef MY_CPU_LE
#define CRC_UINT32_SWAP(v) Z7_BSWAP32(v)
#define CRC_UPDATE_BYTE_2_BE(crc, b) (table[(((crc) >> 24) ^ (b))] ^ ((crc) << 8))
UInt32 Z7_FASTCALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
table += 0x100;
v = CRC_UINT32_SWAP(v);
for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
v = CRC_UPDATE_BYTE_2_BE(v, *p);
for (; size >= 4; size -= 4, p += 4)
{
v ^= *(const UInt32 *)(const void *)p;
v =
(table + 0x000)[((v ) & 0xFF)]
^ (table + 0x100)[((v >> 8) & 0xFF)]
^ (table + 0x200)[((v >> 16) & 0xFF)]
^ (table + 0x300)[((v >> 24))];
}
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2_BE(v, *p);
return CRC_UINT32_SWAP(v);
}
UInt32 Z7_FASTCALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
table += 0x100;
v = CRC_UINT32_SWAP(v);
for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++)
v = CRC_UPDATE_BYTE_2_BE(v, *p);
for (; size >= 8; size -= 8, p += 8)
{
UInt32 d;
v ^= *(const UInt32 *)(const void *)p;
v =
(table + 0x400)[((v ) & 0xFF)]
^ (table + 0x500)[((v >> 8) & 0xFF)]
^ (table + 0x600)[((v >> 16) & 0xFF)]
^ (table + 0x700)[((v >> 24))];
d = *((const UInt32 *)(const void *)p + 1);
v ^=
(table + 0x000)[((d ) & 0xFF)]
^ (table + 0x100)[((d >> 8) & 0xFF)]
^ (table + 0x200)[((d >> 16) & 0xFF)]
^ (table + 0x300)[((d >> 24))];
}
for (; size > 0; size--, p++)
v = CRC_UPDATE_BYTE_2_BE(v, *p);
return CRC_UINT32_SWAP(v);
}
#endif

View file

@ -1,648 +0,0 @@
/* 7zDec.c -- Decoding from 7z folder
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <string.h>
/* #define Z7_PPMD_SUPPORT */
#include "7z.h"
#include "7zCrc.h"
#include "Bcj2.h"
#include "Bra.h"
#include "CpuArch.h"
#include "Delta.h"
#include "LzmaDec.h"
#include "Lzma2Dec.h"
#ifdef Z7_PPMD_SUPPORT
#include "Ppmd7.h"
#endif
#define k_Copy 0
#ifndef Z7_NO_METHOD_LZMA2
#define k_LZMA2 0x21
#endif
#define k_LZMA 0x30101
#define k_BCJ2 0x303011B
#if !defined(Z7_NO_METHODS_FILTERS)
#define Z7_USE_BRANCH_FILTER
#endif
#if !defined(Z7_NO_METHODS_FILTERS) || \
defined(Z7_USE_NATIVE_BRANCH_FILTER) && defined(MY_CPU_ARM64)
#define Z7_USE_FILTER_ARM64
#ifndef Z7_USE_BRANCH_FILTER
#define Z7_USE_BRANCH_FILTER
#endif
#define k_ARM64 0xa
#endif
#if !defined(Z7_NO_METHODS_FILTERS) || \
defined(Z7_USE_NATIVE_BRANCH_FILTER) && defined(MY_CPU_ARMT)
#define Z7_USE_FILTER_ARMT
#ifndef Z7_USE_BRANCH_FILTER
#define Z7_USE_BRANCH_FILTER
#endif
#define k_ARMT 0x3030701
#endif
#ifndef Z7_NO_METHODS_FILTERS
#define k_Delta 3
#define k_BCJ 0x3030103
#define k_PPC 0x3030205
#define k_IA64 0x3030401
#define k_ARM 0x3030501
#define k_SPARC 0x3030805
#endif
#ifdef Z7_PPMD_SUPPORT
#define k_PPMD 0x30401
typedef struct
{
IByteIn vt;
const Byte *cur;
const Byte *end;
const Byte *begin;
UInt64 processed;
BoolInt extra;
SRes res;
ILookInStreamPtr inStream;
} CByteInToLook;
static Byte ReadByte(IByteInPtr pp)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CByteInToLook)
if (p->cur != p->end)
return *p->cur++;
if (p->res == SZ_OK)
{
size_t size = (size_t)(p->cur - p->begin);
p->processed += size;
p->res = ILookInStream_Skip(p->inStream, size);
size = (1 << 25);
p->res = ILookInStream_Look(p->inStream, (const void **)&p->begin, &size);
p->cur = p->begin;
p->end = p->begin + size;
if (size != 0)
return *p->cur++;
}
p->extra = True;
return 0;
}
static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
{
CPpmd7 ppmd;
CByteInToLook s;
SRes res = SZ_OK;
s.vt.Read = ReadByte;
s.inStream = inStream;
s.begin = s.end = s.cur = NULL;
s.extra = False;
s.res = SZ_OK;
s.processed = 0;
if (propsSize != 5)
return SZ_ERROR_UNSUPPORTED;
{
unsigned order = props[0];
UInt32 memSize = GetUi32(props + 1);
if (order < PPMD7_MIN_ORDER ||
order > PPMD7_MAX_ORDER ||
memSize < PPMD7_MIN_MEM_SIZE ||
memSize > PPMD7_MAX_MEM_SIZE)
return SZ_ERROR_UNSUPPORTED;
Ppmd7_Construct(&ppmd);
if (!Ppmd7_Alloc(&ppmd, memSize, allocMain))
return SZ_ERROR_MEM;
Ppmd7_Init(&ppmd, order);
}
{
ppmd.rc.dec.Stream = &s.vt;
if (!Ppmd7z_RangeDec_Init(&ppmd.rc.dec))
res = SZ_ERROR_DATA;
else if (!s.extra)
{
Byte *buf = outBuffer;
const Byte *lim = buf + outSize;
for (; buf != lim; buf++)
{
int sym = Ppmd7z_DecodeSymbol(&ppmd);
if (s.extra || sym < 0)
break;
*buf = (Byte)sym;
}
if (buf != lim)
res = SZ_ERROR_DATA;
else if (!Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec))
{
/* if (Ppmd7z_DecodeSymbol(&ppmd) != PPMD7_SYM_END || !Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec)) */
res = SZ_ERROR_DATA;
}
}
if (s.extra)
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
else if (s.processed + (size_t)(s.cur - s.begin) != inSize)
res = SZ_ERROR_DATA;
}
Ppmd7_Free(&ppmd, allocMain);
return res;
}
#endif
static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
{
CLzmaDec state;
SRes res = SZ_OK;
LzmaDec_CONSTRUCT(&state)
RINOK(LzmaDec_AllocateProbs(&state, props, propsSize, allocMain))
state.dic = outBuffer;
state.dicBufSize = outSize;
LzmaDec_Init(&state);
for (;;)
{
const void *inBuf = NULL;
size_t lookahead = (1 << 18);
if (lookahead > inSize)
lookahead = (size_t)inSize;
res = ILookInStream_Look(inStream, &inBuf, &lookahead);
if (res != SZ_OK)
break;
{
SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos;
ELzmaStatus status;
res = LzmaDec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);
lookahead -= inProcessed;
inSize -= inProcessed;
if (res != SZ_OK)
break;
if (status == LZMA_STATUS_FINISHED_WITH_MARK)
{
if (outSize != state.dicPos || inSize != 0)
res = SZ_ERROR_DATA;
break;
}
if (outSize == state.dicPos && inSize == 0 && status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK)
break;
if (inProcessed == 0 && dicPos == state.dicPos)
{
res = SZ_ERROR_DATA;
break;
}
res = ILookInStream_Skip(inStream, inProcessed);
if (res != SZ_OK)
break;
}
}
LzmaDec_FreeProbs(&state, allocMain);
return res;
}
#ifndef Z7_NO_METHOD_LZMA2
static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
{
CLzma2Dec state;
SRes res = SZ_OK;
Lzma2Dec_CONSTRUCT(&state)
if (propsSize != 1)
return SZ_ERROR_DATA;
RINOK(Lzma2Dec_AllocateProbs(&state, props[0], allocMain))
state.decoder.dic = outBuffer;
state.decoder.dicBufSize = outSize;
Lzma2Dec_Init(&state);
for (;;)
{
const void *inBuf = NULL;
size_t lookahead = (1 << 18);
if (lookahead > inSize)
lookahead = (size_t)inSize;
res = ILookInStream_Look(inStream, &inBuf, &lookahead);
if (res != SZ_OK)
break;
{
SizeT inProcessed = (SizeT)lookahead, dicPos = state.decoder.dicPos;
ELzmaStatus status;
res = Lzma2Dec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);
lookahead -= inProcessed;
inSize -= inProcessed;
if (res != SZ_OK)
break;
if (status == LZMA_STATUS_FINISHED_WITH_MARK)
{
if (outSize != state.decoder.dicPos || inSize != 0)
res = SZ_ERROR_DATA;
break;
}
if (inProcessed == 0 && dicPos == state.decoder.dicPos)
{
res = SZ_ERROR_DATA;
break;
}
res = ILookInStream_Skip(inStream, inProcessed);
if (res != SZ_OK)
break;
}
}
Lzma2Dec_FreeProbs(&state, allocMain);
return res;
}
#endif
static SRes SzDecodeCopy(UInt64 inSize, ILookInStreamPtr inStream, Byte *outBuffer)
{
while (inSize > 0)
{
const void *inBuf;
size_t curSize = (1 << 18);
if (curSize > inSize)
curSize = (size_t)inSize;
RINOK(ILookInStream_Look(inStream, &inBuf, &curSize))
if (curSize == 0)
return SZ_ERROR_INPUT_EOF;
memcpy(outBuffer, inBuf, curSize);
outBuffer += curSize;
inSize -= curSize;
RINOK(ILookInStream_Skip(inStream, curSize))
}
return SZ_OK;
}
static BoolInt IS_MAIN_METHOD(UInt32 m)
{
switch (m)
{
case k_Copy:
case k_LZMA:
#ifndef Z7_NO_METHOD_LZMA2
case k_LZMA2:
#endif
#ifdef Z7_PPMD_SUPPORT
case k_PPMD:
#endif
return True;
}
return False;
}
static BoolInt IS_SUPPORTED_CODER(const CSzCoderInfo *c)
{
return
c->NumStreams == 1
/* && c->MethodID <= (UInt32)0xFFFFFFFF */
&& IS_MAIN_METHOD((UInt32)c->MethodID);
}
#define IS_BCJ2(c) ((c)->MethodID == k_BCJ2 && (c)->NumStreams == 4)
static SRes CheckSupportedFolder(const CSzFolder *f)
{
if (f->NumCoders < 1 || f->NumCoders > 4)
return SZ_ERROR_UNSUPPORTED;
if (!IS_SUPPORTED_CODER(&f->Coders[0]))
return SZ_ERROR_UNSUPPORTED;
if (f->NumCoders == 1)
{
if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBonds != 0)
return SZ_ERROR_UNSUPPORTED;
return SZ_OK;
}
#if defined(Z7_USE_BRANCH_FILTER)
if (f->NumCoders == 2)
{
const CSzCoderInfo *c = &f->Coders[1];
if (
/* c->MethodID > (UInt32)0xFFFFFFFF || */
c->NumStreams != 1
|| f->NumPackStreams != 1
|| f->PackStreams[0] != 0
|| f->NumBonds != 1
|| f->Bonds[0].InIndex != 1
|| f->Bonds[0].OutIndex != 0)
return SZ_ERROR_UNSUPPORTED;
switch ((UInt32)c->MethodID)
{
#if !defined(Z7_NO_METHODS_FILTERS)
case k_Delta:
case k_BCJ:
case k_PPC:
case k_IA64:
case k_SPARC:
case k_ARM:
#endif
#ifdef Z7_USE_FILTER_ARM64
case k_ARM64:
#endif
#ifdef Z7_USE_FILTER_ARMT
case k_ARMT:
#endif
break;
default:
return SZ_ERROR_UNSUPPORTED;
}
return SZ_OK;
}
#endif
if (f->NumCoders == 4)
{
if (!IS_SUPPORTED_CODER(&f->Coders[1])
|| !IS_SUPPORTED_CODER(&f->Coders[2])
|| !IS_BCJ2(&f->Coders[3]))
return SZ_ERROR_UNSUPPORTED;
if (f->NumPackStreams != 4
|| f->PackStreams[0] != 2
|| f->PackStreams[1] != 6
|| f->PackStreams[2] != 1
|| f->PackStreams[3] != 0
|| f->NumBonds != 3
|| f->Bonds[0].InIndex != 5 || f->Bonds[0].OutIndex != 0
|| f->Bonds[1].InIndex != 4 || f->Bonds[1].OutIndex != 1
|| f->Bonds[2].InIndex != 3 || f->Bonds[2].OutIndex != 2)
return SZ_ERROR_UNSUPPORTED;
return SZ_OK;
}
return SZ_ERROR_UNSUPPORTED;
}
static SRes SzFolder_Decode2(const CSzFolder *folder,
const Byte *propsData,
const UInt64 *unpackSizes,
const UInt64 *packPositions,
ILookInStreamPtr inStream, UInt64 startPos,
Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain,
Byte *tempBuf[])
{
UInt32 ci;
SizeT tempSizes[3] = { 0, 0, 0};
SizeT tempSize3 = 0;
Byte *tempBuf3 = 0;
RINOK(CheckSupportedFolder(folder))
for (ci = 0; ci < folder->NumCoders; ci++)
{
const CSzCoderInfo *coder = &folder->Coders[ci];
if (IS_MAIN_METHOD((UInt32)coder->MethodID))
{
UInt32 si = 0;
UInt64 offset;
UInt64 inSize;
Byte *outBufCur = outBuffer;
SizeT outSizeCur = outSize;
if (folder->NumCoders == 4)
{
const UInt32 indices[] = { 3, 2, 0 };
const UInt64 unpackSize = unpackSizes[ci];
si = indices[ci];
if (ci < 2)
{
Byte *temp;
outSizeCur = (SizeT)unpackSize;
if (outSizeCur != unpackSize)
return SZ_ERROR_MEM;
temp = (Byte *)ISzAlloc_Alloc(allocMain, outSizeCur);
if (!temp && outSizeCur != 0)
return SZ_ERROR_MEM;
outBufCur = tempBuf[1 - ci] = temp;
tempSizes[1 - ci] = outSizeCur;
}
else if (ci == 2)
{
if (unpackSize > outSize) /* check it */
return SZ_ERROR_PARAM;
tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
tempSize3 = outSizeCur = (SizeT)unpackSize;
}
else
return SZ_ERROR_UNSUPPORTED;
}
offset = packPositions[si];
inSize = packPositions[(size_t)si + 1] - offset;
RINOK(LookInStream_SeekTo(inStream, startPos + offset))
if (coder->MethodID == k_Copy)
{
if (inSize != outSizeCur) /* check it */
return SZ_ERROR_DATA;
RINOK(SzDecodeCopy(inSize, inStream, outBufCur))
}
else if (coder->MethodID == k_LZMA)
{
RINOK(SzDecodeLzma(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
}
#ifndef Z7_NO_METHOD_LZMA2
else if (coder->MethodID == k_LZMA2)
{
RINOK(SzDecodeLzma2(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
}
#endif
#ifdef Z7_PPMD_SUPPORT
else if (coder->MethodID == k_PPMD)
{
RINOK(SzDecodePpmd(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
}
#endif
else
return SZ_ERROR_UNSUPPORTED;
}
else if (coder->MethodID == k_BCJ2)
{
const UInt64 offset = packPositions[1];
const UInt64 s3Size = packPositions[2] - offset;
if (ci != 3)
return SZ_ERROR_UNSUPPORTED;
tempSizes[2] = (SizeT)s3Size;
if (tempSizes[2] != s3Size)
return SZ_ERROR_MEM;
tempBuf[2] = (Byte *)ISzAlloc_Alloc(allocMain, tempSizes[2]);
if (!tempBuf[2] && tempSizes[2] != 0)
return SZ_ERROR_MEM;
RINOK(LookInStream_SeekTo(inStream, startPos + offset))
RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2]))
if ((tempSizes[0] & 3) != 0 ||
(tempSizes[1] & 3) != 0 ||
tempSize3 + tempSizes[0] + tempSizes[1] != outSize)
return SZ_ERROR_DATA;
{
CBcj2Dec p;
p.bufs[0] = tempBuf3; p.lims[0] = tempBuf3 + tempSize3;
p.bufs[1] = tempBuf[0]; p.lims[1] = tempBuf[0] + tempSizes[0];
p.bufs[2] = tempBuf[1]; p.lims[2] = tempBuf[1] + tempSizes[1];
p.bufs[3] = tempBuf[2]; p.lims[3] = tempBuf[2] + tempSizes[2];
p.dest = outBuffer;
p.destLim = outBuffer + outSize;
Bcj2Dec_Init(&p);
RINOK(Bcj2Dec_Decode(&p))
{
unsigned i;
for (i = 0; i < 4; i++)
if (p.bufs[i] != p.lims[i])
return SZ_ERROR_DATA;
if (p.dest != p.destLim || !Bcj2Dec_IsMaybeFinished(&p))
return SZ_ERROR_DATA;
}
}
}
#if defined(Z7_USE_BRANCH_FILTER)
else if (ci == 1)
{
#if !defined(Z7_NO_METHODS_FILTERS)
if (coder->MethodID == k_Delta)
{
if (coder->PropsSize != 1)
return SZ_ERROR_UNSUPPORTED;
{
Byte state[DELTA_STATE_SIZE];
Delta_Init(state);
Delta_Decode(state, (unsigned)(propsData[coder->PropsOffset]) + 1, outBuffer, outSize);
}
continue;
}
#endif
#ifdef Z7_USE_FILTER_ARM64
if (coder->MethodID == k_ARM64)
{
UInt32 pc = 0;
if (coder->PropsSize == 4)
pc = GetUi32(propsData + coder->PropsOffset);
else if (coder->PropsSize != 0)
return SZ_ERROR_UNSUPPORTED;
z7_BranchConv_ARM64_Dec(outBuffer, outSize, pc);
continue;
}
#endif
#if !defined(Z7_NO_METHODS_FILTERS) || defined(Z7_USE_FILTER_ARMT)
{
if (coder->PropsSize != 0)
return SZ_ERROR_UNSUPPORTED;
#define CASE_BRA_CONV(isa) case k_ ## isa: Z7_BRANCH_CONV_DEC(isa)(outBuffer, outSize, 0); break; // pc = 0;
switch (coder->MethodID)
{
#if !defined(Z7_NO_METHODS_FILTERS)
case k_BCJ:
{
UInt32 state = Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL;
z7_BranchConvSt_X86_Dec(outBuffer, outSize, 0, &state); // pc = 0
break;
}
CASE_BRA_CONV(PPC)
CASE_BRA_CONV(IA64)
CASE_BRA_CONV(SPARC)
CASE_BRA_CONV(ARM)
#endif
#if !defined(Z7_NO_METHODS_FILTERS) || defined(Z7_USE_FILTER_ARMT)
CASE_BRA_CONV(ARMT)
#endif
default:
return SZ_ERROR_UNSUPPORTED;
}
continue;
}
#endif
} // (c == 1)
#endif
else
return SZ_ERROR_UNSUPPORTED;
}
return SZ_OK;
}
SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex,
ILookInStreamPtr inStream, UInt64 startPos,
Byte *outBuffer, size_t outSize,
ISzAllocPtr allocMain)
{
SRes res;
CSzFolder folder;
CSzData sd;
const Byte *data = p->CodersData + p->FoCodersOffsets[folderIndex];
sd.Data = data;
sd.Size = p->FoCodersOffsets[(size_t)folderIndex + 1] - p->FoCodersOffsets[folderIndex];
res = SzGetNextFolderItem(&folder, &sd);
if (res != SZ_OK)
return res;
if (sd.Size != 0
|| folder.UnpackStream != p->FoToMainUnpackSizeIndex[folderIndex]
|| outSize != SzAr_GetFolderUnpackSize(p, folderIndex))
return SZ_ERROR_FAIL;
{
unsigned i;
Byte *tempBuf[3] = { 0, 0, 0};
res = SzFolder_Decode2(&folder, data,
&p->CoderUnpackSizes[p->FoToCoderUnpackSizes[folderIndex]],
p->PackPositions + p->FoStartPackStreamIndex[folderIndex],
inStream, startPos,
outBuffer, (SizeT)outSize, allocMain, tempBuf);
for (i = 0; i < 3; i++)
ISzAlloc_Free(allocMain, tempBuf[i]);
if (res == SZ_OK)
if (SzBitWithVals_Check(&p->FolderCRCs, folderIndex))
if (CrcCalc(outBuffer, outSize) != p->FolderCRCs.Vals[folderIndex])
res = SZ_ERROR_CRC;
return res;
}
}

View file

@ -1,443 +0,0 @@
/* 7zFile.c -- File IO
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "7zFile.h"
#ifndef USE_WINDOWS_FILE
#include <errno.h>
#ifndef USE_FOPEN
#include <stdio.h>
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
typedef int ssize_t;
typedef int off_t;
#else
#include <unistd.h>
#endif
#endif
#else
/*
ReadFile and WriteFile functions in Windows have BUG:
If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
(Insufficient system resources exist to complete the requested service).
Probably in some version of Windows there are problems with other sizes:
for 32 MB (maybe also for 16 MB).
And message can be "Network connection was lost"
*/
#endif
#define kChunkSizeMax (1 << 22)
void File_Construct(CSzFile *p)
{
#ifdef USE_WINDOWS_FILE
p->handle = INVALID_HANDLE_VALUE;
#elif defined(USE_FOPEN)
p->file = NULL;
#else
p->fd = -1;
#endif
}
#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
static WRes File_Open(CSzFile *p, const char *name, int writeMode)
{
#ifdef USE_WINDOWS_FILE
p->handle = CreateFileA(name,
writeMode ? GENERIC_WRITE : GENERIC_READ,
FILE_SHARE_READ, NULL,
writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
#elif defined(USE_FOPEN)
p->file = fopen(name, writeMode ? "wb+" : "rb");
return (p->file != 0) ? 0 :
#ifdef UNDER_CE
2; /* ENOENT */
#else
errno;
#endif
#else
int flags = (writeMode ? (O_CREAT | O_EXCL | O_WRONLY) : O_RDONLY);
#ifdef O_BINARY
flags |= O_BINARY;
#endif
p->fd = open(name, flags, 0666);
return (p->fd != -1) ? 0 : errno;
#endif
}
WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); }
WRes OutFile_Open(CSzFile *p, const char *name)
{
#if defined(USE_WINDOWS_FILE) || defined(USE_FOPEN)
return File_Open(p, name, 1);
#else
p->fd = creat(name, 0666);
return (p->fd != -1) ? 0 : errno;
#endif
}
#endif
#ifdef USE_WINDOWS_FILE
static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode)
{
p->handle = CreateFileW(name,
writeMode ? GENERIC_WRITE : GENERIC_READ,
FILE_SHARE_READ, NULL,
writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
}
WRes InFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 0); }
WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1); }
#endif
WRes File_Close(CSzFile *p)
{
#ifdef USE_WINDOWS_FILE
if (p->handle != INVALID_HANDLE_VALUE)
{
if (!CloseHandle(p->handle))
return GetLastError();
p->handle = INVALID_HANDLE_VALUE;
}
#elif defined(USE_FOPEN)
if (p->file != NULL)
{
int res = fclose(p->file);
if (res != 0)
{
if (res == EOF)
return errno;
return res;
}
p->file = NULL;
}
#else
if (p->fd != -1)
{
if (close(p->fd) != 0)
return errno;
p->fd = -1;
}
#endif
return 0;
}
WRes File_Read(CSzFile *p, void *data, size_t *size)
{
size_t originalSize = *size;
*size = 0;
if (originalSize == 0)
return 0;
#ifdef USE_WINDOWS_FILE
do
{
const DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
DWORD processed = 0;
const BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
data = (void *)((Byte *)data + processed);
originalSize -= processed;
*size += processed;
if (!res)
return GetLastError();
// debug : we can break here for partial reading mode
if (processed == 0)
break;
}
while (originalSize > 0);
#elif defined(USE_FOPEN)
do
{
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
const size_t processed = fread(data, 1, curSize, p->file);
data = (void *)((Byte *)data + (size_t)processed);
originalSize -= processed;
*size += processed;
if (processed != curSize)
return ferror(p->file);
// debug : we can break here for partial reading mode
if (processed == 0)
break;
}
while (originalSize > 0);
#else
do
{
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
const ssize_t processed = read(p->fd, data, curSize);
if (processed == -1)
return errno;
if (processed == 0)
break;
data = (void *)((Byte *)data + (size_t)processed);
originalSize -= (size_t)processed;
*size += (size_t)processed;
// debug : we can break here for partial reading mode
// break;
}
while (originalSize > 0);
#endif
return 0;
}
WRes File_Write(CSzFile *p, const void *data, size_t *size)
{
size_t originalSize = *size;
*size = 0;
if (originalSize == 0)
return 0;
#ifdef USE_WINDOWS_FILE
do
{
const DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
DWORD processed = 0;
const BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
data = (const void *)((const Byte *)data + processed);
originalSize -= processed;
*size += processed;
if (!res)
return GetLastError();
if (processed == 0)
break;
}
while (originalSize > 0);
#elif defined(USE_FOPEN)
do
{
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
const size_t processed = fwrite(data, 1, curSize, p->file);
data = (void *)((Byte *)data + (size_t)processed);
originalSize -= processed;
*size += processed;
if (processed != curSize)
return ferror(p->file);
if (processed == 0)
break;
}
while (originalSize > 0);
#else
do
{
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
const ssize_t processed = write(p->fd, data, curSize);
if (processed == -1)
return errno;
if (processed == 0)
break;
data = (const void *)((const Byte *)data + (size_t)processed);
originalSize -= (size_t)processed;
*size += (size_t)processed;
}
while (originalSize > 0);
#endif
return 0;
}
WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
{
#ifdef USE_WINDOWS_FILE
DWORD moveMethod;
UInt32 low = (UInt32)*pos;
LONG high = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
// (int) to eliminate clang warning
switch ((int)origin)
{
case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
case SZ_SEEK_END: moveMethod = FILE_END; break;
default: return ERROR_INVALID_PARAMETER;
}
low = SetFilePointer(p->handle, (LONG)low, &high, moveMethod);
if (low == (UInt32)0xFFFFFFFF)
{
WRes res = GetLastError();
if (res != NO_ERROR)
return res;
}
*pos = ((Int64)high << 32) | low;
return 0;
#else
int moveMethod; // = origin;
switch ((int)origin)
{
case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
case SZ_SEEK_END: moveMethod = SEEK_END; break;
default: return EINVAL;
}
#if defined(USE_FOPEN)
{
int res = fseek(p->file, (long)*pos, moveMethod);
if (res == -1)
return errno;
*pos = ftell(p->file);
if (*pos == -1)
return errno;
return 0;
}
#else
{
off_t res = lseek(p->fd, (off_t)*pos, moveMethod);
if (res == -1)
return errno;
*pos = res;
return 0;
}
#endif // USE_FOPEN
#endif // USE_WINDOWS_FILE
}
WRes File_GetLength(CSzFile *p, UInt64 *length)
{
#ifdef USE_WINDOWS_FILE
DWORD sizeHigh;
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
if (sizeLow == 0xFFFFFFFF)
{
DWORD res = GetLastError();
if (res != NO_ERROR)
return res;
}
*length = (((UInt64)sizeHigh) << 32) + sizeLow;
return 0;
#elif defined(USE_FOPEN)
long pos = ftell(p->file);
int res = fseek(p->file, 0, SEEK_END);
*length = ftell(p->file);
fseek(p->file, pos, SEEK_SET);
return res;
#else
off_t pos;
*length = 0;
pos = lseek(p->fd, 0, SEEK_CUR);
if (pos != -1)
{
const off_t len2 = lseek(p->fd, 0, SEEK_END);
const off_t res2 = lseek(p->fd, pos, SEEK_SET);
if (len2 != -1)
{
*length = (UInt64)len2;
if (res2 != -1)
return 0;
}
}
return errno;
#endif
}
/* ---------- FileSeqInStream ---------- */
static SRes FileSeqInStream_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileSeqInStream)
const WRes wres = File_Read(&p->file, buf, size);
p->wres = wres;
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
}
void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
{
p->vt.Read = FileSeqInStream_Read;
}
/* ---------- FileInStream ---------- */
static SRes FileInStream_Read(ISeekInStreamPtr pp, void *buf, size_t *size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileInStream)
const WRes wres = File_Read(&p->file, buf, size);
p->wres = wres;
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
}
static SRes FileInStream_Seek(ISeekInStreamPtr pp, Int64 *pos, ESzSeek origin)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileInStream)
const WRes wres = File_Seek(&p->file, pos, origin);
p->wres = wres;
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
}
void FileInStream_CreateVTable(CFileInStream *p)
{
p->vt.Read = FileInStream_Read;
p->vt.Seek = FileInStream_Seek;
}
/* ---------- FileOutStream ---------- */
static size_t FileOutStream_Write(ISeqOutStreamPtr pp, const void *data, size_t size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileOutStream)
const WRes wres = File_Write(&p->file, data, &size);
p->wres = wres;
return size;
}
void FileOutStream_CreateVTable(CFileOutStream *p)
{
p->vt.Write = FileOutStream_Write;
}

View file

@ -1,92 +0,0 @@
/* 7zFile.h -- File IO
2023-03-05 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_FILE_H
#define ZIP7_INC_FILE_H
#ifdef _WIN32
#define USE_WINDOWS_FILE
// #include <windows.h>
#endif
#ifdef USE_WINDOWS_FILE
#include "7zWindows.h"
#else
// note: USE_FOPEN mode is limited to 32-bit file size
// #define USE_FOPEN
// #include <stdio.h>
#endif
#include "7zTypes.h"
EXTERN_C_BEGIN
/* ---------- File ---------- */
typedef struct
{
#ifdef USE_WINDOWS_FILE
HANDLE handle;
#elif defined(USE_FOPEN)
FILE *file;
#else
int fd;
#endif
} CSzFile;
void File_Construct(CSzFile *p);
#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
WRes InFile_Open(CSzFile *p, const char *name);
WRes OutFile_Open(CSzFile *p, const char *name);
#endif
#ifdef USE_WINDOWS_FILE
WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
#endif
WRes File_Close(CSzFile *p);
/* reads max(*size, remain file's size) bytes */
WRes File_Read(CSzFile *p, void *data, size_t *size);
/* writes *size bytes */
WRes File_Write(CSzFile *p, const void *data, size_t *size);
WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
WRes File_GetLength(CSzFile *p, UInt64 *length);
/* ---------- FileInStream ---------- */
typedef struct
{
ISeqInStream vt;
CSzFile file;
WRes wres;
} CFileSeqInStream;
void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
typedef struct
{
ISeekInStream vt;
CSzFile file;
WRes wres;
} CFileInStream;
void FileInStream_CreateVTable(CFileInStream *p);
typedef struct
{
ISeqOutStream vt;
CSzFile file;
WRes wres;
} CFileOutStream;
void FileOutStream_CreateVTable(CFileOutStream *p);
EXTERN_C_END
#endif

View file

@ -1,199 +0,0 @@
/* 7zStream.c -- 7z Stream functions
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <string.h>
#include "7zTypes.h"
SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize)
{
size_t size = *processedSize;
*processedSize = 0;
while (size != 0)
{
size_t cur = size;
const SRes res = ISeqInStream_Read(stream, buf, &cur);
*processedSize += cur;
buf = (void *)((Byte *)buf + cur);
size -= cur;
if (res != SZ_OK)
return res;
if (cur == 0)
return SZ_OK;
}
return SZ_OK;
}
/*
SRes SeqInStream_Read2(ISeqInStreamPtr stream, void *buf, size_t size, SRes errorType)
{
while (size != 0)
{
size_t processed = size;
RINOK(ISeqInStream_Read(stream, buf, &processed))
if (processed == 0)
return errorType;
buf = (void *)((Byte *)buf + processed);
size -= processed;
}
return SZ_OK;
}
SRes SeqInStream_Read(ISeqInStreamPtr stream, void *buf, size_t size)
{
return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
}
*/
SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf)
{
size_t processed = 1;
RINOK(ISeqInStream_Read(stream, buf, &processed))
return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
}
SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset)
{
Int64 t = (Int64)offset;
return ILookInStream_Seek(stream, &t, SZ_SEEK_SET);
}
SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size)
{
const void *lookBuf;
if (*size == 0)
return SZ_OK;
RINOK(ILookInStream_Look(stream, &lookBuf, size))
memcpy(buf, lookBuf, *size);
return ILookInStream_Skip(stream, *size);
}
SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType)
{
while (size != 0)
{
size_t processed = size;
RINOK(ILookInStream_Read(stream, buf, &processed))
if (processed == 0)
return errorType;
buf = (void *)((Byte *)buf + processed);
size -= processed;
}
return SZ_OK;
}
SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size)
{
return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
}
#define GET_LookToRead2 Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLookToRead2)
static SRes LookToRead2_Look_Lookahead(ILookInStreamPtr pp, const void **buf, size_t *size)
{
SRes res = SZ_OK;
GET_LookToRead2
size_t size2 = p->size - p->pos;
if (size2 == 0 && *size != 0)
{
p->pos = 0;
p->size = 0;
size2 = p->bufSize;
res = ISeekInStream_Read(p->realStream, p->buf, &size2);
p->size = size2;
}
if (*size > size2)
*size = size2;
*buf = p->buf + p->pos;
return res;
}
static SRes LookToRead2_Look_Exact(ILookInStreamPtr pp, const void **buf, size_t *size)
{
SRes res = SZ_OK;
GET_LookToRead2
size_t size2 = p->size - p->pos;
if (size2 == 0 && *size != 0)
{
p->pos = 0;
p->size = 0;
if (*size > p->bufSize)
*size = p->bufSize;
res = ISeekInStream_Read(p->realStream, p->buf, size);
size2 = p->size = *size;
}
if (*size > size2)
*size = size2;
*buf = p->buf + p->pos;
return res;
}
static SRes LookToRead2_Skip(ILookInStreamPtr pp, size_t offset)
{
GET_LookToRead2
p->pos += offset;
return SZ_OK;
}
static SRes LookToRead2_Read(ILookInStreamPtr pp, void *buf, size_t *size)
{
GET_LookToRead2
size_t rem = p->size - p->pos;
if (rem == 0)
return ISeekInStream_Read(p->realStream, buf, size);
if (rem > *size)
rem = *size;
memcpy(buf, p->buf + p->pos, rem);
p->pos += rem;
*size = rem;
return SZ_OK;
}
static SRes LookToRead2_Seek(ILookInStreamPtr pp, Int64 *pos, ESzSeek origin)
{
GET_LookToRead2
p->pos = p->size = 0;
return ISeekInStream_Seek(p->realStream, pos, origin);
}
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead)
{
p->vt.Look = lookahead ?
LookToRead2_Look_Lookahead :
LookToRead2_Look_Exact;
p->vt.Skip = LookToRead2_Skip;
p->vt.Read = LookToRead2_Read;
p->vt.Seek = LookToRead2_Seek;
}
static SRes SecToLook_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CSecToLook)
return LookInStream_LookRead(p->realStream, buf, size);
}
void SecToLook_CreateVTable(CSecToLook *p)
{
p->vt.Read = SecToLook_Read;
}
static SRes SecToRead_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CSecToRead)
return ILookInStream_Read(p->realStream, buf, size);
}
void SecToRead_CreateVTable(CSecToRead *p)
{
p->vt.Read = SecToRead_Read;
}

View file

@ -1,597 +0,0 @@
/* 7zTypes.h -- Basic types
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_7Z_TYPES_H
#define ZIP7_7Z_TYPES_H
#ifdef _WIN32
/* #include <windows.h> */
#else
#include <errno.h>
#endif
#include <stddef.h>
#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif
EXTERN_C_BEGIN
#define SZ_OK 0
#define SZ_ERROR_DATA 1
#define SZ_ERROR_MEM 2
#define SZ_ERROR_CRC 3
#define SZ_ERROR_UNSUPPORTED 4
#define SZ_ERROR_PARAM 5
#define SZ_ERROR_INPUT_EOF 6
#define SZ_ERROR_OUTPUT_EOF 7
#define SZ_ERROR_READ 8
#define SZ_ERROR_WRITE 9
#define SZ_ERROR_PROGRESS 10
#define SZ_ERROR_FAIL 11
#define SZ_ERROR_THREAD 12
#define SZ_ERROR_ARCHIVE 16
#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes;
#ifdef _MSC_VER
#if _MSC_VER > 1200
#define MY_ALIGN(n) __declspec(align(n))
#else
#define MY_ALIGN(n)
#endif
#else
/*
// C11/C++11:
#include <stdalign.h>
#define MY_ALIGN(n) alignas(n)
*/
#define MY_ALIGN(n) __attribute__ ((aligned(n)))
#endif
#ifdef _WIN32
/* typedef DWORD WRes; */
typedef unsigned WRes;
#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
// #define MY_HRES_ERROR_INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
#else // _WIN32
// #define ENV_HAVE_LSTAT
typedef int WRes;
// (FACILITY_ERRNO = 0x800) is 7zip's FACILITY constant to represent (errno) errors in HRESULT
#define MY_FACILITY_ERRNO 0x800
#define MY_FACILITY_WIN32 7
#define MY_FACILITY_WRes MY_FACILITY_ERRNO
#define MY_HRESULT_FROM_errno_CONST_ERROR(x) ((HRESULT)( \
( (HRESULT)(x) & 0x0000FFFF) \
| (MY_FACILITY_WRes << 16) \
| (HRESULT)0x80000000 ))
#define MY_SRes_HRESULT_FROM_WRes(x) \
((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : MY_HRESULT_FROM_errno_CONST_ERROR(x))
// we call macro HRESULT_FROM_WIN32 for system errors (WRes) that are (errno)
#define HRESULT_FROM_WIN32(x) MY_SRes_HRESULT_FROM_WRes(x)
/*
#define ERROR_FILE_NOT_FOUND 2L
#define ERROR_ACCESS_DENIED 5L
#define ERROR_NO_MORE_FILES 18L
#define ERROR_LOCK_VIOLATION 33L
#define ERROR_FILE_EXISTS 80L
#define ERROR_DISK_FULL 112L
#define ERROR_NEGATIVE_SEEK 131L
#define ERROR_ALREADY_EXISTS 183L
#define ERROR_DIRECTORY 267L
#define ERROR_TOO_MANY_POSTS 298L
#define ERROR_INTERNAL_ERROR 1359L
#define ERROR_INVALID_REPARSE_DATA 4392L
#define ERROR_REPARSE_TAG_INVALID 4393L
#define ERROR_REPARSE_TAG_MISMATCH 4394L
*/
// we use errno equivalents for some WIN32 errors:
#define ERROR_INVALID_PARAMETER EINVAL
#define ERROR_INVALID_FUNCTION EINVAL
#define ERROR_ALREADY_EXISTS EEXIST
#define ERROR_FILE_EXISTS EEXIST
#define ERROR_PATH_NOT_FOUND ENOENT
#define ERROR_FILE_NOT_FOUND ENOENT
#define ERROR_DISK_FULL ENOSPC
// #define ERROR_INVALID_HANDLE EBADF
// we use FACILITY_WIN32 for errors that has no errno equivalent
// Too many posts were made to a semaphore.
#define ERROR_TOO_MANY_POSTS ((HRESULT)0x8007012AL)
#define ERROR_INVALID_REPARSE_DATA ((HRESULT)0x80071128L)
#define ERROR_REPARSE_TAG_INVALID ((HRESULT)0x80071129L)
// if (MY_FACILITY_WRes != FACILITY_WIN32),
// we use FACILITY_WIN32 for COM errors:
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define E_INVALIDARG ((HRESULT)0x80070057L)
#define MY_E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
/*
// we can use FACILITY_ERRNO for some COM errors, that have errno equivalents:
#define E_OUTOFMEMORY MY_HRESULT_FROM_errno_CONST_ERROR(ENOMEM)
#define E_INVALIDARG MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
#define MY_E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
*/
#define TEXT(quote) quote
#define FILE_ATTRIBUTE_READONLY 0x0001
#define FILE_ATTRIBUTE_HIDDEN 0x0002
#define FILE_ATTRIBUTE_SYSTEM 0x0004
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
#define FILE_ATTRIBUTE_ARCHIVE 0x0020
#define FILE_ATTRIBUTE_DEVICE 0x0040
#define FILE_ATTRIBUTE_NORMAL 0x0080
#define FILE_ATTRIBUTE_TEMPORARY 0x0100
#define FILE_ATTRIBUTE_SPARSE_FILE 0x0200
#define FILE_ATTRIBUTE_REPARSE_POINT 0x0400
#define FILE_ATTRIBUTE_COMPRESSED 0x0800
#define FILE_ATTRIBUTE_OFFLINE 0x1000
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x2000
#define FILE_ATTRIBUTE_ENCRYPTED 0x4000
#define FILE_ATTRIBUTE_UNIX_EXTENSION 0x8000 /* trick for Unix */
#endif
#ifndef RINOK
#define RINOK(x) { const int _result_ = (x); if (_result_ != 0) return _result_; }
#endif
#ifndef RINOK_WRes
#define RINOK_WRes(x) { const WRes _result_ = (x); if (_result_ != 0) return _result_; }
#endif
typedef unsigned char Byte;
typedef short Int16;
typedef unsigned short UInt16;
#ifdef Z7_DECL_Int32_AS_long
typedef long Int32;
typedef unsigned long UInt32;
#else
typedef int Int32;
typedef unsigned int UInt32;
#endif
#ifndef _WIN32
typedef int INT;
typedef Int32 INT32;
typedef unsigned int UINT;
typedef UInt32 UINT32;
typedef INT32 LONG; // LONG, ULONG and DWORD must be 32-bit for _WIN32 compatibility
typedef UINT32 ULONG;
#undef DWORD
typedef UINT32 DWORD;
#define VOID void
#define HRESULT LONG
typedef void *LPVOID;
// typedef void VOID;
// typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
// gcc / clang on Unix : sizeof(long==sizeof(void*) in 32 or 64 bits)
typedef long INT_PTR;
typedef unsigned long UINT_PTR;
typedef long LONG_PTR;
typedef unsigned long DWORD_PTR;
typedef size_t SIZE_T;
#endif // _WIN32
#define MY_HRES_ERROR_INTERNAL_ERROR ((HRESULT)0x8007054FL)
#ifdef Z7_DECL_Int64_AS_long
typedef long Int64;
typedef unsigned long UInt64;
#else
#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__clang__)
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else
#if defined(__clang__) || defined(__GNUC__)
#include <stdint.h>
typedef int64_t Int64;
typedef uint64_t UInt64;
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
// #define UINT64_CONST(n) n ## ULL
#endif
#endif
#endif
#define UINT64_CONST(n) n
#ifdef Z7_DECL_SizeT_AS_unsigned_int
typedef unsigned int SizeT;
#else
typedef size_t SizeT;
#endif
/*
#if (defined(_MSC_VER) && _MSC_VER <= 1200)
typedef size_t MY_uintptr_t;
#else
#include <stdint.h>
typedef uintptr_t MY_uintptr_t;
#endif
*/
typedef int BoolInt;
/* typedef BoolInt Bool; */
#define True 1
#define False 0
#ifdef _WIN32
#define Z7_STDCALL __stdcall
#else
#define Z7_STDCALL
#endif
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#define Z7_NO_INLINE __declspec(noinline)
#else
#define Z7_NO_INLINE
#endif
#define Z7_FORCE_INLINE __forceinline
#define Z7_CDECL __cdecl
#define Z7_FASTCALL __fastcall
#else // _MSC_VER
#if (defined(__GNUC__) && (__GNUC__ >= 4)) \
|| (defined(__clang__) && (__clang_major__ >= 4)) \
|| defined(__INTEL_COMPILER) \
|| defined(__xlC__)
#define Z7_NO_INLINE __attribute__((noinline))
#define Z7_FORCE_INLINE __attribute__((always_inline)) inline
#else
#define Z7_NO_INLINE
#define Z7_FORCE_INLINE
#endif
#define Z7_CDECL
#if defined(_M_IX86) \
|| defined(__i386__)
// #define Z7_FASTCALL __attribute__((fastcall))
// #define Z7_FASTCALL __attribute__((cdecl))
#define Z7_FASTCALL
#elif defined(MY_CPU_AMD64)
// #define Z7_FASTCALL __attribute__((ms_abi))
#define Z7_FASTCALL
#else
#define Z7_FASTCALL
#endif
#endif // _MSC_VER
/* The following interfaces use first parameter as pointer to structure */
// #define Z7_C_IFACE_CONST_QUAL
#define Z7_C_IFACE_CONST_QUAL const
#define Z7_C_IFACE_DECL(a) \
struct a ## _; \
typedef Z7_C_IFACE_CONST_QUAL struct a ## _ * a ## Ptr; \
typedef struct a ## _ a; \
struct a ## _
Z7_C_IFACE_DECL (IByteIn)
{
Byte (*Read)(IByteInPtr p); /* reads one byte, returns 0 in case of EOF or error */
};
#define IByteIn_Read(p) (p)->Read(p)
Z7_C_IFACE_DECL (IByteOut)
{
void (*Write)(IByteOutPtr p, Byte b);
};
#define IByteOut_Write(p, b) (p)->Write(p, b)
Z7_C_IFACE_DECL (ISeqInStream)
{
SRes (*Read)(ISeqInStreamPtr p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
};
#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
/* try to read as much as avail in stream and limited by (*processedSize) */
SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize);
/* it can return SZ_ERROR_INPUT_EOF */
// SRes SeqInStream_Read(ISeqInStreamPtr stream, void *buf, size_t size);
// SRes SeqInStream_Read2(ISeqInStreamPtr stream, void *buf, size_t size, SRes errorType);
SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf);
Z7_C_IFACE_DECL (ISeqOutStream)
{
size_t (*Write)(ISeqOutStreamPtr p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
};
#define ISeqOutStream_Write(p, buf, size) (p)->Write(p, buf, size)
typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
SZ_SEEK_END = 2
} ESzSeek;
Z7_C_IFACE_DECL (ISeekInStream)
{
SRes (*Read)(ISeekInStreamPtr p, void *buf, size_t *size); /* same as ISeqInStream::Read */
SRes (*Seek)(ISeekInStreamPtr p, Int64 *pos, ESzSeek origin);
};
#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
Z7_C_IFACE_DECL (ILookInStream)
{
SRes (*Look)(ILookInStreamPtr p, const void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
SRes (*Skip)(ILookInStreamPtr p, size_t offset);
/* offset must be <= output(*size) of Look */
SRes (*Read)(ILookInStreamPtr p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
SRes (*Seek)(ILookInStreamPtr p, Int64 *pos, ESzSeek origin);
};
#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
#define ILookInStream_Skip(p, offset) (p)->Skip(p, offset)
#define ILookInStream_Read(p, buf, size) (p)->Read(p, buf, size)
#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size);
SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset);
/* reads via ILookInStream::Read */
SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType);
SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size);
typedef struct
{
ILookInStream vt;
ISeekInStreamPtr realStream;
size_t pos;
size_t size; /* it's data size */
/* the following variables must be set outside */
Byte *buf;
size_t bufSize;
} CLookToRead2;
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
#define LookToRead2_INIT(p) { (p)->pos = (p)->size = 0; }
typedef struct
{
ISeqInStream vt;
ILookInStreamPtr realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream vt;
ILookInStreamPtr realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
Z7_C_IFACE_DECL (ICompressProgress)
{
SRes (*Progress)(ICompressProgressPtr p, UInt64 inSize, UInt64 outSize);
/* Returns: result. (result != SZ_OK) means break.
Value (UInt64)(Int64)-1 for size means unknown value. */
};
#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
typedef struct ISzAlloc ISzAlloc;
typedef const ISzAlloc * ISzAllocPtr;
struct ISzAlloc
{
void *(*Alloc)(ISzAllocPtr p, size_t size);
void (*Free)(ISzAllocPtr p, void *address); /* address can be 0 */
};
#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
#define ISzAlloc_Free(p, a) (p)->Free(p, a)
/* deprecated */
#define IAlloc_Alloc(p, size) ISzAlloc_Alloc(p, size)
#define IAlloc_Free(p, a) ISzAlloc_Free(p, a)
#ifndef MY_offsetof
#ifdef offsetof
#define MY_offsetof(type, m) offsetof(type, m)
/*
#define MY_offsetof(type, m) FIELD_OFFSET(type, m)
*/
#else
#define MY_offsetof(type, m) ((size_t)&(((type *)0)->m))
#endif
#endif
#ifndef Z7_container_of
/*
#define Z7_container_of(ptr, type, m) container_of(ptr, type, m)
#define Z7_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
#define Z7_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
#define Z7_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
*/
/*
GCC shows warning: "perhaps the 'offsetof' macro was used incorrectly"
GCC 3.4.4 : classes with constructor
GCC 4.8.1 : classes with non-public variable members"
*/
#define Z7_container_of(ptr, type, m) \
((type *)(void *)((char *)(void *) \
(1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
#define Z7_container_of_CONST(ptr, type, m) \
((const type *)(const void *)((const char *)(const void *) \
(1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
/*
#define Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m) \
((type *)(void *)(const void *)((const char *)(const void *) \
(1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
*/
#endif
#define Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
#define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of(ptr, type, m)
// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m)
#define Z7_CONTAINER_FROM_VTBL_CONST(ptr, type, m) Z7_container_of_CONST(ptr, type, m)
#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
/*
#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL(ptr, type, m)
*/
#if defined (__clang__) || defined(__GNUC__)
#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL \
_Pragma("GCC diagnostic pop")
#else
#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL
#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
#endif
#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(ptr, type, m, p) \
Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
type *p = Z7_CONTAINER_FROM_VTBL(ptr, type, m); \
Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(type) \
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(pp, type, vt, p)
// #define ZIP7_DECLARE_HANDLE(name) typedef void *name;
#define Z7_DECLARE_HANDLE(name) struct name##_dummy{int unused;}; typedef struct name##_dummy *name;
#define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
#ifndef Z7_ARRAY_SIZE
#define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
#ifdef _WIN32
#define CHAR_PATH_SEPARATOR '\\'
#define WCHAR_PATH_SEPARATOR L'\\'
#define STRING_PATH_SEPARATOR "\\"
#define WSTRING_PATH_SEPARATOR L"\\"
#else
#define CHAR_PATH_SEPARATOR '/'
#define WCHAR_PATH_SEPARATOR L'/'
#define STRING_PATH_SEPARATOR "/"
#define WSTRING_PATH_SEPARATOR L"/"
#endif
#define k_PropVar_TimePrec_0 0
#define k_PropVar_TimePrec_Unix 1
#define k_PropVar_TimePrec_DOS 2
#define k_PropVar_TimePrec_HighPrec 3
#define k_PropVar_TimePrec_Base 16
#define k_PropVar_TimePrec_100ns (k_PropVar_TimePrec_Base + 7)
#define k_PropVar_TimePrec_1ns (k_PropVar_TimePrec_Base + 9)
EXTERN_C_END
#endif
/*
#ifndef Z7_ST
#ifdef _7ZIP_ST
#define Z7_ST
#endif
#endif
*/

View file

@ -1,27 +0,0 @@
#define MY_VER_MAJOR 23
#define MY_VER_MINOR 01
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "23.01"
#define MY_VERSION MY_VERSION_NUMBERS
#ifdef MY_CPU_NAME
#define MY_VERSION_CPU MY_VERSION " (" MY_CPU_NAME ")"
#else
#define MY_VERSION_CPU MY_VERSION
#endif
#define MY_DATE "2023-06-20"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"
#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2023 Igor Pavlov"
#ifdef USE_COPYRIGHT_CR
#define MY_COPYRIGHT MY_COPYRIGHT_CR
#else
#define MY_COPYRIGHT MY_COPYRIGHT_PD
#endif
#define MY_COPYRIGHT_DATE MY_COPYRIGHT " : " MY_DATE
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION_CPU " : " MY_COPYRIGHT " : " MY_DATE

View file

@ -1,55 +0,0 @@
#define MY_VS_FFI_FILEFLAGSMASK 0x0000003FL
#define MY_VOS_NT_WINDOWS32 0x00040004L
#define MY_VOS_CE_WINDOWS32 0x00050004L
#define MY_VFT_APP 0x00000001L
#define MY_VFT_DLL 0x00000002L
// #include <WinVer.h>
#ifndef MY_VERSION
#include "7zVersion.h"
#endif
#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0
#ifdef DEBUG
#define DBG_FL VS_FF_DEBUG
#else
#define DBG_FL 0
#endif
#define MY_VERSION_INFO(fileType, descr, intName, origName) \
LANGUAGE 9, 1 \
1 VERSIONINFO \
FILEVERSION MY_VER \
PRODUCTVERSION MY_VER \
FILEFLAGSMASK MY_VS_FFI_FILEFLAGSMASK \
FILEFLAGS DBG_FL \
FILEOS MY_VOS_NT_WINDOWS32 \
FILETYPE fileType \
FILESUBTYPE 0x0L \
BEGIN \
BLOCK "StringFileInfo" \
BEGIN \
BLOCK "040904b0" \
BEGIN \
VALUE "CompanyName", "Igor Pavlov" \
VALUE "FileDescription", descr \
VALUE "FileVersion", MY_VERSION \
VALUE "InternalName", intName \
VALUE "LegalCopyright", MY_COPYRIGHT \
VALUE "OriginalFilename", origName \
VALUE "ProductName", "7-Zip" \
VALUE "ProductVersion", MY_VERSION \
END \
END \
BLOCK "VarFileInfo" \
BEGIN \
VALUE "Translation", 0x409, 1200 \
END \
END
#define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(MY_VFT_APP, descr, intName, intName ".exe")
#define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(MY_VFT_DLL, descr, intName, intName ".dll")

View file

@ -1,101 +0,0 @@
/* 7zWindows.h -- StdAfx
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_7Z_WINDOWS_H
#define ZIP7_INC_7Z_WINDOWS_H
#ifdef _WIN32
#if defined(__clang__)
# pragma clang diagnostic push
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4668) // '_WIN32_WINNT' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
#if _MSC_VER == 1900
// for old kit10 versions
// #pragma warning(disable : 4255) // winuser.h(13979): warning C4255: 'GetThreadDpiAwarenessContext':
#endif
// win10 Windows Kit:
#endif // _MSC_VER
#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
// for msvc6 without sdk2003
#define RPC_NO_WINDOWS_H
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
// #if defined(__GNUC__) && !defined(__clang__)
#include <windows.h>
#else
#include <Windows.h>
#endif
// #include <basetsd.h>
// #include <wtypes.h>
// but if precompiled with clang-cl then we need
// #include <windows.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
#ifndef _W64
typedef long LONG_PTR, *PLONG_PTR;
typedef unsigned long ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
#define Z7_OLD_WIN_SDK
#endif // _W64
#endif // _MSC_VER == 1200
#ifdef Z7_OLD_WIN_SDK
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
#ifndef FILE_SPECIAL_ACCESS
#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS)
#endif
// ShlObj.h:
// #define BIF_NEWDIALOGSTYLE 0x0040
#pragma warning(disable : 4201)
// #pragma warning(disable : 4115)
#undef VARIANT_TRUE
#define VARIANT_TRUE ((VARIANT_BOOL)-1)
#endif
#endif // Z7_OLD_WIN_SDK
#ifdef UNDER_CE
#undef VARIANT_TRUE
#define VARIANT_TRUE ((VARIANT_BOOL)-1)
#endif
#if defined(_MSC_VER)
#if _MSC_VER >= 1400 && _MSC_VER <= 1600
// BaseTsd.h(148) : 'HandleToULong' : unreferenced inline function has been removed
// string.h
// #pragma warning(disable : 4514)
#endif
#endif
/* #include "7zTypes.h" */
#endif

393
3rdparty/7z/src/Aes.c vendored
View file

@ -1,393 +0,0 @@
/* Aes.c -- AES encryption / decryption
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "CpuArch.h"
#include "Aes.h"
AES_CODE_FUNC g_AesCbc_Decode;
#ifndef Z7_SFX
AES_CODE_FUNC g_AesCbc_Encode;
AES_CODE_FUNC g_AesCtr_Code;
UInt32 g_Aes_SupportedFunctions_Flags;
#endif
static UInt32 T[256 * 4];
static const Byte Sbox[256] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16};
static UInt32 D[256 * 4];
static Byte InvS[256];
#define xtime(x) ((((x) << 1) ^ (((x) & 0x80) != 0 ? 0x1B : 0)) & 0xFF)
#define Ui32(a0, a1, a2, a3) ((UInt32)(a0) | ((UInt32)(a1) << 8) | ((UInt32)(a2) << 16) | ((UInt32)(a3) << 24))
#define gb0(x) ( (x) & 0xFF)
#define gb1(x) (((x) >> ( 8)) & 0xFF)
#define gb2(x) (((x) >> (16)) & 0xFF)
#define gb3(x) (((x) >> (24)))
#define gb(n, x) gb ## n(x)
#define TT(x) (T + (x << 8))
#define DD(x) (D + (x << 8))
// #define Z7_SHOW_AES_STATUS
#ifdef MY_CPU_X86_OR_AMD64
#define USE_HW_AES
#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
#if defined(__clang__)
#if (__clang_major__ >= 8) // fix that check
#define USE_HW_AES
#endif
#elif defined(__GNUC__)
#if (__GNUC__ >= 6) // fix that check
#define USE_HW_AES
#endif
#elif defined(_MSC_VER)
#if _MSC_VER >= 1910
#define USE_HW_AES
#endif
#endif
#endif
#ifdef USE_HW_AES
#ifdef Z7_SHOW_AES_STATUS
#include <stdio.h>
#define PRF(x) x
#else
#define PRF(x)
#endif
#endif
void AesGenTables(void)
{
unsigned i;
for (i = 0; i < 256; i++)
InvS[Sbox[i]] = (Byte)i;
for (i = 0; i < 256; i++)
{
{
const UInt32 a1 = Sbox[i];
const UInt32 a2 = xtime(a1);
const UInt32 a3 = a2 ^ a1;
TT(0)[i] = Ui32(a2, a1, a1, a3);
TT(1)[i] = Ui32(a3, a2, a1, a1);
TT(2)[i] = Ui32(a1, a3, a2, a1);
TT(3)[i] = Ui32(a1, a1, a3, a2);
}
{
const UInt32 a1 = InvS[i];
const UInt32 a2 = xtime(a1);
const UInt32 a4 = xtime(a2);
const UInt32 a8 = xtime(a4);
const UInt32 a9 = a8 ^ a1;
const UInt32 aB = a8 ^ a2 ^ a1;
const UInt32 aD = a8 ^ a4 ^ a1;
const UInt32 aE = a8 ^ a4 ^ a2;
DD(0)[i] = Ui32(aE, a9, aD, aB);
DD(1)[i] = Ui32(aB, aE, a9, aD);
DD(2)[i] = Ui32(aD, aB, aE, a9);
DD(3)[i] = Ui32(a9, aD, aB, aE);
}
}
{
AES_CODE_FUNC d = AesCbc_Decode;
#ifndef Z7_SFX
AES_CODE_FUNC e = AesCbc_Encode;
AES_CODE_FUNC c = AesCtr_Code;
UInt32 flags = 0;
#endif
#ifdef USE_HW_AES
if (CPU_IsSupported_AES())
{
// #pragma message ("AES HW")
PRF(printf("\n===AES HW\n"));
d = AesCbc_Decode_HW;
#ifndef Z7_SFX
e = AesCbc_Encode_HW;
c = AesCtr_Code_HW;
flags = k_Aes_SupportedFunctions_HW;
#endif
#ifdef MY_CPU_X86_OR_AMD64
if (CPU_IsSupported_VAES_AVX2())
{
PRF(printf("\n===vaes avx2\n"));
d = AesCbc_Decode_HW_256;
#ifndef Z7_SFX
c = AesCtr_Code_HW_256;
flags |= k_Aes_SupportedFunctions_HW_256;
#endif
}
#endif
}
#endif
g_AesCbc_Decode = d;
#ifndef Z7_SFX
g_AesCbc_Encode = e;
g_AesCtr_Code = c;
g_Aes_SupportedFunctions_Flags = flags;
#endif
}
}
#define HT(i, x, s) TT(x)[gb(x, s[(i + x) & 3])]
#define HT4(m, i, s, p) m[i] = \
HT(i, 0, s) ^ \
HT(i, 1, s) ^ \
HT(i, 2, s) ^ \
HT(i, 3, s) ^ w[p + i]
#define HT16(m, s, p) \
HT4(m, 0, s, p); \
HT4(m, 1, s, p); \
HT4(m, 2, s, p); \
HT4(m, 3, s, p); \
#define FT(i, x) Sbox[gb(x, m[(i + x) & 3])]
#define FT4(i) dest[i] = Ui32(FT(i, 0), FT(i, 1), FT(i, 2), FT(i, 3)) ^ w[i];
#define HD(i, x, s) DD(x)[gb(x, s[(i - x) & 3])]
#define HD4(m, i, s, p) m[i] = \
HD(i, 0, s) ^ \
HD(i, 1, s) ^ \
HD(i, 2, s) ^ \
HD(i, 3, s) ^ w[p + i];
#define HD16(m, s, p) \
HD4(m, 0, s, p); \
HD4(m, 1, s, p); \
HD4(m, 2, s, p); \
HD4(m, 3, s, p); \
#define FD(i, x) InvS[gb(x, m[(i - x) & 3])]
#define FD4(i) dest[i] = Ui32(FD(i, 0), FD(i, 1), FD(i, 2), FD(i, 3)) ^ w[i];
void Z7_FASTCALL Aes_SetKey_Enc(UInt32 *w, const Byte *key, unsigned keySize)
{
unsigned i, m;
const UInt32 *wLim;
UInt32 t;
UInt32 rcon = 1;
keySize /= 4;
w[0] = ((UInt32)keySize / 2) + 3;
w += 4;
for (i = 0; i < keySize; i++, key += 4)
w[i] = GetUi32(key);
t = w[(size_t)keySize - 1];
wLim = w + (size_t)keySize * 3 + 28;
m = 0;
do
{
if (m == 0)
{
t = Ui32(Sbox[gb1(t)] ^ rcon, Sbox[gb2(t)], Sbox[gb3(t)], Sbox[gb0(t)]);
rcon <<= 1;
if (rcon & 0x100)
rcon = 0x1b;
m = keySize;
}
else if (m == 4 && keySize > 6)
t = Ui32(Sbox[gb0(t)], Sbox[gb1(t)], Sbox[gb2(t)], Sbox[gb3(t)]);
m--;
t ^= w[0];
w[keySize] = t;
}
while (++w != wLim);
}
void Z7_FASTCALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize)
{
unsigned i, num;
Aes_SetKey_Enc(w, key, keySize);
num = keySize + 20;
w += 8;
for (i = 0; i < num; i++)
{
UInt32 r = w[i];
w[i] =
DD(0)[Sbox[gb0(r)]] ^
DD(1)[Sbox[gb1(r)]] ^
DD(2)[Sbox[gb2(r)]] ^
DD(3)[Sbox[gb3(r)]];
}
}
/* Aes_Encode and Aes_Decode functions work with little-endian words.
src and dest are pointers to 4 UInt32 words.
src and dest can point to same block */
// Z7_FORCE_INLINE
static void Aes_Encode(const UInt32 *w, UInt32 *dest, const UInt32 *src)
{
UInt32 s[4];
UInt32 m[4];
UInt32 numRounds2 = w[0];
w += 4;
s[0] = src[0] ^ w[0];
s[1] = src[1] ^ w[1];
s[2] = src[2] ^ w[2];
s[3] = src[3] ^ w[3];
w += 4;
for (;;)
{
HT16(m, s, 0)
if (--numRounds2 == 0)
break;
HT16(s, m, 4)
w += 8;
}
w += 4;
FT4(0)
FT4(1)
FT4(2)
FT4(3)
}
Z7_FORCE_INLINE
static void Aes_Decode(const UInt32 *w, UInt32 *dest, const UInt32 *src)
{
UInt32 s[4];
UInt32 m[4];
UInt32 numRounds2 = w[0];
w += 4 + numRounds2 * 8;
s[0] = src[0] ^ w[0];
s[1] = src[1] ^ w[1];
s[2] = src[2] ^ w[2];
s[3] = src[3] ^ w[3];
for (;;)
{
w -= 8;
HD16(m, s, 4)
if (--numRounds2 == 0)
break;
HD16(s, m, 0)
}
FD4(0)
FD4(1)
FD4(2)
FD4(3)
}
void AesCbc_Init(UInt32 *p, const Byte *iv)
{
unsigned i;
for (i = 0; i < 4; i++)
p[i] = GetUi32(iv + i * 4);
}
void Z7_FASTCALL AesCbc_Encode(UInt32 *p, Byte *data, size_t numBlocks)
{
for (; numBlocks != 0; numBlocks--, data += AES_BLOCK_SIZE)
{
p[0] ^= GetUi32(data);
p[1] ^= GetUi32(data + 4);
p[2] ^= GetUi32(data + 8);
p[3] ^= GetUi32(data + 12);
Aes_Encode(p + 4, p, p);
SetUi32(data, p[0])
SetUi32(data + 4, p[1])
SetUi32(data + 8, p[2])
SetUi32(data + 12, p[3])
}
}
void Z7_FASTCALL AesCbc_Decode(UInt32 *p, Byte *data, size_t numBlocks)
{
UInt32 in[4], out[4];
for (; numBlocks != 0; numBlocks--, data += AES_BLOCK_SIZE)
{
in[0] = GetUi32(data);
in[1] = GetUi32(data + 4);
in[2] = GetUi32(data + 8);
in[3] = GetUi32(data + 12);
Aes_Decode(p + 4, out, in);
SetUi32(data, p[0] ^ out[0])
SetUi32(data + 4, p[1] ^ out[1])
SetUi32(data + 8, p[2] ^ out[2])
SetUi32(data + 12, p[3] ^ out[3])
p[0] = in[0];
p[1] = in[1];
p[2] = in[2];
p[3] = in[3];
}
}
void Z7_FASTCALL AesCtr_Code(UInt32 *p, Byte *data, size_t numBlocks)
{
for (; numBlocks != 0; numBlocks--)
{
UInt32 temp[4];
unsigned i;
if (++p[0] == 0)
p[1]++;
Aes_Encode(p + 4, temp, p);
for (i = 0; i < 4; i++, data += 4)
{
const UInt32 t = temp[i];
#ifdef MY_CPU_LE_UNALIGN
*((UInt32 *)(void *)data) ^= t;
#else
data[0] = (Byte)(data[0] ^ (t & 0xFF));
data[1] = (Byte)(data[1] ^ ((t >> 8) & 0xFF));
data[2] = (Byte)(data[2] ^ ((t >> 16) & 0xFF));
data[3] = (Byte)(data[3] ^ ((t >> 24)));
#endif
}
}
}
#undef xtime
#undef Ui32
#undef gb0
#undef gb1
#undef gb2
#undef gb3
#undef gb
#undef TT
#undef DD
#undef USE_HW_AES
#undef PRF

60
3rdparty/7z/src/Aes.h vendored
View file

@ -1,60 +0,0 @@
/* Aes.h -- AES encryption / decryption
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_AES_H
#define ZIP7_INC_AES_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define AES_BLOCK_SIZE 16
/* Call AesGenTables one time before other AES functions */
void AesGenTables(void);
/* UInt32 pointers must be 16-byte aligned */
/* 16-byte (4 * 32-bit words) blocks: 1 (IV) + 1 (keyMode) + 15 (AES-256 roundKeys) */
#define AES_NUM_IVMRK_WORDS ((1 + 1 + 15) * 4)
/* aes - 16-byte aligned pointer to keyMode+roundKeys sequence */
/* keySize = 16 or 24 or 32 (bytes) */
typedef void (Z7_FASTCALL *AES_SET_KEY_FUNC)(UInt32 *aes, const Byte *key, unsigned keySize);
void Z7_FASTCALL Aes_SetKey_Enc(UInt32 *aes, const Byte *key, unsigned keySize);
void Z7_FASTCALL Aes_SetKey_Dec(UInt32 *aes, const Byte *key, unsigned keySize);
/* ivAes - 16-byte aligned pointer to iv+keyMode+roundKeys sequence: UInt32[AES_NUM_IVMRK_WORDS] */
void AesCbc_Init(UInt32 *ivAes, const Byte *iv); /* iv size is AES_BLOCK_SIZE */
/* data - 16-byte aligned pointer to data */
/* numBlocks - the number of 16-byte blocks in data array */
typedef void (Z7_FASTCALL *AES_CODE_FUNC)(UInt32 *ivAes, Byte *data, size_t numBlocks);
extern AES_CODE_FUNC g_AesCbc_Decode;
#ifndef Z7_SFX
extern AES_CODE_FUNC g_AesCbc_Encode;
extern AES_CODE_FUNC g_AesCtr_Code;
#define k_Aes_SupportedFunctions_HW (1 << 2)
#define k_Aes_SupportedFunctions_HW_256 (1 << 3)
extern UInt32 g_Aes_SupportedFunctions_Flags;
#endif
#define Z7_DECLARE_AES_CODE_FUNC(funcName) \
void Z7_FASTCALL funcName(UInt32 *ivAes, Byte *data, size_t numBlocks);
Z7_DECLARE_AES_CODE_FUNC (AesCbc_Encode)
Z7_DECLARE_AES_CODE_FUNC (AesCbc_Decode)
Z7_DECLARE_AES_CODE_FUNC (AesCtr_Code)
Z7_DECLARE_AES_CODE_FUNC (AesCbc_Encode_HW)
Z7_DECLARE_AES_CODE_FUNC (AesCbc_Decode_HW)
Z7_DECLARE_AES_CODE_FUNC (AesCtr_Code_HW)
Z7_DECLARE_AES_CODE_FUNC (AesCbc_Decode_HW_256)
Z7_DECLARE_AES_CODE_FUNC (AesCtr_Code_HW_256)
EXTERN_C_END
#endif

View file

@ -1,840 +0,0 @@
/* AesOpt.c -- AES optimized code for x86 AES hardware instructions
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Aes.h"
#include "CpuArch.h"
#ifdef MY_CPU_X86_OR_AMD64
#if defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER >= 1110)
#define USE_INTEL_AES
#if (__INTEL_COMPILER >= 1900)
#define USE_INTEL_VAES
#endif
#endif
#elif defined(__clang__) && (__clang_major__ > 3 || __clang_major__ == 3 && __clang_minor__ >= 8) \
|| defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define USE_INTEL_AES
#if !defined(__AES__)
#define ATTRIB_AES __attribute__((__target__("aes")))
#endif
#if defined(__clang__) && (__clang_major__ >= 8) \
|| defined(__GNUC__) && (__GNUC__ >= 8)
#define USE_INTEL_VAES
#if !defined(__AES__) || !defined(__VAES__) || !defined(__AVX__) || !defined(__AVX2__)
#define ATTRIB_VAES __attribute__((__target__("aes,vaes,avx,avx2")))
#endif
#endif
#elif defined(_MSC_VER)
#if (_MSC_VER > 1500) || (_MSC_FULL_VER >= 150030729)
#define USE_INTEL_AES
#if (_MSC_VER >= 1910)
#define USE_INTEL_VAES
#endif
#endif
#endif
#ifndef ATTRIB_AES
#define ATTRIB_AES
#endif
#ifndef ATTRIB_VAES
#define ATTRIB_VAES
#endif
#ifdef USE_INTEL_AES
#include <wmmintrin.h>
#ifndef USE_INTEL_VAES
#define AES_TYPE_keys UInt32
#define AES_TYPE_data Byte
// #define AES_TYPE_keys __m128i
// #define AES_TYPE_data __m128i
#endif
#define AES_FUNC_START(name) \
void Z7_FASTCALL name(UInt32 *ivAes, Byte *data8, size_t numBlocks)
// void Z7_FASTCALL name(__m128i *p, __m128i *data, size_t numBlocks)
#define AES_FUNC_START2(name) \
AES_FUNC_START (name); \
ATTRIB_AES \
AES_FUNC_START (name)
#define MM_OP(op, dest, src) dest = op(dest, src);
#define MM_OP_m(op, src) MM_OP(op, m, src)
#define MM_XOR( dest, src) MM_OP(_mm_xor_si128, dest, src)
#define AVX_XOR(dest, src) MM_OP(_mm256_xor_si256, dest, src)
AES_FUNC_START2 (AesCbc_Encode_HW)
{
__m128i *p = (__m128i *)(void *)ivAes;
__m128i *data = (__m128i *)(void *)data8;
__m128i m = *p;
const __m128i k0 = p[2];
const __m128i k1 = p[3];
const UInt32 numRounds2 = *(const UInt32 *)(p + 1) - 1;
for (; numBlocks != 0; numBlocks--, data++)
{
UInt32 r = numRounds2;
const __m128i *w = p + 4;
__m128i temp = *data;
MM_XOR (temp, k0)
MM_XOR (m, temp)
MM_OP_m (_mm_aesenc_si128, k1)
do
{
MM_OP_m (_mm_aesenc_si128, w[0])
MM_OP_m (_mm_aesenc_si128, w[1])
w += 2;
}
while (--r);
MM_OP_m (_mm_aesenclast_si128, w[0])
*data = m;
}
*p = m;
}
#define WOP_1(op)
#define WOP_2(op) WOP_1 (op) op (m1, 1)
#define WOP_3(op) WOP_2 (op) op (m2, 2)
#define WOP_4(op) WOP_3 (op) op (m3, 3)
#ifdef MY_CPU_AMD64
#define WOP_5(op) WOP_4 (op) op (m4, 4)
#define WOP_6(op) WOP_5 (op) op (m5, 5)
#define WOP_7(op) WOP_6 (op) op (m6, 6)
#define WOP_8(op) WOP_7 (op) op (m7, 7)
#endif
/*
#define WOP_9(op) WOP_8 (op) op (m8, 8);
#define WOP_10(op) WOP_9 (op) op (m9, 9);
#define WOP_11(op) WOP_10(op) op (m10, 10);
#define WOP_12(op) WOP_11(op) op (m11, 11);
#define WOP_13(op) WOP_12(op) op (m12, 12);
#define WOP_14(op) WOP_13(op) op (m13, 13);
*/
#ifdef MY_CPU_AMD64
#define NUM_WAYS 8
#define WOP_M1 WOP_8
#else
#define NUM_WAYS 4
#define WOP_M1 WOP_4
#endif
#define WOP(op) op (m0, 0) WOP_M1(op)
#define DECLARE_VAR(reg, ii) __m128i reg;
#define LOAD_data( reg, ii) reg = data[ii];
#define STORE_data( reg, ii) data[ii] = reg;
#if (NUM_WAYS > 1)
#define XOR_data_M1(reg, ii) MM_XOR (reg, data[ii- 1])
#endif
#define AVX_DECLARE_VAR(reg, ii) __m256i reg;
#define AVX_LOAD_data( reg, ii) reg = ((const __m256i *)(const void *)data)[ii];
#define AVX_STORE_data( reg, ii) ((__m256i *)(void *)data)[ii] = reg;
#define AVX_XOR_data_M1(reg, ii) AVX_XOR (reg, (((const __m256i *)(const void *)(data - 1))[ii]))
#define MM_OP_key(op, reg) MM_OP(op, reg, key);
#define AES_DEC( reg, ii) MM_OP_key (_mm_aesdec_si128, reg)
#define AES_DEC_LAST( reg, ii) MM_OP_key (_mm_aesdeclast_si128, reg)
#define AES_ENC( reg, ii) MM_OP_key (_mm_aesenc_si128, reg)
#define AES_ENC_LAST( reg, ii) MM_OP_key (_mm_aesenclast_si128, reg)
#define AES_XOR( reg, ii) MM_OP_key (_mm_xor_si128, reg)
#define AVX_AES_DEC( reg, ii) MM_OP_key (_mm256_aesdec_epi128, reg)
#define AVX_AES_DEC_LAST( reg, ii) MM_OP_key (_mm256_aesdeclast_epi128, reg)
#define AVX_AES_ENC( reg, ii) MM_OP_key (_mm256_aesenc_epi128, reg)
#define AVX_AES_ENC_LAST( reg, ii) MM_OP_key (_mm256_aesenclast_epi128, reg)
#define AVX_AES_XOR( reg, ii) MM_OP_key (_mm256_xor_si256, reg)
#define CTR_START(reg, ii) MM_OP (_mm_add_epi64, ctr, one) reg = ctr;
#define CTR_END( reg, ii) MM_XOR (data[ii], reg)
#define AVX_CTR_START(reg, ii) MM_OP (_mm256_add_epi64, ctr2, two) reg = _mm256_xor_si256(ctr2, key);
#define AVX_CTR_END( reg, ii) AVX_XOR (((__m256i *)(void *)data)[ii], reg)
#define WOP_KEY(op, n) { \
const __m128i key = w[n]; \
WOP(op); }
#define AVX_WOP_KEY(op, n) { \
const __m256i key = w[n]; \
WOP(op); }
#define WIDE_LOOP_START \
dataEnd = data + numBlocks; \
if (numBlocks >= NUM_WAYS) \
{ dataEnd -= NUM_WAYS; do { \
#define WIDE_LOOP_END \
data += NUM_WAYS; \
} while (data <= dataEnd); \
dataEnd += NUM_WAYS; } \
#define SINGLE_LOOP \
for (; data < dataEnd; data++)
#define NUM_AES_KEYS_MAX 15
#define WIDE_LOOP_START_AVX(OP) \
dataEnd = data + numBlocks; \
if (numBlocks >= NUM_WAYS * 2) \
{ __m256i keys[NUM_AES_KEYS_MAX]; \
UInt32 ii; \
OP \
for (ii = 0; ii < numRounds; ii++) \
keys[ii] = _mm256_broadcastsi128_si256(p[ii]); \
dataEnd -= NUM_WAYS * 2; do { \
#define WIDE_LOOP_END_AVX(OP) \
data += NUM_WAYS * 2; \
} while (data <= dataEnd); \
dataEnd += NUM_WAYS * 2; \
OP \
_mm256_zeroupper(); \
} \
/* MSVC for x86: If we don't call _mm256_zeroupper(), and -arch:IA32 is not specified,
MSVC still can insert vzeroupper instruction. */
AES_FUNC_START2 (AesCbc_Decode_HW)
{
__m128i *p = (__m128i *)(void *)ivAes;
__m128i *data = (__m128i *)(void *)data8;
__m128i iv = *p;
const __m128i *wStart = p + *(const UInt32 *)(p + 1) * 2 + 2 - 1;
const __m128i *dataEnd;
p += 2;
WIDE_LOOP_START
{
const __m128i *w = wStart;
WOP (DECLARE_VAR)
WOP (LOAD_data)
WOP_KEY (AES_XOR, 1)
do
{
WOP_KEY (AES_DEC, 0)
w--;
}
while (w != p);
WOP_KEY (AES_DEC_LAST, 0)
MM_XOR (m0, iv)
WOP_M1 (XOR_data_M1)
iv = data[NUM_WAYS - 1];
WOP (STORE_data)
}
WIDE_LOOP_END
SINGLE_LOOP
{
const __m128i *w = wStart - 1;
__m128i m = _mm_xor_si128 (w[2], *data);
do
{
MM_OP_m (_mm_aesdec_si128, w[1])
MM_OP_m (_mm_aesdec_si128, w[0])
w -= 2;
}
while (w != p);
MM_OP_m (_mm_aesdec_si128, w[1])
MM_OP_m (_mm_aesdeclast_si128, w[0])
MM_XOR (m, iv)
iv = *data;
*data = m;
}
p[-2] = iv;
}
AES_FUNC_START2 (AesCtr_Code_HW)
{
__m128i *p = (__m128i *)(void *)ivAes;
__m128i *data = (__m128i *)(void *)data8;
__m128i ctr = *p;
UInt32 numRoundsMinus2 = *(const UInt32 *)(p + 1) * 2 - 1;
const __m128i *dataEnd;
__m128i one = _mm_cvtsi32_si128(1);
p += 2;
WIDE_LOOP_START
{
const __m128i *w = p;
UInt32 r = numRoundsMinus2;
WOP (DECLARE_VAR)
WOP (CTR_START)
WOP_KEY (AES_XOR, 0)
w += 1;
do
{
WOP_KEY (AES_ENC, 0)
w += 1;
}
while (--r);
WOP_KEY (AES_ENC_LAST, 0)
WOP (CTR_END)
}
WIDE_LOOP_END
SINGLE_LOOP
{
UInt32 numRounds2 = *(const UInt32 *)(p - 2 + 1) - 1;
const __m128i *w = p;
__m128i m;
MM_OP (_mm_add_epi64, ctr, one)
m = _mm_xor_si128 (ctr, p[0]);
w += 1;
do
{
MM_OP_m (_mm_aesenc_si128, w[0])
MM_OP_m (_mm_aesenc_si128, w[1])
w += 2;
}
while (--numRounds2);
MM_OP_m (_mm_aesenc_si128, w[0])
MM_OP_m (_mm_aesenclast_si128, w[1])
MM_XOR (*data, m)
}
p[-2] = ctr;
}
#ifdef USE_INTEL_VAES
/*
GCC before 2013-Jun:
<immintrin.h>:
#ifdef __AVX__
#include <avxintrin.h>
#endif
GCC after 2013-Jun:
<immintrin.h>:
#include <avxintrin.h>
CLANG 3.8+:
{
<immintrin.h>:
#if !defined(_MSC_VER) || defined(__AVX__)
#include <avxintrin.h>
#endif
if (the compiler is clang for Windows and if global arch is not set for __AVX__)
[ if (defined(_MSC_VER) && !defined(__AVX__)) ]
{
<immintrin.h> doesn't include <avxintrin.h>
and we have 2 ways to fix it:
1) we can define required __AVX__ before <immintrin.h>
or
2) we can include <avxintrin.h> after <immintrin.h>
}
}
If we include <avxintrin.h> manually for GCC/CLANG, it's
required that <immintrin.h> must be included before <avxintrin.h>.
*/
/*
#if defined(__clang__) && defined(_MSC_VER)
#define __AVX__
#define __AVX2__
#define __VAES__
#endif
*/
#include <immintrin.h>
#if defined(__clang__) && defined(_MSC_VER)
#if !defined(__AVX__)
#include <avxintrin.h>
#endif
#if !defined(__AVX2__)
#include <avx2intrin.h>
#endif
#if !defined(__VAES__)
#include <vaesintrin.h>
#endif
#endif // __clang__ && _MSC_VER
#define VAES_FUNC_START2(name) \
AES_FUNC_START (name); \
ATTRIB_VAES \
AES_FUNC_START (name)
VAES_FUNC_START2 (AesCbc_Decode_HW_256)
{
__m128i *p = (__m128i *)(void *)ivAes;
__m128i *data = (__m128i *)(void *)data8;
__m128i iv = *p;
const __m128i *dataEnd;
UInt32 numRounds = *(const UInt32 *)(p + 1) * 2 + 1;
p += 2;
WIDE_LOOP_START_AVX(;)
{
const __m256i *w = keys + numRounds - 2;
WOP (AVX_DECLARE_VAR)
WOP (AVX_LOAD_data)
AVX_WOP_KEY (AVX_AES_XOR, 1)
do
{
AVX_WOP_KEY (AVX_AES_DEC, 0)
w--;
}
while (w != keys);
AVX_WOP_KEY (AVX_AES_DEC_LAST, 0)
AVX_XOR (m0, _mm256_setr_m128i(iv, data[0]))
WOP_M1 (AVX_XOR_data_M1)
iv = data[NUM_WAYS * 2 - 1];
WOP (AVX_STORE_data)
}
WIDE_LOOP_END_AVX(;)
SINGLE_LOOP
{
const __m128i *w = p + *(const UInt32 *)(p + 1 - 2) * 2 + 1 - 3;
__m128i m = _mm_xor_si128 (w[2], *data);
do
{
MM_OP_m (_mm_aesdec_si128, w[1])
MM_OP_m (_mm_aesdec_si128, w[0])
w -= 2;
}
while (w != p);
MM_OP_m (_mm_aesdec_si128, w[1])
MM_OP_m (_mm_aesdeclast_si128, w[0])
MM_XOR (m, iv)
iv = *data;
*data = m;
}
p[-2] = iv;
}
/*
SSE2: _mm_cvtsi32_si128 : movd
AVX: _mm256_setr_m128i : vinsertf128
AVX2: _mm256_add_epi64 : vpaddq ymm, ymm, ymm
_mm256_extracti128_si256 : vextracti128
_mm256_broadcastsi128_si256 : vbroadcasti128
*/
#define AVX_CTR_LOOP_START \
ctr2 = _mm256_setr_m128i(_mm_sub_epi64(ctr, one), ctr); \
two = _mm256_setr_m128i(one, one); \
two = _mm256_add_epi64(two, two); \
// two = _mm256_setr_epi64x(2, 0, 2, 0);
#define AVX_CTR_LOOP_ENC \
ctr = _mm256_extracti128_si256 (ctr2, 1); \
VAES_FUNC_START2 (AesCtr_Code_HW_256)
{
__m128i *p = (__m128i *)(void *)ivAes;
__m128i *data = (__m128i *)(void *)data8;
__m128i ctr = *p;
UInt32 numRounds = *(const UInt32 *)(p + 1) * 2 + 1;
const __m128i *dataEnd;
__m128i one = _mm_cvtsi32_si128(1);
__m256i ctr2, two;
p += 2;
WIDE_LOOP_START_AVX (AVX_CTR_LOOP_START)
{
const __m256i *w = keys;
UInt32 r = numRounds - 2;
WOP (AVX_DECLARE_VAR)
AVX_WOP_KEY (AVX_CTR_START, 0)
w += 1;
do
{
AVX_WOP_KEY (AVX_AES_ENC, 0)
w += 1;
}
while (--r);
AVX_WOP_KEY (AVX_AES_ENC_LAST, 0)
WOP (AVX_CTR_END)
}
WIDE_LOOP_END_AVX (AVX_CTR_LOOP_ENC)
SINGLE_LOOP
{
UInt32 numRounds2 = *(const UInt32 *)(p - 2 + 1) - 1;
const __m128i *w = p;
__m128i m;
MM_OP (_mm_add_epi64, ctr, one)
m = _mm_xor_si128 (ctr, p[0]);
w += 1;
do
{
MM_OP_m (_mm_aesenc_si128, w[0])
MM_OP_m (_mm_aesenc_si128, w[1])
w += 2;
}
while (--numRounds2);
MM_OP_m (_mm_aesenc_si128, w[0])
MM_OP_m (_mm_aesenclast_si128, w[1])
MM_XOR (*data, m)
}
p[-2] = ctr;
}
#endif // USE_INTEL_VAES
#else // USE_INTEL_AES
/* no USE_INTEL_AES */
#pragma message("AES HW_SW stub was used")
#define AES_TYPE_keys UInt32
#define AES_TYPE_data Byte
#define AES_FUNC_START(name) \
void Z7_FASTCALL name(UInt32 *p, Byte *data, size_t numBlocks) \
#define AES_COMPAT_STUB(name) \
AES_FUNC_START(name); \
AES_FUNC_START(name ## _HW) \
{ name(p, data, numBlocks); }
AES_COMPAT_STUB (AesCbc_Encode)
AES_COMPAT_STUB (AesCbc_Decode)
AES_COMPAT_STUB (AesCtr_Code)
#endif // USE_INTEL_AES
#ifndef USE_INTEL_VAES
#pragma message("VAES HW_SW stub was used")
#define VAES_COMPAT_STUB(name) \
void Z7_FASTCALL name ## _256(UInt32 *p, Byte *data, size_t numBlocks); \
void Z7_FASTCALL name ## _256(UInt32 *p, Byte *data, size_t numBlocks) \
{ name((AES_TYPE_keys *)(void *)p, (AES_TYPE_data *)(void *)data, numBlocks); }
VAES_COMPAT_STUB (AesCbc_Decode_HW)
VAES_COMPAT_STUB (AesCtr_Code_HW)
#endif // ! USE_INTEL_VAES
#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
#if defined(__clang__)
#if (__clang_major__ >= 8) // fix that check
#define USE_HW_AES
#endif
#elif defined(__GNUC__)
#if (__GNUC__ >= 6) // fix that check
#define USE_HW_AES
#endif
#elif defined(_MSC_VER)
#if _MSC_VER >= 1910
#define USE_HW_AES
#endif
#endif
#ifdef USE_HW_AES
// #pragma message("=== AES HW === ")
#if defined(__clang__) || defined(__GNUC__)
#ifdef MY_CPU_ARM64
#define ATTRIB_AES __attribute__((__target__("+crypto")))
#else
#define ATTRIB_AES __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
#endif
#else
// _MSC_VER
// for arm32
#define _ARM_USE_NEW_NEON_INTRINSICS
#endif
#ifndef ATTRIB_AES
#define ATTRIB_AES
#endif
#if defined(_MSC_VER) && defined(MY_CPU_ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
typedef uint8x16_t v128;
#define AES_FUNC_START(name) \
void Z7_FASTCALL name(UInt32 *ivAes, Byte *data8, size_t numBlocks)
// void Z7_FASTCALL name(v128 *p, v128 *data, size_t numBlocks)
#define AES_FUNC_START2(name) \
AES_FUNC_START (name); \
ATTRIB_AES \
AES_FUNC_START (name)
#define MM_OP(op, dest, src) dest = op(dest, src);
#define MM_OP_m(op, src) MM_OP(op, m, src)
#define MM_OP1_m(op) m = op(m);
#define MM_XOR( dest, src) MM_OP(veorq_u8, dest, src)
#define MM_XOR_m( src) MM_XOR(m, src)
#define AES_E_m(k) MM_OP_m (vaeseq_u8, k)
#define AES_E_MC_m(k) AES_E_m (k) MM_OP1_m(vaesmcq_u8)
AES_FUNC_START2 (AesCbc_Encode_HW)
{
v128 *p = (v128*)(void*)ivAes;
v128 *data = (v128*)(void*)data8;
v128 m = *p;
const v128 k0 = p[2];
const v128 k1 = p[3];
const v128 k2 = p[4];
const v128 k3 = p[5];
const v128 k4 = p[6];
const v128 k5 = p[7];
const v128 k6 = p[8];
const v128 k7 = p[9];
const v128 k8 = p[10];
const v128 k9 = p[11];
const UInt32 numRounds2 = *(const UInt32 *)(p + 1);
const v128 *w = p + ((size_t)numRounds2 * 2);
const v128 k_z1 = w[1];
const v128 k_z0 = w[2];
for (; numBlocks != 0; numBlocks--, data++)
{
MM_XOR_m (*data);
AES_E_MC_m (k0)
AES_E_MC_m (k1)
AES_E_MC_m (k2)
AES_E_MC_m (k3)
AES_E_MC_m (k4)
AES_E_MC_m (k5)
AES_E_MC_m (k6)
AES_E_MC_m (k7)
AES_E_MC_m (k8)
if (numRounds2 >= 6)
{
AES_E_MC_m (k9)
AES_E_MC_m (p[12])
if (numRounds2 != 6)
{
AES_E_MC_m (p[13])
AES_E_MC_m (p[14])
}
}
AES_E_m (k_z1)
MM_XOR_m (k_z0);
*data = m;
}
*p = m;
}
#define WOP_1(op)
#define WOP_2(op) WOP_1 (op) op (m1, 1)
#define WOP_3(op) WOP_2 (op) op (m2, 2)
#define WOP_4(op) WOP_3 (op) op (m3, 3)
#define WOP_5(op) WOP_4 (op) op (m4, 4)
#define WOP_6(op) WOP_5 (op) op (m5, 5)
#define WOP_7(op) WOP_6 (op) op (m6, 6)
#define WOP_8(op) WOP_7 (op) op (m7, 7)
#define NUM_WAYS 8
#define WOP_M1 WOP_8
#define WOP(op) op (m0, 0) WOP_M1(op)
#define DECLARE_VAR(reg, ii) v128 reg;
#define LOAD_data( reg, ii) reg = data[ii];
#define STORE_data( reg, ii) data[ii] = reg;
#if (NUM_WAYS > 1)
#define XOR_data_M1(reg, ii) MM_XOR (reg, data[ii- 1])
#endif
#define MM_OP_key(op, reg) MM_OP (op, reg, key)
#define AES_D_m(k) MM_OP_m (vaesdq_u8, k)
#define AES_D_IMC_m(k) AES_D_m (k) MM_OP1_m (vaesimcq_u8)
#define AES_XOR( reg, ii) MM_OP_key (veorq_u8, reg)
#define AES_D( reg, ii) MM_OP_key (vaesdq_u8, reg)
#define AES_E( reg, ii) MM_OP_key (vaeseq_u8, reg)
#define AES_D_IMC( reg, ii) AES_D (reg, ii) reg = vaesimcq_u8(reg);
#define AES_E_MC( reg, ii) AES_E (reg, ii) reg = vaesmcq_u8(reg);
#define CTR_START(reg, ii) MM_OP (vaddq_u64, ctr, one) reg = vreinterpretq_u8_u64(ctr);
#define CTR_END( reg, ii) MM_XOR (data[ii], reg)
#define WOP_KEY(op, n) { \
const v128 key = w[n]; \
WOP(op) }
#define WIDE_LOOP_START \
dataEnd = data + numBlocks; \
if (numBlocks >= NUM_WAYS) \
{ dataEnd -= NUM_WAYS; do { \
#define WIDE_LOOP_END \
data += NUM_WAYS; \
} while (data <= dataEnd); \
dataEnd += NUM_WAYS; } \
#define SINGLE_LOOP \
for (; data < dataEnd; data++)
AES_FUNC_START2 (AesCbc_Decode_HW)
{
v128 *p = (v128*)(void*)ivAes;
v128 *data = (v128*)(void*)data8;
v128 iv = *p;
const v128 *wStart = p + ((size_t)*(const UInt32 *)(p + 1)) * 2;
const v128 *dataEnd;
p += 2;
WIDE_LOOP_START
{
const v128 *w = wStart;
WOP (DECLARE_VAR)
WOP (LOAD_data)
WOP_KEY (AES_D_IMC, 2)
do
{
WOP_KEY (AES_D_IMC, 1)
WOP_KEY (AES_D_IMC, 0)
w -= 2;
}
while (w != p);
WOP_KEY (AES_D, 1)
WOP_KEY (AES_XOR, 0)
MM_XOR (m0, iv);
WOP_M1 (XOR_data_M1)
iv = data[NUM_WAYS - 1];
WOP (STORE_data)
}
WIDE_LOOP_END
SINGLE_LOOP
{
const v128 *w = wStart;
v128 m = *data;
AES_D_IMC_m (w[2])
do
{
AES_D_IMC_m (w[1]);
AES_D_IMC_m (w[0]);
w -= 2;
}
while (w != p);
AES_D_m (w[1]);
MM_XOR_m (w[0]);
MM_XOR_m (iv);
iv = *data;
*data = m;
}
p[-2] = iv;
}
AES_FUNC_START2 (AesCtr_Code_HW)
{
v128 *p = (v128*)(void*)ivAes;
v128 *data = (v128*)(void*)data8;
uint64x2_t ctr = vreinterpretq_u64_u8(*p);
const v128 *wEnd = p + ((size_t)*(const UInt32 *)(p + 1)) * 2;
const v128 *dataEnd;
uint64x2_t one = vdupq_n_u64(0);
one = vsetq_lane_u64(1, one, 0);
p += 2;
WIDE_LOOP_START
{
const v128 *w = p;
WOP (DECLARE_VAR)
WOP (CTR_START)
do
{
WOP_KEY (AES_E_MC, 0)
WOP_KEY (AES_E_MC, 1)
w += 2;
}
while (w != wEnd);
WOP_KEY (AES_E_MC, 0)
WOP_KEY (AES_E, 1)
WOP_KEY (AES_XOR, 2)
WOP (CTR_END)
}
WIDE_LOOP_END
SINGLE_LOOP
{
const v128 *w = p;
v128 m;
CTR_START (m, 0);
do
{
AES_E_MC_m (w[0]);
AES_E_MC_m (w[1]);
w += 2;
}
while (w != wEnd);
AES_E_MC_m (w[0])
AES_E_m (w[1])
MM_XOR_m (w[2])
CTR_END (m, 0)
}
p[-2] = vreinterpretq_u8_u64(ctr);
}
#endif // USE_HW_AES
#endif // MY_CPU_ARM_OR_ARM64
#undef NUM_WAYS
#undef WOP_M1
#undef WOP
#undef DECLARE_VAR
#undef LOAD_data
#undef STORE_data
#undef USE_INTEL_AES
#undef USE_HW_AES

View file

@ -1,535 +0,0 @@
/* Alloc.c -- Memory allocation functions
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#ifdef _WIN32
#include "7zWindows.h"
#endif
#include <stdlib.h>
#include "Alloc.h"
#ifdef _WIN32
#ifdef Z7_LARGE_PAGES
#if defined(__clang__) || defined(__GNUC__)
typedef void (*Z7_voidFunction)(void);
#define MY_CAST_FUNC (Z7_voidFunction)
#elif defined(_MSC_VER) && _MSC_VER > 1920
#define MY_CAST_FUNC (void *)
// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
#else
#define MY_CAST_FUNC
#endif
#endif // Z7_LARGE_PAGES
#endif // _WIN32
// #define SZ_ALLOC_DEBUG
/* #define SZ_ALLOC_DEBUG */
/* use SZ_ALLOC_DEBUG to debug alloc/free operations */
#ifdef SZ_ALLOC_DEBUG
#include <string.h>
#include <stdio.h>
static int g_allocCount = 0;
#ifdef _WIN32
static int g_allocCountMid = 0;
static int g_allocCountBig = 0;
#endif
#define CONVERT_INT_TO_STR(charType, tempSize) \
char temp[tempSize]; unsigned i = 0; \
while (val >= 10) { temp[i++] = (char)('0' + (unsigned)(val % 10)); val /= 10; } \
*s++ = (charType)('0' + (unsigned)val); \
while (i != 0) { i--; *s++ = temp[i]; } \
*s = 0;
static void ConvertUInt64ToString(UInt64 val, char *s)
{
CONVERT_INT_TO_STR(char, 24)
}
#define GET_HEX_CHAR(t) ((char)(((t < 10) ? ('0' + t) : ('A' + (t - 10)))))
static void ConvertUInt64ToHex(UInt64 val, char *s)
{
UInt64 v = val;
unsigned i;
for (i = 1;; i++)
{
v >>= 4;
if (v == 0)
break;
}
s[i] = 0;
do
{
unsigned t = (unsigned)(val & 0xF);
val >>= 4;
s[--i] = GET_HEX_CHAR(t);
}
while (i);
}
#define DEBUG_OUT_STREAM stderr
static void Print(const char *s)
{
fputs(s, DEBUG_OUT_STREAM);
}
static void PrintAligned(const char *s, size_t align)
{
size_t len = strlen(s);
for(;;)
{
fputc(' ', DEBUG_OUT_STREAM);
if (len >= align)
break;
++len;
}
Print(s);
}
static void PrintLn(void)
{
Print("\n");
}
static void PrintHex(UInt64 v, size_t align)
{
char s[32];
ConvertUInt64ToHex(v, s);
PrintAligned(s, align);
}
static void PrintDec(int v, size_t align)
{
char s[32];
ConvertUInt64ToString((unsigned)v, s);
PrintAligned(s, align);
}
static void PrintAddr(void *p)
{
PrintHex((UInt64)(size_t)(ptrdiff_t)p, 12);
}
#define PRINT_REALLOC(name, cnt, size, ptr) { \
Print(name " "); \
if (!ptr) PrintDec(cnt++, 10); \
PrintHex(size, 10); \
PrintAddr(ptr); \
PrintLn(); }
#define PRINT_ALLOC(name, cnt, size, ptr) { \
Print(name " "); \
PrintDec(cnt++, 10); \
PrintHex(size, 10); \
PrintAddr(ptr); \
PrintLn(); }
#define PRINT_FREE(name, cnt, ptr) if (ptr) { \
Print(name " "); \
PrintDec(--cnt, 10); \
PrintAddr(ptr); \
PrintLn(); }
#else
#ifdef _WIN32
#define PRINT_ALLOC(name, cnt, size, ptr)
#endif
#define PRINT_FREE(name, cnt, ptr)
#define Print(s)
#define PrintLn()
#define PrintHex(v, align)
#define PrintAddr(p)
#endif
/*
by specification:
malloc(non_NULL, 0) : returns NULL or a unique pointer value that can later be successfully passed to free()
realloc(NULL, size) : the call is equivalent to malloc(size)
realloc(non_NULL, 0) : the call is equivalent to free(ptr)
in main compilers:
malloc(0) : returns non_NULL
realloc(NULL, 0) : returns non_NULL
realloc(non_NULL, 0) : returns NULL
*/
void *MyAlloc(size_t size)
{
if (size == 0)
return NULL;
// PRINT_ALLOC("Alloc ", g_allocCount, size, NULL)
#ifdef SZ_ALLOC_DEBUG
{
void *p = malloc(size);
if (p)
{
PRINT_ALLOC("Alloc ", g_allocCount, size, p)
}
return p;
}
#else
return malloc(size);
#endif
}
void MyFree(void *address)
{
PRINT_FREE("Free ", g_allocCount, address)
free(address);
}
void *MyRealloc(void *address, size_t size)
{
if (size == 0)
{
MyFree(address);
return NULL;
}
// PRINT_REALLOC("Realloc ", g_allocCount, size, address)
#ifdef SZ_ALLOC_DEBUG
{
void *p = realloc(address, size);
if (p)
{
PRINT_REALLOC("Realloc ", g_allocCount, size, address)
}
return p;
}
#else
return realloc(address, size);
#endif
}
#ifdef _WIN32
void *MidAlloc(size_t size)
{
if (size == 0)
return NULL;
#ifdef SZ_ALLOC_DEBUG
{
void *p = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
if (p)
{
PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, p)
}
return p;
}
#else
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
#endif
}
void MidFree(void *address)
{
PRINT_FREE("Free-Mid", g_allocCountMid, address)
if (!address)
return;
VirtualFree(address, 0, MEM_RELEASE);
}
#ifdef Z7_LARGE_PAGES
#ifdef MEM_LARGE_PAGES
#define MY__MEM_LARGE_PAGES MEM_LARGE_PAGES
#else
#define MY__MEM_LARGE_PAGES 0x20000000
#endif
extern
SIZE_T g_LargePageSize;
SIZE_T g_LargePageSize = 0;
typedef SIZE_T (WINAPI *Func_GetLargePageMinimum)(VOID);
void SetLargePageSize(void)
{
#ifdef Z7_LARGE_PAGES
SIZE_T size;
const
Func_GetLargePageMinimum fn =
(Func_GetLargePageMinimum) MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
"GetLargePageMinimum");
if (!fn)
return;
size = fn();
if (size == 0 || (size & (size - 1)) != 0)
return;
g_LargePageSize = size;
#endif
}
#endif // Z7_LARGE_PAGES
void *BigAlloc(size_t size)
{
if (size == 0)
return NULL;
PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL)
#ifdef Z7_LARGE_PAGES
{
SIZE_T ps = g_LargePageSize;
if (ps != 0 && ps <= (1 << 30) && size > (ps / 2))
{
size_t size2;
ps--;
size2 = (size + ps) & ~ps;
if (size2 >= size)
{
void *p = VirtualAlloc(NULL, size2, MEM_COMMIT | MY__MEM_LARGE_PAGES, PAGE_READWRITE);
if (p)
{
PRINT_ALLOC("Alloc-BM ", g_allocCountMid, size2, p)
return p;
}
}
}
}
#endif
return MidAlloc(size);
}
void BigFree(void *address)
{
PRINT_FREE("Free-Big", g_allocCountBig, address)
MidFree(address);
}
#endif // _WIN32
static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MyAlloc(size); }
static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MyFree(address); }
const ISzAlloc g_Alloc = { SzAlloc, SzFree };
#ifdef _WIN32
static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MidAlloc(size); }
static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MidFree(address); }
static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return BigAlloc(size); }
static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) BigFree(address); }
const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
#endif
/*
uintptr_t : <stdint.h> C99 (optional)
: unsupported in VS6
*/
#ifdef _WIN32
typedef UINT_PTR UIntPtr;
#else
/*
typedef uintptr_t UIntPtr;
*/
typedef ptrdiff_t UIntPtr;
#endif
#define ADJUST_ALLOC_SIZE 0
/*
#define ADJUST_ALLOC_SIZE (sizeof(void *) - 1)
*/
/*
Use (ADJUST_ALLOC_SIZE = (sizeof(void *) - 1)), if
MyAlloc() can return address that is NOT multiple of sizeof(void *).
*/
/*
#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((char *)(p) - ((size_t)(UIntPtr)(p) & ((align) - 1))))
*/
#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((((UIntPtr)(p)) & ~((UIntPtr)(align) - 1))))
#if !defined(_WIN32) && defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)
#define USE_posix_memalign
#endif
#ifndef USE_posix_memalign
#define MY_ALIGN_PTR_UP_PLUS(p, align) MY_ALIGN_PTR_DOWN(((char *)(p) + (align) + ADJUST_ALLOC_SIZE), align)
#endif
/*
This posix_memalign() is for test purposes only.
We also need special Free() function instead of free(),
if this posix_memalign() is used.
*/
/*
static int posix_memalign(void **ptr, size_t align, size_t size)
{
size_t newSize = size + align;
void *p;
void *pAligned;
*ptr = NULL;
if (newSize < size)
return 12; // ENOMEM
p = MyAlloc(newSize);
if (!p)
return 12; // ENOMEM
pAligned = MY_ALIGN_PTR_UP_PLUS(p, align);
((void **)pAligned)[-1] = p;
*ptr = pAligned;
return 0;
}
*/
/*
ALLOC_ALIGN_SIZE >= sizeof(void *)
ALLOC_ALIGN_SIZE >= cache_line_size
*/
#define ALLOC_ALIGN_SIZE ((size_t)1 << 7)
static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
{
#ifndef USE_posix_memalign
void *p;
void *pAligned;
size_t newSize;
UNUSED_VAR(pp)
/* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
block to prevent cache line sharing with another allocated blocks */
newSize = size + ALLOC_ALIGN_SIZE * 1 + ADJUST_ALLOC_SIZE;
if (newSize < size)
return NULL;
p = MyAlloc(newSize);
if (!p)
return NULL;
pAligned = MY_ALIGN_PTR_UP_PLUS(p, ALLOC_ALIGN_SIZE);
Print(" size="); PrintHex(size, 8);
Print(" a_size="); PrintHex(newSize, 8);
Print(" ptr="); PrintAddr(p);
Print(" a_ptr="); PrintAddr(pAligned);
PrintLn();
((void **)pAligned)[-1] = p;
return pAligned;
#else
void *p;
UNUSED_VAR(pp)
if (posix_memalign(&p, ALLOC_ALIGN_SIZE, size))
return NULL;
Print(" posix_memalign="); PrintAddr(p);
PrintLn();
return p;
#endif
}
static void SzAlignedFree(ISzAllocPtr pp, void *address)
{
UNUSED_VAR(pp)
#ifndef USE_posix_memalign
if (address)
MyFree(((void **)address)[-1]);
#else
free(address);
#endif
}
const ISzAlloc g_AlignedAlloc = { SzAlignedAlloc, SzAlignedFree };
#define MY_ALIGN_PTR_DOWN_1(p) MY_ALIGN_PTR_DOWN(p, sizeof(void *))
/* we align ptr to support cases where CAlignOffsetAlloc::offset is not multiply of sizeof(void *) */
#define REAL_BLOCK_PTR_VAR(p) ((void **)MY_ALIGN_PTR_DOWN_1(p))[-1]
/*
#define REAL_BLOCK_PTR_VAR(p) ((void **)(p))[-1]
*/
static void *AlignOffsetAlloc_Alloc(ISzAllocPtr pp, size_t size)
{
const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
void *adr;
void *pAligned;
size_t newSize;
size_t extra;
size_t alignSize = (size_t)1 << p->numAlignBits;
if (alignSize < sizeof(void *))
alignSize = sizeof(void *);
if (p->offset >= alignSize)
return NULL;
/* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
block to prevent cache line sharing with another allocated blocks */
extra = p->offset & (sizeof(void *) - 1);
newSize = size + alignSize + extra + ADJUST_ALLOC_SIZE;
if (newSize < size)
return NULL;
adr = ISzAlloc_Alloc(p->baseAlloc, newSize);
if (!adr)
return NULL;
pAligned = (char *)MY_ALIGN_PTR_DOWN((char *)adr +
alignSize - p->offset + extra + ADJUST_ALLOC_SIZE, alignSize) + p->offset;
PrintLn();
Print("- Aligned: ");
Print(" size="); PrintHex(size, 8);
Print(" a_size="); PrintHex(newSize, 8);
Print(" ptr="); PrintAddr(adr);
Print(" a_ptr="); PrintAddr(pAligned);
PrintLn();
REAL_BLOCK_PTR_VAR(pAligned) = adr;
return pAligned;
}
static void AlignOffsetAlloc_Free(ISzAllocPtr pp, void *address)
{
if (address)
{
const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
PrintLn();
Print("- Aligned Free: ");
PrintLn();
ISzAlloc_Free(p->baseAlloc, REAL_BLOCK_PTR_VAR(address));
}
}
void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p)
{
p->vt.Alloc = AlignOffsetAlloc_Alloc;
p->vt.Free = AlignOffsetAlloc_Free;
}

View file

@ -1,71 +0,0 @@
/* Alloc.h -- Memory allocation functions
2023-03-04 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_ALLOC_H
#define ZIP7_INC_ALLOC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
/*
MyFree(NULL) : is allowed, as free(NULL)
MyAlloc(0) : returns NULL : but malloc(0) is allowed to return NULL or non_NULL
MyRealloc(NULL, 0) : returns NULL : but realloc(NULL, 0) is allowed to return NULL or non_NULL
MyRealloc() is similar to realloc() for the following cases:
MyRealloc(non_NULL, 0) : returns NULL and always calls MyFree(ptr)
MyRealloc(NULL, non_ZERO) : returns NULL, if allocation failed
MyRealloc(non_NULL, non_ZERO) : returns NULL, if reallocation failed
*/
void *MyAlloc(size_t size);
void MyFree(void *address);
void *MyRealloc(void *address, size_t size);
#ifdef _WIN32
#ifdef Z7_LARGE_PAGES
void SetLargePageSize(void);
#endif
void *MidAlloc(size_t size);
void MidFree(void *address);
void *BigAlloc(size_t size);
void BigFree(void *address);
#else
#define MidAlloc(size) MyAlloc(size)
#define MidFree(address) MyFree(address)
#define BigAlloc(size) MyAlloc(size)
#define BigFree(address) MyFree(address)
#endif
extern const ISzAlloc g_Alloc;
#ifdef _WIN32
extern const ISzAlloc g_BigAlloc;
extern const ISzAlloc g_MidAlloc;
#else
#define g_BigAlloc g_AlignedAlloc
#define g_MidAlloc g_AlignedAlloc
#endif
extern const ISzAlloc g_AlignedAlloc;
typedef struct
{
ISzAlloc vt;
ISzAllocPtr baseAlloc;
unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
} CAlignOffsetAlloc;
void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
EXTERN_C_END
#endif

290
3rdparty/7z/src/Bcj2.c vendored
View file

@ -1,290 +0,0 @@
/* Bcj2.c -- BCJ2 Decoder (Converter for x86 code)
2023-03-01 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Bcj2.h"
#include "CpuArch.h"
#define kTopValue ((UInt32)1 << 24)
#define kNumBitModelTotalBits 11
#define kBitModelTotal (1 << kNumBitModelTotalBits)
#define kNumMoveBits 5
// UInt32 bcj2_stats[256 + 2][2];
void Bcj2Dec_Init(CBcj2Dec *p)
{
unsigned i;
p->state = BCJ2_STREAM_RC; // BCJ2_DEC_STATE_OK;
p->ip = 0;
p->temp = 0;
p->range = 0;
p->code = 0;
for (i = 0; i < sizeof(p->probs) / sizeof(p->probs[0]); i++)
p->probs[i] = kBitModelTotal >> 1;
}
SRes Bcj2Dec_Decode(CBcj2Dec *p)
{
UInt32 v = p->temp;
// const Byte *src;
if (p->range <= 5)
{
UInt32 code = p->code;
p->state = BCJ2_DEC_STATE_ERROR; /* for case if we return SZ_ERROR_DATA; */
for (; p->range != 5; p->range++)
{
if (p->range == 1 && code != 0)
return SZ_ERROR_DATA;
if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC])
{
p->state = BCJ2_STREAM_RC;
return SZ_OK;
}
code = (code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
p->code = code;
}
if (code == 0xffffffff)
return SZ_ERROR_DATA;
p->range = 0xffffffff;
}
// else
{
unsigned state = p->state;
// we check BCJ2_IS_32BIT_STREAM() here instead of check in the main loop
if (BCJ2_IS_32BIT_STREAM(state))
{
const Byte *cur = p->bufs[state];
if (cur == p->lims[state])
return SZ_OK;
p->bufs[state] = cur + 4;
{
const UInt32 ip = p->ip + 4;
v = GetBe32a(cur) - ip;
p->ip = ip;
}
state = BCJ2_DEC_STATE_ORIG_0;
}
if ((unsigned)(state - BCJ2_DEC_STATE_ORIG_0) < 4)
{
Byte *dest = p->dest;
for (;;)
{
if (dest == p->destLim)
{
p->state = state;
p->temp = v;
return SZ_OK;
}
*dest++ = (Byte)v;
p->dest = dest;
if (++state == BCJ2_DEC_STATE_ORIG_3 + 1)
break;
v >>= 8;
}
}
}
// src = p->bufs[BCJ2_STREAM_MAIN];
for (;;)
{
/*
if (BCJ2_IS_32BIT_STREAM(p->state))
p->state = BCJ2_DEC_STATE_OK;
else
*/
{
if (p->range < kTopValue)
{
if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC])
{
p->state = BCJ2_STREAM_RC;
p->temp = v;
return SZ_OK;
}
p->range <<= 8;
p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
}
{
const Byte *src = p->bufs[BCJ2_STREAM_MAIN];
const Byte *srcLim;
Byte *dest = p->dest;
{
const SizeT rem = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - src);
SizeT num = (SizeT)(p->destLim - dest);
if (num >= rem)
num = rem;
#define NUM_ITERS 4
#if (NUM_ITERS & (NUM_ITERS - 1)) == 0
num &= ~((SizeT)NUM_ITERS - 1); // if (NUM_ITERS == (1 << x))
#else
num -= num % NUM_ITERS; // if (NUM_ITERS != (1 << x))
#endif
srcLim = src + num;
}
#define NUM_SHIFT_BITS 24
#define ONE_ITER(indx) { \
const unsigned b = src[indx]; \
*dest++ = (Byte)b; \
v = (v << NUM_SHIFT_BITS) | b; \
if (((b + (0x100 - 0xe8)) & 0xfe) == 0) break; \
if (((v - (((UInt32)0x0f << (NUM_SHIFT_BITS)) + 0x80)) & \
((((UInt32)1 << (4 + NUM_SHIFT_BITS)) - 0x1) << 4)) == 0) break; \
/* ++dest */; /* v = b; */ }
if (src != srcLim)
for (;;)
{
/* The dependency chain of 2-cycle for (v) calculation is not big problem here.
But we can remove dependency chain with v = b in the end of loop. */
ONE_ITER(0)
#if (NUM_ITERS > 1)
ONE_ITER(1)
#if (NUM_ITERS > 2)
ONE_ITER(2)
#if (NUM_ITERS > 3)
ONE_ITER(3)
#if (NUM_ITERS > 4)
ONE_ITER(4)
#if (NUM_ITERS > 5)
ONE_ITER(5)
#if (NUM_ITERS > 6)
ONE_ITER(6)
#if (NUM_ITERS > 7)
ONE_ITER(7)
#endif
#endif
#endif
#endif
#endif
#endif
#endif
src += NUM_ITERS;
if (src == srcLim)
break;
}
if (src == srcLim)
#if (NUM_ITERS > 1)
for (;;)
#endif
{
#if (NUM_ITERS > 1)
if (src == p->lims[BCJ2_STREAM_MAIN] || dest == p->destLim)
#endif
{
const SizeT num = (SizeT)(src - p->bufs[BCJ2_STREAM_MAIN]);
p->bufs[BCJ2_STREAM_MAIN] = src;
p->dest = dest;
p->ip += (UInt32)num;
/* state BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
p->state =
src == p->lims[BCJ2_STREAM_MAIN] ?
(unsigned)BCJ2_STREAM_MAIN :
(unsigned)BCJ2_DEC_STATE_ORIG;
p->temp = v;
return SZ_OK;
}
#if (NUM_ITERS > 1)
ONE_ITER(0)
src++;
#endif
}
{
const SizeT num = (SizeT)(dest - p->dest);
p->dest = dest; // p->dest += num;
p->bufs[BCJ2_STREAM_MAIN] += num; // = src;
p->ip += (UInt32)num;
}
{
UInt32 bound, ttt;
CBcj2Prob *prob; // unsigned index;
/*
prob = p->probs + (unsigned)((Byte)v == 0xe8 ?
2 + (Byte)(v >> 8) :
((v >> 5) & 1)); // ((Byte)v < 0xe8 ? 0 : 1));
*/
{
const unsigned c = ((v + 0x17) >> 6) & 1;
prob = p->probs + (unsigned)
(((0 - c) & (Byte)(v >> NUM_SHIFT_BITS)) + c + ((v >> 5) & 1));
// (Byte)
// 8x->0 : e9->1 : xxe8->xx+2
// 8x->0x100 : e9->0x101 : xxe8->xx
// (((0x100 - (e & ~v)) & (0x100 | (v >> 8))) + (e & v));
// (((0x101 + (~e | v)) & (0x100 | (v >> 8))) + (e & v));
}
ttt = *prob;
bound = (p->range >> kNumBitModelTotalBits) * ttt;
if (p->code < bound)
{
// bcj2_stats[prob - p->probs][0]++;
p->range = bound;
*prob = (CBcj2Prob)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
continue;
}
{
// bcj2_stats[prob - p->probs][1]++;
p->range -= bound;
p->code -= bound;
*prob = (CBcj2Prob)(ttt - (ttt >> kNumMoveBits));
}
}
}
}
{
/* (v == 0xe8 ? 0 : 1) uses setcc instruction with additional zero register usage in x64 MSVC. */
// const unsigned cj = ((Byte)v == 0xe8) ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP;
const unsigned cj = (((v + 0x57) >> 6) & 1) + BCJ2_STREAM_CALL;
const Byte *cur = p->bufs[cj];
Byte *dest;
SizeT rem;
if (cur == p->lims[cj])
{
p->state = cj;
break;
}
v = GetBe32a(cur);
p->bufs[cj] = cur + 4;
{
const UInt32 ip = p->ip + 4;
v -= ip;
p->ip = ip;
}
dest = p->dest;
rem = (SizeT)(p->destLim - dest);
if (rem < 4)
{
if ((unsigned)rem > 0) { dest[0] = (Byte)v; v >>= 8;
if ((unsigned)rem > 1) { dest[1] = (Byte)v; v >>= 8;
if ((unsigned)rem > 2) { dest[2] = (Byte)v; v >>= 8; }}}
p->temp = v;
p->dest = dest + rem;
p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem;
break;
}
SetUi32(dest, v)
v >>= 24;
p->dest = dest + 4;
}
}
if (p->range < kTopValue && p->bufs[BCJ2_STREAM_RC] != p->lims[BCJ2_STREAM_RC])
{
p->range <<= 8;
p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
}
return SZ_OK;
}
#undef NUM_ITERS
#undef ONE_ITER
#undef NUM_SHIFT_BITS
#undef kTopValue
#undef kNumBitModelTotalBits
#undef kBitModelTotal
#undef kNumMoveBits

332
3rdparty/7z/src/Bcj2.h vendored
View file

@ -1,332 +0,0 @@
/* Bcj2.h -- BCJ2 converter for x86 code (Branch CALL/JUMP variant2)
2023-03-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_BCJ2_H
#define ZIP7_INC_BCJ2_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define BCJ2_NUM_STREAMS 4
enum
{
BCJ2_STREAM_MAIN,
BCJ2_STREAM_CALL,
BCJ2_STREAM_JUMP,
BCJ2_STREAM_RC
};
enum
{
BCJ2_DEC_STATE_ORIG_0 = BCJ2_NUM_STREAMS,
BCJ2_DEC_STATE_ORIG_1,
BCJ2_DEC_STATE_ORIG_2,
BCJ2_DEC_STATE_ORIG_3,
BCJ2_DEC_STATE_ORIG,
BCJ2_DEC_STATE_ERROR /* after detected data error */
};
enum
{
BCJ2_ENC_STATE_ORIG = BCJ2_NUM_STREAMS,
BCJ2_ENC_STATE_FINISHED /* it's state after fully encoded stream */
};
/* #define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP) */
#define BCJ2_IS_32BIT_STREAM(s) ((unsigned)((unsigned)(s) - (unsigned)BCJ2_STREAM_CALL) < 2)
/*
CBcj2Dec / CBcj2Enc
bufs sizes:
BUF_SIZE(n) = lims[n] - bufs[n]
bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be multiply of 4:
(BUF_SIZE(BCJ2_STREAM_CALL) & 3) == 0
(BUF_SIZE(BCJ2_STREAM_JUMP) & 3) == 0
*/
// typedef UInt32 CBcj2Prob;
typedef UInt16 CBcj2Prob;
/*
BCJ2 encoder / decoder internal requirements:
- If last bytes of stream contain marker (e8/e8/0f8x), then
there is also encoded symbol (0 : no conversion) in RC stream.
- One case of overlapped instructions is supported,
if last byte of converted instruction is (0f) and next byte is (8x):
marker [xx xx xx 0f] 8x
then the pair (0f 8x) is treated as marker.
*/
/* ---------- BCJ2 Decoder ---------- */
/*
CBcj2Dec:
(dest) is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions:
bufs[BCJ2_STREAM_MAIN] >= dest &&
bufs[BCJ2_STREAM_MAIN] - dest >=
BUF_SIZE(BCJ2_STREAM_CALL) +
BUF_SIZE(BCJ2_STREAM_JUMP)
reserve = bufs[BCJ2_STREAM_MAIN] - dest -
( BUF_SIZE(BCJ2_STREAM_CALL) +
BUF_SIZE(BCJ2_STREAM_JUMP) )
and additional conditions:
if (it's first call of Bcj2Dec_Decode() after Bcj2Dec_Init())
{
(reserve != 1) : if (ver < v23.00)
}
else // if there are more than one calls of Bcj2Dec_Decode() after Bcj2Dec_Init())
{
(reserve >= 6) : if (ver < v23.00)
(reserve >= 4) : if (ver >= v23.00)
We need that (reserve) because after first call of Bcj2Dec_Decode(),
CBcj2Dec::temp can contain up to 4 bytes for writing to (dest).
}
(reserve == 0) is allowed, if we decode full stream via single call of Bcj2Dec_Decode().
(reserve == 0) also is allowed in case of multi-call, if we use fixed buffers,
and (reserve) is calculated from full (final) sizes of all streams before first call.
*/
typedef struct
{
const Byte *bufs[BCJ2_NUM_STREAMS];
const Byte *lims[BCJ2_NUM_STREAMS];
Byte *dest;
const Byte *destLim;
unsigned state; /* BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
UInt32 ip; /* property of starting base for decoding */
UInt32 temp; /* Byte temp[4]; */
UInt32 range;
UInt32 code;
CBcj2Prob probs[2 + 256];
} CBcj2Dec;
/* Note:
Bcj2Dec_Init() sets (CBcj2Dec::ip = 0)
if (ip != 0) property is required, the caller must set CBcj2Dec::ip after Bcj2Dec_Init()
*/
void Bcj2Dec_Init(CBcj2Dec *p);
/* Bcj2Dec_Decode():
returns:
SZ_OK
SZ_ERROR_DATA : if data in 5 starting bytes of BCJ2_STREAM_RC stream are not correct
*/
SRes Bcj2Dec_Decode(CBcj2Dec *p);
/* To check that decoding was finished you can compare
sizes of processed streams with sizes known from another sources.
You must do at least one mandatory check from the two following options:
- the check for size of processed output (ORIG) stream.
- the check for size of processed input (MAIN) stream.
additional optional checks:
- the checks for processed sizes of all input streams (MAIN, CALL, JUMP, RC)
- the checks Bcj2Dec_IsMaybeFinished*()
also before actual decoding you can check that the
following condition is met for stream sizes:
( size(ORIG) == size(MAIN) + size(CALL) + size(JUMP) )
*/
/* (state == BCJ2_STREAM_MAIN) means that decoder is ready for
additional input data in BCJ2_STREAM_MAIN stream.
Note that (state == BCJ2_STREAM_MAIN) is allowed for non-finished decoding.
*/
#define Bcj2Dec_IsMaybeFinished_state_MAIN(_p_) ((_p_)->state == BCJ2_STREAM_MAIN)
/* if the stream decoding was finished correctly, then range decoder
part of CBcj2Dec also was finished, and then (CBcj2Dec::code == 0).
Note that (CBcj2Dec::code == 0) is allowed for non-finished decoding.
*/
#define Bcj2Dec_IsMaybeFinished_code(_p_) ((_p_)->code == 0)
/* use Bcj2Dec_IsMaybeFinished() only as additional check
after at least one mandatory check from the two following options:
- the check for size of processed output (ORIG) stream.
- the check for size of processed input (MAIN) stream.
*/
#define Bcj2Dec_IsMaybeFinished(_p_) ( \
Bcj2Dec_IsMaybeFinished_state_MAIN(_p_) && \
Bcj2Dec_IsMaybeFinished_code(_p_))
/* ---------- BCJ2 Encoder ---------- */
typedef enum
{
BCJ2_ENC_FINISH_MODE_CONTINUE,
BCJ2_ENC_FINISH_MODE_END_BLOCK,
BCJ2_ENC_FINISH_MODE_END_STREAM
} EBcj2Enc_FinishMode;
/*
BCJ2_ENC_FINISH_MODE_CONTINUE:
process non finished encoding.
It notifies the encoder that additional further calls
can provide more input data (src) than provided by current call.
In that case the CBcj2Enc encoder still can move (src) pointer
up to (srcLim), but CBcj2Enc encoder can store some of the last
processed bytes (up to 4 bytes) from src to internal CBcj2Enc::temp[] buffer.
at return:
(CBcj2Enc::src will point to position that includes
processed data and data copied to (temp[]) buffer)
That data from (temp[]) buffer will be used in further calls.
BCJ2_ENC_FINISH_MODE_END_BLOCK:
finish encoding of current block (ended at srcLim) without RC flushing.
at return: if (CBcj2Enc::state == BCJ2_ENC_STATE_ORIG) &&
CBcj2Enc::src == CBcj2Enc::srcLim)
: it shows that block encoding was finished. And the encoder is
ready for new (src) data or for stream finish operation.
finished block means
{
CBcj2Enc has completed block encoding up to (srcLim).
(1 + 4 bytes) or (2 + 4 bytes) CALL/JUMP cortages will
not cross block boundary at (srcLim).
temporary CBcj2Enc buffer for (ORIG) src data is empty.
3 output uncompressed streams (MAIN, CALL, JUMP) were flushed.
RC stream was not flushed. And RC stream will cross block boundary.
}
Note: some possible implementation of BCJ2 encoder could
write branch marker (e8/e8/0f8x) in one call of Bcj2Enc_Encode(),
and it could calculate symbol for RC in another call of Bcj2Enc_Encode().
BCJ2 encoder uses ip/fileIp/fileSize/relatLimit values to calculate RC symbol.
And these CBcj2Enc variables can have different values in different Bcj2Enc_Encode() calls.
So caller must finish each block with BCJ2_ENC_FINISH_MODE_END_BLOCK
to ensure that RC symbol is calculated and written in proper block.
BCJ2_ENC_FINISH_MODE_END_STREAM
finish encoding of stream (ended at srcLim) fully including RC flushing.
at return: if (CBcj2Enc::state == BCJ2_ENC_STATE_FINISHED)
: it shows that stream encoding was finished fully,
and all output streams were flushed fully.
also Bcj2Enc_IsFinished() can be called.
*/
/*
32-bit relative offset in JUMP/CALL commands is
- (mod 4 GiB) for 32-bit x86 code
- signed Int32 for 64-bit x86-64 code
BCJ2 encoder also does internal relative to absolute address conversions.
And there are 2 possible ways to do it:
before v23: we used 32-bit variables and (mod 4 GiB) conversion
since v23: we use 64-bit variables and (signed Int32 offset) conversion.
The absolute address condition for conversion in v23:
((UInt64)((Int64)ip64 - (Int64)fileIp64 + 5 + (Int32)offset) < (UInt64)fileSize64)
note that if (fileSize64 > 2 GiB). there is difference between
old (mod 4 GiB) way (v22) and new (signed Int32 offset) way (v23).
And new (v23) way is more suitable to encode 64-bit x86-64 code for (fileSize64 > 2 GiB) cases.
*/
/*
// for old (v22) way for conversion:
typedef UInt32 CBcj2Enc_ip_unsigned;
typedef Int32 CBcj2Enc_ip_signed;
#define BCJ2_ENC_FileSize_MAX ((UInt32)1 << 31)
*/
typedef UInt64 CBcj2Enc_ip_unsigned;
typedef Int64 CBcj2Enc_ip_signed;
/* maximum size of file that can be used for conversion condition */
#define BCJ2_ENC_FileSize_MAX ((CBcj2Enc_ip_unsigned)0 - 2)
/* default value of fileSize64_minus1 variable that means
that absolute address limitation will not be used */
#define BCJ2_ENC_FileSizeField_UNLIMITED ((CBcj2Enc_ip_unsigned)0 - 1)
/* calculate value that later can be set to CBcj2Enc::fileSize64_minus1 */
#define BCJ2_ENC_GET_FileSizeField_VAL_FROM_FileSize(fileSize) \
((CBcj2Enc_ip_unsigned)(fileSize) - 1)
/* set CBcj2Enc::fileSize64_minus1 variable from size of file */
#define Bcj2Enc_SET_FileSize(p, fileSize) \
(p)->fileSize64_minus1 = BCJ2_ENC_GET_FileSizeField_VAL_FROM_FileSize(fileSize);
typedef struct
{
Byte *bufs[BCJ2_NUM_STREAMS];
const Byte *lims[BCJ2_NUM_STREAMS];
const Byte *src;
const Byte *srcLim;
unsigned state;
EBcj2Enc_FinishMode finishMode;
Byte context;
Byte flushRem;
Byte isFlushState;
Byte cache;
UInt32 range;
UInt64 low;
UInt64 cacheSize;
// UInt32 context; // for marker version, it can include marker flag.
/* (ip64) and (fileIp64) correspond to virtual source stream position
that doesn't include data in temp[] */
CBcj2Enc_ip_unsigned ip64; /* current (ip) position */
CBcj2Enc_ip_unsigned fileIp64; /* start (ip) position of current file */
CBcj2Enc_ip_unsigned fileSize64_minus1; /* size of current file (for conversion limitation) */
UInt32 relatLimit; /* (relatLimit <= ((UInt32)1 << 31)) : 0 means disable_conversion */
// UInt32 relatExcludeBits;
UInt32 tempTarget;
unsigned tempPos; /* the number of bytes that were copied to temp[] buffer
(tempPos <= 4) outside of Bcj2Enc_Encode() */
// Byte temp[4]; // for marker version
Byte temp[8];
CBcj2Prob probs[2 + 256];
} CBcj2Enc;
void Bcj2Enc_Init(CBcj2Enc *p);
/*
Bcj2Enc_Encode(): at exit:
p->State < BCJ2_NUM_STREAMS : we need more buffer space for output stream
(bufs[p->State] == lims[p->State])
p->State == BCJ2_ENC_STATE_ORIG : we need more data in input src stream
(src == srcLim)
p->State == BCJ2_ENC_STATE_FINISHED : after fully encoded stream
*/
void Bcj2Enc_Encode(CBcj2Enc *p);
/* Bcj2Enc encoder can look ahead for up 4 bytes of source stream.
CBcj2Enc::tempPos : is the number of bytes that were copied from input stream to temp[] buffer.
(CBcj2Enc::src) after Bcj2Enc_Encode() is starting position after
fully processed data and after data copied to temp buffer.
So if the caller needs to get real number of fully processed input
bytes (without look ahead data in temp buffer),
the caller must subtruct (CBcj2Enc::tempPos) value from processed size
value that is calculated based on current (CBcj2Enc::src):
cur_processed_pos = Calc_Big_Processed_Pos(enc.src)) -
Bcj2Enc_Get_AvailInputSize_in_Temp(&enc);
*/
/* get the size of input data that was stored in temp[] buffer: */
#define Bcj2Enc_Get_AvailInputSize_in_Temp(p) ((p)->tempPos)
#define Bcj2Enc_IsFinished(p) ((p)->flushRem == 0)
/* Note : the decoder supports overlapping of marker (0f 80).
But we can eliminate such overlapping cases by setting
the limit for relative offset conversion as
CBcj2Enc::relatLimit <= (0x0f << 24) == (240 MiB)
*/
/* default value for CBcj2Enc::relatLimit */
#define BCJ2_ENC_RELAT_LIMIT_DEFAULT ((UInt32)0x0f << 24)
#define BCJ2_ENC_RELAT_LIMIT_MAX ((UInt32)1 << 31)
// #define BCJ2_RELAT_EXCLUDE_NUM_BITS 5
EXTERN_C_END
#endif

View file

@ -1,506 +0,0 @@
/* Bcj2Enc.c -- BCJ2 Encoder converter for x86 code (Branch CALL/JUMP variant2)
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
/* #define SHOW_STAT */
#ifdef SHOW_STAT
#include <stdio.h>
#define PRF2(s) printf("%s ip=%8x tempPos=%d src= %8x\n", s, (unsigned)p->ip64, p->tempPos, (unsigned)(p->srcLim - p->src));
#else
#define PRF2(s)
#endif
#include "Bcj2.h"
#include "CpuArch.h"
#define kTopValue ((UInt32)1 << 24)
#define kNumBitModelTotalBits 11
#define kBitModelTotal (1 << kNumBitModelTotalBits)
#define kNumMoveBits 5
void Bcj2Enc_Init(CBcj2Enc *p)
{
unsigned i;
p->state = BCJ2_ENC_STATE_ORIG;
p->finishMode = BCJ2_ENC_FINISH_MODE_CONTINUE;
p->context = 0;
p->flushRem = 5;
p->isFlushState = 0;
p->cache = 0;
p->range = 0xffffffff;
p->low = 0;
p->cacheSize = 1;
p->ip64 = 0;
p->fileIp64 = 0;
p->fileSize64_minus1 = BCJ2_ENC_FileSizeField_UNLIMITED;
p->relatLimit = BCJ2_ENC_RELAT_LIMIT_DEFAULT;
// p->relatExcludeBits = 0;
p->tempPos = 0;
for (i = 0; i < sizeof(p->probs) / sizeof(p->probs[0]); i++)
p->probs[i] = kBitModelTotal >> 1;
}
// Z7_NO_INLINE
Z7_FORCE_INLINE
static BoolInt Bcj2_RangeEnc_ShiftLow(CBcj2Enc *p)
{
const UInt32 low = (UInt32)p->low;
const unsigned high = (unsigned)
#if defined(Z7_MSC_VER_ORIGINAL) \
&& defined(MY_CPU_X86) \
&& defined(MY_CPU_LE) \
&& !defined(MY_CPU_64BIT)
// we try to rid of __aullshr() call in MSVS-x86
(((const UInt32 *)&p->low)[1]); // [1] : for little-endian only
#else
(p->low >> 32);
#endif
if (low < (UInt32)0xff000000 || high != 0)
{
Byte *buf = p->bufs[BCJ2_STREAM_RC];
do
{
if (buf == p->lims[BCJ2_STREAM_RC])
{
p->state = BCJ2_STREAM_RC;
p->bufs[BCJ2_STREAM_RC] = buf;
return True;
}
*buf++ = (Byte)(p->cache + high);
p->cache = 0xff;
}
while (--p->cacheSize);
p->bufs[BCJ2_STREAM_RC] = buf;
p->cache = (Byte)(low >> 24);
}
p->cacheSize++;
p->low = low << 8;
return False;
}
/*
We can use 2 alternative versions of code:
1) non-marker version:
Byte CBcj2Enc::context
Byte temp[8];
Last byte of marker (e8/e9/[0f]8x) can be written to temp[] buffer.
Encoder writes last byte of marker (e8/e9/[0f]8x) to dest, only in conjunction
with writing branch symbol to range coder in same Bcj2Enc_Encode_2() call.
2) marker version:
UInt32 CBcj2Enc::context
Byte CBcj2Enc::temp[4];
MARKER_FLAG in CBcj2Enc::context shows that CBcj2Enc::context contains finded marker.
it's allowed that
one call of Bcj2Enc_Encode_2() writes last byte of marker (e8/e9/[0f]8x) to dest,
and another call of Bcj2Enc_Encode_2() does offset conversion.
So different values of (fileIp) and (fileSize) are possible
in these different Bcj2Enc_Encode_2() calls.
Also marker version requires additional if((v & MARKER_FLAG) == 0) check in main loop.
So we use non-marker version.
*/
/*
Corner cases with overlap in multi-block.
before v23: there was one corner case, where converted instruction
could start in one sub-stream and finish in next sub-stream.
If multi-block (solid) encoding is used,
and BCJ2_ENC_FINISH_MODE_END_BLOCK is used for each sub-stream.
and (0f) is last byte of previous sub-stream
and (8x) is first byte of current sub-stream
then (0f 8x) pair is treated as marker by BCJ2 encoder and decoder.
BCJ2 encoder can converts 32-bit offset for that (0f 8x) cortage,
if that offset meets limit requirements.
If encoder allows 32-bit offset conversion for such overlap case,
then the data in 3 uncompressed BCJ2 streams for some sub-stream
can depend from data of previous sub-stream.
That corner case is not big problem, and it's rare case.
Since v23.00 we do additional check to prevent conversions in such overlap cases.
*/
/*
Bcj2Enc_Encode_2() output variables at exit:
{
if (Bcj2Enc_Encode_2() exits with (p->state == BCJ2_ENC_STATE_ORIG))
{
it means that encoder needs more input data.
if (p->srcLim == p->src) at exit, then
{
(p->finishMode != BCJ2_ENC_FINISH_MODE_END_STREAM)
all input data were read and processed, and we are ready for
new input data.
}
else
{
(p->srcLim != p->src)
(p->finishMode == BCJ2_ENC_FINISH_MODE_CONTINUE)
The encoder have found e8/e9/0f_8x marker,
and p->src points to last byte of that marker,
Bcj2Enc_Encode_2() needs more input data to get totally
5 bytes (last byte of marker and 32-bit branch offset)
as continuous array starting from p->src.
(p->srcLim - p->src < 5) requirement is met after exit.
So non-processed resedue from p->src to p->srcLim is always less than 5 bytes.
}
}
}
*/
Z7_NO_INLINE
static void Bcj2Enc_Encode_2(CBcj2Enc *p)
{
if (!p->isFlushState)
{
const Byte *src;
UInt32 v;
{
const unsigned state = p->state;
if (BCJ2_IS_32BIT_STREAM(state))
{
Byte *cur = p->bufs[state];
if (cur == p->lims[state])
return;
SetBe32a(cur, p->tempTarget)
p->bufs[state] = cur + 4;
}
}
p->state = BCJ2_ENC_STATE_ORIG; // for main reason of exit
src = p->src;
v = p->context;
// #define WRITE_CONTEXT p->context = v; // for marker version
#define WRITE_CONTEXT p->context = (Byte)v;
#define WRITE_CONTEXT_AND_SRC p->src = src; WRITE_CONTEXT
for (;;)
{
// const Byte *src;
// UInt32 v;
CBcj2Enc_ip_unsigned ip;
if (p->range < kTopValue)
{
// to reduce register pressure and code size: we save and restore local variables.
WRITE_CONTEXT_AND_SRC
if (Bcj2_RangeEnc_ShiftLow(p))
return;
p->range <<= 8;
src = p->src;
v = p->context;
}
// src = p->src;
// #define MARKER_FLAG ((UInt32)1 << 17)
// if ((v & MARKER_FLAG) == 0) // for marker version
{
const Byte *srcLim;
Byte *dest = p->bufs[BCJ2_STREAM_MAIN];
{
const SizeT remSrc = (SizeT)(p->srcLim - src);
SizeT rem = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - dest);
if (rem >= remSrc)
rem = remSrc;
srcLim = src + rem;
}
/* p->context contains context of previous byte:
bits [0 : 7] : src[-1], if (src) was changed in this call
bits [8 : 31] : are undefined for non-marker version
*/
// v = p->context;
#define NUM_SHIFT_BITS 24
#define CONV_FLAG ((UInt32)1 << 16)
#define ONE_ITER { \
b = src[0]; \
*dest++ = (Byte)b; \
v = (v << NUM_SHIFT_BITS) | b; \
if (((b + (0x100 - 0xe8)) & 0xfe) == 0) break; \
if (((v - (((UInt32)0x0f << (NUM_SHIFT_BITS)) + 0x80)) & \
((((UInt32)1 << (4 + NUM_SHIFT_BITS)) - 0x1) << 4)) == 0) break; \
src++; if (src == srcLim) { break; } }
if (src != srcLim)
for (;;)
{
/* clang can generate ineffective code with setne instead of two jcc instructions.
we can use 2 iterations and external (unsigned b) to avoid that ineffective code genaration. */
unsigned b;
ONE_ITER
ONE_ITER
}
ip = p->ip64 + (CBcj2Enc_ip_unsigned)(SizeT)(dest - p->bufs[BCJ2_STREAM_MAIN]);
p->bufs[BCJ2_STREAM_MAIN] = dest;
p->ip64 = ip;
if (src == srcLim)
{
WRITE_CONTEXT_AND_SRC
if (src != p->srcLim)
{
p->state = BCJ2_STREAM_MAIN;
return;
}
/* (p->src == p->srcLim)
(p->state == BCJ2_ENC_STATE_ORIG) */
if (p->finishMode != BCJ2_ENC_FINISH_MODE_END_STREAM)
return;
/* (p->finishMode == BCJ2_ENC_FINISH_MODE_END_STREAM */
// (p->flushRem == 5);
p->isFlushState = 1;
break;
}
src++;
// p->src = src;
}
// ip = p->ip; // for marker version
/* marker was found */
/* (v) contains marker that was found:
bits [NUM_SHIFT_BITS : NUM_SHIFT_BITS + 7]
: value of src[-2] : xx/xx/0f
bits [0 : 7] : value of src[-1] : e8/e9/8x
*/
{
{
#if NUM_SHIFT_BITS != 24
v &= ~(UInt32)CONV_FLAG;
#endif
// UInt32 relat = 0;
if ((SizeT)(p->srcLim - src) >= 4)
{
/*
if (relat != 0 || (Byte)v != 0xe8)
BoolInt isBigOffset = True;
*/
const UInt32 relat = GetUi32(src);
/*
#define EXCLUDE_FLAG ((UInt32)1 << 4)
#define NEED_CONVERT(rel) ((((rel) + EXCLUDE_FLAG) & (0 - EXCLUDE_FLAG * 2)) != 0)
if (p->relatExcludeBits != 0)
{
const UInt32 flag = (UInt32)1 << (p->relatExcludeBits - 1);
isBigOffset = (((relat + flag) & (0 - flag * 2)) != 0);
}
// isBigOffset = False; // for debug
*/
ip -= p->fileIp64;
// Use the following if check, if (ip) is 64-bit:
if (ip > (((v + 0x20) >> 5) & 1)) // 23.00 : we eliminate milti-block overlap for (Of 80) and (e8/e9)
if ((CBcj2Enc_ip_unsigned)((CBcj2Enc_ip_signed)ip + 4 + (Int32)relat) <= p->fileSize64_minus1)
if (((UInt32)(relat + p->relatLimit) >> 1) < p->relatLimit)
v |= CONV_FLAG;
}
else if (p->finishMode == BCJ2_ENC_FINISH_MODE_CONTINUE)
{
// (p->srcLim - src < 4)
// /*
// for non-marker version
p->ip64--; // p->ip = ip - 1;
p->bufs[BCJ2_STREAM_MAIN]--;
src--;
v >>= NUM_SHIFT_BITS;
// (0 < p->srcLim - p->src <= 4)
// */
// v |= MARKER_FLAG; // for marker version
/* (p->state == BCJ2_ENC_STATE_ORIG) */
WRITE_CONTEXT_AND_SRC
return;
}
{
const unsigned c = ((v + 0x17) >> 6) & 1;
CBcj2Prob *prob = p->probs + (unsigned)
(((0 - c) & (Byte)(v >> NUM_SHIFT_BITS)) + c + ((v >> 5) & 1));
/*
((Byte)v == 0xe8 ? 2 + ((Byte)(v >> 8)) :
((Byte)v < 0xe8 ? 0 : 1)); // ((v >> 5) & 1));
*/
const unsigned ttt = *prob;
const UInt32 bound = (p->range >> kNumBitModelTotalBits) * ttt;
if ((v & CONV_FLAG) == 0)
{
// static int yyy = 0; yyy++; printf("\n!needConvert = %d\n", yyy);
// v = (Byte)v; // for marker version
p->range = bound;
*prob = (CBcj2Prob)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
// WRITE_CONTEXT_AND_SRC
continue;
}
p->low += bound;
p->range -= bound;
*prob = (CBcj2Prob)(ttt - (ttt >> kNumMoveBits));
}
// p->context = src[3];
{
// const unsigned cj = ((Byte)v == 0xe8 ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP);
const unsigned cj = (((v + 0x57) >> 6) & 1) + BCJ2_STREAM_CALL;
ip = p->ip64;
v = GetUi32(src); // relat
ip += 4;
p->ip64 = ip;
src += 4;
// p->src = src;
{
const UInt32 absol = (UInt32)ip + v;
Byte *cur = p->bufs[cj];
v >>= 24;
// WRITE_CONTEXT
if (cur == p->lims[cj])
{
p->state = cj;
p->tempTarget = absol;
WRITE_CONTEXT_AND_SRC
return;
}
SetBe32a(cur, absol)
p->bufs[cj] = cur + 4;
}
}
}
}
} // end of loop
}
for (; p->flushRem != 0; p->flushRem--)
if (Bcj2_RangeEnc_ShiftLow(p))
return;
p->state = BCJ2_ENC_STATE_FINISHED;
}
/*
BCJ2 encoder needs look ahead for up to 4 bytes in (src) buffer.
So base function Bcj2Enc_Encode_2()
in BCJ2_ENC_FINISH_MODE_CONTINUE mode can return with
(p->state == BCJ2_ENC_STATE_ORIG && p->src < p->srcLim)
Bcj2Enc_Encode() solves that look ahead problem by using p->temp[] buffer.
so if (p->state == BCJ2_ENC_STATE_ORIG) after Bcj2Enc_Encode(),
then (p->src == p->srcLim).
And the caller's code is simpler with Bcj2Enc_Encode().
*/
Z7_NO_INLINE
void Bcj2Enc_Encode(CBcj2Enc *p)
{
PRF2("\n----")
if (p->tempPos != 0)
{
/* extra: number of bytes that were copied from (src) to (temp) buffer in this call */
unsigned extra = 0;
/* We will touch only minimal required number of bytes in input (src) stream.
So we will add input bytes from (src) stream to temp[] with step of 1 byte.
We don't add new bytes to temp[] before Bcj2Enc_Encode_2() call
in first loop iteration because
- previous call of Bcj2Enc_Encode() could use another (finishMode),
- previous call could finish with (p->state != BCJ2_ENC_STATE_ORIG).
the case with full temp[] buffer (p->tempPos == 4) is possible here.
*/
for (;;)
{
// (0 < p->tempPos <= 5) // in non-marker version
/* p->src : the current src data position including extra bytes
that were copied to temp[] buffer in this call */
const Byte *src = p->src;
const Byte *srcLim = p->srcLim;
const EBcj2Enc_FinishMode finishMode = p->finishMode;
if (src != srcLim)
{
/* if there are some src data after the data copied to temp[],
then we use MODE_CONTINUE for temp data */
p->finishMode = BCJ2_ENC_FINISH_MODE_CONTINUE;
}
p->src = p->temp;
p->srcLim = p->temp + p->tempPos;
PRF2(" ")
Bcj2Enc_Encode_2(p);
{
const unsigned num = (unsigned)(p->src - p->temp);
const unsigned tempPos = p->tempPos - num;
unsigned i;
p->tempPos = tempPos;
for (i = 0; i < tempPos; i++)
p->temp[i] = p->temp[(SizeT)i + num];
// tempPos : number of bytes in temp buffer
p->src = src;
p->srcLim = srcLim;
p->finishMode = finishMode;
if (p->state != BCJ2_ENC_STATE_ORIG)
{
// (p->tempPos <= 4) // in non-marker version
/* if (the reason of exit from Bcj2Enc_Encode_2()
is not BCJ2_ENC_STATE_ORIG),
then we exit from Bcj2Enc_Encode() with same reason */
// optional code begin : we rollback (src) and tempPos, if it's possible:
if (extra >= tempPos)
extra = tempPos;
p->src = src - extra;
p->tempPos = tempPos - extra;
// optional code end : rollback of (src) and tempPos
return;
}
/* (p->tempPos <= 4)
(p->state == BCJ2_ENC_STATE_ORIG)
so encoder needs more data than in temp[] */
if (src == srcLim)
return; // src buffer has no more input data.
/* (src != srcLim)
so we can provide more input data from src for Bcj2Enc_Encode_2() */
if (extra >= tempPos)
{
/* (extra >= tempPos) means that temp buffer contains
only data from src buffer of this call.
So now we can encode without temp buffer */
p->src = src - tempPos; // rollback (src)
p->tempPos = 0;
break;
}
// we append one additional extra byte from (src) to temp[] buffer:
p->temp[tempPos] = *src;
p->tempPos = tempPos + 1;
// (0 < p->tempPos <= 5) // in non-marker version
p->src = src + 1;
extra++;
}
}
}
PRF2("++++")
// (p->tempPos == 0)
Bcj2Enc_Encode_2(p);
PRF2("====")
if (p->state == BCJ2_ENC_STATE_ORIG)
{
const Byte *src = p->src;
const Byte *srcLim = p->srcLim;
const unsigned rem = (unsigned)(srcLim - src);
/* (rem <= 4) here.
if (p->src != p->srcLim), then
- we copy non-processed bytes from (p->src) to temp[] buffer,
- we set p->src equal to p->srcLim.
*/
if (rem)
{
unsigned i = 0;
p->src = srcLim;
p->tempPos = rem;
// (0 < p->tempPos <= 4)
do
p->temp[i] = src[i];
while (++i != rem);
}
// (p->tempPos <= 4)
// (p->src == p->srcLim)
}
}
#undef PRF2
#undef CONV_FLAG
#undef MARKER_FLAG
#undef WRITE_CONTEXT
#undef WRITE_CONTEXT_AND_SRC
#undef ONE_ITER
#undef NUM_SHIFT_BITS
#undef kTopValue
#undef kNumBitModelTotalBits
#undef kBitModelTotal
#undef kNumMoveBits

View file

@ -1,48 +0,0 @@
/* Blake2.h -- BLAKE2 Hash
2023-03-04 : Igor Pavlov : Public domain
2015 : Samuel Neves : Public domain */
#ifndef ZIP7_INC_BLAKE2_H
#define ZIP7_INC_BLAKE2_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define BLAKE2S_BLOCK_SIZE 64
#define BLAKE2S_DIGEST_SIZE 32
#define BLAKE2SP_PARALLEL_DEGREE 8
typedef struct
{
UInt32 h[8];
UInt32 t[2];
UInt32 f[2];
Byte buf[BLAKE2S_BLOCK_SIZE];
UInt32 bufPos;
UInt32 lastNode_f1;
UInt32 dummy[2]; /* for sizeof(CBlake2s) alignment */
} CBlake2s;
/* You need to xor CBlake2s::h[i] with input parameter block after Blake2s_Init0() */
/*
void Blake2s_Init0(CBlake2s *p);
void Blake2s_Update(CBlake2s *p, const Byte *data, size_t size);
void Blake2s_Final(CBlake2s *p, Byte *digest);
*/
typedef struct
{
CBlake2s S[BLAKE2SP_PARALLEL_DEGREE];
unsigned bufPos;
} CBlake2sp;
void Blake2sp_Init(CBlake2sp *p);
void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size);
void Blake2sp_Final(CBlake2sp *p, Byte *digest);
EXTERN_C_END
#endif

View file

@ -1,250 +0,0 @@
/* Blake2s.c -- BLAKE2s and BLAKE2sp Hash
2023-03-04 : Igor Pavlov : Public domain
2015 : Samuel Neves : Public domain */
#include "Precomp.h"
#include <string.h>
#include "Blake2.h"
#include "CpuArch.h"
#include "RotateDefs.h"
#define rotr32 rotrFixed
#define BLAKE2S_NUM_ROUNDS 10
#define BLAKE2S_FINAL_FLAG (~(UInt32)0)
static const UInt32 k_Blake2s_IV[8] =
{
0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL
};
static const Byte k_Blake2s_Sigma[BLAKE2S_NUM_ROUNDS][16] =
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
};
static void Blake2s_Init0(CBlake2s *p)
{
unsigned i;
for (i = 0; i < 8; i++)
p->h[i] = k_Blake2s_IV[i];
p->t[0] = 0;
p->t[1] = 0;
p->f[0] = 0;
p->f[1] = 0;
p->bufPos = 0;
p->lastNode_f1 = 0;
}
static void Blake2s_Compress(CBlake2s *p)
{
UInt32 m[16];
UInt32 v[16];
{
unsigned i;
for (i = 0; i < 16; i++)
m[i] = GetUi32(p->buf + i * sizeof(m[i]));
for (i = 0; i < 8; i++)
v[i] = p->h[i];
}
v[ 8] = k_Blake2s_IV[0];
v[ 9] = k_Blake2s_IV[1];
v[10] = k_Blake2s_IV[2];
v[11] = k_Blake2s_IV[3];
v[12] = p->t[0] ^ k_Blake2s_IV[4];
v[13] = p->t[1] ^ k_Blake2s_IV[5];
v[14] = p->f[0] ^ k_Blake2s_IV[6];
v[15] = p->f[1] ^ k_Blake2s_IV[7];
#define G(r,i,a,b,c,d) \
a += b + m[sigma[2*i+0]]; d ^= a; d = rotr32(d, 16); c += d; b ^= c; b = rotr32(b, 12); \
a += b + m[sigma[2*i+1]]; d ^= a; d = rotr32(d, 8); c += d; b ^= c; b = rotr32(b, 7); \
#define R(r) \
G(r,0,v[ 0],v[ 4],v[ 8],v[12]) \
G(r,1,v[ 1],v[ 5],v[ 9],v[13]) \
G(r,2,v[ 2],v[ 6],v[10],v[14]) \
G(r,3,v[ 3],v[ 7],v[11],v[15]) \
G(r,4,v[ 0],v[ 5],v[10],v[15]) \
G(r,5,v[ 1],v[ 6],v[11],v[12]) \
G(r,6,v[ 2],v[ 7],v[ 8],v[13]) \
G(r,7,v[ 3],v[ 4],v[ 9],v[14]) \
{
unsigned r;
for (r = 0; r < BLAKE2S_NUM_ROUNDS; r++)
{
const Byte *sigma = k_Blake2s_Sigma[r];
R(r)
}
/* R(0); R(1); R(2); R(3); R(4); R(5); R(6); R(7); R(8); R(9); */
}
#undef G
#undef R
{
unsigned i;
for (i = 0; i < 8; i++)
p->h[i] ^= v[i] ^ v[i + 8];
}
}
#define Blake2s_Increment_Counter(S, inc) \
{ p->t[0] += (inc); p->t[1] += (p->t[0] < (inc)); }
#define Blake2s_Set_LastBlock(p) \
{ p->f[0] = BLAKE2S_FINAL_FLAG; p->f[1] = p->lastNode_f1; }
static void Blake2s_Update(CBlake2s *p, const Byte *data, size_t size)
{
while (size != 0)
{
unsigned pos = (unsigned)p->bufPos;
unsigned rem = BLAKE2S_BLOCK_SIZE - pos;
if (size <= rem)
{
memcpy(p->buf + pos, data, size);
p->bufPos += (UInt32)size;
return;
}
memcpy(p->buf + pos, data, rem);
Blake2s_Increment_Counter(S, BLAKE2S_BLOCK_SIZE)
Blake2s_Compress(p);
p->bufPos = 0;
data += rem;
size -= rem;
}
}
static void Blake2s_Final(CBlake2s *p, Byte *digest)
{
unsigned i;
Blake2s_Increment_Counter(S, (UInt32)p->bufPos)
Blake2s_Set_LastBlock(p)
memset(p->buf + p->bufPos, 0, BLAKE2S_BLOCK_SIZE - p->bufPos);
Blake2s_Compress(p);
for (i = 0; i < 8; i++)
{
SetUi32(digest + sizeof(p->h[i]) * i, p->h[i])
}
}
/* ---------- BLAKE2s ---------- */
/* we need to xor CBlake2s::h[i] with input parameter block after Blake2s_Init0() */
/*
typedef struct
{
Byte digest_length;
Byte key_length;
Byte fanout;
Byte depth;
UInt32 leaf_length;
Byte node_offset[6];
Byte node_depth;
Byte inner_length;
Byte salt[BLAKE2S_SALTBYTES];
Byte personal[BLAKE2S_PERSONALBYTES];
} CBlake2sParam;
*/
static void Blake2sp_Init_Spec(CBlake2s *p, unsigned node_offset, unsigned node_depth)
{
Blake2s_Init0(p);
p->h[0] ^= (BLAKE2S_DIGEST_SIZE | ((UInt32)BLAKE2SP_PARALLEL_DEGREE << 16) | ((UInt32)2 << 24));
p->h[2] ^= ((UInt32)node_offset);
p->h[3] ^= ((UInt32)node_depth << 16) | ((UInt32)BLAKE2S_DIGEST_SIZE << 24);
/*
P->digest_length = BLAKE2S_DIGEST_SIZE;
P->key_length = 0;
P->fanout = BLAKE2SP_PARALLEL_DEGREE;
P->depth = 2;
P->leaf_length = 0;
store48(P->node_offset, node_offset);
P->node_depth = node_depth;
P->inner_length = BLAKE2S_DIGEST_SIZE;
*/
}
void Blake2sp_Init(CBlake2sp *p)
{
unsigned i;
p->bufPos = 0;
for (i = 0; i < BLAKE2SP_PARALLEL_DEGREE; i++)
Blake2sp_Init_Spec(&p->S[i], i, 0);
p->S[BLAKE2SP_PARALLEL_DEGREE - 1].lastNode_f1 = BLAKE2S_FINAL_FLAG;
}
void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size)
{
unsigned pos = p->bufPos;
while (size != 0)
{
unsigned index = pos / BLAKE2S_BLOCK_SIZE;
unsigned rem = BLAKE2S_BLOCK_SIZE - (pos & (BLAKE2S_BLOCK_SIZE - 1));
if (rem > size)
rem = (unsigned)size;
Blake2s_Update(&p->S[index], data, rem);
size -= rem;
data += rem;
pos += rem;
pos &= (BLAKE2S_BLOCK_SIZE * BLAKE2SP_PARALLEL_DEGREE - 1);
}
p->bufPos = pos;
}
void Blake2sp_Final(CBlake2sp *p, Byte *digest)
{
CBlake2s R;
unsigned i;
Blake2sp_Init_Spec(&R, 0, 1);
R.lastNode_f1 = BLAKE2S_FINAL_FLAG;
for (i = 0; i < BLAKE2SP_PARALLEL_DEGREE; i++)
{
Byte hash[BLAKE2S_DIGEST_SIZE];
Blake2s_Final(&p->S[i], hash);
Blake2s_Update(&R, hash, BLAKE2S_DIGEST_SIZE);
}
Blake2s_Final(&R, digest);
}
#undef rotr32

420
3rdparty/7z/src/Bra.c vendored
View file

@ -1,420 +0,0 @@
/* Bra.c -- Branch converters for RISC code
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Bra.h"
#include "CpuArch.h"
#include "RotateDefs.h"
#if defined(MY_CPU_SIZEOF_POINTER) \
&& ( MY_CPU_SIZEOF_POINTER == 4 \
|| MY_CPU_SIZEOF_POINTER == 8)
#define BR_CONV_USE_OPT_PC_PTR
#endif
#ifdef BR_CONV_USE_OPT_PC_PTR
#define BR_PC_INIT pc -= (UInt32)(SizeT)p;
#define BR_PC_GET (pc + (UInt32)(SizeT)p)
#else
#define BR_PC_INIT pc += (UInt32)size;
#define BR_PC_GET (pc - (UInt32)(SizeT)(lim - p))
// #define BR_PC_INIT
// #define BR_PC_GET (pc + (UInt32)(SizeT)(p - data))
#endif
#define BR_CONVERT_VAL(v, c) if (encoding) v += c; else v -= c;
// #define BR_CONVERT_VAL(v, c) if (!encoding) c = (UInt32)0 - c; v += c;
#define Z7_BRANCH_CONV(name) z7_BranchConv_ ## name
#define Z7_BRANCH_FUNC_MAIN(name) \
static \
Z7_FORCE_INLINE \
Z7_ATTRIB_NO_VECTOR \
Byte *Z7_BRANCH_CONV(name)(Byte *p, SizeT size, UInt32 pc, int encoding)
#define Z7_BRANCH_FUNC_IMP(name, m, encoding) \
Z7_NO_INLINE \
Z7_ATTRIB_NO_VECTOR \
Byte *m(name)(Byte *data, SizeT size, UInt32 pc) \
{ return Z7_BRANCH_CONV(name)(data, size, pc, encoding); } \
#ifdef Z7_EXTRACT_ONLY
#define Z7_BRANCH_FUNCS_IMP(name) \
Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_DEC, 0)
#else
#define Z7_BRANCH_FUNCS_IMP(name) \
Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_DEC, 0) \
Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_ENC, 1)
#endif
#if defined(__clang__)
#define BR_EXTERNAL_FOR
#define BR_NEXT_ITERATION continue;
#else
#define BR_EXTERNAL_FOR for (;;)
#define BR_NEXT_ITERATION break;
#endif
#if defined(__clang__) && (__clang_major__ >= 8) \
|| defined(__GNUC__) && (__GNUC__ >= 1000) \
// GCC is not good for __builtin_expect() here
/* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
// #define Z7_unlikely [[unlikely]]
// #define Z7_LIKELY(x) (__builtin_expect((x), 1))
#define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
// #define Z7_likely [[likely]]
#else
// #define Z7_LIKELY(x) (x)
#define Z7_UNLIKELY(x) (x)
// #define Z7_likely
#endif
Z7_BRANCH_FUNC_MAIN(ARM64)
{
// Byte *p = data;
const Byte *lim;
const UInt32 flag = (UInt32)1 << (24 - 4);
const UInt32 mask = ((UInt32)1 << 24) - (flag << 1);
size &= ~(SizeT)3;
// if (size == 0) return p;
lim = p + size;
BR_PC_INIT
pc -= 4; // because (p) will point to next instruction
BR_EXTERNAL_FOR
{
// Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
for (;;)
{
UInt32 v;
if Z7_UNLIKELY(p == lim)
return p;
v = GetUi32a(p);
p += 4;
if Z7_UNLIKELY(((v - 0x94000000) & 0xfc000000) == 0)
{
UInt32 c = BR_PC_GET >> 2;
BR_CONVERT_VAL(v, c)
v &= 0x03ffffff;
v |= 0x94000000;
SetUi32a(p - 4, v)
BR_NEXT_ITERATION
}
// v = rotlFixed(v, 8); v += (flag << 8) - 0x90; if Z7_UNLIKELY((v & ((mask << 8) + 0x9f)) == 0)
v -= 0x90000000; if Z7_UNLIKELY((v & 0x9f000000) == 0)
{
UInt32 z, c;
// v = rotrFixed(v, 8);
v += flag; if Z7_UNLIKELY(v & mask) continue;
z = (v & 0xffffffe0) | (v >> 26);
c = (BR_PC_GET >> (12 - 3)) & ~(UInt32)7;
BR_CONVERT_VAL(z, c)
v &= 0x1f;
v |= 0x90000000;
v |= z << 26;
v |= 0x00ffffe0 & ((z & (((flag << 1) - 1))) - flag);
SetUi32a(p - 4, v)
}
}
}
}
Z7_BRANCH_FUNCS_IMP(ARM64)
Z7_BRANCH_FUNC_MAIN(ARM)
{
// Byte *p = data;
const Byte *lim;
size &= ~(SizeT)3;
lim = p + size;
BR_PC_INIT
/* in ARM: branch offset is relative to the +2 instructions from current instruction.
(p) will point to next instruction */
pc += 8 - 4;
for (;;)
{
for (;;)
{
if Z7_UNLIKELY(p >= lim) { return p; } p += 4; if Z7_UNLIKELY(p[-1] == 0xeb) break;
if Z7_UNLIKELY(p >= lim) { return p; } p += 4; if Z7_UNLIKELY(p[-1] == 0xeb) break;
}
{
UInt32 v = GetUi32a(p - 4);
UInt32 c = BR_PC_GET >> 2;
BR_CONVERT_VAL(v, c)
v &= 0x00ffffff;
v |= 0xeb000000;
SetUi32a(p - 4, v)
}
}
}
Z7_BRANCH_FUNCS_IMP(ARM)
Z7_BRANCH_FUNC_MAIN(PPC)
{
// Byte *p = data;
const Byte *lim;
size &= ~(SizeT)3;
lim = p + size;
BR_PC_INIT
pc -= 4; // because (p) will point to next instruction
for (;;)
{
UInt32 v;
for (;;)
{
if Z7_UNLIKELY(p == lim)
return p;
// v = GetBe32a(p);
v = *(UInt32 *)(void *)p;
p += 4;
// if ((v & 0xfc000003) == 0x48000001) break;
// if ((p[-4] & 0xFC) == 0x48 && (p[-1] & 3) == 1) break;
if Z7_UNLIKELY(
((v - Z7_CONV_BE_TO_NATIVE_CONST32(0x48000001))
& Z7_CONV_BE_TO_NATIVE_CONST32(0xfc000003)) == 0) break;
}
{
v = Z7_CONV_NATIVE_TO_BE_32(v);
{
UInt32 c = BR_PC_GET;
BR_CONVERT_VAL(v, c)
}
v &= 0x03ffffff;
v |= 0x48000000;
SetBe32a(p - 4, v)
}
}
}
Z7_BRANCH_FUNCS_IMP(PPC)
#ifdef Z7_CPU_FAST_ROTATE_SUPPORTED
#define BR_SPARC_USE_ROTATE
#endif
Z7_BRANCH_FUNC_MAIN(SPARC)
{
// Byte *p = data;
const Byte *lim;
const UInt32 flag = (UInt32)1 << 22;
size &= ~(SizeT)3;
lim = p + size;
BR_PC_INIT
pc -= 4; // because (p) will point to next instruction
for (;;)
{
UInt32 v;
for (;;)
{
if Z7_UNLIKELY(p == lim)
return p;
/* // the code without GetBe32a():
{ const UInt32 v = GetUi16a(p) & 0xc0ff; p += 4; if (v == 0x40 || v == 0xc07f) break; }
*/
v = GetBe32a(p);
p += 4;
#ifdef BR_SPARC_USE_ROTATE
v = rotlFixed(v, 2);
v += (flag << 2) - 1;
if Z7_UNLIKELY((v & (3 - (flag << 3))) == 0)
#else
v += (UInt32)5 << 29;
v ^= (UInt32)7 << 29;
v += flag;
if Z7_UNLIKELY((v & (0 - (flag << 1))) == 0)
#endif
break;
}
{
// UInt32 v = GetBe32a(p - 4);
#ifndef BR_SPARC_USE_ROTATE
v <<= 2;
#endif
{
UInt32 c = BR_PC_GET;
BR_CONVERT_VAL(v, c)
}
v &= (flag << 3) - 1;
#ifdef BR_SPARC_USE_ROTATE
v -= (flag << 2) - 1;
v = rotrFixed(v, 2);
#else
v -= (flag << 2);
v >>= 2;
v |= (UInt32)1 << 30;
#endif
SetBe32a(p - 4, v)
}
}
}
Z7_BRANCH_FUNCS_IMP(SPARC)
Z7_BRANCH_FUNC_MAIN(ARMT)
{
// Byte *p = data;
Byte *lim;
size &= ~(SizeT)1;
// if (size == 0) return p;
if (size <= 2) return p;
size -= 2;
lim = p + size;
BR_PC_INIT
/* in ARM: branch offset is relative to the +2 instructions from current instruction.
(p) will point to the +2 instructions from current instruction */
// pc += 4 - 4;
// if (encoding) pc -= 0xf800 << 1; else pc += 0xf800 << 1;
// #define ARMT_TAIL_PROC { goto armt_tail; }
#define ARMT_TAIL_PROC { return p; }
do
{
/* in MSVC 32-bit x86 compilers:
UInt32 version : it loads value from memory with movzx
Byte version : it loads value to 8-bit register (AL/CL)
movzx version is slightly faster in some cpus
*/
unsigned b1;
// Byte / unsigned
b1 = p[1];
// optimized version to reduce one (p >= lim) check:
// unsigned a1 = p[1]; b1 = p[3]; p += 2; if Z7_LIKELY((b1 & (a1 ^ 8)) < 0xf8)
for (;;)
{
unsigned b3; // Byte / UInt32
/* (Byte)(b3) normalization can use low byte computations in MSVC.
It gives smaller code, and no loss of speed in some compilers/cpus.
But new MSVC 32-bit x86 compilers use more slow load
from memory to low byte register in that case.
So we try to use full 32-bit computations for faster code.
*/
// if (p >= lim) { ARMT_TAIL_PROC } b3 = b1 + 8; b1 = p[3]; p += 2; if ((b3 & b1) >= 0xf8) break;
if Z7_UNLIKELY(p >= lim) { ARMT_TAIL_PROC } b3 = p[3]; p += 2; if Z7_UNLIKELY((b3 & (b1 ^ 8)) >= 0xf8) break;
if Z7_UNLIKELY(p >= lim) { ARMT_TAIL_PROC } b1 = p[3]; p += 2; if Z7_UNLIKELY((b1 & (b3 ^ 8)) >= 0xf8) break;
}
{
/* we can adjust pc for (0xf800) to rid of (& 0x7FF) operation.
But gcc/clang for arm64 can use bfi instruction for full code here */
UInt32 v =
((UInt32)GetUi16a(p - 2) << 11) |
((UInt32)GetUi16a(p) & 0x7FF);
/*
UInt32 v =
((UInt32)p[1 - 2] << 19)
+ (((UInt32)p[1] & 0x7) << 8)
+ (((UInt32)p[-2] << 11))
+ (p[0]);
*/
p += 2;
{
UInt32 c = BR_PC_GET >> 1;
BR_CONVERT_VAL(v, c)
}
SetUi16a(p - 4, (UInt16)(((v >> 11) & 0x7ff) | 0xf000))
SetUi16a(p - 2, (UInt16)(v | 0xf800))
/*
p[-4] = (Byte)(v >> 11);
p[-3] = (Byte)(0xf0 | ((v >> 19) & 0x7));
p[-2] = (Byte)v;
p[-1] = (Byte)(0xf8 | (v >> 8));
*/
}
}
while (p < lim);
return p;
// armt_tail:
// if ((Byte)((lim[1] & 0xf8)) != 0xf0) { lim += 2; } return lim;
// return (Byte *)(lim + ((Byte)((lim[1] ^ 0xf0) & 0xf8) == 0 ? 0 : 2));
// return (Byte *)(lim + (((lim[1] ^ ~0xfu) & ~7u) == 0 ? 0 : 2));
// return (Byte *)(lim + 2 - (((((unsigned)lim[1] ^ 8) + 8) >> 7) & 2));
}
Z7_BRANCH_FUNCS_IMP(ARMT)
// #define BR_IA64_NO_INLINE
Z7_BRANCH_FUNC_MAIN(IA64)
{
// Byte *p = data;
const Byte *lim;
size &= ~(SizeT)15;
lim = p + size;
pc -= 1 << 4;
pc >>= 4 - 1;
// pc -= 1 << 1;
for (;;)
{
unsigned m;
for (;;)
{
if Z7_UNLIKELY(p == lim)
return p;
m = (unsigned)((UInt32)0x334b0000 >> (*p & 0x1e));
p += 16;
pc += 1 << 1;
if (m &= 3)
break;
}
{
p += (ptrdiff_t)m * 5 - 20; // negative value is expected here.
do
{
const UInt32 t =
#if defined(MY_CPU_X86_OR_AMD64)
// we use 32-bit load here to reduce code size on x86:
GetUi32(p);
#else
GetUi16(p);
#endif
UInt32 z = GetUi32(p + 1) >> m;
p += 5;
if (((t >> m) & (0x70 << 1)) == 0
&& ((z - (0x5000000 << 1)) & (0xf000000 << 1)) == 0)
{
UInt32 v = (UInt32)((0x8fffff << 1) | 1) & z;
z ^= v;
#ifdef BR_IA64_NO_INLINE
v |= (v & ((UInt32)1 << (23 + 1))) >> 3;
{
UInt32 c = pc;
BR_CONVERT_VAL(v, c)
}
v &= (0x1fffff << 1) | 1;
#else
{
if (encoding)
{
// pc &= ~(0xc00000 << 1); // we just need to clear at least 2 bits
pc &= (0x1fffff << 1) | 1;
v += pc;
}
else
{
// pc |= 0xc00000 << 1; // we need to set at least 2 bits
pc |= ~(UInt32)((0x1fffff << 1) | 1);
v -= pc;
}
}
v &= ~(UInt32)(0x600000 << 1);
#endif
v += (0x700000 << 1);
v &= (0x8fffff << 1) | 1;
z |= v;
z <<= m;
SetUi32(p + 1 - 5, z)
}
m++;
}
while (m &= 3); // while (m < 4);
}
}
}
Z7_BRANCH_FUNCS_IMP(IA64)

99
3rdparty/7z/src/Bra.h vendored
View file

@ -1,99 +0,0 @@
/* Bra.h -- Branch converters for executables
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_BRA_H
#define ZIP7_INC_BRA_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define Z7_BRANCH_CONV_DEC(name) z7_BranchConv_ ## name ## _Dec
#define Z7_BRANCH_CONV_ENC(name) z7_BranchConv_ ## name ## _Enc
#define Z7_BRANCH_CONV_ST_DEC(name) z7_BranchConvSt_ ## name ## _Dec
#define Z7_BRANCH_CONV_ST_ENC(name) z7_BranchConvSt_ ## name ## _Enc
#define Z7_BRANCH_CONV_DECL(name) Byte * name(Byte *data, SizeT size, UInt32 pc)
#define Z7_BRANCH_CONV_ST_DECL(name) Byte * name(Byte *data, SizeT size, UInt32 pc, UInt32 *state)
typedef Z7_BRANCH_CONV_DECL( (*z7_Func_BranchConv));
typedef Z7_BRANCH_CONV_ST_DECL((*z7_Func_BranchConvSt));
#define Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL 0
Z7_BRANCH_CONV_ST_DECL(Z7_BRANCH_CONV_ST_DEC(X86));
Z7_BRANCH_CONV_ST_DECL(Z7_BRANCH_CONV_ST_ENC(X86));
#define Z7_BRANCH_FUNCS_DECL(name) \
Z7_BRANCH_CONV_DECL(Z7_BRANCH_CONV_DEC(name)); \
Z7_BRANCH_CONV_DECL(Z7_BRANCH_CONV_ENC(name));
Z7_BRANCH_FUNCS_DECL(ARM64)
Z7_BRANCH_FUNCS_DECL(ARM)
Z7_BRANCH_FUNCS_DECL(ARMT)
Z7_BRANCH_FUNCS_DECL(PPC)
Z7_BRANCH_FUNCS_DECL(SPARC)
Z7_BRANCH_FUNCS_DECL(IA64)
/*
These functions convert data that contain CPU instructions.
Each such function converts relative addresses to absolute addresses in some
branch instructions: CALL (in all converters) and JUMP (X86 converter only).
Such conversion allows to increase compression ratio, if we compress that data.
There are 2 types of converters:
Byte * Conv_RISC (Byte *data, SizeT size, UInt32 pc);
Byte * ConvSt_X86(Byte *data, SizeT size, UInt32 pc, UInt32 *state);
Each Converter supports 2 versions: one for encoding
and one for decoding (_Enc/_Dec postfixes in function name).
In params:
data : data buffer
size : size of data
pc : current virtual Program Counter (Instruction Pinter) value
In/Out param:
state : pointer to state variable (for X86 converter only)
Return:
The pointer to position in (data) buffer after last byte that was processed.
If the caller calls converter again, it must call it starting with that position.
But the caller is allowed to move data in buffer. so pointer to
current processed position also will be changed for next call.
Also the caller must increase internal (pc) value for next call.
Each converter has some characteristics: Endian, Alignment, LookAhead.
Type Endian Alignment LookAhead
X86 little 1 4
ARMT little 2 2
ARM little 4 0
ARM64 little 4 0
PPC big 4 0
SPARC big 4 0
IA64 little 16 0
(data) must be aligned for (Alignment).
processed size can be calculated as:
SizeT processed = Conv(data, size, pc) - data;
if (processed == 0)
it means that converter needs more data for processing.
If (size < Alignment + LookAhead)
then (processed == 0) is allowed.
Example code for conversion in loop:
UInt32 pc = 0;
size = 0;
for (;;)
{
size += Load_more_input_data(data + size);
SizeT processed = Conv(data, size, pc) - data;
if (processed == 0 && no_more_input_data_after_size)
break; // we stop convert loop
data += processed;
size -= processed;
pc += processed;
}
*/
EXTERN_C_END
#endif

View file

@ -1,187 +0,0 @@
/* Bra86.c -- Branch converter for X86 code (BCJ)
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Bra.h"
#include "CpuArch.h"
#if defined(MY_CPU_SIZEOF_POINTER) \
&& ( MY_CPU_SIZEOF_POINTER == 4 \
|| MY_CPU_SIZEOF_POINTER == 8)
#define BR_CONV_USE_OPT_PC_PTR
#endif
#ifdef BR_CONV_USE_OPT_PC_PTR
#define BR_PC_INIT pc -= (UInt32)(SizeT)p; // (MY_uintptr_t)
#define BR_PC_GET (pc + (UInt32)(SizeT)p)
#else
#define BR_PC_INIT pc += (UInt32)size;
#define BR_PC_GET (pc - (UInt32)(SizeT)(lim - p))
// #define BR_PC_INIT
// #define BR_PC_GET (pc + (UInt32)(SizeT)(p - data))
#endif
#define BR_CONVERT_VAL(v, c) if (encoding) v += c; else v -= c;
// #define BR_CONVERT_VAL(v, c) if (!encoding) c = (UInt32)0 - c; v += c;
#define Z7_BRANCH_CONV_ST(name) z7_BranchConvSt_ ## name
#define BR86_NEED_CONV_FOR_MS_BYTE(b) ((((b) + 1) & 0xfe) == 0)
#ifdef MY_CPU_LE_UNALIGN
#define BR86_PREPARE_BCJ_SCAN const UInt32 v = GetUi32(p) ^ 0xe8e8e8e8;
#define BR86_IS_BCJ_BYTE(n) ((v & ((UInt32)0xfe << (n) * 8)) == 0)
#else
#define BR86_PREPARE_BCJ_SCAN
// bad for MSVC X86 (partial write to byte reg):
#define BR86_IS_BCJ_BYTE(n) ((p[n - 4] & 0xfe) == 0xe8)
// bad for old MSVC (partial write to byte reg):
// #define BR86_IS_BCJ_BYTE(n) (((*p ^ 0xe8) & 0xfe) == 0)
#endif
static
Z7_FORCE_INLINE
Z7_ATTRIB_NO_VECTOR
Byte *Z7_BRANCH_CONV_ST(X86)(Byte *p, SizeT size, UInt32 pc, UInt32 *state, int encoding)
{
if (size < 5)
return p;
{
// Byte *p = data;
const Byte *lim = p + size - 4;
unsigned mask = (unsigned)*state; // & 7;
#ifdef BR_CONV_USE_OPT_PC_PTR
/* if BR_CONV_USE_OPT_PC_PTR is defined: we need to adjust (pc) for (+4),
because call/jump offset is relative to the next instruction.
if BR_CONV_USE_OPT_PC_PTR is not defined : we don't need to adjust (pc) for (+4),
because BR_PC_GET uses (pc - (lim - p)), and lim was adjusted for (-4) before.
*/
pc += 4;
#endif
BR_PC_INIT
goto start;
for (;; mask |= 4)
{
// cont: mask |= 4;
start:
if (p >= lim)
goto fin;
{
BR86_PREPARE_BCJ_SCAN
p += 4;
if (BR86_IS_BCJ_BYTE(0)) { goto m0; } mask >>= 1;
if (BR86_IS_BCJ_BYTE(1)) { goto m1; } mask >>= 1;
if (BR86_IS_BCJ_BYTE(2)) { goto m2; } mask = 0;
if (BR86_IS_BCJ_BYTE(3)) { goto a3; }
}
goto main_loop;
m0: p--;
m1: p--;
m2: p--;
if (mask == 0)
goto a3;
if (p > lim)
goto fin_p;
// if (((0x17u >> mask) & 1) == 0)
if (mask > 4 || mask == 3)
{
mask >>= 1;
continue; // goto cont;
}
mask >>= 1;
if (BR86_NEED_CONV_FOR_MS_BYTE(p[mask]))
continue; // goto cont;
// if (!BR86_NEED_CONV_FOR_MS_BYTE(p[3])) continue; // goto cont;
{
UInt32 v = GetUi32(p);
UInt32 c;
v += (1 << 24); if (v & 0xfe000000) continue; // goto cont;
c = BR_PC_GET;
BR_CONVERT_VAL(v, c)
{
mask <<= 3;
if (BR86_NEED_CONV_FOR_MS_BYTE(v >> mask))
{
v ^= (((UInt32)0x100 << mask) - 1);
#ifdef MY_CPU_X86
// for X86 : we can recalculate (c) to reduce register pressure
c = BR_PC_GET;
#endif
BR_CONVERT_VAL(v, c)
}
mask = 0;
}
// v = (v & ((1 << 24) - 1)) - (v & (1 << 24));
v &= (1 << 25) - 1; v -= (1 << 24);
SetUi32(p, v)
p += 4;
goto main_loop;
}
main_loop:
if (p >= lim)
goto fin;
for (;;)
{
BR86_PREPARE_BCJ_SCAN
p += 4;
if (BR86_IS_BCJ_BYTE(0)) { goto a0; }
if (BR86_IS_BCJ_BYTE(1)) { goto a1; }
if (BR86_IS_BCJ_BYTE(2)) { goto a2; }
if (BR86_IS_BCJ_BYTE(3)) { goto a3; }
if (p >= lim)
goto fin;
}
a0: p--;
a1: p--;
a2: p--;
a3:
if (p > lim)
goto fin_p;
// if (!BR86_NEED_CONV_FOR_MS_BYTE(p[3])) continue; // goto cont;
{
UInt32 v = GetUi32(p);
UInt32 c;
v += (1 << 24); if (v & 0xfe000000) continue; // goto cont;
c = BR_PC_GET;
BR_CONVERT_VAL(v, c)
// v = (v & ((1 << 24) - 1)) - (v & (1 << 24));
v &= (1 << 25) - 1; v -= (1 << 24);
SetUi32(p, v)
p += 4;
goto main_loop;
}
}
fin_p:
p--;
fin:
// the following processing for tail is optional and can be commented
/*
lim += 4;
for (; p < lim; p++, mask >>= 1)
if ((*p & 0xfe) == 0xe8)
break;
*/
*state = (UInt32)mask;
return p;
}
}
#define Z7_BRANCH_CONV_ST_FUNC_IMP(name, m, encoding) \
Z7_NO_INLINE \
Z7_ATTRIB_NO_VECTOR \
Byte *m(name)(Byte *data, SizeT size, UInt32 pc, UInt32 *state) \
{ return Z7_BRANCH_CONV_ST(name)(data, size, pc, state, encoding); }
Z7_BRANCH_CONV_ST_FUNC_IMP(X86, Z7_BRANCH_CONV_ST_DEC, 0)
#ifndef Z7_EXTRACT_ONLY
Z7_BRANCH_CONV_ST_FUNC_IMP(X86, Z7_BRANCH_CONV_ST_ENC, 1)
#endif

View file

@ -1,14 +0,0 @@
/* BraIA64.c -- Converter for IA-64 code
2023-02-20 : Igor Pavlov : Public domain */
#include "Precomp.h"
// the code was moved to Bra.c
#ifdef _MSC_VER
#pragma warning(disable : 4206) // nonstandard extension used : translation unit is empty
#endif
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wempty-translation-unit"
#endif

View file

@ -1,516 +0,0 @@
/* BwtSort.c -- BWT block sorting
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "BwtSort.h"
#include "Sort.h"
/* #define BLOCK_SORT_USE_HEAP_SORT */
/* Don't change it !!! */
#define kNumHashBytes 2
#define kNumHashValues (1 << (kNumHashBytes * 8))
/* kNumRefBitsMax must be < (kNumHashBytes * 8) = 16 */
#define kNumRefBitsMax 12
#define BS_TEMP_SIZE kNumHashValues
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
/* 32 Flags in UInt32 word */
#define kNumFlagsBits 5
#define kNumFlagsInWord (1 << kNumFlagsBits)
#define kFlagsMask (kNumFlagsInWord - 1)
#define kAllFlags 0xFFFFFFFF
#else
#define kNumBitsMax 20
#define kIndexMask ((1 << kNumBitsMax) - 1)
#define kNumExtraBits (32 - kNumBitsMax)
#define kNumExtra0Bits (kNumExtraBits - 2)
#define kNumExtra0Mask ((1 << kNumExtra0Bits) - 1)
#define SetFinishedGroupSize(p, size) \
{ *(p) |= ((((size) - 1) & kNumExtra0Mask) << kNumBitsMax); \
if ((size) > (1 << kNumExtra0Bits)) { \
*(p) |= 0x40000000; *((p) + 1) |= ((((size) - 1)>> kNumExtra0Bits) << kNumBitsMax); } } \
static void SetGroupSize(UInt32 *p, UInt32 size)
{
if (--size == 0)
return;
*p |= 0x80000000 | ((size & kNumExtra0Mask) << kNumBitsMax);
if (size >= (1 << kNumExtra0Bits))
{
*p |= 0x40000000;
p[1] |= ((size >> kNumExtra0Bits) << kNumBitsMax);
}
}
#endif
/*
SortGroup - is recursive Range-Sort function with HeapSort optimization for small blocks
"range" is not real range. It's only for optimization.
returns: 1 - if there are groups, 0 - no more groups
*/
static
UInt32
Z7_FASTCALL
SortGroup(UInt32 BlockSize, UInt32 NumSortedBytes, UInt32 groupOffset, UInt32 groupSize, int NumRefBits, UInt32 *Indices
#ifndef BLOCK_SORT_USE_HEAP_SORT
, UInt32 left, UInt32 range
#endif
)
{
UInt32 *ind2 = Indices + groupOffset;
UInt32 *Groups;
if (groupSize <= 1)
{
/*
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetFinishedGroupSize(ind2, 1)
#endif
*/
return 0;
}
Groups = Indices + BlockSize + BS_TEMP_SIZE;
if (groupSize <= ((UInt32)1 << NumRefBits)
#ifndef BLOCK_SORT_USE_HEAP_SORT
&& groupSize <= range
#endif
)
{
UInt32 *temp = Indices + BlockSize;
UInt32 j;
UInt32 mask, thereAreGroups, group, cg;
{
UInt32 gPrev;
UInt32 gRes = 0;
{
UInt32 sp = ind2[0] + NumSortedBytes;
if (sp >= BlockSize) sp -= BlockSize;
gPrev = Groups[sp];
temp[0] = (gPrev << NumRefBits);
}
for (j = 1; j < groupSize; j++)
{
UInt32 sp = ind2[j] + NumSortedBytes;
UInt32 g;
if (sp >= BlockSize) sp -= BlockSize;
g = Groups[sp];
temp[j] = (g << NumRefBits) | j;
gRes |= (gPrev ^ g);
}
if (gRes == 0)
{
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetGroupSize(ind2, groupSize);
#endif
return 1;
}
}
HeapSort(temp, groupSize);
mask = (((UInt32)1 << NumRefBits) - 1);
thereAreGroups = 0;
group = groupOffset;
cg = (temp[0] >> NumRefBits);
temp[0] = ind2[temp[0] & mask];
{
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 *Flags = Groups + BlockSize;
#else
UInt32 prevGroupStart = 0;
#endif
for (j = 1; j < groupSize; j++)
{
UInt32 val = temp[j];
UInt32 cgCur = (val >> NumRefBits);
if (cgCur != cg)
{
cg = cgCur;
group = groupOffset + j;
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
{
UInt32 t = group - 1;
Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask));
}
#else
SetGroupSize(temp + prevGroupStart, j - prevGroupStart);
prevGroupStart = j;
#endif
}
else
thereAreGroups = 1;
{
UInt32 ind = ind2[val & mask];
temp[j] = ind;
Groups[ind] = group;
}
}
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetGroupSize(temp + prevGroupStart, j - prevGroupStart);
#endif
}
for (j = 0; j < groupSize; j++)
ind2[j] = temp[j];
return thereAreGroups;
}
/* Check that all strings are in one group (cannot sort) */
{
UInt32 group, j;
UInt32 sp = ind2[0] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize;
group = Groups[sp];
for (j = 1; j < groupSize; j++)
{
sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize;
if (Groups[sp] != group)
break;
}
if (j == groupSize)
{
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetGroupSize(ind2, groupSize);
#endif
return 1;
}
}
#ifndef BLOCK_SORT_USE_HEAP_SORT
{
/* ---------- Range Sort ---------- */
UInt32 i;
UInt32 mid;
for (;;)
{
UInt32 j;
if (range <= 1)
{
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetGroupSize(ind2, groupSize);
#endif
return 1;
}
mid = left + ((range + 1) >> 1);
j = groupSize;
i = 0;
do
{
UInt32 sp = ind2[i] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize;
if (Groups[sp] >= mid)
{
for (j--; j > i; j--)
{
sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize;
if (Groups[sp] < mid)
{
UInt32 temp = ind2[i]; ind2[i] = ind2[j]; ind2[j] = temp;
break;
}
}
if (i >= j)
break;
}
}
while (++i < j);
if (i == 0)
{
range = range - (mid - left);
left = mid;
}
else if (i == groupSize)
range = (mid - left);
else
break;
}
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
{
UInt32 t = (groupOffset + i - 1);
UInt32 *Flags = Groups + BlockSize;
Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask));
}
#endif
{
UInt32 j;
for (j = i; j < groupSize; j++)
Groups[ind2[j]] = groupOffset + i;
}
{
UInt32 res = SortGroup(BlockSize, NumSortedBytes, groupOffset, i, NumRefBits, Indices, left, mid - left);
return res | SortGroup(BlockSize, NumSortedBytes, groupOffset + i, groupSize - i, NumRefBits, Indices, mid, range - (mid - left));
}
}
#else
/* ---------- Heap Sort ---------- */
{
UInt32 j;
for (j = 0; j < groupSize; j++)
{
UInt32 sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize;
ind2[j] = sp;
}
HeapSortRef(ind2, Groups, groupSize);
/* Write Flags */
{
UInt32 sp = ind2[0];
UInt32 group = Groups[sp];
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 *Flags = Groups + BlockSize;
#else
UInt32 prevGroupStart = 0;
#endif
for (j = 1; j < groupSize; j++)
{
sp = ind2[j];
if (Groups[sp] != group)
{
group = Groups[sp];
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
{
UInt32 t = groupOffset + j - 1;
Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask));
}
#else
SetGroupSize(ind2 + prevGroupStart, j - prevGroupStart);
prevGroupStart = j;
#endif
}
}
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
SetGroupSize(ind2 + prevGroupStart, j - prevGroupStart);
#endif
}
{
/* Write new Groups values and Check that there are groups */
UInt32 thereAreGroups = 0;
for (j = 0; j < groupSize; j++)
{
UInt32 group = groupOffset + j;
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 subGroupSize = ((ind2[j] & ~0xC0000000) >> kNumBitsMax);
if ((ind2[j] & 0x40000000) != 0)
subGroupSize += ((ind2[(size_t)j + 1] >> kNumBitsMax) << kNumExtra0Bits);
subGroupSize++;
for (;;)
{
UInt32 original = ind2[j];
UInt32 sp = original & kIndexMask;
if (sp < NumSortedBytes) sp += BlockSize; sp -= NumSortedBytes;
ind2[j] = sp | (original & ~kIndexMask);
Groups[sp] = group;
if (--subGroupSize == 0)
break;
j++;
thereAreGroups = 1;
}
#else
UInt32 *Flags = Groups + BlockSize;
for (;;)
{
UInt32 sp = ind2[j]; if (sp < NumSortedBytes) sp += BlockSize; sp -= NumSortedBytes;
ind2[j] = sp;
Groups[sp] = group;
if ((Flags[(groupOffset + j) >> kNumFlagsBits] & (1 << ((groupOffset + j) & kFlagsMask))) == 0)
break;
j++;
thereAreGroups = 1;
}
#endif
}
return thereAreGroups;
}
}
#endif
}
/* conditions: blockSize > 0 */
UInt32 BlockSort(UInt32 *Indices, const Byte *data, UInt32 blockSize)
{
UInt32 *counters = Indices + blockSize;
UInt32 i;
UInt32 *Groups;
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 *Flags;
#endif
/* Radix-Sort for 2 bytes */
for (i = 0; i < kNumHashValues; i++)
counters[i] = 0;
for (i = 0; i < blockSize - 1; i++)
counters[((UInt32)data[i] << 8) | data[(size_t)i + 1]]++;
counters[((UInt32)data[i] << 8) | data[0]]++;
Groups = counters + BS_TEMP_SIZE;
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
Flags = Groups + blockSize;
{
UInt32 numWords = (blockSize + kFlagsMask) >> kNumFlagsBits;
for (i = 0; i < numWords; i++)
Flags[i] = kAllFlags;
}
#endif
{
UInt32 sum = 0;
for (i = 0; i < kNumHashValues; i++)
{
UInt32 groupSize = counters[i];
if (groupSize > 0)
{
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 t = sum + groupSize - 1;
Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask));
#endif
sum += groupSize;
}
counters[i] = sum - groupSize;
}
for (i = 0; i < blockSize - 1; i++)
Groups[i] = counters[((UInt32)data[i] << 8) | data[(size_t)i + 1]];
Groups[i] = counters[((UInt32)data[i] << 8) | data[0]];
for (i = 0; i < blockSize - 1; i++)
Indices[counters[((UInt32)data[i] << 8) | data[(size_t)i + 1]]++] = i;
Indices[counters[((UInt32)data[i] << 8) | data[0]]++] = i;
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
{
UInt32 prev = 0;
for (i = 0; i < kNumHashValues; i++)
{
UInt32 prevGroupSize = counters[i] - prev;
if (prevGroupSize == 0)
continue;
SetGroupSize(Indices + prev, prevGroupSize);
prev = counters[i];
}
}
#endif
}
{
int NumRefBits;
UInt32 NumSortedBytes;
for (NumRefBits = 0; ((blockSize - 1) >> NumRefBits) != 0; NumRefBits++);
NumRefBits = 32 - NumRefBits;
if (NumRefBits > kNumRefBitsMax)
NumRefBits = kNumRefBitsMax;
for (NumSortedBytes = kNumHashBytes; ; NumSortedBytes <<= 1)
{
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
UInt32 finishedGroupSize = 0;
#endif
UInt32 newLimit = 0;
for (i = 0; i < blockSize;)
{
UInt32 groupSize;
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
if ((Flags[i >> kNumFlagsBits] & (1 << (i & kFlagsMask))) == 0)
{
i++;
continue;
}
for (groupSize = 1;
(Flags[(i + groupSize) >> kNumFlagsBits] & (1 << ((i + groupSize) & kFlagsMask))) != 0;
groupSize++);
groupSize++;
#else
groupSize = ((Indices[i] & ~0xC0000000) >> kNumBitsMax);
{
BoolInt finishedGroup = ((Indices[i] & 0x80000000) == 0);
if ((Indices[i] & 0x40000000) != 0)
{
groupSize += ((Indices[(size_t)i + 1] >> kNumBitsMax) << kNumExtra0Bits);
Indices[(size_t)i + 1] &= kIndexMask;
}
Indices[i] &= kIndexMask;
groupSize++;
if (finishedGroup || groupSize == 1)
{
Indices[i - finishedGroupSize] &= kIndexMask;
if (finishedGroupSize > 1)
Indices[(size_t)(i - finishedGroupSize) + 1] &= kIndexMask;
{
UInt32 newGroupSize = groupSize + finishedGroupSize;
SetFinishedGroupSize(Indices + i - finishedGroupSize, newGroupSize)
finishedGroupSize = newGroupSize;
}
i += groupSize;
continue;
}
finishedGroupSize = 0;
}
#endif
if (NumSortedBytes >= blockSize)
{
UInt32 j;
for (j = 0; j < groupSize; j++)
{
UInt32 t = (i + j);
/* Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); */
Groups[Indices[t]] = t;
}
}
else
if (SortGroup(blockSize, NumSortedBytes, i, groupSize, NumRefBits, Indices
#ifndef BLOCK_SORT_USE_HEAP_SORT
, 0, blockSize
#endif
) != 0)
newLimit = i + groupSize;
i += groupSize;
}
if (newLimit == 0)
break;
}
}
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
for (i = 0; i < blockSize;)
{
UInt32 groupSize = ((Indices[i] & ~0xC0000000) >> kNumBitsMax);
if ((Indices[i] & 0x40000000) != 0)
{
groupSize += ((Indices[(size_t)i + 1] >> kNumBitsMax) << kNumExtra0Bits);
Indices[(size_t)i + 1] &= kIndexMask;
}
Indices[i] &= kIndexMask;
groupSize++;
i += groupSize;
}
#endif
return Groups[0];
}

View file

@ -1,26 +0,0 @@
/* BwtSort.h -- BWT block sorting
2023-03-03 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_BWT_SORT_H
#define ZIP7_INC_BWT_SORT_H
#include "7zTypes.h"
EXTERN_C_BEGIN
/* use BLOCK_SORT_EXTERNAL_FLAGS if blockSize can be > 1M */
/* #define BLOCK_SORT_EXTERNAL_FLAGS */
#ifdef BLOCK_SORT_EXTERNAL_FLAGS
#define BLOCK_SORT_EXTERNAL_SIZE(blockSize) ((((blockSize) + 31) >> 5))
#else
#define BLOCK_SORT_EXTERNAL_SIZE(blockSize) 0
#endif
#define BLOCK_SORT_BUF_SIZE(blockSize) ((blockSize) * 2 + BLOCK_SORT_EXTERNAL_SIZE(blockSize) + (1 << 16))
UInt32 BlockSort(UInt32 *indices, const Byte *data, UInt32 blockSize);
EXTERN_C_END
#endif

View file

@ -1,159 +0,0 @@
/* Compiler.h : Compiler specific defines and pragmas
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_COMPILER_H
#define ZIP7_INC_COMPILER_H
#if defined(__clang__)
# define Z7_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#endif
#if defined(__clang__) && defined(__apple_build_version__)
# define Z7_APPLE_CLANG_VERSION Z7_CLANG_VERSION
#elif defined(__clang__)
# define Z7_LLVM_CLANG_VERSION Z7_CLANG_VERSION
#elif defined(__GNUC__)
# define Z7_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
#ifdef _MSC_VER
#if !defined(__clang__) && !defined(__GNUC__)
#define Z7_MSC_VER_ORIGINAL _MSC_VER
#endif
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
#define Z7_MINGW
#endif
// #pragma GCC diagnostic ignored "-Wunknown-pragmas"
#ifdef __clang__
// padding size of '' with 4 bytes to alignment boundary
#pragma GCC diagnostic ignored "-Wpadded"
#endif
#ifdef _MSC_VER
#ifdef UNDER_CE
#define RPC_NO_WINDOWS_H
/* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
#pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1800
#pragma warning(disable : 4464) // relative include path contains '..'
#endif
// == 1200 : -O1 : for __forceinline
// >= 1900 : -O1 : for printf
#pragma warning(disable : 4710) // function not inlined
#if _MSC_VER < 1900
// winnt.h: 'Int64ShllMod32'
#pragma warning(disable : 4514) // unreferenced inline function has been removed
#endif
#if _MSC_VER < 1300
// #pragma warning(disable : 4702) // unreachable code
// Bra.c : -O1:
#pragma warning(disable : 4714) // function marked as __forceinline not inlined
#endif
/*
#if _MSC_VER > 1400 && _MSC_VER <= 1900
// strcat: This function or variable may be unsafe
// sysinfoapi.h: kit10: GetVersion was declared deprecated
#pragma warning(disable : 4996)
#endif
*/
#if _MSC_VER > 1200
// -Wall warnings
#pragma warning(disable : 4711) // function selected for automatic inline expansion
#pragma warning(disable : 4820) // '2' bytes padding added after data member
#if _MSC_VER >= 1400 && _MSC_VER < 1920
// 1400: string.h: _DBG_MEMCPY_INLINE_
// 1600 - 191x : smmintrin.h __cplusplus'
// is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
#pragma warning(disable : 4668)
// 1400 - 1600 : WinDef.h : 'FARPROC' :
// 1900 - 191x : immintrin.h: _readfsbase_u32
// no function prototype given : converting '()' to '(void)'
#pragma warning(disable : 4255)
#endif
#if _MSC_VER >= 1914
// Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#pragma warning(disable : 5045)
#endif
#endif // _MSC_VER > 1200
#endif // _MSC_VER
#if defined(__clang__) && (__clang_major__ >= 4)
#define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
_Pragma("clang loop unroll(disable)") \
_Pragma("clang loop vectorize(disable)")
#define Z7_ATTRIB_NO_VECTORIZE
#elif defined(__GNUC__) && (__GNUC__ >= 5)
#define Z7_ATTRIB_NO_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
// __attribute__((optimize("no-unroll-loops")));
#define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
#elif defined(_MSC_VER) && (_MSC_VER >= 1920)
#define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
_Pragma("loop( no_vector )")
#define Z7_ATTRIB_NO_VECTORIZE
#else
#define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
#define Z7_ATTRIB_NO_VECTORIZE
#endif
#if defined(MY_CPU_X86_OR_AMD64) && ( \
defined(__clang__) && (__clang_major__ >= 4) \
|| defined(__GNUC__) && (__GNUC__ >= 5))
#define Z7_ATTRIB_NO_SSE __attribute__((__target__("no-sse")))
#else
#define Z7_ATTRIB_NO_SSE
#endif
#define Z7_ATTRIB_NO_VECTOR \
Z7_ATTRIB_NO_VECTORIZE \
Z7_ATTRIB_NO_SSE
#if defined(__clang__) && (__clang_major__ >= 8) \
|| defined(__GNUC__) && (__GNUC__ >= 1000) \
/* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
// GCC is not good for __builtin_expect()
#define Z7_LIKELY(x) (__builtin_expect((x), 1))
#define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
// #define Z7_unlikely [[unlikely]]
// #define Z7_likely [[likely]]
#else
#define Z7_LIKELY(x) (x)
#define Z7_UNLIKELY(x) (x)
// #define Z7_likely
#endif
#if (defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 36000))
#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wreserved-macro-identifier\"")
#define Z7_DIAGNOSCTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER \
_Pragma("GCC diagnostic pop")
#else
#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
#define Z7_DIAGNOSCTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
#endif
#define UNUSED_VAR(x) (void)x;
/* #define UNUSED_VAR(x) x=x; */
#endif

View file

@ -1,823 +0,0 @@
/* CpuArch.c -- CPU specific code
2023-05-18 : Igor Pavlov : Public domain */
#include "Precomp.h"
// #include <stdio.h>
#include "CpuArch.h"
#ifdef MY_CPU_X86_OR_AMD64
#undef NEED_CHECK_FOR_CPUID
#if !defined(MY_CPU_AMD64)
#define NEED_CHECK_FOR_CPUID
#endif
/*
cpuid instruction supports (subFunction) parameter in ECX,
that is used only with some specific (function) parameter values.
But we always use only (subFunction==0).
*/
/*
__cpuid(): MSVC and GCC/CLANG use same function/macro name
but parameters are different.
We use MSVC __cpuid() parameters style for our z7_x86_cpuid() function.
*/
#if defined(__GNUC__) /* && (__GNUC__ >= 10) */ \
|| defined(__clang__) /* && (__clang_major__ >= 10) */
/* there was some CLANG/GCC compilers that have issues with
rbx(ebx) handling in asm blocks in -fPIC mode (__PIC__ is defined).
compiler's <cpuid.h> contains the macro __cpuid() that is similar to our code.
The history of __cpuid() changes in CLANG/GCC:
GCC:
2007: it preserved ebx for (__PIC__ && __i386__)
2013: it preserved rbx and ebx for __PIC__
2014: it doesn't preserves rbx and ebx anymore
we suppose that (__GNUC__ >= 5) fixed that __PIC__ ebx/rbx problem.
CLANG:
2014+: it preserves rbx, but only for 64-bit code. No __PIC__ check.
Why CLANG cares about 64-bit mode only, and doesn't care about ebx (in 32-bit)?
Do we need __PIC__ test for CLANG or we must care about rbx even if
__PIC__ is not defined?
*/
#define ASM_LN "\n"
#if defined(MY_CPU_AMD64) && defined(__PIC__) \
&& ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
#define x86_cpuid_MACRO(p, func) { \
__asm__ __volatile__ ( \
ASM_LN "mov %%rbx, %q1" \
ASM_LN "cpuid" \
ASM_LN "xchg %%rbx, %q1" \
: "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
/* "=&r" selects free register. It can select even rbx, if that register is free.
"=&D" for (RDI) also works, but the code can be larger with "=&D"
"2"(0) means (subFunction = 0),
2 is (zero-based) index in the output constraint list "=c" (ECX). */
#elif defined(MY_CPU_X86) && defined(__PIC__) \
&& ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
#define x86_cpuid_MACRO(p, func) { \
__asm__ __volatile__ ( \
ASM_LN "mov %%ebx, %k1" \
ASM_LN "cpuid" \
ASM_LN "xchg %%ebx, %k1" \
: "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
#else
#define x86_cpuid_MACRO(p, func) { \
__asm__ __volatile__ ( \
ASM_LN "cpuid" \
: "=a" ((p)[0]), "=b" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(0)); }
#endif
void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
x86_cpuid_MACRO(p, func)
}
Z7_NO_INLINE
UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
{
#if defined(NEED_CHECK_FOR_CPUID)
#define EFALGS_CPUID_BIT 21
UInt32 a;
__asm__ __volatile__ (
ASM_LN "pushf"
ASM_LN "pushf"
ASM_LN "pop %0"
// ASM_LN "movl %0, %1"
// ASM_LN "xorl $0x200000, %0"
ASM_LN "btc %1, %0"
ASM_LN "push %0"
ASM_LN "popf"
ASM_LN "pushf"
ASM_LN "pop %0"
ASM_LN "xorl (%%esp), %0"
ASM_LN "popf"
ASM_LN
: "=&r" (a) // "=a"
: "i" (EFALGS_CPUID_BIT)
);
if ((a & (1 << EFALGS_CPUID_BIT)) == 0)
return 0;
#endif
{
UInt32 p[4];
x86_cpuid_MACRO(p, 0)
return p[0];
}
}
#undef ASM_LN
#elif !defined(_MSC_VER)
/*
// for gcc/clang and other: we can try to use __cpuid macro:
#include <cpuid.h>
void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
__cpuid(func, p[0], p[1], p[2], p[3]);
}
UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
{
return (UInt32)__get_cpuid_max(0, NULL);
}
*/
// for unsupported cpuid:
void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
UNUSED_VAR(func)
p[0] = p[1] = p[2] = p[3] = 0;
}
UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
{
return 0;
}
#else // _MSC_VER
#if !defined(MY_CPU_AMD64)
UInt32 __declspec(naked) Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
{
#if defined(NEED_CHECK_FOR_CPUID)
#define EFALGS_CPUID_BIT 21
__asm pushfd
__asm pushfd
/*
__asm pop eax
// __asm mov edx, eax
__asm btc eax, EFALGS_CPUID_BIT
__asm push eax
*/
__asm btc dword ptr [esp], EFALGS_CPUID_BIT
__asm popfd
__asm pushfd
__asm pop eax
// __asm xor eax, edx
__asm xor eax, [esp]
// __asm push edx
__asm popfd
__asm and eax, (1 shl EFALGS_CPUID_BIT)
__asm jz end_func
#endif
__asm push ebx
__asm xor eax, eax // func
__asm xor ecx, ecx // subFunction (optional) for (func == 0)
__asm cpuid
__asm pop ebx
#if defined(NEED_CHECK_FOR_CPUID)
end_func:
#endif
__asm ret 0
}
void __declspec(naked) Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
UNUSED_VAR(p)
UNUSED_VAR(func)
__asm push ebx
__asm push edi
__asm mov edi, ecx // p
__asm mov eax, edx // func
__asm xor ecx, ecx // subfunction (optional) for (func == 0)
__asm cpuid
__asm mov [edi ], eax
__asm mov [edi + 4], ebx
__asm mov [edi + 8], ecx
__asm mov [edi + 12], edx
__asm pop edi
__asm pop ebx
__asm ret 0
}
#else // MY_CPU_AMD64
#if _MSC_VER >= 1600
#include <intrin.h>
#define MY_cpuidex __cpuidex
#else
/*
__cpuid (func == (0 or 7)) requires subfunction number in ECX.
MSDN: The __cpuid intrinsic clears the ECX register before calling the cpuid instruction.
__cpuid() in new MSVC clears ECX.
__cpuid() in old MSVC (14.00) x64 doesn't clear ECX
We still can use __cpuid for low (func) values that don't require ECX,
but __cpuid() in old MSVC will be incorrect for some func values: (func == 7).
So here we use the hack for old MSVC to send (subFunction) in ECX register to cpuid instruction,
where ECX value is first parameter for FASTCALL / NO_INLINE func,
So the caller of MY_cpuidex_HACK() sets ECX as subFunction, and
old MSVC for __cpuid() doesn't change ECX and cpuid instruction gets (subFunction) value.
DON'T remove Z7_NO_INLINE and Z7_FASTCALL for MY_cpuidex_HACK(): !!!
*/
static
Z7_NO_INLINE void Z7_FASTCALL MY_cpuidex_HACK(UInt32 subFunction, UInt32 func, int *CPUInfo)
{
UNUSED_VAR(subFunction)
__cpuid(CPUInfo, func);
}
#define MY_cpuidex(info, func, func2) MY_cpuidex_HACK(func2, func, info)
#pragma message("======== MY_cpuidex_HACK WAS USED ========")
#endif // _MSC_VER >= 1600
#if !defined(MY_CPU_AMD64)
/* inlining for __cpuid() in MSVC x86 (32-bit) produces big ineffective code,
so we disable inlining here */
Z7_NO_INLINE
#endif
void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
{
MY_cpuidex((int *)p, (int)func, 0);
}
Z7_NO_INLINE
UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
{
int a[4];
MY_cpuidex(a, 0, 0);
return a[0];
}
#endif // MY_CPU_AMD64
#endif // _MSC_VER
#if defined(NEED_CHECK_FOR_CPUID)
#define CHECK_CPUID_IS_SUPPORTED { if (z7_x86_cpuid_GetMaxFunc() == 0) return 0; }
#else
#define CHECK_CPUID_IS_SUPPORTED
#endif
#undef NEED_CHECK_FOR_CPUID
static
BoolInt x86cpuid_Func_1(UInt32 *p)
{
CHECK_CPUID_IS_SUPPORTED
z7_x86_cpuid(p, 1);
return True;
}
/*
static const UInt32 kVendors[][1] =
{
{ 0x756E6547 }, // , 0x49656E69, 0x6C65746E },
{ 0x68747541 }, // , 0x69746E65, 0x444D4163 },
{ 0x746E6543 } // , 0x48727561, 0x736C7561 }
};
*/
/*
typedef struct
{
UInt32 maxFunc;
UInt32 vendor[3];
UInt32 ver;
UInt32 b;
UInt32 c;
UInt32 d;
} Cx86cpuid;
enum
{
CPU_FIRM_INTEL,
CPU_FIRM_AMD,
CPU_FIRM_VIA
};
int x86cpuid_GetFirm(const Cx86cpuid *p);
#define x86cpuid_ver_GetFamily(ver) (((ver >> 16) & 0xff0) | ((ver >> 8) & 0xf))
#define x86cpuid_ver_GetModel(ver) (((ver >> 12) & 0xf0) | ((ver >> 4) & 0xf))
#define x86cpuid_ver_GetStepping(ver) (ver & 0xf)
int x86cpuid_GetFirm(const Cx86cpuid *p)
{
unsigned i;
for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[0]); i++)
{
const UInt32 *v = kVendors[i];
if (v[0] == p->vendor[0]
// && v[1] == p->vendor[1]
// && v[2] == p->vendor[2]
)
return (int)i;
}
return -1;
}
BoolInt CPU_Is_InOrder()
{
Cx86cpuid p;
UInt32 family, model;
if (!x86cpuid_CheckAndRead(&p))
return True;
family = x86cpuid_ver_GetFamily(p.ver);
model = x86cpuid_ver_GetModel(p.ver);
switch (x86cpuid_GetFirm(&p))
{
case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && (
// In-Order Atom CPU
model == 0x1C // 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330
|| model == 0x26 // 45 nm, Z6xx
|| model == 0x27 // 32 nm, Z2460
|| model == 0x35 // 32 nm, Z2760
|| model == 0x36 // 32 nm, N2xxx, D2xxx
)));
case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
}
return False; // v23 : unknown processors are not In-Order
}
*/
#ifdef _WIN32
#include "7zWindows.h"
#endif
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
/* for legacy SSE ia32: there is no user-space cpu instruction to check
that OS supports SSE register storing/restoring on context switches.
So we need some OS-specific function to check that it's safe to use SSE registers.
*/
Z7_FORCE_INLINE
static BoolInt CPU_Sys_Is_SSE_Supported(void)
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996) // `GetVersion': was declared deprecated
#endif
/* low byte is major version of Windows
We suppose that any Windows version since
Windows2000 (major == 5) supports SSE registers */
return (Byte)GetVersion() >= 5;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}
#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
#else
#define CHECK_SYS_SSE_SUPPORT
#endif
#if !defined(MY_CPU_AMD64)
BoolInt CPU_IsSupported_CMOV(void)
{
UInt32 a[4];
if (!x86cpuid_Func_1(&a[0]))
return 0;
return (a[3] >> 15) & 1;
}
BoolInt CPU_IsSupported_SSE(void)
{
UInt32 a[4];
CHECK_SYS_SSE_SUPPORT
if (!x86cpuid_Func_1(&a[0]))
return 0;
return (a[3] >> 25) & 1;
}
BoolInt CPU_IsSupported_SSE2(void)
{
UInt32 a[4];
CHECK_SYS_SSE_SUPPORT
if (!x86cpuid_Func_1(&a[0]))
return 0;
return (a[3] >> 26) & 1;
}
#endif
static UInt32 x86cpuid_Func_1_ECX(void)
{
UInt32 a[4];
CHECK_SYS_SSE_SUPPORT
if (!x86cpuid_Func_1(&a[0]))
return 0;
return a[2];
}
BoolInt CPU_IsSupported_AES(void)
{
return (x86cpuid_Func_1_ECX() >> 25) & 1;
}
BoolInt CPU_IsSupported_SSSE3(void)
{
return (x86cpuid_Func_1_ECX() >> 9) & 1;
}
BoolInt CPU_IsSupported_SSE41(void)
{
return (x86cpuid_Func_1_ECX() >> 19) & 1;
}
BoolInt CPU_IsSupported_SHA(void)
{
CHECK_SYS_SSE_SUPPORT
if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
UInt32 d[4];
z7_x86_cpuid(d, 7);
return (d[1] >> 29) & 1;
}
}
/*
MSVC: _xgetbv() intrinsic is available since VS2010SP1.
MSVC also defines (_XCR_XFEATURE_ENABLED_MASK) macro in
<immintrin.h> that we can use or check.
For any 32-bit x86 we can use asm code in MSVC,
but MSVC asm code is huge after compilation.
So _xgetbv() is better
ICC: _xgetbv() intrinsic is available (in what version of ICC?)
ICC defines (__GNUC___) and it supports gnu assembler
also ICC supports MASM style code with -use-msasm switch.
but ICC doesn't support __attribute__((__target__))
GCC/CLANG 9:
_xgetbv() is macro that works via __builtin_ia32_xgetbv()
and we need __attribute__((__target__("xsave")).
But with __target__("xsave") the function will be not
inlined to function that has no __target__("xsave") attribute.
If we want _xgetbv() call inlining, then we should use asm version
instead of calling _xgetbv().
Note:intrinsic is broke before GCC 8.2:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684
*/
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) \
|| defined(_MSC_VER) && (_MSC_VER >= 1600) && (_MSC_FULL_VER >= 160040219) \
|| defined(__GNUC__) && (__GNUC__ >= 9) \
|| defined(__clang__) && (__clang_major__ >= 9)
// we define ATTRIB_XGETBV, if we want to use predefined _xgetbv() from compiler
#if defined(__INTEL_COMPILER)
#define ATTRIB_XGETBV
#elif defined(__GNUC__) || defined(__clang__)
// we don't define ATTRIB_XGETBV here, because asm version is better for inlining.
// #define ATTRIB_XGETBV __attribute__((__target__("xsave")))
#else
#define ATTRIB_XGETBV
#endif
#endif
#if defined(ATTRIB_XGETBV)
#include <immintrin.h>
#endif
// XFEATURE_ENABLED_MASK/XCR0
#define MY_XCR_XFEATURE_ENABLED_MASK 0
#if defined(ATTRIB_XGETBV)
ATTRIB_XGETBV
#endif
static UInt64 x86_xgetbv_0(UInt32 num)
{
#if defined(ATTRIB_XGETBV)
{
return
#if (defined(_MSC_VER))
_xgetbv(num);
#else
__builtin_ia32_xgetbv(
#if !defined(__clang__)
(int)
#endif
num);
#endif
}
#elif defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_CC)
UInt32 a, d;
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
__asm__
(
"xgetbv"
: "=a"(a), "=d"(d) : "c"(num) : "cc"
);
#else // is old gcc
__asm__
(
".byte 0x0f, 0x01, 0xd0" "\n\t"
: "=a"(a), "=d"(d) : "c"(num) : "cc"
);
#endif
return ((UInt64)d << 32) | a;
// return a;
#elif defined(_MSC_VER) && !defined(MY_CPU_AMD64)
UInt32 a, d;
__asm {
push eax
push edx
push ecx
mov ecx, num;
// xor ecx, ecx // = MY_XCR_XFEATURE_ENABLED_MASK
_emit 0x0f
_emit 0x01
_emit 0xd0
mov a, eax
mov d, edx
pop ecx
pop edx
pop eax
}
return ((UInt64)d << 32) | a;
// return a;
#else // it's unknown compiler
// #error "Need xgetbv function"
UNUSED_VAR(num)
// for MSVC-X64 we could call external function from external file.
/* Actually we had checked OSXSAVE/AVX in cpuid before.
So it's expected that OS supports at least AVX and below. */
// if (num != MY_XCR_XFEATURE_ENABLED_MASK) return 0; // if not XCR0
return
// (1 << 0) | // x87
(1 << 1) // SSE
| (1 << 2); // AVX
#endif
}
#ifdef _WIN32
/*
Windows versions do not know about new ISA extensions that
can be introduced. But we still can use new extensions,
even if Windows doesn't report about supporting them,
But we can use new extensions, only if Windows knows about new ISA extension
that changes the number or size of registers: SSE, AVX/XSAVE, AVX512
So it's enough to check
MY_PF_AVX_INSTRUCTIONS_AVAILABLE
instead of
MY_PF_AVX2_INSTRUCTIONS_AVAILABLE
*/
#define MY_PF_XSAVE_ENABLED 17
// #define MY_PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
// #define MY_PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
// #define MY_PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
// #define MY_PF_AVX_INSTRUCTIONS_AVAILABLE 39
// #define MY_PF_AVX2_INSTRUCTIONS_AVAILABLE 40
// #define MY_PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
#endif
BoolInt CPU_IsSupported_AVX(void)
{
#ifdef _WIN32
if (!IsProcessorFeaturePresent(MY_PF_XSAVE_ENABLED))
return False;
/* PF_AVX_INSTRUCTIONS_AVAILABLE probably is supported starting from
some latest Win10 revisions. But we need AVX in older Windows also.
So we don't use the following check: */
/*
if (!IsProcessorFeaturePresent(MY_PF_AVX_INSTRUCTIONS_AVAILABLE))
return False;
*/
#endif
/*
OS must use new special XSAVE/XRSTOR instructions to save
AVX registers when it required for context switching.
At OS statring:
OS sets CR4.OSXSAVE flag to signal the processor that OS supports the XSAVE extensions.
Also OS sets bitmask in XCR0 register that defines what
registers will be processed by XSAVE instruction:
XCR0.SSE[bit 0] - x87 registers and state
XCR0.SSE[bit 1] - SSE registers and state
XCR0.AVX[bit 2] - AVX registers and state
CR4.OSXSAVE is reflected to CPUID.1:ECX.OSXSAVE[bit 27].
So we can read that bit in user-space.
XCR0 is available for reading in user-space by new XGETBV instruction.
*/
{
const UInt32 c = x86cpuid_Func_1_ECX();
if (0 == (1
& (c >> 28) // AVX instructions are supported by hardware
& (c >> 27))) // OSXSAVE bit: XSAVE and related instructions are enabled by OS.
return False;
}
/* also we can check
CPUID.1:ECX.XSAVE [bit 26] : that shows that
XSAVE, XRESTOR, XSETBV, XGETBV instructions are supported by hardware.
But that check is redundant, because if OSXSAVE bit is set, then XSAVE is also set */
/* If OS have enabled XSAVE extension instructions (OSXSAVE == 1),
in most cases we expect that OS also will support storing/restoring
for AVX and SSE states at least.
But to be ensure for that we call user-space instruction
XGETBV(0) to get XCR0 value that contains bitmask that defines
what exact states(registers) OS have enabled for storing/restoring.
*/
{
const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK);
// printf("\n=== XGetBV=%d\n", bm);
return 1
& (bm >> 1) // SSE state is supported (set by OS) for storing/restoring
& (bm >> 2); // AVX state is supported (set by OS) for storing/restoring
}
// since Win7SP1: we can use GetEnabledXStateFeatures();
}
BoolInt CPU_IsSupported_AVX2(void)
{
if (!CPU_IsSupported_AVX())
return False;
if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
UInt32 d[4];
z7_x86_cpuid(d, 7);
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
return 1
& (d[1] >> 5); // avx2
}
}
BoolInt CPU_IsSupported_VAES_AVX2(void)
{
if (!CPU_IsSupported_AVX())
return False;
if (z7_x86_cpuid_GetMaxFunc() < 7)
return False;
{
UInt32 d[4];
z7_x86_cpuid(d, 7);
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
return 1
& (d[1] >> 5) // avx2
// & (d[1] >> 31) // avx512vl
& (d[2] >> 9); // vaes // VEX-256/EVEX
}
}
BoolInt CPU_IsSupported_PageGB(void)
{
CHECK_CPUID_IS_SUPPORTED
{
UInt32 d[4];
z7_x86_cpuid(d, 0x80000000);
if (d[0] < 0x80000001)
return False;
z7_x86_cpuid(d, 0x80000001);
return (d[3] >> 26) & 1;
}
}
#elif defined(MY_CPU_ARM_OR_ARM64)
#ifdef _WIN32
#include "7zWindows.h"
BoolInt CPU_IsSupported_CRC32(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
BoolInt CPU_IsSupported_CRYPTO(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
BoolInt CPU_IsSupported_NEON(void) { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
#else
#if defined(__APPLE__)
/*
#include <stdio.h>
#include <string.h>
static void Print_sysctlbyname(const char *name)
{
size_t bufSize = 256;
char buf[256];
int res = sysctlbyname(name, &buf, &bufSize, NULL, 0);
{
int i;
printf("\nres = %d : %s : '%s' : bufSize = %d, numeric", res, name, buf, (unsigned)bufSize);
for (i = 0; i < 20; i++)
printf(" %2x", (unsigned)(Byte)buf[i]);
}
}
*/
/*
Print_sysctlbyname("hw.pagesize");
Print_sysctlbyname("machdep.cpu.brand_string");
*/
static BoolInt z7_sysctlbyname_Get_BoolInt(const char *name)
{
UInt32 val = 0;
if (z7_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
return 1;
return 0;
}
BoolInt CPU_IsSupported_CRC32(void)
{
return z7_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
}
BoolInt CPU_IsSupported_NEON(void)
{
return z7_sysctlbyname_Get_BoolInt("hw.optional.neon");
}
#ifdef MY_CPU_ARM64
#define APPLE_CRYPTO_SUPPORT_VAL 1
#else
#define APPLE_CRYPTO_SUPPORT_VAL 0
#endif
BoolInt CPU_IsSupported_SHA1(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
#else // __APPLE__
#include <sys/auxv.h>
#define USE_HWCAP
#ifdef USE_HWCAP
#include <asm/hwcap.h>
#define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP) & (HWCAP_ ## name2)) ? 1 : 0; }
#ifdef MY_CPU_ARM64
#define MY_HWCAP_CHECK_FUNC(name) \
MY_HWCAP_CHECK_FUNC_2(name, name)
MY_HWCAP_CHECK_FUNC_2(NEON, ASIMD)
// MY_HWCAP_CHECK_FUNC (ASIMD)
#elif defined(MY_CPU_ARM)
#define MY_HWCAP_CHECK_FUNC(name) \
BoolInt CPU_IsSupported_ ## name() { return (getauxval(AT_HWCAP2) & (HWCAP2_ ## name)) ? 1 : 0; }
MY_HWCAP_CHECK_FUNC_2(NEON, NEON)
#endif
#else // USE_HWCAP
#define MY_HWCAP_CHECK_FUNC(name) \
BoolInt CPU_IsSupported_ ## name() { return 0; }
MY_HWCAP_CHECK_FUNC(NEON)
#endif // USE_HWCAP
MY_HWCAP_CHECK_FUNC (CRC32)
MY_HWCAP_CHECK_FUNC (SHA1)
MY_HWCAP_CHECK_FUNC (SHA2)
MY_HWCAP_CHECK_FUNC (AES)
#endif // __APPLE__
#endif // _WIN32
#endif // MY_CPU_ARM_OR_ARM64
#ifdef __APPLE__
#include <sys/sysctl.h>
int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
{
return sysctlbyname(name, buf, bufSize, NULL, 0);
}
int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
{
size_t bufSize = sizeof(*val);
const int res = z7_sysctlbyname_Get(name, val, &bufSize);
if (res == 0 && bufSize != sizeof(*val))
return EFAULT;
return res;
}
#endif

View file

@ -1,523 +0,0 @@
/* CpuArch.h -- CPU specific code
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_CPU_ARCH_H
#define ZIP7_INC_CPU_ARCH_H
#include "7zTypes.h"
EXTERN_C_BEGIN
/*
MY_CPU_LE means that CPU is LITTLE ENDIAN.
MY_CPU_BE means that CPU is BIG ENDIAN.
If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform.
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
MY_CPU_64BIT means that processor can work with 64-bit registers.
MY_CPU_64BIT can be used to select fast code branch
MY_CPU_64BIT doesn't mean that (sizeof(void *) == 8)
*/
#if defined(_M_X64) \
|| defined(_M_AMD64) \
|| defined(__x86_64__) \
|| defined(__AMD64__) \
|| defined(__amd64__)
#define MY_CPU_AMD64
#ifdef __ILP32__
#define MY_CPU_NAME "x32"
#define MY_CPU_SIZEOF_POINTER 4
#else
#define MY_CPU_NAME "x64"
#define MY_CPU_SIZEOF_POINTER 8
#endif
#define MY_CPU_64BIT
#endif
#if defined(_M_IX86) \
|| defined(__i386__)
#define MY_CPU_X86
#define MY_CPU_NAME "x86"
/* #define MY_CPU_32BIT */
#define MY_CPU_SIZEOF_POINTER 4
#endif
#if defined(_M_ARM64) \
|| defined(__AARCH64EL__) \
|| defined(__AARCH64EB__) \
|| defined(__aarch64__)
#define MY_CPU_ARM64
#ifdef __ILP32__
#define MY_CPU_NAME "arm64-32"
#define MY_CPU_SIZEOF_POINTER 4
#else
#define MY_CPU_NAME "arm64"
#define MY_CPU_SIZEOF_POINTER 8
#endif
#define MY_CPU_64BIT
#endif
#if defined(_M_ARM) \
|| defined(_M_ARM_NT) \
|| defined(_M_ARMT) \
|| defined(__arm__) \
|| defined(__thumb__) \
|| defined(__ARMEL__) \
|| defined(__ARMEB__) \
|| defined(__THUMBEL__) \
|| defined(__THUMBEB__)
#define MY_CPU_ARM
#if defined(__thumb__) || defined(__THUMBEL__) || defined(_M_ARMT)
#define MY_CPU_ARMT
#define MY_CPU_NAME "armt"
#else
#define MY_CPU_ARM32
#define MY_CPU_NAME "arm"
#endif
/* #define MY_CPU_32BIT */
#define MY_CPU_SIZEOF_POINTER 4
#endif
#if defined(_M_IA64) \
|| defined(__ia64__)
#define MY_CPU_IA64
#define MY_CPU_NAME "ia64"
#define MY_CPU_64BIT
#endif
#if defined(__mips64) \
|| defined(__mips64__) \
|| (defined(__mips) && (__mips == 64 || __mips == 4 || __mips == 3))
#define MY_CPU_NAME "mips64"
#define MY_CPU_64BIT
#elif defined(__mips__)
#define MY_CPU_NAME "mips"
/* #define MY_CPU_32BIT */
#endif
#if defined(__ppc64__) \
|| defined(__powerpc64__) \
|| defined(__ppc__) \
|| defined(__powerpc__) \
|| defined(__PPC__) \
|| defined(_POWER)
#define MY_CPU_PPC_OR_PPC64
#if defined(__ppc64__) \
|| defined(__powerpc64__) \
|| defined(_LP64) \
|| defined(__64BIT__)
#ifdef __ILP32__
#define MY_CPU_NAME "ppc64-32"
#define MY_CPU_SIZEOF_POINTER 4
#else
#define MY_CPU_NAME "ppc64"
#define MY_CPU_SIZEOF_POINTER 8
#endif
#define MY_CPU_64BIT
#else
#define MY_CPU_NAME "ppc"
#define MY_CPU_SIZEOF_POINTER 4
/* #define MY_CPU_32BIT */
#endif
#endif
#if defined(__riscv) \
|| defined(__riscv__)
#if __riscv_xlen == 32
#define MY_CPU_NAME "riscv32"
#elif __riscv_xlen == 64
#define MY_CPU_NAME "riscv64"
#else
#define MY_CPU_NAME "riscv"
#endif
#endif
#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64)
#define MY_CPU_X86_OR_AMD64
#endif
#if defined(MY_CPU_ARM) || defined(MY_CPU_ARM64)
#define MY_CPU_ARM_OR_ARM64
#endif
#ifdef _WIN32
#ifdef MY_CPU_ARM
#define MY_CPU_ARM_LE
#endif
#ifdef MY_CPU_ARM64
#define MY_CPU_ARM64_LE
#endif
#ifdef _M_IA64
#define MY_CPU_IA64_LE
#endif
#endif
#if defined(MY_CPU_X86_OR_AMD64) \
|| defined(MY_CPU_ARM_LE) \
|| defined(MY_CPU_ARM64_LE) \
|| defined(MY_CPU_IA64_LE) \
|| defined(__LITTLE_ENDIAN__) \
|| defined(__ARMEL__) \
|| defined(__THUMBEL__) \
|| defined(__AARCH64EL__) \
|| defined(__MIPSEL__) \
|| defined(__MIPSEL) \
|| defined(_MIPSEL) \
|| defined(__BFIN__) \
|| (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
#define MY_CPU_LE
#endif
#if defined(__BIG_ENDIAN__) \
|| defined(__ARMEB__) \
|| defined(__THUMBEB__) \
|| defined(__AARCH64EB__) \
|| defined(__MIPSEB__) \
|| defined(__MIPSEB) \
|| defined(_MIPSEB) \
|| defined(__m68k__) \
|| defined(__s390__) \
|| defined(__s390x__) \
|| defined(__zarch__) \
|| (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
#define MY_CPU_BE
#endif
#if defined(MY_CPU_LE) && defined(MY_CPU_BE)
#error Stop_Compiling_Bad_Endian
#endif
#if !defined(MY_CPU_LE) && !defined(MY_CPU_BE)
#error Stop_Compiling_CPU_ENDIAN_must_be_detected_at_compile_time
#endif
#if defined(MY_CPU_32BIT) && defined(MY_CPU_64BIT)
#error Stop_Compiling_Bad_32_64_BIT
#endif
#ifdef __SIZEOF_POINTER__
#ifdef MY_CPU_SIZEOF_POINTER
#if MY_CPU_SIZEOF_POINTER != __SIZEOF_POINTER__
#error Stop_Compiling_Bad_MY_CPU_PTR_SIZE
#endif
#else
#define MY_CPU_SIZEOF_POINTER __SIZEOF_POINTER__
#endif
#endif
#if defined(MY_CPU_SIZEOF_POINTER) && (MY_CPU_SIZEOF_POINTER == 4)
#if defined (_LP64)
#error Stop_Compiling_Bad_MY_CPU_PTR_SIZE
#endif
#endif
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#define MY_CPU_pragma_pack_push_1 __pragma(pack(push, 1))
#define MY_CPU_pragma_pop __pragma(pack(pop))
#else
#define MY_CPU_pragma_pack_push_1
#define MY_CPU_pragma_pop
#endif
#else
#ifdef __xlC__
#define MY_CPU_pragma_pack_push_1 _Pragma("pack(1)")
#define MY_CPU_pragma_pop _Pragma("pack()")
#else
#define MY_CPU_pragma_pack_push_1 _Pragma("pack(push, 1)")
#define MY_CPU_pragma_pop _Pragma("pack(pop)")
#endif
#endif
#ifndef MY_CPU_NAME
#ifdef MY_CPU_LE
#define MY_CPU_NAME "LE"
#elif defined(MY_CPU_BE)
#define MY_CPU_NAME "BE"
#else
/*
#define MY_CPU_NAME ""
*/
#endif
#endif
#ifdef __has_builtin
#define Z7_has_builtin(x) __has_builtin(x)
#else
#define Z7_has_builtin(x) 0
#endif
#define Z7_BSWAP32_CONST(v) \
( (((UInt32)(v) << 24) ) \
| (((UInt32)(v) << 8) & (UInt32)0xff0000) \
| (((UInt32)(v) >> 8) & (UInt32)0xff00 ) \
| (((UInt32)(v) >> 24) ))
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#include <stdlib.h>
/* Note: these macros will use bswap instruction (486), that is unsupported in 386 cpu */
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64)
#define Z7_BSWAP16(v) _byteswap_ushort(v)
#define Z7_BSWAP32(v) _byteswap_ulong (v)
#define Z7_BSWAP64(v) _byteswap_uint64(v)
#define Z7_CPU_FAST_BSWAP_SUPPORTED
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
|| (defined(__clang__) && Z7_has_builtin(__builtin_bswap16))
#define Z7_BSWAP16(v) __builtin_bswap16(v)
#define Z7_BSWAP32(v) __builtin_bswap32(v)
#define Z7_BSWAP64(v) __builtin_bswap64(v)
#define Z7_CPU_FAST_BSWAP_SUPPORTED
#else
#define Z7_BSWAP16(v) ((UInt16) \
( ((UInt32)(v) << 8) \
| ((UInt32)(v) >> 8) \
))
#define Z7_BSWAP32(v) Z7_BSWAP32_CONST(v)
#define Z7_BSWAP64(v) \
( ( ( (UInt64)(v) ) << 8 * 7 ) \
| ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 1) ) << 8 * 5 ) \
| ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 2) ) << 8 * 3 ) \
| ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 3) ) << 8 * 1 ) \
| ( ( (UInt64)(v) >> 8 * 1 ) & ((UInt32)0xff << 8 * 3) ) \
| ( ( (UInt64)(v) >> 8 * 3 ) & ((UInt32)0xff << 8 * 2) ) \
| ( ( (UInt64)(v) >> 8 * 5 ) & ((UInt32)0xff << 8 * 1) ) \
| ( ( (UInt64)(v) >> 8 * 7 ) ) \
)
#endif
#ifdef MY_CPU_LE
#if defined(MY_CPU_X86_OR_AMD64) \
|| defined(MY_CPU_ARM64)
#define MY_CPU_LE_UNALIGN
#define MY_CPU_LE_UNALIGN_64
#elif defined(__ARM_FEATURE_UNALIGNED)
/* gcc9 for 32-bit arm can use LDRD instruction that requires 32-bit alignment.
So we can't use unaligned 64-bit operations. */
#define MY_CPU_LE_UNALIGN
#endif
#endif
#ifdef MY_CPU_LE_UNALIGN
#define GetUi16(p) (*(const UInt16 *)(const void *)(p))
#define GetUi32(p) (*(const UInt32 *)(const void *)(p))
#ifdef MY_CPU_LE_UNALIGN_64
#define GetUi64(p) (*(const UInt64 *)(const void *)(p))
#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
#endif
#define SetUi16(p, v) { *(UInt16 *)(void *)(p) = (v); }
#define SetUi32(p, v) { *(UInt32 *)(void *)(p) = (v); }
#else
#define GetUi16(p) ( (UInt16) ( \
((const Byte *)(p))[0] | \
((UInt16)((const Byte *)(p))[1] << 8) ))
#define GetUi32(p) ( \
((const Byte *)(p))[0] | \
((UInt32)((const Byte *)(p))[1] << 8) | \
((UInt32)((const Byte *)(p))[2] << 16) | \
((UInt32)((const Byte *)(p))[3] << 24))
#define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
_ppp_[0] = (Byte)_vvv_; \
_ppp_[1] = (Byte)(_vvv_ >> 8); }
#define SetUi32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
_ppp_[0] = (Byte)_vvv_; \
_ppp_[1] = (Byte)(_vvv_ >> 8); \
_ppp_[2] = (Byte)(_vvv_ >> 16); \
_ppp_[3] = (Byte)(_vvv_ >> 24); }
#endif
#ifndef GetUi64
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
#endif
#ifndef SetUi64
#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \
SetUi32(_ppp2_ , (UInt32)_vvv2_) \
SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)) }
#endif
#if defined(MY_CPU_LE_UNALIGN) && defined(Z7_CPU_FAST_BSWAP_SUPPORTED)
#define GetBe32(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p))
#define SetBe32(p, v) { (*(UInt32 *)(void *)(p)) = Z7_BSWAP32(v); }
#if defined(MY_CPU_LE_UNALIGN_64)
#define GetBe64(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p))
#endif
#else
#define GetBe32(p) ( \
((UInt32)((const Byte *)(p))[0] << 24) | \
((UInt32)((const Byte *)(p))[1] << 16) | \
((UInt32)((const Byte *)(p))[2] << 8) | \
((const Byte *)(p))[3] )
#define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
_ppp_[0] = (Byte)(_vvv_ >> 24); \
_ppp_[1] = (Byte)(_vvv_ >> 16); \
_ppp_[2] = (Byte)(_vvv_ >> 8); \
_ppp_[3] = (Byte)_vvv_; }
#endif
#ifndef GetBe64
#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
#endif
#ifndef GetBe16
#define GetBe16(p) ( (UInt16) ( \
((UInt16)((const Byte *)(p))[0] << 8) | \
((const Byte *)(p))[1] ))
#endif
#if defined(MY_CPU_BE)
#define Z7_CONV_BE_TO_NATIVE_CONST32(v) (v)
#define Z7_CONV_LE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
#define Z7_CONV_NATIVE_TO_BE_32(v) (v)
#elif defined(MY_CPU_LE)
#define Z7_CONV_BE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
#define Z7_CONV_LE_TO_NATIVE_CONST32(v) (v)
#define Z7_CONV_NATIVE_TO_BE_32(v) Z7_BSWAP32(v)
#else
#error Stop_Compiling_Unknown_Endian_CONV
#endif
#if defined(MY_CPU_BE)
#define GetBe32a(p) (*(const UInt32 *)(const void *)(p))
#define GetBe16a(p) (*(const UInt16 *)(const void *)(p))
#define SetBe32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
#define SetBe16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
#define GetUi32a(p) GetUi32(p)
#define GetUi16a(p) GetUi16(p)
#define SetUi32a(p, v) SetUi32(p, v)
#define SetUi16a(p, v) SetUi16(p, v)
#elif defined(MY_CPU_LE)
#define GetUi32a(p) (*(const UInt32 *)(const void *)(p))
#define GetUi16a(p) (*(const UInt16 *)(const void *)(p))
#define SetUi32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
#define SetUi16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
#define GetBe32a(p) GetBe32(p)
#define GetBe16a(p) GetBe16(p)
#define SetBe32a(p, v) SetBe32(p, v)
#define SetBe16a(p, v) SetBe16(p, v)
#else
#error Stop_Compiling_Unknown_Endian_CPU_a
#endif
#if defined(MY_CPU_X86_OR_AMD64) \
|| defined(MY_CPU_ARM_OR_ARM64) \
|| defined(MY_CPU_PPC_OR_PPC64)
#define Z7_CPU_FAST_ROTATE_SUPPORTED
#endif
#ifdef MY_CPU_X86_OR_AMD64
void Z7_FASTCALL z7_x86_cpuid(UInt32 a[4], UInt32 function);
UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void);
#if defined(MY_CPU_AMD64)
#define Z7_IF_X86_CPUID_SUPPORTED
#else
#define Z7_IF_X86_CPUID_SUPPORTED if (z7_x86_cpuid_GetMaxFunc())
#endif
BoolInt CPU_IsSupported_AES(void);
BoolInt CPU_IsSupported_AVX(void);
BoolInt CPU_IsSupported_AVX2(void);
BoolInt CPU_IsSupported_VAES_AVX2(void);
BoolInt CPU_IsSupported_CMOV(void);
BoolInt CPU_IsSupported_SSE(void);
BoolInt CPU_IsSupported_SSE2(void);
BoolInt CPU_IsSupported_SSSE3(void);
BoolInt CPU_IsSupported_SSE41(void);
BoolInt CPU_IsSupported_SHA(void);
BoolInt CPU_IsSupported_PageGB(void);
#elif defined(MY_CPU_ARM_OR_ARM64)
BoolInt CPU_IsSupported_CRC32(void);
BoolInt CPU_IsSupported_NEON(void);
#if defined(_WIN32)
BoolInt CPU_IsSupported_CRYPTO(void);
#define CPU_IsSupported_SHA1 CPU_IsSupported_CRYPTO
#define CPU_IsSupported_SHA2 CPU_IsSupported_CRYPTO
#define CPU_IsSupported_AES CPU_IsSupported_CRYPTO
#else
BoolInt CPU_IsSupported_SHA1(void);
BoolInt CPU_IsSupported_SHA2(void);
BoolInt CPU_IsSupported_AES(void);
#endif
#endif
#if defined(__APPLE__)
int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
#endif
EXTERN_C_END
#endif

View file

@ -1,169 +0,0 @@
/* Delta.c -- Delta converter
2021-02-09 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Delta.h"
void Delta_Init(Byte *state)
{
unsigned i;
for (i = 0; i < DELTA_STATE_SIZE; i++)
state[i] = 0;
}
void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size)
{
Byte temp[DELTA_STATE_SIZE];
if (size == 0)
return;
{
unsigned i = 0;
do
temp[i] = state[i];
while (++i != delta);
}
if (size <= delta)
{
unsigned i = 0, k;
do
{
Byte b = *data;
*data++ = (Byte)(b - temp[i]);
temp[i] = b;
}
while (++i != size);
k = 0;
do
{
if (i == delta)
i = 0;
state[k] = temp[i++];
}
while (++k != delta);
return;
}
{
Byte *p = data + size - delta;
{
unsigned i = 0;
do
state[i] = *p++;
while (++i != delta);
}
{
const Byte *lim = data + delta;
ptrdiff_t dif = -(ptrdiff_t)delta;
if (((ptrdiff_t)size + dif) & 1)
{
--p; *p = (Byte)(*p - p[dif]);
}
while (p != lim)
{
--p; *p = (Byte)(*p - p[dif]);
--p; *p = (Byte)(*p - p[dif]);
}
dif = -dif;
do
{
--p; *p = (Byte)(*p - temp[--dif]);
}
while (dif != 0);
}
}
}
void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size)
{
unsigned i;
const Byte *lim;
if (size == 0)
return;
i = 0;
lim = data + size;
if (size <= delta)
{
do
*data = (Byte)(*data + state[i++]);
while (++data != lim);
for (; delta != i; state++, delta--)
*state = state[i];
data -= i;
}
else
{
/*
#define B(n) b ## n
#define I(n) Byte B(n) = state[n];
#define U(n) { B(n) = (Byte)((B(n)) + *data++); data[-1] = (B(n)); }
#define F(n) if (data != lim) { U(n) }
if (delta == 1)
{
I(0)
if ((lim - data) & 1) { U(0) }
while (data != lim) { U(0) U(0) }
data -= 1;
}
else if (delta == 2)
{
I(0) I(1)
lim -= 1; while (data < lim) { U(0) U(1) }
lim += 1; F(0)
data -= 2;
}
else if (delta == 3)
{
I(0) I(1) I(2)
lim -= 2; while (data < lim) { U(0) U(1) U(2) }
lim += 2; F(0) F(1)
data -= 3;
}
else if (delta == 4)
{
I(0) I(1) I(2) I(3)
lim -= 3; while (data < lim) { U(0) U(1) U(2) U(3) }
lim += 3; F(0) F(1) F(2)
data -= 4;
}
else
*/
{
do
{
*data = (Byte)(*data + state[i++]);
data++;
}
while (i != delta);
{
ptrdiff_t dif = -(ptrdiff_t)delta;
do
*data = (Byte)(*data + data[dif]);
while (++data != lim);
data += dif;
}
}
}
do
*state++ = *data;
while (++data != lim);
}

View file

@ -1,19 +0,0 @@
/* Delta.h -- Delta converter
2023-03-03 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_DELTA_H
#define ZIP7_INC_DELTA_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define DELTA_STATE_SIZE 256
void Delta_Init(Byte *state);
void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size);
void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size);
EXTERN_C_END
#endif

View file

@ -1,111 +0,0 @@
/* DllSecur.c -- DLL loading security
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#ifdef _WIN32
#include "7zWindows.h"
#include "DllSecur.h"
#ifndef UNDER_CE
#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
// #pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#if defined(__clang__) || defined(__GNUC__)
typedef void (*Z7_voidFunction)(void);
#define MY_CAST_FUNC (Z7_voidFunction)
#elif defined(_MSC_VER) && _MSC_VER > 1920
#define MY_CAST_FUNC (void *)
// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
#else
#define MY_CAST_FUNC
#endif
typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
#define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
#define MY_LOAD_LIBRARY_SEARCH_SYSTEM32 0x800
#define DELIM "\0"
static const char * const g_Dlls =
"userenv"
DELIM "setupapi"
DELIM "apphelp"
DELIM "propsys"
DELIM "dwmapi"
DELIM "cryptbase"
DELIM "oleacc"
DELIM "clbcatq"
DELIM "version"
#ifndef _CONSOLE
DELIM "uxtheme"
#endif
DELIM;
#endif
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1900
// sysinfoapi.h: kit10: GetVersion was declared deprecated
#pragma warning(disable : 4996)
#endif
#define IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN \
if ((UInt16)GetVersion() != 6) { \
const \
Func_SetDefaultDllDirectories setDllDirs = \
(Func_SetDefaultDllDirectories) MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), \
"SetDefaultDllDirectories"); \
if (setDllDirs) if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS)) return; }
void My_SetDefaultDllDirectories(void)
{
#ifndef UNDER_CE
IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN
#endif
}
void LoadSecurityDlls(void)
{
#ifndef UNDER_CE
// at Vista (ver 6.0) : CoCreateInstance(CLSID_ShellLink, ...) doesn't work after SetDefaultDllDirectories() : Check it ???
IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN
{
wchar_t buf[MAX_PATH + 100];
const char *dll;
unsigned pos = GetSystemDirectoryW(buf, MAX_PATH + 2);
if (pos == 0 || pos > MAX_PATH)
return;
if (buf[pos - 1] != '\\')
buf[pos++] = '\\';
for (dll = g_Dlls; *dll != 0;)
{
wchar_t *dest = &buf[pos];
for (;;)
{
const char c = *dll++;
if (c == 0)
break;
*dest++ = (Byte)c;
}
dest[0] = '.';
dest[1] = 'd';
dest[2] = 'l';
dest[3] = 'l';
dest[4] = 0;
// lstrcatW(buf, L".dll");
LoadLibraryExW(buf, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
}
#endif
}
#endif // _WIN32

View file

@ -1,20 +0,0 @@
/* DllSecur.h -- DLL loading for security
2023-03-03 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_DLL_SECUR_H
#define ZIP7_INC_DLL_SECUR_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#ifdef _WIN32
void My_SetDefaultDllDirectories(void);
void LoadSecurityDlls(void);
#endif
EXTERN_C_END
#endif

View file

@ -1,154 +0,0 @@
/* HuffEnc.c -- functions for Huffman encoding
2023-03-04 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "HuffEnc.h"
#include "Sort.h"
#define kMaxLen 16
#define NUM_BITS 10
#define MASK (((unsigned)1 << NUM_BITS) - 1)
#define NUM_COUNTERS 64
#define HUFFMAN_SPEED_OPT
void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymbols, UInt32 maxLen)
{
UInt32 num = 0;
/* if (maxLen > 10) maxLen = 10; */
{
UInt32 i;
#ifdef HUFFMAN_SPEED_OPT
UInt32 counters[NUM_COUNTERS];
for (i = 0; i < NUM_COUNTERS; i++)
counters[i] = 0;
for (i = 0; i < numSymbols; i++)
{
UInt32 freq = freqs[i];
counters[(freq < NUM_COUNTERS - 1) ? freq : NUM_COUNTERS - 1]++;
}
for (i = 1; i < NUM_COUNTERS; i++)
{
UInt32 temp = counters[i];
counters[i] = num;
num += temp;
}
for (i = 0; i < numSymbols; i++)
{
UInt32 freq = freqs[i];
if (freq == 0)
lens[i] = 0;
else
p[counters[((freq < NUM_COUNTERS - 1) ? freq : NUM_COUNTERS - 1)]++] = i | (freq << NUM_BITS);
}
counters[0] = 0;
HeapSort(p + counters[NUM_COUNTERS - 2], counters[NUM_COUNTERS - 1] - counters[NUM_COUNTERS - 2]);
#else
for (i = 0; i < numSymbols; i++)
{
UInt32 freq = freqs[i];
if (freq == 0)
lens[i] = 0;
else
p[num++] = i | (freq << NUM_BITS);
}
HeapSort(p, num);
#endif
}
if (num < 2)
{
unsigned minCode = 0;
unsigned maxCode = 1;
if (num == 1)
{
maxCode = (unsigned)p[0] & MASK;
if (maxCode == 0)
maxCode++;
}
p[minCode] = 0;
p[maxCode] = 1;
lens[minCode] = lens[maxCode] = 1;
return;
}
{
UInt32 b, e, i;
i = b = e = 0;
do
{
UInt32 n, m, freq;
n = (i != num && (b == e || (p[i] >> NUM_BITS) <= (p[b] >> NUM_BITS))) ? i++ : b++;
freq = (p[n] & ~MASK);
p[n] = (p[n] & MASK) | (e << NUM_BITS);
m = (i != num && (b == e || (p[i] >> NUM_BITS) <= (p[b] >> NUM_BITS))) ? i++ : b++;
freq += (p[m] & ~MASK);
p[m] = (p[m] & MASK) | (e << NUM_BITS);
p[e] = (p[e] & MASK) | freq;
e++;
}
while (num - e > 1);
{
UInt32 lenCounters[kMaxLen + 1];
for (i = 0; i <= kMaxLen; i++)
lenCounters[i] = 0;
p[--e] &= MASK;
lenCounters[1] = 2;
while (e != 0)
{
UInt32 len = (p[p[--e] >> NUM_BITS] >> NUM_BITS) + 1;
p[e] = (p[e] & MASK) | (len << NUM_BITS);
if (len >= maxLen)
for (len = maxLen - 1; lenCounters[len] == 0; len--);
lenCounters[len]--;
lenCounters[(size_t)len + 1] += 2;
}
{
UInt32 len;
i = 0;
for (len = maxLen; len != 0; len--)
{
UInt32 k;
for (k = lenCounters[len]; k != 0; k--)
lens[p[i++] & MASK] = (Byte)len;
}
}
{
UInt32 nextCodes[kMaxLen + 1];
{
UInt32 code = 0;
UInt32 len;
for (len = 1; len <= kMaxLen; len++)
nextCodes[len] = code = (code + lenCounters[(size_t)len - 1]) << 1;
}
/* if (code + lenCounters[kMaxLen] - 1 != (1 << kMaxLen) - 1) throw 1; */
{
UInt32 k;
for (k = 0; k < numSymbols; k++)
p[k] = nextCodes[lens[k]]++;
}
}
}
}
}
#undef kMaxLen
#undef NUM_BITS
#undef MASK
#undef NUM_COUNTERS
#undef HUFFMAN_SPEED_OPT

View file

@ -1,23 +0,0 @@
/* HuffEnc.h -- Huffman encoding
2023-03-05 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_HUFF_ENC_H
#define ZIP7_INC_HUFF_ENC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
/*
Conditions:
num <= 1024 = 2 ^ NUM_BITS
Sum(freqs) < 4M = 2 ^ (32 - NUM_BITS)
maxLen <= 16 = kMaxLen
Num_Items(p) >= HUFFMAN_TEMP_SIZE(num)
*/
void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 num, UInt32 maxLen);
EXTERN_C_END
#endif

1717
3rdparty/7z/src/LzFind.c vendored

File diff suppressed because it is too large Load diff

View file

@ -1,159 +0,0 @@
/* LzFind.h -- Match finder for LZ algorithms
2023-03-04 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZ_FIND_H
#define ZIP7_INC_LZ_FIND_H
#include "7zTypes.h"
EXTERN_C_BEGIN
typedef UInt32 CLzRef;
typedef struct
{
const Byte *buffer;
UInt32 pos;
UInt32 posLimit;
UInt32 streamPos; /* wrap over Zero is allowed (streamPos < pos). Use (UInt32)(streamPos - pos) */
UInt32 lenLimit;
UInt32 cyclicBufferPos;
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
Byte streamEndWasReached;
Byte btMode;
Byte bigHash;
Byte directInput;
UInt32 matchMaxLen;
CLzRef *hash;
CLzRef *son;
UInt32 hashMask;
UInt32 cutValue;
Byte *bufBase;
ISeqInStreamPtr stream;
UInt32 blockSize;
UInt32 keepSizeBefore;
UInt32 keepSizeAfter;
UInt32 numHashBytes;
size_t directInputRem;
UInt32 historySize;
UInt32 fixedHashSize;
Byte numHashBytes_Min;
Byte numHashOutBits;
Byte _pad2_[2];
SRes result;
UInt32 crc[256];
size_t numRefs;
UInt64 expectedDataSize;
} CMatchFinder;
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((const Byte *)(p)->buffer)
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((UInt32)((p)->streamPos - (p)->pos))
/*
#define Inline_MatchFinder_IsFinishedOK(p) \
((p)->streamEndWasReached \
&& (p)->streamPos == (p)->pos \
&& (!(p)->directInput || (p)->directInputRem == 0))
*/
int MatchFinder_NeedMove(CMatchFinder *p);
/* Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); */
void MatchFinder_MoveBlock(CMatchFinder *p);
void MatchFinder_ReadIfRequired(CMatchFinder *p);
void MatchFinder_Construct(CMatchFinder *p);
/* (directInput = 0) is default value.
It's required to provide correct (directInput) value
before calling MatchFinder_Create().
You can set (directInput) by any of the following calls:
- MatchFinder_SET_DIRECT_INPUT_BUF()
- MatchFinder_SET_STREAM()
- MatchFinder_SET_STREAM_MODE()
*/
#define MatchFinder_SET_DIRECT_INPUT_BUF(p, _src_, _srcLen_) { \
(p)->stream = NULL; \
(p)->directInput = 1; \
(p)->buffer = (_src_); \
(p)->directInputRem = (_srcLen_); }
/*
#define MatchFinder_SET_STREAM_MODE(p) { \
(p)->directInput = 0; }
*/
#define MatchFinder_SET_STREAM(p, _stream_) { \
(p)->stream = _stream_; \
(p)->directInput = 0; }
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
ISzAllocPtr alloc);
void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
/*
#define MatchFinder_INIT_POS(p, val) \
(p)->pos = (val); \
(p)->streamPos = (val);
*/
// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
#define MatchFinder_REDUCE_OFFSETS(p, subValue) \
(p)->pos -= (subValue); \
(p)->streamPos -= (subValue);
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
UInt32 *distances, UInt32 maxLen);
/*
Conditions:
Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
*/
typedef void (*Mf_Init_Func)(void *object);
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
typedef UInt32 * (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
typedef void (*Mf_Skip_Func)(void *object, UInt32);
typedef struct
{
Mf_Init_Func Init;
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
Mf_GetMatches_Func GetMatches;
Mf_Skip_Func Skip;
} IMatchFinder2;
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder2 *vTable);
void MatchFinder_Init_LowHash(CMatchFinder *p);
void MatchFinder_Init_HighHash(CMatchFinder *p);
void MatchFinder_Init_4(CMatchFinder *p);
void MatchFinder_Init(CMatchFinder *p);
UInt32* Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
UInt32* Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
void LzFindPrepare(void);
EXTERN_C_END
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,109 +0,0 @@
/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
2023-03-05 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZ_FIND_MT_H
#define ZIP7_INC_LZ_FIND_MT_H
#include "LzFind.h"
#include "Threads.h"
EXTERN_C_BEGIN
typedef struct
{
UInt32 numProcessedBlocks;
CThread thread;
UInt64 affinity;
BoolInt wasCreated;
BoolInt needStart;
BoolInt csWasInitialized;
BoolInt csWasEntered;
BoolInt exit;
BoolInt stopWriting;
CAutoResetEvent canStart;
CAutoResetEvent wasStopped;
CSemaphore freeSemaphore;
CSemaphore filledSemaphore;
CCriticalSection cs;
// UInt32 numBlocks_Sent;
} CMtSync;
typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
#define kMtCacheLineDummy 128
typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);
typedef struct
{
/* LZ */
const Byte *pointerToCurPos;
UInt32 *btBuf;
const UInt32 *btBufPos;
const UInt32 *btBufPosLimit;
UInt32 lzPos;
UInt32 btNumAvailBytes;
UInt32 *hash;
UInt32 fixedHashSize;
// UInt32 hash4Mask;
UInt32 historySize;
const UInt32 *crc;
Mf_Mix_Matches MixMatchesFunc;
UInt32 failure_LZ_BT; // failure in BT transfered to LZ
// UInt32 failure_LZ_LZ; // failure in LZ tables
UInt32 failureBuf[1];
// UInt32 crc[256];
/* LZ + BT */
CMtSync btSync;
Byte btDummy[kMtCacheLineDummy];
/* BT */
UInt32 *hashBuf;
UInt32 hashBufPos;
UInt32 hashBufPosLimit;
UInt32 hashNumAvail;
UInt32 failure_BT;
CLzRef *son;
UInt32 matchMaxLen;
UInt32 numHashBytes;
UInt32 pos;
const Byte *buffer;
UInt32 cyclicBufferPos;
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
UInt32 cutValue;
/* BT + Hash */
CMtSync hashSync;
/* Byte hashDummy[kMtCacheLineDummy]; */
/* Hash */
Mf_GetHeads GetHeadsFunc;
CMatchFinder *MatchFinder;
// CMatchFinder MatchFinder;
} CMatchFinderMt;
// only for Mt part
void MatchFinderMt_Construct(CMatchFinderMt *p);
void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc);
SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc);
void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder2 *vTable);
/* call MatchFinderMt_InitMt() before IMatchFinder::Init() */
SRes MatchFinderMt_InitMt(CMatchFinderMt *p);
void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
EXTERN_C_END
#endif

View file

@ -1,578 +0,0 @@
/* LzFindOpt.c -- multithreaded Match finder for LZ algorithms
2023-04-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "CpuArch.h"
#include "LzFind.h"
// #include "LzFindMt.h"
// #define LOG_ITERS
// #define LOG_THREAD
#ifdef LOG_THREAD
#include <stdio.h>
#define PRF(x) x
#else
// #define PRF(x)
#endif
#ifdef LOG_ITERS
#include <stdio.h>
UInt64 g_NumIters_Tree;
UInt64 g_NumIters_Loop;
UInt64 g_NumIters_Bytes;
#define LOG_ITER(x) x
#else
#define LOG_ITER(x)
#endif
// ---------- BT THREAD ----------
#define USE_SON_PREFETCH
#define USE_LONG_MATCH_OPT
#define kEmptyHashValue 0
// #define CYC_TO_POS_OFFSET 0
// #define CYC_TO_POS_OFFSET 1 // for debug
/*
Z7_NO_INLINE
UInt32 * Z7_FASTCALL GetMatchesSpecN_1(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size, UInt32 *posRes)
{
do
{
UInt32 delta;
if (hash == size)
break;
delta = *hash++;
if (delta == 0 || delta > (UInt32)pos)
return NULL;
lenLimit++;
if (delta == (UInt32)pos)
{
CLzRef *ptr1 = son + ((size_t)pos << 1) - CYC_TO_POS_OFFSET * 2;
*d++ = 0;
ptr1[0] = kEmptyHashValue;
ptr1[1] = kEmptyHashValue;
}
else
{
UInt32 *_distances = ++d;
CLzRef *ptr0 = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2 + 1;
CLzRef *ptr1 = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
const Byte *len0 = cur, *len1 = cur;
UInt32 cutValue = _cutValue;
const Byte *maxLen = cur + _maxLen;
for (LOG_ITER(g_NumIters_Tree++);;)
{
LOG_ITER(g_NumIters_Loop++);
{
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
CLzRef *pair = son + ((size_t)(((ptrdiff_t)pos - CYC_TO_POS_OFFSET) + diff) << 1);
const Byte *len = (len0 < len1 ? len0 : len1);
#ifdef USE_SON_PREFETCH
const UInt32 pair0 = *pair;
#endif
if (len[diff] == len[0])
{
if (++len != lenLimit && len[diff] == len[0])
while (++len != lenLimit)
{
LOG_ITER(g_NumIters_Bytes++);
if (len[diff] != len[0])
break;
}
if (maxLen < len)
{
maxLen = len;
*d++ = (UInt32)(len - cur);
*d++ = delta - 1;
if (len == lenLimit)
{
const UInt32 pair1 = pair[1];
*ptr1 =
#ifdef USE_SON_PREFETCH
pair0;
#else
pair[0];
#endif
*ptr0 = pair1;
_distances[-1] = (UInt32)(d - _distances);
#ifdef USE_LONG_MATCH_OPT
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
break;
{
for (;;)
{
hash++;
pos++;
cur++;
lenLimit++;
{
CLzRef *ptr = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
#if 0
*(UInt64 *)(void *)ptr = ((const UInt64 *)(const void *)ptr)[diff];
#else
const UInt32 p0 = ptr[0 + (diff * 2)];
const UInt32 p1 = ptr[1 + (diff * 2)];
ptr[0] = p0;
ptr[1] = p1;
// ptr[0] = ptr[0 + (diff * 2)];
// ptr[1] = ptr[1 + (diff * 2)];
#endif
}
// PrintSon(son + 2, pos - 1);
// printf("\npos = %x delta = %x\n", pos, delta);
len++;
*d++ = 2;
*d++ = (UInt32)(len - cur);
*d++ = delta - 1;
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
break;
}
}
#endif
break;
}
}
}
{
const UInt32 curMatch = (UInt32)pos - delta; // (UInt32)(pos + diff);
if (len[diff] < len[0])
{
delta = pair[1];
if (delta >= curMatch)
return NULL;
*ptr1 = curMatch;
ptr1 = pair + 1;
len1 = len;
}
else
{
delta = *pair;
if (delta >= curMatch)
return NULL;
*ptr0 = curMatch;
ptr0 = pair;
len0 = len;
}
delta = (UInt32)pos - delta;
if (--cutValue == 0 || delta >= pos)
{
*ptr0 = *ptr1 = kEmptyHashValue;
_distances[-1] = (UInt32)(d - _distances);
break;
}
}
}
} // for (tree iterations)
}
pos++;
cur++;
}
while (d < limit);
*posRes = (UInt32)pos;
return d;
}
*/
/* define cbs if you use 2 functions.
GetMatchesSpecN_1() : (pos < _cyclicBufferSize)
GetMatchesSpecN_2() : (pos >= _cyclicBufferSize)
do not define cbs if you use 1 function:
GetMatchesSpecN_2()
*/
// #define cbs _cyclicBufferSize
/*
we use size_t for (pos) and (_cyclicBufferPos_ instead of UInt32
to eliminate "movsx" BUG in old MSVC x64 compiler.
*/
UInt32 * Z7_FASTCALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes);
Z7_NO_INLINE
UInt32 * Z7_FASTCALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes)
{
do // while (hash != size)
{
UInt32 delta;
#ifndef cbs
UInt32 cbs;
#endif
if (hash == size)
break;
delta = *hash++;
if (delta == 0)
return NULL;
lenLimit++;
#ifndef cbs
cbs = _cyclicBufferSize;
if ((UInt32)pos < cbs)
{
if (delta > (UInt32)pos)
return NULL;
cbs = (UInt32)pos;
}
#endif
if (delta >= cbs)
{
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
*d++ = 0;
ptr1[0] = kEmptyHashValue;
ptr1[1] = kEmptyHashValue;
}
else
{
UInt32 *_distances = ++d;
CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
UInt32 cutValue = _cutValue;
const Byte *len0 = cur, *len1 = cur;
const Byte *maxLen = cur + _maxLen;
// if (cutValue == 0) { *ptr0 = *ptr1 = kEmptyHashValue; } else
for (LOG_ITER(g_NumIters_Tree++);;)
{
LOG_ITER(g_NumIters_Loop++);
{
// SPEC code
CLzRef *pair = son + ((size_t)((ptrdiff_t)_cyclicBufferPos - (ptrdiff_t)delta
+ (ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)
) << 1);
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
const Byte *len = (len0 < len1 ? len0 : len1);
#ifdef USE_SON_PREFETCH
const UInt32 pair0 = *pair;
#endif
if (len[diff] == len[0])
{
if (++len != lenLimit && len[diff] == len[0])
while (++len != lenLimit)
{
LOG_ITER(g_NumIters_Bytes++);
if (len[diff] != len[0])
break;
}
if (maxLen < len)
{
maxLen = len;
*d++ = (UInt32)(len - cur);
*d++ = delta - 1;
if (len == lenLimit)
{
const UInt32 pair1 = pair[1];
*ptr1 =
#ifdef USE_SON_PREFETCH
pair0;
#else
pair[0];
#endif
*ptr0 = pair1;
_distances[-1] = (UInt32)(d - _distances);
#ifdef USE_LONG_MATCH_OPT
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
break;
{
for (;;)
{
*d++ = 2;
*d++ = (UInt32)(lenLimit - cur);
*d++ = delta - 1;
cur++;
lenLimit++;
// SPEC
_cyclicBufferPos++;
{
// SPEC code
CLzRef *dest = son + ((size_t)(_cyclicBufferPos) << 1);
const CLzRef *src = dest + ((diff
+ (ptrdiff_t)(UInt32)((_cyclicBufferPos < delta) ? cbs : 0)) << 1);
// CLzRef *ptr = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
#if 0
*(UInt64 *)(void *)dest = *((const UInt64 *)(const void *)src);
#else
const UInt32 p0 = src[0];
const UInt32 p1 = src[1];
dest[0] = p0;
dest[1] = p1;
#endif
}
pos++;
hash++;
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
break;
} // for() end for long matches
}
#endif
break; // break from TREE iterations
}
}
}
{
const UInt32 curMatch = (UInt32)pos - delta; // (UInt32)(pos + diff);
if (len[diff] < len[0])
{
delta = pair[1];
*ptr1 = curMatch;
ptr1 = pair + 1;
len1 = len;
if (delta >= curMatch)
return NULL;
}
else
{
delta = *pair;
*ptr0 = curMatch;
ptr0 = pair;
len0 = len;
if (delta >= curMatch)
return NULL;
}
delta = (UInt32)pos - delta;
if (--cutValue == 0 || delta >= cbs)
{
*ptr0 = *ptr1 = kEmptyHashValue;
_distances[-1] = (UInt32)(d - _distances);
break;
}
}
}
} // for (tree iterations)
}
pos++;
_cyclicBufferPos++;
cur++;
}
while (d < limit);
*posRes = (UInt32)pos;
return d;
}
/*
typedef UInt32 uint32plus; // size_t
UInt32 * Z7_FASTCALL GetMatchesSpecN_3(uint32plus lenLimit, size_t pos, const Byte *cur, CLzRef *son,
UInt32 _cutValue, UInt32 *d, uint32plus _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
UInt32 *posRes)
{
do // while (hash != size)
{
UInt32 delta;
#ifndef cbs
UInt32 cbs;
#endif
if (hash == size)
break;
delta = *hash++;
if (delta == 0)
return NULL;
#ifndef cbs
cbs = _cyclicBufferSize;
if ((UInt32)pos < cbs)
{
if (delta > (UInt32)pos)
return NULL;
cbs = (UInt32)pos;
}
#endif
if (delta >= cbs)
{
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
*d++ = 0;
ptr1[0] = kEmptyHashValue;
ptr1[1] = kEmptyHashValue;
}
else
{
CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
UInt32 *_distances = ++d;
uint32plus len0 = 0, len1 = 0;
UInt32 cutValue = _cutValue;
uint32plus maxLen = _maxLen;
// lenLimit++; // const Byte *lenLimit = cur + _lenLimit;
for (LOG_ITER(g_NumIters_Tree++);;)
{
LOG_ITER(g_NumIters_Loop++);
{
// const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
CLzRef *pair = son + ((size_t)((ptrdiff_t)_cyclicBufferPos - delta
+ (ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)
) << 1);
const Byte *pb = cur - delta;
uint32plus len = (len0 < len1 ? len0 : len1);
#ifdef USE_SON_PREFETCH
const UInt32 pair0 = *pair;
#endif
if (pb[len] == cur[len])
{
if (++len != lenLimit && pb[len] == cur[len])
while (++len != lenLimit)
if (pb[len] != cur[len])
break;
if (maxLen < len)
{
maxLen = len;
*d++ = (UInt32)len;
*d++ = delta - 1;
if (len == lenLimit)
{
{
const UInt32 pair1 = pair[1];
*ptr0 = pair1;
*ptr1 =
#ifdef USE_SON_PREFETCH
pair0;
#else
pair[0];
#endif
}
_distances[-1] = (UInt32)(d - _distances);
#ifdef USE_LONG_MATCH_OPT
if (hash == size || *hash != delta || pb[lenLimit] != cur[lenLimit] || d >= limit)
break;
{
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
for (;;)
{
*d++ = 2;
*d++ = (UInt32)lenLimit;
*d++ = delta - 1;
_cyclicBufferPos++;
{
CLzRef *dest = son + ((size_t)_cyclicBufferPos << 1);
const CLzRef *src = dest + ((diff +
(ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)) << 1);
#if 0
*(UInt64 *)(void *)dest = *((const UInt64 *)(const void *)src);
#else
const UInt32 p0 = src[0];
const UInt32 p1 = src[1];
dest[0] = p0;
dest[1] = p1;
#endif
}
hash++;
pos++;
cur++;
pb++;
if (hash == size || *hash != delta || pb[lenLimit] != cur[lenLimit] || d >= limit)
break;
}
}
#endif
break;
}
}
}
{
const UInt32 curMatch = (UInt32)pos - delta;
if (pb[len] < cur[len])
{
delta = pair[1];
*ptr1 = curMatch;
ptr1 = pair + 1;
len1 = len;
}
else
{
delta = *pair;
*ptr0 = curMatch;
ptr0 = pair;
len0 = len;
}
{
if (delta >= curMatch)
return NULL;
delta = (UInt32)pos - delta;
if (delta >= cbs
// delta >= _cyclicBufferSize || delta >= pos
|| --cutValue == 0)
{
*ptr0 = *ptr1 = kEmptyHashValue;
_distances[-1] = (UInt32)(d - _distances);
break;
}
}
}
}
} // for (tree iterations)
}
pos++;
_cyclicBufferPos++;
cur++;
}
while (d < limit);
*posRes = (UInt32)pos;
return d;
}
*/

View file

@ -1,34 +0,0 @@
/* LzHash.h -- HASH constants for LZ algorithms
2023-03-05 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZ_HASH_H
#define ZIP7_INC_LZ_HASH_H
/*
(kHash2Size >= (1 << 8)) : Required
(kHash3Size >= (1 << 16)) : Required
*/
#define kHash2Size (1 << 10)
#define kHash3Size (1 << 16)
// #define kHash4Size (1 << 20)
#define kFix3HashSize (kHash2Size)
#define kFix4HashSize (kHash2Size + kHash3Size)
// #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
/*
We use up to 3 crc values for hash:
crc0
crc1 << Shift_1
crc2 << Shift_2
(Shift_1 = 5) and (Shift_2 = 10) is good tradeoff.
Small values for Shift are not good for collision rate.
Big value for Shift_2 increases the minimum size
of hash table, that will be slow for small files.
*/
#define kLzHash_CrcShift_1 5
#define kLzHash_CrcShift_2 10
#endif

View file

@ -1,491 +0,0 @@
/* Lzma2Dec.c -- LZMA2 Decoder
2023-03-03 : Igor Pavlov : Public domain */
/* #define SHOW_DEBUG_INFO */
#include "Precomp.h"
#ifdef SHOW_DEBUG_INFO
#include <stdio.h>
#endif
#include <string.h>
#include "Lzma2Dec.h"
/*
00000000 - End of data
00000001 U U - Uncompressed, reset dic, need reset state and set new prop
00000010 U U - Uncompressed, no reset
100uuuuu U U P P - LZMA, no reset
101uuuuu U U P P - LZMA, reset state
110uuuuu U U P P S - LZMA, reset state + set new prop
111uuuuu U U P P S - LZMA, reset state + set new prop, reset dic
u, U - Unpack Size
P - Pack Size
S - Props
*/
#define LZMA2_CONTROL_COPY_RESET_DIC 1
#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & (1 << 7)) == 0)
#define LZMA2_LCLP_MAX 4
#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11))
#ifdef SHOW_DEBUG_INFO
#define PRF(x) x
#else
#define PRF(x)
#endif
typedef enum
{
LZMA2_STATE_CONTROL,
LZMA2_STATE_UNPACK0,
LZMA2_STATE_UNPACK1,
LZMA2_STATE_PACK0,
LZMA2_STATE_PACK1,
LZMA2_STATE_PROP,
LZMA2_STATE_DATA,
LZMA2_STATE_DATA_CONT,
LZMA2_STATE_FINISHED,
LZMA2_STATE_ERROR
} ELzma2State;
static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props)
{
UInt32 dicSize;
if (prop > 40)
return SZ_ERROR_UNSUPPORTED;
dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop);
props[0] = (Byte)LZMA2_LCLP_MAX;
props[1] = (Byte)(dicSize);
props[2] = (Byte)(dicSize >> 8);
props[3] = (Byte)(dicSize >> 16);
props[4] = (Byte)(dicSize >> 24);
return SZ_OK;
}
SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
{
Byte props[LZMA_PROPS_SIZE];
RINOK(Lzma2Dec_GetOldProps(prop, props))
return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc);
}
SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
{
Byte props[LZMA_PROPS_SIZE];
RINOK(Lzma2Dec_GetOldProps(prop, props))
return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc);
}
void Lzma2Dec_Init(CLzma2Dec *p)
{
p->state = LZMA2_STATE_CONTROL;
p->needInitLevel = 0xE0;
p->isExtraMode = False;
p->unpackSize = 0;
// p->decoder.dicPos = 0; // we can use it instead of full init
LzmaDec_Init(&p->decoder);
}
// ELzma2State
static unsigned Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b)
{
switch (p->state)
{
case LZMA2_STATE_CONTROL:
p->isExtraMode = False;
p->control = b;
PRF(printf("\n %8X", (unsigned)p->decoder.dicPos));
PRF(printf(" %02X", (unsigned)b));
if (b == 0)
return LZMA2_STATE_FINISHED;
if (LZMA2_IS_UNCOMPRESSED_STATE(p))
{
if (b == LZMA2_CONTROL_COPY_RESET_DIC)
p->needInitLevel = 0xC0;
else if (b > 2 || p->needInitLevel == 0xE0)
return LZMA2_STATE_ERROR;
}
else
{
if (b < p->needInitLevel)
return LZMA2_STATE_ERROR;
p->needInitLevel = 0;
p->unpackSize = (UInt32)(b & 0x1F) << 16;
}
return LZMA2_STATE_UNPACK0;
case LZMA2_STATE_UNPACK0:
p->unpackSize |= (UInt32)b << 8;
return LZMA2_STATE_UNPACK1;
case LZMA2_STATE_UNPACK1:
p->unpackSize |= (UInt32)b;
p->unpackSize++;
PRF(printf(" %7u", (unsigned)p->unpackSize));
return LZMA2_IS_UNCOMPRESSED_STATE(p) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0;
case LZMA2_STATE_PACK0:
p->packSize = (UInt32)b << 8;
return LZMA2_STATE_PACK1;
case LZMA2_STATE_PACK1:
p->packSize |= (UInt32)b;
p->packSize++;
// if (p->packSize < 5) return LZMA2_STATE_ERROR;
PRF(printf(" %5u", (unsigned)p->packSize));
return (p->control & 0x40) ? LZMA2_STATE_PROP : LZMA2_STATE_DATA;
case LZMA2_STATE_PROP:
{
unsigned lc, lp;
if (b >= (9 * 5 * 5))
return LZMA2_STATE_ERROR;
lc = b % 9;
b /= 9;
p->decoder.prop.pb = (Byte)(b / 5);
lp = b % 5;
if (lc + lp > LZMA2_LCLP_MAX)
return LZMA2_STATE_ERROR;
p->decoder.prop.lc = (Byte)lc;
p->decoder.prop.lp = (Byte)lp;
return LZMA2_STATE_DATA;
}
}
return LZMA2_STATE_ERROR;
}
static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size)
{
memcpy(p->dic + p->dicPos, src, size);
p->dicPos += size;
if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size)
p->checkDicSize = p->prop.dicSize;
p->processedPos += (UInt32)size;
}
void LzmaDec_InitDicAndState(CLzmaDec *p, BoolInt initDic, BoolInt initState);
SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
{
SizeT inSize = *srcLen;
*srcLen = 0;
*status = LZMA_STATUS_NOT_SPECIFIED;
while (p->state != LZMA2_STATE_ERROR)
{
SizeT dicPos;
if (p->state == LZMA2_STATE_FINISHED)
{
*status = LZMA_STATUS_FINISHED_WITH_MARK;
return SZ_OK;
}
dicPos = p->decoder.dicPos;
if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY)
{
*status = LZMA_STATUS_NOT_FINISHED;
return SZ_OK;
}
if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT)
{
if (*srcLen == inSize)
{
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
(*srcLen)++;
p->state = Lzma2Dec_UpdateState(p, *src++);
if (dicPos == dicLimit && p->state != LZMA2_STATE_FINISHED)
break;
continue;
}
{
SizeT inCur = inSize - *srcLen;
SizeT outCur = dicLimit - dicPos;
ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY;
if (outCur >= p->unpackSize)
{
outCur = (SizeT)p->unpackSize;
curFinishMode = LZMA_FINISH_END;
}
if (LZMA2_IS_UNCOMPRESSED_STATE(p))
{
if (inCur == 0)
{
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
return SZ_OK;
}
if (p->state == LZMA2_STATE_DATA)
{
BoolInt initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC);
LzmaDec_InitDicAndState(&p->decoder, initDic, False);
}
if (inCur > outCur)
inCur = outCur;
if (inCur == 0)
break;
LzmaDec_UpdateWithUncompressed(&p->decoder, src, inCur);
src += inCur;
*srcLen += inCur;
p->unpackSize -= (UInt32)inCur;
p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT;
}
else
{
SRes res;
if (p->state == LZMA2_STATE_DATA)
{
BoolInt initDic = (p->control >= 0xE0);
BoolInt initState = (p->control >= 0xA0);
LzmaDec_InitDicAndState(&p->decoder, initDic, initState);
p->state = LZMA2_STATE_DATA_CONT;
}
if (inCur > p->packSize)
inCur = (SizeT)p->packSize;
res = LzmaDec_DecodeToDic(&p->decoder, dicPos + outCur, src, &inCur, curFinishMode, status);
src += inCur;
*srcLen += inCur;
p->packSize -= (UInt32)inCur;
outCur = p->decoder.dicPos - dicPos;
p->unpackSize -= (UInt32)outCur;
if (res != 0)
break;
if (*status == LZMA_STATUS_NEEDS_MORE_INPUT)
{
if (p->packSize == 0)
break;
return SZ_OK;
}
if (inCur == 0 && outCur == 0)
{
if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|| p->unpackSize != 0
|| p->packSize != 0)
break;
p->state = LZMA2_STATE_CONTROL;
}
*status = LZMA_STATUS_NOT_SPECIFIED;
}
}
}
*status = LZMA_STATUS_NOT_SPECIFIED;
p->state = LZMA2_STATE_ERROR;
return SZ_ERROR_DATA;
}
ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
SizeT outSize,
const Byte *src, SizeT *srcLen,
int checkFinishBlock)
{
SizeT inSize = *srcLen;
*srcLen = 0;
while (p->state != LZMA2_STATE_ERROR)
{
if (p->state == LZMA2_STATE_FINISHED)
return (ELzma2ParseStatus)LZMA_STATUS_FINISHED_WITH_MARK;
if (outSize == 0 && !checkFinishBlock)
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT)
{
if (*srcLen == inSize)
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
(*srcLen)++;
p->state = Lzma2Dec_UpdateState(p, *src++);
if (p->state == LZMA2_STATE_UNPACK0)
{
// if (p->decoder.dicPos != 0)
if (p->control == LZMA2_CONTROL_COPY_RESET_DIC || p->control >= 0xE0)
return LZMA2_PARSE_STATUS_NEW_BLOCK;
// if (outSize == 0) return LZMA_STATUS_NOT_FINISHED;
}
// The following code can be commented.
// It's not big problem, if we read additional input bytes.
// It will be stopped later in LZMA2_STATE_DATA / LZMA2_STATE_DATA_CONT state.
if (outSize == 0 && p->state != LZMA2_STATE_FINISHED)
{
// checkFinishBlock is true. So we expect that block must be finished,
// We can return LZMA_STATUS_NOT_SPECIFIED or LZMA_STATUS_NOT_FINISHED here
// break;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
}
if (p->state == LZMA2_STATE_DATA)
return LZMA2_PARSE_STATUS_NEW_CHUNK;
continue;
}
if (outSize == 0)
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
{
SizeT inCur = inSize - *srcLen;
if (LZMA2_IS_UNCOMPRESSED_STATE(p))
{
if (inCur == 0)
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
if (inCur > p->unpackSize)
inCur = p->unpackSize;
if (inCur > outSize)
inCur = outSize;
p->decoder.dicPos += inCur;
src += inCur;
*srcLen += inCur;
outSize -= inCur;
p->unpackSize -= (UInt32)inCur;
p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT;
}
else
{
p->isExtraMode = True;
if (inCur == 0)
{
if (p->packSize != 0)
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
}
else if (p->state == LZMA2_STATE_DATA)
{
p->state = LZMA2_STATE_DATA_CONT;
if (*src != 0)
{
// first byte of lzma chunk must be Zero
*srcLen += 1;
p->packSize--;
break;
}
}
if (inCur > p->packSize)
inCur = (SizeT)p->packSize;
src += inCur;
*srcLen += inCur;
p->packSize -= (UInt32)inCur;
if (p->packSize == 0)
{
SizeT rem = outSize;
if (rem > p->unpackSize)
rem = p->unpackSize;
p->decoder.dicPos += rem;
p->unpackSize -= (UInt32)rem;
outSize -= rem;
if (p->unpackSize == 0)
p->state = LZMA2_STATE_CONTROL;
}
}
}
}
p->state = LZMA2_STATE_ERROR;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_SPECIFIED;
}
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
{
SizeT outSize = *destLen, inSize = *srcLen;
*srcLen = *destLen = 0;
for (;;)
{
SizeT inCur = inSize, outCur, dicPos;
ELzmaFinishMode curFinishMode;
SRes res;
if (p->decoder.dicPos == p->decoder.dicBufSize)
p->decoder.dicPos = 0;
dicPos = p->decoder.dicPos;
curFinishMode = LZMA_FINISH_ANY;
outCur = p->decoder.dicBufSize - dicPos;
if (outCur >= outSize)
{
outCur = outSize;
curFinishMode = finishMode;
}
res = Lzma2Dec_DecodeToDic(p, dicPos + outCur, src, &inCur, curFinishMode, status);
src += inCur;
inSize -= inCur;
*srcLen += inCur;
outCur = p->decoder.dicPos - dicPos;
memcpy(dest, p->decoder.dic + dicPos, outCur);
dest += outCur;
outSize -= outCur;
*destLen += outCur;
if (res != 0)
return res;
if (outCur == 0 || outSize == 0)
return SZ_OK;
}
}
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAllocPtr alloc)
{
CLzma2Dec p;
SRes res;
SizeT outSize = *destLen, inSize = *srcLen;
*destLen = *srcLen = 0;
*status = LZMA_STATUS_NOT_SPECIFIED;
Lzma2Dec_CONSTRUCT(&p)
RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc))
p.decoder.dic = dest;
p.decoder.dicBufSize = outSize;
Lzma2Dec_Init(&p);
*srcLen = inSize;
res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
*destLen = p.decoder.dicPos;
if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
res = SZ_ERROR_INPUT_EOF;
Lzma2Dec_FreeProbs(&p, alloc);
return res;
}
#undef PRF

View file

@ -1,121 +0,0 @@
/* Lzma2Dec.h -- LZMA2 Decoder
2023-03-03 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZMA2_DEC_H
#define ZIP7_INC_LZMA2_DEC_H
#include "LzmaDec.h"
EXTERN_C_BEGIN
/* ---------- State Interface ---------- */
typedef struct
{
unsigned state;
Byte control;
Byte needInitLevel;
Byte isExtraMode;
Byte _pad_;
UInt32 packSize;
UInt32 unpackSize;
CLzmaDec decoder;
} CLzma2Dec;
#define Lzma2Dec_CONSTRUCT(p) LzmaDec_CONSTRUCT(&(p)->decoder)
#define Lzma2Dec_Construct(p) Lzma2Dec_CONSTRUCT(p)
#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc)
#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc)
SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc);
SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc);
void Lzma2Dec_Init(CLzma2Dec *p);
/*
finishMode:
It has meaning only if the decoding reaches output limit (*destLen or dicLimit).
LZMA_FINISH_ANY - use smallest number of input bytes
LZMA_FINISH_END - read EndOfStream marker after decoding
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
LZMA_STATUS_NEEDS_MORE_INPUT
SZ_ERROR_DATA - Data error
*/
SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
/* ---------- LZMA2 block and chunk parsing ---------- */
/*
Lzma2Dec_Parse() parses compressed data stream up to next independent block or next chunk data.
It can return LZMA_STATUS_* code or LZMA2_PARSE_STATUS_* code:
- LZMA2_PARSE_STATUS_NEW_BLOCK - there is new block, and 1 additional byte (control byte of next block header) was read from input.
- LZMA2_PARSE_STATUS_NEW_CHUNK - there is new chunk, and only lzma2 header of new chunk was read.
CLzma2Dec::unpackSize contains unpack size of that chunk
*/
typedef enum
{
/*
LZMA_STATUS_NOT_SPECIFIED // data error
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED //
LZMA_STATUS_NEEDS_MORE_INPUT
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK // unused
*/
LZMA2_PARSE_STATUS_NEW_BLOCK = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + 1,
LZMA2_PARSE_STATUS_NEW_CHUNK
} ELzma2ParseStatus;
ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
SizeT outSize, // output size
const Byte *src, SizeT *srcLen,
int checkFinishBlock // set (checkFinishBlock = 1), if it must read full input data, if decoder.dicPos reaches blockMax position.
);
/*
LZMA2 parser doesn't decode LZMA chunks, so we must read
full input LZMA chunk to decode some part of LZMA chunk.
Lzma2Dec_GetUnpackExtra() returns the value that shows
max possible number of output bytes that can be output by decoder
at current input positon.
*/
#define Lzma2Dec_GetUnpackExtra(p) ((p)->isExtraMode ? (p)->unpackSize : 0)
/* ---------- One Call Interface ---------- */
/*
finishMode:
It has meaning only if the decoding reaches output limit (*destLen).
LZMA_FINISH_ANY - use smallest number of input bytes
LZMA_FINISH_END - read EndOfStream marker after decoding
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
*/
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAllocPtr alloc);
EXTERN_C_END
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
/* Lzma2DecMt.h -- LZMA2 Decoder Multi-thread
2023-04-13 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZMA2_DEC_MT_H
#define ZIP7_INC_LZMA2_DEC_MT_H
#include "7zTypes.h"
EXTERN_C_BEGIN
typedef struct
{
size_t inBufSize_ST;
size_t outStep_ST;
#ifndef Z7_ST
unsigned numThreads;
size_t inBufSize_MT;
size_t outBlockMax;
size_t inBlockMax;
#endif
} CLzma2DecMtProps;
/* init to single-thread mode */
void Lzma2DecMtProps_Init(CLzma2DecMtProps *p);
/* ---------- CLzma2DecMtHandle Interface ---------- */
/* Lzma2DecMt_ * functions can return the following exit codes:
SRes:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater in props
SZ_ERROR_WRITE - ISeqOutStream write callback error
// SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
SZ_ERROR_PROGRESS - some break from progress callback
SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
*/
typedef struct CLzma2DecMt CLzma2DecMt;
typedef CLzma2DecMt * CLzma2DecMtHandle;
// Z7_DECLARE_HANDLE(CLzma2DecMtHandle)
CLzma2DecMtHandle Lzma2DecMt_Create(ISzAllocPtr alloc, ISzAllocPtr allocMid);
void Lzma2DecMt_Destroy(CLzma2DecMtHandle p);
SRes Lzma2DecMt_Decode(CLzma2DecMtHandle p,
Byte prop,
const CLzma2DecMtProps *props,
ISeqOutStreamPtr outStream,
const UInt64 *outDataSize, // NULL means undefined
int finishMode, // 0 - partial unpacking is allowed, 1 - if lzma2 stream must be finished
// Byte *outBuf, size_t *outBufSize,
ISeqInStreamPtr inStream,
// const Byte *inData, size_t inDataSize,
// out variables:
UInt64 *inProcessed,
int *isMT, /* out: (*isMT == 0), if single thread decoding was used */
// UInt64 *outProcessed,
ICompressProgressPtr progress);
/* ---------- Read from CLzma2DecMtHandle Interface ---------- */
SRes Lzma2DecMt_Init(CLzma2DecMtHandle pp,
Byte prop,
const CLzma2DecMtProps *props,
const UInt64 *outDataSize, int finishMode,
ISeqInStreamPtr inStream);
SRes Lzma2DecMt_Read(CLzma2DecMtHandle pp,
Byte *data, size_t *outSize,
UInt64 *inStreamProcessed);
EXTERN_C_END
#endif

View file

@ -1,805 +0,0 @@
/* Lzma2Enc.c -- LZMA2 Encoder
2023-04-13 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <string.h>
/* #define Z7_ST */
#include "Lzma2Enc.h"
#ifndef Z7_ST
#include "MtCoder.h"
#else
#define MTCODER_THREADS_MAX 1
#endif
#define LZMA2_CONTROL_LZMA (1 << 7)
#define LZMA2_CONTROL_COPY_NO_RESET 2
#define LZMA2_CONTROL_COPY_RESET_DIC 1
#define LZMA2_CONTROL_EOF 0
#define LZMA2_LCLP_MAX 4
#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11))
#define LZMA2_PACK_SIZE_MAX (1 << 16)
#define LZMA2_COPY_CHUNK_SIZE LZMA2_PACK_SIZE_MAX
#define LZMA2_UNPACK_SIZE_MAX (1 << 21)
#define LZMA2_KEEP_WINDOW_SIZE LZMA2_UNPACK_SIZE_MAX
#define LZMA2_CHUNK_SIZE_COMPRESSED_MAX ((1 << 16) + 16)
#define PRF(x) /* x */
/* ---------- CLimitedSeqInStream ---------- */
typedef struct
{
ISeqInStream vt;
ISeqInStreamPtr realStream;
UInt64 limit;
UInt64 processed;
int finished;
} CLimitedSeqInStream;
static void LimitedSeqInStream_Init(CLimitedSeqInStream *p)
{
p->limit = (UInt64)(Int64)-1;
p->processed = 0;
p->finished = 0;
}
static SRes LimitedSeqInStream_Read(ISeqInStreamPtr pp, void *data, size_t *size)
{
Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLimitedSeqInStream)
size_t size2 = *size;
SRes res = SZ_OK;
if (p->limit != (UInt64)(Int64)-1)
{
const UInt64 rem = p->limit - p->processed;
if (size2 > rem)
size2 = (size_t)rem;
}
if (size2 != 0)
{
res = ISeqInStream_Read(p->realStream, data, &size2);
p->finished = (size2 == 0 ? 1 : 0);
p->processed += size2;
}
*size = size2;
return res;
}
/* ---------- CLzma2EncInt ---------- */
typedef struct
{
CLzmaEncHandle enc;
Byte propsAreSet;
Byte propsByte;
Byte needInitState;
Byte needInitProp;
UInt64 srcPos;
} CLzma2EncInt;
static SRes Lzma2EncInt_InitStream(CLzma2EncInt *p, const CLzma2EncProps *props)
{
if (!p->propsAreSet)
{
SizeT propsSize = LZMA_PROPS_SIZE;
Byte propsEncoded[LZMA_PROPS_SIZE];
RINOK(LzmaEnc_SetProps(p->enc, &props->lzmaProps))
RINOK(LzmaEnc_WriteProperties(p->enc, propsEncoded, &propsSize))
p->propsByte = propsEncoded[0];
p->propsAreSet = True;
}
return SZ_OK;
}
static void Lzma2EncInt_InitBlock(CLzma2EncInt *p)
{
p->srcPos = 0;
p->needInitState = True;
p->needInitProp = True;
}
SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p, ISeqInStreamPtr inStream, UInt32 keepWindowSize,
ISzAllocPtr alloc, ISzAllocPtr allocBig);
SRes LzmaEnc_MemPrepare(CLzmaEncHandle p, const Byte *src, SizeT srcLen,
UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig);
SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit,
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize);
const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p);
void LzmaEnc_Finish(CLzmaEncHandle p);
void LzmaEnc_SaveState(CLzmaEncHandle p);
void LzmaEnc_RestoreState(CLzmaEncHandle p);
/*
UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle p);
*/
static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
size_t *packSizeRes, ISeqOutStreamPtr outStream)
{
size_t packSizeLimit = *packSizeRes;
size_t packSize = packSizeLimit;
UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX;
unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0);
BoolInt useCopyBlock;
SRes res;
*packSizeRes = 0;
if (packSize < lzHeaderSize)
return SZ_ERROR_OUTPUT_EOF;
packSize -= lzHeaderSize;
LzmaEnc_SaveState(p->enc);
res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState,
outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize);
PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize));
if (unpackSize == 0)
return res;
if (res == SZ_OK)
useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16));
else
{
if (res != SZ_ERROR_OUTPUT_EOF)
return res;
res = SZ_OK;
useCopyBlock = True;
}
if (useCopyBlock)
{
size_t destPos = 0;
PRF(printf("################# COPY "));
while (unpackSize > 0)
{
const UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE;
if (packSizeLimit - destPos < u + 3)
return SZ_ERROR_OUTPUT_EOF;
outBuf[destPos++] = (Byte)(p->srcPos == 0 ? LZMA2_CONTROL_COPY_RESET_DIC : LZMA2_CONTROL_COPY_NO_RESET);
outBuf[destPos++] = (Byte)((u - 1) >> 8);
outBuf[destPos++] = (Byte)(u - 1);
memcpy(outBuf + destPos, LzmaEnc_GetCurBuf(p->enc) - unpackSize, u);
unpackSize -= u;
destPos += u;
p->srcPos += u;
if (outStream)
{
*packSizeRes += destPos;
if (ISeqOutStream_Write(outStream, outBuf, destPos) != destPos)
return SZ_ERROR_WRITE;
destPos = 0;
}
else
*packSizeRes = destPos;
/* needInitState = True; */
}
LzmaEnc_RestoreState(p->enc);
return SZ_OK;
}
{
size_t destPos = 0;
const UInt32 u = unpackSize - 1;
const UInt32 pm = (UInt32)(packSize - 1);
const unsigned mode = (p->srcPos == 0) ? 3 : (p->needInitState ? (p->needInitProp ? 2 : 1) : 0);
PRF(printf(" "));
outBuf[destPos++] = (Byte)(LZMA2_CONTROL_LZMA | (mode << 5) | ((u >> 16) & 0x1F));
outBuf[destPos++] = (Byte)(u >> 8);
outBuf[destPos++] = (Byte)u;
outBuf[destPos++] = (Byte)(pm >> 8);
outBuf[destPos++] = (Byte)pm;
if (p->needInitProp)
outBuf[destPos++] = p->propsByte;
p->needInitProp = False;
p->needInitState = False;
destPos += packSize;
p->srcPos += unpackSize;
if (outStream)
if (ISeqOutStream_Write(outStream, outBuf, destPos) != destPos)
return SZ_ERROR_WRITE;
*packSizeRes = destPos;
return SZ_OK;
}
}
/* ---------- Lzma2 Props ---------- */
void Lzma2EncProps_Init(CLzma2EncProps *p)
{
LzmaEncProps_Init(&p->lzmaProps);
p->blockSize = LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO;
p->numBlockThreads_Reduced = -1;
p->numBlockThreads_Max = -1;
p->numTotalThreads = -1;
}
void Lzma2EncProps_Normalize(CLzma2EncProps *p)
{
UInt64 fileSize;
int t1, t1n, t2, t2r, t3;
{
CLzmaEncProps lzmaProps = p->lzmaProps;
LzmaEncProps_Normalize(&lzmaProps);
t1n = lzmaProps.numThreads;
}
t1 = p->lzmaProps.numThreads;
t2 = p->numBlockThreads_Max;
t3 = p->numTotalThreads;
if (t2 > MTCODER_THREADS_MAX)
t2 = MTCODER_THREADS_MAX;
if (t3 <= 0)
{
if (t2 <= 0)
t2 = 1;
t3 = t1n * t2;
}
else if (t2 <= 0)
{
t2 = t3 / t1n;
if (t2 == 0)
{
t1 = 1;
t2 = t3;
}
if (t2 > MTCODER_THREADS_MAX)
t2 = MTCODER_THREADS_MAX;
}
else if (t1 <= 0)
{
t1 = t3 / t2;
if (t1 == 0)
t1 = 1;
}
else
t3 = t1n * t2;
p->lzmaProps.numThreads = t1;
t2r = t2;
fileSize = p->lzmaProps.reduceSize;
if ( p->blockSize != LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID
&& p->blockSize != LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO
&& (p->blockSize < fileSize || fileSize == (UInt64)(Int64)-1))
p->lzmaProps.reduceSize = p->blockSize;
LzmaEncProps_Normalize(&p->lzmaProps);
p->lzmaProps.reduceSize = fileSize;
t1 = p->lzmaProps.numThreads;
if (p->blockSize == LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID)
{
t2r = t2 = 1;
t3 = t1;
}
else if (p->blockSize == LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO && t2 <= 1)
{
/* if there is no block multi-threading, we use SOLID block */
p->blockSize = LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID;
}
else
{
if (p->blockSize == LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO)
{
const UInt32 kMinSize = (UInt32)1 << 20;
const UInt32 kMaxSize = (UInt32)1 << 28;
const UInt32 dictSize = p->lzmaProps.dictSize;
UInt64 blockSize = (UInt64)dictSize << 2;
if (blockSize < kMinSize) blockSize = kMinSize;
if (blockSize > kMaxSize) blockSize = kMaxSize;
if (blockSize < dictSize) blockSize = dictSize;
blockSize += (kMinSize - 1);
blockSize &= ~(UInt64)(kMinSize - 1);
p->blockSize = blockSize;
}
if (t2 > 1 && fileSize != (UInt64)(Int64)-1)
{
UInt64 numBlocks = fileSize / p->blockSize;
if (numBlocks * p->blockSize != fileSize)
numBlocks++;
if (numBlocks < (unsigned)t2)
{
t2r = (int)numBlocks;
if (t2r == 0)
t2r = 1;
t3 = t1 * t2r;
}
}
}
p->numBlockThreads_Max = t2;
p->numBlockThreads_Reduced = t2r;
p->numTotalThreads = t3;
}
static SRes Progress(ICompressProgressPtr p, UInt64 inSize, UInt64 outSize)
{
return (p && ICompressProgress_Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK;
}
/* ---------- Lzma2 ---------- */
struct CLzma2Enc
{
Byte propEncoded;
CLzma2EncProps props;
UInt64 expectedDataSize;
Byte *tempBufLzma;
ISzAllocPtr alloc;
ISzAllocPtr allocBig;
CLzma2EncInt coders[MTCODER_THREADS_MAX];
#ifndef Z7_ST
ISeqOutStreamPtr outStream;
Byte *outBuf;
size_t outBuf_Rem; /* remainder in outBuf */
size_t outBufSize; /* size of allocated outBufs[i] */
size_t outBufsDataSizes[MTCODER_BLOCKS_MAX];
BoolInt mtCoder_WasConstructed;
CMtCoder mtCoder;
Byte *outBufs[MTCODER_BLOCKS_MAX];
#endif
};
CLzma2EncHandle Lzma2Enc_Create(ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
CLzma2Enc *p = (CLzma2Enc *)ISzAlloc_Alloc(alloc, sizeof(CLzma2Enc));
if (!p)
return NULL;
Lzma2EncProps_Init(&p->props);
Lzma2EncProps_Normalize(&p->props);
p->expectedDataSize = (UInt64)(Int64)-1;
p->tempBufLzma = NULL;
p->alloc = alloc;
p->allocBig = allocBig;
{
unsigned i;
for (i = 0; i < MTCODER_THREADS_MAX; i++)
p->coders[i].enc = NULL;
}
#ifndef Z7_ST
p->mtCoder_WasConstructed = False;
{
unsigned i;
for (i = 0; i < MTCODER_BLOCKS_MAX; i++)
p->outBufs[i] = NULL;
p->outBufSize = 0;
}
#endif
return (CLzma2EncHandle)p;
}
#ifndef Z7_ST
static void Lzma2Enc_FreeOutBufs(CLzma2Enc *p)
{
unsigned i;
for (i = 0; i < MTCODER_BLOCKS_MAX; i++)
if (p->outBufs[i])
{
ISzAlloc_Free(p->alloc, p->outBufs[i]);
p->outBufs[i] = NULL;
}
p->outBufSize = 0;
}
#endif
// #define GET_CLzma2Enc_p CLzma2Enc *p = (CLzma2Enc *)(void *)p;
void Lzma2Enc_Destroy(CLzma2EncHandle p)
{
// GET_CLzma2Enc_p
unsigned i;
for (i = 0; i < MTCODER_THREADS_MAX; i++)
{
CLzma2EncInt *t = &p->coders[i];
if (t->enc)
{
LzmaEnc_Destroy(t->enc, p->alloc, p->allocBig);
t->enc = NULL;
}
}
#ifndef Z7_ST
if (p->mtCoder_WasConstructed)
{
MtCoder_Destruct(&p->mtCoder);
p->mtCoder_WasConstructed = False;
}
Lzma2Enc_FreeOutBufs(p);
#endif
ISzAlloc_Free(p->alloc, p->tempBufLzma);
p->tempBufLzma = NULL;
ISzAlloc_Free(p->alloc, p);
}
SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props)
{
// GET_CLzma2Enc_p
CLzmaEncProps lzmaProps = props->lzmaProps;
LzmaEncProps_Normalize(&lzmaProps);
if (lzmaProps.lc + lzmaProps.lp > LZMA2_LCLP_MAX)
return SZ_ERROR_PARAM;
p->props = *props;
Lzma2EncProps_Normalize(&p->props);
return SZ_OK;
}
void Lzma2Enc_SetDataSize(CLzma2EncHandle p, UInt64 expectedDataSiize)
{
// GET_CLzma2Enc_p
p->expectedDataSize = expectedDataSiize;
}
Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p)
{
// GET_CLzma2Enc_p
unsigned i;
UInt32 dicSize = LzmaEncProps_GetDictSize(&p->props.lzmaProps);
for (i = 0; i < 40; i++)
if (dicSize <= LZMA2_DIC_SIZE_FROM_PROP(i))
break;
return (Byte)i;
}
static SRes Lzma2Enc_EncodeMt1(
CLzma2Enc *me,
CLzma2EncInt *p,
ISeqOutStreamPtr outStream,
Byte *outBuf, size_t *outBufSize,
ISeqInStreamPtr inStream,
const Byte *inData, size_t inDataSize,
int finished,
ICompressProgressPtr progress)
{
UInt64 unpackTotal = 0;
UInt64 packTotal = 0;
size_t outLim = 0;
CLimitedSeqInStream limitedInStream;
if (outBuf)
{
outLim = *outBufSize;
*outBufSize = 0;
}
if (!p->enc)
{
p->propsAreSet = False;
p->enc = LzmaEnc_Create(me->alloc);
if (!p->enc)
return SZ_ERROR_MEM;
}
limitedInStream.realStream = inStream;
if (inStream)
{
limitedInStream.vt.Read = LimitedSeqInStream_Read;
}
if (!outBuf)
{
// outStream version works only in one thread. So we use CLzma2Enc::tempBufLzma
if (!me->tempBufLzma)
{
me->tempBufLzma = (Byte *)ISzAlloc_Alloc(me->alloc, LZMA2_CHUNK_SIZE_COMPRESSED_MAX);
if (!me->tempBufLzma)
return SZ_ERROR_MEM;
}
}
RINOK(Lzma2EncInt_InitStream(p, &me->props))
for (;;)
{
SRes res = SZ_OK;
SizeT inSizeCur = 0;
Lzma2EncInt_InitBlock(p);
LimitedSeqInStream_Init(&limitedInStream);
limitedInStream.limit = me->props.blockSize;
if (inStream)
{
UInt64 expected = (UInt64)(Int64)-1;
// inStream version works only in one thread. So we use CLzma2Enc::expectedDataSize
if (me->expectedDataSize != (UInt64)(Int64)-1
&& me->expectedDataSize >= unpackTotal)
expected = me->expectedDataSize - unpackTotal;
if (me->props.blockSize != LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID
&& expected > me->props.blockSize)
expected = (size_t)me->props.blockSize;
LzmaEnc_SetDataSize(p->enc, expected);
RINOK(LzmaEnc_PrepareForLzma2(p->enc,
&limitedInStream.vt,
LZMA2_KEEP_WINDOW_SIZE,
me->alloc,
me->allocBig))
}
else
{
inSizeCur = (SizeT)(inDataSize - (size_t)unpackTotal);
if (me->props.blockSize != LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID
&& inSizeCur > me->props.blockSize)
inSizeCur = (SizeT)(size_t)me->props.blockSize;
// LzmaEnc_SetDataSize(p->enc, inSizeCur);
RINOK(LzmaEnc_MemPrepare(p->enc,
inData + (size_t)unpackTotal, inSizeCur,
LZMA2_KEEP_WINDOW_SIZE,
me->alloc,
me->allocBig))
}
for (;;)
{
size_t packSize = LZMA2_CHUNK_SIZE_COMPRESSED_MAX;
if (outBuf)
packSize = outLim - (size_t)packTotal;
res = Lzma2EncInt_EncodeSubblock(p,
outBuf ? outBuf + (size_t)packTotal : me->tempBufLzma, &packSize,
outBuf ? NULL : outStream);
if (res != SZ_OK)
break;
packTotal += packSize;
if (outBuf)
*outBufSize = (size_t)packTotal;
res = Progress(progress, unpackTotal + p->srcPos, packTotal);
if (res != SZ_OK)
break;
/*
if (LzmaEnc_GetNumAvailableBytes(p->enc) == 0)
break;
*/
if (packSize == 0)
break;
}
LzmaEnc_Finish(p->enc);
unpackTotal += p->srcPos;
RINOK(res)
if (p->srcPos != (inStream ? limitedInStream.processed : inSizeCur))
return SZ_ERROR_FAIL;
if (inStream ? limitedInStream.finished : (unpackTotal == inDataSize))
{
if (finished)
{
if (outBuf)
{
const size_t destPos = *outBufSize;
if (destPos >= outLim)
return SZ_ERROR_OUTPUT_EOF;
outBuf[destPos] = LZMA2_CONTROL_EOF; // 0
*outBufSize = destPos + 1;
}
else
{
const Byte b = LZMA2_CONTROL_EOF; // 0;
if (ISeqOutStream_Write(outStream, &b, 1) != 1)
return SZ_ERROR_WRITE;
}
}
return SZ_OK;
}
}
}
#ifndef Z7_ST
static SRes Lzma2Enc_MtCallback_Code(void *p, unsigned coderIndex, unsigned outBufIndex,
const Byte *src, size_t srcSize, int finished)
{
CLzma2Enc *me = (CLzma2Enc *)p;
size_t destSize = me->outBufSize;
SRes res;
CMtProgressThunk progressThunk;
Byte *dest = me->outBufs[outBufIndex];
me->outBufsDataSizes[outBufIndex] = 0;
if (!dest)
{
dest = (Byte *)ISzAlloc_Alloc(me->alloc, me->outBufSize);
if (!dest)
return SZ_ERROR_MEM;
me->outBufs[outBufIndex] = dest;
}
MtProgressThunk_CreateVTable(&progressThunk);
progressThunk.mtProgress = &me->mtCoder.mtProgress;
progressThunk.inSize = 0;
progressThunk.outSize = 0;
res = Lzma2Enc_EncodeMt1(me,
&me->coders[coderIndex],
NULL, dest, &destSize,
NULL, src, srcSize,
finished,
&progressThunk.vt);
me->outBufsDataSizes[outBufIndex] = destSize;
return res;
}
static SRes Lzma2Enc_MtCallback_Write(void *p, unsigned outBufIndex)
{
CLzma2Enc *me = (CLzma2Enc *)p;
size_t size = me->outBufsDataSizes[outBufIndex];
const Byte *data = me->outBufs[outBufIndex];
if (me->outStream)
return ISeqOutStream_Write(me->outStream, data, size) == size ? SZ_OK : SZ_ERROR_WRITE;
if (size > me->outBuf_Rem)
return SZ_ERROR_OUTPUT_EOF;
memcpy(me->outBuf, data, size);
me->outBuf_Rem -= size;
me->outBuf += size;
return SZ_OK;
}
#endif
SRes Lzma2Enc_Encode2(CLzma2EncHandle p,
ISeqOutStreamPtr outStream,
Byte *outBuf, size_t *outBufSize,
ISeqInStreamPtr inStream,
const Byte *inData, size_t inDataSize,
ICompressProgressPtr progress)
{
// GET_CLzma2Enc_p
if (inStream && inData)
return SZ_ERROR_PARAM;
if (outStream && outBuf)
return SZ_ERROR_PARAM;
{
unsigned i;
for (i = 0; i < MTCODER_THREADS_MAX; i++)
p->coders[i].propsAreSet = False;
}
#ifndef Z7_ST
if (p->props.numBlockThreads_Reduced > 1)
{
IMtCoderCallback2 vt;
if (!p->mtCoder_WasConstructed)
{
p->mtCoder_WasConstructed = True;
MtCoder_Construct(&p->mtCoder);
}
vt.Code = Lzma2Enc_MtCallback_Code;
vt.Write = Lzma2Enc_MtCallback_Write;
p->outStream = outStream;
p->outBuf = NULL;
p->outBuf_Rem = 0;
if (!outStream)
{
p->outBuf = outBuf;
p->outBuf_Rem = *outBufSize;
*outBufSize = 0;
}
p->mtCoder.allocBig = p->allocBig;
p->mtCoder.progress = progress;
p->mtCoder.inStream = inStream;
p->mtCoder.inData = inData;
p->mtCoder.inDataSize = inDataSize;
p->mtCoder.mtCallback = &vt;
p->mtCoder.mtCallbackObject = p;
p->mtCoder.blockSize = (size_t)p->props.blockSize;
if (p->mtCoder.blockSize != p->props.blockSize)
return SZ_ERROR_PARAM; /* SZ_ERROR_MEM */
{
const size_t destBlockSize = p->mtCoder.blockSize + (p->mtCoder.blockSize >> 10) + 16;
if (destBlockSize < p->mtCoder.blockSize)
return SZ_ERROR_PARAM;
if (p->outBufSize != destBlockSize)
Lzma2Enc_FreeOutBufs(p);
p->outBufSize = destBlockSize;
}
p->mtCoder.numThreadsMax = (unsigned)p->props.numBlockThreads_Max;
p->mtCoder.expectedDataSize = p->expectedDataSize;
{
const SRes res = MtCoder_Code(&p->mtCoder);
if (!outStream)
*outBufSize = (size_t)(p->outBuf - outBuf);
return res;
}
}
#endif
return Lzma2Enc_EncodeMt1(p,
&p->coders[0],
outStream, outBuf, outBufSize,
inStream, inData, inDataSize,
True, /* finished */
progress);
}
#undef PRF

View file

@ -1,57 +0,0 @@
/* Lzma2Enc.h -- LZMA2 Encoder
2023-04-13 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZMA2_ENC_H
#define ZIP7_INC_LZMA2_ENC_H
#include "LzmaEnc.h"
EXTERN_C_BEGIN
#define LZMA2_ENC_PROPS_BLOCK_SIZE_AUTO 0
#define LZMA2_ENC_PROPS_BLOCK_SIZE_SOLID ((UInt64)(Int64)-1)
typedef struct
{
CLzmaEncProps lzmaProps;
UInt64 blockSize;
int numBlockThreads_Reduced;
int numBlockThreads_Max;
int numTotalThreads;
} CLzma2EncProps;
void Lzma2EncProps_Init(CLzma2EncProps *p);
void Lzma2EncProps_Normalize(CLzma2EncProps *p);
/* ---------- CLzmaEnc2Handle Interface ---------- */
/* Lzma2Enc_* functions can return the following exit codes:
SRes:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater in props
SZ_ERROR_WRITE - ISeqOutStream write callback error
SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
SZ_ERROR_PROGRESS - some break from progress callback
SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
*/
typedef struct CLzma2Enc CLzma2Enc;
typedef CLzma2Enc * CLzma2EncHandle;
// Z7_DECLARE_HANDLE(CLzma2EncHandle)
CLzma2EncHandle Lzma2Enc_Create(ISzAllocPtr alloc, ISzAllocPtr allocBig);
void Lzma2Enc_Destroy(CLzma2EncHandle p);
SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props);
void Lzma2Enc_SetDataSize(CLzma2EncHandle p, UInt64 expectedDataSiize);
Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p);
SRes Lzma2Enc_Encode2(CLzma2EncHandle p,
ISeqOutStreamPtr outStream,
Byte *outBuf, size_t *outBufSize,
ISeqInStreamPtr inStream,
const Byte *inData, size_t inDataSize,
ICompressProgressPtr progress);
EXTERN_C_END
#endif

View file

@ -1,111 +0,0 @@
/* Lzma86.h -- LZMA + x86 (BCJ) Filter
2023-03-03 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZMA86_H
#define ZIP7_INC_LZMA86_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#define LZMA86_SIZE_OFFSET (1 + 5)
#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8)
/*
It's an example for LZMA + x86 Filter use.
You can use .lzma86 extension, if you write that stream to file.
.lzma86 header adds one additional byte to standard .lzma header.
.lzma86 header (14 bytes):
Offset Size Description
0 1 = 0 - no filter, pure LZMA
= 1 - x86 filter + LZMA
1 1 lc, lp and pb in encoded form
2 4 dictSize (little endian)
6 8 uncompressed size (little endian)
Lzma86_Encode
-------------
level - compression level: 0 <= level <= 9, the default value for "level" is 5.
dictSize - The dictionary size in bytes. The maximum value is
128 MB = (1 << 27) bytes for 32-bit version
1 GB = (1 << 30) bytes for 64-bit version
The default value is 16 MB = (1 << 24) bytes, for level = 5.
It's recommended to use the dictionary that is larger than 4 KB and
that can be calculated as (1 << N) or (3 << N) sizes.
For better compression ratio dictSize must be >= inSize.
filterMode:
SZ_FILTER_NO - no Filter
SZ_FILTER_YES - x86 Filter
SZ_FILTER_AUTO - it tries both alternatives to select best.
Encoder will use 2 or 3 passes:
2 passes when FILTER_NO provides better compression.
3 passes when FILTER_YES provides better compression.
Lzma86Encode allocates Data with MyAlloc functions.
RAM Requirements for compressing:
RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize
filterMode FilterBlockSize
SZ_FILTER_NO 0
SZ_FILTER_YES inSize
SZ_FILTER_AUTO inSize
Return code:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater
SZ_ERROR_OUTPUT_EOF - output buffer overflow
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
enum ESzFilterMode
{
SZ_FILTER_NO,
SZ_FILTER_YES,
SZ_FILTER_AUTO
};
SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
int level, UInt32 dictSize, int filterMode);
/*
Lzma86_GetUnpackSize:
In:
src - input data
srcLen - input data size
Out:
unpackSize - size of uncompressed stream
Return code:
SZ_OK - OK
SZ_ERROR_INPUT_EOF - Error in headers
*/
SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize);
/*
Lzma86_Decode:
In:
dest - output data
destLen - output data size
src - input data
srcLen - input data size
Out:
destLen - processed output size
srcLen - processed input size
Return code:
SZ_OK - OK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - unsupported file
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer
*/
SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen);
EXTERN_C_END
#endif

View file

@ -1,53 +0,0 @@
/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder
2023-03-03 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "Lzma86.h"
#include "Alloc.h"
#include "Bra.h"
#include "LzmaDec.h"
SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
{
unsigned i;
if (srcLen < LZMA86_HEADER_SIZE)
return SZ_ERROR_INPUT_EOF;
*unpackSize = 0;
for (i = 0; i < sizeof(UInt64); i++)
*unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i);
return SZ_OK;
}
SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen)
{
SRes res;
int useFilter;
SizeT inSizePure;
ELzmaStatus status;
if (*srcLen < LZMA86_HEADER_SIZE)
return SZ_ERROR_INPUT_EOF;
useFilter = src[0];
if (useFilter > 1)
{
*destLen = 0;
return SZ_ERROR_UNSUPPORTED;
}
inSizePure = *srcLen - LZMA86_HEADER_SIZE;
res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure,
src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc);
*srcLen = inSizePure + LZMA86_HEADER_SIZE;
if (res != SZ_OK)
return res;
if (useFilter == 1)
{
UInt32 x86State = Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL;
z7_BranchConvSt_X86_Dec(dest, *destLen, 0, &x86State);
}
return SZ_OK;
}

View file

@ -1,103 +0,0 @@
/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder
2023-03-03 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <string.h>
#include "Lzma86.h"
#include "Alloc.h"
#include "Bra.h"
#include "LzmaEnc.h"
int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
int level, UInt32 dictSize, int filterMode)
{
size_t outSize2 = *destLen;
Byte *filteredStream;
BoolInt useFilter;
int mainResult = SZ_ERROR_OUTPUT_EOF;
CLzmaEncProps props;
LzmaEncProps_Init(&props);
props.level = level;
props.dictSize = dictSize;
*destLen = 0;
if (outSize2 < LZMA86_HEADER_SIZE)
return SZ_ERROR_OUTPUT_EOF;
{
int i;
UInt64 t = srcLen;
for (i = 0; i < 8; i++, t >>= 8)
dest[LZMA86_SIZE_OFFSET + i] = (Byte)t;
}
filteredStream = 0;
useFilter = (filterMode != SZ_FILTER_NO);
if (useFilter)
{
if (srcLen != 0)
{
filteredStream = (Byte *)MyAlloc(srcLen);
if (filteredStream == 0)
return SZ_ERROR_MEM;
memcpy(filteredStream, src, srcLen);
}
{
UInt32 x86State = Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL;
z7_BranchConvSt_X86_Enc(filteredStream, srcLen, 0, &x86State);
}
}
{
size_t minSize = 0;
BoolInt bestIsFiltered = False;
/* passes for SZ_FILTER_AUTO:
0 - BCJ + LZMA
1 - LZMA
2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better.
*/
int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1;
int i;
for (i = 0; i < numPasses; i++)
{
size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE;
size_t outPropsSize = 5;
SRes curRes;
BoolInt curModeIsFiltered = (numPasses > 1 && i == numPasses - 1);
if (curModeIsFiltered && !bestIsFiltered)
break;
if (useFilter && i == 0)
curModeIsFiltered = True;
curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
curModeIsFiltered ? filteredStream : src, srcLen,
&props, dest + 1, &outPropsSize, 0,
NULL, &g_Alloc, &g_Alloc);
if (curRes != SZ_ERROR_OUTPUT_EOF)
{
if (curRes != SZ_OK)
{
mainResult = curRes;
break;
}
if (outSizeProcessed <= minSize || mainResult != SZ_OK)
{
minSize = outSizeProcessed;
bestIsFiltered = curModeIsFiltered;
mainResult = SZ_OK;
}
}
}
dest[0] = (Byte)(bestIsFiltered ? 1 : 0);
*destLen = LZMA86_HEADER_SIZE + minSize;
}
if (useFilter)
MyFree(filteredStream);
return mainResult;
}

File diff suppressed because it is too large Load diff

View file

@ -1,237 +0,0 @@
/* LzmaDec.h -- LZMA Decoder
2023-04-02 : Igor Pavlov : Public domain */
#ifndef ZIP7_INC_LZMA_DEC_H
#define ZIP7_INC_LZMA_DEC_H
#include "7zTypes.h"
EXTERN_C_BEGIN
/* #define Z7_LZMA_PROB32 */
/* Z7_LZMA_PROB32 can increase the speed on some CPUs,
but memory usage for CLzmaDec::probs will be doubled in that case */
typedef
#ifdef Z7_LZMA_PROB32
UInt32
#else
UInt16
#endif
CLzmaProb;
/* ---------- LZMA Properties ---------- */
#define LZMA_PROPS_SIZE 5
typedef struct
{
Byte lc;
Byte lp;
Byte pb;
Byte _pad_;
UInt32 dicSize;
} CLzmaProps;
/* LzmaProps_Decode - decodes properties
Returns:
SZ_OK
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
/* ---------- LZMA Decoder state ---------- */
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
#define LZMA_REQUIRED_INPUT_MAX 20
typedef struct
{
/* Don't change this structure. ASM code can use it. */
CLzmaProps prop;
CLzmaProb *probs;
CLzmaProb *probs_1664;
Byte *dic;
SizeT dicBufSize;
SizeT dicPos;
const Byte *buf;
UInt32 range;
UInt32 code;
UInt32 processedPos;
UInt32 checkDicSize;
UInt32 reps[4];
UInt32 state;
UInt32 remainLen;
UInt32 numProbs;
unsigned tempBufSize;
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
} CLzmaDec;
#define LzmaDec_CONSTRUCT(p) { (p)->dic = NULL; (p)->probs = NULL; }
#define LzmaDec_Construct(p) LzmaDec_CONSTRUCT(p)
void LzmaDec_Init(CLzmaDec *p);
/* There are two types of LZMA streams:
- Stream with end mark. That end mark adds about 6 bytes to compressed size.
- Stream without end mark. You must know exact uncompressed size to decompress such stream. */
typedef enum
{
LZMA_FINISH_ANY, /* finish at any point */
LZMA_FINISH_END /* block must be finished at the end */
} ELzmaFinishMode;
/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
You must use LZMA_FINISH_END, when you know that current output buffer
covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
and output value of destLen will be less than output buffer size limit.
You can check status result also.
You can use multiple checks to test data integrity after full decompression:
1) Check Result and "status" variable.
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
You must use correct finish mode in that case. */
typedef enum
{
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
} ELzmaStatus;
/* ELzmaStatus is used only as output value for function call */
/* ---------- Interfaces ---------- */
/* There are 3 levels of interfaces:
1) Dictionary Interface
2) Buffer Interface
3) One Call Interface
You can select any of these interfaces, but don't mix functions from different
groups for same object. */
/* There are two variants to allocate state for Dictionary Interface:
1) LzmaDec_Allocate / LzmaDec_Free
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
You can use variant 2, if you set dictionary buffer manually.
For Buffer Interface you must always use variant 1.
LzmaDec_Allocate* can return:
SZ_OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc);
SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc);
/* ---------- Dictionary Interface ---------- */
/* You can use it, if you want to eliminate the overhead for data copying from
dictionary to some other external buffer.
You must work with CLzmaDec variables directly in this interface.
STEPS:
LzmaDec_Construct()
LzmaDec_Allocate()
for (each new stream)
{
LzmaDec_Init()
while (it needs more decompression)
{
LzmaDec_DecodeToDic()
use data from CLzmaDec::dic and update CLzmaDec::dicPos
}
}
LzmaDec_Free()
*/
/* LzmaDec_DecodeToDic
The decoding to internal dictionary buffer (CLzmaDec::dic).
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
finishMode:
It has meaning only if the decoding reaches output limit (dicLimit).
LZMA_FINISH_ANY - Decode just dicLimit bytes.
LZMA_FINISH_END - Stream must be finished after dicLimit.
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
LZMA_STATUS_NEEDS_MORE_INPUT
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
SZ_ERROR_DATA - Data error
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
*/
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
/* ---------- Buffer Interface ---------- */
/* It's zlib-like interface.
See LzmaDec_DecodeToDic description for information about STEPS and return results,
but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
to work with CLzmaDec variables manually.
finishMode:
It has meaning only if the decoding reaches output limit (*destLen).
LZMA_FINISH_ANY - Decode just destLen bytes.
LZMA_FINISH_END - Stream must be finished after (*destLen).
*/
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
/* ---------- One Call Interface ---------- */
/* LzmaDecode
finishMode:
It has meaning only if the decoding reaches output limit (*destLen).
LZMA_FINISH_ANY - Decode just destLen bytes.
LZMA_FINISH_END - Stream must be finished after (*destLen).
Returns:
SZ_OK
status:
LZMA_STATUS_FINISHED_WITH_MARK
LZMA_STATUS_NOT_FINISHED
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
*/
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
ELzmaStatus *status, ISzAllocPtr alloc);
EXTERN_C_END
#endif

File diff suppressed because it is too large Load diff

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