Compare commits

...

842 Commits

Author SHA1 Message Date
Ani c4d99f93db rpcs3_version: Bump to 0.0.7 2019-08-30 03:09:59 +01:00
Nekotekina 801adb0947 VFS: Escape Control Characters 0-31
Escaping NUL is formal, it's not expected on input.
2019-08-29 02:44:12 +03:00
Nekotekina b3f5d6d85b Put lv2_obj::awake calls under mutex 2019-08-29 02:44:12 +03:00
kd-11 04c808b8ab rsx: Fixup for MRT color write lookup and surface_target_a 2019-08-28 16:12:10 +03:00
kd-11 e55d216619 rsx: Workarounds for some buggy games
- Replace assert with log message until hardware testing confirms findings
2019-08-28 14:54:51 +03:00
kd-11 e334a43169 rsx: Fix surface cache hit tests
- Avoid silly broken tests due to queue_tag being called before pitch is initialized.
- Return actual memory range covered and exclude trailing padding.
- Coordinates in src are to be calculated with src_pitch, not required_pitch.
2019-08-28 14:54:51 +03:00
JohnHolmesII cca6a19cdd Fix improper string concatenation in rsx_decode. 2019-08-28 01:26:14 +03:00
kd-11 64aff7f019 emucore: Initialize fxo on loading RSX captures
- Fixes crash on capture replay
2019-08-27 21:59:02 +03:00
kd-11 2962e05f26 rsx: Implement per-RTT color masks
- Also refactors and simplifies some common code in surface store and rsx core
2019-08-27 21:59:02 +03:00
kd-11 27aeaf66bc gl: Restructure buffer objects to give more control over usage
- This allows creating buffers with no MAP bits set which should ensure they are created for VRAM usage only
- TODO: Implement compute kernels to avoid software fallback mode for pack/unpack operations
2019-08-27 21:59:02 +03:00
Nekotekina 9672ad53cd Fix SPRX building on AppImage builds 2019-08-27 17:25:55 +03:00
Nekotekina b6b7d7b48c sys_cond_wait fixup 2019-08-27 15:38:18 +03:00
Nekotekina ec8c5453bc Fix sys_cond_wait
Schedule PPU thread before relocking.
Don't lock mutex in notify functions.
2019-08-27 15:13:01 +03:00
Nekotekina fd839243ec Revert PR 6405 2019-08-27 14:05:38 +03:00
Nekotekina ede816387f Fix SPRX loader crash 2019-08-27 13:57:27 +03:00
Nekotekina 796a6646f7 Silence statichle 2019-08-27 13:56:50 +03:00
Nekotekina dd79a5efb7 Remove fxm::make_always 2019-08-27 03:50:15 +03:00
Nekotekina e41b234dc4 Use g_fxo for cellSysCache 2019-08-27 03:50:15 +03:00
Nekotekina d2eba2387b Use g_fxo for display_manager 2019-08-27 03:50:15 +03:00
Nekotekina 6811ec562c Use parentheses for new T() syntax
MSVC keeps being dumb...
2019-08-27 03:50:15 +03:00
Nekotekina fcbf91b7cb Deprecate fxm::get_always
And also its unused fxm::import_always counterpart
2019-08-27 03:50:15 +03:00
Nekotekina 4ec3e968ff Use g_fxo for jit_core_allocator 2019-08-27 03:50:15 +03:00
Nekotekina 3dd6961ee5 Use g_fxo in PPUThread.cpp misc
Replace fxm::get_always
2019-08-27 03:50:15 +03:00
Nekotekina 232e815f17 Init g_fxo in SPRX Loader mode 2019-08-27 03:50:15 +03:00
Nekotekina ebdb0781fa Use g_fxo for statichle_handler 2019-08-27 03:50:15 +03:00
Nekotekina 84e44d3372 Use g_fxo for ppu_linkage_info 2019-08-27 03:50:15 +03:00
Nekotekina 2a37a4bcea Use g_fxo for cellPad
Rename pad_t -> pad_info
2019-08-27 03:50:15 +03:00
Nekotekina 928719b658 Use g_fxo for rsx::avconf 2019-08-27 03:50:15 +03:00
Nekotekina 7a00b5f809 Use g_fxo for patch_engine 2019-08-27 03:50:15 +03:00
Nekotekina cfdd298693 Use g_fxo for cellMusicDecode 2019-08-27 03:50:15 +03:00
Nekotekina 7b0d834477 Use g_fxo for gem_camera_shared 2019-08-27 03:50:15 +03:00
Nekotekina e4a7e8c058 Use g_fxo for cellGem
Rename gem_t -> gem_config
2019-08-27 03:50:15 +03:00
Nekotekina 1d3c18f4e2 Use g_fxo for cellGcm
Rename CellGcmSysConfig -> gcm_config
2019-08-27 03:50:15 +03:00
Nekotekina 9a2338a5ca Use g_fxo for fs_aio_manager (dummy) 2019-08-27 03:50:15 +03:00
Nekotekina 38a06c4b14 Use g_fxo for SysRsxConfig
Rename to lv2_rsx_config
2019-08-27 03:50:15 +03:00
Nekotekina cf44038435 Use g_fxo for lv2_config 2019-08-27 03:50:15 +03:00
Nekotekina 8304043d00 Use g_fxo for sysutil_cb_manager 2019-08-27 03:50:15 +03:00
Eladash a921fe3351 lv2: Wait for rescheduling before confirming ETIMEOUT 2019-08-27 03:44:34 +03:00
Eladash 35a3bed91a sys_cond_wait: Wait for rescheduling before relocking 2019-08-27 03:44:34 +03:00
kd-11 3317e13b64 rsx: Hotfix for semaphore timeout bug
- Add pending flip requests as a reason to invoke the RSX local task handler and release the vblank semaphore
2019-08-26 22:33:29 +03:00
Megamouse 32b5b11a83 cellSaveData/overlays: prevent possible array out of bounds in list view 2019-08-26 21:09:20 +02:00
kd-11 eed32cf3a4 rsx: Decompiler fixups and improvements
- Fix 2D coordinate sampling of W coordinate.
  W is actually HPOS.w and not 1. Z is however always 0.
- Optimize register usage a bit
  Disassembling compiled SPV shows that global declaration results in less ops than using inout modifiers. Modifiers generate extra mov instructions.
2019-08-26 20:03:31 +03:00
kd-11 3e28e4b1e0 rsx/decompiler: Restructure program register behavior
- Fix reading of varying registers in FP
  Different registers have different behavior
- Always write to varying registers. If a register is not written to, it is initialized to (0, 0, 0, 1)
- Reimplements two-sided lighting correctly without hacks
- Also bumps shader cache version
2019-08-26 20:03:31 +03:00
kd-11 fe6ff8622a rsx: Decompiler fixups for conditional execution
- Cond actually obeys vector mask
2019-08-26 20:03:31 +03:00
kd-11 f9aea076ae rsx: Implement depth_buffer_float support.
- Since this is transparent to the application at all time, it only becomes a problem when doing memory transfer or DEPTH->RGBA conversion in shaders.
2019-08-26 20:03:31 +03:00
Ani 0aea33687e appveyor: Update OpenSSL DLLs to 1.1.1
- QT 5.13 requires 1.1.1, default "OpenSSL-Win64" folder on AppVeyor currently points to 1.0.2s
2019-08-26 05:28:56 +01:00
kd-11 9d981de96d rsx: Fix offloader deadlock
- Do not allow offloader to handle its own faults. Serialize them on RSX instead.
  This approach introduces a GPU race condition that should be avoided with improved synchronization.
- TODO: Use proper GPU-side synchronization to avoid this situation
2019-08-25 22:09:20 +03:00
Nekotekina b70908c8f3 Appveyor: use VS 2019 2019-08-22 19:09:06 +03:00
Nekotekina 6165bd68c0 Use g_fxo for avconf_manager 2019-08-22 15:14:33 +03:00
Megamouse 94dd6c2007 cellSaveData: improve param.sfo creation 2019-08-22 08:05:12 +02:00
Megamouse 896cfd2ade cellSaveData/cellMsgDialog: implement cellSaveDataDelete 2019-08-22 08:05:12 +02:00
Megamouse 0b720aeb59 cellSaveData: ignore dot and dotdot 2019-08-22 08:05:12 +02:00
Megamouse 2d29a33ea8 cellSaveData/overlays: initialize with focused entry 2019-08-22 08:05:12 +02:00
Megamouse b3c1759853 cellSaveData/overlays/Qt: fix some warnings and a possible nullptr deref 2019-08-22 08:05:12 +02:00
Eladash ec9b896fbf Fix vm::reserve_map logic 2019-08-22 03:53:40 +03:00
Nekotekina c43a126f62 Fix VFS initialization 2019-08-22 02:46:21 +03:00
Nekotekina 8cf025bf71 Use g_fxo for cellWebBrowser
Rename browser_t -> browser_info
2019-08-22 02:13:39 +03:00
Nekotekina 2b55bde104 Use g_fxo in cellRudp
Rename rudp_t -> rudp_info
2019-08-22 02:13:39 +03:00
Nekotekina 02fe1ef7ff Use g_fxo for cellSearch
Rename search_t -> search_info
2019-08-22 02:13:39 +03:00
Nekotekina 4ac1e2d8f5 Use g_fxo for vfs_manager 2019-08-22 02:13:39 +03:00
Nekotekina 93d5c0a38e Use g_fxo for cellRec
Rename rec_t -> rec_info
2019-08-22 02:13:39 +03:00
Nekotekina 2740fafa64 Use g_fxo for page_fault_notification_entries 2019-08-22 02:13:39 +03:00
Nekotekina 54952f6ad6 Use g_fxo for LoadedNpdrmKeys_t
Rename to loaded_npdrm_keys
2019-08-22 02:13:39 +03:00
Nekotekina a85a8796d3 Use g_fxo for page_fault_event_entries 2019-08-22 02:13:39 +03:00
Nekotekina 606601441d Use g_fxo for cellMusic
Replace music_t with music_state
2019-08-22 02:13:39 +03:00
Nekotekina 2882220cbd Implement cpu_thread::stop_all() 2019-08-22 02:13:39 +03:00
Nekotekina 8517ccfdfa Add new typemap for always existing objects
Not to be confused with singletons or global variables.
2019-08-22 02:13:39 +03:00
Nekotekina 7db2e2537f Don't call lv2_obj::awake_all with empty list
Fixup after #5883
2019-08-22 02:13:39 +03:00
Nekotekina 7a3aa02dc1 StrFmt.h: remove some dead code with UB
Global variable is unused but written concurrently.
2019-08-22 02:13:39 +03:00
kd-11 7c5bde4aeb rsx: Update tag timestamp to match newest inherited data
- Avoids memory appearing older when used for depth test without depth write
  The write_barrier before the call will inherit new data but the tag will not update as no new information is added.
2019-08-21 21:17:15 +03:00
kd-11 c67c97844e rsx: Fixup for blit engine range calculations 2019-08-21 21:17:15 +03:00
kd-11 5d1b7eb945 rsx: Fix reference leaks in texture_cache<->surface_cache communication
- Properly commit orphaned blocks not invalidating existing cache structures
- Do not ignore overwritten objects when commiting as unprotected fbo. Avoids stale references to invalidated surface objects.
2019-08-21 21:17:15 +03:00
kd-11 ca8b0da141 gl: Invalidate range before reading to prevent deadlock 2019-08-21 21:17:15 +03:00
kd-11 141072023b rsx: Fix handling of ARGB8 memory
- Load into memory as straightforward BGRA
- Fixes a bug in vulkan caused by byte shuffling in blit engine vs shader access
- Removes the need for memory shuffling when transferring into a rendertarget
2019-08-21 21:17:15 +03:00
kd-11 9cd5325962 rsx: Free memory 'held hostage' by storage sections in the surface cache
- Once the memory has been captured by another surface, release the allocation
2019-08-21 21:17:15 +03:00
kd-11 be98554b40 rsx: Fix surface split logic
- Calculations are supposed to be done based on the properties of the outgoing surface
2019-08-21 21:17:15 +03:00
kd-11 67dac94704 rsx/fp: Zero-initialize FragDepth register to match hw 2019-08-21 21:17:15 +03:00
kd-11 35e61c77e0 gl: Fixup for D24S8 readback 2019-08-21 21:17:15 +03:00
Megamouse 9c64318e8a Qt: Fall back to VERSION in game list 2019-08-21 07:57:44 +02:00
Alex James b0d0f51d8d crypto: implement AES-NI acceleration
This is based off the upstream implementation in mbedTLS as well as an
external pull request [1] for MSVC support (using intrinsics).

1: https://github.com/ARMmbed/mbedtls/pull/1355
2019-08-19 23:39:40 +03:00
JohnHolmesII bd8cbcdb21 Reapply old template depth to compilers (fixes Gentoo building) 2019-08-19 20:12:31 +03:00
kd-11 dca29def5e rsx: Temporary workaround for race condition in blit engine 2019-08-18 20:45:48 +03:00
kd-11 5e299111cc rsx/vk: Restructure surface access barriers and implement RCB/RDB
- Implements render target data load (aka Read Color Buffer/Read Depth Buffer)
- Refactors vulkan surface barrier to be much cleaner.
- Removes redundant surface barrier invocations after doing a merged load
  from surface cache.
- Adds explicit access modes when gathering surfaces from cache.
2019-08-18 20:45:48 +03:00
kd-11 dfe709d464 rsx: Surface cache restructuring
- Further improve aliased data preservation by unconditionally scanning.
  Its is possible for cache aliasing to occur when doing memory split.
- Also sets up for RCB/RDB implementation
2019-08-18 20:45:48 +03:00
JohnHolmesII 5817e2a359 Fix mismatched enum string formats in sys_config 2019-08-18 18:39:17 +02:00
Silent 87ffa04a2b Improvements to XInput vibration:
- use std::chrono to measure 20ms between XInputSetState calls, because clock() measures cpu time and not real time (so calls were made more often than intended)
- fixup data types for cached vibration values to prevent u8 values overflowing and giving false positives on m_dev->newVibrateData
2019-08-18 18:03:20 +02:00
Megamouse b3aff3a1c6 cellKb: fix large ASCII characters for some compilers 2019-08-18 08:18:15 +02:00
Megamouse eedf96e1f4 Qt: fix diacritics in keyboard handler 2019-08-18 08:18:15 +02:00
Megamouse 7408f50d71 cellKb: improve key conversion 2019-08-18 08:18:15 +02:00
Megamouse 86a8b5924a Add option for keyboard layout 2019-08-18 08:18:15 +02:00
Megamouse 8a31c7a7c8 Qt/input: windows workaround to fix shift on the basic keyboard handler 2019-08-18 08:18:15 +02:00
Eladash 62414cee15 Do not allow SYS_SYNC_PRIORITY_INHERIT in sys_semaphore_create (EINVAL) 2019-08-18 04:01:16 +03:00
Eladash 960c8e6538 Partial compilation fix for WTH_GDB build 2019-08-18 04:01:16 +03:00
eladash 0af342a978 PPU Precise: FPCC handling on float ops implemented 2019-08-18 04:01:16 +03:00
Nekotekina dd86aa472d Fix _sys_lwcond_queue_wait
Fixup after #5883
2019-08-18 00:19:31 +03:00
Nekotekina 6535fb0603 Fix _sys_lwcond_signal_all
Fixup after #5883
2019-08-18 00:19:31 +03:00
Nekotekina 11a43e25d7 typeindices.hpp - start index from 0
Starting it from 1 makes it more error-prone to use.
2019-08-17 23:40:51 +03:00
max 92e6dee60f [rpcs3] refactor includes and additional dependencies 2019-08-17 23:30:23 +03:00
max c5440c95c8 [MSbuild] Extend support to v142 toolset
- Added support for current default toolset, explitly specified c++17 standard and 8.1 win sdk.
  - properties were defined via `common_default.props` and `common_default_macros.props`
 Note: There are 2 files because some properties need to be imported before `Microsoft.Cpp.Default.props` , but other common properties can be imported after but they require marco defined in `Microsoft.Cpp.Default.props`.
- Added hidapi and libusb project files to repository to simplify msbuild changes.
2019-08-17 23:30:23 +03:00
max 4cfff8ea4a [MSbuild] Detect and use MSVC version for NMake CL.
- llvm and glslang projects modified to detect and use Visual Studio Version.
 - Added `-Thost=x64` to llvm NMake CL (warning in cmake lists)
Note: `-A` option is used to set platform since rpcs3 requires cmake 3.8.3+ anyway.
2019-08-17 23:30:23 +03:00
yahfz 1444492eab lv2: Allow sys_sync_priority_inherit 2019-08-17 23:11:08 +03:00
eladash 050339bb3e PPU/LV2: Make thread-lists scheduling atomic 2019-08-17 22:46:36 +03:00
Eladash 500a4fa2fb rsx: Fix potential out of range methods execution (can result in segfaults) 2019-08-17 17:26:04 +01:00
Ani 51188db717 gui: Remove fallback font from YoRHa theme
Starting with QT 5.13, having both fonts causes stylesheets to use the fallback font even if the first font is present, but uses the first font when there's no fallback font.
The fallback font (Arial) can safely be removed as the default one is 'good enough' for the intended purpose of having a fallback.
2019-08-17 01:41:05 +01:00
Eladash 0d88f037ff Add new accuracy control for PUTLLUC accuracy setting (non-TSX)
With the option enabled GET commands are blocked until the current PUTLLC/PUTLLUC executer on that address finishes

Additional improvements:
- Minor race fix of sys_ppu_thread_exit (wait until the writer finishes)
- Max number of ppu threads bumped to 8
2019-08-17 00:42:46 +03:00
Eladash d8402008dd Stub sys_process_get_number_of_object(object == SYS_SPUPORT_OBJECT) 2019-08-16 23:49:24 +03:00
Eladash 0dce6be8cb Implement lv2_spu_image
- Improved sys_spu_image_.. error checking
- sys_process SYS_SPUIMAGE_OBJECT handling implemented
2019-08-16 23:49:24 +03:00
Eladash 80827aa31a Stub sys_process_get_number_of_object(object == SYS_TRACE_OBJECT) 2019-08-16 23:49:24 +03:00
Eladash 6540fecdc3 Add another pattern to ppu analyzer imports 2019-08-16 22:55:04 +03:00
Pierre-Loup A. Griffais f342f4b826 Work around a crash on startup on current versions of KDE on Linux.
https://bugs.kde.org/show_bug.cgi?id=401637
2019-08-16 20:37:41 +03:00
Pierre-Loup A. Griffais 56011cbddd vk: don't die on VK_SUBOPTIMAL_KHR in AcquireNextImage, and recreate swapchain
vkAcquireNextImageKHR can also return VK_SUBOPTIMAL_KHR and is non-fatal.

However, it's a good idea to still recreate the swap chain later to maintain
optimal presentation paths after temporary occlusion.
2019-08-16 20:09:37 +03:00
msuih 42ff93d30c Add advanced tab 2019-08-16 19:58:19 +03:00
Eladash f2a2dfda3a Improve unknown settings values dialog text message 2019-08-16 09:45:24 +02:00
Eladash f0c267ecb0 Change default Sleep Timers Accuracy setting's value to "Usleep Only" 2019-08-16 09:45:24 +02:00
kd-11 a0f0c418d7 gl:Implement proper support for packed 16-bit rendertargets
- Also some minor refactoring
2019-08-15 14:00:17 +03:00
kd-11 7f85b18b46 gl: Add support for 4444 typeless texture 2019-08-15 14:00:17 +03:00
Megamouse 9f854dba98 Qt: move default stylesheet to stylesheets.h 2019-08-14 23:54:09 +02:00
Megamouse 503d43889d rename rpcs3_app to headless_application 2019-08-14 23:54:09 +02:00
Megamouse 0dc7841d0f Add cli arg for hidpi 2019-08-14 23:54:09 +02:00
Megamouse 13367071b0 update some comments 2019-08-14 23:54:09 +02:00
RipleyTom 2040a11585 header shuffling 2019-08-14 23:54:09 +02:00
Megamouse 8debdfcd09 handle empty callback returns 2019-08-14 23:54:09 +02:00
Megamouse 08c581947d Create headless application [WIP] 2019-08-14 23:54:09 +02:00
Nekotekina 4df1c16099 Implement stx::typeinfo_v (util/typeindices.hpp)
Move and generalize logic from typemap.h
2019-08-14 21:04:25 +03:00
Nekotekina 9f9309055f typemap: remove "shared" type support
Need to fix design mistakes of putting too much into the same bag.
2019-08-14 20:28:34 +03:00
Nekotekina d41d7b5e24 typemap: remove "polymorphic" type support
Unnecessary complexity
2019-08-14 20:28:34 +03:00
Nekotekina f8f3067deb Always check page_allocated in vm::check_addr 2019-08-14 20:28:34 +03:00
Nekotekina d45c743877 Remove lib_loading_type::automatic
This is former default and is now obsolete.
2019-08-14 20:28:34 +03:00
Nekotekina 4f22559ff0 Remove dumb overloads of atomic_op, fetch_op
And lf_queue::apply.
Fix inlining problem by passing F by value.
2019-08-14 20:28:34 +03:00
Nekotekina cf16ee5eb5 Implement lib_loading_type::liblv2list 2019-08-14 20:28:34 +03:00
Nekotekina ae46333e99 Implement lib_loading_type::liblv2both 2019-08-14 20:28:34 +03:00
RipleyTom 87bf0386c4 Screenshot function 2019-08-14 19:24:42 +02:00
MarioSonic2987 b3f4cd3a95 Update "Enable native user interface" description
Since the merge of native OSK, back in February 2019, RPCS3 is able to support more languages with native UI. However, the description hasn't been updated since then. 

As far as I know, the languages that are now supported are English, French, German, Italian and Spanish. 
Both Greek and Russian use different alphabets from Latin, therefore they aren't supported. Polish or Norwegian uses special Latin characters that aren't covered in extended ASCII character set. Chinese, Japanese and Korean aren't also supported.
2019-08-14 04:44:59 +01:00
Eladash 7fda07eb5b rsx: UB fix (signed vs unsigned mismatch) 2019-08-13 20:48:50 +01:00
Eladash 519fe9309e rsx: Fix nv0039::buffer_notify 2019-08-13 20:48:50 +01:00
Eladash 527b1bb071 rsx: Fix overlapping transfer of nv3089::image_in when out_pitch != in_pitch
or out_pitch != out_bpp * out_w
2019-08-13 20:48:50 +01:00
Eladash 19825366f5 Fixup for fixup 2019-08-13 17:55:45 +01:00
Eladash a902874b01 Fixup after #6286 2019-08-13 13:34:14 +03:00
Eladash 95f22b76c6 Fixup after #6329 2019-08-13 04:56:00 +03:00
Eladash a4896eb6df Fix race on cellVdecClose TLS cleanup 2019-08-13 04:56:00 +03:00
Eladash 30c72b105e Fix race on notifying vdec thread in cellVdecGetPicture
Can dereference nullptr if cellVdecClose was called simultaneously.
2019-08-13 04:56:00 +03:00
Eladash 14ac70dfbf Avoid using _sys_ppu_thread_exit in _sys_interrupt_thread_disestablish 2019-08-13 04:56:00 +03:00
Eladash 4b82006984 ppu: Improve LWSYNC
Block load<->load reordering as real lwsync.
2019-08-13 04:56:00 +03:00
eladash 4f00af6000 ppu interpreter: Allow non-ssse3 to use fast path
byte shuffle is now removed which was the barrier for ssse3 check.
2019-08-13 04:56:00 +03:00
Eladash 6d3fc3a386 core config: Expose min/max ranges of integral settings and use it 2019-08-13 04:56:00 +03:00
Eladash a6c94a0eaf Fix possible infinite loop on vm area searching (sys_mmapper_allocate_address)
Specifically when allocation with 0x8000'0000 alignment fails.
2019-08-13 04:56:00 +03:00
Eladash cd4e895c04 Use error_code in mmapper_thread_recover_page_fault 2019-08-13 04:56:00 +03:00
Eladash 629d8e3a51 Fix sys_time_get_current_time() date 2019-08-13 04:56:00 +03:00
Eladash 6d0f2ae58a ppu interpreter: Improve SRD/SLD 2019-08-13 04:56:00 +03:00
Eladash a560498cd4 ppu: Improve FCTIW, FCTIWZ, FCTID and FCTIDZ 2019-08-13 04:56:00 +03:00
Eladash d48d424b19 Return immediatly from fs::remove_all on failure to remove entries
This way error code will be reflected properly
2019-08-12 14:37:23 +03:00
Eladash 0a5b6ad928 Add missing EALIGN check for sys_mmapper_search_and_map 2019-08-11 21:43:13 +03:00
Eladash a832581201 Fix sys_vm address boundary checks (fix vsize) 2019-08-11 21:43:13 +03:00
Eladash ecb3b62787 Fix CELL_CAMERA_ERROR_NOT_INIT check in cellCameraSetNotifyEventQueue when camera set to null
Don't worry, this was a duplicated check for null camera setting.
2019-08-11 21:43:13 +03:00
Eladash 96527eee5b idm: Fix bug in ID searching
* ID checking now checks if (id % step) == 0
* Extend possible ID range to allow UINT32_MAX (as long as base is non-zero)
2019-08-11 21:43:13 +03:00
Eladash 5c904bf3e2 Fix max allocations for DECR mode (sys_memory) 2019-08-11 21:43:13 +03:00
Eladash cbcd06d1dc ppu: Stack size allocation improvements 2019-08-11 21:43:13 +03:00
Eladash 3ce18fd960 Implement vm::page_executable (#6330)
Fixes segfaults when attenpting to set segfaults on non-executable memory.
2019-08-11 21:04:17 +03:00
Eladash 94d33003a3 Write zero in attr->pad (sys_memory_get_page_attribute)
Its included in lv2 as well.
2019-08-10 19:47:37 +03:00
Eladash 25e47e0de0 Fix vm::check_addr memory state check 2019-08-10 19:47:37 +03:00
kd-11 8866a3d6a9 rsx: Cleanup for blit engine fixes 2019-08-10 16:45:02 +01:00
msuih 8150095e8f Qt warnings cleanup 2019-08-10 16:15:24 +02:00
Megamouse f051f53e15 Qt: add setting for trophy manager icon background color 2019-08-10 15:13:36 +02:00
Megamouse 2f12226ff9 Qt: add setting for save manager background icon colors + fix icon size 2019-08-10 15:13:36 +02:00
Megamouse d4c635a83c Qt: change default icon background color to something friendlier looking 2019-08-10 15:13:36 +02:00
Megamouse 697128464b Qt: add some sanity checks to prevent list crashes 2019-08-10 15:13:36 +02:00
Megamouse 0559e929d4 fix some warnings 2019-08-10 15:13:36 +02:00
Megamouse efcb46658b Qt: fix initial trophy icon background color 2019-08-10 15:13:36 +02:00
Megamouse 01720afba9 silence some warnings 2019-08-10 11:02:20 +02:00
Megamouse e21b8eb95b Update Appveyor to Qt 5.13 2019-08-10 11:02:20 +02:00
kd-11 033836d88c rsx: Minor fixup for nv3089::image_in
- Typo scale_x->scale_y
- Remove convoluted temp buffer creation and just use vector instead
2019-08-08 15:48:22 +03:00
Eladash 112ad9dda2 Allow to load liblv2.sprx with manual/both lib loading options (#6274) 2019-08-07 18:41:27 +03:00
RipleyTom 05813c7e90 Fixes suspend+stop threads not stopping 2019-08-04 21:16:19 +03:00
xddxd 6e89e4ebbf Update game_list_frame.cpp 2019-08-04 13:29:45 +02:00
Megamouse 4ad784d614 Qt: select custom configs when opening the custom config folder 2019-08-04 08:45:52 +02:00
Eladash c219417f62 sys_vm: Fix sys_vm_invalidate 2019-08-03 14:29:17 +01:00
Nekotekina 5bd17a44c9 Add fallback implementation for waitable atomics
May improve perf on OSX/BSD
2019-08-02 18:37:23 +03:00
Eladash 72fb3ba794 perf hotfix for sys_timer_usleep 2019-08-01 23:38:09 +03:00
kd-11 f0bd0b5a7c rsx: Conditional render sync optimization
- ZCULL queue was updated to one-per-cb but the conditional render sync hint was not updated.
- Do not unconditionally flush the queue unless the upcoming ref is contained in the active CB.
- This avoids spamming queue flush, which frees up resources and improves performance
2019-07-30 21:13:42 +03:00
Malcolm Jestadt d689a6e47b vk: Don't warn RADV users on LLVM 8.0.1
- The 'back screen' issue on RADV was resolved with LLVM 8.0.1
2019-07-30 19:56:05 +03:00
eladash e40b76b253 sys_lwcond: Extract protocol from lwmutex at creation
This is the only reason theres a need to specify lwmutex_sq id at creation. unlike sys_cond, lwcond isn't connected to lwmutex at the lv2 level.
SYS_SYNC_RETRY fix is done explicitly at the firmware level.
This fixes issues when the original lwcond and lwmutexol data got corrupted or deallocated, this can happen when the program simply memcpy the control data to somewhere else.
Or if it uses direct lv2 the lwcond conrol param can even be NULL which will make it access violate when dereferncing it. (This param is unchecked and can be anything)
2019-07-29 21:58:04 +03:00
eladash 7508ae6e65 Add EAGAIN check for sys_memory_contianer_create 2019-07-29 21:55:59 +03:00
eladash 1e5e0f3b5e make sys_fs_closedir atomic 2019-07-29 21:55:59 +03:00
Nekotekina 949f33c8a4 Fix sys_config_get_io_event syscall name 2019-07-29 21:55:59 +03:00
Nekotekina c6993d3f1c Change bits of waitable atomics
Reduce max waiter count to 2^14.
Refactor code to use waiter_mask and signal_mask constants.
2019-07-29 21:55:59 +03:00
Nekotekina e1db6cef6f Remove ignored bits in waitable atomics
It was not implemented correctly.
2019-07-29 21:55:59 +03:00
Eladash 829047ecdb ppu disasm: Improve ORI and ORIS disassembly 2019-07-29 18:28:39 +03:00
Nekotekina 8886414013 Use atomic wait in shared_mutex and semaphore 2019-07-29 03:04:55 +03:00
Nekotekina f63e89f9b4 Implement waitable atomics
Moved Atomic.h to util/atomic.hpp
List source files in CMakeLists.txt
2019-07-29 03:04:55 +03:00
Nekotekina ec2db8edbc Correct get_int_t to get_uint_t.
Add get_sint_t.
2019-07-29 00:12:07 +03:00
Eladash 997e3046e3 vm/sys_overlay Improvements
- Implement sys_overlay_load_module_by_fd.
- Implement special segment allocation when ppc_seg flag is specified.
2019-07-28 14:23:58 +03:00
Megamouse 65134f73d6 Qt: properly scale icons in trophy manager 2019-07-27 15:29:05 +02:00
Megamouse 76a1fd5c88 Qt: simplify game list icon resize 2019-07-27 15:29:05 +02:00
kd-11 1de90bdb1f rsx: Improve aliased data preservation
- Carve out inherited region if any
- Perform pitch compatibility test before assigning old_surface
2019-07-27 16:09:21 +03:00
msuih 738cfccbba Save manager improvements 2019-07-27 11:48:37 +02:00
Eladash 230c3d55b6 Fixup 2019-07-27 04:03:29 +01:00
Eladash fcc75c8b0f rsx: Write atomically semaphore updates and fix zcull timestamp 2019-07-26 21:27:55 +03:00
Eladash 22994d15fb Fix cellCamera events support with clocks scaling 2019-07-26 21:27:55 +03:00
Eladash c53f0dd7b5 rsx: Fix gcm unmap events 2019-07-26 21:27:55 +03:00
Megamouse b56b425b19 Emu: set m_title to the actual disc game title 2019-07-25 08:53:07 +02:00
Megamouse b44b44b3c4 Qt: cleanup some comments 2019-07-25 08:53:07 +02:00
Megamouse 71c56b719c Emu/overlays: fix background picture path 2019-07-25 08:53:07 +02:00
Nekotekina 090c71aa7c TSX: Improve cpu_thread::suspend_all implementation
Implement low_lock and vip_lock (for shared_mutex).
Try to simplify suspend_all implementation with updated shared_mutex.
2019-07-24 17:25:52 +03:00
Eladash 49aefc0795 Prefetch MFC list elements (#5345)
* Prefetch mfc list elemets to protect from overwriting

Also move some stuff away from command processing such as a few constant arguments setup
2019-07-24 01:13:45 +03:00
Eladash 85b1152e29 Timers scaling and fixes 2019-07-23 00:09:01 +01:00
Eladash d17be2c2ec Fix similar bug in sys_rsx_context_iomap
TODO: Is there an rsxmem unmap event for those cases?
2019-07-22 15:16:43 +03:00
Eladash cf4d715284 typo fix (to squash) 2019-07-22 15:16:43 +03:00
Eladash 2b721b9e29 correctness fix
Not that it really matters because of gcm's lwmutex but just in case the syscall is useb directly.
2019-07-22 15:16:43 +03:00
Eladash 492c9e3c7c Fix sys_rsx_context_iounmap partial unmapping 2019-07-22 15:16:43 +03:00
Rui Pinheiro 070c3af50f Initial sys_config implementation 2019-07-22 02:44:45 +03:00
Zangetsu38 a98a2b79d0 thread scheduler: Add scheduler for zen2 and refactor for zen(+). 2019-07-21 23:02:11 +03:00
Megamouse 6128fffd3e Qt: make text labels in about dialog selectable 2019-07-21 20:07:19 +02:00
Silent 66c1143a65 Improvements to Virtual File System dialog:
- Replace Add Directory and Reset buttons with + and - buttons
- Add a confirmation message before Reset All
- Rename "Okay" to "Save" (to be in line with the rest of the UI) and add a Close option to quit without savin
2019-07-21 13:25:43 +02:00
Silent f5f0a5aa19 Use move semantics with several shared pointers in vfs_dialog, they need not be copied 2019-07-21 13:25:43 +02:00
Megamouse 78ecacabcb input: keep pads intercepted while regular buttons are still pressed 2019-07-21 10:18:59 +02:00
kd-11 9a7c2784f0 rsx: Do not clip scissor to viewport when doing buffer clear 2019-07-20 16:39:32 +03:00
Nekotekina 4e4c896136 Expand thread affinity mask to u64
Also fix and note __APPLE__ path.
2019-07-20 15:58:28 +03:00
kd-11 e2574ff100 rsx: Support CSAA transparency without multiple rasterization samples enabled 2019-07-19 15:49:08 +03:00
Malcolm Jestadt 79ddf55937 Fix decryption filtering for case sensitive platforms
- Filter for .BIN instead of .bin
2019-07-19 14:46:53 +03:00
kd-11 b5a2f0df68 rsx: Implement separate viewport raster clipping
- Merge viewport raster window and scissor into one clipping region
- Viewport raster clip is different from viewport geometry clipping in
hardware as the latter is configurable separately
2019-07-19 14:21:19 +03:00
Nekotekina 1b140c8e97 SPU Recompiler: optimize JIT memory consumption
Avoid rebuilding trampoline for every function at startup.
This should fix Out of Memory error in some cases.
2019-07-19 04:56:35 +03:00
msuih 95b6883ad4 Tiny typo fix 2019-07-18 19:16:17 +02:00
msuih d9c311737d Keep custom name when adding/removing game-specific config 2019-07-18 19:16:17 +02:00
scribam a268415121 vk: Use macros from Vulkan SDK 2019-07-17 17:56:29 +03:00
kd-11 ea2f4d57fa rsx: Fixups 2019-07-17 13:29:42 +03:00
kd-11 113a49e00c rsx: Handle cyclic references when doing memory inheritance 2019-07-17 13:29:42 +03:00
kd-11 34b06453f9 rsx: Handle lost data due to unused data sections
- After splitting, the sections may not be referenced at all for anything other than just pixel storage
- In such cases, either merge down or sample from the upstream source instead
2019-07-17 13:29:42 +03:00
kd-11 998717659f rsx: Fix reference leak when cloning surfaces 2019-07-17 13:29:42 +03:00
kd-11 009e01a347 rsx: Set up for multi-section inheritance 2019-07-17 13:29:42 +03:00
Alex James 397e5dd1ea Qt/game_list_frame: Ignore file entries when adding disc/game directories
Fixes #6212.
2019-07-16 15:58:52 +03:00
Nekotekina 736ec4035e Fixup for SPU Recompilers, regression after #6210 2019-07-15 19:51:58 +03:00
Nekotekina c062000288 Add experimental TSC frequency detection 2019-07-15 17:20:12 +03:00
Nekotekina cb5c26f2b5 Fix SPU Interpreter regression after #6147 2019-07-15 16:34:34 +03:00
Eladash 1e2f81dd33 kernel explorer typo fix 2019-07-15 15:50:40 +03:00
Nekotekina c01f1a8968 Avoid transitive include of vm_ref.h
Add forward declarations of vm::_ref_base
Remove default AT = u32 in _ptr_base and _ref_base (doesn't play well).
2019-07-15 15:46:46 +03:00
Nekotekina cfa1416d64 sys_spu: add vm::temporary_unlock 2019-07-14 18:33:23 +03:00
Nekotekina 1a1eff66bc sys_timer: add vm::temporary_unlock 2019-07-14 18:21:56 +03:00
Nekotekina bc1617758c sys_semaphore: add vm::temporary_unlock 2019-07-14 18:18:03 +03:00
Nekotekina 6126a98111 sys_rwlock: add vm::temporary_unlock 2019-07-14 18:14:15 +03:00
Nekotekina e1293b14f8 sys_net: add vm::temporary_unlock 2019-07-14 18:11:00 +03:00
Nekotekina f5ee8c1292 sys_interrupt: add vm::temporary_unlock 2019-07-14 18:08:18 +03:00
Nekotekina 0a88a23bf5 sys_event: add vm::temporary_unlock 2019-07-14 18:06:02 +03:00
Nekotekina cbfa6cc91f sys_vm: add vm::temporary_unlock 2019-07-14 17:55:26 +03:00
Nekotekina 38d4e3c184 sys_mmapper: add vm::temporary_unlock 2019-07-14 17:51:03 +03:00
Nekotekina 7398cfc950 sys_event_flag: add vm::temporary_unlock 2019-07-14 17:37:58 +03:00
Nekotekina 22e4ef147a SPU TSX: fix "Preferred SPU Threads" 2019-07-14 17:33:20 +03:00
Megamouse 9ff6486c85 Qt: Fix small controller icon in pad settings for high dpi modes 2019-07-14 16:19:02 +02:00
Eladash c727760537 Fix g_exec_addr addres check for access violations 2019-07-13 16:59:58 +03:00
Eladash 3de885c7a6 Dealloc exec cache after sys_prx/overlay_unload_module
Must come before vm::dealloc of it.
2019-07-13 16:59:58 +03:00
Megamouse 3d6c211382 Qt: fix app versions after a patch was removed from the game list 2019-07-13 10:50:41 +02:00
Malcolm Jestadt 94af3b3f03 vk: Fix Linux Vega float16_t workaround
- It was disabling float16_t for non Vega cards
2019-07-12 12:25:46 +03:00
yahfz ae055f6792 Set the default SPU Decoder to LLVM and rename SPU LLVM to "fastest" 2019-07-11 23:39:27 +02:00
Eladash 17c8ac9ab8 rsx: Debugger output text fix 2019-07-12 00:19:56 +03:00
Eladash c4d8ef4340 rsx: Allow to configure vblank rate
Removed "HLE protection" hack from sys_rsx_context_attribute
2019-07-12 00:19:56 +03:00
Eladash efbae02a22 Fix Emu.Stop() with vulkan device enumeration hack 2019-07-11 23:34:29 +03:00
Silent f3551cedb7 rsx: Swap R and B channels in SET_BLEND_COLOR since this color is BGRA, not RGBA 2019-07-11 22:51:01 +03:00
RipleyTom 6c6b973342 Microphone implementation 2019-07-11 20:13:12 +01:00
kd-11 2898309f68 vk: Silence some debug prints
- This message confuses some users
2019-07-11 13:22:13 +03:00
kd-11 fc09572648 rsx: Implement texel border decode
- Texel borders are no longer actually supported in modern APIs
- Removes the border texels and uses border color instead which is incorrect but should work fine
2019-07-11 13:22:13 +03:00
kd-11 d8f753f1e8 rsx: Do not allow framebuffer surfaces that exceed their allocated pitch dimensions
- Truncate surfaces to forcefully fit inside the declared region
2019-07-11 13:22:13 +03:00
Eladash 537d3f2548 Log last function on debug pause or exception, dump cpu_thread state on access violation 2019-07-10 17:35:39 +03:00
Eladash d7a2d42d8f MFC: Fix Tag Status report for sync/eieio/barrier commands 2019-07-10 17:35:39 +03:00
eladash 0979207cc6 Log currently PPU HLE function executed after access violation
old functionality retrieved
2019-07-10 17:35:39 +03:00
Silent 2016a33277 Fixed behaviour of buttons in Welcome, Find, Settings, VFS and Debugger dialogs - now reacting to button click, not press 2019-07-10 13:14:05 +03:00
Margen67 ab228d6407 Fix #6180 (typo in UI options) 2019-07-10 07:55:01 +02:00
Eladash 78e447e28c rsx: Typo fix 2019-07-09 22:47:55 +03:00
kd-11 2548057ea0 vk: Improve AMD driver support
- Workaround broken fp16 in AMDVLK/RADV
- Do not disable primitive restart as the issue seems to have been fixed
2019-07-09 16:27:59 +03:00
kd-11 956270d9be gl: Add readback/writeback config for format GL_R16 2019-07-09 16:27:59 +03:00
kd-11 c072c511a1 rsx: Add support for slice padding rows when gathering slices for cubemap/3d 2019-07-09 16:27:59 +03:00
kd-11 9ca6546dec vk: When reusing resources, make sure to reinitialize the component layout 2019-07-09 16:27:59 +03:00
kd-11 0cc672dcb3 vk: "Improve" initialization hack
- Change default alpha to 1 from 0
- TODO: Implement memory tagging for synchronizing this
2019-07-09 16:27:59 +03:00
kd-11 219a5382f7 rsx: If no array streams are enabled, mark inline array as disabled (null render) 2019-07-09 16:27:59 +03:00
kd-11 7840cd914e rsx: Fixup nv3089::image_in
- Correct pitch when sourcing from temp block
- Remove obsolete? double transfer that also introduced a stale pointer reference to freed memory
2019-07-09 16:27:59 +03:00
kd-11 c47f4fd59e vk: Fix frame skipping 2019-07-09 16:27:59 +03:00
Nekotekina b9130dd663 Remove redundant const on return value in rsx_methods.h 2019-07-09 12:09:21 +03:00
Nekotekina d1db6a6827 Revert incorrect usage of le_t in name_u64 2019-07-09 12:07:58 +03:00
Eladash 6fba3dd90c Misc correctness improvement
Use let_<u64> for name_64 and prefer it when possible.
2019-07-09 11:52:34 +03:00
Eladash 9d9e158b9a Make more use of the new get_int_t 2019-07-09 11:52:34 +03:00
Eladash d57b4dc8f3 rsx: Refactor rsx_decode.h and bugfixes 2019-07-09 11:52:34 +03:00
Nekotekina db4bc6f6be Add RESTRICT macro
Applied as C keyword 'restrict'
2019-07-08 19:43:16 +03:00
Nekotekina 92c08be387 Build with -fno-strict-aliasing
Doesn't affect MSVC build since MSVC already works in a similar manner.
2019-07-08 19:39:44 +03:00
kd-11 50736263d2 gl: Fix native pitch computation 2019-07-08 18:04:56 +03:00
RipleyTom 20dd7c0200 Adds spurs_test.self to test bins 2019-07-08 05:37:46 +01:00
arabek b6cfa5c9b9 Fix build with cotire and clang-8.0 branch
Without this patch, build fails when using
cotire, because pch headers are missing
the pthread flag when using Clang
2019-07-08 03:38:18 +01:00
Eladash 6d65d3424f rsx: Clamp fragment shaders address 2019-07-06 20:58:18 +03:00
Eladash 4c2fb54b99 Fix possible inconsistencies for sys_memory mem stats report 2019-07-04 22:35:22 +03:00
kd-11 ad10eb391e vk: Reuse discarded memory whenever possible instead of recreating new
objects
- Memory allocations are surprisingly expensive when spammed
2019-07-03 15:52:16 +03:00
kd-11 71e809a78b rsx: Implement dma abort in case of a reset after misprediction 2019-07-03 15:52:16 +03:00
kd-11 0f11939faf vk: Refactor gc 2019-07-03 15:52:16 +03:00
kd-11 ae93b417ec vk: Handle emergency commandbuffer close with dangling queries
- TODO: Refactoring
2019-07-03 15:52:16 +03:00
kd-11 d69e8288ad vk: Restructure commandbuffer submission into tagged event IDs
- Tagged eventIDs can be used to safely delete resources that are no
longer used
- TODO: Expand gc to collect images as well
- TODO: Fix the texture cache to avoid over-allocating image resources
2019-07-03 15:52:16 +03:00
kd-11 ce04a797c3 vk: Fix event signal race when speculation fails to avoid a cache miss
- TODO: Proper GC for stale events
2019-07-03 15:52:16 +03:00
Malcolm Jestadt b5d5113803 gl: Workaround slow PBO usage with Mesa
-Mesa is currently fastest with GL_STREAM_COPY
-See https://gitlab.freedesktop.org/mesa/mesa/commit/a338dc01866ce50bf7555ee8dc08491c7f63b585
-Also see https://bugs.freedesktop.org/show_bug.cgi?id=111043
2019-07-03 11:28:29 +03:00
msuih 690cdff0d3 Minor fixes
- Fix a typo in OpenAL
- Fix typo in cellHttp.h
- Unused variables in catch
- Use 64-bit shifts
- Use use_count with shared pointers, unique is depracated and getting removed
- Explicitly cast boolean to int
- Signed/unsigned issues with loop variables
- Fix missing return statement (the code path is unreachable, but compiler wants a return)
- */ ouside of comment
- Fix duplicate layout name
2019-07-01 04:33:23 +03:00
msuih 1e0289bcb2 Update libusb 2019-07-01 04:33:23 +03:00
msuih 503e023815 Explicitly downcast integers 2019-07-01 04:33:23 +03:00
msuih d57124d075 Explicitly cast size_t to integer types 2019-07-01 04:33:23 +03:00
msuih 146e43b6ec Do not use negative unsigned literals 2019-07-01 04:33:23 +03:00
msuih 13a557fe67 Silence some warnings
These are technically UB but work just fine
2019-07-01 04:20:00 +03:00
msuih 3d8389457e Disable more 3rdparty warnings 2019-07-01 04:20:00 +03:00
Eladash 2bce367488 Fixup for fixup (#6153)
* Fixup for fixup

* Fix memory ordering for MTRSX

volatile doesnt block reordering.

* ugh
2019-06-30 12:47:42 +03:00
Eladash 43f919c04b Fixup after #6143 (#6146)
vm::spu max address was overflowing resulting in issues, so cast to u64 where needed. Fixes #6145.
    Use vm::get_addr instead of manually substructing vm::base(0) from pointer in texture cache code.
    Prefer std::atomic_thread_fence over _mm_?fence(), adjust usage to be more correct.
    Used sequantially consistent ordering in semaphore_release for TSX path as well.
    Improved memory ordering for sys_rsx_context_iounmap/map.
    Fixed sync bugs in HLE gcm because of not using atomic instructions.
    Use release memory barrier in lwsync for PPU LLVM, according to this xbox360 programming guide lwsync is a hw release memory barrier.
    Also use release barrier where lwsync was originally used in liblv2 sys_lwmutex and cellSync.
    Use acquire barrier for isync instruction, see https://devblogs.microsoft.com/oldnewthing/20180814-00/?p=99485
2019-06-29 18:48:42 +03:00
Eladash 1ee7b91646 Refactoring (#6143)
Prefer vm::ptr<>::ptr over vm::get_addr.
    Prefer vm::_ptr/base over vm::g_base_addr with offset.
    Added methods atomic_t<>::bts and atomic_t<>::btr .
    Removed obsolute rsx::thread::Read/WriteIO32 methods.
    Removed wrong check in semaphore_release.
    Added handling for PUTRx commands for RawSPU MFC proxy.
    Prefer overloaded methods of v128 instead of _mm_... in VPKSHUS ppu interpreter precise.
    Fixed more potential overflows that may result in wrong behaviour.
    Added io/size alignment check for sys_rsx_context_iounmap.
    Added rsx::constants::local_mem_base which represents RSX local memory base address.
    Removed obsolute rsx::thread::main_mem_addr/ioSize/ioAddress members.
2019-06-29 01:27:49 +03:00
msuih e043412be4 Add timeout for vulkan device enumeration 2019-06-28 23:34:13 +03:00
JohnHolmesII 232a35b6fc Various small warning fixes
-Indentation warnings
-prevent shift overflow
-This was declared extern in all contexts. Remove this for initialization
-Fix main return types. OH CANADA!
-Silence extraneos 'unused expression' warning
-Force use return value (warning)
-Remove tautological compare copy-pasta (char always < 256)
2019-06-28 01:45:29 +03:00
JohnHolmesII 948c1df969 Remove unecessary vulkan loader check var, per kd 2019-06-28 01:45:29 +03:00
JohnHolmesII a124ec4a26 Remove braces around shader source strings (warnings) 2019-06-28 01:45:29 +03:00
JohnHolmesII d0eae7bab1 Fix -Wsign-compare a little bit
Explicitly mark loop types (per review)
2019-06-28 01:45:29 +03:00
JohnHolmesII 22917084d9 Explcitly mark overflow in various SIMD functions. Doing so silently
created warnings.
2019-06-28 01:40:52 +03:00
JohnHolmesII ebb1ae6408 Properly ignore SIMD macros to avoid warning 2019-06-28 01:40:52 +03:00
JohnHolmesII 23094b48bb Fix warnings related to -Wswitch
Add default cases.
Move default breaks to newline
Add proper handling in some instances.
Add missing enums to switches
2019-06-28 01:40:52 +03:00
JohnHolmesII be521ff0ab Fix warnings related to parentheses 2019-06-25 20:36:32 -07:00
JohnHolmesII 32f8f40a4a Disable warnings for stb_image.cpp. Should this file be moved to
3rdparty?
2019-06-25 20:36:32 -07:00
JohnHolmesII 1fcf62fdf0 asmjit cleaned up their cmake warnings (no code change) 2019-06-25 20:36:32 -07:00
JohnHolmesII 27fca2ed33 CMake refactor 2019-06-25 20:36:32 -07:00
Nekotekina 1641be5e0c Fix UTF-8 BOM in vm.cpp 2019-06-25 22:21:56 +03:00
Malcolm Jestadt 31afd046b0 lv2: sys_timer_usleep improvements for linux
-The minimum quantum on linux appears to be 50 microseconds by default, not 100
-Do not wait for the last quantum to avoid sleeping too long
2019-06-25 20:20:05 +01:00
kd-11 9ce7b8a401 vk: Add LLVM8 warning for RADV drivers 2019-06-25 20:50:54 +03:00
kd-11 009c55fcba vk: Fix broken layout stream on first draw call 2019-06-25 20:50:54 +03:00
kd-11 4ff77a8555 rsx: Improve balancing of the offloader thread
- Use two counters to avoid atomic operations
- Yield instead of sleeping because some games are very sensitive to timing
2019-06-25 20:50:54 +03:00
kd-11 8249d51aa8 vk: Optimize occlusion pool management
- Do not consume a slot every draw call, instead batch as many draws as possible
- Since renderpasses are dispatched per-draw-clause, keeping occlusion queries outside the renderpasses works fine
- If renderpasses are reorganized, occlusion tasks will have to be reorganized again
2019-06-25 20:50:54 +03:00
kd-11 1ee675e1f4 facepalm of the year
- Typo fix
- This check leads to forever relocating memory if size never exceeds capacity!
2019-06-25 20:50:54 +03:00
kd-11 2b9c315374 rsx: Use rpcs3 thread construct for the offloader thread 2019-06-25 20:50:54 +03:00
kd-11 d26b25816d rsx: Improve profiling setup
- Avoid spamming QPC when not needed
- Free performance when debug overlay is not enabled
2019-06-25 20:50:54 +03:00
kd-11 b893a75002 rsx: Rework RSX offloading
- Use a lockless queue
- Do not enqueue small transfers
2019-06-25 20:50:54 +03:00
kd-11 c32c1b0a62 gl: Minor API tweaks
- Avoid spamming the driver with samplerParameter calls unless the parameters have actually changed
2019-06-25 20:50:54 +03:00
kd-11 6a32f716db rsx: Reimplement vertex layout streaming
- Remove string comparisons from the hot-path!
- Use attribute streaming and push constants to avoid forcing a descriptor block copy every other draw call/pass.
  While this isn't so bad on nvidia cards, it makes AMD cards a slideshow.
2019-06-25 20:50:54 +03:00
kd-11 59ee74a275 rsx: Disable vertex cache if multithreaded memory access is enabled
- When multithreaded RSX is enabled, the vertex cache just lowers performance
- The small cost of upload is paid by the asynchronous thread, allowing RSX to work optimally
2019-06-25 20:50:54 +03:00
kd-11 0fa3bcc336 rsx: Asynchronous data transfer 2019-06-25 20:50:54 +03:00
kd-11 358169507c rsx: Use SSE to accelerate index buffer uploads 2019-06-25 20:50:54 +03:00
kd-11 b645ebdb04 vk: Refactor device management and improve driver detection 2019-06-25 20:50:54 +03:00
kd-11 25bba9bf56 vk: API update
- use KHRONOS_validation instead of LUNARG_standard_validation which is deprecated
2019-06-25 20:50:54 +03:00
kd-11 f113cfe5c0 vk: Avoid some useless memory barriers
- Do format conversions only when necessary
2019-06-25 20:50:54 +03:00
kd-11 c9501b60ab rsx: Use explicit fma for MAD emulation 2019-06-25 20:50:54 +03:00
kd-11 6be7c58fa4 glsl: Refactoring, cleanup and optimizations
- Avoid generating unused code
- Reduce GPR usage in emitted code
2019-06-25 20:50:54 +03:00
Lassi Hämäläinen c963c51a60 Remove unnecessary header includes
- Manually removed lot of unneeded #includes to clean code and reduce
  compilation time
- Reordered some of the #includes to be in more logical order
2019-06-25 17:11:10 +03:00
Lassi Hämäläinen 23432d420d CMake: Disable RTTI for jit.cpp on MSVC 2019-06-25 17:11:10 +03:00
Lassi Hämäläinen a070a414a6 Move rsx::constants and rsx::limits to rsx_utils.h 2019-06-25 17:11:10 +03:00
Lassi Hämäläinen e9e87b8bd9 Add missing #includes to header files
- Multiple header files where missing #includes to other headers that
  where used in the header. Correct header was included in correct
  order in source files which caused everything to compile.
- Added missing #includes so header files correctly include all their
  dependencies and fixes problems with IDEs being unable to parse
  headers correctly due to missing symbols
2019-06-25 17:11:10 +03:00
Lassi Hämäläinen 499035512b Split Emu/Memory into more logical headers
- Add vm_locking.h and vm_reservation.h and move relevant functions
  and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
  usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
  vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
  where vm::reservation_* and locking related functions are used
2019-06-25 17:11:10 +03:00
Megamouse 8e942eb50c Qt: add more filters to the decryption file dialog and fix file endings 2019-06-23 21:08:58 +03:00
Eladash 806a7bbf04 Fixup for #6115 (#6120) 2019-06-22 12:10:47 +03:00
Eladash cd0ef99df5 Fix BE endianess arch support in semaphore_406e (#6116)
Add raw() methods for endianness support types and make use of it.
2019-06-21 19:29:49 +03:00
Eladash ade291e73d Fix potential overflow in sys_vm 2019-06-21 00:02:52 +03:00
Nekotekina 517a2bc34a sys_lwcond: add vm::temporary_unlock 2019-06-20 14:46:32 +03:00
Nekotekina a935203a18 sys_lwmutex: add vm::temporary_unlock 2019-06-20 14:46:32 +03:00
Nekotekina b9b591bf02 Fix SPU Loop Detection 2019-06-20 14:46:32 +03:00
Megamouse 3602d45cb7 input: raise max mouse acceleration to x10 2019-06-20 10:23:50 +02:00
Megamouse a0f2ade55d gui/input: improve log message for GetNextButtonPress 2019-06-20 10:23:50 +02:00
Nekotekina 5753b3222e sys_memory: add vm::temporary_unlock 2019-06-19 20:45:59 +03:00
Nekotekina d021d9e14a sys_mutex: add vm::temporary_unlock 2019-06-19 20:39:39 +03:00
Nekotekina 89a31292dc sys_cond: add vm::temporary_unlock 2019-06-19 20:39:29 +03:00
Nekotekina 5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
Megamouse 17d0dcb7a2 gui/input: add evdev callback when no button was pressed 2019-06-18 18:15:19 +02:00
Eladash d52953fca6 minor UB fix 2019-06-17 02:52:43 +03:00
Ivan 0fe26f8293 Add sys_rsx_context_iomap workaround
Don't fail with CELL_EINVAL on vm::main.
2019-06-17 01:17:02 +03:00
scribam 185fd3d257 rsx: Minor cleanup after #6055 2019-06-17 00:31:38 +03:00
Megamouse 5928dd826c Qt: add Remove All Caches to the game context menu 2019-06-16 23:07:13 +03:00
Rui Pinheiro b94730fa95 Fix dynamic_library::loaded 2019-06-16 21:31:38 +03:00
Megamouse b29a89807e cellPad: set len to 0 if pads are being intercepted by the system 2019-06-15 00:24:10 +02:00
Megamouse 3f00b485a0 cellMsgDialogAbort: don't call on_close and properly re-enable pads 2019-06-15 00:24:10 +02:00
kd-11 8dafc8e542 cfg: Default MSAA level to auto 2019-06-14 17:19:55 +03:00
kd-11 e515d9b83a vk: Fixup for missing resource reference
- Missing ref increment when using framebuffer could lead to use-after-free.
  How master was not crashing is surprising
2019-06-14 16:19:52 +03:00
kd-11 c90186cf35 vk: Do not use pixel_center_origin as its use is explicitly restricted by spec 2019-06-14 16:19:52 +03:00
kd-11 98156d2a2c vk: Avoid submitting wrong sample count in overlay passes 2019-06-14 16:19:52 +03:00
kd-11 4104d7a6a1 vk: Simplify WCB heuristics and fix out-of-bounds access 2019-06-14 16:19:52 +03:00
kd-11 86119f58d6 rsx: Typo fix 2019-06-14 16:19:52 +03:00
kd-11 9d166c5bed rsx: Force invalidate of children by issuing a resolve notification whenever the parent is written to
- Fixes successive reads of an antialiased surface that is still bound between reads
2019-06-14 16:19:52 +03:00
kd-11 296e0105c4 vk: Fix WCB for antialiased memory 2019-06-14 16:19:52 +03:00
kd-11 9d0f5aedf3 vk: Add some missing barriers 2019-06-14 16:19:52 +03:00
kd-11 e4671c29a6 rsx: Fix typo
- Arguments to the transform function are xxyy not xyxy
2019-06-14 16:19:52 +03:00
kd-11 8a1cf2c913 rsx: Attempt to reduce stencil load overhead for nvidia cards 2019-06-14 16:19:52 +03:00
kd-11 ca82dd7200 vk: Improve overlay passes for resolve/unreolve
- Refactor overlays and resolve passes to support use of push constants instead of relying buffer map/unmap
- Add support for nvidia resolve (NV is the only vendor not supporting shader_stencil_export)
2019-06-14 16:19:52 +03:00
kd-11 c655036920 rsx/fp: Ease pressure on fragment shaders when emulating clamp16
- TODO: Option to completely skip clamping in some architectures as it is not needed in most games
- Mostly affects older GPUs that do not have access to native fp16
2019-06-14 16:19:52 +03:00
kd-11 5f34c0c59a vk: Clean up WCB readbacks when resource is multisampled
- Resolve image first before performing any transfer operations
2019-06-14 16:19:52 +03:00
kd-11 9d314ca4ca rsx: Correctly count number of valid entries if there are broken entries in the cache 2019-06-14 16:19:52 +03:00
kd-11 bca5f94b3f rsx: Add option to toggle MSAA 2019-06-14 16:19:52 +03:00
kd-11 ea8409dcfd rsx: Re-enable optional sample-to-pixel transformation 2019-06-14 16:19:52 +03:00
kd-11 acb14320da rsx: Fixup for resolution scaling support 2019-06-14 16:19:52 +03:00
kd-11 4a5bbba277 rsx: Enable MSAA
- vk: Enable depth buffer resolve+unresolve
- vk: Add AMD stenciling extension support
- rsx: Temporarily disables MSAA-compatible hacks such as transparency AA
- TODO: Add paths to optionally disable MSAA
2019-06-14 16:19:52 +03:00
kd-11 f6f3b40ecc rsx: Fix AA coordinate transforms
- Requires native_pitch value to take samples into account
2019-06-14 16:19:52 +03:00
kd-11 655eff29e8 rsx: Refactoring and cleanup after d3d12 separation
- Remove deprecated functionality
- Refactor to share code between common routines
2019-06-14 16:19:52 +03:00
kd-11 db5d56a22d d3d12: Remove all shared code with other backends 2019-06-14 16:19:52 +03:00
kd-11 0d906d6974 rsx: Remove surface aa_mode hacks 2019-06-14 16:19:52 +03:00
Megamouse ac3982d2b0 Input: fix evdev buttons 2019-06-13 19:12:46 +02:00
scribam 595ad15499 Add FUNDING.yml 2019-06-12 18:20:52 +03:00
scribam 13671d9684 rsx: Apply Clang-Tidy fix "modernize-loop-convert" + const when relevant 2019-06-12 15:11:52 +03:00
scribam 1e327ad31b rsx: Apply Clang-Tidy fix "readability-avoid-const-params-in-decls" 2019-06-12 15:11:52 +03:00
scribam 370dcd9d6e rsx: Apply Clang-Tidy fix "readability-simplify-subscript-expr" 2019-06-12 15:11:52 +03:00
scribam 0b97d12a7b rsx: Apply Clang-Tidy fix "modernize-use-using" 2019-06-12 15:11:52 +03:00
scribam f1e939936a rsx: Apply Clang-Tidy fix "modernize-use-override" 2019-06-12 15:11:52 +03:00
scribam 44265aa27d rsx: Apply Clang-Tidy fix "modernize-use-equals-default" 2019-06-12 15:11:52 +03:00
scribam 635695ac78 rsx: Apply Clang-Tidy fix "modernize-use-emplace" 2019-06-12 15:11:52 +03:00
scribam a555504142 rsx: Apply Clang-Tidy fix "modernize-deprecated-headers" 2019-06-12 15:11:52 +03:00
scribam cba828384d rsx: Apply Clang-Tidy fix "modernize-pass-by-value" 2019-06-12 15:11:52 +03:00
scribam a02a8642b0 rsx: Apply Clang-Tidy fix "modernize-make-unique" 2019-06-12 15:11:52 +03:00
scribam b91bcdbbca rsx: Apply Clang-Tidy fix "modernize-use-bool-literals" 2019-06-12 15:11:52 +03:00
scribam 349e7c8708 rsx: Apply Clang-Tidy fix "readability-non-const-parameter" 2019-06-12 15:11:52 +03:00
scribam 35dc98be06 rsx: Apply Clang-Tidy fix "readability-string-compare" 2019-06-12 15:11:52 +03:00
scribam ac7e89660f rsx: Apply Clang-Tidy fix "readability-redundant-smartptr-get" 2019-06-12 15:11:52 +03:00
scribam 801fa0113f rsx: Apply Clang-Tidy fix "readability-inconsistent-declaration-parameter-name" 2019-06-12 15:11:52 +03:00
scribam c9b0a4afd0 rsx: Apply Clang-Tidy fix "performance-type-promotion-in-math-fn" 2019-06-12 15:11:52 +03:00
scribam 8f2647555a rsx: Apply Clang-Tidy fix "readability-redundant-string-init" 2019-06-12 15:11:52 +03:00
scribam 331fe01762 rsx: Apply Clang-Tidy fix "performance-for-range-copy" 2019-06-12 15:11:52 +03:00
scribam db926ee671 rsx: Apply Clang-Tidy fix "performance-unnecessary-value-param" 2019-06-12 15:11:52 +03:00
scribam 81a3b49c2f rsx: Apply Clang-Tidy fix "readability-container-size-empty" 2019-06-12 15:11:52 +03:00
scribam c4667133c4 gl/vk: Add constexpr to varying_registers and sync functions between the two backends 2019-06-12 10:59:31 +01:00
scribam 497f0c26e7 utilities: Add constexpr to color4_base
For consistency with the others colorX_base
2019-06-12 10:59:31 +01:00
scribam 65581acbf9 rsx: Use constexpr for flattening_helper::m_register_properties 2019-06-12 10:59:31 +01:00
Eladash d6db61c594 misc atomics: Use std::atomic_thread_fence (MSVC) 2019-06-11 12:18:04 +03:00
scribam b3513cd7fa Set minimum supported version of GCC to 8.x
And update the documentation accordingly
2019-06-11 00:48:11 +03:00
kd-11 d361eedbec rsx: Clean up window management code
- Removes a lot of wm_event code that was used to perform window management and is no longer needed.
- Significantly simplifies the vulkan code.
- Implements resource management when vulkan window is minimized to allow resources to be freed.
2019-06-10 14:57:03 +03:00
kd-11 57196f0504 vk: Move frame present synchronization to the driver
- Just use a semaphore and let the driver handle it instead of manual framepacing.
  We lose framepace control but drivers have matured in the past few years so it should work fine.
2019-06-10 14:57:03 +03:00
Talkashie 527f7a437a important fix (#6067)
Fix typo in Pad Settings Dialog
2019-06-10 13:03:55 +03:00
RainbowCookie32 652e32341d Update DS3 message in Pads settings 2019-06-10 00:52:22 +01:00
scribam 8646e90832 3rdparty: Update stb_image.h and stb_truetype.h 2019-06-09 23:43:57 +01:00
scribam b190e1f50b 3rdparty/vk: Update VulkanMemoryAllocator to version v2.2.0 2019-06-09 23:43:57 +01:00
scribam 39fa1d7031 ci/vk: Bump Vulkan version (1.1.73.0/1.1.97.0 => 1.1.106.0)
VULKAN_SDK_MIRROR removed as the server is down
2019-06-09 23:43:57 +01:00
scribam f9ad635856 rsx: TextGlyphs optimizations 2019-06-09 23:09:11 +01:00
Nekotekina 2bc0ea37ab sys_fs: yield PPU on disk access ops 2019-06-08 19:34:55 +03:00
Megamouse e8a516529b fix games.yml 2019-06-08 15:47:11 +03:00
Nekotekina 1dedeb37bf Fix lf_queue_base::wait
Add missing state change
2019-06-05 15:51:25 +03:00
Nekotekina b2e08100ff Fix sad bug 2019-06-04 19:13:30 +03:00
Nekotekina 9dc0368079 Rename cond_x16 to shared_cond
Extend capacity from 16 to 32.
Remove redundant m_total counter.
2019-06-04 16:37:50 +03:00
Nekotekina 447029a700 Implement fs::file::write_gather (Vectored I/O) 2019-06-03 23:18:39 +03:00
Nekotekina 31994dd3b2 Rename cond_one to unique_cond
Remove redundant in_cv in cellVdec
2019-06-02 23:22:16 +03:00
Nekotekina 0333942795 Change utils::popcnt16 to popcnt32
Use __builtin_popcount if available.
2019-06-02 23:22:16 +03:00
Nekotekina dfd50d0185 Implement std::bit_cast<>
Partial implementation of std::bit_cast from C++20.
Also fix most strict-aliasing rule break warnings (gcc).
2019-06-02 23:22:16 +03:00
scribam 790962425c Fix some "-Wpedantic" warnings 2019-06-01 22:59:23 +03:00
scribam 99c1f87289 vk: Fix memory value in comments to match with the code below 2019-06-01 22:59:23 +03:00
scribam 66946a83e6 keyboard: Replace integer literals by bool when relevant
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2019-06-01 22:59:23 +03:00
scribam 8a6b5ca71f Access class static methods with "::"
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/readability-static-accessed-through-instance.html
2019-06-01 22:59:23 +03:00
scribam 09c9996f31 Use empty() instead of comparing size() with 0
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/readability-container-size-empty.html
2019-06-01 22:59:23 +03:00
scribam bf557ea6e6 Use the more efficient character literal overload for find_first_of/find_last_of
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html
2019-06-01 22:59:23 +03:00
scribam 78c7ef3039 rsx: Use clear() instead of resize(0)
The result is the same but clear [1] has slightly less code than resize [2] and signals better the intent IMHO.

[1] https://github.com/gcc-mirror/gcc/blob/fb7fb646fa1631f429dcca7201f4a1a77f876667/libstdc%2B%2B-v3/include/bits/stl_vector.h#L1495
[2] https://github.com/gcc-mirror/gcc/blob/fb7fb646fa1631f429dcca7201f4a1a77f876667/libstdc%2B%2B-v3/include/bits/stl_vector.h#L934
2019-06-01 22:59:23 +03:00
Malcolm Jestadt f90f68d129 Detect tsx_force_abort presence and print to log 2019-06-01 17:46:57 +03:00
Megamouse cafa4521ee Better Support For Game Collections (#4450) 2019-06-01 01:12:30 +03:00
scribam 141d78344a cmake: do not build glslang SPVRemapper 2019-06-01 00:01:32 +03:00
scribam d9d7634f8b vk: remove duplicate condition in pipeline_props struct equal operator 2019-06-01 00:01:32 +03:00
msuih 32776db8a6 Remove SPU verification from settings 2019-05-31 19:49:32 +03:00
msuih ef587d4cdc Limit shaderlog writing behind log_programs setting 2019-05-31 19:49:32 +03:00
kd-11 f2cac26154 rsx: Refactor out GLSLTypes from GLSLCommon to avoid warning spam due to unused functions when included in settings dialog code 2019-05-31 13:27:43 +03:00
kd-11 6e92516070 vk: Do not reset descriptors from the aux buffer when things are running slow
- The aux buffer borrows its descriptors from the lagging frame, so they are still in use until the frame completes.
2019-05-31 13:27:43 +03:00
kd-11 e118c9e5da update glslang 2019-05-30 11:48:38 +03:00
Megamouse c638e82678 Qt: fix a crash when closing rpcs3 after downloading the compat database 2019-05-28 21:47:49 +02:00
Megamouse fb1d8cb548 Qt/Input: keep LED colors when setting vibration and merge pad functions 2019-05-28 21:47:49 +02:00
Megamouse 5760aa2e57 Qt: Use correct LED color in pad settings dialog 2019-05-28 21:47:49 +02:00
Megamouse e4fca8274e PSF: Don't attempt to load files with size 0 2019-05-28 21:47:49 +02:00
Megamouse f48589005d handle some more warnings 2019-05-28 21:47:49 +02:00
Megamouse 8ebe02ce32 Qt: properly disable the "Filter Noise" button in pad_settings_dialog 2019-05-28 21:47:49 +02:00
Megamouse 3a5d1c6b15 Input: Add simple stick multipliers 2019-05-28 21:47:49 +02:00
Megamouse 34964e0e4f handle some warnings 2019-05-28 21:47:49 +02:00
kd-11 d9ab2c7104 vk: Bump shaders cache version
- Pipeline properties changed with the renderpass update
2019-05-28 15:28:30 +03:00
kd-11 57eb892153 vk: Refactor framebuffers
- Refactor out framebuffers from the renderer core
- Use a proper cache with sorted queues for faster searching
2019-05-28 15:28:30 +03:00
Nekotekina 71b71537a0 SPU TSX: implement Accurate PUTLLC option
Allow spurious PUTLLC failure if disabled (default).
2019-05-25 22:23:23 +03:00
Nekotekina b839cc9d5b SPU TSX: restore busy_wait in GETLLAR 2019-05-25 21:41:11 +03:00
kd-11 507ec8252b vk: Refactor renderpass management
- Ensures the current renderpass matches the image properties even when a cyclic reference is detected
- Solves SDK debug output error spam due to mismatching layouts and renderpasses
2019-05-25 14:07:29 +03:00
Malcolm Jestadt c348fec84b Warn AMD linux users about potential performance loss if not using RADV 2019-05-24 17:16:29 +03:00
Malcolm Jestadt 6ab3011eef vk: Check_window_status fixups
Intel ANV has been tested and verified to work without workaround
AMDVLK and the proprietary AMD driver have been confirmed to require workaround for window resizing
2019-05-24 17:16:29 +03:00
RipleyTom d616ce223c Official ds3 driver support 2019-05-22 16:56:40 +03:00
kd-11 370b9e196d vk: Improve descriptor pool management
- Add double-buffered descriptor pools to avoid use-after-free situations
- Make descriptor pools more configurable
- Also adds in a hack to allow renderdoc to capture properly
2019-05-22 01:18:46 +03:00
kd-11 46ba53f122 vk: Propagate more information to the driver
- Pass "correct" layout to descriptors
- TODO: Fix renderpass attachment descriptors which are inadvertently doing silent transitions
2019-05-22 01:18:46 +03:00
kd-11 c3b234f972 gl: Fix staging buffer size calculation 2019-05-22 01:18:46 +03:00
Malcolm 9a26c0abda Overlays: Fix timing 2019-05-21 13:01:38 +03:00
Nekotekina 7de3c410cf SPU/PPU: update reservation logic on TSX path transactions
Make use of lock bits in reservation counters.
On PPU, fallback to compare_and_swap instead of desperate retry.
On SPU, lighten write set on retry by 'locking' outside of the transaction.
2019-05-20 14:32:50 +03:00
Nekotekina 9abb303569 vm: expand reservation lock bit area to 7 bit
This is minor change.
2019-05-19 17:46:55 +03:00
Nekotekina ceaa669494 LLVM DSL: change array syntax again
I probably misunderstand something.
2019-05-19 17:46:55 +03:00
Nekotekina a6cde36dc4 Link LLVMAsmParser library 2019-05-19 17:46:55 +03:00
kd-11 8009e53642 rsx: Fix upload block range optimization
- The 'max' index should take the first assigned ID; fixes problems with divisors
2019-05-19 17:33:21 +03:00
kd-11 a245d9fb24 vk: DOuble general-purpose heap allocation to 128M and add a better diagnostic message for OOM 2019-05-19 17:33:21 +03:00
kd-11 0ef7b2aaff rsx: Use a saner model for swap queue handling
- Use a simple queue to avoid redundant checks over all the contexts
- Poll queue if RSX pipe is idle
- Only check the queue when the frame context is dirty (after a queue operation)
- Reset descriptors at the start of the frame context to avoid having to synchronize mid-frame
- Fully synchronize if a descriptor reset is required mid-frame (spec compliance; also fixes flickering verts on some hardware)
2019-05-19 17:33:21 +03:00
kd-11 dc749d3975 vk: Bump max number of allocated draw calls from 4k to 16k 2019-05-19 17:33:21 +03:00
Nekotekina 85920253b3 SPU ASMJIT: fix BISLED
Properly prevent losing branch target (addr) vs get_events result (flags).
Move get_events() to the beginning.
Match BISL indirect_branch() args.
2019-05-17 23:44:19 +03:00
Nekotekina 6416fee986 SPU ASMJIT: fix indirect branch target order
Check stack mirror first, as in SPU LLVM.
2019-05-17 23:44:19 +03:00
Nekotekina bf7ee2de4c SPU: fix spu_runtime::g_tail_escape (unused yet) 2019-05-17 23:44:19 +03:00
Nekotekina 2cf139c7a8 SPU analyser: minor Safe fix
Properly handle known indirect branch target as a function call target.
2019-05-17 23:44:19 +03:00
msuih 164a7636bf Add max SPURS threads to settings 2019-05-17 23:43:00 +03:00
kd-11 e3f68c66d8 rsx: Use a shared sampler pool instead of relying on the drivers 2019-05-17 22:51:40 +03:00
Megamouse edb1a32bb1 overlays: use L1 and R1 to step by 10 in the save data list 2019-05-17 20:21:23 +02:00
Megamouse 32bdd8ef7b overlays: move some code to cpp files 2019-05-17 20:21:23 +02:00
kd-11 4037225e98 vk: Workaround for cyclic feedback loops
- Transition attachments to LAYOUT_GENERAL in case of a feedback loop
  - Fixes appearance of garbage along polygon edges in some
post-processing passes.
  - Also reverse this transition when rendering goes back to normal
2019-05-17 16:41:17 +03:00
gidan80 9aa08313e3 Qt: Add custom pad configs
Add a custom pad config for every game.
2019-05-16 20:37:41 +02:00
kd-11 cb78522620 rsx: Fixup for uninitialized surface antialiasing mode 2019-05-16 19:25:26 +03:00
kd-11 45a13d0319 rsx: Fixup for lost aliased surfaces
- Intersection routines were changed and require explicit identification of the "old surface"
2019-05-16 19:25:26 +03:00
kd-11 05eb1e9193 rsx: Fix zombie image references from inside the texture cache
- Do not add locked orphans to the flush_always cache! They will not remove their cache entries as they are not bound
2019-05-16 19:25:26 +03:00
kd-11 214bb3ec87 rsx: Always initialize memory unless it is guaranteed to be wiped 2019-05-16 19:25:26 +03:00
kd-11 88290d9fab rsx: Hack around using data regions as transfer targets 2019-05-16 19:25:26 +03:00
kd-11 4182f9984d rsx: Propagate split section information back to the texture cache 2019-05-16 19:25:26 +03:00
kd-11 3c7d8a1099 rsx: Minor texture/surface scanning optimization
- Also re-enable optimization in blit engine accidentally disabled during debugging
2019-05-16 19:25:26 +03:00
kd-11 9f0090772a rsx: Fix write tagging when comments are transferred in by blit engine 2019-05-16 19:25:26 +03:00
kd-11 4b443be881 rsx: Fix self-intersection with previous occupant of the address being replaced 2019-05-16 19:25:26 +03:00
kd-11 b840f6da28 [WIP] rsx: Use a sane reference counting model 2019-05-16 19:25:26 +03:00
kd-11 e3cf3ab6b8 rsx: Minor fixes
- Fix transfer scaling (inverted)
- Fix under-estimated typeless acquisition when doing depth format scaling
2019-05-16 19:25:26 +03:00
kd-11 e02e27b2b3 rsx: Prevent out-of-bounds writes when resolving shader input textures
- The target area can also have padding!
2019-05-16 19:25:26 +03:00
kd-11 1c439f6198 vk: Fix some spec violations 2019-05-16 19:25:26 +03:00
kd-11 88c20afd3a rsx: Implement unaligned surface inheritance with hierachial contribution
- Allows render targets to behave like stacked 3D views same as shader inputs are resolved
- Basically implements most of 'Read Color/Depth Buffers" option for 'free'.
- Allows splitting RTV/DSV resources if they are superceded by a partial surface
- Also allows intersecting new resources through the surface cache for proper inheritance from other scattered data
- TODO: Refactor bind_surface_as_rtt and bind_surface_as_ds to reduce asinine code duplication
2019-05-16 19:25:26 +03:00
Nekotekina a016728a9e SPU LLVM: re-enable stack mirror
It was disabled due to other bugs which should be fixed now.
2019-05-16 04:12:08 +03:00
Nekotekina a69329fe02 SPU ASMJIT: Fix Giga mode
This is embarassing.
Fixed local instruction table computation (indirect branch).
2019-05-16 04:11:05 +03:00
Nekotekina 26d131ef29 SPU LLVM: Fix Giga mode
Forgot to adjust global chunk table computation.
2019-05-16 04:02:33 +03:00
Nekotekina 91897fa69d SPU LLVM/ASMJIT: fix BRA/BRASL instructions for PIC
Handle absolute branch addressing correctly.
2019-05-16 02:41:31 +03:00
Nekotekina f95ec8a37c SPU LLVM: simplify jump table computation
Remove one add operation and adjust constants instead.
2019-05-16 00:54:50 +03:00
Nekotekina b138d25b97 SPU Disasm: fix absolute addressing in some instructions.
STQA, LQA, BRA, BRASL instructions.
2019-05-16 00:53:37 +03:00
Nekotekina a921af1e96 SPU LLVM/ASMJIT: remove minor unnecessary code 2019-05-16 00:52:52 +03:00
Nekotekina 43ae4b3f33 SPU LLVM/ASMJIT: add missing PC clamping
Minor fix, since it's mostly impossible to overflow.
2019-05-16 00:51:47 +03:00
Nekotekina 007108100e SPU: implement spu_runtime::g_tail_escape
May help to avoid gateway costs in some cases.
2019-05-15 18:47:40 +03:00
Nekotekina 4e75d2c2f7 SPU LLVM: don't save $2 in optimized functions 2019-05-15 16:41:57 +03:00
Nekotekina adc7d96683 SPU LLVM: simplify function prototype
Pass only $3
2019-05-15 16:18:13 +03:00
Nekotekina 16401722f1 SPU LLVM: fix $SP passing in functions, write PC on halt
Allows to skip updating $SP in optimizable functions.
2019-05-15 15:42:03 +03:00
Nekotekina b2d0ca83fb LLVM DSL: simplify value_t template for array 2019-05-15 15:17:36 +03:00
Nekotekina 09eb633f69 SPU ASMJIT: increase stack frame size
It seems Windows has minimal stack frame size 0x28.
2019-05-15 02:16:08 +03:00
Nekotekina 3753d27aba SPU: fix Giga mode (kinda)
Don't scan before the entry point.
Disable stack mirror in SPU LLVM.
Improve analyser logic for holes.
2019-05-14 22:15:04 +03:00
Nekotekina c481472faf SPU ASMJIT: add PIC support (fix)
Also cleanup and adapt for GHC CC.
2019-05-14 22:15:04 +03:00
Nekotekina 82295d131a SPU LLVM: split LLVM IR dump to spu-ir.log
Also move disasm to spu_recompiler_base::dump.
Interleave disasm with block target info for convenience.
2019-05-14 22:15:04 +03:00
Nekotekina ea554ae828 Implement 'Max SPURS Threads' option (hack)
Pauses SPURS threads beyond limit automatically if set.
2019-05-14 22:15:04 +03:00
Nekotekina 1eed421774 SPU LLVM: use branch patchpoints again
Renewed and adapted for PIC and all branch types.
This may address performance degradation after #5923.
2019-05-14 22:15:04 +03:00
Nekotekina 2f6707d0a0 SPU LLVM: regain some efficiency
Avoid returns from the recompiler gateway, favoring tail calls.
This may address performance degradation after #5923.
2019-05-14 22:15:04 +03:00
Nekotekina f33b81545e SPU: implement recompiler gateway function in assembly
Use GHC calling convention directly for SPU object entry points.
This may address performance degradation after #5923.
2019-05-14 22:15:04 +03:00
Nekotekina a74fd27e3d SPU LLVM: fix SPU termination (spu_escape) on Windows
Adjust restored stack pointer for the lack of tail call.
2019-05-14 22:15:04 +03:00
Nekotekina cc8c635855 SPU: PIC support preview
SPU ASMJIT not supported yet.
Giga mode not supported properly.
2019-05-14 22:15:04 +03:00
z0z0z 7cf11c7637 Use setenv instead of qputenv
A user reported issues with Qt's hidpi scaling and RPCS3. They could not disable with their own environment variable because qputenv overwrites them, setenv with 0 as third arg doesn't.
2019-05-14 21:48:14 +03:00
drysalter 6b01c2f9f5 Further changes to Skyline and Envy 2019-05-14 09:16:45 +01:00
scribam 22f61caf9f GLTexture: add missing #pragma once directive 2019-05-12 18:32:11 +03:00
scribam 786dc6ef40 Use if constexpr in hash_struct function 2019-05-12 18:32:11 +03:00
scribam 6c5ea068c9 Remove redundant semicolons
Fix "-Wextra-semi" warnings
2019-05-12 18:32:11 +03:00
Rui Pinheiro 1f82a26a9c SPU LLVM: Fix Mega 2019-05-12 00:39:42 +03:00
scribam 3623f4343f gl/vk: clear scissor_setup_invalid bit along with scissor_config_state_dirty bit 2019-05-11 13:13:49 +03:00
Nekotekina 8194c92f1c SPU LLVM: disable GHC CC for chunks on Windows
Causes fatal error inside LLVM.
2019-05-11 02:35:16 +03:00
Nekotekina 5d33d9a3d9 Enable most warnings in GCC 2019-05-11 02:13:19 +03:00
Nekotekina 7492f335e9 SPU analyser: basic function detection in Giga mode
Misc: fix EH frame registration (LLVM, non-Windows).
Misc: constant-folding bitcast (cpu_translator).
Misc: add syntax for LLVM arrays (cpu_translator).
Misc: use function names for proper linkage (SPU LLVM).

Changed function search and verification in Giga mode.
Basic stack frame layout analysis.
Function detection in Giga mode.
Basic use of new information in SPU LLVM.
Fixed jump table compilation in SPU LLVM.
Disable broken optimization in Accurate xfloat mode.
Make compiled SPU modules position-independent in SPU LLVM.

Optimizations include but not limited to:
 * Compiling SPU functions as native functions when eligible
 * Avoiding register context write-out
 * Aligned stack assumption (CWD alike instruction)
2019-05-11 02:13:19 +03:00
Megamouse fce9d6a7b8 Qt/input: add LED color picker to pad settings dialog 2019-05-09 22:02:00 +02:00
eladash 7ead021aa7 rsx: Fix 3d swizzled texture to linear conversation 2019-05-08 23:48:39 +03:00
kd-11 feb77793df typo fix
- Minor argument change requested by Megamouse
2019-05-07 09:39:35 +03:00
Exfiltratior f1ff75d815 correct small mistake 2019-05-07 09:39:35 +03:00
eladash 13d8e33d9a Return ESRCH if ppu thread ID was not found in sys_cond_signal_to 2019-05-07 08:58:07 +03:00
eladash 4e2650af91 Fix sys_rwlock_wlock timedout event
If the rwlock is currently acquired by a writer signaling readers is wrong and will lead to EPERM for wunlock!
Only signal blocked readers if the rwlock is currently acquired by readers
2019-05-07 08:58:07 +03:00
eladash ca08418dc1 Fix sys_rwlock_runlock on waiting readers
readers can wait on the sleep queue if a writer lock has been blocked before it, in this case after runlock: writer should acquire the lock but the r's sleep queue is still not empty!
2019-05-07 08:58:07 +03:00
Megamouse 5141590729 overlays: add separate timestamp for the start of the d-pad interval 2019-05-06 22:00:40 +02:00
Malcolm Jestadt fd2bc95a7b overlays: Double dpad repeat rate 2019-05-06 22:00:40 +02:00
Megamouse 9aa9cbf1d8 travis: update mac build 2019-05-06 21:06:25 +02:00
Megamouse 87d493fe1b Qt: smoother custom config icons 2019-05-06 20:00:36 +02:00
Megamouse e883f4f880 Qt: center compat circles 2019-05-06 20:00:36 +02:00
Megamouse 767eaaa82a Qt: smoother game grid icons 2019-05-06 20:00:36 +02:00
Megamouse caa6895310 Qt: smoother game icons in list mode 2019-05-06 20:00:36 +02:00
Megamouse ea0f04e130 Qt: smoother compat circles in list mode 2019-05-06 20:00:36 +02:00
Megamouse f480ba13c0 Qt: show all unique game data entries 2019-05-05 16:29:50 +02:00
Megamouse c1e245ae73 Emu: msg_dialog_frame fixup: don't reject on Close to prevent Emu.Stop() 2019-05-05 16:29:50 +02:00
Megamouse b639584acc Emu/Qt: Fix Boot Recent when using BootGame(add_only=true) 2019-05-05 16:29:50 +02:00
Megamouse b0a24665e5 Emu: msg_dialog_frame fixes 2019-05-05 16:29:50 +02:00
Megamouse 8a4778ba8c Qt: add some batch operations 2019-05-05 16:29:50 +02:00
kd-11 9c346c92f3 gl: undo an accidental deletion 2019-05-05 13:37:55 +03:00
kd-11 2bec304cca vk: Allow some drivers to bypass window polling if not needed 2019-05-05 13:37:55 +03:00
drysalter f246a8666a Qt: Minor Visual Fixes (#5899)
* Increase minimum size of User Manager window so QPushButtons aren't squeezed together
* Add spacing to the links in the About dialog to match all other buttons in the GUI
* Make the links in the About dialog work on Linux
* Turn the tooltip on "Config" in toolbar into an imperative like the rest of them
2019-05-04 22:56:55 +02:00
Nekotekina a703460fc6 SPU ASMJIT: skip some unused analyser steps
May improve performance
2019-05-04 19:35:13 +03:00
Nekotekina ba1ec1d5d6 SPU analyser: remove use_ra from HBR
Since this is a hint instruction, we don't really use reg value here.
2019-05-04 18:33:58 +03:00
Nekotekina 45ce8db6cb SPU Analyser: fix reg origin regression
Propagate phi instead of claiming new values
2019-05-04 18:29:47 +03:00
Nekotekina 4bd022f778 SPU analyser: minor logic fix and cleanup
Don't fill any chunk info for now (design mistake).
2019-05-03 14:18:22 +03:00
Nekotekina 6c34d7104e SPU analyser: fix excessive workload list size
Typo grade; regression
2019-05-02 23:29:02 +03:00
Nekotekina 54dc617f39 SPU analyser: internal spu_itype optimization
Use only 1 byte for instruction type.
Flags are transformed into range comparisons.
2019-05-02 19:32:09 +03:00
Nekotekina 15bd3b8724 SPU: fix minor UB in STQD/LQD instructions 2019-05-02 18:00:49 +03:00
Nekotekina 2b4da18709 SPU LLVM: fix xfloat regression
It was an old bug with possible hidden use of deleted instructions.
2019-05-02 13:39:43 +03:00
Nekotekina d48dc29e55 SPU LLVM: fix perf regression
Bug in the analyser was created recently in #5882.
2019-05-02 13:39:43 +03:00
Nekotekina 69d2ea35b9 SPU: minor analyser cleanup 2019-05-02 13:39:43 +03:00
Nekotekina a4c4ee9cb2 SPU: fix excessive cache size regression 2019-05-02 13:39:43 +03:00
msuih bc42719c48 Put DS3/DS4 instructions to Wiki instead 2019-05-02 13:39:16 +03:00
kd-11 6b7cd458e3 rsx: Silence some diagnostics unless compiled with debugging options 2019-05-01 15:36:21 +03:00
kd-11 1d5c52f476 rsx: Ignore stencil clear flag if the stencil write mask is disabled 2019-05-01 15:36:21 +03:00
kd-11 48cb265c2c rsx: Bounds check on local resource for atlas merge.
- Local resources can also have padded pitch dimensions and false-positives on range overlap tests
2019-05-01 15:36:21 +03:00
kd-11 63f9b8e0c6 gl/vk: Minor cleanup 2019-05-01 15:36:21 +03:00
kd-11 ec9aa74008 rsx: Fix section base offset calculation for blit_dst targets which affects confirmed memory range
- Fixes flushes only writing partially to target memory
2019-05-01 15:36:21 +03:00
kd-11 4e3ec162e2 rsx: Fix broken texture cache search when flipping 2019-05-01 15:36:21 +03:00
kd-11 6feffe6ff6 rsx: Ignore transfer offsets when wrapping behaviour is expected 2019-05-01 15:36:21 +03:00
kd-11 f56a6548b0 gl: Remove workaround for AMD driver bug fixed in driver 19.4.3 2019-05-01 15:36:21 +03:00
Nekotekina 1bc5e27507 SPU LLVM: move reg origin search to analyser
Refactor SPU analyser (block_info struct).
Fill register use info (currently unused).
2019-05-01 00:37:15 +03:00
Nekotekina 1294e0d189 SPU LLVM: improve codegen in loops
Use a trick in check_state to improve LICM pass.
2019-05-01 00:37:15 +03:00
Nekotekina e09c6ea4b4 SPU analyser: add spu_iflag
Register information about register accesses.
2019-04-30 14:33:27 +03:00
Nekotekina 716737ecf2 LLVM DSL: expression matching (alpha)
Implement remaining instructions.
Implement match_expr method.
Implement helper methods.
2019-04-30 14:33:27 +03:00
Deep Sleep c24b74398f Update to README.md due to dependency
Add qtbase5-private-dev for Debian as dependency to the README.md since it is needed, probably due to qt5.11.3+.
2019-04-30 14:33:01 +03:00
RipleyTom 301dd82819 DS3 Linux fix 2019-04-30 00:31:34 +03:00
eladash 3bd29b8bac Fix Unregistered HLE function access 2019-04-29 23:04:16 +03:00
eladash ea1c9a2e17 Fix PPU Breakpoints and ppu_check_toc 2019-04-29 23:04:16 +03:00
drysalter 468e1e90c8 Touch-ups to Skyline and Envy (#5884)
* Touch-ups to Skyline and Envy

* Match disabled colors on sliders, checkboxes and comboboxes

* Align header titles with section contents

* Make slider grooves clickable, add opacity to tooltips

* Adjust opacity, clean some code

* Correct slider margins, add hover effect to game table on Nightfall
2019-04-29 20:02:50 +01:00
msuih be6d9af1ab Print OS info to log
Credit to @maximilian578 for help
2019-04-25 20:20:37 +03:00
kd-11 243df38360 rsx: Fix VP writes to CC with a MOV instruction
- When moving to CC, the operation has VEC flag disabled and also temp
regs disabled. Looks to be the catch-all ELSE in the selection logic.
2019-04-25 16:23:05 +03:00
kd-11 3cbccdd760 rsx: Fragment shader decompiler cleanup
TODO: Investigate the _s input modifier behaviour further, in case it can avoid generating zeroes from a MAD instruction.
x = MAD(+ve, -ve, -ve) with _s input modifier in BFBC expects result to be Non-zero
2019-04-25 16:23:05 +03:00
kd-11 4cd1c25729 "rsx: Ignore argument sign for SQRT operations" 2019-04-25 16:23:05 +03:00
kd-11 32396ba366 rsx: Simplify use of some mixed input functions using OPFLAGS to avoid implicit conversions 2019-04-25 16:23:05 +03:00
kd-11 f12bd8068c rsx: Fragment decompiler fixups
- Properly test for NaN and Inf when clamping down to fp16
- Optimize divsq a bit; mix(vec, vec, bvec) emits OpSelect which is what
we want here, instead of component-wise selection which is much slower.
2019-04-25 16:23:05 +03:00
kd-11 abe7188acf rsx: Proper workaround for broken DIVSQ instruction on realhw
- While mul(0, nan) = nan and 0 / 0 = nan, 0 / sqrt(0) = 0 because of hw
gremlins. normalize(0) is also nan so this behaviour does not work
around that particular case either which makes it even more baffling.
2019-04-25 16:23:05 +03:00
kd-11 60f3059d22 rsx: Compensate for nvidia's low precision attribute interpolation
- The hw generates inaccurate values when doing perspective-correct
  interpolation of vertex output attributes and makes the comparison (a ==
  b) fail even when they are a fixed constant value.
- Increase equality tolerance when doing comparisons in fragment
  shaders for NV cards only to work around this issue.
- Teepo fix
2019-04-25 16:23:05 +03:00
kd-11 463b1b220d rsx: Improve accuracy of shadow compare Ops when non-integer depth formats are used
- The fixed-point D24S8 format does special Z clamping during compare which matches PS3 behaviour
- D32S8 is a floating point format and comparison with Dref > 1 always fails causing black edges/borders
2019-04-25 16:23:05 +03:00
kd-11 7ad1646c2c vk: Skip feature check if extension is not supported 2019-04-25 16:23:05 +03:00
kd-11 06a85f00d1 rsx: Shader decompiler cleanup and improvements
- Improve support for float16_t by minimizing mixed inputs to functions
(ambiguous overloads)
- Minimize amount of downcasts in code by using opcode flags
- Re-enable float16_t support for vulkan
2019-04-25 16:23:05 +03:00
kd-11 a668560c68 rsx: Use native half float types if available
- Emulating f16 with f32 is not ideal and requires a lot of value clamping
- Using native data type can significantly improve performance and accuracy
- With openGL, check for the compatible extensions NV_gpu_shader5 and
AMD_gpu_shader_half_float
- With Vulkan, enable this functionality in the deviceFeatures if
applicable. (VK_KHR_shader_float16_int8 extension)
- Temporarily disable hw fp16 for vulkan
2019-04-25 16:23:05 +03:00
kd-11 ee319f7c13 rsx: Implement strict clamp16 operation needed for NVIDIA cards 2019-04-25 16:23:05 +03:00
Nekotekina 2ade3c594c LLVM DSL: expression matching (preview 2)
Implement more instructions.
2019-04-25 03:33:18 +03:00
Nekotekina aca61fdcf9 LLVM DSL: implement expression matching (preview)
Only literal match for binary ops implemented.
2019-04-24 23:55:41 +03:00
Nekotekina 8754bbd444 SPU LLVM: add match_vr<> template
Returns reg value only if type is compatible, avoiding bitcast.
2019-04-24 23:55:41 +03:00
Nekotekina dd9bd1338b SPU LLVM: add get_vrs<> template 2019-04-24 23:55:41 +03:00
Nekotekina 3e0b45719d LLVM DSL: rewrite zshuffle, shuffle2, build
Add llvm_const_vector template.
2019-04-24 23:55:41 +03:00
Nekotekina b02503963e LLVM DSL: rewrite splat, fsplat, vsplat
Add llvm_const_float and llvm_splat templates.
2019-04-24 23:55:41 +03:00
Nekotekina c83e65f29e LLVM DSL: rewrite extract and insert 2019-04-24 23:55:41 +03:00
Nekotekina b7b93eae13 SPU LLVM: minor bitcast cleanup
Remove redundant explicit constand propagation in some instructions.
2019-04-24 23:55:41 +03:00
Nekotekina 2eac59f59a LLVM DSL: rewrite add_sat and sub_sat
Simplify constant folding logic
2019-04-24 23:55:41 +03:00
Nekotekina ac473eb400 Rewrite cpu_translator::rol, add fshl and fshr
Use new funnel shift intrinsics
2019-04-24 23:55:41 +03:00
Nekotekina 42448cf3e5 Remove cpu_translator::scarry, cpu_translator::merge 2019-04-24 23:55:41 +03:00
Nekotekina 524aac75ed LLVM DSL: rewrite bitcast, zext, sext, trunc, select, min, max ops
Are made composable in expressions similar to arithmetic ops.
Implement noncast in addition to bitcast (no-op case).
Implement bitcast constant folding.
Fixed some misuse of sext<>.
2019-04-24 23:55:41 +03:00
Nekotekina 3925cb59ac LLVM DSL: fix pointer type traits
Clear and match 'void' type
2019-04-24 23:55:41 +03:00
Nekotekina dc9118ef50 LLVM DSL refactoring
Properly forward value categories in expression structs.
Simplify SFINAE tests (is_llvm_expr, llvm_common_t) in global operators.
Add llvm_const_int and remove llvm_add_const, llvm_sub_const, etc.
Add llvm_ord and llvm_uno for FP comparison via >=< operators.
Replace cpu_translator::fcmp with fcmp_ord and fcmp_uno.
2019-04-24 23:55:41 +03:00
Megamouse 467ef2afca Qt: also spawn exit game dialog if rpcs3 is closed (e.g. by accident) 2019-04-24 21:48:36 +02:00
Megamouse cb5dd1353b Qt: force always on top to fix dialogs appearing behind the game window 2019-04-24 21:48:36 +02:00
Megamouse bb0609372d Qt: go out of fullsceen if exit game pop up is triggered 2019-04-24 21:48:36 +02:00
drysalter 258df80bf6 Add Envy and Skyline themes (#5789) 2019-04-21 00:41:20 +01:00
Ani a24ede4f40 cellPad: Update vendor and product IDs
- Used IDs were not from the Guitar Hero instruments but in fact from the Rock Band ones. Sets the correct Guitar Hero IDs and adds the Rock Band ones on comments. TODO: Allow selecting the specific devices on the PAD Settings.
- Adds DJ Hero Turntable VID/PID.
- Adds Dance Dance Revolution Mat VID/PID.
2019-04-20 23:17:13 +01:00
eladash 3a5f4ed757 Print SPU Group ID on the debugger 2019-04-20 20:43:58 +01:00
eladash 450e2c9a0e cellSaveData: Add missing SDK version check for setParam->reserved2 check 2019-04-20 20:43:58 +01:00
eladash ae5a4b697e Fix cellSaveDataListAutoSave/Load unk flags 2019-04-20 01:04:41 +03:00
eladash 1e9d3346d1 Reschedule in cellMsgDialogOpen2 2019-04-20 01:04:41 +03:00
eladash 9446bd2d3f Handle a few more cellSaveData errors
* Check directory existence if setParam is NULL (dont create directory)
* Fix mask for reCreateMode
* Check a few setParam fields including reserved buffers.
* Fix sizeKb when the dir is empty except from PARAM.SFO
* Fix error checking when CELL_SAVEDATA_RECREATE_YES is specified but setParam is NULL (Doesnt do anything, simply errors)
2019-04-20 01:04:41 +03:00
eladash 6f76e34104 rsx: Fix race on clearing native_ui vs emu_requested flag 2019-04-20 01:04:41 +03:00
eladash 67f098627a Fix sys_spu group ID 2019-04-20 01:04:41 +03:00
eladash ff11d9a3bd Improve scheduler control for cellSaveData
TODO: There are probably more spots where we should yield.
A little more at the start because PacketRead is called twice.
Dont use sys_timer_usleep because it will just call this_thread::yield() repeatedly.
2019-04-20 01:04:41 +03:00
eladash 9497270da5 Implement initial arguments error checking for cellSaveData 2019-04-20 01:04:41 +03:00
eladash 2b4bc588dc Put missing check_state() in some places
Fixes a few verification failures while closing the emulator with HLE liblv2
2019-04-20 01:04:41 +03:00
eladash 888cb9d673 Remove reader_lock executed in every instruction by RSX
Use optimistic double check instead, use one load instruction for the check to be atomic

+ Read emu status once every FIFO iteration
2019-04-20 01:04:41 +03:00
eladash f25587d24c rsx: Write vblank semahpre, minor semaphore acquire optimization 2019-04-20 01:04:41 +03:00
eladash 777a99d01b misc: Lower default perf overlay detail
Because RSX Guest utilization confuses people and is only meaningful for debugging.
2019-04-18 22:23:05 +03:00
Nekotekina 7865982208 Fix static_hle log channel definition 2019-04-16 23:49:18 +03:00
Nekotekina 52c589ed3d Revert disabling AVX path in SPU verification.
It was experimental and builds for tests are available in history.
2019-04-16 23:49:18 +03:00
Nekotekina 9060177dbd SPU transactions: add SSE path if AVX is not available
This handles hypothetical situation when AVX is disabled system-wise.
Also refactored register use, to match Windows path with Linux path.
This reduces read set a little at the cost of stack use.
2019-04-16 23:49:18 +03:00
Megamouse 1152317b47 libusb VS stuff 2019-04-16 22:47:24 +02:00
Megamouse b929c13c45 implement get_firmware_version
add firmware version to the first line in the log
2019-04-16 22:13:28 +02:00
Megamouse 092cfef060 Qt: add more filters to firmware installation file dialogs 2019-04-16 21:39:14 +02:00
msuih 8f333117eb Set stack limit properly 2019-04-16 18:39:57 +03:00
msuih baf42430d6 Decrease severity of sys_net_bnet_close 2019-04-16 18:39:57 +03:00
Jordy Vieira f995771143 Ignore sorting on ranged combobox and log message 2019-04-14 19:15:23 +03:00
Jordy Vieira bad0415f05 Change EnhanceComboBox to optionally sort the settings list before adding it to the combo box 2019-04-14 19:15:23 +03:00
Nekotekina 136fc8cfe3 SPU ASMJIT: avoid AVX in verification (experimental) 2019-04-14 18:03:45 +03:00
Nekotekina b97a1aeca2 Increase max stack size to 8 MB on Windows
Default is 1 MB and it could cause problems in compiling heavy SPU LLVM functions.
2019-04-14 18:03:45 +03:00
Nekotekina c1edae73c5 SPU ASMJIT: move vzeroupper a bit 2019-04-14 15:10:54 +03:00
Nekotekina 8deb20e928 SPU: write cache before compiling 2019-04-13 22:56:11 +03:00
Nekotekina e064b92058 mutex.h: fix warning (unary minus unsigned) 2019-04-13 22:56:11 +03:00
Nekotekina d52df9352c fs::rename, use renameat2 on Linux 2019-04-13 22:56:11 +03:00
Nekotekina fe593de6d7 Update LLVM 2019-04-12 22:20:21 +03:00
kd-11 df3b46a611 rsx: Improve texture sourcing and clipping when reverse scanning is enabled
- When reverse scanning, offsets are inverted and offset value of 0 is logically equivalent to an offset of -1
- Add an explicit message if clipping happens to avoid silent errors/bugs
2019-04-12 15:36:21 +03:00
Nekotekina 0d415407c7 sys_fs_unlink: add CELL_EISDIR check 2019-04-12 12:24:36 +03:00
Nekotekina f40320bcae Fix cellVdecOpen
Use pseudo-address in sys_ppu_thread_create calls
2019-04-11 21:20:22 +03:00
Nekotekina c34821ded2 Travis: disable gcc build
Temporary optimization
2019-04-11 18:57:56 +03:00
TGEnigma 38cc92ec45 Add _sys_ppu_thread_create and sys_ppu_thread_rename error checks 2019-04-11 18:14:05 +03:00
eladash 8da78c098c SPU LLVM: Fix branch to self at start of block state check 2019-04-11 17:47:52 +03:00
eladash eba8e2284b SPU LLVM: Fix CFLTU
Clamp properly result from both sides!

TODO: Figure out whats different CreateFPToUi has from CFLTU and why it fails here.
2019-04-11 17:47:52 +03:00
eladash 969af86eba SPU: Implement BISLED
DFCMGT instruction removed, it was wrong to add to begin with

ASMJIT: Fix compilation of double compare instructions, move exception to runtime instead of compiletime!
Jarves confirmed that he implemented this instruction because of that bug with asmjit only, affected God Of War 3
2019-04-11 17:47:52 +03:00
eladash b307aff9eb Prefetch byteswapped opcodes in ppu interpreter 2019-04-11 17:47:52 +03:00
eladash 1c462abc37 Make sure to update cia when calling in unknown hle table func access 2019-04-11 17:47:52 +03:00
eladash 3304e3b0b7 PPU LLVM: Fix STSWI and LSWI 2019-04-11 17:47:52 +03:00
eladash f028737db8 Implement fallback for PPU LLVM
This matches with interpreter implementation, fixing unregistered functions in lost cases
2019-04-11 17:47:52 +03:00
eladash a9014a8cac ppu Fast/Precise: Fix SIMD instructions VSUM2SWS, VPKSWSS, VPKSHUS, VPKSHSS
Also rewrite VPKSHUS for speed.
2019-04-11 17:47:52 +03:00
eladash e21504d52d ppu interpreter: Improve FPCC field handling 2019-04-11 17:47:52 +03:00
eladash aa44ef1f44 Fix default PPU nj status
TODO: Support  it...
2019-04-11 17:47:52 +03:00
eladash d555eeb0f4 Check start status in sys_prx_start/stop_module 2019-04-11 17:47:52 +03:00
msuih af86d1d77a Fix timespec for MSVC 2019-04-11 16:29:48 +03:00
Inviuz 52a12185a0 Initial sys_overlay 2019-04-10 23:25:09 +03:00
scribam 1d947daa81 hle: Add some more functions 2019-04-10 22:15:35 +03:00
Megamouse ec2d882199 Qt: add version update hint to game list 2019-04-10 15:37:37 +01:00
Nekotekina 40142420c1 Implement vfs::host::unlink
Emulate POSIX behaviour in sys_fs_unlink.
This should allow to delete opened files transparently on Windows.
2019-04-10 13:58:12 +03:00
Nekotekina 0736fc8b28 Add fs::file::set_delete 2019-04-10 13:58:12 +03:00
Nekotekina a54d9c527f Simplify fs::file::get_handle
Via fs::file_base::get_native_handle method
2019-04-10 13:58:12 +03:00
Nekotekina 9736773c04 Implement vfs::host::rename
With spurious access error workaround
2019-04-10 13:58:12 +03:00
Nekotekina 3354f068fc PPU/SPU transactions: ease cache line interference (TSX path)
Touch memory on the same memory page, but different cache lines.
2019-04-10 13:58:12 +03:00
kd-11 12dc3c1872 vk: Dynamic heap management to potentially fix ring buffer overflows
- Allows checking one heap type at a time, on demand
- Should avoid OOM situations unless inside an uninterruptible block
2019-04-09 13:40:54 +03:00
kd-11 a4495c35b7 rsx: Fixups for swizzled texture scanning
- Revert to using block metrics, but with optional per-channel decode
stage for the final transfer. Much cleaner than hacking in the width to
be in channels instead of blocks.
2019-04-09 13:40:54 +03:00
kd-11 a5ed30a8c0 rsx: Fixups for data cast operations via typeless transfer 2019-04-09 13:40:54 +03:00
kd-11 f04a0a2bb6 rsx: Remove some old restrictions affecting memory persistence 2019-04-09 13:40:54 +03:00
kd-11 0a604e39f1 rsx: Implement RGB655 decode 2019-04-09 13:40:54 +03:00
kd-11 cc3809fbfe gl: Register a few more missing formats for conversion 2019-04-09 13:40:54 +03:00
kd-11 e4e86455f2 rsx: Fix temporary subresource caching behaviour
- Do not cache if a gathered subresource contains a bound RTT
- Change op to dynamic copy if parent is still bound
2019-04-09 13:40:54 +03:00
kd-11 3249000511 rsx: Improvements to texture scanning
- Removes CPU-only transforms that broke GPU-side code.
 -- Channels in GPU compute are laid out in cell-order, but CPU was uploading in favorable order and compensating with swizzles.
 -- This leads to 2 different layouts depending on the location of the data (CPU vs GPU)
- Implement R8G8_R8B8 interleaved format decode
- General improvements
2019-04-09 13:40:54 +03:00
kd-11 0f7af391d7 vk: Implement copy-to-buffer and copy-from-buffer for depth_stencil
formats
- Allows D24S8 and D32S8 transport via typeless channels
- Allows uploading and downloading D24S8 data easily
- TODO: Implement optional byteswapping to fix flushed readbacks with
the same method
2019-04-09 13:40:54 +03:00
kd-11 366e4c2422 rsx: Preliminary support for format conversions using typeless resolve 2019-04-09 13:40:54 +03:00
kd-11 b7470cfc1a rsx: Tighten format checks in cache hit tests 2019-04-09 13:40:54 +03:00
kd-11 443fde760f rsx: Blit engine clipping fixes
- Do not round up sub-pixel offsets, round down instead
- Do not allow incomplete sources for hw blit transfer
- Reimplement src clipping (slice_h)
- Check 'area' of incoming texels and correct for them before RTT lookup/transfer
- Filter out incomplete targets when performing RTT lookup (1 texel or less contribution)
2019-04-09 13:40:54 +03:00
scribam f30af3ccd2 hle: Add more missing functions 2019-04-07 23:31:15 +03:00
JohnHolmesII 7625f7df11 Correct travis deploy behavior (bug).
cd returns an error code, thus overwriting '0'
2019-04-06 16:52:31 +03:00
scribam 8dbf2638e2 hle: Add some missing functions
0xBA50BC23 => cellCelpEncOpenExt
0x1AC58D11 => cellHttpFlushCache
0xA39FE9DC => cellHttpEndCache
0xB4FA3111 => cellHttpInitCache
0x4A18A89E => sceNpMatchingSetRoomInfoNoLimit
0xB020684E => sceNpMatchingGetRoomInfoNoLimit
2019-04-05 17:28:10 +01:00
Alex James d7ad991b7e Fix macOS compilation
This is needed for GL/glew.h to be found.
2019-04-02 03:16:55 +03:00
Violette Jansson 3bfe921a7a updated domain name for vulkan mirror
obk.ee expired the new domain is nkmk.ch, renewing a .ee domain is expensive and annoying so i moved to a new tld.
this .ch domain will not expire for around 3 years normally.
2019-04-01 13:46:32 +03:00
Jocker666z 2119566da7 add qtdeclarative5-dev fo debian/ubuntu
if not installed, cmake fail on -> '/usr/lib/x86_64-linux-gnu/cmake/Qt5Qml/Qt5QmlConfig.cmake'
2019-03-31 22:43:00 +03:00
eladash 182054b8af Implement sys_vm_append/return_memory 2019-03-31 14:57:21 +03:00
eladash 3c0564c9b7 Fix timer state after event queue was destroyed
* Hw tests show state is unaffected by external destruction of the event queue

* Minor race regarding state check fixed (can result in an undestroyable state)
2019-03-31 14:57:21 +03:00
eladash 90490f775d Fix sys_timer_usleep specifically with 0 sleep time
Remove context switch, replace it with host yield() for giving some cpu time for SPUs ans RSX
2019-03-31 14:57:21 +03:00
eladash 8185ef7610 rsx: Improve vblank accuracy 2019-03-31 14:57:21 +03:00
eladash 801e6114b6 rsx: Use relaxed store on fifo ctrl registers 2019-03-31 14:57:21 +03:00
eladash a3f65084df Fix sys_process_exit2 when SPUs are at av handler 2019-03-31 14:57:21 +03:00
eladash 1ed2055ec1 Fix cellVdecGetPicItem element popping behaviour 2019-03-31 14:57:21 +03:00
eladash 16f86b2458 Fix page fault area range check
Range end check was bugged (always true), also rewrite it so vm::get would be called only once
2019-03-31 14:57:21 +03:00
eladash f2bbae9db4 Remove handle in cellVdecClose 2019-03-31 14:57:21 +03:00
eladash 8eb59271a5 Improve error checking of cellVdecOpen
Those are the initial argument checks done by the firmware
2019-03-31 14:57:21 +03:00
eladash d6025c6764 Fix cellPadGetInfo port status returned
ASSIGN_CHANGES flag is not returned in this func.
2019-03-31 14:57:21 +03:00
eladash 47ca1b1dda Minor optimizations in cellPad
- Dont bother with shared_ptr since all pad_t management is going under the pad mutex.

- Change m_pads type into std::array since its size is known
2019-03-31 14:57:21 +03:00
eladash 6502d933df Fix stack memory view on the debugger
the debugger uses super ptr which was unmapped for stack.
2019-03-31 14:57:21 +03:00
scribam f15eb88f59 hle: Fix cellSysutilAvcExt module
And add cellSysutilAvcExtSetChatMode and cellSysutilAvcExtSetChatGroup
functions
2019-03-31 00:55:55 +03:00
scribam 1916cc1691 hle: Add cellSysmoduleUnloadModuleInternal and cellSysmoduleLoadModuleInternal functions 2019-03-30 23:52:56 +03:00
scribam f369aeab7a hle: Add FT_Get_X11_Font_Format function 2019-03-30 23:52:56 +03:00
scribam 0e9313d2df hle: Add cellFontInitLibraryFreeType function 2019-03-30 23:52:56 +03:00
Nekotekina d873802b9c Use LLVM 9
Use new add/sub with saturation intrinsics
2019-03-30 01:36:48 +03:00
Nekotekina 7e0b941e9f PPU LLVM: implement get_vrs<>() adaptor
Make use of structured bindings
2019-03-30 01:36:48 +03:00
Nekotekina d77fed6105 SPU LLVM: remove wrong dead code 2019-03-29 17:00:53 +03:00
scribam a254a203bb hle: Add libad_async and libad_core modules 2019-03-27 21:41:44 +00:00
Nekotekina 71b88cdc82 New SPU interpreter (SPU fast)
Use LLVM to build SPU interpreter.
Simplify interpreter loop.
2019-03-27 20:33:44 +03:00
scribam a9eb321814 hle: Add sceNpEulaAbort function 2019-03-26 23:19:01 +03:00
scribam 956d039415 hle: Add cellVideoPlayerUtility module 2019-03-24 19:16:49 +03:00
scribam 581b205f73 hle: Add cellPesmUtility module 2019-03-24 19:16:49 +03:00
scribam 6c40b9f3e0 hle: Add cellDtcpIpUtility module 2019-03-24 19:16:49 +03:00
scribam d6bf18eabc hle: Add some sceNpMatchingInt functions 2019-03-24 17:29:18 +03:00
scribam 32ae7e466c hle: Add cellNetAoi module 2019-03-24 17:29:18 +03:00
Nekotekina 7ea04d5d76 Minor optimization in SPU analyser
Reduce vector copy/allocation
2019-03-23 02:43:41 +03:00
Nekotekina 4b381fbbb1 Implement spu_runtime::reset
To handle JIT: Out Of Memory error.
2019-03-23 02:43:41 +03:00
Nekotekina 1880a17f79 SPU recs: implement spu_runtime::find
Use this function to link to existing functions from branch patchpoints.
Don't compile from branch patchpoints.
2019-03-23 02:43:41 +03:00
Nekotekina 31304f4234 SPU rec: refactor some trampoline generation
Move branch/dispatch trampoline generation at startup.
2019-03-23 02:43:41 +03:00
Nekotekina 3794f65bb6 Add cpu_flag::jit_return 2019-03-23 02:43:41 +03:00
Nekotekina 849411693a PPU LLVM: add MemoryManager3
For temporary allocations.
Add flags in jit_compiler constructor.
2019-03-23 02:43:41 +03:00
Nekotekina 466d58ccef SPU LLVM: fix branch patchpoints
Forgot to passthrough 3rd arg (rip)
2019-03-23 02:43:41 +03:00
kd-11 41b87cf577 rsx: Blit engine fixes
- If a transfer writes to a RTT and depth mismatch happens, create a local target and the upload function will likely resolve between the two
- If a surface is rejected, reset the target region!
2019-03-22 21:27:15 +03:00
kd-11 86ad204636 rsx: Rebase output region when using upload-fallback path 2019-03-22 21:27:15 +03:00
kd-11 dbc8e70ddd rsx: Silence some compiler noise 2019-03-22 21:27:15 +03:00
kd-11 3a4e3fa53a rsx: Fix use-after-modify condition when inserting a draw command out of order
- Fixes barrier->range rebase after the insert
2019-03-22 21:27:15 +03:00
kd-11 d731c07ade vk: Fix typeless resource management
- Fixes bugs that appear with high resolution scaling
2019-03-22 21:27:15 +03:00
kd-11 adc59f9810 rsx: Fix blit transfers when texel sizes mismatch
- Also refactors some bpp handling code
- Simplify texture intersection test to use a normalized/uniform coordinate space
- Fix broken bounds checking as well
2019-03-22 21:27:15 +03:00
kd-11 b879b32271 rsx: Fix bpp calculation taking resolution scaling into account
- Do not rely on image->width(), use surface_width() instead for unscaled values
- Refactor/clean GL rendertarget class a bit
2019-03-20 10:05:54 +03:00
kd-11 03fca73cf4 rsx: Fix blit intersection falling outside the available texture
- Just becaue we have a hit inside the tile of interest does not guarantee that it sits inside the texture!
2019-03-20 10:05:54 +03:00
Jan Beich 1a13d3ae4e OpenBSD doesn't have mcontext_t
`<signal.h>` provides `typedef struct sigcontext ucontext_t`
2019-03-19 22:24:49 +03:00
Jan Beich 1f845a3634 Don't try to build libusb on FreeBSD
CMake Error at 3rdparty/libusb/libusb/os/CMakeLists.txt:90 (message):
  Unsupported platform FreeBSD.  Currently only support Windows, OSX, &
  Linux.
2019-03-19 22:24:49 +03:00
Matias Morán 3eb2bcad39 Update DualShock 3 warning 2019-03-18 22:46:02 +00:00
RipleyTom 63bbe459ea DS3 pad handler 2019-03-18 19:05:02 +03:00
RipleyTom f2aaad11bb Adds libusb 2019-03-18 19:05:02 +03:00
kd-11 3ef16bee47 rsx: Fix texture lookups and avoid out-of-bounds copies/transfers 2019-03-17 21:50:11 +03:00
kd-11 bb65e45614 rsx: Implement GPU acceleration for rotated images 2019-03-17 21:50:11 +03:00
kd-11 5260f4b47d rsx: Improvements to memory flush mechanism
- Batch dma transfers whenever possible and do them in one go
- vk: Always ensure that queued dma transfers are visible to the GPU before they are needed by the host
  Requires a little refactoring to allow proper communication of the commandbuffer state
- vk: Code cleanup, the simplified mechanism makes it so that its not necessary to pass tons of args to methods
- vk: Fixup - do not forcefully do dma transfers on sections in an invalidation zone! They may have been speculated correctly already
2019-03-17 21:50:11 +03:00
kd-11 385485204b vk/gl: Omit unlocked data when grabbing flip sources from texture cache 2019-03-17 21:50:11 +03:00
kd-11 74eeacd091 vk/gl: Improve memory tag sync and test
- Properly pass parameters such as rsx-pitch to the surface store
- Do not crash if a surface fails verification in flip, use fall-back instead
2019-03-17 21:50:11 +03:00
kd-11 1a44446250 rsx: Fix dst upload block region
- The section needed starts at image origin, not transfer origin!
2019-03-17 21:50:11 +03:00
kd-11 a49a0f2a86 vk/gl: Synchronization improvements
- Properly wait for the buffer transfer operation to finish before map/readback!
- Change vkFence to vkEvent which works more like a GL fence which is what is needed.
- Implement supporting methods and functions
- Do not destroy fence by immediately waiting after copying to dma buffer
2019-03-17 21:50:11 +03:00
kd-11 85cb703633 rsx/cache: Debugging bugs introduced by the atlas coverage check
- Figured out why it breaks things, ofc can't actually check for coverage when there is no proper fbo data persistence
2019-03-17 21:50:11 +03:00
kd-11 3a4083263e rsx: Fix texture transfer when pitch does not match exactly 2019-03-17 21:50:11 +03:00
kd-11 612160a8ff rsx: Fix zero-pitch textures
- Assumption here is that only texel (0, 0) is accessible. Inline with other pitch 0 operations.
- TODO: Verify pitch 0 does not advance in Y either
2019-03-17 21:50:11 +03:00
kd-11 17c49d21a5 rsx/blit: Remove workarounds/hacks added for master. Start implementation/stubs for blit engine rotations in GPU 2019-03-17 21:50:11 +03:00
kd-11 745f8f9627 rsx: Remove pointless assert 2019-03-17 21:50:11 +03:00
Nekotekina e9b6beadfc SPU LLVM: implement static branch weights
May help branch prediction in some cases
2019-03-13 21:14:55 +03:00
Nekotekina 388d49db80 SPU LLVM: fix SPU MMIO in TSX mode 2019-03-13 21:14:55 +03:00
RipleyTom 980c3d6fe8 Fix lf_queue destructor 2019-03-13 15:59:13 +03:00
Ani 3b01e59cd4 InstallPup: Fix exception on newline trim
Avoid throwing fatal error when installing firmware without a \n character on the version string
Fixes #5646
2019-03-13 03:45:06 +03:00
Nekotekina a08cd0fe38 Update asmjit 2019-03-13 01:56:43 +03:00
Nekotekina 8623899499 Update 3rdparty/libpng 2019-03-13 01:34:55 +03:00
Nekotekina 6d4c9f2d41 Update 3rdparty/yaml-cpp 2019-03-13 01:33:23 +03:00
Nekotekina 30636f0199 Update 3rdparty/xxHash 2019-03-13 01:32:00 +03:00
Nekotekina 0aa9243557 Update 3rdparty/pugixml 2019-03-13 01:29:31 +03:00
Nekotekina eae5b9e049 Rewrite mulh64/umulh64
Use __int128_t/__uint128_t idioms on GCC/Clang.
May result in better codegen by avoiding inline asm.
2019-03-13 00:16:43 +03:00
Nekotekina 688aabc6c9 Add _sys_lwmutex_unlock2 syscall name 2019-03-12 23:55:13 +03:00
eladash 4a28319edf Implement SPU page faults notifications
* Implement both RawSPU and threaded SPU page fault recovery
* Guard page_fault_notification_entries access with a mutex
* Add missing lock in sys_ppu_thread_recover_page_fault/get_page_fault_context
* Fix EINVAL check in sys_ppu_thread_recover_page_fault, previously when the event was not found begin() was erased and
CELL_OK was returned.
* Fixed page fault recovery waiting logic:
- Do not rely on a single thread_ctrl notification (unsafe)
- Avoided a race where ::awake(ppu) can be called before ::sleep(ppu) therefore nop-ing out the notification
* Avoid inconsistencies with vm flags on page fault cause detection
* Fix sys_mmapper_enable_page_fault_notification EBUSY check
from RE it's allowed to register the same queue twice (on a different area) but not to enable page fault notifications twice
2019-03-12 13:28:31 +03:00
kd-11 1875dc3f18 gl: Fix buffer size calculations 2019-03-10 16:09:05 +03:00
kd-11 358558aaa7 cleanup and fixups 2019-03-10 16:09:05 +03:00
kd-11 04dda44225 rsx: Properly generate render target data with all parameters provided
- Build-up to variable-sized framebuffers and AA implementation
- Also allows accurate range calculation for our hit testing
2019-03-10 16:09:05 +03:00
kd-11 21bc6c7a87 rsx: Properly resolve data for upload when needed.
- Avoids blindly reusing blit dst sections as they may contain garbage.
  If a section was unlocked for a flush, just discard it as its reuse introduces potential data corruption.
  Since the data needs to be reuploaded anyway (for now), its better to start afresh
- In case of format mismatch, reset the calculated dst block
- Add a bounds check to determine if data contained in an atlas is good enough for sampling the cache.
  If not enough data is provided, fall back to full upload
2019-03-10 16:09:05 +03:00
kd-11 9d4d3d9443 rsx: Reimplement render target intersection tests when using hw accelerated blit engine
- Properly collapse memory tree when scanning in case of overlaps!
2019-03-10 16:09:05 +03:00
kd-11 f4ebcb0029 rsx: Properly decode packed renders from the type flag
- Seems to occupy bits [8-9]
2019-03-10 16:09:05 +03:00
kd-11 7c379432dd rsx: Implement proper pitch compatibility lookup
- When a single row is required or is all that is available, pitch has
no meaning as the coordinate space changed to 1D
2019-03-10 16:09:05 +03:00
kd-11 dccb4a4888 rsx/texture_cache: fixes to commit_framebuffer_memory 2019-03-10 16:09:05 +03:00
kd-11 b9e7b085fe rsx/texture_cache: Fixups for local resource hit and fast-path added 2019-03-10 16:09:05 +03:00
kd-11 a80f1a6ed4 gl: Fix memory tag sampling
- Also fixes a bad arg passed to glClearBuffer
2019-03-10 16:09:05 +03:00
kd-11 0395fb9955 rsx/tecture_cache: Addendum - fix data cast with scaling conversion (AA emulation)
- Blit operations do format conversion automatically which is NOT what we want!
- Scale onto temp buffer with similar format before performing data cast.
2019-03-10 16:09:05 +03:00
kd-11 10dc3dadee rsx/texture_cache: Improve framebuffer memory locking when WCB/WDB is not enabled
- Adds a new mode that removes non-framebuffer stuff inside framebuffer range
2019-03-10 16:09:05 +03:00
kd-11 563e205a72 rsx/texture_cache: Fix 'AA' scaling hack and restore collection template selection 2019-03-10 16:09:05 +03:00
kd-11 fa628f0ac4 rsx/surface_store: More aggressive tag sampling
- Use a 5-point tap with an X pattern across the target's memory space to reduce chances of false positives
- TODO: Potential false positives identified, requires some minor
restructuring of surface_store
2019-03-10 16:09:05 +03:00
kd-11 3a071a9c07 rsx: Texture search rewrite
- Perform a full search across all resource types as needed without
taking too many shortcuts/hacks
2019-03-10 16:09:05 +03:00
kd-11 6ef9dcd62e rsx: Handle mismatched/invalidated framebuffer sections when WCB is enabled 2019-03-10 16:09:05 +03:00
kd-11 ef071ebb6b rsx: Synchronize surface cache and texture cache data
- TODO: The whole upload_texture thing is a big hack, fix it properly
2019-03-10 16:09:05 +03:00
eladash a43e7c172c Fix shared memory page flags
TODO: From hw testing, it seems like sys_memory_get_page_attribute and sys_rsx_context_iomap check page size a little differently

get_page_attribute() always go by area flags, sys_rsx_context_iomap checks page by the page granularity
This means that if the area page size 64k, but shared memory is mapped with SYS_MEMORY_GRANULARITY_1M
It can be mapped for rsxio, but the page attribute will indicate 64k page size :thonk:
rsxio memory is verified to need 1m pages.
2019-03-08 23:44:46 +03:00
eladash 7470388e5a Use error_code in sys_rsx 2019-03-08 23:44:46 +03:00
eladash 26bcd0a4de Small improvements to sys_event_flag
- From RE, only protocols SYS_SYNC_FIFO and SYS_SYNC_PRIORITY are valid
- Use conditional atomic op store in a few places
- Properly revert changes in sys_event_flag_set when aomic op fails
2019-03-08 23:44:46 +03:00
elad bd259c8ae4 vulkan zcull: Fix deadlock in zcull flush waiting
Block adding additional flush requests until the first ones are treated (by adding missing lock)
2019-03-08 23:44:46 +03:00
elad fc253165e2 Correctness fix for RSXIOMem
- Make RSXIOMem volatile.
- Hint the compiler to check only once the address returned.
2019-03-08 23:44:46 +03:00
elad b7da3ea5cd Release ppu thread before ShowSaveDataDialog, Fixes #4031 2019-03-08 23:44:46 +03:00
elad ce8c92262d Treat X8R8G8B8 format as A8R8G8B8 in image_in, Fixes #5510 2019-03-08 23:44:46 +03:00
elad f272a5f779 sys_lwmutex fixup after #5680
sys_lwcond_wait unlocks always with the 'usual' unlocking flags
2019-03-08 23:44:46 +03:00
RipleyTom 61bd2ea799 Adds VID/PID for Guitar Hero guitar & drum 2019-03-08 17:52:48 +00:00
elad 3c9f03968c Yield before flushing io buffers in fsync (sys_fs) (#5506) 2019-03-08 16:07:14 +00:00
Nekotekina 4ea76def7c Update sys_lwmutex_lock and sys_lwmutex_unlock (liblv2 HLE)
Implement missing SYS_SYNC_RETRY logic
Following #5680
2019-03-06 15:09:50 +03:00
Nekotekina 986c750fdc VFS: fix sys_fs_opendir on root 2019-03-05 22:12:01 +03:00
Nekotekina efe067bfa0 LLVM: handle cascadelake CPU name 2019-03-05 21:47:34 +03:00
eladash e38b7aee5a check address in sys_rsx_context_iomap
* Fix 0 vm page flags to behave like 1m flags, follows c8a681e60
* check if address exists and valid for rsx io allcations (must be allocated on 1m pages)
2019-03-05 21:23:24 +03:00
eladash d82362fa1d Use sys_memory_allocate on rsx replayer to fix it 2019-03-05 21:23:24 +03:00
Nekotekina ebb24375d1 LLVM: handle icelake-client and icelake-server CPU names
Correct AVX / AVX-512 disabling logic
2019-03-01 00:20:04 +03:00
Nekotekina fb64b28886 SPU LLVM: reintroduce branch patchpoints
Previously only used on SPU ASMJIT, may improve perf in some cases.
Now refactored to spu_runtime::make_branch_patchpoint.
2019-03-01 00:08:20 +03:00
Nekotekina 7f6a410770 Add dummy __has_builtin macro, use rotate builtins if possible 2019-03-01 00:08:19 +03:00
Nekotekina 765d15f23f Optimize SPU trampolines
Load values in EAX and reuse it if possible
2019-03-01 00:08:19 +03:00
Nekotekina f143035af1 Fix sys_spu_thread_group_join wait condition
After waiting, thread group cannot be safely accessed
Following #5643
2019-03-01 00:08:19 +03:00
Nekotekina 9ee2867247 Improve count leading/trailing zeros implementation
Use x86 intrinsics if compiled with appropriate instruction support
2019-03-01 00:08:19 +03:00
Nekotekina 7b344b7654 Implement utils::refptr for typemap (with && syntax)
Ref-counted pointer, object is always allocated on heap.
Rvalue reference && in typemap is converted to refptr for convenience.
2019-03-01 00:08:19 +03:00
Nekotekina 6c5d9fffaa typemap: improve pointer support
If stored object is a pointer, access dereferenced object directly via ->
2019-03-01 00:08:19 +03:00
Jan Beich 240ba39d16 Chase GIT_VERSION rename after 923700a167 2019-02-28 04:48:16 +03:00
RipleyTom de5379a69f Static hle implementation 2019-02-27 22:54:59 +03:00
eladash a22297f205 exception throwing fix in sys_lwmutex_create
arg6 doesnt exist, if arg4 is not negative name is discarded and treated as 0.
2019-02-27 22:16:08 +03:00
eladash d4459af4b3 Implement _sys_lwmutex_unlock (SYS_SYNC_RETRY mode) 2019-02-27 22:16:08 +03:00
RipleyTom ad6b0ee122 Adds class type to controller options 2019-02-27 18:13:19 +00:00
Megamouse b107718869 sysPrxForUser: improve crash dump functions
this might fix some crashes that could appear in the todo logging itself
2019-02-26 21:53:59 +00:00
Alex James f5163cc4ff CMake: Use Info.plist template for macOS bundle
Define and use a template for Info.plist for the macOS bundle. The template
uses the previously defined RPCS3_GIT_TAG variable for automatically
generating the version strings, and also enables proper HiDPI support.
2019-02-26 21:09:18 +00:00
Alex James 923700a167 CMake: Refactor git-version.cmake
Refactor git-version.cmake to define the RPCS3_GIT_VERSION,
RPCS3_GIT_BRANCH, and RPCS3_GIT_TAG variables, and move the generation
of git-version.h to a function (gen_git_version).
2019-02-26 21:09:18 +00:00
JohnHolmesII c325534f07 readme - direct qt link to avoid confused kot noises 2019-02-23 13:29:38 +01:00
Megamouse 14ddb0c5b4 Qt: hide viewport settings on custom configs 2019-02-21 22:02:02 +01:00
German 4c72f7c1de Fix clear string container in CgBinaryFragmentProgram.cpp 2019-02-18 16:34:16 +03:00
German 3b9f9dd4c5 Fix true clear string container in GameInfo.h 2019-02-18 16:34:16 +03:00
German 45c31a99a3 Fix true clear string container in PPUModule.cpp 2019-02-18 16:34:16 +03:00
elad 63a9421634 Fix race in sys_lwcond_wait on error code 2019-02-16 21:41:59 +03:00
EmulationChannel 92ff7c4c24 Update FW Latest Version
Updates the latest FW 4.84 version according to: https://www.playstation.com/en-us/support/system-updates/ps3/
2019-02-16 13:59:30 +01:00
Filippe LeMarchand 56e24f8993 Update rpcs3.appdata.xml
- split description to paragraphs
- add bugtracker and quickstart urls
- add screenshot
2019-02-14 03:10:36 +03:00
Filippe LeMarchand a8621ebc22 Remove zero-width spaces (u200b) 2019-02-14 03:10:36 +03:00
Megamouse d4888a4973 cellSysCacheMount: don't return RET_OK_RELAYED on empty cacheId
The system cache is supposed to be cleared but I don't think we wanna do that
2019-02-13 01:55:07 +03:00
Megamouse 4a1499e0be cellMsgDialog: optionally make dialogs blocking and fix exit condition
and apply review fixes
2019-02-12 21:06:10 +03:00
Megamouse fe79e541dd cellGame: improve exit functions 2019-02-12 21:06:10 +03:00
Megamouse 17a5e0bc98 cellGame: add error_code 2019-02-12 21:06:10 +03:00
Megamouse 982b2ab88f Qt: only show supported resolutions in custom configs 2019-02-11 20:34:33 +01:00
eladash d6995f40c7 Fixup for sys_lwcond_signal_x error checking 2019-02-11 01:13:29 +03:00
eladash fa647bc121 Fix race condion in sys_spu_thread_group_join 2019-02-10 18:20:24 +03:00
eladash 84d42ecb65 Add EFAULT checks to spu_thread_group_join, ppu_thread_join
Order of checks is based on firmware
2019-02-10 00:16:57 +03:00
eladash 0861226271 Make more use of the new atomic_t<>::release 2019-02-10 00:16:57 +03:00
eladash e3ee481f01 Make sys_spu_thread_group_join return once per termination 2019-02-10 00:16:57 +03:00
kd-11 19ff95da70 vk: Fix usage of VK_IMAGE_LAYOUT_GENERAL
- Properly synchronize when transitioning to/from GENERAL layout.
- General layout requires full pipeline dependency since its used in a 'general' sense. As such, its use is to be largely avoided.
2019-02-07 11:40:17 +03:00
kd-11 38887bc03e gl/vk: Improvements to overlay rendering
- gl: Properly initialize and manage sampler states
- gl/vk: Snap overlay elements to pixel grid by aligning to pixel centers
- overlays: Disable grid snapping in stb since its now handled in the backend
2019-02-05 12:15:12 +03:00
kd-11 4c593959fd overlays/save_dialog: Layout improvements
- Make detail a separate text entity as it often contains a lot of noise
- Properly pad the entry if needed to avoid text sitting too close to the edge
2019-02-03 22:26:46 +03:00
kd-11 67cdec577f overlays/util: Add support for glyph set lowering when mapping utf8 to ascii8
- Lower fullwidth glyphs to halfwidth counterparts
- Lower CJK punctuation glyphs
- Lower general punctuation glyphs
2019-02-03 22:26:46 +03:00
kd-11 a36d3af3b4 vk: Minor frame management improvements 2019-02-02 11:54:01 +03:00
kd-11 27af05da1a osk: Fixup attempt for hang in close callback where a sysutil_callback fails to fire. 2019-02-02 11:54:01 +03:00
kd-11 b36cb66129 overlays: Allow use of extended ascii8
- Use custom string conversion to ensure overlay deals with extended ascii whenever possible
- Improves language compatibility greatly and avoids empty spaces for unknown glyphs
2019-02-02 11:54:01 +03:00
kd-11 12990f3ca3 overlays/util: Strip extended codes from utf-16 encoded strings 2019-02-02 11:54:01 +03:00
kd-11 9e39e2d2c4 gl/vk: Fix clip region scaling for overlay elements 2019-02-02 11:54:01 +03:00
kd-11 3653c2eb0d overlays/osk: Add support for edit text control and disabled cells
- Allows to disable cells from being selectable.
- Edit text control adds proper support for multiline and a functioning caret
2019-02-02 11:54:01 +03:00
kd-11 faf5221b0d overlays: Implement edit_text control 2019-02-02 11:54:01 +03:00
kd-11 c434e0ce27 overlays/osk: Add more buttons to native dialog and other improvements
- Adds all the major buttons to native dialog input options
- Adds more button options for the native osk
- Brighten osk cell backgrounds a bit to improve visibility
2019-02-02 11:54:01 +03:00
kd-11 9ed9d7e947 overlays/osk: Implement native osk interface 2019-02-02 11:54:01 +03:00
kd-11 9d4b19b97a vk: Increase number of draw calls per frame for overlays to 1024
- Allows for more complex interface design
2019-02-02 11:54:01 +03:00
Megamouse 8920eda321 facepalm: fix open_config_dir old vs. new location switch up 2019-02-01 17:47:27 +03:00
Ani f4afd56e67 rpcs3_version: Bump to 0.0.6 2019-01-31 22:08:45 +00:00
kd-11 f47d3a761b vk: Hotfix for fullscreen not working on non-windows platforms 2019-02-01 00:22:11 +03:00
586 changed files with 63121 additions and 29675 deletions
+2
View File
@@ -0,0 +1,2 @@
patreon: Nekotekina
custom: https://rpcs3.net/alipay
+4
View File
@@ -48,3 +48,7 @@
path = 3rdparty/libpng
url = https://github.com/glennrp/libpng.git
ignore = dirty
[submodule "3rdparty/libusb"]
path = 3rdparty/libusb
url = https://github.com/RPCS3/libusb.git
ignore = dirty
+12 -14
View File
@@ -1,27 +1,25 @@
language: cpp
matrix:
include:
- os: linux
env:
- NAME="Linux build"
- COMPILER="gcc"
dist: trusty
services: docker
cache: ccache
install: "docker pull rpcs3/rpcs3-travis-trusty:1.0"
script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-trusty:1.0 /bin/bash -ex /rpcs3/.travis/build-linux.bash'
# - os: linux
# env:
# - NAME="Linux build"
# - COMPILER="gcc"
# services: docker
# cache: ccache
# install: "docker pull rpcs3/rpcs3-travis-trusty:1.1"
# script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-trusty:1.1 /bin/bash -ex /rpcs3/.travis/build-linux.bash'
- os: linux
env:
- NAME="Linux build"
- COMPILER="clang"
- DEPLOY_APPIMAGE="true"
dist: trusty
services: docker
cache: ccache
install: "docker pull rpcs3/rpcs3-travis-trusty:1.0"
script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-trusty:1.0 /bin/bash -ex /rpcs3/.travis/build-linux.bash'
install: "docker pull rpcs3/rpcs3-travis-trusty:1.1"
script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-trusty:1.1 /bin/bash -ex /rpcs3/.travis/build-linux.bash'
- os: osx
osx_image: xcode10.1
osx_image: xcode10.2
addons:
homebrew:
packages:
@@ -31,7 +29,7 @@ matrix:
- qt
script: "/bin/bash -ex .travis/build-mac.bash"
cache: ccache
git:
depth: false # Unshallow clone to obtain proper GIT_VERSION
submodules: false
+3 -3
View File
@@ -8,7 +8,7 @@ export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib
cd rpcs3
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb Vulkan/glslang
# Download pre-compiled llvm libs
curl -sLO https://github.com/RPCS3/llvm/releases/download/continuous-linux-master/llvmlibs-linux.tar.gz
@@ -28,8 +28,8 @@ fi
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_LLVM_SUBMODULE=OFF -DLLVM_DIR=llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
ninja
ninja; build_status=$?;
cd ..
# If it compiled succesfully let's deploy
if [ $? -eq 0 ] && [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then /bin/bash -ex .travis/deploy-linux.bash ; fi
if [ $build_status -eq 0 ] && [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then /bin/bash -ex .travis/deploy-linux.bash ; fi
+2 -6
View File
@@ -2,14 +2,10 @@ export CCACHE_SLOPPINESS=pch_defines,time_macros
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/
export PATH="/usr/local/opt/ccache/libexec:$PATH"
# Allow using optional on 10.13
sudo perl -pi -e 'BEGIN{undef $/;} s/(_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS[ ]+\\\n[^\n]+10)\.14/\1.13/;' \
$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config
# Setup vulkan and gfx-rs/portability
curl -sLO https://github.com/gfx-rs/portability/releases/download/latest/gfx-portability-macos-latest.zip
unzip -: gfx-portability-macos-latest.zip
curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.92.0.zip
curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.106.0.zip
unzip -: sdk-*.zip
mkdir vulkan-sdk
ln -s ${PWD}/Vulkan-Headers*/include vulkan-sdk/include
@@ -19,7 +15,7 @@ cp target/release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib
install_name_tool -id ${PWD}/vulkan-sdk/lib/libVulkan.dylib vulkan-sdk/lib/libVulkan.dylib
export VULKAN_SDK=${PWD}/vulkan-sdk
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/libusb 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang
mkdir build; cd build
cmake .. -DWITH_LLVM=OFF -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
+15
View File
@@ -86,6 +86,20 @@ else()
endif()
# libusb
if(CMAKE_SYSTEM MATCHES "DragonFly|FreeBSD")
# Always use system libusb as reference implementation isn't supported
add_library(usb-1.0-static INTERFACE)
target_link_libraries(usb-1.0-static INTERFACE usb)
elseif(MSVC)
# Windows time.h defines timespec but doesn't add any flag for it, which makes libusb attempt to define it again
add_definitions(-DHAVE_STRUCT_TIMESPEC=1)
add_subdirectory(libusb EXCLUDE_FROM_ALL)
else()
add_subdirectory(libusb EXCLUDE_FROM_ALL)
endif()
# yaml-cpp
# We don't want to install yaml-cpp but its cmake file doesn't have option
# to disable it...
@@ -342,6 +356,7 @@ include(llvm.cmake)
# add nice ALIAS targets for ease of use
add_library(3rdparty::libusb ALIAS usb-1.0-static)
add_library(3rdparty::zlib ALIAS 3rdparty_zlib)
add_library(3rdparty::pugixml ALIAS pugixml)
add_library(3rdparty::yaml-cpp ALIAS yaml-cpp)
+16763 -9359
View File
File diff suppressed because it is too large Load Diff
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A107C21C-418A-4697-BB10-20C3AA60E2E4}</ProjectGuid>
<RootNamespace>hidapi</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.26323.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)lib/</OutDir>
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)/</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)lib/</OutDir>
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)/</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>hidapi\hidapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>hidapi\hidapi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Lib>
<AdditionalDependencies>setupapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="hidapi\windows\hid.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="hidapi\hidapi\hidapi.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hidapi\windows\hid.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="hidapi\hidapi\hidapi.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
+2 -2
View File
@@ -16,16 +16,16 @@
<RootNamespace>libpng</RootNamespace>
</PropertyGroup>
<Import Project="$(SolutionDir)\3rdparty\zlib.props" />
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Vendored Submodule
+1
Submodule 3rdparty/libusb added at 7cfa00e9d7
+90
View File
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>libusb-1.0 (static)</ProjectName>
<ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
<RootNamespace>libusb</RootNamespace>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization Condition="'$(Configuration)'=='Release'">true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir>$(SolutionDir)lib/</OutDir>
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)/</IntDir>
<TargetName>libusb-1.0</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>libusb\msvc;libusb\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINVER=0x0501;_WIN32_WINNT=0x0501;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<ClCompile Condition="'$(Configuration)'=='Debug'">
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<ClCompile Condition="'$(Configuration)'=='Release'">
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)libusb-1.0.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="libusb\libusb\core.c" />
<ClCompile Include="libusb\libusb\descriptor.c" />
<ClCompile Include="libusb\libusb\hotplug.c" />
<ClCompile Include="libusb\libusb\io.c" />
<ClCompile Include="libusb\libusb\os\poll_windows.c" />
<ClCompile Include="libusb\libusb\strerror.c" />
<ClCompile Include="libusb\libusb\sync.c" />
<ClCompile Include="libusb\libusb\os\threads_windows.c" />
<ClCompile Include="libusb\libusb\os\windows_nt_common.c" />
<ClCompile Include="libusb\libusb\os\windows_usbdk.c" />
<ClCompile Include="libusb\libusb\os\windows_winusb.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="libusb\msvc\config.h" />
<ClInclude Include="libusb\libusb\hotplug.h" />
<ClInclude Include="libusb\libusb\libusb.h" />
<ClInclude Include="libusb\libusb\libusbi.h" />
<ClInclude Include="libusb\libusb\os\poll_windows.h" />
<ClInclude Include="libusb\libusb\os\threads_windows.h" />
<ClInclude Include="libusb\libusb\version.h" />
<ClInclude Include="libusb\libusb\version_nano.h" />
<ClInclude Include="libusb\libusb\os\windows_common.h" />
<ClInclude Include="libusb\libusb\os\windows_nt_common.h" />
<ClInclude Include="libusb\libusb\os\windows_nt_shared_types.h" />
<ClInclude Include="libusb\libusb\os\windows_usbdk.h" />
<ClInclude Include="libusb\libusb\os\windows_winusb.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+5 -5
View File
@@ -26,7 +26,7 @@ if(WITH_LLVM)
set(CMAKE_CXX_FLAGS ${CXX_FLAGS_OLD})
# now tries to find LLVM again
find_package(LLVM 8.0 CONFIG)
find_package(LLVM 9.0 CONFIG)
if(NOT LLVM_FOUND)
message(FATAL_ERROR "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
endif()
@@ -39,11 +39,11 @@ if(WITH_LLVM)
set(LLVM_DIR ${CMAKE_SOURCE_DIR}/${LLVM_DIR})
endif()
find_package(LLVM 8.0 CONFIG)
find_package(LLVM 9.0 CONFIG)
if (NOT LLVM_FOUND)
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 8)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 8.0. \
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 9)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 9.0. \
Enable BUILD_LLVM_SUBMODULE option to build LLVM from included as a git submodule.")
endif()
@@ -52,7 +52,7 @@ if(WITH_LLVM)
endif()
endif()
set(LLVM_LIBS LLVMMCJIT LLVMX86CodeGen)
set(LLVM_LIBS LLVMMCJIT LLVMX86CodeGen LLVMX86AsmParser)
add_library(3rdparty_llvm INTERFACE)
target_link_libraries(3rdparty_llvm INTERFACE ${LLVM_LIBS})
+2 -2
View File
@@ -9,15 +9,15 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{EB33566E-DA7F-4D28-9077-88C0B7C77E35}</ProjectGuid>
<RootNamespace>pnglibconf</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(SolutionDir)\3rdparty\zlib.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+138 -53
View File
@@ -1,4 +1,4 @@
/* stb_image - v2.19 - public domain image loader - http://nothings.org/stb
/* stb_image - v2.22 - public domain image loader - http://nothings.org/stb
no warranty implied; use at your own risk
Do this:
@@ -48,6 +48,9 @@ LICENSE
RECENT REVISION HISTORY:
2.22 (2019-03-04) gif fixes, fix warnings
2.21 (2019-02-25) fix typo in comment
2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs
2.19 (2018-02-11) fix warning
2.18 (2018-01-30) fix warnings
2.17 (2018-01-29) bugfix, 1-bit BMP, 16-bitness query, fix warnings
@@ -84,6 +87,7 @@ RECENT REVISION HISTORY:
Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query)
Arseny Kapoulkine
John-Mark Allen
Carmelo J Fdez-Aguera
Bug & warning fixes
Marc LeBlanc David Woo Guillaume George Martins Mozeiko
@@ -99,7 +103,7 @@ RECENT REVISION HISTORY:
Aldo Culquicondor Philipp Wiesemann Dale Weiler github:sammyhw
Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus
Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo
Christian Floisand Kevin Schmidt github:darealshinji
Christian Floisand Kevin Schmidt JR Smith github:darealshinji
Blazej Dariusz Roszkowski github:Michaelangel007
*/
@@ -161,6 +165,16 @@ RECENT REVISION HISTORY:
//
// ===========================================================================
//
// UNICODE:
//
// If compiling for Windows and you wish to use Unicode filenames, compile
// with
// #define STBI_WINDOWS_UTF8
// and pass utf8-encoded filenames. Call stbi_convert_wchar_to_utf8 to convert
// Windows wchar_t filenames to utf8.
//
// ===========================================================================
//
// Philosophy
//
// stb libraries are designed with the following priorities:
@@ -171,12 +185,12 @@ RECENT REVISION HISTORY:
//
// Sometimes I let "good performance" creep up in priority over "easy to maintain",
// and for best performance I may provide less-easy-to-use APIs that give higher
// performance, in addition to the easy to use ones. Nevertheless, it's important
// performance, in addition to the easy-to-use ones. Nevertheless, it's important
// to keep in mind that from the standpoint of you, a client of this library,
// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all.
//
// Some secondary priorities arise directly from the first two, some of which
// make more explicit reasons why performance can't be emphasized.
// provide more explicit reasons why performance can't be emphasized.
//
// - Portable ("ease of use")
// - Small source code footprint ("easy to maintain")
@@ -219,11 +233,10 @@ RECENT REVISION HISTORY:
//
// HDR image support (disable by defining STBI_NO_HDR)
//
// stb_image now supports loading HDR images in general, and currently
// the Radiance .HDR file format, although the support is provided
// generically. You can still load any file through the existing interface;
// if you attempt to load an HDR file, it will be automatically remapped to
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
// stb_image supports loading HDR images in general, and currently the Radiance
// .HDR file format specifically. You can still load any file through the existing
// interface; if you attempt to load an HDR file, it will be automatically remapped
// to LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
// both of these constants can be reconfigured through this interface:
//
// stbi_hdr_to_ldr_gamma(2.2f);
@@ -257,7 +270,7 @@ RECENT REVISION HISTORY:
//
// By default we convert iphone-formatted PNGs back to RGB, even though
// they are internally encoded differently. You can disable this conversion
// by by calling stbi_convert_iphone_png_to_rgb(0), in which case
// by calling stbi_convert_iphone_png_to_rgb(0), in which case
// you will always just get the native iphone "format" through (which
// is BGR stored in RGB).
//
@@ -319,6 +332,7 @@ enum
STBI_rgb_alpha = 4
};
#include <stdlib.h>
typedef unsigned char stbi_uc;
typedef unsigned short stbi_us;
@@ -326,11 +340,13 @@ typedef unsigned short stbi_us;
extern "C" {
#endif
#ifndef STBIDEF
#ifdef STB_IMAGE_STATIC
#define STBIDEF static
#else
#define STBIDEF extern
#endif
#endif
//////////////////////////////////////////////////////////////////////////////
//
@@ -355,10 +371,6 @@ typedef struct
STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels);
#ifndef STBI_NO_GIF
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp);
#endif
#ifndef STBI_NO_STDIO
STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
@@ -366,6 +378,14 @@ STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in
// for stbi_load_from_file, file pointer is left pointing immediately after image
#endif
#ifndef STBI_NO_GIF
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp);
#endif
#ifdef STBI_WINDOWS_UTF8
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input);
#endif
////////////////////////////////////
//
// 16-bits-per-channel interface
@@ -525,6 +545,12 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch
#define STBI_ASSERT(x) assert(x)
#endif
#ifdef __cplusplus
#define STBI_EXTERN extern "C"
#else
#define STBI_EXTERN extern
#endif
#ifndef _MSC_VER
#ifdef __cplusplus
@@ -649,14 +675,18 @@ static int stbi__cpuid3(void)
#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name
#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2)
static int stbi__sse2_available(void)
{
int info3 = stbi__cpuid3();
return ((info3 >> 26) & 1) != 0;
}
#endif
#else // assume GCC-style if not VC++
#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))
#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2)
static int stbi__sse2_available(void)
{
// If we're even attempting to compile this on GCC/Clang, that means
@@ -664,6 +694,8 @@ static int stbi__sse2_available(void)
// instructions at will, and so are we.
return 1;
}
#endif
#endif
#endif
@@ -1070,6 +1102,7 @@ static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel)
}
}
#ifndef STBI_NO_GIF
static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel)
{
int slice;
@@ -1081,6 +1114,7 @@ static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int byt
bytes += slice_size;
}
}
#endif
static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
@@ -1131,7 +1165,7 @@ static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x,
return (stbi__uint16 *) result;
}
#if !defined(STBI_NO_HDR) || !defined(STBI_NO_LINEAR)
#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR)
static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)
{
if (stbi__vertically_flip_on_load && result != NULL) {
@@ -1143,10 +1177,38 @@ static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, in
#ifndef STBI_NO_STDIO
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide);
STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default);
#endif
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input)
{
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
}
#endif
static FILE *stbi__fopen(char const *filename, char const *mode)
{
FILE *f;
#if defined(_MSC_VER) && _MSC_VER >= 1400
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8)
wchar_t wMode[64];
wchar_t wFilename[1024];
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)))
return 0;
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)))
return 0;
#if _MSC_VER >= 1400
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
#else
f = _wfopen(wFilename, wMode);
#endif
#elif defined(_MSC_VER) && _MSC_VER >= 1400
if (0 != fopen_s(&f, filename, mode))
f=0;
#else
@@ -1539,18 +1601,18 @@ static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int r
// convert source image with img_n components to one with req_comp components;
// avoid switch per pixel, so use switch per scanline and massive macros
switch (STBI__COMBO(img_n, req_comp)) {
STBI__CASE(1,2) { dest[0]=src[0], dest[1]=255; } break;
STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break;
STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;
STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; } break;
STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break;
STBI__CASE(2,1) { dest[0]=src[0]; } break;
STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;
STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;
STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; } break;
STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;
STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break;
STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;
STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = 255; } break;
STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break;
STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;
STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = src[3]; } break;
STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;
STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break;
STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;
default: STBI_ASSERT(0);
}
#undef STBI__CASE
@@ -1588,18 +1650,18 @@ static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int r
// convert source image with img_n components to one with req_comp components;
// avoid switch per pixel, so use switch per scanline and massive macros
switch (STBI__COMBO(img_n, req_comp)) {
STBI__CASE(1,2) { dest[0]=src[0], dest[1]=0xffff; } break;
STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break;
STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;
STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=0xffff; } break;
STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break;
STBI__CASE(2,1) { dest[0]=src[0]; } break;
STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;
STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;
STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=0xffff; } break;
STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;
STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break;
STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;
STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = 0xffff; } break;
STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break;
STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;
STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = src[3]; } break;
STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;
STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break;
STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;
default: STBI_ASSERT(0);
}
#undef STBI__CASE
@@ -1623,7 +1685,11 @@ static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
for (k=0; k < n; ++k) {
output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale);
}
if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;
}
if (n < comp) {
for (i=0; i < x*y; ++i) {
output[i*comp + n] = data[i*comp + n]/255.0f;
}
}
STBI_FREE(data);
return output;
@@ -3596,7 +3662,7 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp
int k;
unsigned int i,j;
stbi_uc *output;
stbi_uc *coutput[4];
stbi_uc *coutput[4] = { NULL, NULL, NULL, NULL };
stbi__resample res_comp[4];
@@ -3717,7 +3783,7 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp
if (n == 1)
for (i=0; i < z->s->img_x; ++i) out[i] = y[i];
else
for (i=0; i < z->s->img_x; ++i) *out++ = y[i], *out++ = 255;
for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; }
}
}
}
@@ -4731,7 +4797,7 @@ static void stbi__de_iphone(stbi__png *z)
static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
{
stbi_uc palette[1024], pal_img_n=0;
stbi_uc has_trans=0, tc[3];
stbi_uc has_trans=0, tc[3]={0};
stbi__uint16 tc16[3];
stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0;
int first=1,k,interlace=0, color=0, is_iphone=0;
@@ -5009,11 +5075,11 @@ static int stbi__high_bit(unsigned int z)
{
int n=0;
if (z == 0) return -1;
if (z >= 0x10000) n += 16, z >>= 16;
if (z >= 0x00100) n += 8, z >>= 8;
if (z >= 0x00010) n += 4, z >>= 4;
if (z >= 0x00004) n += 2, z >>= 2;
if (z >= 0x00002) n += 1, z >>= 1;
if (z >= 0x10000) { n += 16; z >>= 16; }
if (z >= 0x00100) { n += 8; z >>= 8; }
if (z >= 0x00010) { n += 4; z >>= 4; }
if (z >= 0x00004) { n += 2; z >>= 2; }
if (z >= 0x00002) { n += 1; z >>= 1; }
return n;
}
@@ -5030,7 +5096,7 @@ static int stbi__bitcount(unsigned int a)
// extract an arbitrarily-aligned N-bit value (N=bits)
// from v, and then make it 8-bits long and fractionally
// extend it to full full range.
static int stbi__shiftsigned(int v, int shift, int bits)
static int stbi__shiftsigned(unsigned int v, int shift, int bits)
{
static unsigned int mul_table[9] = {
0,
@@ -5207,6 +5273,8 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req
out[z++] = pal[color][0];
out[z++] = pal[color][1];
out[z++] = pal[color][2];
if (target == 4) out[z++] = 255;
if (i+1 == (int) s->img_x) break;
if((--bit_offset) < 0) {
bit_offset = 7;
v = stbi__get8(s);
@@ -5299,7 +5367,7 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req
stbi_uc *p1 = out + j *s->img_x*target;
stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
for (i=0; i < (int) s->img_x*target; ++i) {
t = p1[i], p1[i] = p2[i], p2[i] = t;
t = p1[i]; p1[i] = p2[i]; p2[i] = t;
}
}
}
@@ -5789,7 +5857,7 @@ static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req
// Else if n is 128, noop.
// Endloop
// The RLE-compressed data is preceeded by a 2-byte data count for each row in the data,
// The RLE-compressed data is preceded by a 2-byte data count for each row in the data,
// which we're going to just skip.
stbi__skip(s, h * channelCount * 2 );
@@ -6342,22 +6410,27 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
int first_frame;
int pi;
int pcount;
STBI_NOTUSED(req_comp);
// on first frame, any non-written pixels get the background colour (non-transparent)
first_frame = 0;
if (g->out == 0) {
if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header
g->out = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
g->background = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
g->history = (stbi_uc *) stbi__malloc(g->w * g->h);
if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory");
if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header
if (!stbi__mad3sizes_valid(4, g->w, g->h, 0))
return stbi__errpuc("too large", "GIF image is too large");
pcount = g->w * g->h;
g->out = (stbi_uc *) stbi__malloc(4 * pcount);
g->background = (stbi_uc *) stbi__malloc(4 * pcount);
g->history = (stbi_uc *) stbi__malloc(pcount);
if (!g->out || !g->background || !g->history)
return stbi__errpuc("outofmem", "Out of memory");
// image is treated as "tranparent" at the start - ie, nothing overwrites the current background;
// image is treated as "transparent" at the start - ie, nothing overwrites the current background;
// background colour is only used for pixels that are not rendered first frame, after that "background"
// color refers to teh color that was there the previous frame.
memset( g->out, 0x00, 4 * g->w * g->h );
memset( g->background, 0x00, 4 * g->w * g->h ); // state of the background (starts transparent)
memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame
// color refers to the color that was there the previous frame.
memset(g->out, 0x00, 4 * pcount);
memset(g->background, 0x00, 4 * pcount); // state of the background (starts transparent)
memset(g->history, 0x00, pcount); // pixels that were affected previous frame
first_frame = 1;
} else {
// second frame - how do we dispoase of the previous one?
@@ -6418,6 +6491,13 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
g->cur_x = g->start_x;
g->cur_y = g->start_y;
// if the width of the specified rectangle is 0, that means
// we may not see *any* pixels or the image is malformed;
// to make sure this is caught, move the current y down to
// max_y (which is what out_gif_code checks).
if (w == 0)
g->cur_y = g->max_y;
g->lflags = stbi__get8(s);
if (g->lflags & 0x40) {
@@ -6437,7 +6517,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
return stbi__errpuc("missing color table", "Corrupt GIF");
o = stbi__process_gif_raster(s, g);
if (o == NULL) return NULL;
if (!o) return NULL;
// if this was the first frame,
pcount = g->w * g->h;
@@ -6565,6 +6645,7 @@ static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req
stbi_uc *u = 0;
stbi__gif g;
memset(&g, 0, sizeof(g));
STBI_NOTUSED(ri);
u = stbi__gif_load_next(s, &g, comp, req_comp, 0);
if (u == (stbi_uc *) s) u = 0; // end of animated gif marker
@@ -6576,6 +6657,9 @@ static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req
// can be done for multiple frames.
if (req_comp && req_comp != 4)
u = stbi__convert_format(u, 4, req_comp, g.w, g.h);
} else if (g.out) {
// if there was an error and we allocated an image buffer, free it!
STBI_FREE(g.out);
}
// free buffers needed for multiple frame loading;
@@ -7238,6 +7322,7 @@ STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user
/*
revision history:
2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs
2.19 (2018-02-11) fix warning
2.18 (2018-01-30) fix warnings
2.17 (2018-01-29) change sbti__shiftsigned to avoid clang -O2 bug
+58 -29
View File
@@ -1,4 +1,4 @@
// stb_truetype.h - v1.19 - public domain
// stb_truetype.h - v1.21 - public domain
// authored from 2009-2016 by Sean Barrett / RAD Game Tools
//
// This library processes TrueType files:
@@ -49,6 +49,8 @@
//
// VERSION HISTORY
//
// 1.21 (2019-02-25) fix warning
// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics()
// 1.19 (2018-02-11) GPOS kerning, STBTT_fmod
// 1.18 (2018-01-29) add missing function
// 1.17 (2017-07-23) make more arguments const; doc fix
@@ -75,7 +77,7 @@
//
// USAGE
//
// Include this file in whatever places neeed to refer to it. In ONE C/C++
// Include this file in whatever places need to refer to it. In ONE C/C++
// file, write:
// #define STB_TRUETYPE_IMPLEMENTATION
// before the #include of this file. This expands out the actual
@@ -242,19 +244,6 @@
// recommend it.
//
//
// SOURCE STATISTICS (based on v0.6c, 2050 LOC)
//
// Documentation & header file 520 LOC \___ 660 LOC documentation
// Sample code 140 LOC /
// Truetype parsing 620 LOC ---- 620 LOC TrueType
// Software rasterization 240 LOC \ .
// Curve tesselation 120 LOC \__ 550 LOC Bitmap creation
// Bitmap management 100 LOC /
// Baked bitmap interface 70 LOC /
// Font name matching & access 150 LOC ---- 150
// C runtime library abstraction 60 LOC ---- 60
//
//
// PERFORMANCE MEASUREMENTS FOR 1.06:
//
// 32-bit 64-bit
@@ -556,6 +545,8 @@ STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int p
//
// It's inefficient; you might want to c&p it and optimize it.
STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap);
// Query the font vertical metrics without having to create a font first.
//////////////////////////////////////////////////////////////////////////////
@@ -641,6 +632,12 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
// To use with PackFontRangesGather etc., you must set it before calls
// call to PackFontRangesGatherRects.
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);
// If skip != 0, this tells stb_truetype to skip any codepoints for which
// there is no corresponding glyph. If skip=0, which is the default, then
// codepoints without a glyph recived the font's "missing character" glyph,
// typically an empty box by convention.
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
int char_index, // character to display
float *xpos, float *ypos, // pointers to current position in screen pixel space
@@ -669,6 +666,7 @@ struct stbtt_pack_context {
int height;
int stride_in_bytes;
int padding;
int skip_missing;
unsigned int h_oversample, v_oversample;
unsigned char *pixels;
void *nodes;
@@ -694,7 +692,7 @@ STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index);
// file will only define one font and it always be at offset 0, so it will
// return '0' for index 0, and -1 for all other indices.
// The following structure is defined publically so you can declare one on
// The following structure is defined publicly so you can declare one on
// the stack or as a global or etc, but you should treat it as opaque.
struct stbtt_fontinfo
{
@@ -733,6 +731,7 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
// and you want a speed-up, call this function with the character you're
// going to process, then use glyph-based functions instead of the
// codepoint-based functions.
// Returns 0 if the character codepoint is not defined in the font.
//////////////////////////////////////////////////////////////////////////////
@@ -820,7 +819,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s
// returns # of vertices and fills *vertices with the pointer to them
// these are expressed in "unscaled" coordinates
//
// The shape is a series of countours. Each one starts with
// The shape is a series of contours. Each one starts with
// a STBTT_moveto, then consists of a series of mixed
// STBTT_lineto and STBTT_curveto segments. A lineto
// draws a line from previous endpoint to its x,y; a curveto
@@ -916,7 +915,7 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff);
// These functions compute a discretized SDF field for a single character, suitable for storing
// in a single-channel texture, sampling with bilinear filtering, and testing against
// larger than some threshhold to produce scalable fonts.
// larger than some threshold to produce scalable fonts.
// info -- the font
// scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap
// glyph/codepoint -- the character to generate the SDF for
@@ -2463,6 +2462,7 @@ static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, i
if (valueFormat2 != 0) return 0;
STBTT_assert(coverageIndex < pairSetCount);
STBTT__NOTUSED(pairSetCount);
needle=glyph2;
r=pairValueCount-1;
@@ -3160,7 +3160,13 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e,
if (e->y0 != e->y1) {
stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);
if (z != NULL) {
STBTT_assert(z->ey >= scan_y_top);
if (j == 0 && off_y != 0) {
if (z->ey < scan_y_top) {
// this can happen due to subpixel positioning and some kind of fp rounding error i think
z->ey = scan_y_top;
}
}
STBTT_assert(z->ey >= scan_y_top); // if we get really unlucky a tiny bit of an edge can be out of bounds
// insert at front
z->next = active;
active = z;
@@ -3229,7 +3235,7 @@ static void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n)
static void stbtt__sort_edges_quicksort(stbtt__edge *p, int n)
{
/* threshhold for transitioning to insertion sort */
/* threshold for transitioning to insertion sort */
while (n > 12) {
stbtt__edge t;
int c01,c12,c,m,i,j;
@@ -3364,7 +3370,7 @@ static void stbtt__add_point(stbtt__point *points, int n, float x, float y)
points[n].y = y;
}
// tesselate until threshhold p is happy... @TODO warped to compensate for non-linear stretching
// tessellate until threshold p is happy... @TODO warped to compensate for non-linear stretching
static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)
{
// midpoint
@@ -3789,6 +3795,7 @@ STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, in
spc->stride_in_bytes = stride_in_bytes != 0 ? stride_in_bytes : pw;
spc->h_oversample = 1;
spc->v_oversample = 1;
spc->skip_missing = 0;
stbrp_init_target(context, pw-padding, ph-padding, nodes, num_nodes);
@@ -3814,6 +3821,11 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
spc->v_oversample = v_oversample;
}
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip)
{
spc->skip_missing = skip;
}
#define STBTT__OVER_MASK (STBTT_MAX_OVERSAMPLE-1)
static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)
@@ -3967,13 +3979,17 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb
int x0,y0,x1,y1;
int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];
int glyph = stbtt_FindGlyphIndex(info, codepoint);
stbtt_GetGlyphBitmapBoxSubpixel(info,glyph,
scale * spc->h_oversample,
scale * spc->v_oversample,
0,0,
&x0,&y0,&x1,&y1);
rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1);
rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1);
if (glyph == 0 && spc->skip_missing) {
rects[k].w = rects[k].h = 0;
} else {
stbtt_GetGlyphBitmapBoxSubpixel(info,glyph,
scale * spc->h_oversample,
scale * spc->v_oversample,
0,0,
&x0,&y0,&x1,&y1);
rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1);
rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1);
}
++k;
}
}
@@ -4026,7 +4042,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const
sub_y = stbtt__oversample_shift(spc->v_oversample);
for (j=0; j < ranges[i].num_chars; ++j) {
stbrp_rect *r = &rects[k];
if (r->was_packed) {
if (r->was_packed && r->w != 0 && r->h != 0) {
stbtt_packedchar *bc = &ranges[i].chardata_for_range[j];
int advance, lsb, x0,y0,x1,y1;
int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];
@@ -4140,6 +4156,19 @@ STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *
return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);
}
STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap)
{
int i_ascent, i_descent, i_lineGap;
float scale;
stbtt_fontinfo info;
stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, index));
scale = size > 0 ? stbtt_ScaleForPixelHeight(&info, size) : stbtt_ScaleForMappingEmToPixels(&info, -size);
stbtt_GetFontVMetrics(&info, &i_ascent, &i_descent, &i_lineGap);
*ascent = (float) i_ascent * scale;
*descent = (float) i_descent * scale;
*lineGap = (float) i_lineGap * scale;
}
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)
{
float ipw = 1.0f / pw, iph = 1.0f / ph;
+2 -2
View File
@@ -12,12 +12,12 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{939FE206-1182-ABC3-1234-FEAB88E98404}</ProjectGuid>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
+2 -2
View File
@@ -13,13 +13,13 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{FDC361C5-7734-493B-8CFB-037308B35122}</ProjectGuid>
<RootNamespace>yamlcpp</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+2 -3
View File
@@ -27,17 +27,16 @@
<ProjectGuid>{60F89955-91C6-3A36-8000-13C592FEC2DF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>zlib</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(SolutionDir)\3rdparty\zlib.props" />
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+116
View File
@@ -0,0 +1,116 @@
# Building
Only Windows and Linux are officially supported for building. However, various other platforms are capable of building RPCS3.
Other instructions may be found [here](https://wiki.rpcs3.net/index.php?title=Building).
## Setup your environment
### Windows 7 or later
* [CMake 3.8.2+](https://www.cmake.org/download/) (add to PATH)
* [Python 3.3+](https://www.python.org/downloads/) (add to PATH)
* [Qt 5.10+](https://www.qt.io/download-qt-installer) (Avoid 5.11.1, due to a bug)
* [Visual Studio 2017](https://visualstudio.microsoft.com/vs/older-downloads/)
* [Vulkan SDK 1.1.97.0+](https://vulkan.lunarg.com/sdk/home) (See "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html))
**Either add the** `QTDIR` **environment variable, e.g.** `<QtInstallFolder>\5.10.0\msvc2017_64\` **, or use the [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools-19123)**
### Linux
These are the essentials tools to build RPCS3 on Linux. Some of them can be installed through your favorite package manager.
* Clang 5.0+ or GCC 8.1+
* [CMake 3.8.2+](https://www.cmake.org/download/)
* [Qt 5.10+](https://www.qt.io/download-qt-installer) (Avoid 5.11.1, due to a bug)
* [Vulkan SDK 1.1.97.0+](https://vulkan.lunarg.com/sdk/home) (See "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html))
**If you have an NVIDIA GPU, you may need to install the libglvnd package.**
#### Arch Linux
sudo pacman -S glew openal cmake vulkan-validation-layers qt5-base qt5-declarative
#### Debian & Ubuntu
sudo apt-get install cmake build-essential libasound2-dev libpulse-dev libopenal-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev libudev-dev git qt5-default libevdev-dev qtdeclarative5-dev qtbase5-private-dev
##### GCC 8.x installation
If the `gcc-8` package is not available on your system, use the following command
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
```
Then
```
sudo apt-get update
sudo apt-get install gcc-8 g++-8
```
You can either use `update-alternatives` to setup `gcc-8`/`g++-8` as your default compilers or prefix any `cmake` command by `CXX=g++-8 CC=gcc-8 ` to use it.
##### Vulkan SDK
For Ubuntu systems, it is strongly recommended to use the PPA from [LunarG](https://packages.lunarg.com/) which will provide a compatible Vulkan SDK to compile RPCS3. If your Vulkan SDK is older, it can lead to compilation errors.
Ubuntu 18.04 (Bionic Beaver)
```
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.1.106-bionic.list http://packages.lunarg.com/vulkan/1.1.106/lunarg-vulkan-1.1.106-bionic.list
sudo apt update
sudo apt install vulkan-sdk
```
Ubuntu 16.04 (Xenial Xerus)
```
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.1.106-xenial.list http://packages.lunarg.com/vulkan/1.1.106/lunarg-vulkan-1.1.106-xenial.list
sudo apt update
sudo apt install vulkan-sdk
```
#### Fedora
sudo dnf install alsa-lib-devel cmake glew glew-devel libatomic libevdev-devel libudev-devel openal-devel qt5-devel vulkan-devel
#### OpenSUSE
sudo zypper install git cmake libasound2 libpulse-devel openal-soft-devel glew-devel zlib-devel libedit-devel vulkan-devel libudev-devel libqt5-qtbase-devel libevdev-devel
## Setup the project
Clone and initialize the repository
```
git clone https://github.com/RPCS3/rpcs3.git
cd rpcs3
git submodule update --init
```
### Windows
#### Configuring the Qt plugin (if used)
1) Go to the Qt5 menu and edit Qt5 options.
2) Add the path to your Qt installation with compiler e.g. `<QtInstallFolder>\5.10.0\msvc2017_64`.
3) While selecting the rpcs3qt project, go to Qt5->Project Setting and select the version you added.
#### Building the projects
Open `rpcs3.sln`. The recommended build configuration is `Release - LLVM` for all purposes.
You may want to download precompiled [LLVM libs](https://github.com/RPCS3/llvm/releases/download/continuous-master/llvmlibs.7z) and extract to root rpcs3 folder (which contains `rpcs3.sln`), as well as download and extract [additional libs](https://drive.google.com/uc?export=download&id=1A2eOMmCO714i0U7J0qI4aEMKnuWl8l_R) to `lib\%CONFIGURATION%-x64\` to speed up compilation time (unoptimised/debug libs are currently not available precompiled).
If you're not using precompiled libs, build the projects in *__BUILD_BEFORE* folder: right-click on every project > *Build*.
`Build > Build Solution`
### Linux
While still in the project root:
1) `cd .. && mkdir rpcs3_build && cd rpcs3_build`
2) `cmake ../rpcs3/ && make` or `CXX=g++-8 CC=gcc-8 cmake ../rpcs3/ && make` to force these compilers
3) Run RPCS3 with `./bin/rpcs3`
When using GDB, configure it to ignore SIGSEGV signal (`handle SIGSEGV nostop noprint`).
If desired, use the various build options in [CMakeLists](https://github.com/RPCS3/rpcs3/blob/master/CMakeLists.txt).
+26 -5
View File
@@ -2,20 +2,25 @@ cmake_minimum_required(VERSION 3.8.2)
project(rpcs3)
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
message(FATAL_ERROR "RPCS3 requires at least gcc-8.")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "RPCS3 requires at least clang-5.0.")
endif()
endif()
option(WITH_GDB "WITH_GDB" OFF)
option(USE_NATIVE_INSTRUCTIONS "USE_NATIVE_INSTRUCTIONS makes rpcs3 compile with -march=native, which is useful for local builds, but not good for packages." ON)
option(WITH_LLVM "Enable usage of LLVM library" ON)
option(BUILD_LLVM_SUBMODULE "Build LLVM from git submodule" ON)
option(USE_ALSA "ALSA audio backend" ON)
option(USE_PULSE "PulseAudio audio backend" ON)
option(USE_LIBEVDEV "libevdev-based joystick support" ON)
option(USE_DISCORD_RPC "Discord rich presence integration" ON)
option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON)
option(USE_VULKAN "Vulkan render backend" ON)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules")
@@ -56,10 +61,26 @@ if(APPLE)
link_directories(/opt/local/lib)
endif()
# Warnings are silenced for 3rdparty code
set(CMAKE_CXX_FLAGS -w)
set(CMAKE_C_FLAGS -w)
set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "")
if(MSVC)
add_compile_options(/wd4530) # C++ exception handler used, but unwind semantics are not enabled
endif()
add_subdirectory(Vulkan EXCLUDE_FROM_ALL)
add_subdirectory(asmjitsrc EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty)
unset(CMAKE_CXX_FLAGS)
unset(CMAKE_C_FLAGS)
if (NOT WIN32)
add_compile_options(-pthread)
endif()
# TODO: do real installation, including copying directory structure
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
+4 -61
View File
@@ -11,7 +11,6 @@ For discussion about this emulator, PS3 emulation, and game compatibility report
[**Support Lead Developers Nekotekina and kd-11 on Patreon**](https://www.patreon.com/Nekotekina)
## Contributing
If you want to help the project but do not code, the best way to help out is to test games and make bug reports. See:
@@ -25,71 +24,15 @@ If you want to contribute as a developer, please take a look at the following pa
You should also contact any of the developers in the forums or in the Discord server to learn more about the current state of the emulator.
## Dependencies
### Windows
* [Visual Studio 2017](https://www.visualstudio.com/en/downloads/)
* [Visual C++ Redistributable Packages for Visual Studio 2017](https://go.microsoft.com/fwlink/?LinkId=746572)
* [CMake 3.8.2+](https://www.cmake.org/download/) (add to PATH)
* [Python 3.3+](https://www.python.org/downloads/) (add to PATH)
* [Vulkan SDK](https://vulkan.lunarg.com/sdk/home) (See "Install the SDK" [here](https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html))
* [Qt 5.10+](https://www.qt.io/download-open-source/) (Avoid 5.11.1, due to a bug)
**Either add the** `QTDIR` **environment variable, e.g.** `<QtInstallFolder>\5.11.2\msvc2017_64\` **, or use the [Visual Studio Qt Plugin](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools-19123)**
### Linux
* [Qt 5.10+](https://www.qt.io/download-open-source/) (Avoid 5.11.1, due to a bug)
* GCC 7.3+ or Clang 5.0+
* CMake 3.8.2+
* Debian & Ubuntu: `sudo apt-get install cmake build-essential libasound2-dev libpulse-dev libopenal-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev libudev-dev git qt5-default libevdev-dev`
* Arch: `sudo pacman -S glew openal cmake vulkan-validation-layers qt5-base qt5-declarative`
* Fedora: `sudo dnf install alsa-lib-devel cmake glew glew-devel libatomic libevdev-devel libudev-devel openal-devel qt5-devel vulkan-devel`
* OpenSUSE: `sudo zypper install git cmake libasound2 libpulse-devel openal-soft-devel glew-devel zlib-devel libedit-devel vulkan-devel libudev-devel libqt5-qtbase-devel libevdev-devel`
**If you have an NVIDIA GPU, you may need to install the libglvnd package.**
## Building
Only Windows and Linux are officially supported for building. However, various other platforms are capable of building RPCS3. Other instructions may be found [here](https://wiki.rpcs3.net/index.php?title=Building).
See [BUILDING.md](BUILDING.md) for more information about how to setup an environment to build RPCS3.
Clone and initialize the repository:
## Running
1) `git clone https://github.com/RPCS3/rpcs3.git`
2) `cd rpcs3/`
3) `git submodule update --init`
Check our friendly [quickstart](https://rpcs3.net/quickstart) guide to make sure your computer meets the minimum system requirements to run RPCS3.
### Windows
#### Configuring the Qt plugin (if used)
1) Go to the Qt5 menu and edit Qt5 options.
2) Add the path to your Qt installation with compiler e.g. `<QtInstallFolder>\5.11.2\msvc2017_64`.
3) While selecting the rpcs3qt project, go to Qt5->Project Setting and select the version you added.
#### Building the projects
Open `rpcs3.sln`. The recommended build configuration is `Release - LLVM` for all purposes.
You may want to download precompiled [LLVM libs](https://github.com/RPCS3/llvm/releases/download/continuous-master/llvmlibs.7z) and extract to root rpcs3 folder (which contains `rpcs3.sln`), as well as download and extract [additional libs](https://drive.google.com/uc?export=download&id=1A2eOMmCO714i0U7J0qI4aEMKnuWl8l_R) to `lib\%CONFIGURATION%-x64\` to speed up compilation time (unoptimised/debug libs are currently not available precompiled).
If you're not using precompiled libs, build the projects in *__BUILD_BEFORE* folder: right-click on every project > *Build*.
`Build > Build Solution`
### Linux
While still in the project root:
1) `cd .. && mkdir rpcs3_build && cd rpcs3_build`
2) `cmake ../rpcs3/ && make GitVersion && make`
3) Run RPCS3 with `./bin/rpcs3`
When using GDB, configure it to ignore SIGSEGV signal (`handle SIGSEGV nostop noprint`).
If desired, use the various build options in [CMakeLists](https://github.com/RPCS3/rpcs3/blob/master/CMakeLists.txt).
Don't forget to have your graphics driver up to date and to install the [Visual C++ Redistributable Packages for Visual Studio 2017](https://go.microsoft.com/fwlink/?LinkId=746572) if you are a Windows user.
## License
+2 -1
View File
@@ -1,7 +1,8 @@
#pragma once
#include "Atomic.h"
#include "util/atomic.hpp"
#include <memory>
#include <cstddef>
// Unfinished. Only std::default_delete will work as expected.
template<typename T, typename D>
+21 -24
View File
@@ -380,13 +380,12 @@ struct se_storage<T, 2, 2>
static inline u16 to(const T& src)
{
return swap(reinterpret_cast<const u16&>(src));
return swap(std::bit_cast<u16>(src));
}
static inline T from(u16 src)
{
const u16 result = swap(src);
return reinterpret_cast<const T&>(result);
return std::bit_cast<T, u16>(swap(src));
}
};
@@ -406,13 +405,12 @@ struct se_storage<T, 4, 4>
static inline u32 to(const T& src)
{
return swap(reinterpret_cast<const u32&>(src));
return swap(std::bit_cast<u32>(src));
}
static inline T from(u32 src)
{
const u32 result = swap(src);
return reinterpret_cast<const T&>(result);
return std::bit_cast<T, u32>(swap(src));
}
};
@@ -432,13 +430,12 @@ struct se_storage<T, 8, 8>
static inline u64 to(const T& src)
{
return swap(reinterpret_cast<const u64&>(src));
return swap(std::bit_cast<u64>(src));
}
static inline T from(u64 src)
{
const u64 result = swap(src);
return reinterpret_cast<const T&>(result);
return std::bit_cast<T, u64>(swap(src));
}
};
@@ -454,13 +451,12 @@ struct se_storage<T, 16, 16>
static inline v128 to(const T& src)
{
return swap(reinterpret_cast<const v128&>(src));
return swap(std::bit_cast<v128>(src));
}
static inline T from(const v128& src)
{
const v128 result = swap(src);
return reinterpret_cast<const T&>(result);
return std::bit_cast<T, v128>(swap(src));
}
};
@@ -494,6 +490,11 @@ public:
return storage::from(m_data);
}
stype& raw()
{
return m_data;
}
se_t& operator=(const se_t&) = default;
se_t& operator=(type value)
@@ -524,33 +525,29 @@ class se_t<T, false, Align>
stype m_data;
static stype init(type value)
{
stype result;
std::memcpy(&result, &value, sizeof(result));
return result;
}
public:
se_t() = default;
se_t(type value)
: m_data(init(value))
: m_data(std::bit_cast<stype>(value))
{
}
type value() const
{
type result;
std::memcpy(&result, &m_data, sizeof(result));
return result;
return std::bit_cast<type>(m_data);
}
stype& raw()
{
return m_data;
}
se_t& operator=(const se_t& value) = default;
se_t& operator=(type value)
{
std::memcpy(&m_data, &value, sizeof(m_data));
m_data = std::bit_cast<stype>(value);
return *this;
}
+5 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include "types.h"
#include <limits>
template<typename T, uint N>
struct bf_base
@@ -15,11 +16,11 @@ struct bf_base
// Field bitsize
static constexpr uint bitsize = N;
// Value mask
static constexpr utype vmask = static_cast<utype>(~utype{} >> (bitmax - bitsize));
// All ones mask
static constexpr utype mask1 = static_cast<utype>(~utype{});
static constexpr utype mask1 = std::numeric_limits<utype>::max();
// Value mask
static constexpr utype vmask = mask1 >> (bitmax - bitsize);
protected:
type m_data;
+10 -6
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "Utilities/types.h"
#include "Utilities/StrFmt.h"
@@ -133,7 +133,7 @@ namespace cfg
return m_value;
}
bool get() const
const bool& get() const
{
return m_value;
}
@@ -184,7 +184,7 @@ namespace cfg
return m_value;
}
T get() const
const T& get() const
{
return m_value;
}
@@ -235,6 +235,10 @@ namespace cfg
public:
int_type def;
// Expose range
static const s64 max = Max;
static const s64 min = Min;
_int(node* owner, const std::string& name, int_type def = std::min<int_type>(Max, std::max<int_type>(Min, 0)))
: _base(type::_int, owner, name)
, m_value(def)
@@ -247,7 +251,7 @@ namespace cfg
return m_value;
}
int_type get() const
const int_type& get() const
{
return m_value;
}
@@ -347,7 +351,7 @@ namespace cfg
{
}
std::set<std::string> get_set() const
const std::set<std::string>& get_set() const
{
return m_set;
}
@@ -382,7 +386,7 @@ namespace cfg
{
}
std::map<std::string, logs::level> get_map() const
const std::map<std::string, logs::level>& get_map() const
{
return m_map;
}
+113 -22
View File
@@ -125,6 +125,7 @@ static fs::error to_error(DWORD e)
#include <sys/types.h>
#include <sys/statvfs.h>
#include <sys/file.h>
#include <sys/uio.h>
#include <dirent.h>
#include <fcntl.h>
#include <libgen.h>
@@ -137,6 +138,8 @@ static fs::error to_error(DWORD e)
#include <mach-o/dyld.h>
#elif defined(__linux__) || defined(__sun)
#include <sys/sendfile.h>
#include <sys/syscall.h>
#include <linux/fs.h>
#else
#include <fstream>
#endif
@@ -192,6 +195,43 @@ namespace fs
// Do notning
}
fs::native_handle fs::file_base::get_handle()
{
#ifdef _WIN32
return INVALID_HANDLE_VALUE;
#else
return -1;
#endif
}
u64 file_base::write_gather(const iovec_clone* buffers, u64 buf_count)
{
u64 total = 0;
for (u64 i = 0; i < buf_count; i++)
{
if (!buffers[i].iov_base || buffers[i].iov_len + total < total)
{
g_tls_error = error::inval;
return -1;
}
total += buffers[i].iov_len;
}
const auto buf = std::make_unique<uchar[]>(total);
u64 copied = 0;
for (u64 i = 0; i < buf_count; i++)
{
std::memcpy(buf.get() + copied, buffers[i].iov_base, buffers[i].iov_len);
copied += buffers[i].iov_len;
}
return this->write(buf.get(), total);
}
dir_base::~dir_base()
{
}
@@ -600,6 +640,21 @@ bool fs::rename(const std::string& from, const std::string& to, bool overwrite)
return true;
#else
#ifdef __linux__
if (syscall(SYS_renameat2, AT_FDCWD, from.c_str(), AT_FDCWD, to.c_str(), overwrite ? 0 : 1 /* RENAME_NOREPLACE */) == 0)
{
return true;
}
// If the filesystem doesn't support RENAME_NOREPLACE, it returns EINVAL. Retry with fallback method in that case.
if (errno != EINVAL || overwrite)
{
g_tls_error = to_error(errno);
return false;
}
#endif
if (!overwrite && exists(to))
{
g_tls_error = fs::error::exist;
@@ -884,7 +939,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return;
}
class windows_file final : public file_base, public get_native_handle
class windows_file final : public file_base
{
const HANDLE m_handle;
@@ -987,7 +1042,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return size.QuadPart;
}
native_handle get() override
native_handle get_handle() override
{
return m_handle;
}
@@ -1034,7 +1089,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
::ftruncate(fd, 0);
}
class unix_file final : public file_base, public get_native_handle
class unix_file final : public file_base
{
const int m_fd;
@@ -1127,10 +1182,21 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
return file_info.st_size;
}
native_handle get() override
native_handle get_handle() override
{
return m_fd;
}
u64 write_gather(const iovec_clone* buffers, u64 buf_count) override
{
static_assert(sizeof(iovec) == sizeof(iovec_clone), "Weird iovec size");
static_assert(offsetof(iovec, iov_len) == offsetof(iovec_clone, iov_len), "Weird iovec::iov_len offset");
const auto result = ::writev(m_fd, (const iovec*)buffers, buf_count);
verify("file::write_gather" HERE), result != -1;
return result;
}
};
m_file = std::make_unique<unix_file>(fd);
@@ -1208,9 +1274,9 @@ fs::file::file(const void* ptr, std::size_t size)
fs::native_handle fs::file::get_handle() const
{
if (auto getter = dynamic_cast<get_native_handle*>(m_file.get()))
if (m_file)
{
return getter->get();
return m_file->get_handle();
}
#ifdef _WIN32
@@ -1220,6 +1286,15 @@ fs::native_handle fs::file::get_handle() const
#endif
}
#ifdef _WIN32
bool fs::file::set_delete(bool autodelete) const
{
FILE_DISPOSITION_INFO disp;
disp.DeleteFileW = autodelete;
return SetFileInformationByHandle(get_handle(), FileDispositionInfo, &disp, sizeof(disp)) != 0;
}
#endif
void fs::dir::xnull() const
{
fmt::throw_exception<std::logic_error>("fs::dir is null");
@@ -1385,8 +1460,9 @@ const std::string& fs::get_config_dir()
#ifdef _WIN32
wchar_t buf[32768];
if (GetEnvironmentVariable(L"RPCS3_CONFIG_DIR", buf, std::size(buf)) - 1 >= std::size(buf) - 1 &&
GetModuleFileName(NULL, buf, std::size(buf)) - 1 >= std::size(buf) - 1)
constexpr DWORD size = static_cast<DWORD>(std::size(buf));
if (GetEnvironmentVariable(L"RPCS3_CONFIG_DIR", buf, size) - 1 >= size - 1 &&
GetModuleFileName(NULL, buf, size) - 1 >= size - 1)
{
MessageBoxA(0, fmt::format("GetModuleFileName() failed: error %u.", GetLastError()).c_str(), "fs::get_config_dir()", MB_ICONERROR);
return dir; // empty
@@ -1463,30 +1539,45 @@ const std::string& fs::get_cache_dir()
return s_dir;
}
void fs::remove_all(const std::string& path, bool remove_root)
bool fs::remove_all(const std::string& path, bool remove_root)
{
for (const auto& entry : dir(path))
if (const auto root_dir = dir(path))
{
if (entry.name == "." || entry.name == "..")
for (const auto& entry : root_dir)
{
continue;
}
if (entry.name == "." || entry.name == "..")
{
continue;
}
if (entry.is_directory == false)
{
remove_file(path + '/' + entry.name);
}
if (entry.is_directory == false)
{
if (!remove_file(path + '/' + entry.name))
{
return false;
}
}
if (entry.is_directory == true)
{
remove_all(path + '/' + entry.name);
if (entry.is_directory == true)
{
if (!remove_all(path + '/' + entry.name))
{
return false;
}
}
}
}
else
{
return false;
}
if (remove_root)
{
remove_dir(path);
return remove_dir(path);
}
return true;
}
u64 fs::get_dir_size(const std::string& path)
+19 -4
View File
@@ -65,10 +65,11 @@ namespace fs
s64 ctime;
};
// Native handle getter
struct get_native_handle
// Helper, layout is equal to iovec struct
struct iovec_clone
{
virtual native_handle get() = 0;
const void* iov_base;
std::size_t iov_len;
};
// File handle base
@@ -83,6 +84,8 @@ namespace fs
virtual u64 write(const void* buffer, u64 size) = 0;
virtual u64 seek(s64 offset, seek_mode whence) = 0;
virtual u64 size() = 0;
virtual native_handle get_handle();
virtual u64 write_gather(const iovec_clone* buffers, u64 buf_count);
};
// Directory entry (TODO)
@@ -366,6 +369,18 @@ namespace fs
// Get native handle if available
native_handle get_handle() const;
// Gathered write
u64 write_gather(const iovec_clone* buffers, u64 buf_count) const
{
if (!m_file) xnull();
return m_file->write_gather(buffers, buf_count);
}
#ifdef _WIN32
// Windows-specific function
bool set_delete(bool autodelete = true) const;
#endif
};
class dir final
@@ -488,7 +503,7 @@ namespace fs
const std::string& get_cache_dir();
// Delete directory and all its contents recursively
void remove_all(const std::string& path, bool remove_root = true);
bool remove_all(const std::string& path, bool remove_root = true);
// Get size of all files recursively
u64 get_dir_size(const std::string& path);
+6 -6
View File
@@ -354,7 +354,7 @@ std::string GDBDebugServer::get_reg(std::shared_ptr<ppu_thread> thread, u32 rid)
case 65:
return std::string(16, 'x');
case 66:
return u32_to_padded_hex(thread->cr_pack());
return u32_to_padded_hex(thread->cr.pack());
case 67:
return u64_to_padded_hex(thread->lr);
case 68:
@@ -368,7 +368,7 @@ std::string GDBDebugServer::get_reg(std::shared_ptr<ppu_thread> thread, u32 rid)
default:
if (rid > 70) return "";
return (rid > 31)
? u64_to_padded_hex(reinterpret_cast<u64&>(thread->fpr[rid - 32])) //fpr
? u64_to_padded_hex(std::bit_cast<u64>(thread->fpr[rid - 32])) //fpr
: u64_to_padded_hex(thread->gpr[rid]); //gpr
}
}
@@ -383,7 +383,7 @@ bool GDBDebugServer::set_reg(std::shared_ptr<ppu_thread> thread, u32 rid, std::s
case 65:
return true;
case 66:
thread->cr_unpack(hex_to_u32(value));
thread->cr.unpack(hex_to_u32(value));
return true;
case 67:
thread->lr = hex_to_u64(value);
@@ -401,7 +401,7 @@ bool GDBDebugServer::set_reg(std::shared_ptr<ppu_thread> thread, u32 rid, std::s
if (rid > 70) return false;
if (rid > 31) {
u64 val = hex_to_u64(value);
thread->fpr[rid - 32] = reinterpret_cast<f64&>(val);
thread->fpr[rid - 32] = std::bit_cast<f64>(val);
} else {
thread->gpr[rid] = hex_to_u64(value);
}
@@ -541,7 +541,7 @@ bool GDBDebugServer::cmd_read_memory(gdb_cmd & cmd)
std::string result;
result.reserve(len * 2);
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr, 1, vm::page_allocated | vm::page_readable)) {
if (vm::check_addr(addr)) {
result += to_hexbyte(vm::read8(addr + i));
} else {
break;
@@ -567,7 +567,7 @@ bool GDBDebugServer::cmd_write_memory(gdb_cmd & cmd)
u32 len = hex_to_u32(cmd.data.substr(s + 1, s2 - s - 1));
const char* data_ptr = (cmd.data.c_str()) + s2 + 1;
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr + i, 1, vm::page_allocated | vm::page_writable)) {
if (vm::check_addr(addr + i, 1, vm::page_writable)) {
u8 val;
int res = sscanf_s(data_ptr, "%02hhX", &val);
if (!res) {
+2
View File
@@ -1,5 +1,7 @@
#pragma once
#include <type_traits>
template<typename T1, typename T2> struct range_t
{
T1 _min; // first value
+108 -34
View File
@@ -64,6 +64,8 @@ static u8* add_jit_memory(std::size_t size, uint align)
if (UNLIKELY(_new > 0x40000000))
{
// Sorry, we failed, and further attempts should fail too.
ctr = 0x40000000;
return -1;
}
@@ -77,7 +79,7 @@ static u8* add_jit_memory(std::size_t size, uint align)
if (UNLIKELY(pos == -1))
{
LOG_FATAL(GENERAL, "JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off);
LOG_WARNING(GENERAL, "JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off);
return nullptr;
}
@@ -181,25 +183,41 @@ void jit_runtime::finalize() noexcept
std::memcpy(alloc(s_data_init.size(), 1, false), s_data_init.data(), s_data_init.size());
}
::jit_runtime& asmjit::get_global_runtime()
asmjit::JitRuntime& asmjit::get_global_runtime()
{
// Magic static
static ::jit_runtime g_rt;
static asmjit::JitRuntime g_rt;
return g_rt;
}
asmjit::Label asmjit::build_transaction_enter(asmjit::X86Assembler& c, asmjit::Label fallback)
void asmjit::build_transaction_enter(asmjit::X86Assembler& c, asmjit::Label fallback, const asmjit::X86Gp& ctr, uint less_than)
{
Label fall = c.newLabel();
Label begin = c.newLabel();
c.jmp(begin);
c.bind(fall);
c.test(x86::eax, _XABORT_RETRY);
c.jz(fallback);
if (less_than < 65)
{
c.add(ctr, 1);
c.test(x86::eax, _XABORT_RETRY);
c.jz(fallback);
}
else
{
// Count an attempt without RETRY flag as 65 normal attempts and continue
c.not_(x86::eax);
c.and_(x86::eax, _XABORT_RETRY);
c.shl(x86::eax, 5);
c.add(x86::eax, 1); // eax = RETRY ? 1 : 65
c.add(ctr, x86::rax);
}
c.cmp(ctr, less_than);
c.jae(fallback);
c.align(kAlignCode, 16);
c.bind(begin);
c.xbegin(fall);
return begin;
}
void asmjit::build_transaction_abort(asmjit::X86Assembler& c, unsigned char code)
@@ -248,6 +266,7 @@ static void* const s_memory = []() -> void*
{
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeNativeTargetAsmParser();
LLVMLinkInMCJIT();
#ifdef MAP_32BIT
@@ -472,7 +491,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
s_unfire.push_front(std::make_pair(addr, size));
#endif
return RTDyldMemoryManager::registerEHFrames(addr, load_addr, size);
return RTDyldMemoryManager::registerEHFramesInProcess(addr, size);
}
void deregisterEHFrames() override
@@ -503,6 +522,63 @@ struct MemoryManager2 : llvm::RTDyldMemoryManager
{
return false;
}
void registerEHFrames(u8* addr, u64 load_addr, std::size_t size) override
{
#ifndef _WIN32
RTDyldMemoryManager::registerEHFramesInProcess(addr, size);
s_unfire.push_front(std::make_pair(addr, size));
#endif
}
void deregisterEHFrames() override
{
}
};
// Simple memory manager. I promise there will be no MemoryManager4.
struct MemoryManager3 : llvm::RTDyldMemoryManager
{
std::vector<std::pair<u8*, std::size_t>> allocs;
MemoryManager3() = default;
~MemoryManager3() override
{
for (auto& a : allocs)
{
utils::memory_release(a.first, a.second);
}
}
u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
{
u8* r = static_cast<u8*>(utils::memory_reserve(size));
utils::memory_commit(r, size, utils::protection::wx);
allocs.emplace_back(r, size);
return r;
}
u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
{
u8* r = static_cast<u8*>(utils::memory_reserve(size));
utils::memory_commit(r, size);
allocs.emplace_back(r, size);
return r;
}
bool finalizeMemory(std::string* = nullptr) override
{
return false;
}
void registerEHFrames(u8* addr, u64 load_addr, std::size_t size) override
{
}
void deregisterEHFrames() override
{
}
};
// Helper class
@@ -515,7 +591,7 @@ struct EventListener : llvm::JITEventListener
{
}
void NotifyObjectEmitted(const llvm::object::ObjectFile& obj, const llvm::RuntimeDyld::LoadedObjectInfo& inf) override
void notifyObjectLoaded(ObjectKey K, const llvm::object::ObjectFile& obj, const llvm::RuntimeDyld::LoadedObjectInfo& inf) override
{
#ifdef _WIN32
for (auto it = obj.section_begin(), end = obj.section_end(); it != end; ++it)
@@ -624,8 +700,11 @@ std::string jit_compiler::cpu(const std::string& _cpu)
m_cpu == "broadwell" ||
m_cpu == "skylake" ||
m_cpu == "skylake-avx512" ||
m_cpu == "cascadelake" ||
m_cpu == "cannonlake" ||
m_cpu == "icelake")
m_cpu == "icelake" ||
m_cpu == "icelake-client" ||
m_cpu == "icelake-server")
{
// Downgrade if AVX is not supported by some chips
if (!utils::has_avx())
@@ -635,8 +714,11 @@ std::string jit_compiler::cpu(const std::string& _cpu)
}
if (m_cpu == "skylake-avx512" ||
m_cpu == "cascadelake" ||
m_cpu == "cannonlake" ||
m_cpu == "icelake")
m_cpu == "icelake" ||
m_cpu == "icelake-client" ||
m_cpu == "icelake-server")
{
// Downgrade if AVX-512 is disabled or not supported
if (!utils::has_512())
@@ -649,7 +731,7 @@ std::string jit_compiler::cpu(const std::string& _cpu)
return m_cpu;
}
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, bool large)
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags)
: m_link(_link)
, m_cpu(cpu(_cpu))
{
@@ -657,13 +739,24 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
if (m_link.empty())
{
std::unique_ptr<llvm::RTDyldMemoryManager> mem;
if (flags & 0x1)
{
mem = std::make_unique<MemoryManager3>();
}
else
{
mem = std::make_unique<MemoryManager2>();
}
// Auxiliary JIT (does not use custom memory manager, only writes the objects)
m_engine.reset(llvm::EngineBuilder(std::make_unique<llvm::Module>("null_", m_context))
.setErrorStr(&result)
.setEngineKind(llvm::EngineKind::JIT)
.setMCJITMemoryManager(std::make_unique<MemoryManager2>())
.setMCJITMemoryManager(std::move(mem))
.setOptLevel(llvm::CodeGenOpt::Aggressive)
.setCodeModel(large ? llvm::CodeModel::Large : llvm::CodeModel::Small)
.setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small)
.setMCPU(m_cpu)
.create());
}
@@ -678,7 +771,7 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
.setEngineKind(llvm::EngineKind::JIT)
.setMCJITMemoryManager(std::move(mem))
.setOptLevel(llvm::CodeGenOpt::Aggressive)
.setCodeModel(large ? llvm::CodeModel::Large : llvm::CodeModel::Small)
.setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small)
.setMCPU(m_cpu)
.create());
@@ -698,25 +791,6 @@ jit_compiler::~jit_compiler()
{
}
bool jit_compiler::has_ssse3() const
{
if (m_cpu == "generic" ||
m_cpu == "k8" ||
m_cpu == "opteron" ||
m_cpu == "athlon64" ||
m_cpu == "athlon-fx" ||
m_cpu == "k8-sse3" ||
m_cpu == "opteron-sse3" ||
m_cpu == "athlon64-sse3" ||
m_cpu == "amdfam10" ||
m_cpu == "barcelona")
{
return false;
}
return true;
}
void jit_compiler::add(std::unique_ptr<llvm::Module> module, const std::string& path)
{
ObjectCache cache{path};
+3 -6
View File
@@ -40,10 +40,10 @@ struct jit_runtime final : asmjit::HostRuntime
namespace asmjit
{
// Should only be used to build global functions
::jit_runtime& get_global_runtime();
asmjit::JitRuntime& get_global_runtime();
// Emit xbegin and adjacent loop, return label at xbegin
Label build_transaction_enter(X86Assembler& c, Label fallback);
void build_transaction_enter(X86Assembler& c, Label fallback, const X86Gp& ctr, uint less_than);
// Emit xabort
void build_transaction_abort(X86Assembler& c, unsigned char code);
@@ -128,7 +128,7 @@ class jit_compiler final
std::string m_cpu;
public:
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, bool large = false);
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags = 0);
~jit_compiler();
// Get LLVM context
@@ -142,9 +142,6 @@ public:
return *m_engine;
}
// Test SSSE3 feature
bool has_ssse3() const;
// Add module (path to obj cache dir)
void add(std::unique_ptr<llvm::Module> module, const std::string& path);
+18 -8
View File
@@ -387,9 +387,7 @@ logs::file_writer::file_writer(const std::string& name)
#ifdef _WIN32
// Autodelete compressed log file
FILE_DISPOSITION_INFO disp;
disp.DeleteFileW = TRUE;
SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp));
m_fout2.set_delete();
#endif
}
catch (const std::exception& e)
@@ -469,9 +467,7 @@ logs::file_writer::~file_writer()
#ifdef _WIN32
// Cancel compressed log file autodeletion
FILE_DISPOSITION_INFO disp;
disp.DeleteFileW = FALSE;
SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp));
m_fout2.set_delete(false);
UnmapViewOfFile(m_fptr);
CloseHandle(m_fmap);
@@ -593,16 +589,30 @@ logs::file_listener::file_listener(const std::string& name)
// Write UTF-8 BOM
file_writer::log(logs::level::always, "\xEF\xBB\xBF", 3);
const std::string firmware_version = utils::get_firmware_version();
const std::string firmware_string = firmware_version.empty() ? "" : (" | Firmware version: " + firmware_version);
// Write initial message
stored_message ver;
ver.m.ch = nullptr;
ver.m.sev = level::always;
ver.stamp = 0;
ver.text = fmt::format("RPCS3 v%s | %s\n%s", rpcs3::version.to_string(), rpcs3::get_branch(), utils::get_system_info());
ver.text = fmt::format("RPCS3 v%s | %s%s\n%s", rpcs3::version.to_string(), rpcs3::get_branch(), firmware_string, utils::get_system_info());
file_writer::log(logs::level::always, ver.text.data(), ver.text.size());
file_writer::log(logs::level::always, "\n", 1);
messages.emplace_back(std::move(ver));
// Write OS version
stored_message os;
os.m.ch = nullptr;
os.m.sev = level::notice;
os.stamp = 0;
os.text = utils::get_OS_version();
file_writer::log(logs::level::notice, os.text.data(), os.text.size());
file_writer::log(logs::level::notice, "\n", 1);
messages.emplace_back(std::move(os));
}
void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& _text)
@@ -630,7 +640,7 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
const u64 frac = (stamp % 1'000'000);
fmt::append(text, "%u:%02u:%02u.%06u ", hours, mins, secs, frac);
if (prefix.size() > 0)
if (!prefix.empty())
{
text += "{";
text += prefix;
+2 -2
View File
@@ -1,7 +1,7 @@
#pragma once
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
#include "StrFmt.h"
#include <climits>
@@ -110,7 +110,7 @@ namespace logs
void set_level(const std::string&, level);
}
#define LOG_CHANNEL(ch, ...) ::logs::channel ch(#ch, ##__VA_ARGS__);
#define LOG_CHANNEL(ch, ...) ::logs::channel ch(#ch, ##__VA_ARGS__)
// Legacy:
+2 -2
View File
@@ -177,13 +177,13 @@ void fmt_class_string<ullong>::format(std::string& out, u64 arg)
template <>
void fmt_class_string<float>::format(std::string& out, u64 arg)
{
fmt::append(out, "%gf", static_cast<float>(reinterpret_cast<f64&>(arg)));
fmt::append(out, "%gf", static_cast<float>(std::bit_cast<f64>(arg)));
}
template <>
void fmt_class_string<double>::format(std::string& out, u64 arg)
{
fmt::append(out, "%g", reinterpret_cast<f64&>(arg));
fmt::append(out, "%g", std::bit_cast<f64>(arg));
}
template <>
+1 -13
View File
@@ -62,7 +62,7 @@ struct fmt_unveil<T, std::enable_if_t<std::is_floating_point<T>::value && sizeof
// Convert FP to f64 and reinterpret as u64
static inline u64 get(const f64& arg)
{
return *reinterpret_cast<const u64*>(reinterpret_cast<const u8*>(&arg));
return std::bit_cast<u64>(arg);
}
};
@@ -140,18 +140,9 @@ struct fmt_class_string
// Enum -> string function type
using convert_t = const char*(*)(T value);
// Enum -> string function registered
static convert_t convert_enum;
// Helper function (safely converts arg to enum value)
static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, convert_t convert)
{
// Save convert function
if (convert_enum == nullptr)
{
convert_enum = convert;
}
const auto value = static_cast<std::underlying_type_t<T>>(arg);
// Check narrowing
@@ -203,9 +194,6 @@ struct fmt_class_string
static constexpr const char* unknown = nullptr;
};
template <typename T, typename V>
const char*(*fmt_class_string<T, V>::convert_enum)(T) = nullptr;
template <>
struct fmt_class_string<const void*, void>
{
+284 -73
View File
@@ -1,7 +1,9 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Emu/Memory/vm.h"
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/SPUThread.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/lv2/sys_mmapper.h"
#include "Emu/Cell/lv2/sys_event.h"
@@ -28,7 +30,9 @@
#endif
#include <errno.h>
#include <signal.h>
#ifndef __OpenBSD__
#include <ucontext.h>
#endif
#include <pthread.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -801,7 +805,7 @@ register_t* freebsd_x64reg(x64_context *context, int reg)
long* openbsd_x64reg(x64_context *context, int reg)
{
auto *state = &context->uc_mcontext;
auto *state = &context;
switch(reg)
{
case 0: return &state->sc_rax;
@@ -1098,6 +1102,11 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
try
{
if (cpu)
{
vm::temporary_unlock(*cpu);
}
handled = rsx::g_access_violation_handler(addr, is_writing);
}
catch (const std::exception& e)
@@ -1106,7 +1115,6 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (cpu)
{
vm::temporary_unlock(*cpu);
cpu->state += cpu_flag::dbg_pause;
if (cpu->test_stopped())
@@ -1128,6 +1136,10 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
return true;
}
if (cpu && cpu->test_stopped())
{
}
}
auto code = (const u8*)RIP(context);
@@ -1148,7 +1160,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
}
};
if ((d_size | d_size + addr) >= 0x100000000ull)
if ((d_size | (d_size + addr)) >= 0x100000000ull)
{
LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size);
report_opcode();
@@ -1158,7 +1170,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
// get length of data being accessed
size_t a_size = get_x64_access_size(context, op, reg, d_size, i_size);
if ((a_size | a_size + addr) >= 0x100000000ull)
if ((a_size | (a_size + addr)) >= 0x100000000ull)
{
LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size);
report_opcode();
@@ -1261,7 +1273,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
return true;
}
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), vm::page_allocated | (is_writing ? vm::page_writable : vm::page_readable)))
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
{
if (cpu && cpu->test_stopped())
{
@@ -1273,64 +1285,175 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (cpu)
{
// TODO: Only PPU thread page fault notifications are supported
if (cpu->id_type() == 1 && fxm::check<page_fault_notification_entries>())
u32 pf_port_id = 0;
if (auto pf_entries = g_fxo->get<page_fault_notification_entries>(); true)
{
for (const auto& entry : fxm::get<page_fault_notification_entries>()->entries)
if (auto mem = vm::get(vm::any, addr))
{
auto mem = vm::get(vm::any, entry.start_addr);
if (!mem)
std::shared_lock lock(pf_entries->mutex);
for (const auto& entry : pf_entries->entries)
{
continue;
}
if (entry.start_addr <= addr && addr <= addr + mem->size - 1)
{
// Place the page fault event onto table so that other functions [sys_mmapper_free_address and ppu pagefault funcs]
// know that this thread is page faulted and where.
auto pf_entries = fxm::get_always<page_fault_event_entries>();
if (entry.start_addr == mem->addr)
{
std::lock_guard pf_lock(pf_entries->pf_mutex);
page_fault_event pf_event{ cpu->id, addr };
pf_entries->events.emplace_back(pf_event);
pf_port_id = entry.port_id;
break;
}
// Now, we notify the game that a page fault occurred so it can rectify it.
// Note, for data3, were the memory readable AND we got a page fault, it must be due to a write violation since reads are allowed.
u64 data1 = addr;
u64 data2 = ((u64)SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) + cpu->id;
u64 data3 = vm::check_addr(addr, a_size, vm::page_readable) ? SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY : SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED;
LOG_ERROR(MEMORY, "Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
addr, data3 == SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY ? "writing read-only" : "using unmapped");
error_code sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
// If we fail due to being busy, wait a bit and try again.
while (sending_error == CELL_EBUSY)
{
lv2_obj::sleep(*cpu, 1000);
thread_ctrl::wait_for(1000);
sending_error = sys_event_port_send(entry.port_id, data1, data2, data3);
}
if (sending_error)
{
fmt::throw_exception("Unknown error %x while trying to pass page fault.", sending_error.value);
}
lv2_obj::sleep(*cpu);
thread_ctrl::wait();
return true;
}
}
}
vm::temporary_unlock(*cpu);
if (pf_port_id)
{
// We notify the game that a page fault occurred so it can rectify it.
// Note, for data3, were the memory readable AND we got a page fault, it must be due to a write violation since reads are allowed.
u64 data1 = addr;
u64 data2;
if (cpu->id_type() == 1)
{
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) | cpu->id;
}
else if (static_cast<spu_thread*>(cpu)->group)
{
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_SPU_THREAD << 32) | cpu->id;
}
else
{
// Index is the correct ID in RawSPU
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_RAW_SPU << 32) | static_cast<spu_thread*>(cpu)->index;
}
u64 data3;
{
vm::reader_lock rlock;
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
{
// Memory was allocated inbetween, retry
return true;
}
else if (vm::check_addr(addr, std::max<std::size_t>(1, d_size)))
{
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY; // TODO
}
else
{
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_NON_MAPPED;
}
}
// Now, place the page fault event onto table so that other functions [sys_mmapper_free_address and pagefault recovery funcs etc]
// know that this thread is page faulted and where.
auto pf_events = g_fxo->get<page_fault_event_entries>();
{
std::lock_guard pf_lock(pf_events->pf_mutex);
pf_events->events.emplace(static_cast<u32>(data2), addr);
}
LOG_ERROR(MEMORY, "Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
addr, data3 == SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY ? "writing read-only" : "using unmapped");
error_code sending_error = sys_event_port_send(pf_port_id, data1, data2, data3);
// If we fail due to being busy, wait a bit and try again.
while (sending_error == CELL_EBUSY)
{
if (cpu->id_type() == 1)
{
lv2_obj::sleep(*cpu, 1000);
}
thread_ctrl::wait_for(1000);
sending_error = sys_event_port_send(pf_port_id, data1, data2, data3);
}
if (sending_error)
{
fmt::throw_exception("Unknown error %x while trying to pass page fault.", sending_error.value);
}
if (cpu->id_type() == 1)
{
// Deschedule
lv2_obj::sleep(*cpu);
}
// Wait until the thread is recovered
for (std::shared_lock pf_lock(pf_events->pf_mutex);
pf_events->events.find(static_cast<u32>(data2)) != pf_events->events.end();)
{
if (Emu.IsStopped())
{
break;
}
// Timeout in case the emulator is stopping
pf_events->cond.wait(pf_lock, 10000);
}
// Reschedule
if (cpu->test_stopped())
{
//
}
if (Emu.IsStopped())
{
// Hack: allocate memory in case the emulator is stopping
vm::falloc(addr & -0x10000, 0x10000);
}
return true;
}
if (cpu->id_type() != 1)
{
LOG_NOTICE(GENERAL, "\n%s", cpu->dump());
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
// TODO:
// RawSPU: Send appropriate interrupt
// SPUThread: Send sys_spu exception event
cpu->state += cpu_flag::dbg_pause;
if (cpu->check_state())
{
// Hack: allocate memory in case the emulator is stopping
auto area = vm::reserve_map(vm::any, addr & -0x10000, 0x10000);
if (area->flags & 0x100)
{
// For 4kb pages
utils::memory_protect(vm::base(addr & -0x1000), 0x1000, utils::protection::rw);
}
else
{
area->falloc(addr & -0x10000, 0x10000);
}
return true;
}
}
else
{
if (auto last_func = static_cast<ppu_thread*>(cpu)->current_function)
{
LOG_FATAL(PPU, "Function aborted: %s", last_func);
}
lv2_obj::sleep(*cpu);
}
}
Emu.Pause();
if (cpu)
{
LOG_NOTICE(GENERAL, "\n%s", cpu->dump());
}
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
Emu.Pause();
while (Emu.IsPaused())
{
@@ -1406,7 +1529,7 @@ static bool is_leaf_function(u64 rip)
static LONG exception_handler(PEXCEPTION_POINTERS pExp)
{
const u64 addr64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_base_addr;
const u64 exec64 = pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_exec_addr;
const u64 exec64 = (pExp->ExceptionRecord->ExceptionInformation[1] - (u64)vm::g_exec_addr) / 2;
const bool is_writing = pExp->ExceptionRecord->ExceptionInformation[0] != 0;
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && addr64 < 0x100000000ull)
@@ -1541,7 +1664,7 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
#endif
const u64 addr64 = (u64)info->si_addr - (u64)vm::g_base_addr;
const u64 exec64 = (u64)info->si_addr - (u64)vm::g_exec_addr;
const u64 exec64 = ((u64)info->si_addr - (u64)vm::g_exec_addr) / 2;
const auto cause = is_writing ? "writing" : "reading";
if (addr64 < 0x100000000ull)
@@ -1584,7 +1707,7 @@ const bool s_exception_handler_set = []() -> bool
#endif
// TODO
extern atomic_t<u32> g_thread_count(0);
atomic_t<u32> g_thread_count(0);
thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr;
@@ -1879,13 +2002,13 @@ void thread_ctrl::detect_cpu_layout()
}
}
u16 thread_ctrl::get_affinity_mask(thread_class group)
u64 thread_ctrl::get_affinity_mask(thread_class group)
{
detect_cpu_layout();
if (const auto thread_count = std::thread::hardware_concurrency())
{
const u16 all_cores_mask = thread_count < 16 ? (u16)(~(UINT16_MAX << thread_count)): UINT16_MAX;
const u64 all_cores_mask = thread_count < 64 ? UINT64_MAX >> (64 - thread_count): UINT64_MAX;
switch (g_native_core_layout)
{
@@ -1896,20 +2019,100 @@ u16 thread_ctrl::get_affinity_mask(thread_class group)
}
case native_core_arrangement::amd_ccx:
{
u16 spu_mask, ppu_mask, rsx_mask;
if (thread_count >= 16)
u64 spu_mask, ppu_mask, rsx_mask;
const auto system_id = utils::get_system_info();
if (thread_count >= 32)
{
// Threadripper, R7
// Assign threads 8-16
// It appears some windows code is bound to lower core addresses, binding 8-16 is alot faster than 0-7
ppu_mask = spu_mask = 0b1111111100000000;
rsx_mask = all_cores_mask;
if (system_id.find("3950X") != std::string::npos)
{
// zen2
// Ryzen 9 3950X
// Assign threads 9-32
ppu_mask = 0b11111111000000000000000000000000;
spu_mask = 0b00000000111111110000000000000000;
rsx_mask = 0b00000000000000001111111100000000;
}
else if (system_id.find("2970WX") != std::string::npos)
{
// zen+
// Threadripper 2970WX
// Assign threads 9-24
ppu_mask = 0b000000111111000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b111111000000000000000000;
}
else
{
// zen(+)
// Threadripper 1950X/2950X/2990WX
// Assign threads 17-32
ppu_mask = 0b00000000111111110000000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b11111111000000000000000000000000;
}
}
else if (thread_count == 24)
{
if (system_id.find("3900X") != std::string::npos)
{
// zen2
// Ryzen 9 3900X
// Assign threads 7-22
ppu_mask = 0b111111000000000000000000;
spu_mask = 0b000000111111000000000000;
rsx_mask = 0b000000000000111111000000;
}
else
{
// zen(+)
// Threadripper 1920X/2920X
// Assign threads 13-24
ppu_mask = 0b000000111111000000000000;
spu_mask = ppu_mask;
rsx_mask = 0b111111000000000000000000;
}
}
else if (thread_count == 16)
{
if (system_id.find("3700X") != std::string::npos || system_id.find("3800X") != std::string::npos)
{
// Ryzen 7 3700/3800 (x)
// Assign threads 1-16
ppu_mask = 0b0000000011110000;
spu_mask = 0b1111111100000000;
rsx_mask = 0b0000000000001111;
}
else
{
// zen(+)
// Ryzen 7, Threadripper
// Assign threads 3-16
ppu_mask = 0b1111111100000000;
spu_mask = ppu_mask;
rsx_mask = 0b0000000000111100;
}
}
else if (thread_count == 12)
{
// 1600/2600 (x)
ppu_mask = spu_mask = 0b111111000000;
rsx_mask = all_cores_mask;
if (system_id.find("3600") != std::string::npos)
{
// zen2
// R5 3600 (x)
// Assign threads 1-12
ppu_mask = 0b000000111000;
spu_mask = 0b111111000000;
rsx_mask = 0b000000000111;
}
else
{
// zen(+)
// R5 1600/2600 (x)
// Assign threads 3-12
ppu_mask = 0b111111000000;
spu_mask = ppu_mask;
rsx_mask = 0b000000111100;
}
}
else
{
@@ -1954,7 +2157,7 @@ u16 thread_ctrl::get_affinity_mask(thread_class group)
}
}
return UINT16_MAX;
return UINT64_MAX;
}
void thread_ctrl::set_native_priority(int priority)
@@ -1990,25 +2193,33 @@ void thread_ctrl::set_native_priority(int priority)
#endif
}
void thread_ctrl::set_thread_affinity_mask(u16 mask)
void thread_ctrl::set_thread_affinity_mask(u64 mask)
{
#ifdef _WIN32
HANDLE _this_thread = GetCurrentThread();
SetThreadAffinityMask(_this_thread, (DWORD_PTR)mask);
SetThreadAffinityMask(_this_thread, mask);
#elif __APPLE__
thread_affinity_policy_data_t policy = { static_cast<integer_t>(mask) };
// Supports only one core
thread_affinity_policy_data_t policy = { static_cast<integer_t>(utils::cnttz64(mask)) };
thread_port_t mach_thread = pthread_mach_thread_np(pthread_self());
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1);
#elif defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)
cpu_set_t cs;
CPU_ZERO(&cs);
for (u32 core = 0; core < 16u; ++core)
for (u32 core = 0; core < 64u; ++core)
{
if ((u32)mask & (1u << core))
const u64 shifted = mask >> core;
if (shifted & 1)
{
CPU_SET(core, &cs);
}
if (shifted <= 1)
{
break;
}
}
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs);
+3 -3
View File
@@ -1,7 +1,7 @@
#pragma once
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
#include <string>
#include <memory>
@@ -258,13 +258,13 @@ public:
static void detect_cpu_layout();
// Returns a core affinity mask. Set whether to generate the high priority set or not
static u16 get_affinity_mask(thread_class group);
static u64 get_affinity_mask(thread_class group);
// Sets the native thread priority
static void set_native_priority(int priority);
// Sets the preferred affinity mask for this thread
static void set_thread_affinity_mask(u16 mask);
static void set_thread_affinity_mask(u64 mask);
// Spawn a detached named thread
template <typename F>
+2
View File
@@ -1,5 +1,7 @@
#pragma once
#include "types.h"
#include <chrono>
class Timer
+2
View File
@@ -1,5 +1,7 @@
#pragma once
#include "types.h"
namespace utils
{
// Memory protection type
+10 -8
View File
@@ -1,4 +1,6 @@
#include "types.h"
#pragma once
#include "types.h"
#include "StrFmt.h"
#include <vector>
@@ -58,12 +60,12 @@ namespace utils
return (start1 >= start2 && end1 <= end2);
}
address_range(u32 _start, u32 _end) : start(_start), end(_end) {};
address_range(u32 _start, u32 _end) : start(_start), end(_end) {}
public:
// Constructors
address_range() = default;
address_range(const address_range &other) : start(other.start), end(other.end) {};
address_range(const address_range &other) : start(other.start), end(other.end) {}
static inline address_range start_length(u32 _start, u32 _length)
{
@@ -376,7 +378,7 @@ namespace utils
// We use index access because we might have to push_back within the loop, which could invalidate the iterators
size_type _size = data.size();
for (int n = 0; n < _size; ++n)
for (size_type n = 0; n < _size; ++n)
{
address_range &existing = data[n];
@@ -453,7 +455,7 @@ namespace utils
{
size_t _size = data.size();
for (int i = 0; i < _size; ++i)
for (size_t i = 0; i < _size; ++i)
{
const auto &r1 = data[i];
if (!r1.valid())
@@ -461,7 +463,7 @@ namespace utils
continue;
}
for (int j = i + 1; j < _size; ++j)
for (size_t j = i + 1; j < _size; ++j)
{
const auto &r2 = data[j];
if (!r2.valid())
@@ -572,7 +574,7 @@ namespace utils
return vec.overlaps(*this);
}
}; // namespace utils
} // namespace utils
namespace std {
@@ -587,4 +589,4 @@ namespace std {
return (size_t{ k.start } << 32) | size_t{ k.end };
}
};
};
}
+60 -17
View File
@@ -9,6 +9,8 @@ namespace utils
#ifdef _MSC_VER
ulong res;
return _BitScanReverse(&res, arg) || nonzero ? res ^ 31 : 32;
#elif __LZCNT__
return _lzcnt_u32(arg);
#else
return arg || nonzero ? __builtin_clz(arg) : 32;
#endif
@@ -19,6 +21,8 @@ namespace utils
#ifdef _MSC_VER
ulong res;
return _BitScanReverse64(&res, arg) || nonzero ? res ^ 63 : 64;
#elif __LZCNT__
return _lzcnt_u64(arg);
#else
return arg || nonzero ? __builtin_clzll(arg) : 64;
#endif
@@ -29,6 +33,8 @@ namespace utils
#ifdef _MSC_VER
ulong res;
return _BitScanForward(&res, arg) || nonzero ? res : 32;
#elif __BMI__
return _tzcnt_u32(arg);
#else
return arg || nonzero ? __builtin_ctz(arg) : 32;
#endif
@@ -39,23 +45,28 @@ namespace utils
#ifdef _MSC_VER
ulong res;
return _BitScanForward64(&res, arg) || nonzero ? res : 64;
#elif __BMI__
return _tzcnt_u64(arg);
#else
return arg || nonzero ? __builtin_ctzll(arg) : 64;
#endif
}
inline u8 popcnt16(u16 arg)
inline u8 popcnt32(u32 arg)
{
const u32 a1 = arg & 0x5555;
const u32 a2 = (arg >> 1) & 0x5555;
#ifdef _MSC_VER
const u32 a1 = arg & 0x55555555;
const u32 a2 = (arg >> 1) & 0x55555555;
const u32 a3 = a1 + a2;
const u32 b1 = a3 & 0x3333;
const u32 b2 = (a3 >> 2) & 0x3333;
const u32 b1 = a3 & 0x33333333;
const u32 b2 = (a3 >> 2) & 0x33333333;
const u32 b3 = b1 + b2;
const u32 c1 = b3 & 0x0f0f;
const u32 c2 = (b3 >> 4) & 0x0f0f;
const u32 c3 = c1 + c2;
return static_cast<u8>(c3 + (c3 >> 8));
const u32 c3 = (b3 + (b3 >> 4)) & 0x0f0f0f0f;
const u32 d3 = c3 + (c3 >> 8);
return static_cast<u8>(d3 + (d3 >> 16));
#else
return __builtin_popcount(arg);
#endif
}
// Rotate helpers
@@ -63,72 +74,104 @@ namespace utils
inline u8 rol8(u8 x, u8 n)
{
#if __has_builtin(__builtin_rotateleft8)
return __builtin_rotateleft8(x, n);
#else
u8 result = x;
__asm__("rolb %[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u8 ror8(u8 x, u8 n)
{
#if __has_builtin(__builtin_rotateright8)
return __builtin_rotateright8(x, n);
#else
u8 result = x;
__asm__("rorb %[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u16 rol16(u16 x, u16 n)
{
#if __has_builtin(__builtin_rotateleft16)
return __builtin_rotateleft16(x, n);
#else
u16 result = x;
__asm__("rolw %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u16 ror16(u16 x, u16 n)
{
#if __has_builtin(__builtin_rotateright16)
return __builtin_rotateright16(x, n);
#else
u16 result = x;
__asm__("rorw %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u32 rol32(u32 x, u32 n)
{
#if __has_builtin(__builtin_rotateleft32)
return __builtin_rotateleft32(x, n);
#else
u32 result = x;
__asm__("roll %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u32 ror32(u32 x, u32 n)
{
#if __has_builtin(__builtin_rotateright32)
return __builtin_rotateright32(x, n);
#else
u32 result = x;
__asm__("rorl %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u64 rol64(u64 x, u64 n)
{
#if __has_builtin(__builtin_rotateleft64)
return __builtin_rotateleft64(x, n);
#else
u64 result = x;
__asm__("rolq %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u64 ror64(u64 x, u64 n)
{
#if __has_builtin(__builtin_rotateright64)
return __builtin_rotateright64(x, n);
#else
u64 result = x;
__asm__("rorq %b[n], %[result]" : [result] "+g"(result) : [n] "c"(n));
return result;
#endif
}
inline u64 umulh64(u64 a, u64 b)
constexpr u64 umulh64(u64 a, u64 b)
{
u64 result;
__asm__("mulq %[b]" : "=d"(result) : [a] "a"(a), [b] "rm"(b));
return result;
const __uint128_t x = a;
const __uint128_t y = b;
return (x * y) >> 64;
}
inline s64 mulh64(s64 a, s64 b)
constexpr s64 mulh64(s64 a, s64 b)
{
s64 result;
__asm__("imulq %[b]" : "=d"(result) : [a] "a"(a), [b] "rm"(b));
return result;
const __int128_t x = a;
const __int128_t y = b;
return (x * y) >> 64;
}
#elif defined(_MSC_VER)
+2 -2
View File
@@ -86,13 +86,13 @@ void patch_engine::append(const std::string& patch)
case patch_type::bef32:
case patch_type::lef32:
{
info.value_as<f32>() = patch[2].as<f32>();
info.value = std::bit_cast<u32>(patch[2].as<f32>());
break;
}
case patch_type::bef64:
case patch_type::lef64:
{
info.value_as<f64>() = patch[2].as<f64>();
info.value = std::bit_cast<u64>(patch[2].as<f64>());
break;
}
default:
-6
View File
@@ -28,12 +28,6 @@ class patch_engine
patch_type type;
u32 offset;
u64 value;
template <typename T>
T& value_as()
{
return *reinterpret_cast<T*>(reinterpret_cast<char*>(&value));
}
};
// Database
+1 -1
View File
@@ -22,7 +22,7 @@ Intersection (&) and symmetric difference (^) is also available.
*/
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
template <typename T>
class atomic_bs_t;
+17 -12
View File
@@ -7,6 +7,8 @@
#include <vector>
#include <algorithm>
static const size_t size_dropped = std::numeric_limits<size_t>::max();
/*
C-style format parser. Appends formatted string to `out`, returns number of characters written.
`out`: mutable reference to std::string, std::vector<char> or other compatible container
@@ -41,7 +43,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
const auto drop_sequence = [&]
{
out.insert(out.end(), fmt - ctx.size, fmt);
ctx.size = -1;
ctx.size = size_dropped;
};
const auto read_decimal = [&](uint result) -> uint
@@ -112,7 +114,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
ctx = {0};
out.push_back(ch);
}
else if (ctx.size == -1)
else if (ctx.size == size_dropped)
{
out.push_back(ch);
}
@@ -410,9 +412,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? 0xff :
ctx.type == 2 ? 0xffff :
ctx.type == 4 ? 0xffff'ffffu :
0xffff'ffff'ffff'ffffu;
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;
@@ -466,9 +469,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? 0xff :
ctx.type == 2 ? 0xffff :
ctx.type == 4 ? 0xffff'ffffu :
0xffff'ffff'ffff'ffffu;
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;
@@ -529,9 +533,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? 0xff :
ctx.type == 2 ? 0xffff :
ctx.type == 4 ? 0xffff'ffffu :
0xffff'ffff'ffff'ffffu;
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;
@@ -626,7 +631,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
// Handle unfinished sequence
if (ctx.size && ctx.size != -1)
if (ctx.size && ctx.size != size_dropped)
{
fmt--, drop_sequence();
}
+208 -26
View File
@@ -148,7 +148,7 @@ bool notifier::wait(u64 usec_timeout)
return res;
}
bool cond_one::imp_wait(u64 _timeout) noexcept
bool unique_cond::imp_wait(u64 _timeout) noexcept
{
// State transition: c_sig -> c_lock \ c_lock -> c_wait
const u32 _old = m_value.fetch_sub(1);
@@ -173,7 +173,7 @@ bool cond_one::imp_wait(u64 _timeout) noexcept
});
}
void cond_one::imp_notify() noexcept
void unique_cond::imp_notify() noexcept
{
auto [old, ok] = m_value.fetch_op([](u32& v)
{
@@ -196,46 +196,51 @@ void cond_one::imp_notify() noexcept
balanced_awaken(m_value, 1);
}
bool cond_x16::imp_wait(u32 slot, u64 _timeout) noexcept
bool shared_cond::imp_wait(u32 slot, u64 _timeout) noexcept
{
const u32 wait_bit = c_wait << slot;
const u32 lock_bit = c_lock << slot;
if (slot >= 32)
{
// Invalid argument, assume notified
return true;
}
const u64 wait_bit = c_wait << slot;
const u64 lock_bit = c_lock << slot;
// Change state from c_lock to c_wait
const u32 old_ = m_cvx16.fetch_op([=](u32& cvx16)
const u64 old_ = m_cvx32.fetch_op([=](u64& cvx32)
{
if (cvx16 & wait_bit)
if (cvx32 & wait_bit)
{
// c_sig -> c_lock
cvx16 &= ~wait_bit;
// c_lock -> c_wait
cvx32 &= ~(lock_bit & ~wait_bit);
}
else
{
cvx16 |= wait_bit;
cvx16 &= ~lock_bit;
// c_sig -> c_lock
cvx32 |= lock_bit;
}
});
if (old_ & wait_bit)
if ((old_ & wait_bit) == 0)
{
// Already signaled, return without waiting
return true;
}
return balanced_wait_until(m_cvx16, _timeout, [&](u32& cvx16, auto... ret) -> int
return balanced_wait_until(m_cvx32, _timeout, [&](u64& cvx32, auto... ret) -> int
{
if (cvx16 & lock_bit)
if ((cvx32 & wait_bit) == 0)
{
// c_sig -> c_lock
cvx16 &= ~wait_bit;
cvx32 |= lock_bit;
return +1;
}
if constexpr (sizeof...(ret))
{
// Retire
cvx16 |= lock_bit;
cvx16 &= ~wait_bit;
cvx32 |= lock_bit;
return -1;
}
@@ -243,16 +248,14 @@ bool cond_x16::imp_wait(u32 slot, u64 _timeout) noexcept
});
}
void cond_x16::imp_notify() noexcept
void shared_cond::imp_notify() noexcept
{
auto [old, ok] = m_cvx16.fetch_op([](u32& v)
auto [old, ok] = m_cvx32.fetch_op([](u64& cvx32)
{
const u32 lock_mask = v >> 16;
const u32 wait_mask = v & 0xffff;
if (const u32 sig_mask = lock_mask ^ wait_mask)
if (const u64 sig_mask = cvx32 & 0xffffffff)
{
v |= sig_mask | sig_mask << 16;
cvx32 &= 0xffffffffull << 32;
cvx32 |= sig_mask << 32;
return true;
}
@@ -260,18 +263,197 @@ void cond_x16::imp_notify() noexcept
});
// Determine if some waiters need a syscall notification
const u32 wait_mask = old & (~old >> 16);
const u64 wait_mask = old & (~old >> 32);
if (UNLIKELY(!ok || !wait_mask))
{
return;
}
balanced_awaken<true>(m_cvx16, utils::popcnt16(wait_mask));
balanced_awaken<true>(m_cvx32, utils::popcnt32(wait_mask));
}
void shared_cond::wait_all() noexcept
{
// Try to acquire waiting state without locking but only if there are other locks
const auto [old_, result] = m_cvx32.fetch_op([](u64& cvx32) -> u64
{
// Check waiting alone
if ((cvx32 & 0xffffffff) == 0)
{
return 0;
}
// Combine used bits and invert to find least significant bit unused
const u32 slot = utils::cnttz64(~((cvx32 & 0xffffffff) | (cvx32 >> 32)), true);
// Set waiting bit (does nothing if all slots are used)
cvx32 |= (1ull << slot) & 0xffffffff;
return 1ull << slot;
});
if (!result)
{
return;
}
if (result > 0xffffffffu)
{
// All slots are used, fallback to spin wait
while (m_cvx32 & 0xffffffff)
{
busy_wait();
}
return;
}
const u64 wait_bit = result;
const u64 lock_bit = wait_bit | (wait_bit << 32);
balanced_wait_until(m_cvx32, -1, [&](u64& cvx32, auto... ret) -> int
{
if ((cvx32 & wait_bit) == 0)
{
// Remove signal and unlock at once
cvx32 &= ~lock_bit;
return +1;
}
if constexpr (sizeof...(ret))
{
cvx32 &= ~lock_bit;
return -1;
}
return 0;
});
}
bool shared_cond::wait_all(shared_cond::shared_lock& lock) noexcept
{
AUDIT(lock.m_this == this);
if (lock.m_slot >= 32)
{
// Invalid argument, assume notified
return true;
}
const u64 wait_bit = c_wait << lock.m_slot;
const u64 lock_bit = c_lock << lock.m_slot;
// Try to acquire waiting state only if there are other locks
const auto [old_, not_alone] = m_cvx32.fetch_op([&](u64& cvx32)
{
// Check locking alone
if (((cvx32 >> 32) & cvx32) == (lock_bit >> 32))
{
return false;
}
// c_lock -> c_wait, c_sig -> unlock
cvx32 &= ~(lock_bit & ~wait_bit);
return true;
});
if (!not_alone)
{
return false;
}
else
{
// Set invalid slot to acknowledge unlocking
lock.m_slot = 33;
}
if ((old_ & wait_bit) == 0)
{
// Already signaled, return without waiting
return true;
}
balanced_wait_until(m_cvx32, -1, [&](u64& cvx32, auto... ret) -> int
{
if ((cvx32 & wait_bit) == 0)
{
// Remove signal and unlock at once
cvx32 &= ~lock_bit;
return +1;
}
if constexpr (sizeof...(ret))
{
cvx32 &= ~lock_bit;
return -1;
}
return 0;
});
return true;
}
bool shared_cond::notify_all(shared_cond::shared_lock& lock) noexcept
{
AUDIT(lock.m_this == this);
if (lock.m_slot >= 32)
{
// Invalid argument
return false;
}
const u64 slot_mask = c_sig << lock.m_slot;
auto [old, ok] = m_cvx32.fetch_op([&](u64& cvx32)
{
if (((cvx32 << 32) & cvx32) != slot_mask)
{
return false;
}
if (const u64 sig_mask = cvx32 & 0xffffffff)
{
cvx32 &= (0xffffffffull << 32) & ~slot_mask;
cvx32 |= (sig_mask << 32) & ~slot_mask;
return true;
}
return false;
});
if (!ok)
{
// Not an exclusive reader
return false;
}
// Set invalid slot to acknowledge unlocking
lock.m_slot = 34;
// Determine if some waiters need a syscall notification
const u64 wait_mask = old & (~old >> 32);
if (UNLIKELY(!wait_mask))
{
return true;
}
balanced_awaken<true>(m_cvx32, utils::popcnt32(wait_mask));
return true;
}
bool lf_queue_base::wait(u64 _timeout)
{
auto _old = m_head.compare_and_swap(0, 1);
if (_old)
{
verify("lf_queue concurrent wait" HERE), _old != 1;
return true;
}
return balanced_wait_until(m_head, _timeout, [](std::uintptr_t& head, auto... ret) -> int
{
if (head != 1)
+60 -41
View File
@@ -1,7 +1,7 @@
#pragma once
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
#include <shared_mutex>
#include "asm.h"
@@ -64,7 +64,7 @@ public:
static constexpr u64 max_timeout = u64{UINT32_MAX} / 1000 * 1000000;
};
// Pair of a fake shared mutex (only limited shared locking) and a condition variable
// Pair of a fake shared mutex (only limited shared locking) and a condition variable. Obsolete.
class notifier
{
atomic_t<u32> m_counter{0};
@@ -129,7 +129,8 @@ public:
static constexpr u32 max_readers = 0x7f;
};
class cond_one
// Condition variable fused with a pseudo-mutex which is never supposed to be locked concurrently.
class unique_cond
{
enum : u32
{
@@ -144,7 +145,7 @@ class cond_one
void imp_notify() noexcept;
public:
constexpr cond_one() = default;
constexpr unique_cond() = default;
void lock() noexcept
{
@@ -158,7 +159,7 @@ public:
m_value = 0;
}
bool wait(std::unique_lock<cond_one>& lock, u64 usec_timeout = -1) noexcept
bool wait(std::unique_lock<unique_cond>& lock, u64 usec_timeout = -1) noexcept
{
AUDIT(lock.owns_lock());
AUDIT(lock.mutex() == this);
@@ -175,61 +176,67 @@ public:
}
};
// Packed version of cond_one, supports up to 16 readers.
class cond_x16
// Condition variable fused with a pseudo-mutex supporting only reader locks (up to 32 readers).
class shared_cond
{
// For information, shouldn't modify
enum : u32
enum : u64
{
// Wait bit is aligned for compatibility with 32-bit futex.
c_wait = 1,
c_lock = 1 << 16,
c_sig = 1 << 16 | 1,
c_sig = 1ull << 32,
c_lock = 1ull << 32 | 1,
};
// Split in 16-bit parts for convenient bit combining
atomic_t<u32> m_cvx16{0};
// Split in 32-bit parts for convenient bit combining
atomic_t<u64> m_cvx32{0};
// Effectively unused, only counts readers
atomic_t<u32> m_total{0};
class lock_x16
class shared_lock
{
cond_x16* m_this;
shared_cond* m_this;
u32 m_slot;
friend class cond_x16;
friend class shared_cond;
public:
lock_x16(cond_x16* _this) noexcept
shared_lock(shared_cond* _this) noexcept
: m_this(_this)
{
// Spin if the number of readers exceeds 16
while (UNLIKELY(m_this->m_total++ >= 16))
m_this->m_total--;
// Lock and remember obtained slot index
m_slot = m_this->m_cvx16.atomic_op([](u32& cvx16)
m_slot = m_this->m_cvx32.atomic_op([](u64& cvx32)
{
// Combine used bits and invert to find least significant bit unused
const u32 slot = utils::cnttz32(~((cvx16 & 0xffff) | (cvx16 >> 16)), true);
const u32 slot = static_cast<u32>(utils::cnttz64(~((cvx32 & 0xffffffff) | (cvx32 >> 32)), true));
// Set lock bit
cvx16 |= c_lock << slot;
AUDIT(slot < 16);
// Set lock bits (does nothing if all slots are used)
const u64 bit = (1ull << slot) & 0xffffffff;
cvx32 |= bit | (bit << 32);
return slot;
});
}
lock_x16(const lock_x16&) = delete;
shared_lock(const shared_lock&) = delete;
lock_x16& operator=(const lock_x16&) = delete;
~lock_x16()
shared_lock(shared_lock&& rhs)
: m_this(rhs.m_this)
, m_slot(rhs.m_slot)
{
// Clear the slot
m_this->m_cvx16 &= ~((c_wait | c_lock) << m_slot);
m_this->m_total -= 1;
rhs.m_slot = 32;
}
shared_lock& operator=(const shared_lock&) = delete;
~shared_lock()
{
// Clear the slot (does nothing if all slots are used)
const u64 bit = (1ull << m_slot) & 0xffffffff;
m_this->m_cvx32 &= ~(bit | (bit << 32));
}
explicit operator bool() const noexcept
{
// Check success
return m_slot < 32;
}
bool wait(u64 usec_timeout = -1) const noexcept
@@ -242,24 +249,36 @@ class cond_x16
void imp_notify() noexcept;
public:
constexpr cond_x16() = default;
constexpr shared_cond() = default;
lock_x16 lock_one() noexcept
shared_lock try_shared_lock() noexcept
{
return lock_x16(this);
return shared_lock(this);
}
bool wait(lock_x16 const& lock, u64 usec_timeout = -1) noexcept
u32 count() const noexcept
{
const u64 cvx32 = m_cvx32;
return utils::popcnt32(static_cast<u32>(cvx32 | (cvx32 >> 32)));
}
bool wait(shared_lock const& lock, u64 usec_timeout = -1) noexcept
{
AUDIT(lock.m_this == this);
return imp_wait(lock.m_slot, usec_timeout);
}
void wait_all() noexcept;
bool wait_all(shared_lock& lock) noexcept;
void notify_all() noexcept
{
if (LIKELY(!m_cvx16))
if (LIKELY(!m_cvx32))
return;
imp_notify();
}
bool notify_all(shared_lock& lock) noexcept;
};
+13 -1
View File
@@ -1,5 +1,8 @@
#pragma once
#include <ctime>
#include <string>
namespace date_time
{
static inline tm get_time(time_t* _time)
@@ -22,11 +25,20 @@ namespace date_time
return str;
}
template<char separator = 0>
static inline std::string current_time_narrow()
{
char str[80];
tm now = get_time(0);
strftime(str, sizeof(str), "%Y%m%d%H%M%S", &now);
std::string parse_buf;
if constexpr(separator != 0)
parse_buf = std::string("%Y") + separator + "%m" + separator + "%d" + separator + "%H" + separator + "%M" + separator + "%S";
else
parse_buf = "%Y%m%d%H%M%S";
strftime(str, sizeof(str), parse_buf.c_str(), &now);
return str;
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "dynamic_library.h"
#ifdef _WIN32
@@ -50,7 +50,7 @@ namespace utils
bool dynamic_library::loaded() const
{
return !m_handle;
return m_handle != nullptr;
}
dynamic_library::operator bool() const
+1 -1
View File
@@ -4,7 +4,7 @@
#include <deque>
#include <list>
#include "Atomic.h"
#include "util/atomic.hpp"
template <typename T, T Mod = T::__state_enum_max, typename Under = std::underlying_type_t<T>>
T operator ++(T& value, int)
+21 -6
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <cmath>
@@ -673,6 +673,16 @@ struct area_base
return{ x1, y1, x2 - x1, y2 - y1 };
}
constexpr T width() const
{
return (x1 < x2) ? (x2 - x1) : (x1 - x2);
}
constexpr T height() const
{
return (y1 < y2) ? (y2 - y1) : (y1 - y2);
}
void flip_vertical()
{
T _y = y1; y1 = y2; y2 = _y;
@@ -693,6 +703,11 @@ struct area_base
return{ x2, y1, x1, y2 };
}
constexpr bool is_flipped() const
{
return (x1 > x2 || y1 > y2);
}
constexpr bool operator == (const area_base& rhs) const
{
return x1 == rhs.x1 && x2 == rhs.x2 && y1 == rhs.y1 && y2 == rhs.y2;
@@ -826,7 +841,7 @@ struct color4_base
T xyzw[4];
};
color4_base()
constexpr color4_base()
: x{}
, y{}
, z{}
@@ -834,7 +849,7 @@ struct color4_base
{
}
color4_base(T x, T y = {}, T z = {}, T w = {})
constexpr color4_base(T x, T y = {}, T z = {}, T w = {})
: x(x)
, y(y)
, z(z)
@@ -842,18 +857,18 @@ struct color4_base
{
}
bool operator == (const color4_base& rhs) const
constexpr bool operator == (const color4_base& rhs) const
{
return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a;
}
bool operator != (const color4_base& rhs) const
constexpr bool operator != (const color4_base& rhs) const
{
return !(*this == rhs);
}
template<typename NT>
operator color4_base<NT>() const
constexpr operator color4_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z, (NT)w };
}
+6 -6
View File
@@ -1,5 +1,6 @@
#pragma once
#include <stdint.h>
#include "Utilities/types.h"
namespace rpcs3
{
@@ -28,24 +29,23 @@ namespace rpcs3
template<typename T>
static size_t hash_struct(const T& value)
{
// TODO: use c++17 if constexpr
static constexpr auto block_sz = sizeof(T);
if ((block_sz & 0x7) == 0)
if constexpr ((block_sz & 0x7) == 0)
{
return hash_struct_base<T, u64>(value);
}
if ((block_sz & 0x3) == 0)
if constexpr ((block_sz & 0x3) == 0)
{
return hash_struct_base<T, u32>(value);
}
if ((block_sz & 0x1) == 0)
if constexpr ((block_sz & 0x1) == 0)
{
return hash_struct_base<T, u16>(value);
}
return hash_struct_base<T, u8>(value);
}
}
}
+7 -21
View File
@@ -1,7 +1,7 @@
#pragma once
#pragma once
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
//! Simple sizeless array base for concurrent access. Cannot shrink, only growths automatically.
//! There is no way to know the current size. The smaller index is, the faster it's accessed.
@@ -68,13 +68,13 @@ public:
// Get current "push" position
u32 size() const
{
return reinterpret_cast<const atomic_t<u32>&>(m_ctrl).load(); // Hack
return m_ctrl.load().push;
}
// Acquire the place for one or more elements.
u32 push_begin(u32 count = 1)
{
return reinterpret_cast<atomic_t<u32>&>(m_ctrl).fetch_add(count); // Hack
return std::bit_cast<atomic_t<u64>*>(&m_ctrl)->fetch_add(count); // Hack
}
// Get current "pop" position
@@ -358,7 +358,7 @@ public:
~lf_queue()
{
delete reinterpret_cast<T*>(m_head.load());
delete reinterpret_cast<lf_queue_item<T>*>(m_head.load());
}
template <typename... Args>
@@ -388,27 +388,13 @@ public:
// Apply func(data) to each element, return the total length
template <typename F>
std::size_t apply(F&& func)
std::size_t apply(F func)
{
std::size_t count = 0;
for (auto slice = pop_all(); slice; slice.pop_front())
{
std::invoke(std::forward<F>(func), *slice);
}
return count;
}
// apply() overload for callable template argument
template <auto F>
std::size_t apply()
{
std::size_t count = 0;
for (auto slice = pop_all(); slice; slice.pop_front())
{
std::invoke(F, *slice);
std::invoke(func, *slice);
}
return count;
+109 -11
View File
@@ -1,7 +1,4 @@
#include "mutex.h"
#include "sync.h"
#include <climits>
void shared_mutex::imp_lock_shared(u32 val)
{
@@ -42,26 +39,112 @@ void shared_mutex::imp_unlock_shared(u32 old)
}
}
void shared_mutex::imp_lock_low(u32 val)
{
verify("shared_mutex underflow" HERE), val < c_err;
for (int i = 0; i < 10; i++)
{
busy_wait();
if (try_lock_low())
{
return;
}
}
// Acquire writer lock and downgrade
const u32 old = m_value.fetch_add(c_one);
if (old == 0)
{
lock_downgrade();
return;
}
verify("shared_mutex overflow" HERE), (old % c_sig) + c_one < c_sig;
imp_wait();
lock_downgrade();
}
void shared_mutex::imp_unlock_low(u32 old)
{
verify("shared_mutex underflow" HERE), old - 1 < c_err;
// Check reader count, notify the writer if necessary
if ((old - 1) % c_vip == 0)
{
imp_signal();
}
}
void shared_mutex::imp_lock_vip(u32 val)
{
verify("shared_mutex underflow" HERE), val < c_err;
for (int i = 0; i < 10; i++)
{
busy_wait();
if (try_lock_vip())
{
return;
}
}
// Acquire writer lock and downgrade
const u32 old = m_value.fetch_add(c_one);
if (old == 0)
{
lock_downgrade_to_vip();
return;
}
verify("shared_mutex overflow" HERE), (old % c_sig) + c_one < c_sig;
imp_wait();
lock_downgrade_to_vip();
}
void shared_mutex::imp_unlock_vip(u32 old)
{
verify("shared_mutex underflow" HERE), old - 1 < c_err;
// Check reader count, notify the writer if necessary
if ((old - 1) % c_one / c_vip == 0)
{
imp_signal();
}
}
void shared_mutex::imp_wait()
{
while (!balanced_wait_until(m_value, -1, [&](u32& value, auto...)
while (true)
{
if (value >= c_sig)
const auto [old, ok] = m_value.fetch_op([](u32& value)
{
value -= c_sig;
return true;
if (value >= c_sig)
{
value -= c_sig;
return true;
}
return false;
});
if (ok)
{
break;
}
return false;
}))
{
m_value.wait(old);
}
}
void shared_mutex::imp_signal()
{
m_value += c_sig;
balanced_awaken(m_value, 1);
m_value.notify_one();
}
void shared_mutex::imp_lock(u32 val)
@@ -158,3 +241,18 @@ void shared_mutex::imp_lock_unlock()
imp_wait();
unlock();
}
bool shared_mutex::downgrade_unique_vip_lock_to_low_or_unlock()
{
return m_value.atomic_op([](u32& value)
{
if (value % c_one / c_vip == 1)
{
value -= c_vip - 1;
return true;
}
value -= c_vip;
return false;
});
}
+119 -3
View File
@@ -2,7 +2,7 @@
#include <mutex>
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
// Shared mutex with small size (u32).
class shared_mutex final
@@ -12,12 +12,17 @@ class shared_mutex final
c_one = 1u << 14, // Fixed-point 1.0 value (one writer, max_readers = c_one - 1)
c_sig = 1u << 30,
c_err = 1u << 31,
c_vip = 1u << 7,
};
atomic_t<u32> m_value{};
void imp_lock_shared(u32 val);
void imp_unlock_shared(u32 old);
void imp_lock_low(u32 val);
void imp_unlock_low(u32 old);
void imp_lock_vip(u32 val);
void imp_unlock_vip(u32 old);
void imp_wait();
void imp_signal();
void imp_lock(u32 val);
@@ -83,6 +88,64 @@ public:
}
}
bool try_lock_low()
{
const u32 value = m_value.load();
// Conditional increment
return value < c_vip - 1 && m_value.compare_and_swap_test(value, value + 1);
}
void lock_low()
{
const u32 value = m_value.load();
if (UNLIKELY(value >= c_vip - 1 || !m_value.compare_and_swap_test(value, value + 1)))
{
imp_lock_low(value);
}
}
void unlock_low()
{
// Unconditional decrement (can result in broken state)
const u32 value = m_value.fetch_sub(1);
if (UNLIKELY(value >= c_one))
{
imp_unlock_low(value);
}
}
bool try_lock_vip()
{
const u32 value = m_value.load();
// Conditional increment
return value < c_one - 1 && (value % c_vip) == 0 && m_value.compare_and_swap_test(value, value + c_vip);
}
void lock_vip()
{
const u32 value = m_value.load();
if (UNLIKELY(value >= c_one - 1 || (value % c_vip) || !m_value.compare_and_swap_test(value, value + c_vip)))
{
imp_lock_vip(value);
}
}
void unlock_vip()
{
// Unconditional decrement (can result in broken state)
const u32 value = m_value.fetch_sub(c_vip);
if (UNLIKELY(value >= c_one))
{
imp_unlock_vip(value);
}
}
bool try_lock()
{
return m_value.compare_and_swap_test(0, c_one);
@@ -121,7 +184,7 @@ public:
void unlock_hle()
{
const u32 value = atomic_storage<u32>::fetch_add_hle_rel(m_value.raw(), -c_one);
const u32 value = atomic_storage<u32>::fetch_add_hle_rel(m_value.raw(), 0u - c_one);
if (UNLIKELY(value != c_one))
{
@@ -151,6 +214,12 @@ public:
m_value -= c_one - 1;
}
void lock_downgrade_to_vip()
{
// Convert to vip lock (can result in broken state)
m_value -= c_one - c_vip;
}
// Optimized wait for lockability without locking, relaxed
void lock_unlock()
{
@@ -171,9 +240,12 @@ public:
{
return m_value.load() < c_one - 1;
}
// Special purpose logic
bool downgrade_unique_vip_lock_to_low_or_unlock();
};
// Simplified shared (reader) lock implementation.
// Simplified shared (reader) lock implementation. Mutually incompatible with low_lock and vip_lock.
class reader_lock final
{
shared_mutex& m_mutex;
@@ -211,3 +283,47 @@ public:
m_upgraded ? m_mutex.unlock() : m_mutex.unlock_shared();
}
};
// Special shared (reader) lock, mutually exclusive with vip locks. Mutually incompatible with normal shared (reader) lock.
class low_lock final
{
shared_mutex& m_mutex;
public:
low_lock(const low_lock&) = delete;
low_lock& operator=(const low_lock&) = delete;
explicit low_lock(shared_mutex& mutex)
: m_mutex(mutex)
{
m_mutex.lock_low();
}
~low_lock()
{
m_mutex.unlock_low();
}
};
// Special shared (reader) lock, mutually exclusive with low locks. Mutually incompatible with normal shared (reader) lock.
class vip_lock final
{
shared_mutex& m_mutex;
public:
vip_lock(const vip_lock&) = delete;
vip_lock& operator=(const vip_lock&) = delete;
explicit vip_lock(shared_mutex& mutex)
: m_mutex(mutex)
{
m_mutex.lock_vip();
}
~vip_lock()
{
m_mutex.unlock_vip();
}
};
+3 -17
View File
@@ -1,5 +1,4 @@
#include "sema.h"
#include "sync.h"
void semaphore_base::imp_wait()
{
@@ -15,14 +14,6 @@ void semaphore_base::imp_wait()
}
}
#ifdef _WIN32
const s32 value = m_value.fetch_sub(1);
if (value <= 0)
{
NtWaitForKeyedEvent(nullptr, &m_value, false, nullptr);
}
#else
while (true)
{
// Try hard way
@@ -51,24 +42,19 @@ void semaphore_base::imp_wait()
if (value >= 0)
{
// Signal other waiter to wake up or to restore sign bit
futex(&m_value, FUTEX_WAKE_PRIVATE, 1);
m_value.notify_one();
return;
}
futex(&m_value, FUTEX_WAIT_PRIVATE, value);
m_value.wait(value);
}
#endif
}
void semaphore_base::imp_post(s32 _old)
{
verify("semaphore_base: overflow" HERE), _old < 0;
#ifdef _WIN32
NtReleaseKeyedEvent(nullptr, &m_value, false, nullptr);
#else
futex(&m_value, FUTEX_WAKE_PRIVATE, 1);
#endif
m_value.notify_one();
}
bool semaphore_base::try_post(s32 _max)
+1 -1
View File
@@ -2,7 +2,7 @@
#include <mutex>
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
// Lightweight semaphore helper class
class semaphore_base
+17 -3
View File
@@ -3,7 +3,7 @@
/* For internal use. Don't include. */
#include "types.h"
#include "Atomic.h"
#include "util/atomic.hpp"
#include "dynamic_library.h"
#ifdef _WIN32
@@ -233,9 +233,16 @@ bool balanced_wait_until(atomic_t<T>& var, u64 usec_timeout, Pred&& pred)
timeout.tv_sec = usec_timeout / 1000000;
timeout.tv_nsec = (usec_timeout % 1000000) * 1000;
char* ptr = reinterpret_cast<char*>(&var);
if constexpr (sizeof(T) == 8)
{
ptr += 4 * IS_BE_MACHINE;
}
while (!test_pred(value))
{
if (futex(&var, FUTEX_WAIT_PRIVATE, static_cast<u32>(value), is_inf ? nullptr : &timeout) == 0)
if (futex(ptr, FUTEX_WAIT_PRIVATE, static_cast<u32>(value), is_inf ? nullptr : &timeout) == 0)
{
if (!test_pred(value, nullptr))
{
@@ -284,9 +291,16 @@ void balanced_awaken(atomic_t<T>& var, u32 weight)
NtReleaseKeyedEvent(nullptr, &var, false, nullptr);
}
#else
char* ptr = reinterpret_cast<char*>(&var);
if constexpr (sizeof(T) == 8)
{
ptr += 4 * IS_BE_MACHINE;
}
if (All || weight)
{
futex(&var, FUTEX_WAKE_PRIVATE, All ? INT_MAX : std::min<u32>(INT_MAX, weight));
futex(ptr, FUTEX_WAKE_PRIVATE, All ? INT_MAX : std::min<u32>(INT_MAX, weight));
}
return;
Regular → Executable
+109 -1
View File
@@ -1,10 +1,17 @@
#include "sysinfo.h"
#include "sysinfo.h"
#include "StrFmt.h"
#include "File.h"
#include "Emu/System.h"
#ifdef _WIN32
#include "windows.h"
#include "sysinfoapi.h"
#include "subauth.h"
#include "stringapiset.h"
#else
#include <unistd.h>
#include <sys/utsname.h>
#include <errno.h>
#endif
bool utils::has_ssse3()
@@ -37,6 +44,12 @@ bool utils::has_rtm()
return g_value;
}
bool utils::has_tsx_force_abort()
{
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[3] & 0x2000) == 0x2000;
return g_value;
}
bool utils::has_mpx()
{
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x4000) == 0x4000;
@@ -97,6 +110,15 @@ std::string utils::get_system_info()
fmt::append(result, "%s | %d Threads | %.2f GiB RAM", brand, num_proc, mem_total / (1024.0f * 1024 * 1024));
if (const ullong tsc_freq = get_tsc_freq())
{
fmt::append(result, " | TSC: %.02fGHz", tsc_freq / 1000000000.);
}
else
{
fmt::append(result, " | TSC: Bad");
}
if (has_avx())
{
result += " | AVX";
@@ -120,11 +142,97 @@ std::string utils::get_system_info()
if (has_rtm())
{
result += " | TSX";
if (has_tsx_force_abort())
{
result += "-FA";
}
if (!has_mpx())
{
result += " disabled by default";
}
}
return result;
}
std::string utils::get_firmware_version()
{
const std::string file_path = g_cfg.vfs.get_dev_flash() + "vsh/etc/version.txt";
if (fs::is_file(file_path))
{
const fs::file version_file = fs::file(file_path);
std::string version = version_file.to_string();
// Extract version
const size_t start = version.find_first_of(':') + 1;
const size_t end = version.find_first_of(':', start);
version = version.substr(start, end - start);
// Trim version
const size_t trim_start = version.find_first_not_of('0');
const size_t trim_end = version.find_last_not_of('0');
version = version.substr(trim_start, trim_end);
return version;
}
return "";
}
std::string utils::get_OS_version()
{
std::string output = "";
#ifdef _WIN32
// GetVersionEx is deprecated, RtlGetVersion is kernel-mode only and AnalyticsInfo is UWP only.
// So we're forced to read PEB instead to get Windows version info. It's ugly but works.
const DWORD peb_offset = 0x60;
const INT_PTR peb = __readgsqword(peb_offset);
const DWORD version_major = *reinterpret_cast<const DWORD*>(peb + 0x118);
const DWORD version_minor = *reinterpret_cast<const DWORD*>(peb + 0x11c);
const WORD build = *reinterpret_cast<const WORD*>(peb + 0x120);
const UNICODE_STRING service_pack = *reinterpret_cast<const UNICODE_STRING*>(peb + 0x02E8);
const u64 compatibility_mode = *reinterpret_cast<const u64*>(peb + 0x02C8); // Two DWORDs, major & minor version
const bool has_sp = service_pack.Length > 0;
std::vector<char> holder(service_pack.Length + 1, '\0');
if (has_sp)
{
WideCharToMultiByte(CP_UTF8, NULL, service_pack.Buffer, service_pack.Length,
(LPSTR) holder.data(), static_cast<int>(holder.size()), NULL, NULL);
}
fmt::append(output,
"Operating system: Windows, Major: %lu, Minor: %lu, Build: %u, Service Pack: %s, Compatibility mode: %llu",
version_major, version_minor, build, has_sp ? holder.data() : "none", compatibility_mode);
#else
struct utsname details = {};
if (!uname(&details))
{
fmt::append(output, "Operating system: POSIX, Name: %s, Release: %s, Version: %s",
details.sysname, details.release, details.version);
}
else
{
fmt::append(output, "Operating system: POSIX, Unknown version! (Error: %d)", errno);
}
#endif
return output;
}
ullong utils::get_tsc_freq()
{
#ifdef _WIN32
LARGE_INTEGER freq;
if (!QueryPerformanceFrequency(&freq) || freq.QuadPart > 9'999'999)
return 0;
return freq.QuadPart * 1024;
#else
// TODO
return 0;
#endif
}
Regular → Executable
+9 -1
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "types.h"
#include <string>
@@ -37,6 +37,8 @@ namespace utils
bool has_rtm();
bool has_tsx_force_abort();
bool has_mpx();
bool has_512();
@@ -44,4 +46,10 @@ namespace utils
bool has_xop();
std::string get_system_info();
std::string get_firmware_version();
std::string get_OS_version();
ullong get_tsc_freq();
}
+197 -398
View File
@@ -3,7 +3,8 @@
#include "types.h"
#include "mutex.h"
#include "cond.h"
#include "Atomic.h"
#include "util/atomic.hpp"
#include "util/typeindices.hpp"
#include "VirtualMemory.h"
#include <memory>
@@ -35,21 +36,6 @@ namespace utils
ullong stamp;
};
// Detect shared type: id_share tag type can specify any type
template <typename T, typename = void>
struct typeinfo_share
{
static constexpr bool is_shared = false;
};
template <typename T>
struct typeinfo_share<T, std::void_t<typename std::decay_t<T>::id_share>>
{
using share = std::decay_t<typename std::decay_t<T>::id_share>;
static constexpr bool is_shared = true;
};
// Detect id transformation trait (multiplier)
template <typename T, typename = void>
struct typeinfo_step
@@ -70,12 +56,6 @@ namespace utils
static constexpr uint bias = 0;
};
// template <typename T>
// struct typeinfo_bias<T, std::void_t<decltype(std::decay_t<T>::id_bias)>>
// {
// static constexpr uint bias = uint{std::decay_t<T>::id_bias};
// };
template <typename T>
struct typeinfo_bias<T, std::void_t<decltype(std::decay_t<T>::id_base)>>
{
@@ -92,212 +72,51 @@ namespace utils
template <typename T>
struct typeinfo_count<T, std::void_t<decltype(std::decay_t<T>::id_count)>>
{
static constexpr uint get_max()
{
// Use count of the "shared" tag type, it should be a public base of T in this case
if constexpr (typeinfo_share<T>::is_shared)
{
using shared = typename typeinfo_share<T>::share;
if constexpr (!std::is_same_v<std::decay_t<T>, shared>)
{
return typeinfo_count<shared>::max_count;
}
}
return uint{std::decay_t<T>::id_count};
}
static constexpr uint max_count = get_max();
static constexpr uint max_count = uint{std::decay_t<T>::id_count};
static_assert(ullong{max_count} * typeinfo_step<T>::step <= 0x1'0000'0000ull);
};
// Detect polymorphic type enablement
// Detect operator ->
template <typename T, typename = void>
struct typeinfo_poly
struct typeinfo_pointer
{
static constexpr bool is_poly = false;
static constexpr bool is_ptr = false;
};
template <typename T>
struct typeinfo_poly<T, std::void_t<decltype(std::decay_t<T>::id_poly)>>
struct typeinfo_pointer<T, std::void_t<decltype(&std::decay_t<T>::operator->)>>
{
static constexpr bool is_poly = true;
static_assert(std::has_virtual_destructor_v<std::decay_t<T>>);
static constexpr bool is_ptr = true;
};
// Type information
struct typeinfo_base
{
uint type = 0;
uint size = 0;
uint align = 0;
uint count = 0;
void(*clean)(class typemap_block*) = 0;
const typeinfo_base* base = 0;
constexpr typeinfo_base() noexcept = default;
protected:
// Next typeinfo in linked list
typeinfo_base* next = 0;
template <typename T>
static void call_destructor(typemap_block* ptr) noexcept;
template <typename T>
friend struct typeinfo;
friend class typecounter;
friend class typemap_block;
friend class typemap;
};
template <typename T>
inline typeinfo_base g_sh{};
// Class for automatic type registration
class typecounter
{
// Linked list built at global initialization time
typeinfo_base* first = &g_sh<void>;
typeinfo_base* next = first;
typeinfo_base* last = first;
template <typename T>
friend struct typeinfo;
friend class typemap_block;
friend class typemap;
public:
constexpr typecounter() noexcept = default;
// Get next type id, or total type count
operator uint() const
static constexpr typeinfo_base make_typeinfo() noexcept
{
return last->type + 1;
static_assert(alignof(T) < 4096);
typeinfo_base r;
r.size = uint{sizeof(T)};
r.align = uint{alignof(T)};
r.count = typeinfo_count<T>::max_count;
r.clean = &call_destructor<T>;
return r;
}
};
// Global typecounter instance
inline typecounter g_typecounter{};
template <typename T>
struct typeinfo : typeinfo_base
{
static void call_destructor(class typemap_block* ptr);
typeinfo();
template <typename, typename B>
friend struct typepoly;
};
// Type information for each used type
template <typename T>
inline const typeinfo<T> g_typeinfo{};
template <typename T, typename B>
struct typepoly
{
uint type = 0;
typepoly();
};
// Polymorphic type helper
template <typename T, typename B>
inline const typepoly<T, B> g_typepoly{};
template <typename T>
typeinfo<T>::typeinfo()
{
static_assert(alignof(T) < 4096);
this->type = g_typecounter;
this->size = uint{sizeof(T)};
this->align = uint{alignof(T)};
this->count = typeinfo_count<T>::max_count;
this->clean = &call_destructor;
if (this != &g_typeinfo<T>)
{
// Protect global state against unrelated constructions of typeinfo<> objects
this->type = g_typeinfo<T>.type;
}
else
{
// Update linked list
g_typecounter.next->next = this;
g_typecounter.next = this;
g_typecounter.last = this;
}
if constexpr (typeinfo_share<T>::is_shared)
{
// Store additional information for shared types
using shared = typename typeinfo_share<T>::share;
// Bind
this->base = &g_sh<shared>;
if (this != &g_typeinfo<T>)
{
return;
}
// Use smallest type id (void tag can reuse id 0)
if (g_sh<shared>.type == 0 && !std::is_void_v<shared>)
g_sh<shared>.type = this->type;
// Update max size and alignment
if (g_sh<shared>.size < this->size)
g_sh<shared>.size = this->size;
if (g_sh<shared>.align < this->align)
g_sh<shared>.align = this->align;
if (g_sh<shared>.count < this->count)
g_sh<shared>.count = this->count;
}
}
template <typename T, typename B>
typepoly<T, B>::typepoly()
{
static_assert(alignof(T) < 4096);
if (this != &g_typepoly<T, B>)
{
// Protect global state against unrelated constructions of typepoly<> objects
return;
}
// Set min align 16 to make some space for a pointer
const uint size{sizeof(T) < 16 ? 16 : sizeof(T)};
const uint align{alignof(T) < 16 ? 16 : alignof(T)};
typeinfo_base& info = const_cast<typeinfo<B>&>(g_typeinfo<B>);
this->type = info.type;
// Update max size and alignment of the base class typeinfo
if (info.size < size)
info.size = size;
if (info.align < align)
info.align = align;
if constexpr (typeinfo_share<B>::is_shared)
{
typeinfo_base& base = const_cast<typeinfo_base&>(*info.base);
// Update max size and alignment of the shared type
if (base.size < size)
base.size = size;
if (base.align < align)
base.align = align;
}
}
// Internal, control block for a particular object
class typemap_block
{
@@ -326,20 +145,126 @@ namespace utils
static_assert(sizeof(typemap_block) == 8);
template <typename T>
void typeinfo<T>::call_destructor(typemap_block* ptr)
void typeinfo_base::call_destructor(typemap_block* ptr) noexcept
{
// Choose cleanup routine
if constexpr (typeinfo_poly<T>::is_poly)
{
// Read actual pointer to the base class
(*ptr->get_ptr<T*>())->~T();
}
else
{
ptr->get_ptr<T>()->~T();
}
ptr->get_ptr<T>()->~T();
}
// An object of type T paired with atomic refcounter
template <typename T>
class refctr final
{
atomic_t<std::size_t> m_ref{1};
public:
T object;
template <typename... Args>
refctr(Args&&... args)
: object(std::forward<Args>(args)...)
{
}
void add_ref() noexcept
{
m_ref++;
}
std::size_t remove_ref() noexcept
{
return --m_ref;
}
};
// Simplified "shared" ptr making use of refctr<T> class
template <typename T>
class refptr final
{
refctr<T>* m_ptr = nullptr;
void destroy()
{
if (m_ptr && !m_ptr->remove_ref())
delete m_ptr;
}
public:
constexpr refptr() = default;
// Construct directly from refctr<T> pointer
explicit refptr(refctr<T>* ptr) noexcept
: m_ptr(ptr)
{
}
refptr(const refptr& rhs) noexcept
: m_ptr(rhs.m_ptr)
{
if (m_ptr)
m_ptr->add_ref();
}
refptr(refptr&& rhs) noexcept
: m_ptr(rhs.m_ptr)
{
rhs.m_ptr = nullptr;
}
~refptr()
{
destroy();
}
refptr& operator =(const refptr& rhs) noexcept
{
destroy();
m_ptr = rhs.m_ptr;
if (m_ptr)
m_ptr->add_ref();
}
refptr& operator =(refptr&& rhs) noexcept
{
std::swap(m_ptr, rhs.m_ptr);
}
void reset() noexcept
{
destroy();
m_ptr = nullptr;
}
refctr<T>* release() noexcept
{
return std::exchange(m_ptr, nullptr);
}
void swap(refptr&& rhs) noexcept
{
std::swap(m_ptr, rhs.m_ptr);
}
refctr<T>* get() const noexcept
{
return m_ptr;
}
T& operator *() const noexcept
{
return m_ptr->object;
}
T* operator ->() const noexcept
{
return &m_ptr->object;
}
explicit operator bool() const noexcept
{
return !!m_ptr;
}
};
// Internal, typemap control block for a particular type
struct alignas(64) typemap_head
{
@@ -456,20 +381,20 @@ namespace utils
auto get() const noexcept
{
ASSUME(m_block->m_type != 0);
if constexpr (std::is_lvalue_reference_v<T>)
{
return static_cast<D*>(*m_block->get_ptr<std::remove_reference_t<T>*>());
}
else
{
return m_block->get_ptr<T>();
}
return m_block->get_ptr<T>();
}
auto operator->() const noexcept
{
return get();
// Invoke object's operator -> if available
if constexpr (typeinfo_pointer<T>::is_ptr)
{
return get()->operator->();
}
else
{
return get();
}
}
// Release the lock and set invalid state
@@ -512,24 +437,12 @@ namespace utils
}
}
if constexpr (std::is_lvalue_reference_v<T>)
{
using base = std::remove_reference_t<T>;
if (m_block->m_type.exchange(g_typepoly<New, base>.type) != 0)
{
(*m_block->get_ptr<base*>())->~base();
m_head->m_destroy_count++;
}
*m_block->get_ptr<base*>() = new (m_block->get_ptr<New, 16>()) New(std::forward<Args>(args)...);
}
else
if constexpr (true)
{
static_assert(std::is_same_v<New, T>);
// Set type; zero value shall not be observed in the case of recreation
if (m_block->m_type.exchange(type_index()) != 0)
if (m_block->m_type.exchange(1) != 0)
{
// Destroy object if it exists
m_block->get_ptr<T>()->~T();
@@ -552,16 +465,7 @@ namespace utils
return;
}
if constexpr (std::is_lvalue_reference_v<T>)
{
using base = std::remove_reference_t<T>;
(*m_block->get_ptr<base*>())->~base();
}
else
{
m_block->get_ptr<T>()->~T();
}
m_block->get_ptr<T>()->~T();
m_head->m_destroy_count++;
}
@@ -582,17 +486,6 @@ namespace utils
return static_cast<uint>(quot) * step + bias;
}
// Get current type
uint get_type() const
{
return m_block->m_type;
}
static uint type_index()
{
return g_typeinfo<std::decay_t<T>>.type;
}
static constexpr bool type_const()
{
return std::is_const_v<std::remove_reference_t<T>>;
@@ -619,16 +512,7 @@ namespace utils
template <typename T>
typemap_head* get_head() const
{
using _type = std::decay_t<T>;
if constexpr (typeinfo_share<T>::is_shared)
{
return &m_map[g_sh<_type>.type];
}
else
{
return &m_map[g_typeinfo<_type>.type];
}
return &m_map[stx::type_counter<typeinfo_base>::type<std::decay_t<T>>.index()];
}
public:
@@ -660,10 +544,7 @@ namespace utils
// Recreate, also required if constructed without initialization.
void init()
{
// Kill the ability to register more types (should segfault on attempt)
g_typecounter.next = nullptr;
if (g_typecounter <= 1)
if (!stx::typeinfo_v<typeinfo_base>.count())
{
return;
}
@@ -671,13 +552,14 @@ namespace utils
// Recreate and copy some type information
if (m_map == nullptr)
{
m_map = new typemap_head[g_typecounter]();
m_map = new typemap_head[stx::typeinfo_v<typeinfo_base>.count()]();
}
else
{
auto type = g_typecounter.first;
auto type = stx::typeinfo_v<typeinfo_base>.begin();
auto _end = stx::typeinfo_v<typeinfo_base>.end();
for (uint i = 0; type; i++, type = type->next)
for (uint i = 0; type != _end; i++, ++type)
{
// Delete objects (there shall be no threads accessing them)
const uint lim = m_map[i].m_count != 1 ? +m_map[i].m_limit : 1;
@@ -686,9 +568,9 @@ namespace utils
{
const auto block = reinterpret_cast<typemap_block*>(m_map[i].m_ptr + j * m_map[i].m_ssize);
if (const uint type_id = block->m_type)
if (block->m_type)
{
m_map[type_id].clean(block);
m_map[i].clean(block);
}
}
@@ -705,26 +587,24 @@ namespace utils
if (m_memory == nullptr)
{
// Determine total size, copy typeinfo
auto type = g_typecounter.first;
auto type = stx::typeinfo_v<typeinfo_base>.begin();
auto _end = stx::typeinfo_v<typeinfo_base>.end();
for (uint i = 0; type; i++, type = type->next)
for (uint i = 0; type != _end; i++, ++type)
{
// Use base info if provided
const auto base = type->base ? type->base : type;
const uint align = base->align;
const uint ssize = ::align<uint>(sizeof(typemap_block), align) + ::align(base->size, align);
const auto total = std::size_t{ssize} * base->count;
const uint align = type->align;
const uint ssize = ::align<uint>(sizeof(typemap_block), align) + ::align(type->size, align);
const auto total = std::size_t{ssize} * type->count;
const auto start = std::uintptr_t{::align(m_total, align)};
if (total && type->type == base->type)
if (total)
{
// Move forward hoping there are no usable gaps wasted
m_total = start + total;
// Store storage size and object count
m_map[i].m_ssize = ssize;
m_map[i].m_count = base->count;
m_map[i].m_count = type->count;
m_map[i].m_ptr = reinterpret_cast<uchar*>(start);
}
@@ -737,7 +617,7 @@ namespace utils
utils::memory_commit(m_memory, m_total);
// Update pointers
for (uint i = 0, n = g_typecounter; i < n; i++)
for (uint i = 0, n = stx::typeinfo_v<typeinfo_base>.count(); i < n; i++)
{
if (m_map[i].m_count)
{
@@ -769,8 +649,6 @@ namespace utils
return {};
}
const uint type_id = g_typeinfo<std::decay_t<Type>>.type;
using id_tag = std::decay_t<Arg>;
typemap_head* head = get_head<Type>();
@@ -829,14 +707,6 @@ namespace utils
block = nullptr;
}
}
else if constexpr (typeinfo_share<Type>::is_shared)
{
// id_any/id_always allows either null or matching type
if (UNLIKELY(block->m_type && block->m_type != type_id))
{
block = nullptr;
}
}
}
}
else if constexpr (std::is_invocable_r_v<bool, const Arg&, const Type&>)
@@ -846,20 +716,13 @@ namespace utils
{
block = reinterpret_cast<typemap_block*>(head->m_ptr + j * head->m_ssize);
if (block->m_type == type_id)
if (block->m_type)
{
std::lock_guard lock(block->m_mutex);
if (block->m_type == type_id)
if (block->m_type)
{
if constexpr (std::is_lvalue_reference_v<Type>)
{
if (std::invoke(std::forward<Arg>(id), std::as_const(**block->get_ptr<std::remove_reference_t<Type>*>())))
{
break;
}
}
else if (std::invoke(std::forward<Arg>(id), std::as_const(*block->get_ptr<Type>())))
if (std::invoke(std::forward<Arg>(id), std::as_const(*block->get_ptr<Type>())))
{
break;
}
@@ -884,13 +747,6 @@ namespace utils
{
block = nullptr;
}
else if constexpr (typeinfo_share<Type>::is_shared)
{
if (UNLIKELY(block->m_type != type_id))
{
block = nullptr;
}
}
else
{
if (UNLIKELY(block->m_type == 0))
@@ -911,58 +767,24 @@ namespace utils
{
using id_tag = std::decay_t<Arg>;
const uint type_id = g_typeinfo<std::decay_t<Type>>.type;
if constexpr (std::is_same_v<id_tag, id_new_t>)
{
// No action for id_new
return;
}
else if constexpr (std::is_same_v<id_tag, id_any_t> && !typeinfo_share<Type>::is_shared)
{
// No action for unshared id_any
return;
}
else if constexpr (std::is_same_v<id_tag, id_any_t>)
{
// Possibly shared id_any
if (LIKELY(!block || block->m_type == type_id || block->m_type == 0))
{
return;
}
// No action for id_any
return;
}
else if constexpr (std::is_same_v<id_tag, id_always_t>)
{
if constexpr (typeinfo_share<Type>::is_shared)
{
if (!block)
{
return;
}
if (block->m_type && block->m_type != type_id)
{
block->m_mutex.unlock();
block = nullptr;
return;
}
}
if (block->m_type == 0 && block->m_type.compare_and_swap_test(0, type_id))
if (block->m_type == 0 && block->m_type.compare_and_swap_test(0, 1))
{
// Initialize object if necessary
static_assert(!std::is_const_v<std::remove_reference_t<Type>>);
static_assert(!std::is_volatile_v<std::remove_reference_t<Type>>);
if constexpr (std::is_lvalue_reference_v<Type>)
{
using base = std::remove_reference_t<Type>;
*block->get_ptr<base*>() = new (block->get_ptr<base, 16>()) base();
}
else
{
new (block->get_ptr<Type>) Type();
}
new (block->get_ptr<Type>) Type();
}
return;
@@ -974,16 +796,9 @@ namespace utils
return;
}
if (LIKELY(block->m_type == type_id))
if (LIKELY(block->m_type))
{
if constexpr (std::is_lvalue_reference_v<Type>)
{
if (std::invoke(std::forward<Arg>(id), std::as_const(**block->get_ptr<std::remove_reference_t<Type>*>())))
{
return;
}
}
else if (std::invoke(std::forward<Arg>(id), std::as_const(*block->get_ptr<Type>())))
if (std::invoke(std::forward<Arg>(id), std::as_const(*block->get_ptr<Type>())))
{
return;
}
@@ -991,19 +806,9 @@ namespace utils
}
else if (block)
{
if constexpr (!typeinfo_share<Type>::is_shared)
if (LIKELY(block->m_type))
{
if (LIKELY(block->m_type))
{
return;
}
}
else
{
if (LIKELY(block->m_type == type_id))
{
return;
}
return;
}
}
else
@@ -1147,44 +952,48 @@ namespace utils
return true;
}
// Transform T&& into refptr<T>, moving const qualifier from T to refptr<T>
template <typename T, typename U = std::remove_reference_t<T>>
using decode_t = std::conditional_t<!std::is_rvalue_reference_v<T>, T,
std::conditional_t<std::is_const_v<U>, const refptr<std::remove_const_t<U>>, refptr<U>>>;
public:
// Lock any objects by their identifiers, special tags id_new/id_any/id_always, or search predicates
template <typename... Types, typename... Args, typename = std::enable_if_t<sizeof...(Types) == sizeof...(Args)>>
auto lock(Args&&... ids) const
{
static_assert(((!std::is_lvalue_reference_v<Types> == !typeinfo_poly<Types>::is_poly) && ...));
static_assert(((!std::is_rvalue_reference_v<Types>) && ...));
static_assert(((!std::is_lvalue_reference_v<Types>) && ...));
static_assert(((!std::is_array_v<Types>) && ...));
static_assert(((!std::is_void_v<Types>) && ...));
// Initialize pointers
std::array<typeptr_base, sizeof...(Types)> result{this->init_ptr<Types>(std::forward<Args>(ids))...};
std::array<typeptr_base, sizeof...(Types)> result{this->init_ptr<decode_t<Types>>(std::forward<Args>(ids))...};
// Whether requires locking after init_ptr
using locks_t = std::integer_sequence<bool, does_need_lock<Types, Args>()...>;
using locks_t = std::integer_sequence<bool, does_need_lock<decode_t<Types>, Args>()...>;
// Array index helper
using seq_t = std::index_sequence_for<Types...>;
using seq_t = std::index_sequence_for<decode_t<Types>...>;
// Lock any number of objects in safe manner
while (true)
{
const uint locked = lock_array<Types...>(result, seq_t{}, locks_t{});
if (LIKELY(try_lock<0, Types...>(result, locked, locks_t{})))
const uint locked = lock_array<decode_t<Types>...>(result, seq_t{}, locks_t{});
if (LIKELY(try_lock<0, decode_t<Types>...>(result, locked, locks_t{})))
break;
}
// Verify object types
check_array<Types...>(result, seq_t{}, std::forward<Args>(ids)...);
check_array<decode_t<Types>...>(result, seq_t{}, std::forward<Args>(ids)...);
// Return tuple of possibly locked pointers, or a single pointer
if constexpr (sizeof...(Types) != 1)
{
return array_to_tuple<Types...>(result, seq_t{});
return array_to_tuple<decode_t<Types>...>(result, seq_t{});
}
else
{
return typeptr<Types...>(result[0]);
return typeptr<decode_t<Types>...>(result[0]);
}
}
@@ -1192,35 +1001,25 @@ namespace utils
template <typename Type, typename... Types, typename F>
ullong apply(F&& func)
{
static_assert(!std::is_lvalue_reference_v<Type> == !typeinfo_poly<Type>::is_poly);
static_assert(!std::is_rvalue_reference_v<Type>);
static_assert(!std::is_lvalue_reference_v<Type>);
static_assert(!std::is_array_v<Type>);
static_assert(!std::is_void_v<Type>);
const uint type_id = g_typeinfo<std::decay_t<Type>>.type;
typemap_head* head = get_head<Type>();
typemap_head* head = get_head<decode_t<Type>>();
const ullong ix = head->m_create_count;
for (std::size_t j = 0; j < (typeinfo_count<Type>::max_count != 1 ? +head->m_limit : 1); j++)
for (std::size_t j = 0; j < (typeinfo_count<decode_t<Type>>::max_count != 1 ? +head->m_limit : 1); j++)
{
const auto block = reinterpret_cast<typemap_block*>(head->m_ptr + j * head->m_ssize);
if (block->m_type == type_id)
if (block->m_type)
{
std::lock_guard lock(block->m_mutex);
if (block->m_type == type_id)
if (block->m_type)
{
if constexpr (std::is_lvalue_reference_v<Type>)
{
std::invoke(std::forward<F>(func), **block->get_ptr<std::remove_reference_t<Type>*>());
}
else
{
std::invoke(std::forward<F>(func), *block->get_ptr<Type>());
}
std::invoke(std::forward<F>(func), *block->get_ptr<decode_t<Type>>());
}
}
}
+104 -11
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#ifdef _MSC_VER
#include <intrin.h>
@@ -10,6 +10,7 @@
#include <cstdint>
#include <cstddef>
#include <cstring>
#include <type_traits>
#include <utility>
#include <chrono>
@@ -20,6 +21,10 @@
#define IS_LE_MACHINE 1
#define IS_BE_MACHINE 0
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#ifdef _MSC_VER
#define ASSUME(...) __assume(__VA_ARGS__) // MSVC __assume ignores side-effects
@@ -28,6 +33,7 @@
#define SAFE_BUFFERS __declspec(safebuffers)
#define NEVER_INLINE __declspec(noinline)
#define FORCE_INLINE __forceinline
#define RESTRICT __restrict
#else // not _MSC_VER
@@ -47,6 +53,7 @@
#define SAFE_BUFFERS
#define NEVER_INLINE __attribute__((noinline))
#define FORCE_INLINE __attribute__((always_inline)) inline
#define RESTRICT __restrict__
#endif // _MSC_VER
@@ -79,6 +86,22 @@
#define AUDIT(...) ((void)0)
#endif
#if defined(__cpp_lib_bit_cast) && (__cpp_lib_bit_cast >= 201806L)
#include <bit>
#else
namespace std
{
template <class To, class From, typename = std::enable_if_t<sizeof(To) == sizeof(From)>>
constexpr To bit_cast(const From& from) noexcept
{
static_assert(sizeof(To) == sizeof(From), "std::bit_cast<>: incompatible type size");
To result;
std::memcpy(&result, &from, sizeof(From));
return result;
}
}
#endif
using schar = signed char;
using uchar = unsigned char;
@@ -108,6 +131,46 @@ using steady_clock = std::conditional<
std::chrono::high_resolution_clock::is_steady,
std::chrono::high_resolution_clock, std::chrono::steady_clock>::type;
// Get integral type from type size
template <std::size_t N>
struct get_int_impl
{
};
template <>
struct get_int_impl<sizeof(u8)>
{
using utype = u8;
using stype = s8;
};
template <>
struct get_int_impl<sizeof(u16)>
{
using utype = u16;
using stype = s16;
};
template <>
struct get_int_impl<sizeof(u32)>
{
using utype = u32;
using stype = s32;
};
template <>
struct get_int_impl<sizeof(u64)>
{
using utype = u64;
using stype = s64;
};
template <std::size_t N>
using get_uint_t = typename get_int_impl<N>::utype;
template <std::size_t N>
using get_sint_t = typename get_int_impl<N>::stype;
namespace gsl
{
using std::byte;
@@ -361,6 +424,9 @@ struct alignas(16) s128
CHECK_SIZE_ALIGN(u128, 16, 16);
CHECK_SIZE_ALIGN(s128, 16, 16);
using f32 = float;
using f64 = double;
union alignas(2) f16
{
u16 _u16;
@@ -371,22 +437,20 @@ union alignas(2) f16
_u16 = raw;
}
explicit operator float() const
explicit operator f32() const
{
// See http://stackoverflow.com/a/26779139
// The conversion doesn't handle NaN/Inf
u32 raw = ((_u16 & 0x8000) << 16) | // Sign (just moved)
(((_u16 & 0x7c00) + 0x1C000) << 13) | // Exponent ( exp - 15 + 127)
((_u16 & 0x03FF) << 13); // Mantissa
return (float&)raw;
return std::bit_cast<f32>(raw);
}
};
CHECK_SIZE_ALIGN(f16, 2, 2);
using f32 = float;
using f64 = double;
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
constexpr T align(const T& value, ullong align)
{
@@ -397,13 +461,11 @@ template <typename T, typename T2>
inline u32 offset32(T T2::*const mptr)
{
#ifdef _MSC_VER
static_assert(sizeof(mptr) == sizeof(u32), "Invalid pointer-to-member size");
return reinterpret_cast<const u32&>(mptr);
return std::bit_cast<u32>(mptr);
#elif __GNUG__
static_assert(sizeof(mptr) == sizeof(std::size_t), "Invalid pointer-to-member size");
return static_cast<u32>(reinterpret_cast<const std::size_t&>(mptr));
return std::bit_cast<std::size_t>(mptr);
#else
static_assert(sizeof(mptr) == 0, "Invalid pointer-to-member size");
static_assert(sizeof(mptr) == 0, "Unsupported pointer-to-member size");
#endif
}
@@ -833,3 +895,34 @@ inline void busy_wait(std::size_t cycles = 3000)
const u64 s = __rdtsc();
do _mm_pause(); while (__rdtsc() - s < cycles);
}
// TODO: Remove when moving to c++20
template <typename T>
inline constexpr uintmax_t floor2(T value)
{
value >>= 1;
for (uintmax_t i = 0;; i++, value >>= 1)
{
if (value == 0)
{
return i;
}
}
}
template <typename T>
inline constexpr uintmax_t ceil2(T value)
{
const uintmax_t ispow2 = value & (value - 1); // if power of 2 the result is 0
value >>= 1;
for (uintmax_t i = 0;; i++, value >>= 1)
{
if (value == 0)
{
return i + std::min<uintmax_t>(ispow2, 1);
}
}
}
+4
View File
@@ -1,4 +1,8 @@
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "Skip installation" FORCE)
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "Enables building of SPVRemapper" FORCE)
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "Builds glslangValidator and spirv-remap" FORCE)
set(ENABLE_OPT OFF CACHE BOOL "Enables spirv-opt capability if present" FORCE)
set(ENABLE_HLSL OFF CACHE BOOL "Enables HLSL input support" FORCE)
set(ENABLE_AMD_EXTENSIONS ON CACHE BOOL "Enables support of AMD-specific extensions" FORCE)
set(ENABLE_NV_EXTENSIONS ON CACHE BOOL "Enables support of Nvidia-specific extensions" FORCE)
add_subdirectory(glslang)
+11 -10
View File
@@ -13,18 +13,17 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{8F85B6CC-250F-4ACA-A617-E820A74E3E3C}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -37,26 +36,28 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros" >
<CmakeGenerator>"Visual Studio $(VisualStudioVersion.Substring(0,2))"</CmakeGenerator>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakeBuildCommandLine>cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
<NMakeBuildCommandLine>cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Release /m</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
<NMakeReBuildCommandLine>cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Release /m</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
<NMakeCleanCommandLine>cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Release /m</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<NMakeBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Debug /m
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Debug /m
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
cmake -G $(CmakeGenerator) -A x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" ../glslang
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Debug /m
</NMakeCleanCommandLine>
</PropertyGroup>
+13 -10
View File
@@ -1,22 +1,23 @@
version: '{build}'
image: Visual Studio 2017
image: Visual Studio 2019
environment:
QTDIR: C:\Qt\5.11\msvc2017_64
QTDIR: C:\Qt\5.13\msvc2017_64
QT_URL: https://cdn.discordapp.com/attachments/442667232489897997/614126952953020416/msvc2017_64.7z
LLVMLIBS: https://github.com/RPCS3/llvm/releases/download/continuous-master/llvmlibs.7z
GLSLANG: https://drive.google.com/uc?export=download&id=1nJK_NEeRzJ_r_u4zWLySwLmMrV8ZO_wL
GLSLANG: https://dl.dropboxusercontent.com/s/ku2qgwmtfptzbvx/glslang.7z
COMPATDB: https://rpcs3.net/compatibility?api=v1&export
VULKAN_SDK: "C:\\VulkanSDK\\1.1.73.0"
VULKAN_SDK_URL: https://sdk.lunarg.com/sdk/download/1.1.73.0/windows/VulkanSDK-1.1.73.0-Installer.exe
VULKAN_SDK_MIRROR: https://obk.ee/rpcs3/VulkanSDK-1.1.73.0-Installer.exe
VULKAN_SDK_SHA: a5d193f97db4de97e6b4fdd81f00ff6a603f66bb17dc3cf8ac0fe9aec58497c7
VULKAN_SDK: "C:\\VulkanSDK\\1.1.106.0"
VULKAN_SDK_URL: https://sdk.lunarg.com/sdk/download/1.1.106.0/windows/VulkanSDK-1.1.106.0-Installer.exe
VULKAN_SDK_SHA: 24b5c9d415912c0fb07f973f10f671a488b0e33ca991409bcabf1d4bebf0b804
cache:
- glslang.7z -> appveyor.yml
- compat_database.dat
- vulkan-sdk.exe -> appveyor.yml
- msvc2017_64.7z -> appveyor.yml
install:
- ps: | # set env vars for versioning
@@ -49,6 +50,7 @@ install:
3rdparty/GSL `
3rdparty/hidapi `
3rdparty/libpng `
3rdparty/libusb `
3rdparty/pugixml `
3rdparty/xxHash `
3rdparty/yaml-cpp `
@@ -68,14 +70,15 @@ build:
before_build:
- ps: | # initialize mirror arrays and fetch precompiled build dependencies
$VULKAN_SDK_URLS = @(
$env:VULKAN_SDK_MIRROR;
$env:VULKAN_SDK_URL;
"$($env:VULKAN_SDK_URL)?Human=true";
)
if (!(test-path llvmlibs.7z)) { irm $env:LLVMLIBS -outfile llvmlibs.7z }
if (!(test-path glslang.7z)) { irm $env:GLSLANG -outfile glslang.7z }
if (!(test-path msvc2017_64.7z)) { irm $env:QT_URL -outfile msvc2017_64.7z }
7z x llvmlibs.7z -aos -o"." | out-null
7z x glslang.7z -aos -o".\lib\$env:CONFIGURATION-$env:PLATFORM" | out-null
7z x msvc2017_64.7z -aos -o"C:\Qt\5.13" | out-null
if (!(test-path vulkan-sdk.exe))
{
foreach ($url in $VULKAN_SDK_URLS) {
@@ -106,8 +109,8 @@ after_build:
- ps: | # package artifacts
7z a -m0=LZMA2 -mx9 $env:BUILD .\bin\*
7z a -m0=LZMA2 -mx9 openssl_win64.7z C:\OpenSSL-Win64\bin\libeay32.dll `
C:\OpenSSL-Win64\bin\ssleay32.dll
7z a -m0=LZMA2 -mx9 openssl_win64.7z C:\OpenSSL-v111-Win64\bin\libcrypto-1_1-x64.dll `
C:\OpenSSL-v111-Win64\bin\libssl-1_1-x64.dll
$env:FILESIZEMB = (Get-Item $env:BUILD).length/1MB
- ps: | # generate sha256 hashes
+1 -1
Submodule asmjit updated: 673dcefaa0...fc251c914e
+2 -2
View File
@@ -87,13 +87,13 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{AC40FF01-426E-4838-A317-66354CEFAE88}</ProjectGuid>
<RootNamespace>asmjit</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+630
View File
@@ -0,0 +1,630 @@
/*
Envy theme for RPCS3 by drysalter (https://github.com/drysalter)
03/04/2019
*/
/*
Table of Main Colors:
Gray: #23262d
Lighter Gray: #2d3038
Disabled Gray: #4d5058
ComboBox Gray: #999999
GroupBox Gray: #bdc3c7
White: #f8f8f8
Green: #8cf944
Lighter Green: #b1f184
Candy Red: #ff007a
Yellow: #f2d571
Fuchsia: #ff00ff
Orange: #ff6000
Cyan: #3498d8
*/
/* Main Colouring */
QWidget {
background-color: #23262d;
color: #f8f8f8;
alternate-background-color: #23262d;
}
/* Tooltips */
QToolTip {
background-color: #2d3038;
color: #8cf944;
padding: 0.2em;
border: 1px #2d3038;
}
/* Table Headers */
QHeaderView {
border: none;
border-bottom: 1px solid #8cf944;
}
QHeaderView::section {
background-color: #23262d;
color: #f8f8f8;
padding-top: 3px;
padding-left: 3px;
height: 20px;
border: none;
}
QHeaderView::section:first {
padding-left: 5px;
}
/* Tabs */
QTabBar::tab {
color: #8cf944;
padding-left: 1.25em;
padding-right: 1.25em;
padding-top: 0.5em;
padding-bottom: 0.75em;
border: none;
min-width: 65px;
border-bottom: 1px solid #8cf944;
}
QTabWidget::pane {
border: none;
}
QTabWidget::tab-bar {
alignment: center;
}
QTabBar::tab:!selected {
color: #f8f8f8;
border-bottom: 1px solid transparent;
}
QTabBar::tab:selected {
color: #8cf944;
border-bottom: 1px solid #8cf944;
}
QTabBar::tab:hover {
color: #b1f184;
}
QTabBar#tab_bar_settings {
border-bottom: 1px solid #8cf944;
}
QTabBar#tab_bar_settings::tab:!selected {
color: #FFF;
border-bottom: 1px solid transparent;
}
QTabBar#tab_bar_settings::tab:selected {
color: #8cf944;
border-bottom: 1px solid #8cf944;
}
QTabBar#tab_bar_settings::tab:hover {
color: #b1f184;
border-bottom: 1px solid #8cf944;
}
/* Log Tabs */
QTabWidget#tab_widget_log::tab-bar {
alignment: left;
}
QTabBar#tab_bar_log::tab:!selected {
color: #FFF;
border: none;
}
QTabBar#tab_bar_log::tab:selected {
color: #8cf944;
border: none;
}
QTabBar#tab_bar_log::tab:hover {
color: #b1f184;
border: none;
}
/* Checkboxes */
QCheckBox::indicator {
border-radius: 0.125em;
border-top-right-radius: 0em;
border-bottom-left-radius: 0em;
border: 1px solid #FFF;
width: 0.75em;
height: 0.75em;
margin-top: 1px;
}
QCheckBox::indicator:checked {
background-color: #7fff03;
}
QCheckBox::indicator:unchecked:hover {
border: 1px solid #7fff03;
}
QCheckBox::indicator:unchecked {
background-color: #000;
}
QCheckBox::indicator:disabled {
background-color: #4d5058;
}
/* Scrollbars */
QScrollBar {
width: 5px;
background: #23262d;
}
QTableView QScrollBar {
width: 3px;
height: 3px;
}
QScrollBar::handle {
background: #4d5058;
min-height: 30px;
}
QScrollBar::handle:hover, QScrollBar::handle:pressed {
background: #8cf944;
}
QScrollBar::handle:disabled {
background: #2d3038;
}
QScrollBar::up-arrow, QScrollBar::down-arrow, QScrollBar::up-button:vertical, QScrollBar::down-button, QScrollBar::sub-line, QScrollBar::add-line, QScrollBar::add-page, QScrollBar::sub-page {
color: transparent;
background: transparent;
border: none;
}
/* Radio Buttons */
QRadioButton::indicator {
border: 0.0625em solid #FFF;
width: 0.8em;
height: 0.8em;
margin-top: 0.0625em;
border-radius: 0.45em;
}
QRadioButton::indicator:checked {
background: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0.25 #7fff03, stop:0.3 #000);
}
QRadioButton::indicator:unchecked:hover {
background: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0.25 #b1f184, stop:0.3 #000);
}
QRadioButton::indicator:unchecked {
background-color: #000;
}
QRadioButton::indicator:disabled {
background-color: #4d5058;
}
/* Combo Boxes */
QComboBox {
background-color: #23262d;
color: #f8f8f8;
border: 0.0625em solid #999999;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
min-height: 14px;
}
QComboBox:hover {
color: #8cf944;
background-color: #2d3038;
border: 0.0625em solid #8cf944;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
}
QComboBox::selected {
background-color: #2d3038;
color: #FFFFFF;
border: 0.0625em solid #8cf944;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
}
QComboBox::!selected {
background-color: #23262d;
color: #FFFFFF;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
}
QComboBox:disabled {
background-color: #4d5058;
color: #fff;
}
/* Sliders */
QSlider::groove:horizontal {
border: -3px solid transparent;
border-radius: 0.45em;
height: 8px;
background: #8cf944;
margin: 1px;
}
QSlider::groove:horizontal:disabled {
background: #4d5058;
}
QSlider::handle:horizontal {
background: #23262d;
border: 1px solid #5c5c5c;
border-radius: 0.1em;
width: 18px;
margin: -2px 2;
}
QSlider::handle:horizontal:hover {
background: #23262d;
border: 1px solid #8cf944;
}
QSlider::handle:horizontal:pressed {
background: #30333a;
border: 1px solid #8cf944;
}
/* Progress Bar */
QProgressBar {
border: 0.05em solid #999999;
border-radius: 3px;
text-align: center;
}
QProgressBar::chunk {
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #b1f184, stop: 0.5 #99f75b, stop: 1 #8cf944);
}
/* Group Boxes (Settings Dialog) */
QGroupBox {
margin-top: 1em;
font-size: 8pt;
border: 0.05em solid #bdc3c7;
border-radius: 0.3em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top;
padding: 0.3em 0.5em 0.3em 0.5em;
color: #fff;
}
/* Buttons */
QPushButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #23262d, stop: 1 #23262d);
border-width: 2px;
border: 1px solid #f8f8f8;
border-radius: 2px;
padding: 2px;
color: #f8f8f8;
min-width: 82px;
}
QPushButton:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #23262d, stop: 1 #23262d);
border-width: 2px;
border: 1px solid #8cf944;
padding: 2px;
color: #8cf944;
}
QPushButton:disabled {
color: #999999;
}
QPushButton::pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d3038, stop: 1 #2d3038);
}
/* Spinboxes */
QSpinBox, QDoubleSpinBox {
border: 1px solid #999999;
padding: 2px;
color: #FFFFFF;
border-radius: 2px;
background-color: transparent;
}
QSpinBox:hover, QDoubleSpinBox:hover {
background-color: transparent;
border: 1px solid #8cf944;
padding: 2px;
}
QSpinBox::up-button, QSpinBox::down-button, QDoubleSpinBox::up-button, QDoubleSpinBox::down-button {
background: transparent;
}
QSpinBox:disabled, QDoubleSpinBox:disabled {
border: 1px solid #4d5058;
color: #4d5058;
}
/* Log and Debugger Borders */
QTextEdit {
border-top: 0.05em solid #8cf944;
}
QLineEdit {
border: 1px solid #f8f8f8;
border-top: none;
border-left: none;
border-right: none;
}
QLineEdit:focus {
border: 1px solid #8cf944;
border-top: none;
border-left: none;
border-right: none;
}
/* Title Bar Docks */
QDockWidget::close-button, QDockWidget::float-button {
background-color: #23262d;
width: auto;
}
QDockWidget#logger {
color: transparent;
}
QDockWidget#gamelist {
color: #f8f8f8;
}
/* Top Menu Bar */
QMenuBar::item:selected {
margin-bottom: 0.125em;
color: #8cf944;
background: transparent;
}
QMenuBar::item:!selected {
border-bottom: 2px solid transparent;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 6px;
padding-right: 6px;
}
QMenuBar::item:pressed {
color: #8cf944;
background: #2d3038;
margin-bottom: 0.125em;
}
QMenu::item {
padding-left: 1.5em;
padding-right: 0.75em;
padding-top: 0.25em;
padding-bottom: 0.25em;
margin-bottom: 0.125em;
border-left: 1px solid transparent;
}
QMenu::item:selected {
background: #2d3038;
color: #8cf944;
border-left: 1px solid #8cf944;
}
QMenu::item:disabled {
background-color: #23262d;
color: #999999;
}
/* Libraries List */
QListWidget {
border: 1px solid #bdc3c7;
border-radius: 0.1em;
}
QListWidget:disabled {
border: 1px solid #4d5058;
}
QListWidget::item:selected {
background-color: #30333a;
color: #b1f184;
border-radius: 0.125em;
}
QListWidget::item:hover {
background-color: #30333a;
color: #8cf944;
border-radius: 0.25em;
}
QListWidget::indicator {
border: 1px solid #f8f8f8;
background: #000000;
padding: 5px;
}
QListWidget::indicator:checked {
background: #8cf944;
}
QListWidget::indicator:hover {
border: 1px solid #8cf944;
}
QListWidget::indicator:disabled {
background: transparent;
border: 1px solid #1b1e23;
}
/* Pad Settings: Controller Image */
QLabel#l_controller {
color: #8cf944;
}
/* Slider on Toolbar */
QWidget#sizeSliderContainer {
background: transparent;
}
QSlider#sizeSlider::groove:horizontal {
border: 0em solid transparent;
height: .3em;
background: #FFFFFF;
}
QSlider#sizeSlider::handle:horizontal {
width: 1em;
margin: -.8em 0;
}
/* Debug UI Settings buttons */
QLabel#color_button {
background: transparent;
}
/* Seachbar on main toolbar */
QLineEdit#mw_searchbar {
color: #ecf0f1;
background-color: #2d3038;
border: 1px solid #f8f8f8;
margin: 15px;
padding-left: 5px;
}
QLineEdit#mw_searchbar:hover {
color: #ecf0f1;
background-color: #2d3038;
border: 1px solid #8cf944;
margin: 15px;
}
QLineEdit#mw_searchbar:focus {
border: 1px solid #8cf944;
}
/* Toolbar */
QToolBar {
border: none;
}
/* Toolbar Buttons */
QLabel#toolbar_icon_color {
color: #FFFFFF;
}
QToolButton {
background: transparent;
border-radius: 0em;
padding: 0.09375em;
margin-left: 0.125em;
margin-top: 0.125em;
margin-bottom: 0.125em;
min-width: 0.063em;
width: auto;
border-bottom: 1px solid transparent;
}
QToolButton:disabled {
background-color: #30333a;
color: #f8f8f8;
}
QToolButton:hover {
background-color: #2d3038;
color: #8cf944;
border-bottom: 1px solid #8cf944;
}
/* Game Table */
QTableView {
selection-background-color: #2d3038;
selection-color: #8cf944;
border: none;
}
QTableView::item:hover {
color: #8cf944;
}
/* Game Icon Background */
QLabel#gamelist_icon_background_color {
color: transparent;
}
/* Set Windows Taskbar Thumbnail colors */
QLabel#thumbnail_icon_color {
color: #23262d;
}
/* Log colors */
QTextEdit#log_frame {
background-color: #23262d;
}
QLabel#log_level_always {
color: #f8f8f8;
}
QLabel#log_level_fatal {
color: #ff00ff;
}
QLabel#log_level_error {
color: #ff007a;
}
QLabel#log_level_todo {
color: #f2d571;
}
QLabel#log_level_success {
color: #8cf944;
}
QLabel#log_level_warning {
color: #ff6000;
}
QLabel#log_level_notice {
color: #FFFFFF;
}
QLabel#log_level_trace {
color: #2d3038;
}
QLabel#log_stack {
color: #3498d8;
}
/* TTY colors */
QTextEdit#tty_frame {
background-color: #23262d;
}
QLabel#tty_text {
color: #f8f8f8;
}
+656
View File
@@ -0,0 +1,656 @@
/*
Skyline (Nightfall) theme for RPCS3 by drysalter (https://github.com/drysalter)
04/04/2019
*/
/* Color Palette:
Banner Purple: #370048
Banner Blue: #161249
Banner Dusk Blue: #00364a
Background Gray: #111525
Gray: #455971
Highlight-blue: #0074e7
Light blue: #359aff
Button-blue: #0071ec
Fatal-error red: #b23345
Warning-orange: #e49000
Todo-orange: #fbb81b
Disable-gray: #999999 & #26293b
*/
/* Widget Colors */
QWidget {
background-color: #111525;
color: #FFFFFF;
alternate-background-color: #1c273d;
}
/* Top Menu Bar */
QMenuBar {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #370048, stop: 0.5 #161249, stop: 1 #00364a);
color: #FFFFFF;
border-bottom: none;
}
QMenuBar::item:selected {
border-bottom: 2px solid #FFFFFF;
}
QMenuBar::item:!selected {
border-bottom: 2px solid transparent;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 6px;
padding-right: 6px;
}
QMenuBar::item:pressed {
color: #FFFFFF;
background: #111525;
border-bottom: 2px solid #111525;
}
QMenu::item {
padding-left: 1.5em;
padding-right: 0.75em;
padding-top: 0.25em;
padding-bottom: 0.25em;
margin-bottom: 0.125em;
border-left: 2px solid #111525;
}
QMenu::item:selected {
background: #1c273d;
color: #0074e7;
border-left: 2px solid #0074e7;
}
QMenu::item:disabled {
background-color: #111525;
color: #999999;
}
/* Toolbar */
QToolBar {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #370048, stop: 0.5 #161249, stop: 1 #00364a);
border: none;
}
/* Toolbar Buttons */
QLabel#toolbar_icon_color {
color: #FFFFFF;
}
QToolButton {
color: #FFFFFF;
background: transparent;
border-radius: 0em;
padding: 0.09375em;
margin-left: 0.125em;
margin-top: 0.125em;
margin-bottom: 0.125em;
min-width: 0.063em;
width: auto;
border-bottom: 2px solid transparent;
}
QToolButton:disabled {
color: #999999;
}
QToolButton:hover {
border-bottom: 2px solid #FFFFFF;
}
/* Searchbar in Main Toolbar */
QLineEdit#mw_searchbar {
color: #455971;
background-color: #FFFFFF;
border: 1px solid #999999;
margin: 15px;
padding-left: 5px;
}
QLineEdit#mw_searchbar:hover {
margin-left: 0.7em;
color: #0074e7;
background-color: #FFFFFF;
border: 1px solid #0071ec;
margin: 15px;
}
QLineEdit#mw_searchbar:focus {
border: 1px solid #0074e7;
}
/* Sliders */
QSlider {
padding-top: 1px;
}
QSlider::groove:horizontal {
border: -3px solid transparent;
border-radius: 0.45em;
height: 8px;
background: #0074e7;
margin: 1px;
}
QSlider::groove:horizontal:disabled {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #51657e, stop:1 #455971);
}
QSlider::handle:horizontal {
background: #111525;
border: 1px solid #5c5c5c;
border-radius: 0.1em;
width: 18px;
margin: -2px 2;
}
QSlider::handle:horizontal:hover {
background: #111525;
border: 1px solid #0074e7;
}
QSlider::handle:horizontal:pressed {
border: 1px solid #0074e7;
background: #1c273d;
}
/* Slider on Toolbar */
QToolBar#mw_toolbar QSlider {
background-color: transparent;
}
QWidget#sizeSliderContainer {
background: transparent;
}
QSlider#sizeSlider::groove:horizontal {
border: 0em transparent;
height: .3em;
background: #FFFFFF;
}
QSlider#sizeSlider::handle:horizontal {
width: 1em;
margin: -.8em 0;
border: 1px solid #161249;
border-radius: 0.1em;
}
QSlider#sizeSlider::handle:hover {
border: 1px solid #0074e7;
}
/* Scrollbars */
QScrollBar {
width: 5px;
}
QTableView QScrollBar {
width: 3px;
height: 3px;
}
QScrollBar::handle {
background: #455971;
min-height: 30px;
}
QScrollBar::handle:hover, QScrollBar::handle:pressed {
background: #0074e7;
}
QScrollBar::handle:disabled {
background: #26293b;
}
QTableView QScrollBar::handle {
background: #1c273d;
}
QScrollBar::up-arrow, QScrollBar::down-arrow, QScrollBar::up-button:vertical, QScrollBar::down-button, QScrollBar::sub-line, QScrollBar::add-line, QScrollBar::add-page, QScrollBar::sub-page {
color: transparent;
background: transparent;
border: none;
}
/* Radio Buttons */
QRadioButton::indicator {
border: 0.0625em solid #455971;
width: 0.8em;
height: 0.8em;
margin-top: 0.0625em;
border-radius: 0.45em;
}
QRadioButton::indicator:checked {
background: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0.25 #0074e7, stop:0.3 #FFFFFF);
}
QRadioButton::indicator:unchecked:hover, QRadioButton::indicator:checked:hover {
border: 0.0625em solid #0074e7;
}
QRadioButton::indicator:unchecked {
background-color: #FFFFFF;
}
QRadioButton::indicator:disabled {
background-color: #455971;
}
/* Checkboxes */
QCheckBox::indicator {
border: 1px solid #455971;
border-radius: 2px;
width: 0.75em;
height: 0.75em;
margin-top: 1px;
}
QCheckBox::indicator:checked {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #008be7, stop:1 #0074e7);
}
QCheckBox::indicator:unchecked:hover {
border: 1px solid #0074e7;
}
QCheckBox::indicator:checked:hover {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #3ca3e7, stop:1 #2a89e7);
}
QCheckBox::indicator:unchecked {
background-color: #FFFFFF;
}
QCheckBox::indicator:disabled {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #51657e, stop:1 #455971);
}
/* Group Boxes (Settings Dialog) */
QGroupBox {
margin-top: 1em;
font-size: 8pt;
border: 0.05em solid #FFFFFF;
border-radius: 0.3em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top;
padding: 0.3em 0.5em 0.3em 0.5em;
color: #FFFFFF;
}
/* Tabs */
QTabBar::tab {
color: #455971;
padding-left: 1.25em;
padding-right: 1.25em;
padding-top: 0.5em;
padding-bottom: 0.75em;
border: none;
min-width: 65px;
border-bottom: 1px solid transparent;
}
QTabWidget::pane {
border: none;
}
QTabWidget::tab-bar {
alignment: center;
}
QTabBar::tab:!selected {
color: #FFFFFF;
border-bottom: 1px solid transparent;
}
QTabBar::tab:selected {
color: #0074e7;
border-bottom: 1px solid #0074e7;
}
QTabBar::tab:hover {
color: #0074e7;
}
QTabBar#tab_bar_settings {
border-bottom: 1px solid #0074e7;
width: 5.20em;
}
QTabBar#tab_bar_settings::tab:!selected {
color: #FFFFFF;
border-bottom: 1px solid transparent;
}
QTabBar#tab_bar_settings::tab:selected {
color: #0074e7;
border-bottom: 1px solid transparent;
}
QTabBar#tab_bar_settings::tab:hover {
color: #177fe7;
border-bottom: 1px solid transparent;
}
/* Log Tabs */
QTabWidget#tab_widget_log::tab-bar {
alignment: left;
}
QTabBar#tab_bar_log::tab:!selected {
color: #FFFFFF;
border: none;
}
QTabBar#tab_bar_log::tab:selected, QTabBar#tab_bar_log::tab:hover {
color: #0074e7;
border: none;
}
/* Combo Boxes */
QComboBox {
background-color: #1c273d;
color: #FFFFFF;
border: 0.0625em solid #455971;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
min-height: 14px;
}
QComboBox:hover {
color: #FFFFFF;
background-color: #1c273d;
border: 0.0625em solid #0074e7;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
}
QComboBox::item:selected {
color: #FFFFFF;
background-color: #1c273d;
border: 0.0625em solid #0074e7;
border-radius: 0.10em;
border: none;
padding: 5px;
}
QComboBox::item:!selected {
color: #FFFFFF;
background-color: #111525;
border: 0.0625em solid #0074e7;
border-radius: 0.10em;
border: none;
padding: 5px;
height: 15px;
}
QComboBox::indicator{
background-color: transparent;
selection-background-color: transparent;
color: transparent;
selection-color: transparent;
}
QComboBox::selected {
background-color: #1c273d;
color: #FFFFFF;
border: 0.0625em solid #0074e7;
border-radius: 0.10em;
padding-bottom: 0.125em;
}
QComboBox:disabled {
background-color: #26293b;
color: #455971;
}
/* Buttons */
QPushButton {
border: 1px solid #455971;
padding: 2px;
color: #FFFFFF;
border-radius: 2px;
background-color: #1c273d;
min-width: 82px;
}
QPushButton:hover {
background-color: #1c273d;
border: 1px solid #0074e7;
padding: 2px;
color: #FFFFFF;
}
QPushButton::pressed {
background-color: #121d34;
}
QPushButton:disabled {
border: 1px solid #999999;
color: #999999;
}
/* Spinboxes */
QSpinBox, QDoubleSpinBox {
border: 1px solid #455971;
padding: 2px;
color: #FFFFFF;
border-radius: 2px;
background-color: #1c273d;
}
QSpinBox:hover, QDoubleSpinBox:hover {
background-color: #1c273d;
border: 1px solid #0074e7;
padding: 2px;
color: #FFFFFF;
}
QSpinBox::up-button, QSpinBox::down-button, QDoubleSpinBox::up-button, QDoubleSpinBox::down-button {
background: transparent;
}
QSpinBox:disabled, QDoubleSpinBox:disabled {
color: #455971;
background: #26293b;
border: 1px solid #455971;
}
/* Libraries List */
QListWidget {
border: 1px solid #FFFFFF;
border-radius: 0.1em;
}
QListWidget:disabled {
border: 1px solid #455971;
}
QListWidget::item:selected {
background-color: #1c273d;
color: #0074e7;
border-radius: 0.125em;
}
QListWidget::item:hover {
background-color: #1c273d;
}
QListWidget:disabled, QListWidget:disabled:hover, QListWidget::item:disabled:hover {
background-color: #111525;
color: #FFFFFF;
border-radius: 0.25em;
}
QListWidget::item:disabled {
color: #999999;
}
/* Title Bar Docking Buttons */
QDockWidget::close-button, QDockWidget::float-button {
background: transparent;
}
QDockWidget::title#gamelist {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #370048, stop: 0.5 #161249, stop: 1 #00364a);
}
QDockWidget#gamelist {
color: #FFFFFF;
}
/* Game Table */
QTableView {
selection-background-color: #0f1d36;
selection-color: #2397ff;
border: none;
color: #FFFFFF;
}
QTableView::item:hover {
color: #2397ff;
}
/* Progress Bar */
QProgressBar {
border: 1px solid #455971;
border-radius: 3px;
text-align: center;
}
QProgressBar::chunk {
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #370048, stop: 0.5 #161249, stop: 1 #00364a);
}
/* Pad Settings: Controller Image */
QLabel#l_controller {
color: #0074e7;
}
/* Game Icon Background */
QLabel#gamelist_icon_background_color {
color: transparent;
}
/* Table Headers */
QHeaderView {
border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #370048, stop: 0.5 #161249, stop: 1 #00364a);
border-left: none;
border-right: none;
border-top: none;
}
QHeaderView::section {
background-color: #111525;
color: #FFFFFF;
padding-top: 3px;
padding-left: 3px;
height: 20px;
border: none;
}
QHeaderView::section:first {
padding-left: 5px;
}
/* Tooltips */
QToolTip {
background-color: #111525;
color: #FFFFFF;
padding: 0.1em;
border: none;
opacity: 225;
}
/* Log and Debugger Borders */
QDockWidget::title#logger {
background: #111525;
}
QDockWidget#logger {
color: transparent;
}
QTextEdit {
border-top: 1px solid #0074e7;
}
QLineEdit {
border: 1px solid #455971;
border-top: none;
border-left: none;
border-right: none;
}
QLineEdit:focus {
border: 1px solid #0074e7;
border-top: none;
border-left: none;
border-right: none;
}
/* Log colors */
QTextEdit#log_frame {
background-color: #111525;
}
QLabel#log_level_always {
color: #0074e7;
}
QLabel#log_level_fatal {
color: #b23345;
}
QLabel#log_level_error {
color: #e85545;
}
QLabel#log_level_todo {
color: #fbb81b;
}
QLabel#log_level_success {
color: #07c365;
}
QLabel#log_level_warning {
color: #e49000;
}
QLabel#log_level_notice {
color: #FFFFFF;
}
QLabel#log_level_trace {
color: #00364a;
}
QLabel#log_stack {
color: #0071ec;
}
/* Debug UI Settings buttons */
QLabel#color_button {
background: transparent;
}
/* Set Windows Taskbar Thumbnail colors */
QLabel#thumbnail_icon_color {
color: #370048;
}
+675
View File
@@ -0,0 +1,675 @@
/*
Skyline theme for RPCS3 by drysalter (https://github.com/drysalter)
04/04/2019
*/
/* Color Palette:
Purple: #8500ae
Pink Highlight: #f8edfb
Blue: #4343c1
Light Blue: #009ed0
Gray: #455971
Toolbar-blue: #4c5ad6
Border-blue: #359aff
Button-blue: #0071ec
Fatal-error red: #b23345
Warning-orange: #e49000
Todo-orange: #fbb81b
Disable-gray: #999999 & #b3b3b3
*/
/* Widget Colors */
QWidget {
background-color: #FFFFFF;
color: #455971;
alternate-background-color: #f8edfb;
}
/* Top Menu Bar */
QMenuBar {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
color: #FFFFFF;
border-bottom: none;
}
QMenuBar::item:selected {
border-bottom: 2px solid #FFFFFF;
}
QMenuBar::item:!selected {
border-bottom: 2px solid transparent;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 6px;
padding-right: 6px;
}
QMenuBar::item:pressed {
color: #455971;
background: #FFFFFF;
border-bottom: 2px solid #FFFFFF;
}
QMenu::item {
padding-left: 1.5em;
padding-right: 1.5em;
padding-top: 0.25em;
padding-bottom: 0.25em;
margin-bottom: 0.125em;
border-left: 2px solid #FFFFFF;
}
QMenu::item:selected {
background: #f8edfb;
color: #455971;
border-left: 2px solid #8500ae;
}
QMenu::item:disabled {
background-color: #FFFFFF;
color: #999999;
}
/* Toolbar */
QToolBar {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
border: none;
}
/* Toolbar Buttons */
QLabel#toolbar_icon_color {
color: #FFFFFF;
}
QToolButton {
color: #FFFFFF;
background: transparent;
border-radius: 0em;
padding: 0.09375em;
margin-left: 0.125em;
margin-top: 0.125em;
margin-bottom: 0.125em;
min-width: 0.063em;
width: auto;
border-bottom: 2px solid transparent;
}
QToolButton:disabled {
color: #999999;
}
QToolButton:hover {
border-bottom: 2px solid #FFFFFF;
}
/* Searchbar in Main Toolbar */
QLineEdit#mw_searchbar {
color: #455971;
background-color: #FFFFFF;
border: 1px solid #999999;
margin: 15px;
padding-left: 5px;
}
QLineEdit#mw_searchbar:hover {
margin-left: 0.7em;
color: #455971;
background-color: #FFFFFF;
border: 1px solid #0071ec;
margin: 15px;
}
QLineEdit#mw_searchbar:focus {
border: 1px solid #0071ec;
}
/* Sliders */
QSlider {
padding-top: 1px;
}
QSlider::groove:horizontal {
border: -3px solid transparent;
border-radius: 0.45em;
height: 8px;
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
margin: 1px;
}
QSlider::groove:horizontal:disabled {
background: #b3b3b3;
}
QSlider::handle:horizontal {
background: #FFFFFF;
border: 1px solid #5c5c5c;
border-radius: 0.1em;
width: 18px;
margin: -2px 2;
}
QSlider::handle:horizontal:disabled {
border: 1px solid #b3b3b3;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border: 1px solid #8500ae;
}
QSlider::handle:horizontal:pressed {
background: #f8edfb;
border: 1px solid #8500ae;
}
/* Slider on Toolbar */
QToolBar#mw_toolbar QSlider {
background-color: transparent;
}
QWidget#sizeSliderContainer {
background: transparent;
}
QSlider#sizeSlider::groove:horizontal {
border: 0em transparent;
height: .3em;
background: #FFFFFF;
}
QSlider#sizeSlider::handle:horizontal {
width: 1em;
margin: -.8em 0;
border: 1px solid #4343c1;
border-radius: 0.1em;
}
QSlider#sizeSlider::handle:hover {
border: 1px solid #8500ae;
}
/* Scrollbars */
QScrollBar {
width: 5px;
}
QScrollArea {
background: transparent;
}
QTableView QScrollBar {
width: 3px;
height: 3px;
}
QScrollBar::handle {
background: #999999;
min-height: 30px;
}
QTableView QScrollBar::handle {
background: #999999;
}
QScrollBar::handle:hover, QScrollBar::handle:pressed {
background: #8500ae;
}
QTableView QScrollBar::handle:hover, QTableView QScrollBar::handle:pressed {
background: #4343c1;
}
QScrollBar::handle:disabled {
background: #b3b3b3;
}
QScrollBar::up-arrow, QScrollBar::down-arrow, QScrollBar::up-button:vertical, QScrollBar::down-button, QScrollBar::sub-line, QScrollBar::add-line, QScrollBar::add-page, QScrollBar::sub-page {
color: transparent;
background: transparent;
border: none;
}
/* Radio Buttons */
QRadioButton::indicator {
border: 0.0625em solid #455971;
width: 0.8em;
height: 0.8em;
margin-top: 0.0625em;
border-radius: 0.45em;
}
QRadioButton::indicator:checked {
background: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0.25 #b345d9, stop:0.3 #FFFFFF);
}
QRadioButton::indicator:unchecked:hover, QRadioButton::indicator:checked:hover {
border: 0.0625em solid #8500ae;
}
QRadioButton::indicator:unchecked {
background-color: #FFFFFF;
}
QRadioButton::indicator:disabled {
background-color: #455971;
}
/* Checkboxes */
QCheckBox::indicator {
border: 1px solid #455971;
border-radius: 2px;
width: 0.75em;
height: 0.75em;
margin-top: 1px;
}
QCheckBox::indicator:checked {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #c500ff, stop:1 #8500ae);
}
QCheckBox::indicator:unchecked:hover {
border: 1px solid #8500ae;
}
QCheckBox::indicator:checked:hover {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #da5eff, stop:1 #974cae);
}
QCheckBox::indicator:unchecked {
background-color: #FFFFFF;
}
QCheckBox::indicator:checked:disabled {
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:0.3, fy:0.3, stop:0.8 #b3b3b3, stop:1 #9d9d9d);
}
QCheckBox::indicator:unchecked:disabled {
border: 1px solid #b3b3b3;
}
/* Group Boxes (Settings Dialog) */
QGroupBox {
margin-top: 1em;
font-size: 8pt;
border: 0.05em solid #455971;
border-radius: 0.3em;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top;
padding: 0.3em 0.5em 0.3em 0.5em;
color: #455971;
}
/* Tabs */
QTabBar::tab {
color: #455971;
padding-left: 1.25em;
padding-right: 1.25em;
padding-top: 0.5em;
padding-bottom: 0.75em;
border: none;
min-width: 65px;
border-bottom: 1px solid #455971;
}
QTabWidget::pane {
border: none;
}
QTabWidget::tab-bar {
alignment: center;
}
QTabBar::tab:!selected {
color: #455971;
border-bottom: 1px solid transparent;
}
QTabBar::tab:selected {
color: #8500ae;
background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border-bottom: 1px solid #8500ae;
}
QTabBar::tab:hover {
color: #8500ae;
}
QTabBar#tab_bar_settings {
border-bottom: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
width: 5.20em;
}
QTabBar#tab_bar_settings::tab:!selected {
color: #455971;
border-bottom: 1px solid transparent;
}
QTabBar#tab_bar_settings::tab:selected, QTabBar#tab_bar_settings::tab:hover {
color: #8500ae;
background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border-bottom: 1px solid #8500ae;
}
/* Log Tabs */
QTabWidget#tab_widget_log::tab-bar {
alignment: left;
}
QTabBar#tab_bar_log::tab:!selected {
color: #956fa1;
border: none;
}
QTabBar#tab_bar_log::tab:selected {
color: #4343c1;
background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border: none;
}
QTabBar#tab_bar_log::tab:hover {
color: #8500ae;
background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border: none;
}
/* Combo Boxes */
QComboBox {
background-color: #FFFFFF;
color: #455971;
border: 0.0625em solid #455971;
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
min-height: 14px;
}
QComboBox:hover {
color: #455971;
background-color: #FFFFFF;
border: 0.0625em solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
border-radius: 0.10em;
padding-bottom: 0.125em;
padding-left: 0.25em;
}
QComboBox::item:selected {
color: #000000;
background-color: #f8edfb;
border: 0.0625em solid #455971;
border-radius: 0.10em;
border: none;
padding: 5px;
}
QComboBox::item:!selected {
color: #000000;
background-color: #FFFFFF;
border: 0.0625em solid #455971;
border-radius: 0.10em;
border: none;
padding: 5px;
height: 15px;
}
QComboBox::indicator {
background-color: transparent;
selection-background-color: transparent;
color: transparent;
selection-color: transparent;
}
QComboBox::selected {
background-color: #FFFFFF;
color: #455971;
border: 0.0625em solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
border-radius: 0.10em;
padding-bottom: 0.125em;
}
QComboBox:disabled {
background-color: #b3b3b3;
color: #455971;
}
/* Buttons */
QPushButton {
border: 1px solid #455971;
padding: 2px;
color: #455971;
border-radius: 2px;
background-color: #FFFFFF;
text-align: center;
min-width: 82px;
}
QPushButton:hover {
background-color: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0.2 #FFF3FF, stop: 1 #FFFFFF);
border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
padding: 2px;
color: #455971;
}
QPushButton::pressed {
background-color: #f8edfb;
}
QPushButton:disabled {
border: 1px solid #b3b3b3;
color: #b3b3b3;
}
/* Spinboxes */
QSpinBox, QDoubleSpinBox {
border: 1px solid #455971;
padding: 2px;
color: #455971;
border-radius: 2px;
background-color: #FFFFFF;
}
QSpinBox:hover, QDoubleSpinBox:hover {
background-color: #FFFFFF;
border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
padding: 2px;
color: #455971;
}
QSpinBox::up-button, QSpinBox::down-button, QDoubleSpinBox::up-button, QDoubleSpinBox::down-button {
background: transparent;
}
QSpinBox:disabled, QDoubleSpinBox:disabled {
background-color: #b3b3b3;
color: #455971;
border: 1px solid #455971;
}
/* Libraries List */
QListWidget {
border: 1px solid #455971;
border-radius: 0.1em;
}
QListWidget:disabled, QListWidget:disabled:hover, QListWidget::item:disabled:hover {
border: 1px solid #999999;
background: #FFFFFF;
}
QListWidget::item:selected {
background-color: #FFFFFF;
color: #4343c1;
border-radius: 0.125em;
}
QListWidget::item:hover {
background-color: #FFFFFF;
color: #8500ae;
border-radius: 0.25em;
}
QListWidget::item:disabled {
color: #999999;
}
/* Title Bar & Docking Buttons */
QDockWidget::close-button, QDockWidget::float-button {
background: transparent;
}
QDockWidget::title#gamelist {
background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
}
QDockWidget#gamelist {
color: #FFFFFF;
}
/* Game Table */
QTableView {
selection-background-color: #4343c1;
selection-color: #FFFFFF;
border: none;
}
QTableView::item:hover {
color: #4343c1;
}
/* Progress Bar */
QProgressBar {
border: 1px solid #455971;
border-radius: 3px;
color: #000000;
text-align: center;
}
QProgressBar::chunk {
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
}
/* Pad Settings: Controller Image */
QLabel#l_controller {
color: #4343c1;
}
/* Game Icon Background */
QLabel#gamelist_icon_background_color {
color: transparent;
}
/* Table Headers */
QHeaderView {
border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
border-left: none;
border-right: none;
border-top: none;
}
QHeaderView::section {
background-color: #FFFFFF;
color: #455971;
padding-top: 3px;
padding-left: 3px;
height: 20px;
border: none;
}
QHeaderView::section:first {
padding-left: 5px;
}
/* Tooltips */
QToolTip {
background-color: #FFFFFF;
color: #8500ae;
padding: 0.1em;
border: none;
opacity: 225;
}
/* Log and Debugger Borders */
QDockWidget::title#logger {
background: #FFFFFF;
}
QDockWidget#logger {
color: transparent;
}
QTextEdit {
border-top: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
}
QLineEdit {
border: 1px solid #455971;
border-top: none;
border-left: none;
border-right: none;
}
QLineEdit:focus {
border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.25 #8500ae, stop: 0.5 #4343c1, stop: 1 #009ed0);
border-top: none;
border-left: none;
border-right: none;
}
/* Log colors */
QTextEdit#log_frame {
background-color: #FFFFFF;
}
QLabel#log_level_always {
color: #8500ae;
}
QLabel#log_level_fatal {
color: #b23345;
}
QLabel#log_level_error {
color: #e85545;
}
QLabel#log_level_todo {
color: #fbb81b;
}
QLabel#log_level_success {
color: #07c365;
}
QLabel#log_level_warning {
color: #e49000;
}
QLabel#log_level_notice {
color: #FFFFFF;
}
QLabel#log_level_trace {
color: #009ed0;
}
QLabel#log_stack {
color: #0071ec;
}
/* Debug UI Settings buttons */
QLabel#color_button {
background: transparent;
}
/* Set Windows Taskbar Thumbnail colors */
QLabel#thumbnail_icon_color {
color: #8500ae;
}
+1 -1
View File
@@ -25,7 +25,7 @@ aea993
/* Every widget */
QWidget {
font-family: SCE-PS3 Rodin LATIN, Arial;
font-family: SCE-PS3 Rodin LATIN;
font-size: 9.00pt;
color: #292929;
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Common default props for defining properties without macros. Import right before Microsoft.Cpp.Default.props -->
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="Globals">
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Common default props for defining properties with macros. Import right after Microsoft.Cpp.Default.props -->
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="Configuration">
<PlatformToolSet>$(DefaultPlatformToolset)</PlatformToolSet>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>
+1 -1
Submodule llvm updated: 5c906fd169...b860b5e8f4
+11 -9
View File
@@ -14,16 +14,16 @@
<ProjectGuid>{8BC303AB-25BE-4276-8E57-73F171B2D672}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -34,35 +34,37 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros" >
<CmakeGenerator>"Visual Studio $(VisualStudioVersion.Substring(0,2))"</CmakeGenerator>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<NMakePreprocessorDefinitions>
</NMakePreprocessorDefinitions>
<NMakeBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Debug /m
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Debug /m
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Debug /m
</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakePreprocessorDefinitions />
<NMakeBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Release /m
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Release /m
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=8.1 ../llvm
cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -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 -DWITH_POLLY=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) ../llvm
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Release /m
</NMakeCleanCommandLine>
</PropertyGroup>
+17 -1
View File
@@ -64,16 +64,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxpro
{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078} = {FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}
{FDC361C5-7734-493B-8CFB-037308B35122} = {FDC361C5-7734-493B-8CFB-037308B35122}
{8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hidapi", "hidapi", "{FA1E6C16-CA63-45F8-8D52-E21DF396BE36}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "3rdparty\hidapi\windows\hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "3rdparty\hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xxhash", "xxhash", "{D16E245C-CC5A-4B9A-8BAB-1176F02C1631}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxhash", "3rdparty\xxhash.vcxproj", "{939FE206-1182-ABC3-1234-FEAB88E98404}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libusb", "libusb", "{6D8E86F7-84A0-45BA-ACC3-F02FC5545B3B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "3rdparty\libusb_static.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - LLVM|x64 = Debug - LLVM|x64
@@ -232,6 +237,16 @@ Global
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release - LLVM|x64.Build.0 = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release|x64.ActiveCfg = Release|x64
{939FE206-1182-ABC3-1234-FEAB88E98404}.Release|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug - LLVM|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug - MemLeak|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release - LLVM|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release - LLVM|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -252,6 +267,7 @@ Global
{FDC361C5-7734-493B-8CFB-037308B35122} = {DDF904CA-2771-441A-8629-5DF2EB922A79}
{A107C21C-418A-4697-BB10-20C3AA60E2E4} = {FA1E6C16-CA63-45F8-8D52-E21DF396BE36}
{939FE206-1182-ABC3-1234-FEAB88E98404} = {D16E245C-CC5A-4B9A-8BAB-1176F02C1631}
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {6D8E86F7-84A0-45BA-ACC3-F02FC5545B3B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06CC7920-E085-4B81-9582-8DE8AAD42510}
+24 -14
View File
@@ -1,11 +1,9 @@
cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.8.2)
include(cotire)
# Generate git-version.h at build time.
add_custom_target(GitVersion ALL
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
# Check for a sufficient compiler and set build options
include(ConfigureCompiler)
@@ -37,31 +35,43 @@ include(${CMAKE_SOURCE_DIR}/3rdparty/qt5.cmake)
add_subdirectory(Emu)
add_subdirectory(rpcs3qt)
file(GLOB RPCS3_SRC "*.cpp")
set(RPCS3_SRC
basic_keyboard_handler.cpp
basic_mouse_handler.cpp
ds3_pad_handler.cpp
ds4_pad_handler.cpp
evdev_joystick_handler.cpp
headless_application.cpp
keyboard_pad_handler.cpp
main.cpp
main_application.cpp
mm_joystick_handler.cpp
pad_thread.cpp
rpcs3_version.cpp
stb_image.cpp
stdafx.cpp
xinput_pad_handler.cpp
)
if(WIN32)
add_executable(rpcs3 WIN32 ${RPCS3_SRC})
elseif(APPLE)
set(MACOSX_BUNDLE_BUNDLE_NAME rpcs3)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "net.rpcs3.rpcs3")
set(MACOSX_BUNDLE_INFO_STRING "Open-source Sony PlayStation 3 emulator")
set(MACOSX_BUNDLE_ICON_FILE "rpcs3.icns")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "0.0.5")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.0.5")
set(MACOSX_BUNDLE_BUNDLE_VERSION "0.0.5")
add_executable(rpcs3 MACOSX_BUNDLE ${RPCS3_SRC} "${RPCS3_SRC_DIR}/rpcs3.icns")
set_target_properties(rpcs3
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${RPCS3_SRC_DIR}/rpcs3.plist.in")
else()
add_executable(rpcs3 ${RPCS3_SRC})
endif()
add_dependencies(rpcs3 GitVersion)
gen_git_version(${RPCS3_SRC_DIR})
set_target_properties(rpcs3
PROPERTIES
AUTOMOC ON
AUTOUIC ON)
target_link_libraries(rpcs3 rpcs3_emu rpcs3_ui)
target_link_libraries(rpcs3 3rdparty::discord-rpc 3rdparty::qt5 3rdparty::hidapi)
target_link_libraries(rpcs3 3rdparty::discord-rpc 3rdparty::qt5 3rdparty::hidapi 3rdparty::libusb)
target_link_libraries(rpcs3 ${ADDITIONAL_LIBS})
# Win resource file
+15
View File
@@ -30,6 +30,7 @@
*/
#include "aes.h"
#include "aesni.h"
/*
* 32-bit integer manipulation macros (little endian)
@@ -458,6 +459,9 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int key
ctx->rk = RK = ctx->buf;
if( aesni_supports( POLARSSL_AESNI_AES ) )
return( aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize ) );
for( i = 0; i < (keysize >> 5); i++ )
{
GET_UINT32_LE( RK[i], key, i << 2 );
@@ -558,6 +562,13 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
if( ret != 0 )
return( ret );
if( aesni_supports( POLARSSL_AESNI_AES ) )
{
aesni_inverse_key( (unsigned char *) ctx->rk,
(const unsigned char *) cty.rk, ctx->nr );
goto done;
}
SK = cty.rk + cty.nr * 4;
*RK++ = *SK++;
@@ -581,6 +592,7 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
*RK++ = *SK++;
*RK++ = *SK++;
done:
memset( &cty, 0, sizeof( aes_context ) );
return( 0 );
@@ -643,6 +655,9 @@ int aes_crypt_ecb( aes_context *ctx,
int i;
uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
if( aesni_supports( POLARSSL_AESNI_AES ) )
return( aesni_crypt_ecb( ctx, mode, input, output ) );
RK = ctx->rk;
GET_UINT32_LE( X0, input, 0 ); X0 ^= *RK++;
+682
View File
@@ -0,0 +1,682 @@
/*
* AES-NI support functions
*
* Copyright (C) 2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* [AES-WP] http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-aes-instructions-set
* [CLMUL-WP] http://software.intel.com/en-us/articles/intel-carry-less-multiplication-instruction-and-its-usage-for-computing-the-gcm-mode/
*/
#include "aesni.h"
#if defined(_MSC_VER) && defined(_M_X64)
#define POLARSSL_HAVE_MSVC_X64_INTRINSICS
#include <intrin.h>
#endif
/*
* AES-NI support detection routine
*/
int aesni_supports( unsigned int what )
{
static int done = 0;
static unsigned int c = 0;
if( ! done )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
int regs[4]; // eax, ebx, ecx, edx
__cpuid( regs, 1 );
c = regs[2];
#else
asm( "movl $1, %%eax \n"
"cpuid \n"
: "=c" (c)
:
: "eax", "ebx", "edx" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
done = 1;
}
return( ( c & what ) != 0 );
}
/*
* AES-NI AES-ECB block en(de)cryption
*/
int aesni_crypt_ecb( aes_context *ctx,
int mode,
const unsigned char input[16],
unsigned char output[16] )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
__m128i* rk, a;
int i;
rk = (__m128i*)ctx->rk;
a = _mm_xor_si128( _mm_loadu_si128( (__m128i*)input ), _mm_loadu_si128( rk++ ) );
if (mode == AES_ENCRYPT)
{
for (i = ctx->nr - 1; i; --i)
a = _mm_aesenc_si128( a, _mm_loadu_si128( rk++ ) );
a = _mm_aesenclast_si128( a, _mm_loadu_si128( rk ) );
}
else
{
for (i = ctx->nr - 1; i; --i)
a = _mm_aesdec_si128( a, _mm_loadu_si128( rk++ ) );
a = _mm_aesdeclast_si128( a, _mm_loadu_si128( rk ) );
}
_mm_storeu_si128( (__m128i*)output, a );
#else
asm( "movdqu (%3), %%xmm0 \n" // load input
"movdqu (%1), %%xmm1 \n" // load round key 0
"pxor %%xmm1, %%xmm0 \n" // round 0
"addq $16, %1 \n" // point to next round key
"subl $1, %0 \n" // normal rounds = nr - 1
"test %2, %2 \n" // mode?
"jz 2f \n" // 0 = decrypt
"1: \n" // encryption loop
"movdqu (%1), %%xmm1 \n" // load round key
"aesenc %%xmm1, %%xmm0 \n" // do round
"addq $16, %1 \n" // point to next round key
"subl $1, %0 \n" // loop
"jnz 1b \n"
"movdqu (%1), %%xmm1 \n" // load round key
"aesenclast %%xmm1, %%xmm0 \n" // last round
"jmp 3f \n"
"2: \n" // decryption loop
"movdqu (%1), %%xmm1 \n"
"aesdec %%xmm1, %%xmm0 \n"
"addq $16, %1 \n"
"subl $1, %0 \n"
"jnz 2b \n"
"movdqu (%1), %%xmm1 \n" // load round key
"aesdeclast %%xmm1, %%xmm0 \n" // last round
"3: \n"
"movdqu %%xmm0, (%4) \n" // export output
:
: "r" (ctx->nr), "r" (ctx->rk), "r" (mode), "r" (input), "r" (output)
: "memory", "cc", "xmm0", "xmm1" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
return( 0 );
}
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
static inline void clmul256( __m128i a, __m128i b, __m128i* r0, __m128i* r1 )
{
__m128i c, d, e, f, ef;
c = _mm_clmulepi64_si128( a, b, 0x00 );
d = _mm_clmulepi64_si128( a, b, 0x11 );
e = _mm_clmulepi64_si128( a, b, 0x10 );
f = _mm_clmulepi64_si128( a, b, 0x01 );
// r0 = f0^e0^c1:c0 = c1:c0 ^ f0^e0:0
// r1 = d1:f1^e1^d0 = d1:d0 ^ 0:f1^e1
ef = _mm_xor_si128( e, f );
*r0 = _mm_xor_si128( c, _mm_slli_si128( ef, 8 ) );
*r1 = _mm_xor_si128( d, _mm_srli_si128( ef, 8 ) );
}
static inline void sll256( __m128i a0, __m128i a1, __m128i* s0, __m128i* s1 )
{
__m128i l0, l1, r0, r1;
l0 = _mm_slli_epi64( a0, 1 );
l1 = _mm_slli_epi64( a1, 1 );
r0 = _mm_srli_epi64( a0, 63 );
r1 = _mm_srli_epi64( a1, 63 );
*s0 = _mm_or_si128( l0, _mm_slli_si128( r0, 8 ) );
*s1 = _mm_or_si128( _mm_or_si128( l1, _mm_srli_si128( r0, 8 ) ), _mm_slli_si128( r1, 8 ) );
}
static inline __m128i reducemod128( __m128i x10, __m128i x32 )
{
__m128i a, b, c, dx0, e, f, g, h;
// (1) left shift x0 by 63, 62 and 57
a = _mm_slli_epi64( x10, 63 );
b = _mm_slli_epi64( x10, 62 );
c = _mm_slli_epi64( x10, 57 );
// (2) compute D xor'ing a, b, c and x1
// d:x0 = x1:x0 ^ [a^b^c:0]
dx0 = _mm_xor_si128( x10, _mm_slli_si128( _mm_xor_si128( _mm_xor_si128( a, b ), c ), 8 ) );
// (3) right shift [d:x0] by 1, 2, 7
e = _mm_or_si128( _mm_srli_epi64( dx0, 1 ), _mm_srli_si128( _mm_slli_epi64( dx0, 63 ), 8 ) );
f = _mm_or_si128( _mm_srli_epi64( dx0, 2 ), _mm_srli_si128( _mm_slli_epi64( dx0, 62 ), 8 ) );
g = _mm_or_si128( _mm_srli_epi64( dx0, 7 ), _mm_srli_si128( _mm_slli_epi64( dx0, 57 ), 8 ) );
// (4) compute h = d^e1^f1^g1 : x0^e0^f0^g0
h = _mm_xor_si128( dx0, _mm_xor_si128( e, _mm_xor_si128( f, g ) ) );
// result is x3^h1:x2^h0
return _mm_xor_si128( x32, h );
}
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
/*
* GCM multiplication: c = a times b in GF(2^128)
* Based on [CLMUL-WP] algorithms 1 (with equation 27) and 5.
*/
void aesni_gcm_mult( unsigned char c[16],
const unsigned char a[16],
const unsigned char b[16] )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
__m128i xa, xb, m0, m1, x10, x32, r;
xa.m128i_u64[1] = _byteswap_uint64( *((unsigned __int64*)a + 0) );
xa.m128i_u64[0] = _byteswap_uint64( *((unsigned __int64*)a + 1) );
xb.m128i_u64[1] = _byteswap_uint64( *((unsigned __int64*)b + 0) );
xb.m128i_u64[0] = _byteswap_uint64( *((unsigned __int64*)b + 1) );
clmul256( xa, xb, &m0, &m1 );
sll256( m0, m1, &x10, &x32 );
r = reducemod128( x10, x32 );
*((unsigned __int64*)c + 0) = _byteswap_uint64( r.m128i_u64[1] );
*((unsigned __int64*)c + 1) = _byteswap_uint64( r.m128i_u64[0] );
#else
unsigned char aa[16], bb[16], cc[16];
size_t i;
/* The inputs are in big-endian order, so byte-reverse them */
for( i = 0; i < 16; i++ )
{
aa[i] = a[15 - i];
bb[i] = b[15 - i];
}
asm( "movdqu (%0), %%xmm0 \n" // a1:a0
"movdqu (%1), %%xmm1 \n" // b1:b0
/*
* Caryless multiplication xmm2:xmm1 = xmm0 * xmm1
* using [CLMUL-WP] algorithm 1 (p. 13).
*/
"movdqa %%xmm1, %%xmm2 \n" // copy of b1:b0
"movdqa %%xmm1, %%xmm3 \n" // same
"movdqa %%xmm1, %%xmm4 \n" // same
"pclmulqdq $0x00, %%xmm0, %%xmm1 \n" // a0*b0 = c1:c0
"pclmulqdq $0x11, %%xmm0, %%xmm2 \n" // a1*b1 = d1:d0
"pclmulqdq $0x10, %%xmm0, %%xmm3 \n" // a0*b1 = e1:e0
"pclmulqdq $0x01, %%xmm0, %%xmm4 \n" // a1*b0 = f1:f0
"pxor %%xmm3, %%xmm4 \n" // e1+f1:e0+f0
"movdqa %%xmm4, %%xmm3 \n" // same
"psrldq $8, %%xmm4 \n" // 0:e1+f1
"pslldq $8, %%xmm3 \n" // e0+f0:0
"pxor %%xmm4, %%xmm2 \n" // d1:d0+e1+f1
"pxor %%xmm3, %%xmm1 \n" // c1+e0+f1:c0
/*
* Now shift the result one bit to the left,
* taking advantage of [CLMUL-WP] eq 27 (p. 20)
*/
"movdqa %%xmm1, %%xmm3 \n" // r1:r0
"movdqa %%xmm2, %%xmm4 \n" // r3:r2
"psllq $1, %%xmm1 \n" // r1<<1:r0<<1
"psllq $1, %%xmm2 \n" // r3<<1:r2<<1
"psrlq $63, %%xmm3 \n" // r1>>63:r0>>63
"psrlq $63, %%xmm4 \n" // r3>>63:r2>>63
"movdqa %%xmm3, %%xmm5 \n" // r1>>63:r0>>63
"pslldq $8, %%xmm3 \n" // r0>>63:0
"pslldq $8, %%xmm4 \n" // r2>>63:0
"psrldq $8, %%xmm5 \n" // 0:r1>>63
"por %%xmm3, %%xmm1 \n" // r1<<1|r0>>63:r0<<1
"por %%xmm4, %%xmm2 \n" // r3<<1|r2>>62:r2<<1
"por %%xmm5, %%xmm2 \n" // r3<<1|r2>>62:r2<<1|r1>>63
/*
* Now reduce modulo the GCM polynomial x^128 + x^7 + x^2 + x + 1
* using [CLMUL-WP] algorithm 5 (p. 20).
* Currently xmm2:xmm1 holds x3:x2:x1:x0 (already shifted).
*/
/* Step 2 (1) */
"movdqa %%xmm1, %%xmm3 \n" // x1:x0
"movdqa %%xmm1, %%xmm4 \n" // same
"movdqa %%xmm1, %%xmm5 \n" // same
"psllq $63, %%xmm3 \n" // x1<<63:x0<<63 = stuff:a
"psllq $62, %%xmm4 \n" // x1<<62:x0<<62 = stuff:b
"psllq $57, %%xmm5 \n" // x1<<57:x0<<57 = stuff:c
/* Step 2 (2) */
"pxor %%xmm4, %%xmm3 \n" // stuff:a+b
"pxor %%xmm5, %%xmm3 \n" // stuff:a+b+c
"pslldq $8, %%xmm3 \n" // a+b+c:0
"pxor %%xmm3, %%xmm1 \n" // x1+a+b+c:x0 = d:x0
/* Steps 3 and 4 */
"movdqa %%xmm1,%%xmm0 \n" // d:x0
"movdqa %%xmm1,%%xmm4 \n" // same
"movdqa %%xmm1,%%xmm5 \n" // same
"psrlq $1, %%xmm0 \n" // e1:x0>>1 = e1:e0'
"psrlq $2, %%xmm4 \n" // f1:x0>>2 = f1:f0'
"psrlq $7, %%xmm5 \n" // g1:x0>>7 = g1:g0'
"pxor %%xmm4, %%xmm0 \n" // e1+f1:e0'+f0'
"pxor %%xmm5, %%xmm0 \n" // e1+f1+g1:e0'+f0'+g0'
// e0'+f0'+g0' is almost e0+f0+g0, except for some missing
// bits carried from d. Now get those bits back in.
"movdqa %%xmm1,%%xmm3 \n" // d:x0
"movdqa %%xmm1,%%xmm4 \n" // same
"movdqa %%xmm1,%%xmm5 \n" // same
"psllq $63, %%xmm3 \n" // d<<63:stuff
"psllq $62, %%xmm4 \n" // d<<62:stuff
"psllq $57, %%xmm5 \n" // d<<57:stuff
"pxor %%xmm4, %%xmm3 \n" // d<<63+d<<62:stuff
"pxor %%xmm5, %%xmm3 \n" // missing bits of d:stuff
"psrldq $8, %%xmm3 \n" // 0:missing bits of d
"pxor %%xmm3, %%xmm0 \n" // e1+f1+g1:e0+f0+g0
"pxor %%xmm1, %%xmm0 \n" // h1:h0
"pxor %%xmm2, %%xmm0 \n" // x3+h1:x2+h0
"movdqu %%xmm0, (%2) \n" // done
:
: "r" (aa), "r" (bb), "r" (cc)
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" );
/* Now byte-reverse the outputs */
for( i = 0; i < 16; i++ )
c[i] = cc[15 - i];
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
return;
}
/*
* Compute decryption round keys from encryption round keys
*/
void aesni_inverse_key( unsigned char *invkey,
const unsigned char *fwdkey, int nr )
{
unsigned char *ik = invkey;
const unsigned char *fk = fwdkey + 16 * nr;
memcpy( ik, fk, 16 );
for( fk -= 16, ik += 16; fk > fwdkey; fk -= 16, ik += 16 )
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
_mm_storeu_si128( (__m128i*)ik, _mm_aesimc_si128( _mm_loadu_si128( (__m128i*)fk) ) );
#else
asm( "movdqu (%0), %%xmm0 \n"
"aesimc %%xmm0, %%xmm0 \n"
"movdqu %%xmm0, (%1) \n"
:
: "r" (fk), "r" (ik)
: "memory", "xmm0" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
memcpy( ik, fk, 16 );
}
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
inline static __m128i aes_key_128_assist( __m128i key, __m128i kg )
{
key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) );
key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) );
key = _mm_xor_si128( key, _mm_slli_si128( key, 4 ) );
kg = _mm_shuffle_epi32( kg, _MM_SHUFFLE( 3, 3, 3, 3 ) );
return _mm_xor_si128( key, kg );
}
// [AES-WP] Part of Fig. 25 page 32
inline static void aes_key_192_assist( __m128i* temp1, __m128i * temp3, __m128i kg )
{
__m128i temp4;
kg = _mm_shuffle_epi32( kg, 0x55 );
temp4 = _mm_slli_si128( *temp1, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
*temp1 = _mm_xor_si128( *temp1, kg );
kg = _mm_shuffle_epi32( *temp1, 0xff );
temp4 = _mm_slli_si128( *temp3, 0x4 );
*temp3 = _mm_xor_si128( *temp3, temp4 );
*temp3 = _mm_xor_si128( *temp3, kg );
}
// [AES-WP] Part of Fig. 26 page 34
inline static void aes_key_256_assist_1( __m128i* temp1, __m128i kg )
{
__m128i temp4;
kg = _mm_shuffle_epi32( kg, 0xff );
temp4 = _mm_slli_si128( *temp1, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp1 = _mm_xor_si128( *temp1, temp4 );
*temp1 = _mm_xor_si128( *temp1, kg );
}
inline static void aes_key_256_assist_2( __m128i* temp1, __m128i* temp3 )
{
__m128i temp2, temp4;
temp4 = _mm_aeskeygenassist_si128( *temp1, 0x0 );
temp2 = _mm_shuffle_epi32( temp4, 0xaa );
temp4 = _mm_slli_si128( *temp3, 0x4 );
*temp3 = _mm_xor_si128( *temp3, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp3 = _mm_xor_si128( *temp3, temp4 );
temp4 = _mm_slli_si128( temp4, 0x4 );
*temp3 = _mm_xor_si128( *temp3, temp4 );
*temp3 = _mm_xor_si128( *temp3, temp2 );
}
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
/*
* Key expansion, 128-bit case
*/
static void aesni_setkey_enc_128( unsigned char *rk,
const unsigned char *key )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
__m128i* xrk, k;
xrk = (__m128i*)rk;
#define EXPAND_ROUND(k, rcon) \
_mm_storeu_si128( xrk++, k ); \
k = aes_key_128_assist( k, _mm_aeskeygenassist_si128( k, rcon ) )
k = _mm_loadu_si128( (__m128i*)key );
EXPAND_ROUND( k, 0x01 );
EXPAND_ROUND( k, 0x02 );
EXPAND_ROUND( k, 0x04 );
EXPAND_ROUND( k, 0x08 );
EXPAND_ROUND( k, 0x10 );
EXPAND_ROUND( k, 0x20 );
EXPAND_ROUND( k, 0x40 );
EXPAND_ROUND( k, 0x80 );
EXPAND_ROUND( k, 0x1b );
EXPAND_ROUND( k, 0x36 );
_mm_storeu_si128( xrk, k );
#undef EXPAND_ROUND
#else
asm( "movdqu (%1), %%xmm0 \n" // copy the original key
"movdqu %%xmm0, (%0) \n" // as round key 0
"jmp 2f \n" // skip auxiliary routine
/*
* Finish generating the next round key.
*
* On entry xmm0 is r3:r2:r1:r0 and xmm1 is X:stuff:stuff:stuff
* with X = rot( sub( r3 ) ) ^ RCON.
*
* On exit, xmm0 is r7:r6:r5:r4
* with r4 = X + r0, r5 = r4 + r1, r6 = r5 + r2, r7 = r6 + r3
* and those are written to the round key buffer.
*/
"1: \n"
"pshufd $0xff, %%xmm1, %%xmm1 \n" // X:X:X:X
"pxor %%xmm0, %%xmm1 \n" // X+r3:X+r2:X+r1:r4
"pslldq $4, %%xmm0 \n" // r2:r1:r0:0
"pxor %%xmm0, %%xmm1 \n" // X+r3+r2:X+r2+r1:r5:r4
"pslldq $4, %%xmm0 \n" // etc
"pxor %%xmm0, %%xmm1 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm1, %%xmm0 \n" // update xmm0 for next time!
"add $16, %0 \n" // point to next round key
"movdqu %%xmm0, (%0) \n" // write it
"ret \n"
/* Main "loop" */
"2: \n"
"aeskeygenassist $0x01, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x02, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x04, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x08, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x10, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x20, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x40, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x80, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x1B, %%xmm0, %%xmm1 \ncall 1b \n"
"aeskeygenassist $0x36, %%xmm0, %%xmm1 \ncall 1b \n"
:
: "r" (rk), "r" (key)
: "memory", "cc", "0" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
}
/*
* Key expansion, 192-bit case
*/
static void aesni_setkey_enc_192( unsigned char *rk,
const unsigned char *key )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
__m128i temp1, temp3;
__m128i *key_schedule = (__m128i*)rk;
temp1 = _mm_loadu_si128( (__m128i*)key );
temp3 = _mm_loadu_si128( (__m128i*)(key + 16) );
key_schedule[0] = temp1;
key_schedule[1] = temp3;
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128(temp3, 0x1) );
key_schedule[1] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[1] ), _mm_castsi128_pd( temp1 ), 0 ) );
key_schedule[2] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) );
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x2 ) );
key_schedule[3] = temp1;
key_schedule[4] = temp3;
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x4 ) );
key_schedule[4] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[4] ), _mm_castsi128_pd( temp1 ), 0 ) );
key_schedule[5] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) );
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x8 ) );
key_schedule[6] = temp1;
key_schedule[7] = temp3;
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x10 ) );
key_schedule[7] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[7] ), _mm_castsi128_pd( temp1 ), 0 ) );
key_schedule[8] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) );
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x20 ) );
key_schedule[9] = temp1;
key_schedule[10] = temp3;
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x40 ) );
key_schedule[10] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( key_schedule[10] ), _mm_castsi128_pd( temp1 ), 0 ) );
key_schedule[11] = _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( temp1 ), _mm_castsi128_pd( temp3 ), 1 ) );
aes_key_192_assist( &temp1, &temp3, _mm_aeskeygenassist_si128( temp3, 0x80 ) );
key_schedule[12] = temp1;
#else
asm( "movdqu (%1), %%xmm0 \n" // copy original round key
"movdqu %%xmm0, (%0) \n"
"add $16, %0 \n"
"movq 16(%1), %%xmm1 \n"
"movq %%xmm1, (%0) \n"
"add $8, %0 \n"
"jmp 2f \n" // skip auxiliary routine
/*
* Finish generating the next 6 quarter-keys.
*
* On entry xmm0 is r3:r2:r1:r0, xmm1 is stuff:stuff:r5:r4
* and xmm2 is stuff:stuff:X:stuff with X = rot( sub( r3 ) ) ^ RCON.
*
* On exit, xmm0 is r9:r8:r7:r6 and xmm1 is stuff:stuff:r11:r10
* and those are written to the round key buffer.
*/
"1: \n"
"pshufd $0x55, %%xmm2, %%xmm2 \n" // X:X:X:X
"pxor %%xmm0, %%xmm2 \n" // X+r3:X+r2:X+r1:r4
"pslldq $4, %%xmm0 \n" // etc
"pxor %%xmm0, %%xmm2 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm0, %%xmm2 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm2, %%xmm0 \n" // update xmm0 = r9:r8:r7:r6
"movdqu %%xmm0, (%0) \n"
"add $16, %0 \n"
"pshufd $0xff, %%xmm0, %%xmm2 \n" // r9:r9:r9:r9
"pxor %%xmm1, %%xmm2 \n" // stuff:stuff:r9+r5:r10
"pslldq $4, %%xmm1 \n" // r2:r1:r0:0
"pxor %%xmm2, %%xmm1 \n" // update xmm1 = stuff:stuff:r11:r10
"movq %%xmm1, (%0) \n"
"add $8, %0 \n"
"ret \n"
"2: \n"
"aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x80, %%xmm1, %%xmm2 \ncall 1b \n"
:
: "r" (rk), "r" (key)
: "memory", "cc", "0" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
}
/*
* Key expansion, 256-bit case
*/
static void aesni_setkey_enc_256( unsigned char *rk,
const unsigned char *key )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
__m128i temp1, temp3;
__m128i *key_schedule = (__m128i*)rk;
temp1 = _mm_loadu_si128( (__m128i*)key );
temp3 = _mm_loadu_si128( (__m128i*)(key + 16) );
key_schedule[0] = temp1;
key_schedule[1] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x01 ) );
key_schedule[2] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[3] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x02 ) );
key_schedule[4] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[5] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x04 ) );
key_schedule[6] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[7] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x08 ) );
key_schedule[8] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[9] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x10 ) );
key_schedule[10] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[11] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x20 ) );
key_schedule[12] = temp1;
aes_key_256_assist_2( &temp1, &temp3 );
key_schedule[13] = temp3;
aes_key_256_assist_1( &temp1, _mm_aeskeygenassist_si128( temp3, 0x40 ) );
key_schedule[14] = temp1;
#else
asm( "movdqu (%1), %%xmm0 \n"
"movdqu %%xmm0, (%0) \n"
"add $16, %0 \n"
"movdqu 16(%1), %%xmm1 \n"
"movdqu %%xmm1, (%0) \n"
"jmp 2f \n" // skip auxiliary routine
/*
* Finish generating the next two round keys.
*
* On entry xmm0 is r3:r2:r1:r0, xmm1 is r7:r6:r5:r4 and
* xmm2 is X:stuff:stuff:stuff with X = rot( sub( r7 )) ^ RCON
*
* On exit, xmm0 is r11:r10:r9:r8 and xmm1 is r15:r14:r13:r12
* and those have been written to the output buffer.
*/
"1: \n"
"pshufd $0xff, %%xmm2, %%xmm2 \n"
"pxor %%xmm0, %%xmm2 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm0, %%xmm2 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm0, %%xmm2 \n"
"pslldq $4, %%xmm0 \n"
"pxor %%xmm2, %%xmm0 \n"
"add $16, %0 \n"
"movdqu %%xmm0, (%0) \n"
/* Set xmm2 to stuff:Y:stuff:stuff with Y = subword( r11 )
* and proceed to generate next round key from there */
"aeskeygenassist $0, %%xmm0, %%xmm2\n"
"pshufd $0xaa, %%xmm2, %%xmm2 \n"
"pxor %%xmm1, %%xmm2 \n"
"pslldq $4, %%xmm1 \n"
"pxor %%xmm1, %%xmm2 \n"
"pslldq $4, %%xmm1 \n"
"pxor %%xmm1, %%xmm2 \n"
"pslldq $4, %%xmm1 \n"
"pxor %%xmm2, %%xmm1 \n"
"add $16, %0 \n"
"movdqu %%xmm1, (%0) \n"
"ret \n"
/*
* Main "loop" - Generating one more key than necessary,
* see definition of aes_context.buf
*/
"2: \n"
"aeskeygenassist $0x01, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x02, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x04, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x08, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x10, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x20, %%xmm1, %%xmm2 \ncall 1b \n"
"aeskeygenassist $0x40, %%xmm1, %%xmm2 \ncall 1b \n"
:
: "r" (rk), "r" (key)
: "memory", "cc", "0" );
#endif /* POLARSSL_HAVE_MSVC_X64_INTRINSICS */
}
/*
* Key expansion, wrapper
*/
int aesni_setkey_enc( unsigned char *rk,
const unsigned char *key,
size_t bits )
{
switch( bits )
{
case 128: aesni_setkey_enc_128( rk, key ); break;
case 192: aesni_setkey_enc_192( rk, key ); break;
case 256: aesni_setkey_enc_256( rk, key ); break;
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
}
return( 0 );
}
+103
View File
@@ -0,0 +1,103 @@
#pragma once
#define POLARSSL_HAVE_ASM
/**
* \file aesni.h
*
* \brief AES-NI for hardware AES acceleration on some Intel processors
*
* Copyright (C) 2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "aes.h"
#define POLARSSL_AESNI_AES 0x02000000u
#define POLARSSL_AESNI_CLMUL 0x00000002u
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief AES-NI features detection routine
*
* \param what The feature to detect
* (POLARSSL_AESNI_AES or POLARSSL_AESNI_CLMUL)
*
* \return 1 if CPU has support for the feature, 0 otherwise
*/
int aesni_supports( unsigned int what );
/**
* \brief AES-NI AES-ECB block en(de)cryption
*
* \param ctx AES context
* \param mode AES_ENCRYPT or AES_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
* \return 0 on success (cannot fail)
*/
int aesni_crypt_ecb( aes_context *ctx,
int mode,
const unsigned char input[16],
unsigned char output[16] );
/**
* \brief GCM multiplication: c = a * b in GF(2^128)
*
* \param c Result
* \param a First operand
* \param b Second operand
*
* \note Both operands and result are bit strings interpreted as
* elements of GF(2^128) as per the GCM spec.
*/
void aesni_gcm_mult( unsigned char c[16],
const unsigned char a[16],
const unsigned char b[16] );
/**
* \brief Compute decryption round keys from encryption round keys
*
* \param invkey Round keys for the equivalent inverse cipher
* \param fwdkey Original round keys (for encryption)
* \param nr Number of rounds (that is, number of round keys minus one)
*/
void aesni_inverse_key( unsigned char *invkey,
const unsigned char *fwdkey, int nr );
/**
* \brief Perform key expansion (for encryption)
*
* \param rk Destination buffer where the round keys are written
* \param key Encryption key
* \param bits Key size in bits (must be 128, 192 or 256)
*
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
*/
int aesni_setkey_enc( unsigned char *rk,
const unsigned char *key,
size_t bits );
#ifdef __cplusplus
}
#endif
+2
View File
@@ -1,5 +1,7 @@
#pragma once
#include "Utilities/types.h"
#include <string>
#include <vector>
#include <memory>
+6 -6
View File
@@ -1,11 +1,11 @@
#pragma once
#include <stdio.h>
#include <string.h>
#include <array>
#include "utils.h"
#include "Utilities/File.h"
constexpr u32 SDAT_FLAG = 0x01000000;
constexpr u32 EDAT_COMPRESSED_FLAG = 0x00000001;
constexpr u32 EDAT_FLAG_0x02 = 0x00000002;
@@ -14,7 +14,7 @@ constexpr u32 EDAT_FLAG_0x10 = 0x00000010;
constexpr u32 EDAT_FLAG_0x20 = 0x00000020;
constexpr u32 EDAT_DEBUG_DATA_FLAG = 0x80000000;
struct LoadedNpdrmKeys_t
struct loaded_npdrm_keys
{
std::array<u8, 0x10> devKlic{};
std::array<u8, 0x10> rifKey{};
@@ -77,7 +77,7 @@ public:
: edata_file(std::move(input)), rif_key(rif_key), dev_key(dev_key) {}
~EDATADecrypter() override {}
// false if invalid
// false if invalid
bool ReadHeader();
u64 ReadData(u64 pos, u8* data, u64 size);
@@ -92,10 +92,10 @@ public:
stats.mtime = -1;
return stats;
}
bool trunc(u64 length) override
bool trunc(u64 length) override
{
return true;
};
}
u64 read(void* buffer, u64 size) override
{
u64 bytesRead = ReadData(pos, (u8*)buffer, size);
+1 -1
View File
@@ -201,7 +201,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
bool was_null = true;
// Get full path and create the directory
const std::string dir = Emu.GetHddDir() + "game/" + install_id + '/';
const std::string dir = Emulator::GetHddDir() + "game/" + install_id + '/';
if (!fs::create_dir(dir))
{
+2
View File
@@ -1,5 +1,7 @@
#pragma once
#include "Utilities/BEType.h"
// Constants
enum
{
+4
View File
@@ -3,6 +3,10 @@
#include "key_vault.h"
#include "zlib.h"
#include "Utilities/types.h"
#include "Utilities/File.h"
#include "Utilities/Log.h"
struct AppInfo
{
u64 authid;
+3 -3
View File
@@ -25,13 +25,13 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{FAC9B17B-F4B8-4B75-8AEB-C8C7CB92B078}</ProjectGuid>
<RootNamespace>D3D12GSRender</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="..\common_default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -96,4 +96,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
+1 -1
View File
@@ -128,7 +128,7 @@ bool OpenALBackend::AddData(const void* src, u32 num_samples)
// Fail if there are no free buffers remaining
if (m_num_unqueued == 0)
{
LOG_WARNING(GENERAL, "XAudio2Backend : no unqueued buffers remaining");
LOG_WARNING(GENERAL, "OpenALBackend : no unqueued buffers remaining");
return false;
}
+2 -2
View File
@@ -24,10 +24,10 @@ public:
OpenALBackend();
virtual ~OpenALBackend() override;
virtual const char* GetName() const override { return "OpenAL"; };
virtual const char* GetName() const override { return "OpenAL"; }
static const u32 capabilities = PLAY_PAUSE_FLUSH | IS_PLAYING | GET_NUM_ENQUEUED_SAMPLES | SET_FREQUENCY_RATIO;
virtual u32 GetCapabilities() const override { return capabilities; };
virtual u32 GetCapabilities() const override { return capabilities; }
virtual void Open(u32 num_buffers) override;
virtual void Close() override;
+2 -2
View File
@@ -16,10 +16,10 @@ public:
ALSABackend();
virtual ~ALSABackend() override;
virtual const char* GetName() const override { return "ALSA"; };
virtual const char* GetName() const override { return "ALSA"; }
static const u32 capabilities = 0;
virtual u32 GetCapabilities() const override { return capabilities; };
virtual u32 GetCapabilities() const override { return capabilities; }
virtual void Open(u32) override;
virtual void Close() override;
+3
View File
@@ -1,5 +1,8 @@
#pragma once
#include "Utilities/types.h"
#include "Utilities/File.h"
struct WAVHeader
{
struct RIFFHeader
+8 -8
View File
@@ -8,17 +8,17 @@ public:
NullAudioBackend() {}
virtual ~NullAudioBackend() {}
virtual const char* GetName() const override { return "Null"; }
virtual const char* GetName() const override { return "Null"; }
static const u32 capabilities = PLAY_PAUSE_FLUSH;
virtual u32 GetCapabilities() const override { return capabilities; };
virtual u32 GetCapabilities() const override { return capabilities; }
virtual void Open(u32) override {};
virtual void Close() override {};
virtual void Open(u32) override {}
virtual void Close() override {}
virtual void Play() override {};
virtual void Pause() override {};
virtual void Play() override {}
virtual void Pause() override {}
virtual bool AddData(const void*, u32) override { return true; };
virtual void Flush() override {};
virtual bool AddData(const void*, u32) override { return true; }
virtual void Flush() override {}
};
+2 -2
View File
@@ -10,10 +10,10 @@ public:
PulseBackend();
virtual ~PulseBackend() override;
virtual const char* GetName() const override { return "Pulse"; };
virtual const char* GetName() const override { return "Pulse"; }
static const u32 capabilities = 0;
virtual u32 GetCapabilities() const override { return capabilities; };
virtual u32 GetCapabilities() const override { return capabilities; }
virtual void Open(u32) override;
virtual void Close() override;
+321 -36
View File
@@ -1,6 +1,8 @@
file(GLOB SRC_FILES "*.cpp")
add_library(rpcs3_emu ${SRC_FILES})
add_library(rpcs3_emu
IdManager.cpp
System.cpp
VFS.cpp
)
target_link_libraries(rpcs3_emu
PRIVATE
@@ -15,8 +17,26 @@ target_include_directories(rpcs3_emu
# Utilities
file(GLOB UTILITIES_SRC_FILES "../../Utilities/*.cpp")
target_sources(rpcs3_emu PRIVATE ${UTILITIES_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
../util/atomic.cpp
../../Utilities/bin_patch.cpp
../../Utilities/cond.cpp
../../Utilities/Config.cpp
../../Utilities/dynamic_library.cpp
../../Utilities/File.cpp
../../Utilities/GDBDebugServer.cpp
../../Utilities/JIT.cpp
../../Utilities/Log.cpp
../../Utilities/LUrlParser.cpp
../../Utilities/mutex.cpp
../../Utilities/rXml.cpp
../../Utilities/sema.cpp
../../Utilities/StrFmt.cpp
../../Utilities/sysinfo.cpp
../../Utilities/Thread.cpp
../../Utilities/version.cpp
../../Utilities/VirtualMemory.cpp
)
target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}")
@@ -25,21 +45,48 @@ target_link_libraries(rpcs3_emu
3rdparty::pugixml
3rdparty::gsl)
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS -fno-rtti)
if (MSVC)
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS /GR-)
else()
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS -fno-rtti)
endif()
# Crypto
file(GLOB CRYPTO_SRC_FILES "../Crypto/*.cpp")
target_sources(rpcs3_emu PRIVATE ${CRYPTO_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
../Crypto/aes.cpp
../Crypto/aesni.cpp
../Crypto/ec.cpp
../Crypto/key_vault.cpp
../Crypto/lz.cpp
../Crypto/sha1.cpp
../Crypto/unedat.cpp
../Crypto/unpkg.cpp
../Crypto/unself.cpp
../Crypto/utils.cpp
)
# Loader
file(GLOB LOADER_SRC_FILES "../Loader/*.cpp")
target_sources(rpcs3_emu PRIVATE ${LOADER_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
../Loader/ELF.cpp
../Loader/PSF.cpp
../Loader/PUP.cpp
../Loader/TAR.cpp
../Loader/TROPUSR.cpp
../Loader/TRP.cpp
)
# Audio
file(GLOB_RECURSE AUDIO_SRC_FILES "Audio/*.cpp")
target_sources(rpcs3_emu PRIVATE ${AUDIO_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
Audio/AudioDumper.cpp
Audio/AL/OpenALBackend.cpp
Audio/ALSA/ALSABackend.cpp
Audio/Pulse/PulseBackend.cpp
Audio/XAudio2/XAudio27Backend.cpp
Audio/XAudio2/XAudio28Backend.cpp
Audio/XAudio2/XAudio2Backend.cpp
)
if(WIN32)
# Slimmed down version of minidx9 for XAudio2_7 only
@@ -52,8 +99,180 @@ target_link_libraries(rpcs3_emu
# Cell
file(GLOB_RECURSE CELL_SRC_FILES "Cell/*.cpp")
target_sources(rpcs3_emu PRIVATE ${CELL_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
Cell/MFC.cpp
Cell/PPUAnalyser.cpp
Cell/PPUDisAsm.cpp
Cell/PPUFunction.cpp
Cell/PPUInterpreter.cpp
Cell/PPUModule.cpp
Cell/PPUThread.cpp
Cell/PPUTranslator.cpp
Cell/RawSPUThread.cpp
Cell/SPUAnalyser.cpp
Cell/SPUASMJITRecompiler.cpp
Cell/SPUDisAsm.cpp
Cell/SPUInterpreter.cpp
Cell/SPURecompiler.cpp
Cell/SPUThread.cpp
Cell/lv2/lv2.cpp
Cell/lv2/sys_cond.cpp
Cell/lv2/sys_config.cpp
Cell/lv2/sys_dbg.cpp
Cell/lv2/sys_event.cpp
Cell/lv2/sys_event_flag.cpp
Cell/lv2/sys_fs.cpp
Cell/lv2/sys_gamepad.cpp
Cell/lv2/sys_gpio.cpp
Cell/lv2/sys_interrupt.cpp
Cell/lv2/sys_lwcond.cpp
Cell/lv2/sys_lwmutex.cpp
Cell/lv2/sys_memory.cpp
Cell/lv2/sys_mmapper.cpp
Cell/lv2/sys_mutex.cpp
Cell/lv2/sys_net.cpp
Cell/lv2/sys_overlay.cpp
Cell/lv2/sys_ppu_thread.cpp
Cell/lv2/sys_process.cpp
Cell/lv2/sys_prx.cpp
Cell/lv2/sys_rsx.cpp
Cell/lv2/sys_rwlock.cpp
Cell/lv2/sys_semaphore.cpp
Cell/lv2/sys_spu.cpp
Cell/lv2/sys_ss.cpp
Cell/lv2/sys_time.cpp
Cell/lv2/sys_timer.cpp
Cell/lv2/sys_trace.cpp
Cell/lv2/sys_tty.cpp
Cell/lv2/sys_usbd.cpp
Cell/lv2/sys_vm.cpp
Cell/Modules/cellAdec.cpp
Cell/Modules/cellAtrac.cpp
Cell/Modules/cellAtracMulti.cpp
Cell/Modules/cellAudio.cpp
Cell/Modules/cellAudioOut.cpp
Cell/Modules/cellAvconfExt.cpp
Cell/Modules/cellBgdl.cpp
Cell/Modules/cellCamera.cpp
Cell/Modules/cellCelp8Enc.cpp
Cell/Modules/cellCelpEnc.cpp
Cell/Modules/cellCrossController.cpp
Cell/Modules/cellDaisy.cpp
Cell/Modules/cellDmux.cpp
Cell/Modules/cellDtcpIpUtility.cpp
Cell/Modules/cellFiber.cpp
Cell/Modules/cellFont.cpp
Cell/Modules/cellFontFT.cpp
Cell/Modules/cell_FreeType2.cpp
Cell/Modules/cellFs.cpp
Cell/Modules/cellGame.cpp
Cell/Modules/cellGameExec.cpp
Cell/Modules/cellGcmSys.cpp
Cell/Modules/cellGem.cpp
Cell/Modules/cellGifDec.cpp
Cell/Modules/cellHttp.cpp
Cell/Modules/cellHttpUtil.cpp
Cell/Modules/cellImeJp.cpp
Cell/Modules/cellJpgDec.cpp
Cell/Modules/cellJpgEnc.cpp
Cell/Modules/cellKb.cpp
Cell/Modules/cellKey2char.cpp
Cell/Modules/cellL10n.cpp
Cell/Modules/cellLibprof.cpp
Cell/Modules/cellMic.cpp
Cell/Modules/cellMouse.cpp
Cell/Modules/cellMsgDialog.cpp
Cell/Modules/cellMusic.cpp
Cell/Modules/cellMusicDecode.cpp
Cell/Modules/cellMusicExport.cpp
Cell/Modules/cellNetAoi.cpp
Cell/Modules/cellNetCtl.cpp
Cell/Modules/cellOskDialog.cpp
Cell/Modules/cellOvis.cpp
Cell/Modules/cellPad.cpp
Cell/Modules/cellPamf.cpp
Cell/Modules/cellPesmUtility.cpp
Cell/Modules/cellPhotoDecode.cpp
Cell/Modules/cellPhotoExport.cpp
Cell/Modules/cellPhotoImport.cpp
Cell/Modules/cellPngDec.cpp
Cell/Modules/cellPngEnc.cpp
Cell/Modules/cellPrint.cpp
Cell/Modules/cellRec.cpp
Cell/Modules/cellRemotePlay.cpp
Cell/Modules/cellResc.cpp
Cell/Modules/cellRtcAlarm.cpp
Cell/Modules/cellRtc.cpp
Cell/Modules/cellRudp.cpp
Cell/Modules/cellSail.cpp
Cell/Modules/cellSailRec.cpp
Cell/Modules/cellSaveData.cpp
Cell/Modules/cellScreenshot.cpp
Cell/Modules/cellSearch.cpp
Cell/Modules/cellSheap.cpp
Cell/Modules/cellSpudll.cpp
Cell/Modules/cellSpurs.cpp
Cell/Modules/cellSpursJq.cpp
Cell/Modules/cellSpursSpu.cpp
Cell/Modules/cellSsl.cpp
Cell/Modules/cellStorage.cpp
Cell/Modules/cellSubDisplay.cpp
Cell/Modules/cellSync2.cpp
Cell/Modules/cellSync.cpp
Cell/Modules/cellSysconf.cpp
Cell/Modules/cellSysmodule.cpp
Cell/Modules/cellSysutilAp.cpp
Cell/Modules/cellSysutilAvc2.cpp
Cell/Modules/cellSysutilAvc.cpp
Cell/Modules/cellSysutilAvcExt.cpp
Cell/Modules/cellSysutil.cpp
Cell/Modules/cellSysutilMisc.cpp
Cell/Modules/cellSysutilNpEula.cpp
Cell/Modules/cellUsbd.cpp
Cell/Modules/cellUsbpspcm.cpp
Cell/Modules/cellUserInfo.cpp
Cell/Modules/cellVdec.cpp
Cell/Modules/cellVideoExport.cpp
Cell/Modules/cellVideoOut.cpp
Cell/Modules/cellVideoPlayerUtility.cpp
Cell/Modules/cellVideoUpload.cpp
Cell/Modules/cellVoice.cpp
Cell/Modules/cellVpost.cpp
Cell/Modules/cellWebBrowser.cpp
Cell/Modules/libad_async.cpp
Cell/Modules/libad_core.cpp
Cell/Modules/libmedi.cpp
Cell/Modules/libmixer.cpp
Cell/Modules/libsnd3.cpp
Cell/Modules/libsynth2.cpp
Cell/Modules/sceNp2.cpp
Cell/Modules/sceNpClans.cpp
Cell/Modules/sceNpCommerce2.cpp
Cell/Modules/sceNp.cpp
Cell/Modules/sceNpMatchingInt.cpp
Cell/Modules/sceNpSns.cpp
Cell/Modules/sceNpTrophy.cpp
Cell/Modules/sceNpTus.cpp
Cell/Modules/sceNpUtil.cpp
Cell/Modules/StaticHLE.cpp
Cell/Modules/sys_game.cpp
Cell/Modules/sys_heap.cpp
Cell/Modules/sys_io.cpp
Cell/Modules/sys_libc_.cpp
Cell/Modules/sys_libc.cpp
Cell/Modules/sys_lv2dbg.cpp
Cell/Modules/sys_lwcond_.cpp
Cell/Modules/sys_lwmutex_.cpp
Cell/Modules/sys_mempool.cpp
Cell/Modules/sys_mmapper_.cpp
Cell/Modules/sys_net_.cpp
Cell/Modules/sys_ppu_thread_.cpp
Cell/Modules/sys_prx_.cpp
Cell/Modules/sysPrxForUser.cpp
Cell/Modules/sys_rsxaudio_.cpp
Cell/Modules/sys_spinlock.cpp
Cell/Modules/sys_spu_.cpp
)
if(NOT MSVC)
set_source_files_properties(Cell/PPUTranslator.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
@@ -63,58 +282,124 @@ target_link_libraries(rpcs3_emu
PRIVATE
3rdparty::stblib 3rdparty::libpng)
if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7))
if(CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(rpcs3_emu PUBLIC -latomic)
endif()
# CPU
file(GLOB_RECURSE CPU_SRC_FILES "CPU/*.cpp")
target_sources(rpcs3_emu PRIVATE ${CPU_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
CPU/CPUThread.cpp
CPU/CPUTranslator.cpp
)
target_link_libraries(rpcs3_emu
PUBLIC 3rdparty::llvm 3rdparty::asmjit)
# Io
file(GLOB_RECURSE IO_SRC_FILES "Io/*.cpp")
target_sources(rpcs3_emu PRIVATE ${IO_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
Io/KeyboardHandler.cpp
Io/PadHandler.cpp
)
# Memory
file(GLOB_RECURSE MEMORY_SRC_FILES "Memory/*.cpp")
target_sources(rpcs3_emu PRIVATE ${MEMORY_SRC_FILES})
target_sources(rpcs3_emu PRIVATE
Memory/vm.cpp
)
# RSX
file(GLOB RSX_SRC_FILES
"RSX/*.cpp"
"RSX/Common/*.cpp"
"RSX/Null/*.cpp"
"RSX/Overlays/*.cpp"
"RSX/Capture/*.cpp"
"RSX/GL/*.cpp")
target_sources(rpcs3_emu PRIVATE
RSX/CgBinaryFragmentProgram.cpp
RSX/CgBinaryVertexProgram.cpp
RSX/gcm_enums.cpp
RSX/gcm_printing.cpp
RSX/GSRender.cpp
RSX/RSXFIFO.cpp
RSX/rsx_methods.cpp
RSX/RSXOffload.cpp
RSX/RSXTexture.cpp
RSX/RSXThread.cpp
RSX/rsx_utils.cpp
RSX/Common/BufferUtils.cpp
RSX/Common/FragmentProgramDecompiler.cpp
RSX/Common/ProgramStateCache.cpp
RSX/Common/ShaderParam.cpp
RSX/Common/surface_store.cpp
RSX/Common/TextureUtils.cpp
RSX/Common/VertexProgramDecompiler.cpp
RSX/Null/NullGSRender.cpp
RSX/Overlays/overlay_edit_text.cpp
RSX/Overlays/overlay_font.cpp
RSX/Overlays/overlay_list_view.cpp
RSX/Overlays/overlay_message_dialog.cpp
RSX/Overlays/overlay_osk.cpp
RSX/Overlays/overlay_perf_metrics.cpp
RSX/Overlays/overlay_progress_bar.cpp
RSX/Overlays/overlay_save_dialog.cpp
RSX/Overlays/overlays.cpp
RSX/Overlays/overlay_shader_compile_notification.cpp
RSX/Overlays/overlay_trophy_notification.cpp
RSX/Capture/rsx_capture.cpp
RSX/Capture/rsx_replay.cpp
RSX/GL/GLCommonDecompiler.cpp
RSX/GL/GLFragmentProgram.cpp
RSX/GL/GLGSRender.cpp
RSX/GL/GLHelpers.cpp
RSX/GL/GLRenderTargets.cpp
RSX/GL/GLTexture.cpp
RSX/GL/GLVertexBuffers.cpp
RSX/GL/GLVertexProgram.cpp
RSX/GL/OpenGL.cpp
)
if(TARGET 3rdparty_vulkan)
file(GLOB VULKAN_SRCS "RSX/VK/*.cpp")
list(APPEND RSX_SRC_FILES ${VULKAN_SRCS})
target_sources(rpcs3_emu PRIVATE
RSX/VK/VKCommonDecompiler.cpp
RSX/VK/VKFormats.cpp
RSX/VK/VKFragmentProgram.cpp
RSX/VK/VKFramebuffer.cpp
RSX/VK/VKGSRender.cpp
RSX/VK/VKHelpers.cpp
RSX/VK/VKMemAlloc.cpp
RSX/VK/VKProgramPipeline.cpp
RSX/VK/VKRenderPass.cpp
RSX/VK/VKResolveHelper.cpp
RSX/VK/VKResourceManager.cpp
RSX/VK/VKTexture.cpp
RSX/VK/VKVertexBuffers.cpp
RSX/VK/VKVertexProgram.cpp
RSX/VK/VulkanAPI.cpp
)
endif()
if (WIN32)
file(GLOB DX12_SRCS "RSX/D3D12/*.cpp")
list(APPEND RSX_SRC_FILES ${DX12_SRCS})
target_sources(rpcs3_emu PRIVATE
RSX/D3D12/D3D12Buffer.cpp
RSX/D3D12/D3D12CommonDecompiler.cpp
RSX/D3D12/D3D12Formats.cpp
RSX/D3D12/D3D12FragmentProgramDecompiler.cpp
RSX/D3D12/D3D12GSRender.cpp
RSX/D3D12/D3D12MemoryHelpers.cpp
RSX/D3D12/D3D12Overlay.cpp
RSX/D3D12/D3D12PipelineState.cpp
RSX/D3D12/D3D12RenderTargetSets.cpp
RSX/D3D12/D3D12Texture.cpp
RSX/D3D12/D3D12Utils.cpp
RSX/D3D12/D3D12VertexProgramDecompiler.cpp
)
endif()
target_sources(rpcs3_emu PRIVATE ${RSX_SRC_FILES})
target_link_libraries(rpcs3_emu
PUBLIC
3rdparty::ffmpeg 3rdparty::cereal
3rdparty::opengl 3rdparty::stblib
3rdparty::vulkan
3rdparty::vulkan 3rdparty::glew
PRIVATE
3rdparty::gsl 3rdparty::xxhash
3rdparty::dx12 3rdparty::glew)
3rdparty::dx12)
# Setup cotire

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