Commit graph

4285 commits

Author SHA1 Message Date
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
cf3a6dd4a1
Merge pull request #1434 from DarkLordZach/dlc-edge-case
aoc_u: Fix edge case with DLC that causes breaks
2018-10-03 21:39:23 -04:00
bunnei
39f08e551d
Merge pull request #1433 from lioncash/fs
services/fsp_srv: Amend service function table
2018-10-03 19:13:57 -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
e7e347a828
Merge pull request #1432 from lioncash/lbl
service/lbl: Update service function table
2018-10-03 18:45:15 -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
9aaf1c0df8 aoc_u: Fix edge case with DLC that causes breaks
In some games (Splatoon 2 and Splatoon 2 Splatfest World Premiere, notably), pass offset=0 and count=2047 into the ListAddOnContent method which should return all DLCs for the current title. The (presumably) intended behavior is to successfully return a empty array but because of a < v. <= in an if statement, a failure error code was returned causing these games to svcBreak. This fixes that if statement.
2018-10-02 21:56:32 -04:00
Lioncash
cba78dc70a services/fsp_srv: Amend service function table
Adds new functions that have been given names to the table. Information
is based off what is provided on Switchbrew.
2018-10-02 21:34:33 -04:00
Lioncash
d80dd2b812 service/lbl: Update service function table
Amends the lbl service table to include new names of functions that were
added to Switchbrew.
2018-10-02 21:15:59 -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
6d441828e6 deconstructed_rom_directory: Force NSO loader to patch NSOs 2018-10-01 16:02:50 -04:00
Zach Hilman
003b44822a nso: Add framework to support patching of uncompressed NSOs 2018-10-01 16:02:50 -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
3c9e70fefa nso: Replace NSOHeader padding bytes with build ID 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
62225ae050 aoc_u: Implement Count, List and Prepare AddOnContent
Commands #2, #3, and #7
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
bunnei
8f2ad3a66d
Merge pull request #1338 from raven02/service_vi
Implement ISystemDisplayService::GetDisplayMode
2018-09-30 15:39:54 -04:00
Lioncash
541c550753 kernel/svc: Implement svcGetThreadContext()
Now that we have all of the rearranging and proper structure sizes in
place, it's fairly trivial to implement svcGetThreadContext(). In the
64-bit case we can more or less just write out the context as is, minus
some minor value sanitizing. In the 32-bit case we'll need to clear out
the registers that wouldn't normally be accessible from a 32-bit
AArch32 exectuable (or process).
2018-09-30 05:29:40 -04:00
Lioncash
dccfe193a9 kernel/process: Add a data member to determine if a process is 64-bit or not.
This will be necessary for the implementation of svcGetThreadContext(),
as the kernel checks whether or not the process that owns the thread
that has it context being retrieved is a 64-bit or 32-bit process.

If the process is 32-bit, then the upper 15 general-purpose registers
and upper 16 vector registers are cleared to zero (as AArch32 only has
15 GPRs and 16 128-bit vector registers. not 31 general-purpose
registers and 32 128-bit vector registers like AArch64).
2018-09-30 05:29:40 -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
Lioncash
16145e2f21 arm_interface: Add missing fpsr/tpidr members to the ThreadContext struct
Internally within the kernel, it also includes a member variable for the
floating-point status register, and TPIDR, so we should do the same here to match
it.

While we're at it, also fix up the size of the struct and add a static
assertion to ensure it always stays the correct size.
2018-09-30 02:29:57 -04:00
raven02
4092907687 Implement ISystemDisplayService::GetDisplayMode 2018-09-30 10:04:03 +08:00
Lioncash
a63e6f9dfd loader: Make the Load() function take a process as a regular reference, not a SharedPtr
A process should never require being reference counted in this
situation. If the handle to a process is freed before this function is
called, it's definitely a bug with our lifetime management, so we can
put the requirement in place for the API that the process must be a
valid instance.
2018-09-29 16:00:03 -04:00
bunnei
97c0ac3545
Merge pull request #1412 from lioncash/move
kernel/object: Remove unnecessary std::move from DynamicObjectCast()
2018-09-29 11:58:58 -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
f4c24d0832 kernel/object: Remove unnecessary std::move from DynamicObjectCast()
boost::static_pointer_cast for boost::intrusive_ptr (what SharedPtr is),
takes its parameter by const reference. Given that, it means that this
std::move doesn't actually do anything other than obscure what the
function's actual behavior is, so we can remove this. To clarify, this
would only do something if the parameter was either taking its argument
by value, by non-const ref, or by rvalue-reference.
2018-09-28 02:17:57 -04:00
bunnei
fc2419e441
Merge pull request #1394 from lioncash/stream
stream: Preserve enum class type in GetState()
2018-09-27 17:05:03 -04:00
Mat M
29ff84ea99
Merge pull request #1389 from PhiBabin/valgrind
FPCR register was uninitialized at start up
2018-09-27 15:23:03 -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
bunnei
c0445006af
Merge pull request #1399 from lioncash/sched
kernel/scheduler: Take ARM_Interface instances by reference
2018-09-26 16:17:18 -04:00