Commit graph

61 commits

Author SHA1 Message Date
bunnei
72c1dd467d file_sys: patch_manager: Return early when there are no layers to apply. 2020-04-14 16:25:55 -04:00
Morph
2b0823df12 patch_manager: Adds check for disabled cheats to prevent them from being enabled (#3178)
* Adds check for disabled cheats to prevent them from being added to the CheatList

* Address feedback
2019-11-28 01:17:17 -05:00
Zach Hilman
bcac1b8ff5 dmnt_cheat_vm: Default initialize structure values 2019-09-21 22:43:49 -04:00
Zach Hilman
2b944e0d70 patch_manager: Update cheat parsing for new VM 2019-09-21 21:45:05 -04:00
Zach Hilman
c3ad37b707 yuzu: Port old usages of Filesystem namespace to FilesystemController 2019-09-21 16:43:10 -04:00
Zach Hilman
1d342149cd patch_manager: Add short-circuit edge-case to GetPatchVersionNames
If title ID is 0, there are no add ons, prevents wasting time looking for them.
2019-09-21 16:43:10 -04:00
Zach Hilman
e4336e33d6 patch_manager: Add error checking to load dir to prevent crashes
Prevents a crash if the load dir would be nullptr, instead logs an error and returns appropriately.
2019-09-21 16:43:10 -04:00
Zach Hilman
7891b418d4 patch_manager: Add getter for title version 2019-06-24 19:05:50 -04:00
Lioncash
59d55c8137 common/hex_util: Combine HexVectorToString() and HexArrayToString()
These can be generified together by using a concept type to designate
them. This also has the benefit of not making copies of potentially very
large arrays.
2019-06-12 17:54:05 -04:00
Zach Hilman
d6744d9b06 patch_manager: Dump NSO name with build ID 2019-03-27 20:09:01 -04:00
Zach Hilman
3f62d06b38 core: Port current uses of RegisteredCache to ContentProvider 2019-03-26 22:05:37 -04:00
bunnei
a5edb8d391 Merge pull request #2280 from lioncash/nso
loader/nso: Minor refactoring
2019-03-23 13:46:09 -04:00
Lioncash
b59b7084c7 file_sys/cheat_engine: Remove use of global system accessors
Instead, pass in the core timing instance and make the dependency
explicit in the interface.
2019-03-22 14:43:37 -04:00
Lioncash
be2b64e8bc file_sys/patch_manager: Deduplicate NSO header
This source file was utilizing its own version of the NSO header.
Instead of keeping this around, we can have the patch manager also use
the version of the header that we have defined in loader/nso.h
2019-03-22 14:39:10 -04:00
Lioncash
782461221f file_sys/patch_manager: Remove two magic values
These correspond to the NSOBuildHeader.
2019-03-22 14:17:50 -04:00
Zach Hilman
81302571bf patch_manager: Display cheats in game list add-ons 2019-03-04 18:39:57 -05:00
Zach Hilman
57c6d77be0 patch_manager: Add support for loading cheats lists
Uses load/<title_id>/<mod_name>/cheats as root dir, file name is all upper or lower hex first 8 bytes build ID.
2019-03-04 18:39:57 -05:00
Lioncash
9cb11d1ae4 patch_manager: Prevent use of a dangling pointer within PatchRomFS
fmt::format() returns a std::string instance by value, so calling
.c_str() on it here is equivalent to doing:

auto* ptr = std::string{}.c_str();

The data being pointed to isn't guaranteed to actually be valid anymore
after that expression ends. Instead, we can just take the string as is,
and provide the necessary formatting parameters.
2018-12-11 10:08:13 -05:00
Zach Hilman
1c3bade698 patch_manager: Obey disabled add-ons list when patching game 2018-12-03 17:21:25 -05:00
Lioncash
de9051633c filesystem: De-globalize registered_cache_union
We can just return a new instance of this when it's requested. This only
ever holds pointers to the existing registed caches, so it's not a large
object. Plus, this also gets rid of the need to keep around a separate
member function just to properly clear out the union.

Gets rid of one of five globals in the filesystem code.
2018-12-01 23:43:23 -05:00
Zach Hilman
9192141822 patch_manager: Show LayeredExeFS patch in add-ons column
The decision was made to name them LayeredExeFS instead of just LayeredFS to differentiate from normal RomFS-based mods. The name may be long/unweildy, but conveys the meaning well.
2018-11-20 19:22:34 -05:00
Zach Hilman
67e33e8866 patch_manager: Apply LayeredExeFS patches
This will scan the <mod>/exefs dir for all files and then layer those on top of the game's exefs and use this as the new exefs. This allows for overriding of the compressed NSOs or adding new files. This does use the same dir as IPS/IPSwitch patch, but since the loader will not look for those they are ignored.
2018-11-20 17:51:00 -05:00
Zach Hilman
df1c902e44 settings: Add option to dump ExeFS of games upon launch
When enabled, all exefs(es) will be copied to yuzu/dump/<title_id>/exefs.
2018-11-20 17:49:09 -05:00
bunnei
95a21eb3ef Merge pull request #1618 from DarkLordZach/dump-nso
patch_manager: Add support for dumping uncompressed NSOs
2018-11-15 14:46:10 -08:00
Frederic L
c76f4b6aec 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
c41c8d5cc1 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
Frederic L
cbe1bbf1bd file_sys/patch_manager: Remove unnecessary if-statements (#1586)
* remove unnecessary if-statements

* Addressed feedback
2018-10-28 02:30:29 -04:00
Zach Hilman
ee70cf8a1a patch_manager: Add support for using LayeredFS with Data 2018-10-17 09:03:56 -04:00
bunnei
57e652436a 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
Lioncash
92495f4f70 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
Zach Hilman
8db37c1476 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
Lioncash
4473ebd41d 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
bunnei
7af208ba49 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
8b0cf525c2 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
598ca547b2 romfs_factory: Extract packed update setter to new function 2018-10-05 08:53:51 -04:00
Zach Hilman
91de5d554e 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
19ed4d8558 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
34bbd314d5 patch_manager: Avoid romfs_ext requirement for patching 2018-10-04 14:09:11 -04:00
Zach Hilman
cc50704b77 fsmitm_romfsbuild: Extract stubs and IPS to romfs_ext dir 2018-10-04 12:29:20 -04:00
Zach Hilman
794fdbd680 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
c60739016d ips_layer: Deduplicate resource usage 2018-10-04 11:34:36 -04:00
Zach Hilman
b571894b46 patch_manager: Add support for IPSwitch format patches 2018-10-04 11:34:06 -04:00
Zach Hilman
fc1574a4de 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
4f26c89688 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
d913dba14a patch_manager: Use strings for patch type instead of enum 2018-10-01 16:02:50 -04:00
Zach Hilman
0ad053c374 aoc_u: Extract AccumulateAOCTitleIDs to separate function 2018-09-30 21:07:22 -04:00
Zach Hilman
7e0956b870 aoc_u: Implement GetAddOnContentBaseId
Command #5
2018-09-30 21:01:35 -04:00
Zach Hilman
cfc63b8736 patch_manager: Add DLC recognition to PatchManager 2018-09-30 21:01:35 -04:00
Lioncash
77f4e47b49 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
c42d80cd15 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