Commit Graph

4575 Commits

Author SHA1 Message Date
bunnei 3ef134a092
Merge pull request #1307 from lioncash/pl
services/pl_u: Add missing Korean font to the fallback case for shared fonts
2018-09-13 19:49:39 -04:00
Lioncash 50a5d09d32 kernel/errors: Amend error code for ERR_NOT_FOUND
This is the value returned by the kernel for svcConnectToNamedPort() if
the named port cannot be found.
2018-09-13 17:12:01 -04:00
Lioncash 0258b444ef service/vi: Replace includes with forward declarations where applicable 2018-09-13 16:55:47 -04:00
Lioncash 2ea45fe75b kernel/thread: Include thread-related enums within the kernel namespace
Previously, these were sitting outside of the Kernel namespace, which
doesn't really make sense, given they're related to the Thread class
which is within the Kernel namespace.
2018-09-13 16:05:57 -04:00
Lioncash a0e51d8b98 service: Use nested namespace specifiers where applicable
There were a few places where nested namespace specifiers weren't being
used where they could be within the service code. This amends that to
make the namespacing a tiny bit more compact.
2018-09-13 15:52:55 -04:00
Valentin Vanelslande 2ec9fbc2d4
ipc: minor fix 2018-09-13 11:59:23 -05:00
Lioncash ce97d8ef6c services/pl_u: Add missing Korean font to the fallback case for shared fonts
Previously this wasn't using the Korean font at all.
2018-09-12 19:23:51 -04:00
bunnei 926dd41587
Merge pull request #1163 from FearlessTobi/add-audio-stretching
audio_core: Add audio stretching support
2018-09-12 18:23:54 -04:00
bunnei d9e21eebe8
Merge pull request #1297 from lioncash/pl
pl_u: Eliminate mutable file-scope state
2018-09-12 16:03:53 -04:00
bunnei 79217f9870
Merge pull request #1303 from lioncash/error
kernel/errors: Amend invalid thread priority and invalid processor ID error codes
2018-09-12 12:14:51 -04:00
Lioncash fbe462099b svc: Return ERR_INVALID_PROCESSOR_ID in CreateThread() if an invalid processor ID is given
This is what the kernel does for an out-of-range processor ID.
2018-09-12 05:20:02 -04:00
Lioncash 3c5c292592 kernel/errors: Correct error codes for invalid thread priority and invalid processor ID 2018-09-12 05:19:57 -04:00
Lioncash 9b3bc0b282 svc: Do nothing if svcOutputDebugString() is given a length of zero
While unlikely, it does avoid constructing a std::string and
unnecessarily calling into the memory code if a game or executable
decides to be really silly about their logging.
2018-09-12 04:51:44 -04:00
Lioncash 04d723baf9 svc: Correct parameter type for OutputDebugString()
This should be a u64 to represent size.
2018-09-12 04:49:11 -04:00
bunnei 475222a496
Merge pull request #1296 from lioncash/prepo
service/prepo: Move class into the cpp file
2018-09-11 23:15:07 -04:00
Lioncash c243bc09d4 service/audio: Replace includes with forward declarations where applicable
A few headers were including other headers when a forward declaration
can be used instead, allowing the include to be moved to the cpp file.
2018-09-11 21:54:33 -04:00
Lioncash c061e27155 pl_u: Eliminate mutable file-scope state
Converts the PL_U internals to use the PImpl idiom and makes the state
part of the Impl struct, eliminating mutable global/file state.
2018-09-11 21:24:19 -04:00
Lioncash 325c259fc5 service/prepo: Move class into the cpp file
This doesn't need to be exposed within the header and be kept in the
translation unit, eliminating the need to include anything within the
header.
2018-09-11 20:49:01 -04:00
bunnei 1470b85af9
Merge pull request #1291 from lioncash/default
hle/service: Default constructors and destructors in the cpp file where applicable
2018-09-11 11:42:05 -04:00
Lioncash 46ba1bc40f externals: Place font data within cpp files
This places the font data within cpp files, which mitigates the
possibility of the font data being duplicated within the binary if it's
referred to in more than one translation unit in the future. It also
stores the data within a std::array, which is more flexible when it
comes to operating with the standard library.

Furthermore, it makes the data arrays const. This is what we want, as it
allows the compiler to store the data within the read-only segment. As
it is, having several large sections of mutable data like this just
leaves spots in memory that we can accidentally write to (via accidental
overruns, what have you) and actually have it work. This ensures the
font data remains the same no matter what.
2018-09-11 04:25:33 -04:00
Lioncash 6ac955a0b4 hle/service: Default constructors and destructors in the cpp file where applicable
When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.

The cause of the above mentioned non-obvious errors can be demonstrated
as follows:

------- Demonstrative example, if you know how the described error happens, skip forwards -------

Assume we have the following in the header, which we'll call "thing.h":

\#include <memory>

// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;

class Thing {
public:
    // assume no constructors or destructors are specified here,
    // or the constructors/destructors are defined as:
    //
    // Thing() = default;
    // ~Thing() = default;
    //

    // ... Some interface member functions would be defined here

private:
    std::shared_ptr<Object> obj;
};

If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:

1. Decrement the shared reference count of the object being pointed to,
   and if the reference count decrements to zero,

2. Free the Object instance's memory (aka deallocate the memory it's
   pointing to).

And so the compiler generates the code for the destructor doing this inside main.cpp.

Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.

Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.

---------------------- End example ----------------------------

Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
2018-09-10 23:55:31 -04:00
Tobias 3bac3051fc Use open-source shared fonts if no dumped file is available (#1269)
* Add open-source shared fonts

* Address review comments
2018-09-10 21:31:01 -04:00
Markus Wick 0cfb0bacb2 video_core: Move command buffer loop.
This moves the hot loop into video_core. This refactoring shall reduce the CPU overhead of calling ProcessCommandList.
2018-09-10 22:06:13 +02:00
bunnei 50c191439d
Merge pull request #1276 from FearlessTobi/fix-stupid-stub
hid: Implement ReloadInputDevices
2018-09-09 22:31:04 -04:00
Lioncash 136040ee15 service: Remove unused g_kernel_named_ports variable
With the named port functionality all migrated over to the kernel,
there's no need to keep this around anymore.
2018-09-09 22:10:54 -04:00
fearlessTobi 500e81429a hid: Implement ReloadInputDevices 2018-09-09 00:57:41 +02:00
fearlessTobi a6efff8b02 Add audio stretching support 2018-09-08 18:26:23 +01:00
Lioncash 3f17fe7133 core: Migrate current_process pointer to the kernel
Given we now have the kernel as a class, it doesn't make sense to keep
the current process pointer within the System class, as processes are
related to the kernel.

This also gets rid of a subtle case where memory wouldn't be freed on
core shutdown, as the current_process pointer would never be reset,
causing the pointed to contents to continue to live.
2018-09-06 20:52:58 -04:00
bunnei a164b413fa
Merge pull request #1250 from lioncash/file-sys
file_sys/{nca_patch, patch_manager}: Amend unnecessary/missing includes.
2018-09-06 19:20:09 -04:00
Lioncash 56ab608044 core/core: Remove unnecessary sm/controller include
The only reason this include was necessary, was because the constructor
wasn't defaulted in the cpp file and the compiler would inline it
wherever it was used. However, given Controller is forward declared, all
those inlined constructors would see an incomplete type, causing a
compilation failure. So, we just place the constructor in the cpp file,
where it can see the complete type definition, allowing us to remove
this include.
2018-09-06 14:38:39 -04:00
Lioncash 54724fe918 file_sys/nca_patch: Amend constructor initializer list order
Orders the elements in the initializer list in the order they're
specified in the class. This prevents compiler warnings about
initialization order.
2018-09-06 14:00:11 -04:00
Lioncash b155b3ef81 file_sys/nca_patch: Remove unnecessary includes
romfs.h doesn't need to be included in the header, the only real
dependency here is common's swap.h that needs to be included.
2018-09-06 13:58:53 -04:00
Lioncash a859a35ec8 file_sys/patch_manager: Add missing includes
These includes were previously being satisfied indirectly.
2018-09-06 13:53:23 -04:00
bunnei 94f193af65
Merge pull request #1242 from lioncash/file-sys
file_sys/submission_package: Replace includes with forward declarations where applicable
2018-09-05 18:53:32 -04:00
Lioncash 6bd6beee20 file_sys/submission_package: Correct constructor initialization list order
Orders the elements in the sequence to match the order in which they'll
actually be initialized in.
2018-09-05 13:44:42 -04:00
Lioncash c0b7ed8b58 file_sys/submission_package: Replace includes with forward declarations where applicable 2018-09-05 12:08:04 -04:00
Zach Hilman c913136eb2 bktr: Fix bucket overlap error 2018-09-04 17:01:54 -04:00
Zach Hilman 7d5d781b20 drd: Parse title ID from program metadata 2018-09-04 16:25:30 -04:00
Zach Hilman 23a16c1720 patch_manager: Centralize Control-type NCA parsing 2018-09-04 16:25:10 -04:00
Zach Hilman 92e26df00f nsp: Fix error masking issue with XCI files
Now display correct error instead of catch-all MissingProgramNCA
2018-09-04 16:24:24 -04:00
Zach Hilman c91b60a421 game_list: Fix version display on non-NAND titles 2018-09-04 16:24:02 -04:00
Zach Hilman cbd517d8cc bktr: Add logging on successful patch 2018-09-04 16:24:02 -04:00
Zach Hilman a6e75cd45b bktr: Implement IVFC offset shifting
Fixes base game read errors
2018-09-04 16:24:02 -04:00
Zach Hilman 9664ce255d bktr: Fix missing includes and optimize style 2018-09-04 16:24:02 -04:00
Zach Hilman f5e03b9173 loader: Add BKTR-specific error messages and codes 2018-09-04 16:23:44 -04:00
Zach Hilman 08fcb4694f loader: Ignore patches on NRO and DRD 2018-09-04 16:23:15 -04:00
Zach Hilman 97bf83bc56 patch_manager: Add usages of patches to ExeFS 2018-09-04 16:23:15 -04:00
Zach Hilman 8e900a301a file_sys: Add class to manage game patches
Right now only includes Updates, but should eventually contain all of the other patches we need.
2018-09-04 16:22:25 -04:00
Zach Hilman 54e7ddb93a file_sys: Add BKTR patching mechanism 2018-09-04 16:22:25 -04:00
Zach Hilman 1efe5a76b1 content_archive: Add BKTR header parsing to NCA 2018-09-04 16:22:25 -04:00
Zach Hilman 9951f6d054 registration: Add RegisteredCacheUnion
Aggregates multiple caches into one interface
2018-09-04 16:21:40 -04:00
Zach Hilman d2caf4af7d game_list: Use RegisteredCacheUnion for installed
Reduces code
2018-09-04 16:21:40 -04:00
Zach Hilman 99fbcb3bf2 aes_util: Fix error involving reads of less than 0x10
Issues with block size are fixed by making all reads minimum length of 0x10
2018-09-04 16:21:40 -04:00
Zach Hilman 87be4bc283 main: Only show DRD deprecation warning once 2018-09-04 14:44:48 -04:00
Zach Hilman e973cceadd control_metadata: Use alternate language names if AmericanEnglish isn't available 2018-09-04 14:30:03 -04:00
Zach Hilman 23d2c50479 card_image: Add program title ID getter 2018-09-04 14:29:19 -04:00
Zach Hilman e4e55d064e nsp: Comply with style and performance guidelines 2018-09-04 14:29:19 -04:00
Zach Hilman 58473309a0 qt: Add UI support for NSP files 2018-09-04 14:28:41 -04:00
Zach Hilman f7eaea424d registration: Add support for installing NSP files 2018-09-04 14:28:41 -04:00
Zach Hilman d7518cf6e0 loader: Add AppLoader for NSP files 2018-09-04 14:27:33 -04:00
Zach Hilman 5c8aff984e card_image: Parse XCI secure partition with NSP
Eliminated duplicate code and adds support for Rev1+ carts
2018-09-04 14:27:33 -04:00
Zach Hilman 93703431e2 file_sys: Add Nintendo Submission Package (NSP) 2018-09-04 14:25:54 -04:00
Zach Hilman a040929c90 drd: Load title ID from program metadata
Previously only loaded from control metadata
2018-09-04 14:25:54 -04:00
Zach Hilman b555311438 loader: Add NSP file type and NSP-specific errors 2018-09-04 14:25:54 -04:00
Zach Hilman d770c60205 key_manager: Avoid autogeneration if key exists 2018-09-04 14:25:54 -04:00
bunnei 9a07e9f805
Merge pull request #1237 from degasus/optimizations
Optimizations
2018-09-04 12:16:06 -04:00
bunnei ed37b68fb5
Merge pull request #1223 from DarkLordZach/custom-nand-sd-dirs
file_sys: Allow for custom NAND/SD directories
2018-09-04 11:54:22 -04:00
bunnei 8ec1e16867
Merge pull request #1235 from lioncash/forward-decl
file_sys: Replace includes with forward declarations where applicable
2018-09-04 11:51:54 -04:00
bunnei 5a29b358aa
Merge pull request #1236 from degasus/microprofile
Update microprofile scopes.
2018-09-04 11:50:58 -04:00
bunnei c156ee8eb8
Merge pull request #1230 from lioncash/ssl
ssl: Move SSL class to cpp file
2018-09-04 11:49:22 -04:00
Markus Wick dce624e3f1 core: Use a raw pointer in GetGPUDebugContext.
This helper is called very often. The memory ownership shall not be transfered, so just return the raw pointer.
2018-09-04 14:10:05 +02:00
Markus Wick 10bc725944 Update microprofile scopes.
Blame the subsystems which deserve the blame :)

The updated list is not complete, just the ones I've spotted on random sampling the stack trace.
2018-09-04 11:04:26 +02:00
Lioncash a813c10e1c file_sys: Replace includes with forward declarations where applicable
Cuts down on include dependencies, resulting in less files that need to
be rebuilt when certain things are changed.
2018-09-03 22:52:24 -04:00
bunnei 1c5636e690
Merge pull request #1231 from lioncash/global
service: Migrate global named port map to the KernelCore class
2018-09-03 21:21:12 -04:00
Zach Hilman b2268f1f8d settings: Save and load NAND/SD dirs from config 2018-09-03 19:23:33 -04:00
Lioncash a405373144 vfs_real: Forward declare IOFile
Eliminates the need to rebuild some source files if the file_util header
ever changes. This also uncovered some indirect inclusions, which have
also been fixed.
2018-09-02 12:38:14 -04:00
Lioncash 1242c1ec0a service: Migrate global named port map to the KernelCore class
Now that we have a class representing the kernel in some capacity, we
now have a place to put the named port map, so we move it over and get
rid of another piece of global state within the core.
2018-09-02 12:35:30 -04:00
Lioncash 41cd766438 ssl: Move SSL class to cpp file
This isn't required to be visible to anything outside of the main source
file, and will eliminate needing to rebuild anything else including the
header if the SSL class needs to be changed in the future.
2018-09-02 11:45:26 -04:00
bunnei 325f3e0693
Merge pull request #1213 from DarkLordZach/octopath-fs
filesystem/maxwell_3d: Various changes to boot Project Octopath Traveller
2018-09-02 10:49:18 -04:00
Lioncash fda8f1da20 filesystem: Move dir retrieval after path checking in DeleteFile()
We don't need to do the lookup if the path is considered empty
currently.
2018-09-02 09:20:17 -04:00
Zach Hilman 19d0951ae6 filesystem: Implement OpenReadOnlySaveDataFilesystem 2018-08-31 23:19:49 -04:00
Zach Hilman 7939ea18e8 filesystem: Add OpenFileSystemWithPatch 2018-08-31 23:19:23 -04:00
Lioncash 4a587b81b2 core/core: Replace includes with forward declarations where applicable
The follow-up to e2457418da, which
replaces most of the includes in the core header with forward declarations.

This makes it so that if any of the headers the core header was
previously including change, then no one will need to rebuild the bulk
of the core, due to core.h being quite a prevalent inclusion.

This should make turnaround for changes much faster for developers.
2018-08-31 16:30:14 -04:00
bunnei d647d9550c gl_renderer: Cache textures, framebuffers, and shaders based on CPU address. 2018-08-31 13:07:27 -04:00
Lioncash e2457418da core: Make the main System class use the PImpl idiom
core.h is kind of a massive header in terms what it includes within
itself. It includes VFS utilities, kernel headers, file_sys header,
ARM-related headers, etc. This means that changing anything in the
headers included by core.h essentially requires you to rebuild almost
all of core.

Instead, we can modify the System class to use the PImpl idiom, which
allows us to move all of those headers to the cpp file and forward
declare the bulk of the types that would otherwise be included, reducing
compile times. This change specifically only performs the PImpl portion.
2018-08-31 07:16:57 -04:00
Lioncash 0cbcd6ec9a kernel: Eliminate kernel global state
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.

This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.

This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.

The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
2018-08-28 22:31:51 -04:00
bunnei 4d7e1662c8
Merge pull request #1193 from lioncash/priv
gpu: Make memory_manager private
2018-08-28 12:28:57 -04:00
Lioncash 45fb74d262 gpu: Make memory_manager private
Makes the class interface consistent and provides accessors for
obtaining a reference to the memory manager instance.

Given we also return references, this makes our more flimsy uses of
const apparent, given const doesn't propagate through pointers in the
way one would typically expect. This makes our mutable state more
apparent in some places.
2018-08-28 11:11:50 -04:00
Lioncash f1bc62bb4c hle/result: Make ResultVal's move constructor as noexcept
Many containers within the standard library provide different behaviors
based on whether or not a move constructor/assignment operator can be
guaranteed not to throw or not.

Notably, implementations will generally use std::move_if_noexcept (or an
internal implementation of it) to provide strong exception guarantees.
If a move constructor potentially throws (in other words, is not
noexcept), then certain behaviors will create copies, rather than moving
the values.

For example, consider std::vector. When a std::vector calls resize(),
there are two ways the elements can be relocated to the new block of
memory (if a reallocation happens), by copy, or by moving the existing
elements into the new block of memory. If a type does not have a
guarantee that it will not throw in the move constructor, a copy will
happen. However, if it can be guaranteed that the move constructor won't
throw, then the elements will be moved.

This just allows ResultVal to be moved instead of copied all the time if
ever used in conjunction with containers for whatever reason.
2018-08-28 09:39:50 -04:00
bunnei a409d49bbd
Merge pull request #1177 from lioncash/err
kernel/error: Amend several error codes
2018-08-27 18:37:48 -04:00
bunnei 90fd03015a
Merge pull request #1188 from lioncash/unused
vfs_real: Remove unused variable in CreateDirectoryRelative()
2018-08-27 18:24:23 -04:00
bunnei 62edc01525
Merge pull request #1175 from lioncash/ns
core: Namespace all code in the arm subdirectory under the Core namespace
2018-08-27 18:17:12 -04:00
bunnei 5d2043598e
Merge pull request #1187 from lioncash/shadow
registered_cache: Get rid of variable shadowing in ProcessFiles()
2018-08-27 18:15:49 -04:00
Lioncash c6024379a4 vfs_real: Remove unused variable in CreateDirectoryRelative() 2018-08-27 15:58:23 -04:00
Lioncash d3934d7da7 registered_cache: Get rid of variable shadowing in ProcessFiles()
Prevents compiler warnings.
2018-08-27 15:55:56 -04:00
bunnei af59d4bff0
Merge pull request #1176 from lioncash/info
svc: Return process title ID if queried in GetInfo()
2018-08-27 15:44:52 -04:00
bunnei f96ded9815
Merge pull request #1174 from lioncash/debug
debug_utils: Minor individual interface changes
2018-08-27 15:44:29 -04:00
bunnei 8c66a5a9a5
Merge pull request #1162 from ogniK5377/ttf-plu
PL:U Added SharedFonts loading via TTF
2018-08-27 15:43:10 -04:00
bunnei 34a447d24e
Merge pull request #1168 from lioncash/header
hid: Move core include to cpp file
2018-08-27 15:42:52 -04:00
bunnei 8d86747514
Merge pull request #1171 from lioncash/true
core: Remove always true conditionals in Load()
2018-08-27 15:41:58 -04:00
tech4me d26a46feed set: Fixed GetAvailableLanguageCodes() to follow the max_entries
Rightnow, in games use GetAvailableLanguageCodes(), there is a WriteBuffer() with size larger than the buffer_size. (Core Critical core\hle\kernel\hle_ipc.cpp:WriteBuffer:296: size (0000000000000088) is greater than buffer_size (0000000000000078))

0x88 = 17(languages) * 8
0x78 = 15(languages) * 8

GetAvailableLanguageCodes() can only support 15 languages.
After firmware 4.0.0 there are 17 supported language instead of 15, to enable this GetAvailableLanguageCodes2() need to be used.
So GetAvailableLanguageCodes() will be caped at 15 languages.
Reference:
http://switchbrew.org/index.php/Settings_services
2018-08-26 00:11:13 -07:00
Lioncash f708207ae6 kernel/error: Amend error code for ERR_MAX_CONNECTIONS_REACHED
We can make this error code an alias of the resource limit exceeded
error code, allowing us to get rid of the lingering 3DS error code of
the same type.
2018-08-25 09:40:42 -04:00
Lioncash bfb0c87b7b kernel/error: Amend error code for ERR_PORT_NAME_TOO_LONG
We can treat this as an alias of TooLarge for documentation purposes.
This also lets us get rid of another lingering 3DS-related error code.
2018-08-25 09:40:29 -04:00
Lioncash 81ca46dd17 kernel/error: Add error code for the handle table being full
This replaces the lingering 3DS constant with the proper one, and
utilizes it within HandleTable's Create() member function.
2018-08-25 09:40:21 -04:00
Lioncash b8be5524bc kernel/error: Add error code for invalid memory permissions 2018-08-25 09:40:12 -04:00
Lioncash 2fd45093f2 kernel/error: Correct kernel error code for invalid combination 2018-08-25 09:40:00 -04:00
Sebastian Valle f170159fde
Merge pull request #1166 from lioncash/typo
filesystem: Fix typo in log message
2018-08-25 07:19:46 -05:00
Lioncash e81354ae38 svc: Return process title ID if queried in GetInfo()
We already have the variable itself set up to perform this task, so we
can just return its value from the currently executing process instead
of always stubbing it to zero.
2018-08-25 05:02:28 -04:00
Mat M 6426b0f551
Merge pull request #1094 from DarkLordZach/nax0
file_sys: Add support for NAX archives
2018-08-24 23:47:46 -04:00
Zach Hilman 6314a799aa file_sys/crypto: Fix missing/unnecessary includes 2018-08-24 22:15:32 -04:00
Lioncash 43e0d865fa core: Namespace all code in the arm subdirectory under the Core namespace
Gets all of these types and interfaces out of the global namespace.
2018-08-24 21:50:39 -04:00
Lioncash c65713832c debug_utils: Remove unused includes
Quite a bit of these aren't necessary directly within the debug_utils
header and can be removed or included where actually necessary.
2018-08-24 20:49:14 -04:00
Zach Hilman f09da5d1c9
Merge pull request #1065 from DarkLordZach/window-title
qt: Add filename and title id to window title while running
2018-08-24 14:34:03 -04:00
Lioncash 8492ec1669 core: Remove always true conditionals in Load()
These conditions are always true, since the outer conditional already
checks for these conditions.
2018-08-24 02:48:30 -04:00
Lioncash ec59e4a6c5 hid: Move core include to cpp file
This isn't required to be in the header. Instead, directly include what
this header needs and move it to the cpp file where it belongs.
2018-08-23 23:20:35 -04:00
Lioncash f6f5c2e4d8 filesystem: Fix typo in log message 2018-08-23 22:12:31 -04:00
Zach Hilman d1a6dd61d1 xci: Ignore NCA files with updates in secure 2018-08-23 18:53:37 -04:00
Zach Hilman 4f18c17df7 content_archive: Add update title detection
This is needed because the title IDs of update NCAs will not use the update title ID. The only sure way to tell is to look for a partition with BKTR crypto.
2018-08-23 18:53:13 -04:00
David 5049ca5d8c Added GetBootMode (#1107)
* Added GetBootMode

Used by homebrew

* Added enum for GetBootMode
2018-08-23 18:31:45 -04:00
Zach Hilman 67fa51ea2f qt: Add filename and title id to window title while running 2018-08-23 14:12:56 -04:00
David Marcec 78b109d195 Addressed plu TTF changes 2018-08-24 02:18:04 +10:00
Zach Hilman ccfd176382 key_manager: Eliminate indexed for loop 2018-08-23 11:53:30 -04:00
Zach Hilman 119ab308b5 key_manager: Create keys dir if it dosen't exist
On call to WriteKeyToFile, so that the autogenerated file can be written.
2018-08-23 11:53:30 -04:00
Zach Hilman a7e8d10969 file_sys: Cut down on includes and copies 2018-08-23 11:53:30 -04:00
Zach Hilman 42dc856ce1 crypto: Eliminate magic constants 2018-08-23 11:53:30 -04:00
Zach Hilman 61a5b56abd key_manager: Add support for autogenerated keys
Stored in a separate file than manual keys.
2018-08-23 11:53:30 -04:00
Zach Hilman f26fc64cb4 key_manager: Add support for KEK and SD seed derivation 2018-08-23 11:53:30 -04:00
Zach Hilman cde665c565 key_manager: Switch to boost flat_map for keys
Should make key gets marginally faster.
2018-08-23 11:53:30 -04:00
Zach Hilman ab44192ab0 file_sys: Implement NAX containers 2018-08-23 11:53:30 -04:00
Zach Hilman 8b52d6682a registration: Add GetEntryUnparsed methods
Returns the file before calling parser on it.
2018-08-23 11:53:30 -04:00
Zach Hilman 13524578b6 sdmc_factory: Add SDMC RegisteredCache getter 2018-08-23 11:53:30 -04:00
Zach Hilman bf33f80fae vfs: Add GetOrCreateDirectoryRelative method 2018-08-23 11:52:44 -04:00
Zach Hilman ef3768f323 filesystem: Add CreateFactories methods to fs
Allows frontend to create registration caches for use before a game has booted.
2018-08-23 11:52:44 -04:00
Zach Hilman 410062031b filesystem: Add logging to registration getters 2018-08-23 11:52:44 -04:00
Zach Hilman b247e0cab0 loader: Add new NAX-specific errors and messages 2018-08-23 11:52:44 -04:00
Zach Hilman 2164702cf7 nax: Add AppLoader_NAX and update loader to support it 2018-08-23 11:52:44 -04:00
Zach Hilman c4845df3d4 xts_encryption_layer: Implement XTSEncryptionLayer 2018-08-23 11:52:44 -04:00
Zach Hilman 10e5356e9a aes_util: Make XTSTranscode stricter about sizes
XTS with Nintendo Tweak will fail mysteriously if the sector size is not 0x4000. Upgrade the critical log to an assert to prevent undefined behavior.
2018-08-23 11:52:44 -04:00
Zach Hilman 6dd369ab88 ctr_encryption_layer: Fix bug when transcoding small data
Fixes a bug where data lengths of less than size 0x10 will fail or have misleading return values.
2018-08-23 11:52:44 -04:00
Zach Hilman a9dc5a3c10 xci: Fix error masking issue
Prevents NCA-related errors from being masked into MissingProgramNCA or MissingKeyFile
2018-08-23 11:52:44 -04:00
David Marcec eccc77a8c8 Added SharedFonts loading via TTF
By having the following TTF files in your yuzu sysdata directory. You can load sharedfonts via TTF files.
FontStandard.ttf
FontChineseSimplified.ttf
FontExtendedChineseSimplified.ttf
FontChineseTraditional.ttf
FontKorean.ttf
FontNintendoExtended.ttf
FontNintendoExtended2.ttf
2018-08-23 14:42:06 +10:00
bunnei b38d67d940
Merge pull request #1136 from tech4me/master
qt/main: Port part of citra(#3411), open savedata works
2018-08-22 01:30:08 -04:00
bunnei cea627b0fc
Merge pull request #840 from FearlessTobi/port-3353
Port #3353 from Citra: "citra-qt: Add customizable speed limit target "
2018-08-22 01:19:50 -04:00
David Marcec 15cc34b93e Added missing include for pl:u
Should fix any compile errors
2018-08-22 12:39:52 +10:00
David 99fc32428a PL:U Added BFTTF loading(Loading from System NAND dumps) (#1088)
* Added bfttf loading

We can now load system bfttf fonts from system archives AND shared memory dumps. This allows people who have installed their system nand dumps to yuzu to automatically get shared font support. We also now don't hard code the offsets or the sizes of the shared fonts and it's all calculated for us now.

* Addressed plu fixups

* Style changes for plu

* Fixed logic error for plu and added more error checks.
2018-08-21 21:31:49 -04:00
bunnei ac68c8a605
Merge pull request #1145 from lioncash/fwd-decl
vfs: Replace mode.h include with forward declarations where applicable
2018-08-21 18:00:28 -04:00
Lioncash 29ac15d1b8 vfs: Replace mode.h include with forward declarations where applicable
Avoids the need to rebuild these source files if the mode header
changes.
2018-08-21 15:06:42 -04:00
Lioncash 8dd9cb98ce am: Utilize std::array within PopLaunchParameter()
Gets rid of the potential for C array-to-pointer decay, and also makes
pointer arithmetic to get the end of the copy range unnecessary. We can
just use std::array's begin() and end() member functions.
2018-08-21 11:03:14 -04:00
bunnei c95c4442e9
Merge pull request #1143 from lioncash/inc
sdmc_factory: Remove unnecessary core include
2018-08-21 10:22:29 -04:00
MerryMage 3f4fb4b037 perf_stats: Change MAX_LAG_TIME_US to an appropriate value
25us is far too small, and would result in std::this_thread::sleep_for
being called with this as a maximum value. This means that a guest
application that produces frames instantly would only be limited to
40 kHz.

25ms is a more appropriate value, as it allows for a 60 Hz refresh
rate while providing enough slack in the negative region.
2018-08-21 14:50:50 +01:00
Lioncash bfb28c5b3f sdmc_factory: Remove unnecessary core include
This doesn't require the central core header to be included, it just
needs the vfs headers.
2018-08-21 07:54:29 -04:00
tech4me cc71832b19 qt/main: Port part of citra(#3411), open savedata works 2018-08-21 02:04:33 -07:00
bunnei 79243b6fa0
Merge pull request #1129 from lioncash/header
romfs_factory, service/filesystem: Use forward declarations where applicable
2018-08-21 01:18:04 -04:00
Lioncash 477eee3993 service/filesystem: Use forward declarations where applicable
Avoids the need to rebuild multiple source files if the filesystem code
headers change.

This also gets rid of a few instances of indirect inclusions being
relied upon
2018-08-20 23:28:46 -04:00
bunnei c4ce7e456a
Merge pull request #1126 from lioncash/telem
telemetry_session: Don't allocate std::string instances for program lifetime in GetTelemetryId() and RegenerateTelemetryId()
2018-08-20 22:15:56 -04:00
bunnei 19b05c3f55
Merge pull request #1122 from lioncash/acc
acc/profile_manager: General cleanup
2018-08-20 20:54:34 -04:00
Lioncash 96463d0a55 romfs_factory: Remove unnecessary includes and use forward declarations where applicable
Avoids the need to rebuild whatever includes the romfs factory header if
the loader header ever changes. We also don't need to include the main
core header. We can instead include the headers we specifically need.
2018-08-20 20:27:00 -04:00
bunnei dd70ddad7e
Merge pull request #1095 from DarkLordZach/sysarchives
filesystem: Add support for loading of system archives
2018-08-20 20:17:57 -04:00
Lioncash b5fb246a99 telemetry_session: Don't allocate std::string instances for program lifetime in GetTelemetryId() and RegenerateTelemetryId()
Given these functions aren't intended to be used frequently, there's no
need to keep the std::string instances allocated for the whole lifetime
of the program. It's just a waste of memory.
2018-08-20 20:06:25 -04:00
Lioncash 609cb04f3f acc: Replace profile_manager include with a forward declaration
This is only used in a shared_ptr, so we can forward declare it.
2018-08-20 19:48:57 -04:00
Lioncash eb88fedc5d acc: Simplify WriteBuffer call within LoadImage()
We have an overload of WriteBuffer that accepts containers that satisfy
the ContiguousContainer concept, which std::array does, so we only need
to pass in the array itself.
2018-08-20 19:48:57 -04:00
Lioncash f5b132676f acc: Correct IProfile's constructor initializer list order
Arranges them in the order the members would be initialized
2018-08-20 19:48:57 -04:00
Lioncash 0fcdf37917 acc: Remove unused DEFAULT_USER_ID
This is no longer used, so it can be removed.
2018-08-20 19:48:57 -04:00
Lioncash 350f6e0aa4 profile_manager: Use INVALID_UUID in the initializer of last_opened_user
Makes it a little bit more self-documenting.
2018-08-20 19:48:57 -04:00
Lioncash 9d8f19d7bf profile_manager: Remove unnecessary memcpy in GetProfileBaseAndData()
Given the source and destination types are the same std::array type, we
can simply use regular assignment to perform the same behavior.
2018-08-20 19:48:57 -04:00
Lioncash 38cd4e9c61 profile_manager: Use type aliases for username data, profile data, and user arrays
Avoids the need to repeatedly specify the whole array type in multiple
places.
2018-08-20 19:48:57 -04:00
Lioncash f9a26d468c profile_manager: Take ProfileInfo by const reference where applicable
ProfileInfo is quite a large struct in terms of data, and we don't need
to perform a copy in these instances, so we can just pass constant
references instead.
2018-08-20 19:48:57 -04:00
Lioncash 1277556c69 profile_manager: Make array parameter to CreateNewUser a const reference
This doesn't modify the passed in array, so this can be a const
reference.
2018-08-20 19:48:57 -04:00
Lioncash dfdf4a46fe profile_manager: Remove unnecessary static
This can just be constexpr like the others
2018-08-20 19:48:57 -04:00
Lioncash 69dd37d874 profile_manager: Simplify UUID's two param constructor, operator==, and operator bool
We can use the constructor initializer list and just compare the
contained u128's together instead of comparing each element
individually. Ditto for comparing against an invalid UUID.
2018-08-20 19:48:57 -04:00
Lioncash f13a66b963 profile_manager: Move UUID generation function to the cpp file
This avoids needing to dump the contents of <random> into other files
that include the profile manager header.
2018-08-20 19:48:53 -04:00
bunnei b1d238bbb8
Merge pull request #1064 from lioncash/telemetry
common/telemetry: Migrate core-independent info gathering to common
2018-08-20 19:43:17 -04:00
fearlessTobi ba8ff096fd Port #3353 from Citra 2018-08-21 01:14:06 +02:00
Zach Hilman e8cb6f5c9b registration: Add Data_Unknown5 NCAContentType 2018-08-20 17:34:18 -04:00
Lioncash 9e9a4bb3a7 profile_manager: Remove unnecessary std::move in AddToProfiles() and CreateNewUser()
Moving a const reference isn't possible, so this just results in a copy
(and given ProfileInfo is composed of trivial types and aggregates, a
move wouldn't really do anything).
2018-08-20 17:18:31 -04:00
bunnei 185b35bfcd
Merge pull request #1117 from ogniK5377/CheckFreeCommunicationPermission
Added CheckFreeCommunicationPermission
2018-08-20 11:00:26 -04:00
bunnei 943771e703
Merge pull request #1017 from ogniK5377/better-account
New account backend to allow for future extended support
2018-08-20 10:59:15 -04:00
David Marcec 8a88110060 Added CheckFreeCommunicationPermission
This fixes save files not loading in splatoon 2
2018-08-20 18:14:49 +10:00
Zach Hilman 27da7bc9da filesystem: Add support for loading of system archives 2018-08-18 21:28:23 -04:00
greggameplayer 2003771789 Implement SetIdleTimeDetectionExtension & GetIdleTimeDetectionExtension (#1059)
* Used by Mario Tennis Aces
2018-08-17 00:23:08 -04:00
bunnei f246fd778d
Merge pull request #1090 from lioncash/ctor-assign
core: Delete System copy/move constructors and assignment operators
2018-08-17 00:19:55 -04:00
bunnei 224be09d66
Merge pull request #1093 from greggameplayer/GetDefaultDisplayResolutionChangeEvent
Implement GetDefaultDisplayResolutionChangeEvent
2018-08-17 00:18:35 -04:00
bunnei 0d9b3e425e
Merge pull request #1087 from MerryMage/dynarmic
dynarmic: Update to 550d662
2018-08-16 18:07:11 -04:00
greggameplayer cef35e7c9c
correct coding style 2018-08-16 23:46:06 +02:00
greggameplayer 928e78dced Implement GetDefaultDisplayResolutionChangeEvent
Require by Toki Tori and Toki Tori 2+
2018-08-16 23:25:54 +02:00
bunnei 3fd78f4d24
Merge pull request #1085 from lioncash/namespace
common: Namespace hex_util.h/.cpp
2018-08-16 11:54:42 -04:00
Lioncash a0ce6de913 core: Delete System copy/move constructors and assignment operators
Prevents potentially making copies or doing silly things by accident
with the System instance, particularly given our current core is
designed (unfortunately) around one instantiable instance.

This will prevent the accidental case of:

auto instance = System::Instance();

being compiled without warning when it's supposed to be:

auto& instance = System::Instance();
2018-08-16 10:21:14 -04:00
MerryMage 94329038b6 dynarmic: Update to 550d662
550d662 load_store_exclusive: Define s == t state to be Constraint_NONE
0b69381 A64/translate: Allow for unpredictable behaviour to be defined
6d236d4 system: Implement MRS CNTFRQ_EL0
6cbb6fb A32/testenv: Add missing headers
6729328 externals: Update xbyak to v5.67
1812bd2 Squashed 'externals/xbyak/' changes from 2794cde7..671fc805
9a95802 externals: Document subtrees
714a840 A64: Implement SQ{ADD, SUB}, and UQ{ADD, SUB}'s vector variants
8cab459 A64: Implement UQADD/UQSUB's scalar variants
18a8151 ir: Add opcodes for unsigned saturating add and subtract
a5660ee x64/reg_alloc: Use type alias for array returned by GetArgumentInfo()
29489b5 ir/value: Use type alias CoprocessorInfo for std::array<u8, 8>
e23ba26 status_register_access: Add support for bits 0 and 1 of mask to MSR
55190bd fuzz_with_unicorn: Split utility functions into fuzz_util
23b049d A32/translate/load_store: Correct detection of writeback
7ec9f15 A32/translate: Add TranslateSingleInstruction
efeecb4 A32/ir_emitter: Bug fix: IREmitter::ExceptionRaised using incorrect opcode
08d1d19 A32/decoders: Split instruction list into include file
2d929cc tests: Refactor unicorn_emu to allow for A32 unicorn
f672368 microinstruction: Improve assert messages
7ebff50 emit_x64_vector: EmitVectorNarrow16: AVX512 implementation
edce230 emit_x64_vector: EmitVectorNarrow32: prefer pblendw to loading constant
2018-08-16 10:12:20 +01:00
bunnei 24a759de4a
Merge pull request #1075 from lioncash/include
loader/{nca, xci}: Remove unnecessary includes and unused member variables
2018-08-16 00:04:25 -04:00
Lioncash b39cd70cd4 common: Namespace hex_util.h/.cpp
It's in the common code, so it should be under the Common namespace like
everything else.
2018-08-15 23:24:00 -04:00
bunnei c594ec3417
Merge pull request #1005 from DarkLordZach/registered-fmt
file_sys: Add support for registration format
2018-08-15 23:11:58 -04:00
bunnei c00b374e78
Merge pull request #1078 from lioncash/message
lm: Handle threads and modules within the logger
2018-08-15 18:53:47 -04:00
bunnei 69236e5aff
Merge pull request #1079 from lioncash/fmt
loader: Make ResultStatus directly compatible with fmt
2018-08-15 18:25:57 -04:00
bunnei 1dd27aff47
Merge pull request #1051 from B3n30/UnscheduleEventThreadsafe
Core::CoreTiming: add UnscheduleEventThreadsafe
2018-08-15 18:25:30 -04:00
bunnei cee6a7ab55
Merge pull request #1080 from lioncash/ret
sm/controller: Correct return value of QueryPointerBufferSize
2018-08-15 18:25:05 -04:00
Lioncash aac5792a2b kernel/server_session: Add IsSession() member function
Allows querying the inverse of IsDomain() to make things more readable.
This will likely also be usable in the event of implementing
ConvertDomainToSession().
2018-08-15 06:50:50 -04:00
Lioncash 5752454629 sm/controller: Correct return value of QueryPointerBufferSize
This should be returning a u16 according to Switch Brew.
2018-08-15 06:16:10 -04:00
Lioncash 87d8a9c986 loader: Make ResultStatus directly compatible with fmt
We can make the enum class type compatible with fmt by providing an
overload of operator<<.

While we're at it, perform proper bounds checking. If something exceeds
the array, it should be a hard fail, because it's, without a doubt, a
programmer error in this case.
2018-08-15 05:52:37 -04:00
Lioncash 0769aa594e loader/nca: Remove unnecessary includes and member variables 2018-08-15 01:41:40 -04:00
Lioncash c8e3f98c27 loader/xci: Remove unnecessary includes and member variables
Many of these aren't necessary and will cause this file to be required
to be recompiled whenever any changes to those files are made, which
lengthens compile times for no reason.

This also removes an unused metadata variable from AppLoader_XCI
2018-08-15 01:41:35 -04:00
Lioncash b74df62959 lm: Use LOG_DEBUG for printing out trace logs
Using LOG_TRACE here isn't a good idea because LOG_TRACE is only enabled
when yuzu is compiled in debug mode. Debug mode is also quite slow, and
so we're potentially throwing away logging messages that can provide
value when trying to boot games.
2018-08-15 01:07:41 -04:00
Lioncash e0b0f4eece lm: Handle threads and modules within the logger
The thread field serves to indicate which thread a log is related to and
provides the length of the thread's name, so we can print that out,
ditto for modules.

Now we can know what threads are potentially spawning off logging
messages (for example Lydie & Suelle bounces between MainThread and
LoadingThread when initializing the game).
2018-08-15 01:05:50 -04:00
bunnei 301baaa942
Merge pull request #1067 from lioncash/init
emu_window: Ensure WindowConfig members are always initialized
2018-08-14 22:43:32 -04:00
bunnei 3db1b8e0cd
Merge pull request #1073 from lioncash/3ds
loader: Remove address mapping remnants from citra
2018-08-14 22:43:04 -04:00
bunnei 8f9c49f7ee
Merge pull request #1072 from lioncash/svc
kernel/svc: Log svcBreak parameters
2018-08-14 22:42:44 -04:00
bunnei 409d2e07c2
Merge pull request #1056 from lioncash/mm
mm_u: Move interface class into the cpp file
2018-08-14 21:47:07 -04:00
Lioncash 96c0b81a51 loader: Remove address mapping remnants from citra
These mappings are leftovers from citra and don't apply to the Switch.
2018-08-14 21:37:03 -04:00
Lioncash 25d71454d1 kernel/svc: Log svcBreak parameters
Given if we hit here all is lost, we should probably be logging the
break reason code and associated information to distinguish between the
causes.
2018-08-14 20:54:05 -04:00
Lioncash 2e715ef70d emu_window: Ensure WindowConfig members are always initialized
Previously we weren't always initializing all members of the struct.
Prevents potentially wonky behavior from occurring.
2018-08-14 19:36:43 -04:00
Lioncash 60f476cd8f common/telemetry: Migrate core-independent info gathering to common
Previously core itself was the library containing the code to gather
common information (build info, CPU info, and OS info), however all of
this isn't core-dependent and can be moved to the common code and use
the common interfaces. We can then just call those functions from the
core instead.

This will allow replacing our CPU detection with Xbyak's which has
better detection facilities than ours. It also keeps more
architecture-dependent code in common instead of core.
2018-08-14 18:57:46 -04:00
bunnei d1520410a3
Merge pull request #1055 from lioncash/init
audout_u: Correct IAudioOut initializer list order
2018-08-14 08:03:33 -04:00
Mat M 309564abe3
Merge pull request #1046 from ogniK5377/missing-channels
Added missing channel devices
2018-08-13 19:36:26 -04:00
Lioncash b6c47b578f mm_u: Forward all old variants of functions to the new ones
Ensures both variants go through the same interface, and while we're at
it, add Finalize to provide the inverse of Initialize for consistency.
2018-08-13 18:59:10 -04:00
Lioncash 9d09d92c56 mm_u: Move implementation class into the cpp file
Now if changes are ever made to the behavior of the class, it doesn't
involve rebuilding everything that includes the mm_u header.
2018-08-13 18:59:07 -04:00
Lioncash 57d007e545 audout_u: Correct IAudioOut initializer list order
Orders elements in the precise order they'll be initialized.
2018-08-13 18:23:59 -04:00
MerryMage fcc5155601 arm_dynarmic: Remove IsExecuting check from PrepareReschedule
No longer required. HaltExecution is a no-op if it is not currently executing.
2018-08-13 13:59:01 +01:00
B3n30 eab35c8235 Core::CoreTiming: add UnscheduleEventThreadsafe 2018-08-13 13:56:41 +02:00
bunnei e67630b51e
Merge pull request #1032 from lioncash/sanitize
vfs: Use sanitized paths within MoveFile() and MoveDirectory()
2018-08-13 01:43:35 -04:00
bunnei bd14653417
Merge pull request #1031 from lioncash/verbosity
card_image: Simplify return statement of GetSubdirectories()
2018-08-13 01:42:07 -04:00
Lioncash 3476f5b4d3 kernel/object: Tighten object against data races
Despite being covered by a global mutex, we should still ensure that the
class handles its reference counts properly. This avoids potential
shenanigans when it comes to data races.

Given this is the root object that drives quite a bit of the kernel
object hierarchy, ensuring we always have the correct behavior (and no
races) is a good thing.
2018-08-13 00:16:40 -04:00
David Marcec 76fad8410d Registered missing channel devices 2018-08-13 14:03:50 +10:00
David Marcec 92492ee23b Added missing channel devices 2018-08-13 14:00:27 +10:00
bunnei fecffeb0dd
Merge pull request #1043 from Subv/timing
Use an approximated amortized amount of ticks when advancing timing.
2018-08-12 22:31:55 -04:00
bunnei 9608f51cde
Merge pull request #1036 from lioncash/thread
scheduler: Make HaveReadyThreads() a const member function
2018-08-12 22:13:14 -04:00
bunnei e4ed5bc836
Merge pull request #1042 from Subv/races
Fixed a bunch of race conditions when running in multicore mode.
2018-08-12 22:05:48 -04:00
bunnei de5d431eec
Merge pull request #1041 from Subv/duplicated_mutex
Kernel/Mutex: Don't duplicate threads in the mutex waiter list.
2018-08-12 22:02:03 -04:00
Subv d923766042 CPU/Timing: Use an approximated amortized amount of ticks when advancing timing.
We divide the number of ticks to add by the number of cores (4) to obtain a more or less rough estimate of the actual number of ticks added. This assumes that all 4 cores are doing similar work. Previously we were adding ~4 times the number of ticks, thus making the games think that time was going way too fast.

This lets us bypass certain hangs in some games like Breath of the Wild.

We should modify our CoreTiming to support multiple cores (both running in a single thread, and in multiple host threads).
2018-08-12 20:41:28 -05:00
Subv a9877c8f65 Kernel/SVC: Don't reschedule the current core when creating a new thread.
The current core may have nothing to do with the core where the new thread was scheduled to run. In case it's the same core, then the following PrepareReshedule call will take care of that.
2018-08-12 20:38:37 -05:00
Subv 2e7802ad7d Core/HLE: Make the 'reschedule_pending' flag atomic.
Another thread may write to this variable while the core in question is in the middle of checking for a reschedule request.
2018-08-12 18:41:12 -05:00
Subv 3a338d9286 CPU/HLE: Lock the HLE mutex before performing a reschedule.
Another thread might be in the middle of an SVC, thus altering the state of the schedulers.
2018-08-12 18:41:11 -05:00
Subv 84b542c386 Kernel/Threads: Lock the HLE mutex when executing the wakeup callback.
Another thread might be in the middle of a reschedule, thus altering the state of the schedulers.
2018-08-12 18:41:11 -05:00
Subv 0135b328ed Kernel/Thread: Always use the threadsafe option when scheduling wakeups.
WakeAfterDelay might be called from any host thread, so err on the side of caution and use the thread-safe CoreTiming::ScheduleEventThreadsafe.

Note that CoreTiming is still far from thread-safe, there may be more things we have to work on for it to be up to par with what we want.
2018-08-12 18:40:56 -05:00
Subv 5224cc49c4 Kernel/Mutex: Don't duplicate threads in the mutex waiter list.
Exit from AddMutexWaiter early if the thread is already waiting for a mutex owned by the owner thread.

This accounts for the possibility of a thread that is waiting on a condition variable being awakened twice in a row.

Also added more validation asserts.

This should fix one of the random crashes in Breath Of The Wild.
2018-08-12 16:35:27 -05:00
Lioncash b82b093108 vfs: Make VfsFilesystem constructor explicit
Makes it consistent with the other VFS interfaces and prevents implicit
construction.
2018-08-12 16:55:40 -04:00
Lioncash cf0a7cd1c1 vfs: Make type hierarchy objects classes instead of structs
struct should be used when the data type is very simple or otherwise has
no invariants associated with it. Given these are used to form a
hierarchy, class should be used instead.
2018-08-12 16:55:40 -04:00
bunnei 424e90f0f5
Merge pull request #1025 from ogniK5377/bad-cast
Fixed invalid cast in loader
2018-08-12 16:22:35 -04:00
Zach Hilman 35e4a47be0 registration: Various style and documentation improvements
Fix logic in RealVfsFilesystem Create methods
Remove magic numbers
Fix regex errors
2018-08-12 15:55:44 -04:00
bunnei 4cafc24a4e
Merge pull request #1035 from ogniK5377/audio-dev-revision-info
GetAudioDeviceServiceWithRevisionInfo (Used by Bloodstained: Curse of the Moon)
2018-08-12 14:56:11 -04:00
bunnei 68c44ca0ee
Merge pull request #1028 from ogniK5377/aoa
Added GetAudioRendererSampleRate, GetAudioRendererSampleCount & GetAudioRendererMixBufferCount
2018-08-12 13:33:08 -04:00
Lioncash e850ff63bc scheduler: Make HaveReadyThreads() a const member function
This function doesn't modify instance state, so the const qualifier can
be added to it.
2018-08-12 12:55:58 -04:00
David Marcec 66f4f86a82 GetAudioDeviceServiceWithRevisionInfo
As we're not handling any anything about the revision data for GetAudioDeviceServiceWithRevisionInfo, it's currently marked as stubbed. However for games this shouldn't affect the result. Proper revision info would be more for homebrew.
2018-08-12 22:47:39 +10:00
Lioncash 63a70c253e hid: disable clang-format around tables
Prevents clang-format from butchering them.
2018-08-12 05:57:33 -04:00
Lioncash 9e74d6238e hid: Stub DisconnectNpad()
This is required by ARMS.
2018-08-12 05:56:28 -04:00
Lioncash 75bba25009 vfs: Use sanitized paths within MoveFile() and MoveDirectory()
Previously these were being unused (or partially unused). While we're at
it, use better naming to make it visibly obvious which variant of the
path is being used.
2018-08-12 04:05:01 -04:00
Lioncash 7b6519741b card_image: Use type aliases to shorten definitions
We have the aliases, so we may as well use 'em.
2018-08-12 03:57:16 -04:00
Lioncash d6a1a43854 card_image: Simplify return statement of GetSubdirectories()
We don't need to write out the construction long-form, we can just let
the language itself work it out off the return type.
2018-08-12 03:53:20 -04:00
David Marcec 094f6003e0 Pushed the requested sample rate instead of our fixed sample rate 2018-08-12 14:58:36 +10:00
David Marcec 98b940052c made ResultStatus a u16 2018-08-12 14:56:22 +10:00
David Marcec e5ee0afe6f Added GetAudioRendererSampleRate, GetAudioRendererSampleCount & GetAudioRendererMixBufferCount
GetAudioRendererSampleRate is set as a "STUB" as a game could check if the sample rate it sent and the sample rate it wants don't match. Just a thought of something which could happen so keeping it as stub for the mean time
2018-08-12 14:46:12 +10:00
David Marcec ecfbe7d9c8 Stub UpdateUserPresence
Needed for Retro City Rampage to go in game
2018-08-12 14:00:44 +10:00
David Marcec a1fb8a331f Fixed invalid cast in loader
GetMessageForResultStatus takes a u16, not a size_t.
2018-08-12 13:31:15 +10:00
Zach Hilman 6b76b77400 registration: Add support for force overwrite of installed 2018-08-11 23:01:42 -04:00
Zach Hilman 8f06a0f898 vfs_real: Add CreateFullPath to Create* operations 2018-08-11 22:50:48 -04:00
Zach Hilman dda8ef11c7 control_metadata: Remove unnecessary reference to base file 2018-08-11 22:50:48 -04:00
Zach Hilman 149bda980a romfs: Remove cyclic shared_ptr leak in romfs code 2018-08-11 22:50:48 -04:00
Zach Hilman 893447b6b0 registration: Update documentation and style 2018-08-11 22:50:48 -04:00
Zach Hilman 22bdddd6f0 nca_metadata: Remove unnecessary reference to base file 2018-08-11 22:50:48 -04:00
Zach Hilman 62e859c6c7 bis_factory: Create NAND dirs if they don't exist 2018-08-11 22:50:48 -04:00
Zach Hilman 3b3c919e20 registration: Take RawCopy function as parameter
Instead of defaulting to VfsRawCopy
2018-08-11 22:50:48 -04:00
Zach Hilman e5504a060d registered_cache: Fix missing reading from yuzu_meta 2018-08-11 22:50:48 -04:00
Zach Hilman 167bfddafa file_sys: Comply to style guidelines 2018-08-11 22:50:48 -04:00
Zach Hilman bfb945c243 qt: Add 'Install to NAND' option to menu
Prompts for title type on NCA files.
2018-08-11 22:50:48 -04:00
Zach Hilman a91983b11c file_sys: Add RegisteredCache
Manages NAND NCA get and install.
2018-08-11 22:50:48 -04:00
Zach Hilman 9aab787122 file_sys: Add support for parsing NCA metadata (CNMT) 2018-08-11 22:50:48 -04:00
Zach Hilman ab8acce645 card_image: Add accessor for all NCAs in XCI 2018-08-11 22:50:48 -04:00
Zach Hilman 9b0e3556ed vfs_real: Add CreateFullPath to CreateFile
Fixes bugs with calling CreateFile when the immediate directory does not exist.
2018-08-11 22:50:48 -04:00
Zach Hilman c0257cf52f filesystem: Add Open and Register functions for BISFactory 2018-08-11 22:50:48 -04:00
Zach Hilman 70a510bd8f bis_factory: Add partial implementation of BISFactory
Creates and stores RegisteredCaches for user and system NAND, as creation of a RegisteredCache is expensive.
2018-08-11 22:50:48 -04:00
Zach Hilman 95bb1067c1 loader: Join 0* files in directory if filename is 00
i.e. Load the concatenated 00+01 if 01 exists as well. Needed for split NAND NCAs.
2018-08-11 22:50:48 -04:00
Zach Hilman 5b4119fa7f loader: Recognize filename '00' as NCA
Needed to avoid mismatch filetype warnings on split NAND NCAs
2018-08-11 22:50:08 -04:00
Zach Hilman 42114e1df4 vfs: Add ConcatenatedVfsFile 2018-08-11 22:50:08 -04:00
Zach Hilman a27ec24c0f crypto: Remove hex utilities from key_manager
Move to hex_util.h in common
2018-08-11 22:50:08 -04:00
bunnei a921d22545
Merge pull request #1022 from bunnei/fix-splat
Several Friend service fixes
2018-08-11 22:42:45 -04:00
bunnei 249341d08f friend: Stub DeclareCloseOnlinePlaySession.
- Used by Splatoon 2.
2018-08-11 21:34:14 -04:00
bunnei 261a4f0311 friend: Fix CreateFriendService to return an IFriendService interface. 2018-08-11 21:29:58 -04:00
bunnei ca4bf671ce server_session: Provide more useful information and don't crash on bad IPC request. 2018-08-11 21:15:24 -04:00
Lioncash 0a93b45b6a core: Namespace EmuWindow
Gets the class out of the global namespace.
2018-08-11 20:20:21 -04:00
bunnei bc286c169f
Merge pull request #970 from DarkLordZach/loader-errors
loader: Add more descriptive errors
2018-08-11 19:25:30 -04:00
David Marcec 10f494eefe Better UUID randomness 2018-08-12 02:31:43 +10:00
David Marcec 448290bee4 Removed un-needed count from ListOpenUsers and ListAllUsers 2018-08-12 02:11:04 +10:00
David Marcec 2592e41301 Added better explanations in the profile manager 2018-08-12 01:51:31 +10:00
David Marcec 0b6f8ba51e Code cleanup for profile manager 2018-08-12 01:34:22 +10:00
David Marcec d0b2950434 Removed const from ProfileBase Invalidate 2018-08-12 00:41:17 +10:00
David Marcec 42431d2aa6 fixed invalid uuid bool operator 2018-08-11 21:29:10 +10:00
David Marcec b8e70faa2d Added GetOpenUserCount 2018-08-11 20:45:06 +10:00
David Marcec 662218e997 Removed all for loops from the profile manager 2018-08-11 20:15:59 +10:00
David Marcec c3013c7c9c Added missing ListAllUsers count 2018-08-11 20:06:06 +10:00
David Marcec acff922762 If statement style change 2018-08-11 18:46:42 +10:00
David Marcec dfea525cbe Second round of account changes 2018-08-11 18:26:13 +10:00
David Marcec 82fa0bcea7 First round of account changes 2018-08-11 16:47:33 +10:00
David Marcec 6aa8ee6943 Refactored profile manager sharing 2018-08-11 13:17:06 +10:00
David Marcec b76ddb7647 Merge remote-tracking branch 'origin/master' into better-account 2018-08-11 10:35:47 +10:00
David Marcec 2a3b335b15 Added IsUserRegistrationRequestPermitted 2018-08-11 10:33:11 +10:00
Lioncash 20c2928c2b video_core; Get rid of global g_toggle_framelimit_enabled variable
Instead, we make a struct for renderer settings and allow the renderer
to update all of these settings, getting rid of the need for
global-scoped variables.

This also uncovered a few indirect inclusions for certain headers, which
this commit also fixes.
2018-08-10 19:00:09 -04:00
Zach Hilman ec3bef7b4c loader: Add more descriptive errors
Full list of new errors and descriptions in core/loader/loader.h
2018-08-09 21:06:59 -04:00
bunnei 5191c20b71
Merge pull request #997 from lioncash/const-func
core: Make function reference parameters const where applicable
2018-08-09 19:30:51 -04:00
bunnei 69cd213fac
Merge pull request #990 from lioncash/entry
fsp_srv: Emplace entries first when building index instead of emplacing last
2018-08-09 19:29:36 -04:00
bunnei 96ef22d3d0
Merge pull request #897 from DarkLordZach/vfs-accuracy-2
vfs: Add VfsFilesystem and fix RealVfs* implementations
2018-08-09 19:22:06 -04:00
Lioncash b46a5c42ff buffer_queue: Make reference parameter of SetPreallocatedBuffer const
This is simply copied by value, so there's no need to make it a
modifiable reference.

While we're at it, make the names of the parameters match its
definition.
2018-08-09 03:08:14 -04:00
Lioncash ff5024ee2a hle_ipc: Make WriteToOutgoingCommandBuffer()'s reference parameter const
This function doesn't modify anything within the reference Thread
instance.
2018-08-09 02:51:38 -04:00
David Marcec 4e1471ef21 Don't add user if the uuid already exists 2018-08-09 13:30:58 +10:00
Zach Hilman 668458525e vfs: Fix documentation 2018-08-08 21:45:04 -04:00
bunnei 2f4f4f147f
Merge pull request #986 from mailwl/acc-loadimage
Service/Account: stub LoadImage function
2018-08-08 21:21:06 -04:00
Zach Hilman 94cf327e77 vfs: Fix typo in VfsFilesystem docs 2018-08-08 21:18:45 -04:00
Zach Hilman 2b6128fe0b file_util: Use enum instead of bool for specifing path behavior 2018-08-08 21:18:45 -04:00
Zach Hilman dad2ae1ee0 loader: Remove unused IdentifyFile overload 2018-08-08 21:18:45 -04:00
Zach Hilman 656e97df16 vfs: Use RealVfsFilesystem for fs-operations in RealVfsDirectory 2018-08-08 21:18:45 -04:00
Zach Hilman 52a2e42cb9 file_sys: Add missing include in savedata_factory 2018-08-08 21:18:45 -04:00
Zach Hilman 4b471f0554 core: Port core to VfsFilesystem for file access 2018-08-08 21:18:45 -04:00
Zach Hilman aaa8fdea52 vfs: Add unreachable assert to file permissions converter 2018-08-08 21:18:45 -04:00
Zach Hilman 2de2ec25d6 vfs: Add RealVfsFilesystem implementation 2018-08-08 21:18:45 -04:00
Zach Hilman 3bf488ce52 vfs: Add VfsFilesystem interface and default implementation 2018-08-08 21:18:45 -04:00
Zach Hilman b36dee364e filesystem: Remove unnecessary if conditions 2018-08-08 21:18:45 -04:00
bunnei 9f48454ea9
Merge pull request #978 from bunnei/fixioctl
nvhost_gpu: Don't over copy IoctlSubmitGpfifo.
2018-08-08 19:16:14 -04:00
Lioncash 7353cfc781 fsp_srv: Use std::string_view's copy() function instead of strncpy()
Given elements inserted into a vector are zeroed out, we can just copy
MAX_LEN - 1 elements and the data will already be properly null
terminated.
2018-08-08 18:51:52 -04:00
Lioncash 4afb05d0cc fsp_srv: Emplace entries first when building index instead of emplacing last
The current way were doing it would require copying a 768 character
buffer (part of the Entry struct) to the new element in the vector.
Given it's a plain array, std::move won't eliminate that.

Instead, we can emplace an instance directly into the destination buffer
and then fill it out, avoiding the need to perform any unnecessary
copies.

Given this is done in a loop, we can request the destination to allocate
all of the necessary memory ahead of time, avoiding the need to
potentially keep reallocating over and over on every few insertions into
the vector.
2018-08-08 18:51:41 -04:00
bunnei 756e1e6f9b
Merge pull request #975 from bunnei/am-stub
am: Stub SetScreenShotImageOrientation.
2018-08-08 16:46:45 -04:00
bunnei fd9da4232b
Merge pull request #850 from DarkLordZach/icon-meta
Add Icons and Metadata Support
2018-08-08 12:27:19 -04:00
bunnei 448264e719
Merge pull request #958 from lioncash/nv-global
nvdrv: Get rid of global std::weak_ptr
2018-08-08 11:58:45 -04:00
David Marcec e9978fd4f5 Open first user added 2018-08-09 01:37:55 +10:00
David Marcec 75169c7570 Inital pass of account backend implementation
This commit verified working on puyo
2018-08-09 01:09:12 +10:00
David Marcec 03d7faf583 GetProfileBase and GetProfileBaseAndData added 2018-08-08 23:41:12 +10:00
David Marcec 6f691e71bf began initial implementation of "ProfileManager" 2018-08-08 22:26:42 +10:00
mailwl c0d44d3b2a Service/Account: stub LoadImage function 2018-08-08 14:42:54 +03:00
David Marcec 5f8d253ce0 Switched uuids from u128 to new UUID struct 2018-08-08 21:09:45 +10:00
bunnei 6a5d032809
Merge pull request #965 from lioncash/unused-files
hle: Remove unused romfs.cpp/.h
2018-08-08 03:00:38 -04:00
bunnei 4941e3d412
Merge pull request #974 from lioncash/acc
acc: Add missing function table entries for GetUserCount
2018-08-08 02:56:00 -04:00
mailwl 3c498189b6 hid: fix IsSixAxisSensorAtRest() response 2018-08-08 09:36:23 +03:00
bunnei 0f834e2284 nvhost_gpu: Don't over copy IoctlSubmitGpfifo. 2018-08-08 01:49:47 -04:00
bunnei b7fb9f2071 am: Stub SetScreenShotImageOrientation.
- Used by Super Mario Odyssey.
2018-08-08 00:41:35 -04:00
Lioncash 934a2b9604 acc: Add missing function table entries for GetUserCount
Given this is stubbed within the common module in
5ac7b84, it should be added to the other relevant tables as well.
2018-08-07 22:50:45 -04:00
bunnei 2bc296801a
acc: Stub GetUserCount. (#973)
- Used by Pokken Tournament DX.
2018-08-07 22:39:12 -04:00
Lioncash d378d98e26 nvdrv: Get rid of global std::weak_ptr
Rather than use global state, we can simply pass the instance into the
NVFlinger instance directly.
2018-08-07 21:53:05 -04:00
Lioncash cd1a96f389 hle: Remove unused romfs.cpp/.h
These files are no longer used, so we can get rid of them.
2018-08-07 19:34:12 -04:00
bunnei b9829a05be
Merge pull request #920 from DarkLordZach/titlekey
content_archive: Add support for titlekey cryptography
2018-08-07 17:01:25 -04:00
bunnei 7ed8565978
Merge pull request #957 from lioncash/event
nvflinger: Correct typo in name of composition event
2018-08-07 15:56:51 -04:00
bunnei 6576bc8927
Merge pull request #954 from lioncash/hid
services/hid: Add ActivateNpadWithRevision() to the hid function info array
2018-08-07 15:56:34 -04:00
bunnei 2d57cbaec1
Merge pull request #960 from lioncash/apm
service/apm: Add the apm:sys service
2018-08-07 14:57:12 -04:00
bunnei 573a66c23d
Merge pull request #955 from lioncash/view
nvflinger: Use std::string_view in OpenDisplay()
2018-08-07 14:26:51 -04:00
bunnei 97c6f984dc
Merge pull request #953 from lioncash/time
service/time: Amend command IDs of ToPosixTime() and ToPosixTimeWithMyRule()
2018-08-07 14:25:52 -04:00
bunnei b09c4f45c7
Merge pull request #956 from lioncash/nv
nvdrv: Get rid of indirect inclusions
2018-08-07 14:23:32 -04:00
bunnei c392650e21
Merge pull request #952 from lioncash/usb
service: Add usb services
2018-08-07 11:27:49 -04:00
bunnei 8f73f41824
Merge pull request #949 from lioncash/priv
client_port: Make all data members private
2018-08-07 11:20:26 -04:00
Zach Hilman 3e81c09094 loader: Fix scope error in DeconstructedRomDirectory 2018-08-07 10:37:38 -04:00
Lioncash 12ab5a0547 service/apm: Add the apm:sys service
Adds the basic skeleton of the apm:sys service based off the information
on Switch Brew.
2018-08-07 10:05:26 -04:00
Lioncash d3f64785d1 nvflinger: Correct typo in name of composition event 2018-08-07 09:03:52 -04:00
Lioncash 300ab211e8 nvdrv: Make Ioctl()'s definition match its prototype
The only reason this wasn't a compilation error is because we use
little-endian systems.
2018-08-07 08:57:11 -04:00
Lioncash fa8017295b nvdrv: Get rid of indirect inclusions 2018-08-07 08:54:50 -04:00
Lioncash e40b0cf437 nvflinger: Get rid of indirect inclusions 2018-08-07 08:32:05 -04:00
Lioncash 7e49881b7f nvflinger: Use std::string_view in OpenDisplay()
We don't need to use a std::string here, given all that's done is
comparing the character sequence against another. This allows passing
regular const char* without needing to heap allocate.
2018-08-07 08:32:06 -04:00
Lioncash 890e543304 services/hid: Add ActivateNpadWithRevision() to the hid function info array
Updated based off the information on Switch Brew.
2018-08-07 03:23:20 -04:00
Lioncash 20c976ff2a service/time: Amend command IDs of ToPosixTime() and ToPosixTimeWithMyRule()
Updates the ID of these based off the information on Switch Brew.
2018-08-07 03:18:07 -04:00
Lioncash 45bc449ff9 service: Add usb services
Adds basic skeleton for the usb services based off the information provided by Switch Brew.
2018-08-07 03:14:03 -04:00
Zach Hilman 91cfe70301 loader: Add icon and title support to XCI 2018-08-06 23:13:42 -04:00
Zach Hilman 5927cf0e17 Use const where applicable 2018-08-06 23:06:33 -04:00
Zach Hilman 9e88f03e75 Avoid parsing RomFS to directory in NCA 2018-08-06 23:06:33 -04:00
Lioncash da2f00ab7d client_port: Make all data members private
These members don't need to be entirely exposed, we can instead expose
an API to operate on them without directly needing to mutate them

We can also guard against overflow/API misuse this way as well, given
active_sessions is an unsigned value.
2018-08-06 23:05:17 -04:00
bunnei 826b1394e8
Merge pull request #931 from DarkLordZach/nca-as-drd
loader: Make AppLoader_NCA rely on directory loading code
2018-08-06 22:02:41 -04:00
Hedges e2b74f6354 GDBStub works with both Unicorn and Dynarmic now (#941)
* GDBStub works with both Unicorn and Dynarmic now

* Tidy up
2018-08-06 22:01:24 -04:00
bunnei f179e87864
Merge pull request #940 from lioncash/private
kernel/event: Make data members private
2018-08-06 21:31:25 -04:00
bunnei 83ef37ca37
Merge pull request #934 from lioncash/chrono
core_timing: Make GetGlobalTimeUs() return std::chrono::microseconds
2018-08-06 18:03:05 -04:00
Lioncash 2feb1a8ba6 kernel/event: Make data members private
Instead we can simply provide accessors to the required data instead of
giving external read/write access to the variables directly.
2018-08-06 12:53:02 -04:00
bunnei 1ac45342dd
Merge pull request #933 from lioncash/memory
memory: Correct prototype of ZeroBlock
2018-08-06 12:34:57 -04:00
mailwl 2ea0f0fd16 Service/Audio: audout_a.cpp: remove pragma once 2018-08-06 12:29:27 +03:00
bunnei 0b80bbeb95
Merge pull request #932 from lioncash/func
core_timing: Use transparent functors where applicable
2018-08-05 23:37:53 -04:00
bunnei f1b93d63d1
Merge pull request #929 from lioncash/addr
gdbstub: Minor changes
2018-08-05 23:36:26 -04:00
bunnei 03b7ebbc08
Merge pull request #930 from lioncash/thread
address_arbiter: Return by value from GetThreadsWaitingOnAddress()
2018-08-05 23:35:59 -04:00
bunnei bb21c2198a
Merge pull request #925 from bunnei/audren
Implement audren audio output
2018-08-05 23:35:22 -04:00
Lioncash 6c56754322 perf_stats: Correct literal used for MAX_LAG_TIME_US
ms is shorthand for milliseconds, not microseconds, and given there's no
comment indicating that this was intentional, it probably wasn't.
2018-08-05 22:12:58 -04:00
Lioncash a0c3a46aa9 core_timing: Make GetGlobalTimeUs() return std::chrono::microseconds
Enforces the time unit being returned and also allows using the standard
time utilities to manipulate it.
2018-08-05 22:07:30 -04:00
Lioncash 2a7a2b739b memory: Make prototype parameter names match their definitions
Keeps the code consistent.
2018-08-05 21:39:09 -04:00
Lioncash 4aa31b0618 memory: Correct prototype of ZeroBlock
Previously, the prototype wasn't matching the definition, which has a
Processor parameter before the destination address.
2018-08-05 21:39:06 -04:00
Lioncash 2fc5c783ed memory: Remove unnecessary const qualifiers in prototypes
These aren't necessary, as value-wise const only matters in the
definition.
2018-08-05 21:38:22 -04:00
Lioncash 6edd828101 core_timing: Convert typedef into a type alias
Makes the alias a little more readable from left-to-right.
2018-08-05 21:27:14 -04:00
Lioncash d9815b523b core_timing: Use transparent functors where applicable
Gets rid of the need to hardcode the type in multiple places. This will
now be deduced automatically, based off the elements in the container
being provided to the algorithm.
2018-08-05 21:19:24 -04:00
Zach Hilman 7f9430f7ae loader: Make AppLoader_NCA rely on directory loading code
Eliminates duplicate code shared between their Load methods, after all the only difference is how the romfs is handled.
2018-08-05 18:28:15 -04:00
Lioncash 00f7e584ce gdbstub: Use type alias for breakpoint maps
Rather than having to type out the full std::map type signature, we can
just use a straightforward alias. While we're at it, rename
GetBreakpointList to GetBreakpointMap, which makes the name more
accurate. We can also get rid of unnecessary u64 static_casts, since
VAddr is an alias for a u64.
2018-08-05 16:41:22 -04:00
Lioncash 89c076b4b1 gdbstub: Move all file-static variables into the GDBStub namespace
Keeps everything under the same namespace. While we're at it, enclose
them all within an inner anonymous namespace.
2018-08-05 16:41:18 -04:00
bunnei c0af42d6eb
Merge pull request #912 from lioncash/global-var
video_core: Eliminate the g_renderer global variable
2018-08-05 16:37:39 -04:00
Lioncash 7a77d0a71e address_arbiter: Return by value from GetThreadsWaitingOnAddress()
In all cases the vector being supplied is empty, so we can just return
by value in these instances.
2018-08-05 16:29:17 -04:00
Lioncash ca96f8db4e gdbstub: Replace PAddr alias with VAddr
In all cases, a virtual address is being passed in, not a physical one.
2018-08-05 15:56:01 -04:00
bunnei b46df98e93 audio_core: Implement audren_u audio playback. 2018-08-04 21:54:30 -04:00
bunnei a0a605df06
Merge pull request #924 from lioncash/arp
service: Add arp services
2018-08-04 21:20:26 -04:00
bunnei cd96c04339
Merge pull request #921 from lioncash/view
core/crypto: Minor changes
2018-08-04 21:17:10 -04:00
bunnei 1dee8ceda1 audio_core: Use s16 where possible for audio samples. 2018-08-04 18:22:58 -04:00
bunnei f1cb3903ac audio_core: Port codec code from Citra for ADPCM decoding. 2018-08-04 18:22:58 -04:00
Lioncash de72956181 service: Add arp services
Adds the basic skeleton of the arp services based off the information
provided by Switch Brew.
2018-08-04 18:01:12 -04:00
Lioncash df51207ed2 service: Remove redundant #pragma once directives
These don't do anything within .cpp files (we don't include cpp files,
so...)
2018-08-04 17:39:08 -04:00
Lioncash 0d04ee97dc aes_util: Add static assertion to Transcode() and XTSTranscode() to ensure well-defined behavior
These functions should only be given trivially-copyable types.
2018-08-04 17:30:52 -04:00
Lioncash 64c8212ae1 aes_util: Make CalculateNintendoTweak() an internally linked function
This function doesn't directly depend on class state, so it can be
hidden entirely from the interface in the cpp file.
2018-08-04 17:30:48 -04:00
Lioncash b25468b498 aes_util: Make Transcode() a const member function
This doesn't modify member state, so it can be made const.
2018-08-04 16:49:42 -04:00
Lioncash 8da651ac4d core/crypto: Remove unnecessary includes 2018-08-04 16:44:07 -04:00
Lioncash c1f76abfaf key_manager: Use regular std::string instead of std::string_view
The benefit of std::string_view comes from the idea of avoiding copies
(essentially acting as a non-owning view), however if we're just going
to copy into a local variable immediately, there's not much benefit
gained here.
2018-08-04 16:37:30 -04:00
Zach Hilman 2cc962e171 content_archive: Add support for titlekey cryptography 2018-08-04 14:57:21 -04:00
bunnei 9f846d3aa4 audio_core: Streams need unique names for CoreTiming. 2018-08-04 14:34:12 -04:00
bunnei 2b06301dbf
Merge pull request #849 from DarkLordZach/xci
XCI and Encrypted NCA Support
2018-08-04 14:33:11 -04:00
Lioncash 2665457f4a renderer_base: Make Rasterizer() return the rasterizer by reference
All calling code assumes that the rasterizer will be in a valid state,
which is a totally fine assumption. The only way the rasterizer wouldn't
be is if initialization is done incorrectly or fails, which is checked
against in System::Init().
2018-08-04 02:36:58 -04:00
Lioncash 6030c5ce41 video_core: Eliminate the g_renderer global variable
We move the initialization of the renderer to the core class, while
keeping the creation of it and any other specifics in video_core. This
way we can ensure that the renderer is initialized and doesn't give
unfettered access to the renderer. This also makes dependencies on types
more explicit.

For example, the GPU class doesn't need to depend on the
existence of a renderer, it only needs to care about whether or not it
has a rasterizer, but since it was accessing the global variable, it was
also making the renderer a part of its dependency chain. By adjusting
the interface, we can get rid of this dependency.
2018-08-04 02:36:57 -04:00
bunnei b0129489ea
Merge pull request #913 from lioncash/unused-func
memory: Remove unused GetSpecialHandlers() function
2018-08-04 02:17:44 -04:00
bunnei 206f2e3436
Merge pull request #914 from lioncash/codeset
kernel/process: Use accessors instead of class members for referencing segment array
2018-08-04 02:17:25 -04:00
Lioncash e93fa7f2cc kernel/thread: Fix potential crashes introduced in 26de4bb521
This amends cases where crashes can occur that were missed due to the
odd way the previous code was set up (using 3DS memory regions that
don't exist).
2018-08-03 23:49:10 -04:00
Lioncash e649db8c6b kernel/process: Use std::array where applicable 2018-08-03 14:46:30 -04:00
Lioncash 2beda7c2b3 kernel/process: Use accessors instead of class members for referencing segment array
Using member variables for referencing the segments array increases the
size of the class in memory for little benefit. The same behavior can be
achieved through the use of accessors that just return the relevant
segment.
2018-08-03 14:45:45 -04:00
Lioncash 59b04c0df6 memory: Remove unused GetSpecialHandlers() function
This is just unused code, so we may as well get rid of it.
2018-08-03 14:20:50 -04:00
bunnei 40e63ede6d
Merge pull request #908 from lioncash/memory
core/memory: Get rid of 3DS leftovers
2018-08-03 14:07:49 -04:00
Lioncash 26de4bb521 core/memory: Get rid of 3DS leftovers
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
David c1d54f4aea Added ability to change username & language code in the settings ui. Added IProfile::Get and SET::GetLanguageCode for libnx tests (#851) 2018-08-03 11:02:55 -04:00
bunnei 40e78b9a89
Merge pull request #898 from lioncash/mig
service: Add migration services
2018-08-03 11:00:27 -04:00
bunnei 00ba704a7f
Merge pull request #892 from lioncash/global
video_core: Make global EmuWindow instance part of the base renderer …
2018-08-03 00:31:32 -04:00
bunnei 4c3c608d59
Merge pull request #894 from lioncash/object
kernel: Move object class to its own source files
2018-08-03 00:28:43 -04:00
bunnei 4b84d5bcec
Merge pull request #904 from lioncash/static
kernel/thread: Minor changes
2018-08-03 00:19:29 -04:00
bunnei 61ed68f3d0
Merge pull request #905 from lioncash/vma
kernel/vm_manager: Minor changes
2018-08-02 23:18:03 -04:00
bunnei 291ccf7257
Merge pull request #903 from lioncash/copy
vfs_vector: Minor changes
2018-08-02 23:01:19 -04:00
bunnei 4de18e054b
Merge pull request #899 from lioncash/unused
hw: Remove unused files
2018-08-02 14:58:01 -04:00
bunnei e79e967151
Merge pull request #891 from lioncash/ns
service/ns: Add missing ns services
2018-08-02 14:57:24 -04:00
Lioncash d94a173877 kernel/vm_manager: Convert loop into std::any_of() 2018-08-02 12:46:15 -04:00
Lioncash c4e0c3d76c kernel/vm_manager: Use const where applicable
Makes our immutable state explicit.
2018-08-02 12:21:46 -04:00
Lioncash ce5ad45278 kernel/vm_manager: Use the VAddr type alias in CarveVMA()
These two variables correspond to address ranges.
2018-08-02 12:15:50 -04:00
Lioncash 6058c84b79 kernel/thread: Make GetFreeThreadLocalSlot()'s loop indices size_t
Avoids using a u32 to compare against a range of size_t, which can be a
source of warnings. While we're at it, compress a std::tie into a
structured binding.
2018-08-02 12:01:25 -04:00
Lioncash fac0e42b2f kernel/thread: Make GetFreeThreadLocalSlot() reference parameter a const reference
This function only reads the data being referenced, it doesn't modify
it, so we can turn the reference into a const reference.
2018-08-02 11:56:11 -04:00
Lioncash 9a50a4f2cc kernel/thread: Make GetFreeThreadLocalSlot() internally linked
This function isn't used outside of this translation unit, so we can
make it internally linked.
2018-08-02 11:54:23 -04:00
Lioncash 42a4c6b79e vfs_vector: Remove unused variable in FindAndRemoveVectorElement()
This wasn't being used for anything, so it can be removed.
2018-08-02 11:40:24 -04:00
Lioncash cec9e9b811 vfs_vector: Avoid unnecessary copies where applicable
The lambda elements should be taken by const reference here, and we can
move the virtual directory passed to ReplaceFileWithSubdirectory()
2018-08-02 11:37:39 -04:00
Lioncash c6db1c390b hw: Remove unused files
None of these files are used in any meaningful way. They're just
leftovers from citra. Also has the benefit of getting rid of an unused
global variable.
2018-08-02 10:23:10 -04:00
Lioncash 7469e26e5e service: Add migration services
Adds the basic skeleton for the mig:usr service based off information
provided by Switch Brew.
2018-08-02 10:09:45 -04:00
Lioncash bf45092c61 kernel: Move object class to its own source files
General moving to keep kernel object types separate from the direct
kernel code. Also essentially a preliminary cleanup before eliminating
global kernel state in the kernel code.
2018-08-01 23:34:42 -04:00
Lioncash 5233040ab4 service: Add psc services
Adds the basic skeleton for the psc services based off the information
provided by Switch Brew.
2018-08-01 23:31:27 -04:00
Lioncash 0f2ac928f2 video_core: Make global EmuWindow instance part of the base renderer class
Makes the global a member of the RendererBase class. We also change this
to be a reference. Passing any form of null pointer to these functions
is incorrect entirely, especially given the code itself assumes that the
pointer would always be in a valid state.

This also makes it easier to follow the lifecycle of instances being
used, as we explicitly interact the renderer with the rasterizer, rather
than it just operating on a global pointer.
2018-08-01 21:40:30 -04:00
bunnei 746d7d4d28
Merge pull request #888 from lioncash/caps
service: Add capture services
2018-08-01 21:34:28 -04:00
bunnei 9bb8720289
Merge pull request #890 from lioncash/logger
lm: Amend name of ILogger
2018-08-01 21:33:11 -04:00
bunnei 16b2fd9fc8
Merge pull request #889 from lioncash/fsp
service/filesystem: Add fsp:ldr and fsp:pr services
2018-08-01 21:32:54 -04:00
Lioncash 48acb764a4 service/ns: Add missing ns services
Implements the basic skeleton of ns:am2, ns:ec, ns:rid, ns:rt, ns:su,
ns:vm, and ns:web based off the information provided by Switch Brew and
SwIPC.
2018-08-01 18:02:18 -04:00
Lioncash f77cfab516 lm: Amend name of ILogger
Previously this was being registered with the name "Logger". While we're
at it, also change the name of the class to match it.
2018-08-01 17:08:44 -04:00
Lioncash 208a457909 service/filesystem: Add fsp:ldr and fsp:pr services
Adds the basic skeleton for the remaining fsp services based off
information provided by Switch Brew.
2018-08-01 17:01:29 -04:00
Lioncash e39294c267 service: Add capture services
Adds the basic skeleton for the capture services based off information
provided by Switch Brew.
2018-08-01 16:45:51 -04:00
Lioncash d109279543 service: Add bpc and pcv services
Adds the basic skeleton for the remaining pcv-related services based off
information on Switch Brew.
2018-08-01 16:13:04 -04:00
bunnei 703663d761
Merge pull request #882 from lioncash/unused
kernel/thread: Remove unimplemented function prototype
2018-07-31 22:25:49 -07:00
Zach Hilman 13cdf1f159 Add missing parameter to files.push_back() 2018-08-01 00:16:54 -04:00
Zach Hilman 0497bb5528 Fix merge conflicts with opus and update docs 2018-08-01 00:16:54 -04:00
Zach Hilman 187d8e215f Use more descriptive error codes and messages 2018-08-01 00:16:54 -04:00
Zach Hilman 9d59b96ef9 Use static const instead of const static 2018-08-01 00:16:54 -04:00
Zach Hilman a9c921a41d Use ErrorEncrypted where applicable and fix no keys crash 2018-08-01 00:16:54 -04:00
Zach Hilman 03149d3e4a Add missing includes and use const where applicable 2018-08-01 00:16:54 -04:00
Zach Hilman 150527ec19 Allow key loading from %YUZU_DIR%/keys in addition to ~/.switch 2018-08-01 00:16:54 -04:00
Zach Hilman 239a3113e4 Make XCI comply to review and style guidelines 2018-08-01 00:16:54 -04:00
Zach Hilman 22342487e8 Extract mbedtls to cpp file 2018-08-01 00:16:54 -04:00
Zach Hilman 83c3ae8be8 Add missing string.h include 2018-08-01 00:16:54 -04:00
Zach Hilman c54a10cb4f Update mbedtls and fix compile error 2018-08-01 00:16:54 -04:00
Zach Hilman df5b75694f Remove files that are not used 2018-08-01 00:16:54 -04:00
bunnei d2ad279a32
Merge pull request #871 from bunnei/audio-config
audio_core: Add configuration settings.
2018-07-31 21:04:26 -07:00
Lioncash 49e198b20d kernel/thread: Remove unimplemented function prototype
Given there's no implementation, we may as well remove the code
entirely.
2018-07-31 23:21:38 -04:00
bunnei ff2c1b0a94
Merge pull request #877 from lioncash/remove
kernel: Remove unused object_address_table.cpp/.h
2018-07-31 20:11:39 -07:00
bunnei 98af269415
Merge pull request #880 from lioncash/audio
service/audio: Add missing services
2018-07-31 20:11:04 -07:00
bunnei ca84b530a3 audio_core: Add configuration settings. 2018-07-31 22:38:42 -04:00
bunnei f5efac3442
Merge pull request #876 from lioncash/include
kernel: Remove unnecessary includes
2018-07-31 19:16:05 -07:00
Lioncash bba63b33a1 service/audio: Add missing services
Adds the missing audctl service, as well as the :a and :d services for
audin, audout, audrec, and audren.
2018-07-31 21:58:30 -04:00
bunnei da07faebfe
Merge pull request #879 from lioncash/audio
audout_u: Remove std::move in OpenAudioOutImpl()
2018-07-31 16:49:56 -07:00
bunnei 3575c076cb
Merge pull request #869 from Subv/ubsan
Corrected a few error cases detected by asan/ubsan
2018-07-31 09:24:13 -07:00
bunnei fd020ad52a
Merge pull request #875 from lioncash/fgm
service: Add fgm services
2018-07-31 09:23:17 -07:00
bunnei 3a2581cc7d
Merge pull request #874 from lioncash/am
service/am: Add missing am services
2018-07-31 09:22:56 -07:00
Lioncash 369f6e58aa kernel: Remove unused object_address_table.cpp/.h
These source files were entirely unused throughout the rest of the
codebase. This also has the benefit of getting rid of a global variable
as well.
2018-07-31 11:03:08 -04:00
Lioncash 1ced7bbea5 audout_u: Remove std::move in OpenAudioOutImpl()
Previously the code was using the values from params further below after
it was std::moved. Thankfully, given AudoutParams is a trivially
copyable struct, the values would have simply been copied in this
instance and not invalidated to garbage values.
2018-07-31 10:24:38 -04:00
Lioncash a2304fad16 kernel: Remove unnecessary includes
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
2018-07-31 10:15:17 -04:00
bunnei b79362b9da
Merge pull request #870 from lioncash/init
arm_dynarmic: Correct initializer list order
2018-07-31 07:12:54 -07:00
Lioncash 7da8f15461 service/am: Add missing am services
Adds the basic skeleton for missing am services idle:sys, omm, and spsm
based off the information provided by Switch Brew.
2018-07-31 08:02:20 -04:00
Lioncash 268eeeb406 service: Add fgm services
Adds the basic skeleton for the fgm services based off the information
provided by Switch Brew.
2018-07-31 08:01:19 -04:00
Lioncash f08c0520a4 arm_dynarmic: Make SetTlsAddress() prototype and definition consistent
Makes the definition use the same type aliases as in its prototype.
2018-07-31 07:58:26 -04:00
Lioncash 9d6aa7bff7 arm_dynarmic: Remove unnecessary qualifying of ThreadContext
Given the ARM_Dynarmic class inherits from ARM_Interface, we don't need
to qualify here.
2018-07-31 07:56:59 -04:00
Lioncash 444a01afa6 arm_dynarmic: Correct initializer list order
Amends the initializer list to be in the same order that each variable
would be initialized in. We also do this to ensure we don't use a bogus
uninitialized instance of the exclusive monitor within MakeJit()

We can also remove the jit member from the initializer list as this is
initialized by PageTableChanged()
2018-07-31 07:54:58 -04:00
Lioncash e373027a73 service: Add the pcie service
Adds the basic skeleton of the pcie service based off information on
Switch Brew.
2018-07-31 06:40:21 -04:00
Subv e119e17d18 nvhost_gpu: Added checks to ensure we don't read past the end of the entries when handling a GPU command list. 2018-07-30 20:09:13 -05:00
Subv 2482aca7c3 nvhost_ctrl_gpu: Only read the input parameters if they are actually there.
Passing nullptr to memcpy is undefined behavior.
2018-07-30 20:08:36 -05:00
bunnei eaf66b4c9f audio_core: Move to audout_u impl.
- This is necessary so streams are created on the same thread.
2018-07-30 18:44:16 -04:00
David a483e5e28d Implemented various hwopus functions (#853) 2018-07-30 15:42:20 -07:00
bunnei 45d1438530
Merge pull request #858 from lioncash/cast
partition_filesystem: Remove dynamic_cast in PrintDebugInfo()
2018-07-30 10:09:36 -07:00
bunnei c5fa3560a6
Merge pull request #857 from lioncash/wlan
service: Add wlan services
2018-07-30 10:06:52 -07:00
bunnei 2c4bb11015
Merge pull request #856 from lioncash/btm
service: Add btm services
2018-07-30 10:06:34 -07:00
Hexagon12 fd797e2424 Add some HID commands (#843)
* Added some HID commands

* Addressed comments
2018-07-30 10:06:21 -07:00
Lioncash 57c4d7aa00 partition_filesystem: Remove dynamic_cast in PrintDebugInfo()
We shouldn't be upcasting our file instances. Given a
PartitionFilesystem is currently designed to accept any arbitrary
VfsFile instances, casting to a more specific type than that is just bad
design, and shows an interface design issue.
2018-07-29 06:16:59 -04:00
Lioncash 6ea416091e service: Add wlan services
Adds the basic skeleton for the wlan services based off the information
on Switch Brew.
2018-07-28 21:54:55 -04:00
Lioncash 7ce6858086 service/btm: Add basic implementation of GetCoreImpl()
Based off information on SwIPC and Switch Brew.
2018-07-28 21:09:07 -04:00
Lioncash ca7655be3a service: Add btm services
Adds the skeleton for the btm services based off the information on
Switch Brew.
2018-07-28 21:09:07 -04:00
bunnei 458fdda700
Merge pull request #847 from lioncash/ncm
service: Add ncm services
2018-07-28 10:46:09 -07:00
bunnei d00dcdb1be
Merge pull request #846 from lioncash/mii
service: Add mii services
2018-07-28 10:45:31 -07:00
bunnei e1d66ea794
Merge pull request #842 from bunnei/audio-core
Initial implementation of Audio Core
2018-07-27 20:25:32 -07:00
bunnei f1c519f2cb audout: Implement IAudioOut interface with AudioCore. 2018-07-27 22:55:39 -04:00
bunnei 2a742229ee core: Add AudioCore to global state. 2018-07-27 22:33:37 -04:00
bunnei ab756fd068 audio_core: Add initial code for keeping track of audout state. 2018-07-27 22:33:31 -04:00
Zach Hilman 906d785c73 RomFS Extraction 2018-07-27 18:14:03 -04:00
Lioncash 7931cc0ceb service: Add ncm services
Adds the basic skeleton for the ncm services based off information on
Switch Brew.
2018-07-27 17:38:30 -04:00
bunnei 0191a1e526
Merge pull request #845 from lioncash/nfc
service: Add nfc services
2018-07-27 14:29:27 -07:00
bunnei 833ebbb626
Merge pull request #844 from lioncash/lbl
service: Add the lbl service
2018-07-27 13:06:11 -07:00
bunnei d2749ef0ed
Merge pull request #841 from lioncash/btdrv
service: Add the btdrv service
2018-07-27 13:05:36 -07:00
Lioncash f46bfdd77d service: Add mii services
Adds the skeleton for the mii services based off information provided by
Switch Brew
2018-07-27 16:01:29 -04:00
Lioncash 50dadc33e3 service/nfc: Implement Create[x]Interface functions
These simply return the respective interface.
2018-07-27 15:12:08 -04:00
Lioncash 04d144aa40 service: Add nfc services
Adds the skeleton of the nfc service based off the information provided
on Switch Brew.
2018-07-27 14:50:24 -04:00
Lioncash ea8dd8b650 service/lbl: Implement EnableVrMode, DisableVrMode and GetVrMode
Implements these functions according to the information available on
Switch Brew.
2018-07-27 14:20:42 -04:00
Lioncash c2c543e8f7 service: Add the lbl service
Adds the skeleton of the lbl service based off the information provided
by Switch Brew.
2018-07-27 14:20:07 -04:00
bunnei dc4e5f9159
Merge pull request #837 from lioncash/priv
kernel/timer: Make data members private where applicable
2018-07-27 07:18:50 -07:00
Lioncash f49248437e service: Add the btdrv service
Adds the skeleton for the btdrv service based off the information provided by Switch Brew
2018-07-26 18:06:17 -04:00