Commit Graph

1436 Commits (f90d9808378092e208b431f467c54feb6952e91d)

Author SHA1 Message Date
bunnei a488b86e97 fixup! common: bit_util: Add BIT macro. 4 years ago
bunnei e02785be83 common: parent_of_member: Fix build for OffsetOf(). 4 years ago
bunnei 27a6ef64fd fixup! common: intrusive_red_black_tree: Disable static_assert that will not evaluate as constant on MSVC. 4 years ago
bunnei d3c166d4d5 common: Rename NON_COPYABLE/NON_MOVABLE with YUZU_ prefix. 4 years ago
bunnei 02c2b28cd0 common: common_funcs: Add Size helper function. 4 years ago
bunnei 74120c5e3a common: bit_util: Add BIT macro. 4 years ago
bunnei d9205f82b3 common: intrusive_red_black_tree: Disable static_assert that will not evaluate as constant on MSVC. 4 years ago
bunnei b99fc70191 common: common_funcs: Add helper macros for non-copyable and non-moveable.
- Useful for scenarios where we do not want to inherit from NonCopyable.
4 years ago
Lioncash 6125590a7b log/backend: Use in-class initializer for FileBackend
We can also avoid redundant constructions of the same string repeatedly.
4 years ago
Lioncash aaaca1cd6d log/backend: Make use of erase_if
Same behavior, but less verbose.
4 years ago
bunnei 60511976bb
Merge pull request #6199 from lioncash/log-ns
common/log: Move Log namespace into the Common namespace
4 years ago
Lioncash 2a341c9969 log/backend: Correct order of const in copy constructor
Follows our predominant coding style. Also explicitly specifies the move
constructor/assignment operator as well.
4 years ago
Lioncash 64606aefcf common/log: Move Log namespace into the Common namespace
Forgot to move this over when I moved the rest of the source files with
lacking namespaces over.
4 years ago
bunnei a4c6712a4b common: Move settings to common from core.
- Removes a dependency on core and input_common from common.
4 years ago
bunnei c6c0771b12 core: settings: Add setting for debug assertions and disable by default.
- This is a developer-only setting and no longer needs to be enabled by default.
- Also adds "use_auto_stub" setting to SDL frontend while we are here.
- Supersedes #1340.
4 years ago
Lioncash ff6a83e0fe nvidia_flags: Add missing header guard
Prevents potential inclusion compilation errors.
4 years ago
bunnei b04877dd95
Merge pull request #6099 from bunnei/derive-mem
Kernel Rework: Derive memory regions from board layout.
4 years ago
bunnei d6e5e053a6
Merge pull request #6162 from degasus/no_spin_loops
video_core: Avoid spin loops.
4 years ago
Morph 5ce0e127da bgtc: Update to 12.x and implement OpenTaskService 4 years ago
Markus Wick 4aec060f6d common/threadsafe_queue: Provide Wait() method.
It shall block until there is something to consume in the queue.

And use it for the GPU emulation instead of the spin loop.
This is only in booting the emulator, however in BOTW this is the case for about 1 second.
4 years ago
Markus Wick 9be819faaf common: Move assert failure handling into a cpp file.
Advantage: Altering the handler does not need a full recompilation.
Disadvantage: noreturn is droped, so the caller is a bit slower.

We quite often run yuzu with a YOLO assertion handler. In fact, only very few
games run at all with asserts. This patch allows developers to patch the handler
without recompiling everything. The overhead of the missing "noreturn" attribute
shoul be negletable.
4 years ago
bunnei ab5995c7ae common: common_sizes: Move sizes to the Common namespace. 4 years ago
bunnei 8d0ba7ee49 common: common_sizes: Move Invalid to Size_* prefix and add missing values. 4 years ago
bunnei edbc505e52 hle: kernel: board: k_system_control: Extend to include memory region sizes. 4 years ago
bunnei 28be8aec9a common: Move common sizes to their own header for code reuse. 4 years ago
MerryMage 59173ff7a7 fiber: Double default stack size
Stack overflow occurs with some guest applications
4 years ago
bunnei 8f7eb194af common: Fiber: use a reference for YieldTo.
- Fixes another small leak.
4 years ago
bunnei 68ffac250a common: fiber: Use weak_ptr when yielding.
- Avoids a memory leak, as taking a strong reference of the fiber here causes a circular reference.
- Supersedes #6006 with a more narrow fix.
4 years ago
bunnei a5ab85ac37
Revert "core: Switch to unique_ptr for usage of Common::Fiber." 4 years ago
bunnei 34a3ee1631
Merge pull request #6006 from bunnei/fiber-unique-ptr
core: Switch to unique_ptr for usage of Common::Fiber.
4 years ago
comex 2910aa77b2 [network] Error handling reform
`network.cpp` has several error paths which either:
- report "Unhandled host socket error=n" and return `SUCCESS`, or
- switch on a few possible errors, log them, and translate them to
  Errno; the same switch statement is copied and pasted in multiple
  places in the code

Convert these paths to use a helper function `GetAndLogLastError`, which
is roughly the equivalent of one of the switch statements, but:
- handling more cases (both ones that were already in `Errno`, and a few
  more I added), and
- using OS functions to convert the error to a string when logging, so
  it'll describe the error even if it's not one of the ones in the
  switch statement.
  - To handle this, refactor the logic in `GetLastErrorMsg` to expose a
    new function `NativeErrorToString` which takes the error number
    explicitly as an argument.  And improve the Windows version a bit.

Also, add a test which exercises two random error paths.
4 years ago
bunnei 55f556c53e
Merge pull request #5984 from jbeich/gcc-freebsd
common,video-core: unbreak GCC 11 build on FreeBSD 13
4 years ago
bunnei 51fb0a6f96 core: Switch to unique_ptr for usage of Common::Fiber.
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
4 years ago
bunnei 09f7c355c6
Merge pull request #5953 from bunnei/memory-refactor-1
Kernel Rework: Memory updates and refactoring (Part 1)
4 years ago
Jan Beich 71526ecfc7 common: add missing header after f3805376f7
In file included from src/video_core/dma_pusher.cpp:5:
src/./common/cityhash.h:69:47: error: 'size_t' has not been declared
   69 | [[nodiscard]] u64 CityHash64(const char* buf, size_t len);
      |                                               ^~~~~~
src/./common/cityhash.h:73:55: error: 'size_t' has not been declared
   73 | [[nodiscard]] u64 CityHash64WithSeed(const char* buf, size_t len, u64 seed);
      |                                                       ^~~~~~
src/./common/cityhash.h:77:56: error: 'size_t' has not been declared
   77 | [[nodiscard]] u64 CityHash64WithSeeds(const char* buf, size_t len, u64 seed0, u64 seed1);
      |                                                        ^~~~~~
src/./common/cityhash.h:80:47: error: 'size_t' has not been declared
   80 | [[nodiscard]] u128 CityHash128(const char* s, size_t len);
      |                                               ^~~~~~
src/./common/cityhash.h:84:55: error: 'size_t' has not been declared
   84 | [[nodiscard]] u128 CityHash128WithSeed(const char* s, size_t len, u128 seed);
      |                                                       ^~~~~~
4 years ago
bunnei 3acb265c9e common: wall_clock: Fix integer overflow with StandardWallClock.
- Previous optimized impl. resulted in an integer overflow, so revert.
- This is our slow/fallback path that should never be really be used, so the optimization in unimportant.
4 years ago
bunnei c9235764c7 common: Add implementation of TinyMT (Mersenne Twister RNG). 4 years ago
bunnei b5b92fd1e5 common: alignment: Add DivideUp utility method. 4 years ago
ReinUsesLisp f3805376f7 common/cityhash: Use common types
Allow sharing return types with the rest of the code base. For example,
we use 'u128 = std::array<u64, 2>', meanwhile Google's code uses
'uint128 = std::pair<u64, u64>'.

While we are at it, use size_t instead of std::size_t.
4 years ago
bunnei 592a649918 common: wall_clock: Optimize GetClockCycles/GetCPUCycles to use a single MUL instruction. 4 years ago
bunnei 0a91599aec common: Merge uint128 to a single header file with inlines. 4 years ago
lat9nq a58086ae0d common: Add -fsized-deallocation as a Clang flag
Prevents an operator delete error when compiling with Clang 11.
4 years ago
Morph ff58ad2050 string_util: Remove MSVC workaround for converting between UTF8/UTF16
This has been fixed as of Visual Studio 2019 Version 16.2
4 years ago
bunnei 4a01812ebe
Merge pull request #5885 from MerryMage/ring_buffer-granularity
ring_buffer: Remove granularity template argument
4 years ago
MerryMage 8d00265998 ring_buffer: Remove granularity template argument
Non-obvious bug in RingBuffer::Push(std::vector<T>&) when granularity != 1

Just remove it altogether because we do not have a use for granularity != 1
4 years ago
bunnei ea4f62615e hle: kernel: Drop R_UNLESS_NOLOG in favor of expanded if-statement. 4 years ago
bunnei 18175c71ed common: scope_exit: Add a cancellable ScopeExit macro. 4 years ago
bunnei 4577dcd5f9 common: common_funcs: Add R_UNLESS_NOLOG for scenarios that should not log. 4 years ago
bunnei 8d1afcb90f common: common_funcs: Change R_UNLESS to LOG_ERROR. 4 years ago
bunnei 091e9e8c41 common: common_funcs: Log error on R_UNLESS. 4 years ago
bunnei bb966d3e33 common: common_funcs: Add useful kernel macro R_SUCCEED_IF. 4 years ago
bunnei 2fb77adb9f common: common_funcs: Add a few more useful macros for kernel code. 4 years ago
bunnei 28b822fe38
Merge pull request #5778 from ReinUsesLisp/shader-dir
renderer_opengl: Avoid precompiled cache and force NV GL cache directory
4 years ago
bunnei 1e9b1d439f
common: Add missing include to bit_util.h 4 years ago
Lioncash 6ff2db181f bit_util: Unify implementations of MostSignificantBit32/MostSignificantBit64
We can use the standardized CLZ facilities to perform this. This also
allows us to make utilizing functions constexpr and eliminate the
inclusion of an intrinsics header.
4 years ago
ReinUsesLisp 51512d01d8 renderer_opengl: Avoid precompiled cache and force NV GL cache directory
Setting __GL_SHADER_DISK_CACHE_PATH we can force the cache directory to
be in yuzu's user directory to stop commonly distributed malware from
deleting our driver shader cache. And by setting
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP we can have an unbounded shader
cache size.

This has only been implemented on Windows, mostly because previous tests
didn't seem to work on Linux.

Disable the precompiled cache on Nvidia's driver. There's no need to
hide information the driver already has in its own cache.
4 years ago
bunnei e8401964b4
Merge pull request #5360 from ReinUsesLisp/enforce-memclass-access
core: Silence Wclass-memaccess warnings and enforce it
4 years ago
bunnei a7fd61fcce
Merge pull request #5275 from FernandoS27/fast-native-clock
X86/NativeClock: Improve performance of clock calculations on hot path.
4 years ago
bunnei 8def504d73
Merge pull request #5336 from lioncash/tree
common/tree: Convert defines over to templates
4 years ago
LC 8be9e5b48b
Merge pull request #5358 from ReinUsesLisp/rename-insert-padding
common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINIT
4 years ago
ReinUsesLisp f8650a9580 core: Silence Wclass-memaccess warnings
This requires making several types trivial and properly initialize
them whenever they are called.
4 years ago
ReinUsesLisp 3ff978aa4f common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINIT
INSERT_PADDING_BYTES_NOINIT is more descriptive of the underlying behavior.
4 years ago
bunnei f728a504aa
Merge pull request #5355 from lioncash/timer
common/timer: Remove
4 years ago
LC 9754a8145c
Merge pull request #5357 from ReinUsesLisp/alignment-log2
common/alignment: Rename AlignBits to AlignUpLog2 and use constraints
4 years ago
Lioncash 8620de6b20 common/bit_util: Replace CLZ/CTZ operations with standardized ones
Makes for less code that we need to maintain.
4 years ago
ReinUsesLisp 89c15dd115 common/alignment: Upgrade to use constraints instead of static asserts 4 years ago
ReinUsesLisp fe494a0ccd common/alignment: Rename AlignBits to AlignUpLog2
AlignUpLog2 describes what the function does better than AlignBits.
4 years ago
Lioncash 91084d9396 common/timer: Remove
This is a leftover from citra and dolphin that isn't used at all,
particularly given the <chrono> header exists.
4 years ago
ReinUsesLisp 95fa57f007 common/color: Remove
This is a leftover from Citra we no longer use.
4 years ago
bunnei 0fb19e9bef
Merge pull request #5280 from FearlessTobi/port-5666
Port citra-emu/citra#5666: "Rotate previous log file to "citra_log.txt.old""
4 years ago
Lioncash b15e1a3501 common/tree: Convert defines over to templates
Reworks the tree header to operate off of templates as opposed to a
series of defines.

This allows all tree facilities to obey namespacing rules, and also
allows this code to be used within modules once compiler support is in
place.

This also gets rid to use a macro to define functions and structs for
necessary data types. With templates, these will be generated when
they're actually used, eliminating the need for the separate
declaration.
4 years ago
Lioncash 197b5d19bc common/tree: Remove unused splay tree defines
Makes for less code to take care of.
4 years ago
Lioncash 703c57a119 common/parent_of_member: Replace TYPED_STORAGE define with template alias
Provides the same construct, but makes it obey namespacing.
4 years ago
bunnei 92d5c63f01 common: common_funcs: Add R_UNLESS macro. 4 years ago
bunnei fb43b8efd2 common: Introduce useful tree structures. 4 years ago
ReinUsesLisp c190586597 common/div_ceil: Return numerator type
Fixes instances where DivCeil(u32, u64) would surprisingly return u64,
instead of the more natural u32.
4 years ago
FearlessTobi beb951770a Address review comments 4 years ago
xperia64 fd5776aac2 Delete the old log file before rotating (#5675) 4 years ago
bunnei bf8bd60ab3 Fix the old log file to work with the log parser. 4 years ago
xperia64 f478a57737 Rotate previous log file to '.old' if it exists 4 years ago
Morph a745d87971 general: Fix various spelling errors 4 years ago
Fernando Sahmkow 53d92318b8 X86/NativeClock: Reimplement RTDSC access to be lock free. 4 years ago
Fernando Sahmkow d4f871cb6a X86/NativeClock: Improve performance of clock calculations on hot path. 4 years ago
MerryMage 6d30745d77 memory: Remove MemoryHook 4 years ago
bunnei eb318ffffc
Merge pull request #5249 from ReinUsesLisp/lock-free-pages
core/memory: Read and write page table atomically
4 years ago
bunnei 25d607f5f6
Merge pull request #5208 from bunnei/service-threads
Service threads
4 years ago
ReinUsesLisp b3587102d1 core/memory: Read and write page table atomically
Squash attributes into the pointer's integer, making them an uintptr_t
pair containing 2 bits at the bottom and then the pointer. These bits
are currently unused thanks to alignment requirements.

Configure Dynarmic to mask out these bits on pointer reads.

While we are at it, remove some unused attributes carried over from
Citra.

Read/Write and other hot functions use a two step unpacking process that
is less readable to stop MSVC from emitting an extra AND instruction in
the hot path:

 mov         rdi,rcx
 shr         rdx,0Ch
 mov         r8,qword ptr [rax+8]
 mov         rax,qword ptr [r8+rdx*8]
 mov         rdx,rax
-and         al,3
 and         rdx,0FFFFFFFFFFFFFFFCh
 je          Core::Memory::Memory::Impl::Read<unsigned char>
 mov         rax,qword ptr [vaddr]
 movzx       eax,byte ptr [rdx+rax]
4 years ago
bunnei 69e82d01d5 common: ThreadWorker: Add class to help do asynchronous work. 4 years ago
comex 388cf58b31 k_priority_queue: Fix concepts use
- For `std::same_as`, add missing include of `<concepts>`.

- For `std::convertible_to`, create a replacement in `common/concepts.h`
  and use that instead.

  This would also be found in `<concepts>`, but unlike `std::same_as`,
  `std::convertible_to` is not yet implemented in libc++, LLVM's STL
  implementation - not even in master.  (In fact, `std::same_as` is the
  *only* concept currently implemented.  For some reason.)
4 years ago
bunnei 1279c7ce7a
Merge pull request #5131 from bunnei/scheduler-rewrite
Rewrite Kernel scheduler based on Atmosphere
4 years ago
lat9nq 292dd642ce cmake: Fix generating CMake configs and linking with Boost
Fixes regression by 761206cf81, causing
yuzu to not build on Linux with any version of Boost except a cached
1.73 Conan version from before about a day ago.

Moves the Boost requirement out of the `REQUIRED_LIBS` psuedo-2D-array
for Conan to instead be manually configured, using Conan as a fallback
solution if the system does not meet our requirements.

Requires any update from the linux-fresh container in order to build.

**DO NOT MERGE** until someone with the MSVC toolchain can verify this
works there, too.
4 years ago
bunnei 761206cf81
common: Update CMakeList to fix build issue with Boost. 4 years ago
Morph 4de079b256 Revert "Merge pull request #5173 from lioncash/common-fs"
This reverts commit ce5fcb6bb2, reversing
changes made to 6f41763061.
4 years ago
Morph 8941cdb7d2 Revert "Merge pull request #5174 from ReinUsesLisp/fs-fix"
This reverts commit 5fe55b16a1, reversing
changes made to e94dd7e2c4.
4 years ago
Morph 0195038c07 Revert "Merge pull request #5179 from ReinUsesLisp/fs-path"
This reverts commit 4e94d0d53a, reversing
changes made to 6d6115475b.
4 years ago
Morph ac3ec5ed13 Revert "Merge pull request #5181 from Morph1984/5174-review"
This reverts commit cdb36aef9e, reversing
changes made to 5e9b77129f.
4 years ago
Morph ec8548b414 common/file_util: Simplify the behavior of CreateFullPath 4 years ago
ReinUsesLisp bab9cae71f common/file_util: Let std::filesystem cast from UTF16 to std::string
Fix invalid encoding paths when iterating over a directory on Windows.
4 years ago
ReinUsesLisp 5329834376 common/file_util: Fix and deprecate CreateFullPath, add CreateDirs
Fix CreateFullPath to have its intended previous behavior (whatever
that was), and deprecate it in favor of the new CreateDirs function.

Unlike CreateDir, CreateDirs is marked as [[nodiscard]] to avoid new
code ignoring its result value.
4 years ago
ReinUsesLisp 52f13f2339 common/file_util: Succeed on CreateDir when the directory exists 4 years ago
Lioncash 20aad9e01a file_util: Migrate remaining file handling functions over to std::filesystem
Converts creation and deletion functions over to std::filesystem,
simplifying our file-handling code.

Notably with this, CopyDir will now function on Windows.
4 years ago
Lioncash 0e54aa17e6 file_util: Migrate Exists() and IsDirectory() over to std::filesystem
Greatly simplifies our file-handling code for these functions.
4 years ago
LC 69af6ada2f
Merge pull request #5136 from lioncash/video-shadow3
video_core: Resolve more variable shadowing scenarios pt.3
4 years ago
bunnei d2c0c94f0b common: BitSet: Various style fixes based on code review feedback. 4 years ago
bunnei 8d3e06349e hle: kernel: Separate KScheduler from GlobalSchedulerContext class. 4 years ago
bunnei 8dbfa4e1a4 common: Port BitSet from Mesosphere. 4 years ago
Lioncash f95602f152 video_core: Resolve more variable shadowing scenarios pt.3
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
4 years ago
Lioncash 2c375013dd xbyak_abi: Shorten std::size_t to size_t
Makes for less reading.
4 years ago
Lioncash b126267442 xbyak_abi: Avoid implicit sign conversions 4 years ago
bunnei 69aaad9b96
Merge pull request #4996 from bunnei/use-4jits
Kernel: Refactor to use 4-instances of Dynarmic & various cleanups and improvements
4 years ago
bunnei 88089c8754
Merge pull request #5000 from lioncash/audio-error
audio_core: Make shadowing and unused parameters errors
4 years ago
Lioncash 1ea6bdef05 audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
4 years ago
bunnei 24cae76d16 common: fiber: Use VirtualBuffer for stack memory.
- This will be aligned by default, and helps memory usage.
4 years ago
bunnei c042a89113 common: fiber: Use boost::context instead of native fibers on Windows. 4 years ago
ReinUsesLisp 630823e363 common: Add Common::DivCeil and Common::DivCeilLog2
Add an equivalent to 'Common::AlignUp(n, d) / d' and a log2 alternative.
4 years ago
bunnei 5d1447897a
Merge pull request #4451 from slashiee/extended-logging
logging/settings: Increase maximum log size to 100 MB and add extended logging option
4 years ago
bunnei c47c3d723f
Merge pull request #4951 from bunnei/olsc-stub
hle: service: Stub OLSC Initialize and SetSaveDataBackupSettingEnabled functions.
4 years ago
ReinUsesLisp 3f2e605dd1 common/bit_cast: Add function matching std::bit_cast without constexpr
Add a std::bit_cast-like function archiving the same runtime results as
the standard function, without compile time support.

This allows us to use bit_cast while we wait for compiler support, it
can be trivially replaced in the future.
4 years ago
bunnei 6e37676482 hle: service: Stub OLSC Initialize and SetSaveDataBackupSettingEnabled functions.
- Used by Animal Cross: New Horizons v1.6.0 update, minimal stub gets this update working.
4 years ago
Lioncash 412044960a virtual_buffer: Do nothing on resize() calls with same sizes
Prevents us from churning memory by freeing and reallocating a memory
block that would have already been adequate as is.
4 years ago
Lioncash 0ca91ced2d virtual_buffer: Add compile-time type-safety guarantees with VirtualBuffer
VirtualBuffer makes use of VirtualAlloc (on Windows) and mmap() (on
other platforms). Neither of these ensure that non-trivial objects are
properly constructed in the allocated memory.

To prevent potential undefined behavior occurring due to that, we can
add a static assert to loudly complain about cases where that is done.
4 years ago
Lioncash b3c8997829 page_table: Allow page tables to be moved
Makes page tables and virtual buffers able to be moved, but not copied,
making the interface more flexible.

Previously, with the destructor specified, but no move assignment or
constructor specified, they wouldn't be implicitly generated.
4 years ago
Lioncash 3cfd962ef4 page_table: Add missing doxygen parameters to Resize()
Resolves two -Wdocumentation warnings.
4 years ago
Lioncash 0890451c55 page_table: Remove unnecessary header inclusions
Prevents indirect inclusions for these headers.
4 years ago
Lioncash 00fb79b2f3 common/fiber: Move all member variables into impl class
Hides all of the implementation details for users of the class. This has
the benefit of reducing includes and also making the fiber classes
movable again.
4 years ago
Lioncash 6f006d051e General: Fix clang build
Allows building on clang to work again
4 years ago
Lioncash 4a4b685a04 common: Enable warnings as errors
Cleans up common so that we can enable warnings as errors.
4 years ago
bunnei 8aa9ae5ba5
Merge pull request #4868 from lioncash/discard-error
General: Make ignoring a discarded return value an error
4 years ago
Lioncash 26547d3e3b General: Make ignoring a discarded return value an error
Allows our CI to catch more potential bugs. This also removes the
[[nodiscard]] attribute of IOFile's Open member function. There are
cases where a file may want to be opened, but have the status of it
checked at a later time.
4 years ago
Lioncash 8049b8beb6 common/stream: Be explicit with copy and move operators 4 years ago
ReinUsesLisp cdb2480d39 common/fiber: Take shared_ptr<Fiber> by copy in YieldTo
YieldTo does not intend to modify the passed shared_ptrs.
Pass it by copy to keep a reference count while this function executes.
4 years ago
ameerj eb67a45ca8 video_core: NVDEC Implementation
This commit aims to implement the NVDEC (Nvidia Decoder) functionality, with video frame decoding being handled by the FFmpeg library.

The process begins with Ioctl commands being sent to the NVDEC and VIC (Video Image Composer) emulated devices. These allocate the necessary GPU buffers for the frame data, along with providing information on the incoming video data. A Submit command then signals the GPU to process and decode the frame data.

To decode the frame, the respective codec's header must be manually composed from the information provided by NVDEC, then sent with the raw frame data to the ffmpeg library.

Currently, H264 and VP9 are supported, with VP9 having some minor artifacting issues related mainly to the reference frame composition in its uncompressed header.

Async GPU is not properly implemented at the moment.

Co-Authored-By: David <25727384+ogniK5377@users.noreply.github.com>
4 years ago
Lioncash ea20b5c970 core: Fix clang build pt.3
Should finally resolve building with clang.
4 years ago
bunnei 3d592972dc
Revert "core: Fix clang build" 4 years ago
LC 88d5140cf2
Merge pull request #4796 from lioncash/clang
core: Fix clang build
4 years ago
Lioncash be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
4 years ago
Lioncash 046c0c91a3 input_common/CMakeLists: Make some warnings errors
Makes the input_common code warnings consistent with the rest of the
codebase.
4 years ago
Lioncash 39c8d18feb core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by
applying it to Linux side of things as well. This also makes it more
consistent with the warning settings in other libraries in the project.

This also updates httplib to 0.7.9, as there are several warning
cleanups made that allow us to enable several warnings as errors.
4 years ago
bunnei 3446eb79b5
Merge pull request #4731 from lat9nq/mingw-zstd-fix
common: Use system zstd on Linux
4 years ago
ReinUsesLisp 771a9c21cc common/wall_clock: Add virtual destructors
From -fsanitize=address, this code wasn't calling the proper destructor.
Adding virtual destructors for each inherited class and the base class
fixes this bug.

While we are at it, mark the functions as final.
4 years ago
lat9nq 2cbce77b92 CMakeLists: use system zstd on Linux
From what I understand, this tells CMake to use the system, not conan,
version of zstd. Required to build on the coming MinGW Docker container.
4 years ago
lat9nq 9d665cb8db CMakeLists: fix for finding zstd on linux-mingw 4 years ago
bunnei 94a25b75a0
Merge pull request #4611 from lioncash/xbyak2
externals: Update Xbyak to 5.96
5 years ago
bunnei 40c230e0fa
Merge pull request #4578 from lioncash/xor
common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORS
5 years ago
Morph 45ecd601be input_common/motion_input: Make use of Common::PI constant
Also amend the copyright notice to yuzu's instead of Dolphin's, which was mistakenly copy-pasted from another file.
5 years ago
bunnei f64917a852
Merge pull request #4570 from german77/motionInput
input_common: Add a basic class for motion devices
5 years ago
bunnei ad9ce67b52
Merge pull request #4588 from ReinUsesLisp/tsan-event
common/thread: Fix data race in is_set
5 years ago
LC b5ed2d408c
Merge pull request #4461 from comex/thread-names
Fix thread naming on Linux, which limits names to 15 bytes.
5 years ago
Lioncash a5dcccfdd2 externals: Update Xbyak to 5.96
I made a request on the Xbyak issue tracker to allow some constructors
to be constexpr in order to avoid static constructors from needing to
execute for some of our register constants.

This request was implemented, so this updates Xbyak so that we can make
use of it.
5 years ago
german 2d207ec609 Implement a basic class for motion devices 5 years ago
bunnei 3db9a25977
Merge pull request #4530 from Morph1984/mjolnir-p1
Project Mjölnir: Part 1 - Input Rewrite
5 years ago
bunnei 3f7b0e0772
Merge pull request #4577 from lioncash/asserts
common/assert: Make use of C++ attribute syntax
5 years ago
Morph f0fac0c7fb Project Mjölnir: Part 1
Co-authored-by: James Rowe <jroweboy@gmail.com>
Co-authored-by: Its-Rei <kupfel@gmail.com>
5 years ago
ReinUsesLisp f119ef798b common/thread: Fix data race in is_set
As report by tsan, Event::Set can write is_set while WaitFor and friends
are reading from it. To address this issue, make is_set an atomic.
5 years ago
bunnei b798813eee
Merge pull request #4548 from lioncash/color
common/color: Migrate code over to the Common namespace
5 years ago
M&M 43ce33b6cc logging/settings: Increase maximum log size to 100 MB and add extended logging option
The extended logging option is automatically disabled on boot but can be enabled afterwards, allowing the log file to go up to 1 GB during that session.
This commit also fixes a few errors that are present in the general debug menu.
5 years ago
Lioncash 504175e5b6 common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORS
Ensures that the full set of bitwise operators are available for types
that make use of this macro.
5 years ago
Lioncash 3bfaabdbdd common/assert: Make use of C++ attribute syntax
Normalizes the syntax used for attributes
5 years ago
Lioncash ca5ed50655 web_service: Move web_result.h into web_service
This is the only place it's actively used. It's also more appropriate
for web-related structures to be within the web service target.
Especially given this one doesn't rely on anything in the common
library.
5 years ago
bunnei 3ea3de4ecd
Merge pull request #4546 from lioncash/telemetry
common/telemetry: Migrate namespace into the Common namespace
5 years ago
bunnei 3b8a8cf825
Merge pull request #4547 from lioncash/header-concept
common/concepts: Move <type_traits> include out of the Common namespace
5 years ago
bunnei acbae572d3
Revert "common/time_zone: Simplify GetOsTimeZoneOffset()" 5 years ago
bunnei b1fa647f28
Merge pull request #4539 from lioncash/disc
common: Silence two discarded result warnings
5 years ago
Lioncash f6bb905182 common/telemetry: Migrate namespace into the Common namespace
Migrates the Telemetry namespace into the Common namespace to make the
code consistent with the rest of our common code.
5 years ago
Lioncash e864aa25d5 common/color: Migrate code over to the Common namespace
No external code makes use of this header, so we can freely change the
namespace.
5 years ago
Lioncash 999fc2fece common/concepts: Move <type_traits> include out of the Common namespace
This is a compiler/linker error waiting to happen.
5 years ago
bunnei 56c6a5def8
Merge pull request #4535 from lioncash/fileutil
common/fileutil: Convert namespace to Common::FS
5 years ago
Lioncash c4ed791164 common/fileutil: Convert namespace to Common::FS
Migrates a remaining common file over to the Common namespace, making it
consistent with the rest of common files.

This also allows for high-traffic FS related code to alias the
filesystem function namespace as

namespace FS = Common::FS;

for more concise typing.
5 years ago
Lioncash d09456fc41 common: Silence two discarded result warnings
These are intentionally discarded internally, since the rest of the
public API allows querying success. We want all non-internal uses of
these functions to be explicitly checked, so we can signify that we
intentionally want to discard the return values here.
5 years ago
Lioncash fe97d34156 common/time_zone: Simplify GetOsTimeZoneOffset()
We can simplify this function down into a single line with the use of
fmt. A benefit with the fmt approach is that the fmt variant of
localtime is thread-safe as well, making GetOsTimeZoneOffset()
thread-safe as well.
5 years ago
Lioncash 1ee060ca0d common/compression: Roll back std::span changes
Seems like all compilers don't support std::span yet.
5 years ago
Lioncash df72480395 common: Make use of [[nodiscard]] where applicable
Now that clang-format makes [[nodiscard]] attributes format sensibly, we
can apply them to several functions within the common library to allow
the compiler to complain about any misuses of the functions.
5 years ago
bunnei feb243b08d
Merge pull request #4416 from lioncash/span
lz4_compression/zstd_compression: Make use of std::span in interfaces
5 years ago
LC ff0b14ee62
Merge pull request #4511 from lioncash/build2
General: Tidy up clang-format warnings part 2
5 years ago
Lioncash b724a4d90c General: Tidy up clang-format warnings part 2 5 years ago
bunnei e143adc3cf
Merge pull request #4493 from jbeich/dragonfly
common/virtual_buffer: drop unused includes
5 years ago
Lioncash 1c3490a8db General: Tidy up clang-format warnings 5 years ago
Lioncash 8e86fa7e60 common/concepts: Rename IsBaseOf to DerivedFrom
This makes it more inline with its currently unavailable standardized
analogue std::derived_from.

While we're at it, we can also make the template match the requirements
of the standardized variant as well.
5 years ago
bunnei f5d538f118
Merge pull request #4483 from lioncash/constexpr-hex
partition_data_manager: Make data arrays constexpr
5 years ago
Lioncash 7f0f37fca7 partition_data_manager: Make data arrays constexpr
Previously the constructor for all of these would run at program
startup, consuming time before the application can enter main().

This is also particularly dangerous, given the logging system wouldn't
have been initialized properly yet, yet the program would use the logs
to signify an error.

To rectify this, we can replace the literals with constexpr functions
that perform the conversion at compile-time, completely eliminating the
runtime cost of initializing these arrays.
5 years ago
comex d37f0b29e2 Fix thread naming on Linux, which limits names to 15 bytes.
- In `SetCurrentThreadName`, when on Linux, truncate to 15 bytes, as (at
  least on glibc) `pthread_set_name_np` will otherwise return `ERANGE` and
  do nothing.
- Also, add logging in case `pthread_set_name_np` returns an error
  anyway.  This is Linux-specific, as the Apple and BSD versions of
  `pthread_set_name_np return `void`.
- Change the name for CPU threads in multi-core mode from
  "yuzu:CoreCPUThread_N" (19 bytes) to "yuzu:CPUCore_N" (14 bytes) so it
  fits into the Linux limit.  Some other thread names are also cut off,
  but I didn't bother addressing them as you can guess them from the
  truncated versions.  For a CPU thread, truncation means you can't see
  which core it is!
5 years ago
bunnei d888ac7d20
Merge pull request #4477 from lioncash/log-desig
logging/backend: Make use of designated initializers
5 years ago
Jan Beich 238208ee30 common/virtual_buffer: drop unused includes
On DragonFly and NetBSD build fails with

src/common/virtual_buffer.cpp
src/common/virtual_buffer.cpp:16:10: fatal error: sys/sysinfo.h: No such file or directory
 #include <sys/sysinfo.h>
          ^~~~~~~~~~~~~~~
5 years ago
bunnei 4a2d9c6454
Merge pull request #4444 from lioncash/volatile
common/atomic_ops: Don't cast away volatile from pointers
5 years ago
Lioncash 8725b37a35 logging/backend: Make use of designated initializers
Same behavior, less code.
5 years ago
David 9b75481755
ipc: Allow all trivially copyable objects to be passed directly into WriteBuffer (#4465)
* ipc: Allow all trivially copyable objects to be passed directly into WriteBuffer

With the support of C++20, we can use concepts to deduce if a type is an STL container or not.

* More agressive concept for stl containers

* Add -fconcepts

* Move to common namespace

* Add Common::IsBaseOf
5 years ago
David 6c7292de33
Merge pull request #4263 from lat9nq/fix-screencaps-2
screenshots: Option to save screenshots immediately in a specified directory + Linux workaround
5 years ago
Lioncash e3f0c93230 common/atomic_ops: Don't cast away volatile from pointers
Preserves the volatility of the pointers being casted.
5 years ago
bunnei 45cf48bd0a
Merge pull request #4415 from lioncash/maybe
virtual_buffer: Mark size parameter of FreeMemoryPages() as [[maybe_unused]]
5 years ago
LC e3503de588
common/string_util: Remove unimplemented function prototype (#4414)
This function was relocated to log.h as a constexpr function, so this
can be removed.
5 years ago
Lioncash 2e511246fa lz4_compression: Make use of std::span in interfaces
Allows compressing the data and size parameters into one.
5 years ago
Lioncash c5bdccfecb zstd_compression: Make use of std::span in interfaces
Allows condensing the data and size parameters into a single argument.
5 years ago
Lioncash ca6ff01333 virtual_buffer: Mark size parameter of FreeMemoryPages() as [[maybe_unused]]
This isn't used on Windows, but is used on non-Windows operating
systems.
5 years ago
lat9nq 3848155c42 common: Add a screenshots directory
Adds a screenshots directory as a path managed by FileUtil.
5 years ago
Jan Beich db43b37e15 alignment: explicitly include <new> after 723edb4c06
In file included from src/core/hle/kernel/memory/page_table.cpp:5:
src/./common/alignment.h:67:68: error: no member named 'align_val_t' in namespace 'std'
        return static_cast<T*>(::operator new (n * sizeof(T), std::align_val_t{Align}));
                                                              ~~~~~^
src/./common/alignment.h:71:51: error: no member named 'align_val_t' in namespace 'std'
        ::operator delete (p, n * sizeof(T), std::align_val_t{Align});
                                             ~~~~~^
5 years ago
Lioncash 723edb4c06 alignment: Simplify AlignmentAllocator implementation
With C++20, much of the allocator interface has been simplified, so we
can make the same adjustments.
5 years ago
Lioncash 9f027b1af2 common/swap: Make use of std::endian
Allows removing a bunch of defines in favor of a two liner.
5 years ago
Tobias 80a0f2a118
common/alignment: Fix compilation errors (#4303) 5 years ago
bunnei 1074c87f18
Revert "Port citra-emu/citra#5441: "Common: remove a mod from AlignUp"" 5 years ago
Marshall Mohror a4306b9e56 Common: remove a mod from AlignUp (#5441)
In cases where the size is not a known constant when inlining, AlignUp<std::size_t> currently generates two 64-bit div instructions.
This generates one div and a cmov which is significantly cheaper.
5 years ago
David Marcec bd2feb6873 cmake: Fix libfmt linking errors 5 years ago
John Galt 95cd2e17ab cmake: fix fmt linking when found
This is a new attempt at #4206 that shouldn't break windows builds.

If someone else could test on windows, it would be much appreciated.
Previously, the build bot passed but the actual builds failed.
5 years ago
bunnei 98fcd3ba5d
Revert "cmake: fix fmt linking" 5 years ago
bunnei 064b7bfa5f
Merge pull request #4206 from RealJohnGalt/linkfix
cmake: fix fmt linking
5 years ago
Jan Beich 3b1683a152 common: switch to nullptr for sysctl's empty new value 5 years ago
Jan Beich e6085ea35f common: add sysconf() fallback
src/common/memory_detect.cpp:15:10: fatal error: 'sys/sysinfo.h' file not found
 #include <sys/sysinfo.h>
          ^~~~~~~~~~~~~~~
5 years ago
John Galt 765e37aa35 cmake: fix fmt linking
On gcc/ld, and clang/lld, fmt::v6 symbols are excluded, so linking
fails. This fixes the issue.

Note: This was included in the FindBoost changes I shared with
BlinkHawk, however only they were merged. I'm not sure if it was missed,
or if there was an issue with this part of the change.
5 years ago
Fernando Sahmkow 2f8947583f Core/Common: Address Feedback. 5 years ago
Fernando Sahmkow 7fd7d05838 Common/Kernel: Corrections and small bug fixing. 5 years ago
Fernando Sahmkow 3165152396 Common/NativeClockx86: Reduce native clock accuracy further. 5 years ago
Fernando Sahmkow 7b1804dab4 Common/AtomicOps: Correct GCC Intrinsic argument ordering. 5 years ago
Fernando Sahmkow 467d43570e Clang Format. 5 years ago
Fernando Sahmkow 528b19a842 General: Tune the priority of main emulation threads so they have higher priority than less important helper threads. 5 years ago
Fernando Sahmkow 534466754f X64 Clock: Reduce accuracy to be less or equal to guest accuracy. 5 years ago
Fernando Sahmkow cd1c38be8d ARM/Memory: Correct Exclusive Monitor and Implement Exclusive Memory Writes. 5 years ago
Fernando Sahmkow 18dcb09342 HostTiming: Pause the hardware clock on pause. 5 years ago
Fernando Sahmkow e31425df38 General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
5 years ago
David 0ea4a8bcc4
Merge pull request #3396 from FernandoS27/prometheus-1
Implement SpinLocks, Fibers and a Host Timer
5 years ago
Fernando Sahmkow 7b893c7963 Common: Fix non-conan build 5 years ago
Morph 97ba520434 common/telemetry: Add AVX512 to telemetry 5 years ago
Morph d6474b4aca common/cpu_detect: Add AVX512 detection 5 years ago
Fernando Sahmkow e77ee67bfa Common/Fiber: Address Feedback and Correct Memory leaks. 5 years ago
Fernando Sahmkow b6655aa2e4 Common/Fiber: Implement Rewind on Boost Context. 5 years ago
Fernando Sahmkow 59ce6e6d06 Common/uint128: Correct MSVC Compilation in old versions. 5 years ago
Fernando Sahmkow 18f54f7486 Common/Fiber: Document fiber interexchange. 5 years ago
Fernando Sahmkow 137d862d9b Common/Fiber: Implement Rewinding. 5 years ago
Fernando Sahmkow 41013381d6 Common/Fiber: Additional corrections to f_context. 5 years ago
Fernando Sahmkow 7d2b1a6ec4 Common/Fiber: Correct f_context based Fibers. 5 years ago
Fernando Sahmkow 49a7e0984a Core/HostTiming: Allow events to be advanced manually. 5 years ago
Fernando Sahmkow 1f7dd36499 Common/Tests: Address Feedback 5 years ago
Fernando Sahmkow 3398f701ee Common: Make MinGW build use Windows Fibers instead of fcontext_t 5 years ago
Fernando Sahmkow 1bd706344e Common/Tests: Clang Format. 5 years ago
Fernando Sahmkow 03e4f5dac4 Common: Correct fcontext fibers. 5 years ago
Fernando Sahmkow e3524d1142 Common: Refactor & Document Wall clock. 5 years ago
Fernando Sahmkow 234b5ff6a9 Common: Implement WallClock Interface and implement a native clock for x64 5 years ago
Fernando Sahmkow 0f8e5a1465 Tests: Add base tests to host timing 5 years ago
Fernando Sahmkow be320a9e10 Common: Polish Fiber class, add comments, asserts and more tests. 5 years ago
Fernando Sahmkow 8d0e3c5422 Tests: Add tests for fibers and refactor/fix Fiber class 5 years ago
Fernando Sahmkow bc266a9d98 Common: Implement a basic Fiber class. 5 years ago
Fernando Sahmkow 13ed9438fb Common: Implement a basic SpinLock class 5 years ago
bunnei a8ac99b619
Merge pull request #4086 from MerryMage/abi
xbyak_abi: Cleanup
5 years ago
MerryMage 7c6203dc5e xbyak_abi: Prefer returning a struct to using out parameters in ABI_CalculateFrameSize 5 years ago
MerryMage 36362e9695 xbyak_abi: Register indexes should be unsigned 5 years ago
MerryMage d563017dfe xbyak_abi: Remove *GPS variants of stack manipulation functions 5 years ago
MerryMage 4417770ba9 xbyak_abi: Fix ABI_PushRegistersAndAdjustStack
Pushing GPRs twice.
5 years ago
ReinUsesLisp a63a0daa5e gl_arb_decompiler: Implement an assembly shader decompiler
Emit code compatible with NV_gpu_program5.
This should emit code compatible with Fermi, but it wasn't tested on
that architecture. Pascal has some issues not present on Turing GPUs.
5 years ago
David Marcec d0bdd26c26 Add xbyak external 5 years ago
Morph b2af304918 Fix macOS code and change "Swapfile" to "Swap" 5 years ago
Morph 9a36d8600c main: Log host system memory parameters
Logs both physical memory and swapfile sizes, this is useful for support.
5 years ago
bunnei bba54e1880 time_zone: Use std::chrono::seconds for strong typing. 5 years ago