Commit graph

455 commits

Author SHA1 Message Date
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
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