Commit Graph

617 Commits

Author SHA1 Message Date
Zach Hilman 6aa69880ea file_sys: Add framework for synthesizing open source archives 2018-11-15 22:34:35 -05:00
Zach Hilman 34cd56980f vfs_vector: Add VFS backend for std::array
Allows using constexpr/static const data with VFS.
2018-11-15 22:33:52 -05:00
bunnei 97605e36f7
Merge pull request #1618 from DarkLordZach/dump-nso
patch_manager: Add support for dumping uncompressed NSOs
2018-11-15 14:46:10 -08:00
bunnei 9b12623743
Merge pull request #1608 from DarkLordZach/save-data-reader
[ns|fsp_srv]: Implement various functions to boot Checkpoint
2018-11-13 18:51:08 -08:00
Zach Hilman 97d425c304 file_sys: Use common KeyManager in NCA container types
Creates a single KeyManager for the entire container and then passes it into the NCA constructor, eliminating several unnecessary KeyManager reads.
2018-11-01 20:23:38 -04:00
Zach Hilman e20db909ee content_archive: Add optional KeyManager parameter to constructor
Allows resuing a common KeyManager when a large amount of NCAs are handled by the same class. Should the parameter not be provided, a new KeyManager will be constructed, as was the default behavior prior to this.
2018-11-01 20:22:29 -04:00
Lioncash 352b56367c general: Remove unused boost inclusions where applicable
Cleans up unused includes and trims off some dependencies on externals.
2018-10-30 00:09:46 -04:00
Frederic L 7a5eda5914 global: Use std::optional instead of boost::optional (#1578)
* get rid of boost::optional

* Remove optional references

* Use std::reference_wrapper for optional references

* Fix clang format

* Fix clang format part 2

* Adressed feedback

* Fix clang format and MacOS build
2018-10-30 00:03:25 -04:00
Zach Hilman bdaa76c0db ns: Implement command 400: GetApplicationControlData
Returns the raw NACP bytes and the raw icon bytes into a title-provided buffer. Pulls from Registration Cache for control data, returning all zeros should it not exist.
2018-10-29 16:20:16 -04:00
Zach Hilman 1c0226815d patch_manager: Add support for dumping decompressed NSOs
When enabled in settings, PatchNSO will dump the unmodified NSO that it was passed to a file named <build id>.nso in the dump root for the current title ID.
2018-10-29 16:10:16 -04:00
Zach Hilman 9078bb9854 bis_factory: Add getter for mod dump root for a title ID
Equates to yuzu_dir/dump/<title id>/
2018-10-29 16:08:03 -04:00
Zach Hilman df264d2ccb savedata_factory: Expose accessors for SaveDataSpace 2018-10-29 13:54:38 -04:00
Zach Hilman b04e39107f control_metadata: Add GetRawBytes function to NACP
Returns the raw bytes of the NACP file. Needed for GetApplicationControlData which returns the raw, unprocessed NACP to the game.
2018-10-29 13:54:38 -04:00
Frederic L 72d10ce66c file_sys/patch_manager: Remove unnecessary if-statements (#1586)
* remove unnecessary if-statements

* Addressed feedback
2018-10-28 02:30:29 -04:00
bunnei 72e6b31a07
Merge pull request #1430 from DarkLordZach/remove-promote-dir
vfs: Remove InterpretAsDirectory and related functions
2018-10-26 00:15:34 -04:00
Zach Hilman 9a87ece837 ips_layer: Use rle_size instead of data_size in RLE patch application
Prevents a potential bug when using RLE records in an IPS patch.
2018-10-25 14:23:56 -04:00
Lioncash c7c594a6b8
vfs: Handle failure of file reading within VfsRawCopy()
Also gets rid of an unused variable.
2018-10-24 00:01:32 -04:00
bunnei 5edb2403c2
Merge pull request #1515 from DarkLordZach/dlc-lfs
patch_manager: Add support for LayeredFS on DLC RomFS
2018-10-23 19:26:57 -04:00
Zach Hilman a25d79cfaa vfs: Remove InterpretAsDirectory and related functions
When writing VFS, it initally seemed useful to include a function to in-place convert container files into directories in one homogenous directory structure, but re-evaluating it now there have been plenty of chances to use it and there has always been a better way. Removing as it is unused and likely will not be used.
2018-10-19 14:02:07 -04:00
bunnei 7f152f2273
Merge pull request #1511 from lioncash/content
content_archive: Minor reorganization changes
2018-10-18 21:48:09 -04:00
bunnei d4ff4152ad
Merge pull request #1510 from lioncash/xci
XCI: Add function for checking the existence of the program NCA
2018-10-18 11:51:47 -04:00
Zach Hilman 9d0fb0f815 qt: Add support for dumping a DLC Data RomFS 2018-10-17 18:27:29 -04:00
bunnei afe22d8405
Merge pull request #1509 from DarkLordZach/device-save-data
savedata_factory: Add DeviceSaveData and fix TemporaryStorage
2018-10-17 18:22:05 -04:00
Zach Hilman 59044862a9 registered_cache: Deduplicate results of ListEntry and ListEntryFilter
Prevents a Entry from appearing in the list twice if the user has it installed in two places (e.g. User NAND and SDMC)
2018-10-17 14:04:18 -04:00
Zach Hilman d8273c3857 patch_manager: Add support for using LayeredFS with Data 2018-10-17 09:03:56 -04:00
Lioncash 871350ae35 content_archive: Simpify assignment of bktr_base_romfs in the constructor
std::move doesn't actually dereference the data, so it doesn't matter
whether or not the type is null.
2018-10-16 13:22:31 -04:00
Lioncash 441b5b97bd content_archive: Make IsValidNCA() an internally linked function
This is only ever used within the cpp file, so it can just be an
internal function.
2018-10-16 13:22:31 -04:00
Lioncash 53e77ffbfe content_archive: Simplify rights ID check
This is the same as using std::any_of with an inverted predicate.
2018-10-16 13:22:31 -04:00
Lioncash d6604fa765 content_archive: Split loading into separate functions
The constructor alone is pretty large, the reading code should be split
into its consistuent parts to make it easier to understand it without
having to build a mental model of a 300+ line function.
2018-10-16 13:22:28 -04:00
Lioncash 4783ad54de content_archive: Pass and take NCASectionHeader instance by reference
Each header is 512 bytes in size, which is kind of an excessive amount
to copy all the time when it's possible to avoid doing so.
2018-10-16 12:08:17 -04:00
Lioncash 73e1e929a2 XCI: Add function for checking the existence of the program NCA
The only reason the getter existed was to check whether or not the
program NCA was null. Instead, we can just provide a function to query
for the existence of it, instead of exposing it entirely.
2018-10-16 11:36:58 -04:00
bunnei 78f2a6a9e1
Merge pull request #1443 from DarkLordZach/lower-loader-logs-1
content_archive/patch_manager: Lower log levels to eliminate some unnecessary logs
2018-10-16 11:26:54 -04:00
Zach Hilman 9d4e6176eb savedata_factory: Add TemporaryStorage SaveDataSpaceId
Required for TemporaryStorage saves (in addition to SaveDataType)
2018-10-16 10:20:04 -04:00
Zach Hilman 74890cf2da savedata_factory: Add support for DeviceSaveData
Uses the same path as SaveData except with UID 0. Adds a warning if UID is not 0.
2018-10-16 10:19:21 -04:00
Lioncash 39ae73b356 file_sys/registered_cache: Use unique_ptr and regular pointers instead of shared_ptrs where applicable
The data retrieved in these cases are ultimately chiefly owned by either
the RegisteredCache instance itself, or the filesystem factories. Both
these should live throughout the use of their contained data. If they
don't, it should be considered an interface/design issue, and using
shared_ptr instances here would mask that, as the data would always be
prolonged after the main owner's lifetime ended.

This makes the lifetime of the data explicit and makes it harder to
accidentally create cyclic references. It also makes the interface
slightly more flexible than the previous API, as a shared_ptr can be
created from a unique_ptr, but not the other way around, so this allows
for that use-case if it ever becomes necessary in some form.
2018-10-16 09:38:52 -04:00
Lioncash 76fc8b59b2 file_sys/control_metadata: Get rid of magic constants
These are just the size of the data being passed in, so we can specify
that via the size() member function.
2018-10-15 20:11:44 -04:00
Zach Hilman 5737441374 aoc: Read DLC base title ID from RegisteredCache
Falls back to title ID + 0x1000, which is what HOS does.
2018-10-14 18:58:14 -04:00
Zach Hilman f61379f8d2 patch_manager: Move non-Program RomFS patch log to Debug
Normal Program-type patches will still be logged to aid in debugging, but for others (mainly Control), it was moved to Debug.
2018-10-12 23:27:19 -04:00
Zach Hilman 90c07e0d33 content_archive: Move get key log to Trace level
Avoids printing live keys in the general log.
2018-10-12 23:25:59 -04:00
bunnei 1584fb6b38
Merge pull request #1409 from DarkLordZach/key-derivation
crypto: Add support for full key derivation
2018-10-12 22:55:49 -04:00
bunnei 5461b21c7a
Merge pull request #1461 from lioncash/warn
ips_layer: Silence truncation and conversion warnings
2018-10-09 22:30:01 -04:00
bunnei 3ac874c32e
Merge pull request #1464 from lioncash/unique
patch_manager: Return a std::unique_ptr from ParseControlNCA() and GetControlMetadata() instead of a std::shared_ptr
2018-10-09 22:29:39 -04:00
Lioncash 6636f3ff47 patch_manager: Return a std::unique_ptr from ParseControlNCA() and GetControlMetadata() instead of a std::shared_ptr
Neither of these functions require the use of shared ownership of the
returned pointer. This makes it more difficult to create reference
cycles with, and makes the interface more generic, as std::shared_ptr
instances can be created from a std::unique_ptr, but the vice-versa
isn't possible. This also alters relevant functions to take NCA
arguments by const reference rather than a const reference to a
std::shared_ptr. These functions don't alter the ownership of the memory
used by the NCA instance, so we can make the interface more generic by
not assuming anything about the type of smart pointer the NCA is
contained within and make it the caller's responsibility to ensure the
supplied NCA is valid.
2018-10-09 14:38:03 -04:00
Lioncash 465175cdf5 ips_layer: Avoid constructing std::vector instances where not necessary
We can just compare the existing std::vector instance with a constexpr
std::array containing the desired match. This is lighter resource-wise,
as we don't need to allocate on the heap.
2018-10-09 14:10:22 -04:00
Lioncash 9ff743bc0a ips_layer: Remove unnecessary explicit std::pair constructor in std::array
Makes the layout of the array consistent, by making all elements match,
instead of special-casing the first one.
2018-10-09 14:10:22 -04:00
Lioncash f7d2889fb4 ips_layer: Add missing includes
Adds missing includes to prevent potential compilation issues in the
future. Also moves the definition of a struct into the cpp file, so that
some includes don't need to be introduced within the header.
2018-10-09 14:10:13 -04:00
Lioncash 93ac8d0fea ips_layer: std::move data within PatchIPS() and Apply()
We don't need to make a copy of the read data, so we can std::move it
into the make_shared call here.
2018-10-09 14:06:44 -04:00
Lioncash 567e818440 ips_layer: Silence truncation and conversion warnings
Makes type conversions explicit to avoid compiler warnings.
2018-10-09 13:18:23 -04:00
bunnei 561d79e034
Merge pull request #1423 from DarkLordZach/romfs-file-exts
fsmitm_romfsbuild: Add support for stubbing and IPS patches in LFS
2018-10-08 12:31:27 -04:00
bunnei 6b48ba5271
Merge pull request #1424 from DarkLordZach/ips-witch
ips_layer: Add support for IPSwitch executable patches
2018-10-08 12:30:33 -04:00
Zach Hilman 1fa6ee4723 vfs: Move forward declarations to separate file 2018-10-07 13:15:11 -04:00
Zach Hilman 38c2ac95af romfs_factory: Extract packed update setter to new function 2018-10-05 08:53:51 -04:00
Zach Hilman 5acaeb04c4 patch_manager: Add support for NSP packed updates
Reads as Update (NSP) in add-ons
2018-10-05 08:48:44 -04:00
Zach Hilman d79d4fd764 patch_manager: Add support for packed updates
Will prefer any installed update over the packed version.
2018-10-05 08:47:24 -04:00
Zach Hilman d0e6b93695 patch_manager: Avoid romfs_ext requirement for patching 2018-10-04 14:09:11 -04:00
Zach Hilman c1e069c066 fsmitm_romfsbuild: Extract stubs and IPS to romfs_ext dir 2018-10-04 12:29:20 -04:00
Zach Hilman bc4bec8a60 fsmitm_romfsbuild: Add support for stubbing and IPS patches in LFS 2018-10-04 12:29:14 -04:00
Zach Hilman 110d578470 ips_layer: Fix inaccuracies with comments and flags
Specifically bugs/crashes that arise when putting them in positions that are legal but not typical, such as midline, between patch data, or between patch records.
2018-10-04 12:23:27 -04:00
Zach Hilman 70bd2bb1d3 ips_layer: Deduplicate resource usage 2018-10-04 11:34:36 -04:00
Zach Hilman 9669cdb710 ips_layer: Add support for escape sequences and midline comments
More accurately follows IPSwitch specification.
2018-10-04 11:34:30 -04:00
Zach Hilman 8886f2e55e patch_manager: Add support for IPSwitch format patches 2018-10-04 11:34:06 -04:00
Zach Hilman 306739c2c4 ips_layer: Add IPSwitchCompiler to process IPSwitch format 2018-10-04 11:32:10 -04:00
bunnei f85f2b3728
Merge pull request #1415 from DarkLordZach/ips
file_sys: Add support for loading IPS patches
2018-10-04 09:42:37 -04:00
bunnei 15b2e2ec13
Merge pull request #1436 from lioncash/view
submission_package: Cleanup and bug fixes
2018-10-03 19:05:19 -04:00
bunnei 8679934693
Merge pull request #1435 from lioncash/xci
card_image: Ensure program_nca_status is always initialized
2018-10-03 18:44:28 -04:00
Lioncash 024eec02a5 submission_package: Avoid dangling std::string_view within SetTicketKeys()
GetName() returns a std::string by value, not by reference, so after the
std::string_view is constructed, it's not well defined to actually
execute any member functions of std::string_view that attempt to access
the data, as the std::string has already been destroyed. Instead, we can
just use a std::string and erase the last four characters.
2018-10-03 02:13:51 -04:00
Lioncash dade709f63 submission_package: Correct location of null check within SetTicketKeys()
If a ticket file was ever a null pointer, we'd cause a null pointer
dereference, as we were calling GetExtension() on the pointer instance.
2018-10-03 02:06:30 -04:00
Lioncash 02841052aa submission_package: Use std::string's rfind() when looking for the extension in InitializeExeFSAndRomFS()
When searching for a file extension, it's generally preferable to begin
the search at the end of the string rather than the beginning, as the
whole string isn't going to be walked just to check for something at the
end of it.
2018-10-03 01:51:01 -04:00
Lioncash 37ee05f7c0 submission_package: Ensure the 'extracted' member variable is always initialized
If an error occurs when constructing the PartitionFilesystem instance,
the constructor would be exited early, which wouldn't initialize the
extracted data member, making it possible for other code to perform an
uninitialized read by calling the public IsExtractedType() member
function. This prevents that.
2018-10-03 01:47:34 -04:00
Lioncash ccf0a9cb38 submission_package: Move ExeFS and RomFS initialization to its own function
Like the other two bits of factored out code, this can also be put
within its own function. We can also modify the code so that it accepts
a const reference to a std::vector of files, this way, we can
deduplicate the file retrieval.

Now the constructor for NSP isn't a combination of multiple behaviors in
one spot. It's nice and separate.
2018-10-03 01:46:07 -04:00
Lioncash fd312abedd submission_package: Move NCA reading code to its own function
This too, is completely separate behavior from what is in the
constructor, so we can move this to its own isolated function to keep
everything self-contained.
2018-10-03 01:35:41 -04:00
Lioncash 4f18d35888 submission_package: Move ticket key setting to its own function
This behavior is entirely independent of the surrounding code, so it can
be put in its own function to keep the behavior separate.
2018-10-03 01:20:57 -04:00
Lioncash 0d83f8f255 submission_package: Invert conditionals within NSP's constructor to reduce nesting
We can use early continues here to reduce the amount of nesting.
2018-10-03 01:11:16 -04:00
Lioncash cf463a9b67 card_image: Ensure program_nca_status is always initialized
If any of the error paths before the NCA retrieval are taken, it'll
result in program_nca_status being left in an inconsistent state. So we
initialize it by default with a value indicating an error.
2018-10-02 23:16:05 -04:00
Zach Hilman 215b65fe75 nso: Optimize loading of IPS patches
Avoid resource-heavy classes and remove quasi-duplicated code.
2018-10-02 17:03:38 -04:00
Zach Hilman 42fb4e82d3 patch_manager: Add PatchNSO function
While PatchExeFS operated on the entire directory, this function operates on the uncompressed NSO. Avoids copying decompression code to PatchManager.
2018-10-01 16:02:50 -04:00
Zach Hilman 4c2a94fa94 patch_manager: Use strings for patch type instead of enum 2018-10-01 16:02:50 -04:00
Zach Hilman 21b2411c44 file_sys: Implement function to apply IPS patches 2018-10-01 16:01:46 -04:00
Zach Hilman f72046099a aoc_u: Extract AccumulateAOCTitleIDs to separate function 2018-09-30 21:07:22 -04:00
Zach Hilman 7d86a008e2 aoc_u: Implement GetAddOnContentBaseId
Command #5
2018-09-30 21:01:35 -04:00
Zach Hilman aa0c82e405 romfs_factory: Read from all locations with StorageId None
Previous behavior was to assert. Seems to mirror expected game behavior.
2018-09-30 21:01:35 -04:00
Zach Hilman 32fc31fb13 patch_manager: Add DLC recognition to PatchManager 2018-09-30 21:01:35 -04:00
Lioncash cf9d6c6f52 kernel/process: Make data member variables private
Makes the public interface consistent in terms of how accesses are done
on a process object. It also makes it slightly nicer to reason about the
logic of the process class, as we don't want to expose everything to
external code.
2018-09-30 02:30:01 -04:00
bunnei f7b69d61f2
Merge pull request #1395 from lioncash/vm
process/vm_manager: Initial modifications to load NPDM metadata
2018-09-29 10:54:39 -04:00
Lioncash 861580f6d2 fsmitm_romfsbuild: std::move std::vector instances in Build()
Avoids making copies of large std::vector instances where it's trivially
avoidable to do so.
2018-09-26 17:35:44 -04:00
Lioncash 7ecdaaf189 fsmitm_romfsbuild: Replace manual value aligning with Common::AlignUp()
Theres no need to do explicit bitwise arithmetic here, when we have a
function that does this with a more descriptive name.
2018-09-26 17:35:21 -04:00
Lioncash 11104b4883 patch_manager: Invert conditionals within ApplyLayeredFS()
Avoids the need to nest code quite a bit by early-exiting in error
cases.
2018-09-25 20:09:23 -04:00
Lioncash e3b2ef9170 vfs_vector: Amend initializer list order in VectorVfsFile's constructor initializer list
Orders the initializer list members to be in the same order that they
would be initialized in. Avoids compiler warnings.
2018-09-25 20:06:21 -04:00
Lioncash 4654f89618 fsmitm_romfsbuild: Avoid type truncation warnings
Cast where explicitly necessary and in other cases we can simply modify
the algorithm to accomodate larger data.
2018-09-25 20:06:21 -04:00
Lioncash 91b56c4928 fsmitm_romfsbuild: Remove unnecessary constructors and initializers for RomFSBuildFileContext and RomFSBuildDirectoryContext
There's no need to duplicate in-class initializers with a constructor
initializer list. std::strings also initialize to empty by default.
2018-09-25 20:06:21 -04:00
Lioncash 1f92cbc059 fsmitm_romfsbuild: Remove unnecessary loops in Build()
The std::vector instances are already initially allocated with all
entries having these values, there's no need to loop through and fill
them with it again when they aren't modified.
2018-09-25 20:06:21 -04:00
Lioncash fa9e0f9c8b fsmitm_romfsbuild: Make auto variable into a std::size_t variable within Build()
auto x = 0;

auto-deduces x to be an int. This is undesirable when working with
unsigned values. It also causes sign conversion warnings. Instead, we
can make it a proper unsigned value with the correct width that the
following expressions operate on.
2018-09-25 20:06:21 -04:00
Lioncash 57616f9758 vfs/etc: Append std:: to size_t usages
Given we just recently had a patch backport this from citra, let's try
and keep the convention uniform.
2018-09-25 20:06:21 -04:00
Lioncash 28bef31ea8 vfs_concat/vfs_layered: Remove friend declarations from ConcatenatedVfsFile
Given these are only added to the class to allow those functions to
access the private constructor, it's a better approach to just make them
static functions in the interface, to make the dependency explicit.
2018-09-25 20:06:01 -04:00
Lioncash 14e2df5610 vfs_static: Remove template byte parameter from StaticVfsFile
This converts it into a regular constructor parameter. There's no need
to make this a template parameter on the class when it functions
perfectly well as a constructor argument.

This also reduces the amount of code bloat produced by the compiler, as
it doesn't need to generate the same code for multiple different
instantiations of the same class type, but with a different fill value.
2018-09-25 17:40:53 -04:00
Lioncash 75603b005b process/vm_manager: Amend API to allow reading parameters from NPDM metadata
Rather than hard-code the address range to be 36-bit, we can derive the
parameters from supplied NPDM metadata if the supplied exectuable
supports it. This is the bare minimum necessary for this to be possible.

The following commits will rework the memory code further to adjust to
this.
2018-09-24 17:24:50 -04:00
Zach Hilman b3c2ec362b fsmitm: Cleanup and modernize fsmitm port 2018-09-23 21:50:20 -04:00
Zach Hilman ba0873d33c qt: Add UI elements for LayeredFS and related tools 2018-09-21 19:53:33 -04:00
Zach Hilman 050547b801 romfs: Implement CreateRomFS 2018-09-21 19:53:33 -04:00
Zach Hilman 6eada3c57d file_sys: Port Atmosphere-NX fs_mitm implementation 2018-09-21 19:53:33 -04:00
Zach Hilman 50a470eab8 bis_factory: Add mod directory VFS getter 2018-09-21 19:53:33 -04:00
Zach Hilman 16188acb50 patch_manager: Add LayeredFS mods support 2018-09-21 19:53:33 -04:00
Zach Hilman 44fdac334c vfs_concat: Rewrite and fix ConcatenatedVfsFile 2018-09-21 19:53:33 -04:00
Zach Hilman 3e5c3d0f16 vfs_layered: Add LayeredVfsDirectory
Reads multiple dirs through as if a waterfall.
2018-09-21 19:53:05 -04:00
Zach Hilman b52343a428 vfs_vector: Add VectorVfsFile
Maps a vector into the VFS interface.
2018-09-21 19:53:05 -04:00
Zach Hilman c65d4d119f vfs_static: Add StaticVfsFile
Always returns the template argument byte for all reads. Doesn't support writes.
2018-09-21 19:53:05 -04:00
Zach Hilman f68e324672 vfs: Add and rewite VfsRawCopy functions 2018-09-21 19:53:05 -04:00
Zach Hilman d6cbb3a3e0 vfs: Add GetEntries method
Maps name string to directory or file.
2018-09-21 19:53:05 -04:00
bunnei c1c59617ad
Merge pull request #1364 from lioncash/content
file-sys: Default heavy-weight class destructors in the cpp file
2018-09-20 23:31:31 -04:00
bunnei 8fe9572271
Merge pull request #1358 from DarkLordZach/temp-storage
savedata_factory: Add TemporaryStorage SaveDataType
2018-09-20 10:13:38 -04:00
bunnei 0931a711de
Merge pull request #1363 from lioncash/control
control_metadata: Move language name array definition to the cpp file
2018-09-20 10:13:23 -04:00
Lioncash 05ef9dfc10 file-sys: Default heavy-weight class destructors in the cpp file
Several classes have a lot of non-trivial members within them, or don't
but likely should have the destructor defaulted in the cpp file for
future-proofing/being more friendly to forward declarations.

Leaving the destructor unspecified allows the compiler to inline the
destruction code all over the place, which is generally undesirable from
a code bloat perspective.
2018-09-19 19:34:08 -04:00
Lioncash 3146502a12 control_metadata: Remove unnecessary else within GetLanguageEntry()
There's no need to indent the code here, given the if case contains a
return statement at the end of it.
2018-09-19 19:02:06 -04:00
Lioncash 05d49962b6 control_metadata: Move language name array definition to the cpp file
This was used in two different translation units
(deconstructed_rom_directory and patch_manager). This means we'd be
pointlessly duplicating the whole array twice due to it being defined
within the header.
2018-09-19 18:57:26 -04:00
Lioncash 2e5f0e5024 xts_archive: Remove unused variables from CalculateHMAC256()
These variables aren't used, which still has an impact, as std::vector
cannot be optimized away by the compiler (it's constructor and
destructor are both non-trivial), so this was just wasting memory.
2018-09-19 14:23:13 -04:00
Lioncash 2752183883 xts_archive: Make AsNCA() return a std::unique_ptr instead of a std::shared_ptr
std::shared_ptr isn't strictly necessary here and is only ever used in
contexts where the object doesn't depend on being shared. This also
makes the interface more flexible, as it's possible to create a
std::shared_ptr from a std::unique_ptr (std::shared_ptr has a
constructor that accepts a std::unique_ptr), but not the other way
around.
2018-09-19 14:22:37 -04:00
Lioncash f272261c21 xts_archive: Ensure NAX's type member is always initialized
Ensures that the member always has a deterministic value.
2018-09-19 14:22:37 -04:00
Lioncash 92a98a8b19 xts_archive: Amend initializer order of NAX's constructor
Orders the initializer list in the same order the members would be
initialized. Avoids compiler warnings.
2018-09-19 14:22:30 -04:00
Zach Hilman dfaea55be5 savedata_factory: Add TemporaryStorage SaveDataType
Seems to be used by NSO NES Emulator
2018-09-19 09:06:22 -04:00
fearlessTobi 63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02: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 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 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 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 f7eaea424d registration: Add support for installing NSP files 2018-09-04 14:28:41 -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
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
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 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 90fd03015a
Merge pull request #1188 from lioncash/unused
vfs_real: Remove unused variable in CreateDirectoryRelative()
2018-08-27 18:24:23 -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
Zach Hilman 6314a799aa file_sys/crypto: Fix missing/unnecessary includes 2018-08-24 22:15:32 -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
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 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 c4845df3d4 xts_encryption_layer: Implement XTSEncryptionLayer 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
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
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 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
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
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
Zach Hilman e8cb6f5c9b registration: Add Data_Unknown5 NCAContentType 2018-08-20 17:34:18 -04:00
Zach Hilman 27da7bc9da filesystem: Add support for loading of system archives 2018-08-18 21:28:23 -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
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
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 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
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
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 98b940052c made ResultStatus a u16 2018-08-12 14:56:22 +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 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 42114e1df4 vfs: Add ConcatenatedVfsFile 2018-08-11 22:50:08 -04:00