Commit graph

6862 commits

Author SHA1 Message Date
Lioncash 544fbd5c84 cpu_manager: Make use of ranged for where applicable
We can simplify a few loops by making use of ranged for.
2020-08-22 22:43:19 -04:00
Lioncash 79504f1a39 core_timing: Remove unused header 2020-08-22 22:12:37 -04:00
Lioncash 25cd5d9dda core_timing: Move clock initializer into constructor initializer list
Same behavior, minus unnecessary zeroing out of the pointer.
2020-08-22 20:26:48 -04:00
Lioncash 2624b1eae6 core_timing: Resolve sign conversion warning
This constant is only ever assigned to downcount, which is a s64, not a
u64.
2020-08-22 20:26:45 -04:00
bunnei 66ac7cf730
Merge pull request #4541 from MerryMage/yolo
dynarmic: Add unsafe optimizations
2020-08-21 23:06:21 -04:00
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.
2020-08-18 15:08:32 -04:00
Lioncash 551882e512 vfs_real: Resolve sign conversion warnings 2020-08-18 14:58:33 -04:00
Lioncash ed9ae5a977 vfs_real: Avoid redundant map lookups
Avoids some trivially avoidable map lookups by keeping the result of
find operations around and querying them.
2020-08-18 14:58:29 -04:00
bunnei 56c6a5def8
Merge pull request #4535 from lioncash/fileutil
common/fileutil: Convert namespace to Common::FS
2020-08-17 22:35:30 -04:00
bunnei 0530dd6ea1
Merge pull request #4494 from lioncash/transcode
aes_util: Make use of non-template variant of Transcode
2020-08-17 03:50:35 -04:00
MerryMage 836ec9176a dynarmic: Add unsafe optimizations 2020-08-16 14:15:39 +01:00
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.
2020-08-16 06:52:40 -04:00
bunnei 2b601e8636
Merge pull request #4526 from lioncash/core-semi
core: Resolve several -Wextra-semi warnings
2020-08-15 02:14:11 -04:00
bunnei e6f9231ef0
Merge pull request #4527 from lioncash/pessimizing2
software_keyboard: Resolve a pessimizing move warning
2020-08-15 02:13:44 -04:00
bunnei cb6808b4d0
Merge pull request #4492 from lioncash/linkage
system_control: Make functions internally linked where applicable
2020-08-15 02:11:49 -04:00
bunnei 2aabd1eb05
Merge pull request #4463 from lioncash/lockdiscard
kernel/scheduler: Mark SchedulerLock constructor as nodiscard
2020-08-15 01:31:23 -04:00
Lioncash b14277ef97 time_zone_content_manager: Collapse auto and default case
Prevents a useless self-assignment from occurring.
2020-08-14 10:58:58 -04:00
Lioncash 03d5a5d9de software_keyboard: Resolve a pessimizing move warning
A std::vector created in place like this is already an rvalue and
doesn't need to be moved.
2020-08-14 09:14:54 -04:00
Lioncash 2296e921d2 core: Resolve several -Wextra-semi warnings
We can amend one of the cascade macros to require semicolons in order to
compile. In other cases, we can just remove the superfluous semicolons.
2020-08-14 09:09:20 -04:00
Lioncash a93f6e51d3 emu_window: Mark Scoped constructor and Acquire() as nodiscard
Ensures that callers make use of the constructor, preventing bugs from
silently occurring.
2020-08-14 04:43:44 -04:00
Lioncash f808258ed9 kernel/scheduler: Mark SchedulerLock constructor as nodiscard
Allows the compiler to warn about cases where the constructor is used
but then immediately discarded, which is a potential cause of
locking/unlocking bugs.
2020-08-14 04:43:44 -04:00
Rodrigo Locatti e050594706
Merge pull request #4495 from lioncash/conv
cheat_engine: Resolve implicit bool->u64 conversion
2020-08-14 03:10:17 -03:00
LC ff0b14ee62
Merge pull request #4511 from lioncash/build2
General: Tidy up clang-format warnings part 2
2020-08-13 15:13:21 -04:00
Lioncash b724a4d90c General: Tidy up clang-format warnings part 2 2020-08-13 14:19:08 -04:00
bunnei a8ffe6eee4
Merge pull request #4497 from lioncash/freezer-alg
freezer: Make use of std::erase_if
2020-08-11 23:07:17 -04:00
bunnei 257b1d2c4b
Merge pull request #4496 from lioncash/ce-desig
cheat_engine: Make use of designated initializers
2020-08-10 13:53:43 -04:00
bunnei acfd771e79
Merge pull request #4491 from lioncash/unused-vars
kernel: Remove unused variables
2020-08-10 12:04:30 -04:00
bunnei 664019954a
Merge pull request #4488 from lioncash/file
vfs_vector: Make creation of array vfs files less verbose
2020-08-09 17:19:34 -04:00
bunnei 929fc849e9
Merge pull request #4457 from ogniK5377/SetScreenShotPermission
am: Unstub SetScreenShotPermission
2020-08-07 09:34:20 -04:00
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.
2020-08-07 08:09:57 -04:00
bunnei f5d538f118
Merge pull request #4483 from lioncash/constexpr-hex
partition_data_manager: Make data arrays constexpr
2020-08-06 23:14:14 -04:00
bunnei 5cc2f99fab
Merge pull request #4490 from lioncash/arbiter
address_arbiter/scheduler: Resolve sign conversion warnings
2020-08-06 22:28:11 -04:00
Lioncash 61cd7eb47d freezer: Move entry finding to its own function
Cleans up the callsites in other functions.
2020-08-06 03:11:21 -04:00
Lioncash 06ab28263b freezer: Take address values by value
VAddr will always be 64-bit, so there's no need to take a trivial
primitive alias by reference.
2020-08-06 03:04:54 -04:00
Lioncash 253a17451b freezer: Make use of std::erase_if
With C++20 we can simplify the erasing idiom.
2020-08-06 03:03:05 -04:00
Lioncash 5b89291308 cheat_engine: Resolve implicit bool->u64 conversion
We can just return zero here.
2020-08-06 02:55:47 -04:00
Lioncash df96a214ae cheat_engine: Make use of designated initializers
Same behavior, but makes the member being assigned obvious.
2020-08-06 02:48:13 -04:00
Lioncash 4f2acc54f5 partition_data_manager: Update master key hashes
Fills in some hashes that were previously unhandled.
2020-08-06 02:42:01 -04:00
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.
2020-08-06 02:41:58 -04:00
Lioncash 04bb47f57f partition_data_manager: Eliminate magic value
We can use sizeof to make it obvious at the call site where the value is
coming from.
2020-08-06 02:34:10 -04:00
Lioncash 09f884b7bd aes_util: Make use of non-template variant of Transcode
Same behavior, less template instantiations.
2020-08-06 02:31:19 -04:00
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!
2020-08-05 20:34:49 -07:00
bunnei 1cc0e4b4d8
Merge pull request #4489 from lioncash/typesafe
ipc_helpers: Only allow trivially copyable objects with PushRaw() and PopRaw()
2020-08-05 23:20:23 -04:00
bunnei 35c1607f23
Merge pull request #4484 from lioncash/aesutil
aes_util: Allow SetIV() to be non-allocating
2020-08-05 22:35:41 -04:00
bunnei 61678c4e9f
Merge pull request #4475 from lioncash/bqueue
buffer_queue: Make use of designated initializers/std::nullopt where applicable
2020-08-05 16:56:46 -04:00
Lioncash 87c64c41d2 system_control: Make functions internally linked where applicable
These functions are only ever used internally as implementation details
for GenerateRandomRange(), so these can be given internal linkage.
2020-08-05 15:34:27 -04:00
Lioncash a10d64ea79 kernel: Remove unused variables
Resolves a few compiler warnings.
2020-08-05 15:19:48 -04:00
Lioncash 9893da8e2c scheduler: Resolve sign conversion warning 2020-08-05 15:12:29 -04:00
Lioncash 1a45b15a8c address_arbiter: Resolve sign conversion warning
Makes our type conversion explicit.
2020-08-05 15:07:19 -04:00
bunnei 4a2d9c6454
Merge pull request #4444 from lioncash/volatile
common/atomic_ops: Don't cast away volatile from pointers
2020-08-05 14:22:36 -04:00
Lioncash a77ee63f65 ipc_helpers: Only allow trivially copyable objects with PushRaw() and PopRaw()
It's undefined behavior to use non-trivially copyable objects with
std::memcpy, so we can add asserts to catch usages of these at
compile-time.
2020-08-05 14:08:28 -04:00
Lioncash 0a5456feb9 vfs_vector: Make creation of array vfs files less verbose
We can add a helper function to make creation of these files nicer.
While we're at it, we can eliminate an unnecessary std::array copy in
the constructor. This makes the overhead on some of these functions way
less intensive, given some arrays were quite large.

e.g. The timezone location names are 9633 bytes in size.
2020-08-05 12:37:00 -04:00
bunnei 07691f994a
Merge pull request #4466 from ogniK5377/loader-type-safe
loader: Make IdentifyFile typesafe
2020-08-05 12:34:25 -04:00
bunnei 142930e609
Merge pull request #4476 from lioncash/tz
time_zone_binary: Make use of designated initializers
2020-08-04 18:56:28 -04:00
bunnei ba9ed7b1fe
Merge pull request #4401 from ogniK5377/GetIndirectLayerImageRequiredMemoryInfo
vi: IApplicationDisplayService:GetIndirectLayerImageRequiredMemoryInfo
2020-08-04 18:45:11 -04:00
bunnei f11628b9b7
Merge pull request #4430 from bunnei/new-gpu-vmm
hle: nvdrv: Rewrite of GPU memory management.
2020-08-04 18:44:26 -04:00
bunnei ecbee11829
Merge pull request #4472 from lioncash/const-get
perf_stats: Mark GetMeanFrametime() as const
2020-08-04 07:00:23 -07:00
David 741cbbdc0e
Merge pull request #4470 from lioncash/qualifier
patch_manager: Resolve -Wignored-qualifier warnings
2020-08-04 14:09:48 +10:00
David 723314b682
Merge pull request #4481 from lioncash/cpp-dep
yuzu: Resolve C++20 deprecation warnings related to lambda captures
2020-08-04 14:06:07 +10:00
David 25fb7cd16d
Merge pull request #4474 from lioncash/hle-profile
profile_manager: Make use of designated initializers
2020-08-04 13:51:15 +10:00
bunnei c6e5a36452
Merge pull request #4473 from lioncash/cheat-desig
dmnt_cheat_vm: Make use of designated initializers
2020-08-03 18:07:17 -07:00
bunnei 0dbb95c42d
Merge pull request #4456 from Morph1984/stub-really-long-fs-func
fsp-srv: Stub Read/WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute
2020-08-03 18:06:48 -07:00
Lioncash 15660bd857 aes_util: Allow SetIV to be non-allocating
In a few places, the data to be set as the IV is already within an array.
We shouldn't require this data to be heap-allocated if it doesn't need
to be. This allows certain callers to reduce heap churn.
2020-08-03 14:29:58 -04:00
bunnei 9808f244cc
Merge pull request #4482 from lioncash/ldr-sign
service/ldr: Resolve sign mismatch warnings
2020-08-03 11:27:13 -07:00
bunnei a971667d1f
Merge pull request #4468 from lioncash/regcache
registered_cache: Resolve -Wmaybe_uninitialized warnings
2020-08-03 11:26:45 -07:00
bunnei 94c1689ef3
Merge pull request #4471 from ogniK5377/sm-getservice-concept
sm: Make use of IsBaseOf for GetService
2020-08-03 11:11:22 -07:00
Lioncash 570150bc86 perf_stats: Make use of designated initializers
Same behavior, but allows us to avoid a now-unnecessary zero
initialization.
2020-08-03 12:33:40 -04:00
Lioncash d767be65be perf_stats: Mark GetMeanFrametime() as const
The general pattern is to mark mutexes as mutable when it comes to
matters of constness, given the mutex acts as a transient member of a
data structure.
2020-08-03 12:33:35 -04:00
Lioncash b249e4e0ce yuzu: Resolve C++20 deprecation warnings related to lambda captures
C++20 deprecates capturing the this pointer via the '=' capture.
Instead, we replace it or extend the capture specification.
2020-08-03 11:54:04 -04:00
Lioncash f525da56e5 service/ldr: Resolve sign mismatch warnings
We were performing an int < size_t comparison. We can just correct the
type of the induction variable.
2020-08-03 11:48:16 -04:00
bunnei 3697fc8d14
Merge pull request #4467 from lioncash/mode
file_sys/mode: Make use of DECLARE_ENUM_FLAG_OPERATORS with Mode
2020-08-03 08:07:56 -07:00
Lioncash 04ca1ed2bd time_zone_binary: Make use of designated initializers 2020-08-03 10:42:38 -04:00
Lioncash 9b837c6069 buffer_queue: Make use of std::nullopt
Allows compilers to eliminate unnecessary zeroing out of the optional's
buffer.
2020-08-03 09:31:51 -04:00
Lioncash 24bd068a08 buffer_queue: Make use of designated initializers 2020-08-03 09:31:51 -04:00
Lioncash b9831fd80a profile_manager: Make use of std::nullopt
Allows some implementations to completely avoid unnecessarily zeroing
out the internal buffer.
2020-08-03 09:03:42 -04:00
Lioncash 3fcaf937d2 profile_manager: Make use of designated initializers
More compact code.
2020-08-03 09:01:31 -04:00
Lioncash c883666045 dmnt_cheat_vm: Make use of designated initializers
Allows for more compact code.
2020-08-03 08:50:51 -04:00
Lioncash 2b8ae009a0 file_sys/mode: Make use of DECLARE_ENUM_FLAG_OPERATORS with Mode
Same behavior, minus a hand-rolled operator.
2020-08-03 07:52:36 -04:00
David Marcec 6a0b77996b sm: Make use of IsBaseOf for GetService 2020-08-03 21:46:14 +10:00
Lioncash 1c6d3ba397 patch_manager: Resolve -Wignored-qualifier warnings
Top level const will always be ignored in this case, so it can be
removed.
2020-08-03 07:42:56 -04:00
Lioncash 4ca0014479 registered_cache: Resolve -Wmaybe_uninitialized warnings
While we're at it, we can avoid a redundant map lookup.
2020-08-03 07:34:46 -04:00
David Marcec a5af1161c9 Place in anonymous namespace 2020-08-03 21:31:28 +10:00
David Marcec 6cfff2c3f6 loader: Make IdentifyFile typesafe
Relies on #4465 for concept.h Common::IsBaseOf
2020-08-03 21:31:27 +10:00
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
2020-08-03 07:28:54 -04:00
David 0ca42c806f
Merge pull request #4439 from lioncash/cpu
cpu_manager: Remove redundant std::function declarations
2020-08-03 20:58:31 +10:00
Morph fc86cb4ca2 minor nits 2020-07-31 11:02:59 -04:00
David Marcec e586921c28 am: Unstub SetScreenShotPermission 2020-08-01 00:44:14 +10:00
Morph 1241020093 fsp-srv: Stub Read/WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute
Stub these 2 service commands required for Animal Crossing: New Horizons Update 1.4.0
2020-07-30 15:39:44 -04:00
Morph 45fd67c109 fs: Rename SaveDataDescriptor to SaveDataAttribute 2020-07-30 15:29:39 -04:00
Morph ed46f3c62a xts_archive: Check if the file is nullptr prior to parsing
Fixes an access violation where the file no longer exists at the specified path while being parsed.
2020-07-29 06:50:30 -04:00
Morph 2ec852dd9f registered_cache: Add support for removing folder ncas 2020-07-29 06:50:30 -04:00
bunnei b205b12e75
Merge pull request #4442 from lioncash/devicemem
device_memory: Remove unused system member
2020-07-28 13:03:30 -07:00
Morph 8d42456dc2 configure_graphics: Remove Force 30 FPS mode
The introduction of multicore rendered this setting non-functional as timing code was changed.

This removes the setting entirely.
2020-07-28 08:07:26 -04:00
Lioncash e3f0c93230 common/atomic_ops: Don't cast away volatile from pointers
Preserves the volatility of the pointers being casted.
2020-07-28 04:36:53 -04:00
ReinUsesLisp bc699ace15 service/bsd: Handle Poll with no entries accurately
Testing shows that Poll called with zero entries returns -1 and signals
an errno of zero.
2020-07-28 01:51:47 -03:00
ReinUsesLisp f7d59f3e0e services/bsd: Implement most of bsd:s
This implements: Socket, Poll, Accept, Bind, Connect, GetPeerName,
GetSockName, Listen, Fcntl, SetSockOpt, Shutdown, Recv, RecvFrom,
Send, SendTo, Write, and Close

The implementation was done referencing: SwIPC, switchbrew, testing
with libnx and inspecting its code, general information about bsd
sockets online, and analysing official software.

Not everything from these service calls is implemented, but everything
that is not implemented will be logged in some way.
2020-07-28 01:48:42 -03:00
ReinUsesLisp 2c67bbf609 service/sockets: Add worker pool abstraction
Manage worker threads with an easy to use abstraction.
We can expand this to support thread deletion in the future.
2020-07-28 01:47:03 -03:00
ReinUsesLisp 5692c48ab7 service/sockets: Add worker abstraction to execute blocking calls asynchronously
This abstraction allows executing blocking functions (like recvfrom on a
socket configured for blocking) without blocking the service thread.
It is intended to be used with SleepClientThread.
2020-07-28 01:47:03 -03:00
ReinUsesLisp 80b4bd3583 service/sockets: Add translate functions
These functions translate from Network enumerations/structures to guest
enumerations/structures and viceversa.
2020-07-28 01:47:03 -03:00
ReinUsesLisp 22263ccaa4 service/sockets: Add enumerations and structures
Add guest enumerations and structures used in socket services
2020-07-28 01:47:03 -03:00