Commit graph

2751 commits

Author SHA1 Message Date
Lioncash
929ed59f1f hid/controller/npad: Remove #pragma once from the cpp file
This is only useful in headers.
2018-10-17 20:52:45 -04:00
Lioncash
aeda743446 hid/controller/npad: Move npad_id_list into the cpp file
This is just a lookup table, and since it's private, there's nothing
really stateful about it, so we can just move it into the cpp file.
2018-10-17 20:52:45 -04:00
Lioncash
aeca224890 hid/controller/npad: Remove unnecessary const from void return type
This literally does nothing.
2018-10-17 20:52:45 -04:00
Lioncash
46202e984e hid/controller: Default the destructors of all controller types in the cpp file
These classes are non-trivial and are definitely going to be changed in
the future, so we default these to prevent issues with forward
declarations, and to keep the compiler from inlining tear-down code.
2018-10-17 20:52:43 -04:00
Lioncash
119b47f366 controller_base: Default the base class constructor and destructor in the cpp file
The destructor doesn't need to be a pure-virtual function.
2018-10-17 20:51:54 -04:00
bunnei
7dee60d7d2
Merge pull request #1444 from ogniK5377/better-hid
"Better Hid" Rework Part 1
2018-10-17 20:25:17 -04:00
bunnei
6e8752881c
Merge pull request #1498 from lioncash/aslr
svc: Clarify enum values for AddressSpaceBaseAddr and AddressSpaceSize in svcGetInfo()
2018-10-17 18:31:51 -04:00
David Marcec
8144fa42bd Using dual joycons as the default controller
Reason for the change is to allow both docked and undocked mode to work
2018-10-18 00:11:47 +11:00
Zach Hilman
780c21ab2d fsp_srv: Apply patches to Data storage in OpenDataStorageByDataId 2018-10-17 09:04:20 -04:00
David
92d8ad3770 Implement VI ConvertScalingMode (#1475)
* Implement VI ConvertScalingMode

* Fixed push enum

* Scale mode now uses Nintendo scale mode as an enum as well
2018-10-16 11:25:42 -04:00
bunnei
88b8383da2
Merge pull request #1502 from lioncash/unique
core: Convert shared_ptr instances into unique_ptr instances where applicable for System and Cpu
2018-10-16 11:21:42 -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
bunnei
9b21fbd1eb
Merge pull request #1494 from DarkLordZach/aoc-signature-fixes
aoc: Fix various bugs in current AOC implementation
2018-10-15 18:34:02 -04:00
Lioncash
5484742fda core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrs 2018-10-15 14:15:56 -04:00
Lioncash
90f8474fc1 svc: Clarify enum values for AddressSpaceBaseAddr and AddressSpaceSize in svcGetInfo()
So, one thing that's puzzled me is why the kernel seemed to *not* use
the direct code address ranges in some cases for some service functions.
For example, in svcMapMemory, the full address space width is compared
against for validity, but for svcMapSharedMemory, it compares against
0xFFE00000, 0xFF8000000, and 0x7FF8000000 as upper bounds, and uses
either 0x200000 or 0x8000000 as the lower-bounds as the beginning of the
compared range. Coincidentally, these exact same values are also used in
svcGetInfo, and also when initializing the user address space, so this
is actually retrieving the ASLR extents, not the extents of the address
space in general.
2018-10-14 20:11:16 -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
bunnei
0d2ba0a320
Merge pull request #1491 from lioncash/reference
filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem by reference
2018-10-14 14:42:57 -04:00
bunnei
2f8ca32020
Merge pull request #1492 from lioncash/proc
svc: Implement svcGetProcessInfo
2018-10-14 14:37:58 -04:00
David Marcec
92fae7e1ab Stop all threads on svcBreak
This should help diagnose crashes easier and prevent many users thinking that a game is still running when in fact it's just an audio thread still running(this is typically not killed when svcBreak is hit since the game expects us to do this)
2018-10-14 18:14:51 +11:00
Zach Hilman
7e2096db8a aoc: Return size in ListAddOnContent 2018-10-13 22:52:54 -04:00
Lioncash
1c7a7ed79b svc: Implement svcGetProcessInfo
A fairly basic service function, which only appears to currently support
retrieving the process state. This also alters the ProcessStatus enum to
contain all of the values that a kernel process seems to be able of
reporting with regards to state.
2018-10-13 17:00:43 -04:00
Lioncash
0149162dba filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem instance by reference
Neither of these functions alter the ownership of the provided pointer,
so we can simply make the parameters a reference rather than a direct
shared pointer alias. This way we also disallow passing incorrect memory values like
nullptr.
2018-10-13 11:36:35 -04:00
bunnei
c2aa4293ec
Merge pull request #1483 from lioncash/codeset
kernel/process: Make CodeSet a regular non-inherited object
2018-10-12 22:52:12 -04:00
bunnei
ffcda6c08e
Merge pull request #1481 from lioncash/typo
svc: Fix typos in sanitizing checks for MapMemory/UnmapMemory
2018-10-12 20:46:55 -04:00
bunnei
2946d4bdbe
Merge pull request #1467 from ogniK5377/svcbreak-type-fix
Fixed incorrect types for svcBreak
2018-10-12 12:08:08 -04:00
Lioncash
1abed2f4c4 kernel/process: Make CodeSet a regular non-inherited object
These only exist to ferry data into a Process instance and end up going
out of scope quite early. Because of this, we can just make it a plain
struct for holding things and just std::move it into the relevant
function. There's no need to make this inherit from the kernel's Object
type.
2018-10-12 12:07:32 -04:00
bunnei
0f7ab3e21a
Merge pull request #1478 from ogniK5377/remap-invalidhandle-remap
Passing an invalid nmap handle to Remap should throw an error
2018-10-12 12:07:14 -04:00
bunnei
f9d03b1d41
Merge pull request #1482 from lioncash/init
thread: Remove unnecessary memset from ResetThreadContext()
2018-10-12 12:06:51 -04:00
bunnei
dc328440c8
Merge pull request #1479 from ogniK5377/nmap-revamped
Added error codes for nvmap
2018-10-12 12:06:22 -04:00
Lioncash
b492d43e63 thread: Remove unnecessary memset from ResetThreadContext()
Regular value initialization is adequate here for zeroing out data. It
also has the benefit of not invoking undefined behavior if a non-trivial
type is ever added to the struct for whatever reason.
2018-10-12 10:57:31 -04:00
David Marcec
4d2de6564f Returned an error before processing other remaps 2018-10-12 17:10:41 +11:00
David Marcec
c55b5de0fb Made the minimum alignment more clear 2018-10-12 17:06:46 +11:00
Lioncash
4ccf30dfaa svc: Fix typos in sanitizing checks for MapMemory/UnmapMemory 2018-10-12 01:48:26 -04:00
David Marcec
98b760c645 Wip 2018-10-12 16:28:00 +11:00
bunnei
9bf409f275
Merge pull request #1474 from ogniK5377/hwopus-decodeinterleavedwithperformance
HwOpus, Implemented DecodeInterleavedWithPerformance
2018-10-11 16:52:13 -04:00
bunnei
3fd26b7147
Merge pull request #1472 from lioncash/san
svc: Add missing address range sanitizing checks to MapMemory/UnmapMemory
2018-10-11 16:51:41 -04:00
David Marcec
85b0d9a7be Dynamically decide handheld variant based on supported npad id priority
Kirby input still doesn't work, should fix a lot of other games
2018-10-12 02:56:49 +11:00
David Marcec
c7763603ef Added error codes for nvmap 2018-10-11 23:06:34 +11:00
David Marcec
5dd538cace Passing an invalid nmap handle to Remap should throw an error
Added error for invalid nmap handles
2018-10-11 20:32:21 +11:00
bunnei
bf795edac4 nvhost_as_gpu: Flush CPU VAddr on UnmapBuffer. 2018-10-11 00:19:36 -04:00
David Marcec
fa10905e1e HwOpus, Implemented DecodeInterleavedWithPerformance
Used by sonic ages
2018-10-11 13:06:56 +11:00
Lioncash
72e9cb523e svc: Add missing address range sanitizing checks to MapMemory/UnmapMemory
This adds the missing address range checking that the service functions
do before attempting to map or unmap memory. Given that both service
functions perform the same set of checks in the same order, we can wrap
these into a function and just call it from both functions, which
deduplicates a little bit of code.
2018-10-10 20:30:49 -04:00
David Marcec
9e924f2ef2 Added BeginPermitVibrationSession and EndPermitVibrationSession
Used by Mario Party
2018-10-11 00:58:47 +11:00
David Marcec
3d75c9cd7a Added GetLedPattern and HandheldVariant
HandheldVariant is for specific games which expect handheld controllers to be at position 8(kirby), however this doesn't fix all games as some games require handhelds to be at position 0(snipperclips)
2018-10-10 21:38:43 +11:00
Lioncash
5c0408596f kernel/thread: Use a regular pointer for the owner/current process
There's no real need to use a shared pointer in these cases, and only
makes object management more fragile in terms of how easy it would be to
introduce cycles. Instead, just do the simple thing of using a regular
pointer. Much of this is just a hold-over from citra anyways.

It also doesn't make sense from a behavioral point of view for a
process' thread to prolong the lifetime of the process itself (the
process is supposed to own the thread, not the other way around).
2018-10-10 02:04:55 -04:00
David Marcec
46cdeb4549 Kirby expects handheld controllers to be at position 8 2018-10-10 14:21:56 +11:00
David Marcec
f43815af5d Added the ability to "disconnect" individual npads
Fixes arms
2018-10-10 13:15:39 +11:00
David Marcec
b79c294c02 Removed unneeded forward declarations 2018-10-10 13:15:37 +11:00
David Marcec
5857aea94e Addressed changes for better hid 2018-10-10 13:15:37 +11:00
David Marcec
56f35ab262 "Better Hid" rework part 1 2018-10-10 13:15:35 +11:00
David Marcec
2db37ddea9 Changed all casts in svc_wrap.h to be static_cast instead 2018-10-10 12:49:08 +11:00
David Marcec
09b6dda8f0 Use a better name than "dont_kill_application"
signal_debugger seems like a more fitting name
2018-10-10 12:27:44 +11:00
David Marcec
a4412c8e22 Fixed incorrect types for svcBreak
svcBreak reason should be a u32, not a u64.
2018-10-10 12:23:50 +11:00
David Marcec
f5631e78d1 Added bitfield instead of manually checking if the bit is set 2018-10-09 12:11:14 +11:00
David Marcec
af3ba94b2a Actual kill execution when the bit isn't set, not the other way around 2018-10-09 11:14:48 +11:00
David Marcec
c50f66a8eb svcBreak, Signalling to the debugger should not kill execution
When loading NROs, svcBreak is called to signal to the debugger that a new "module" is loaded. As no debugger is technically attached we shouldn't be killing the programs execution.
2018-10-09 11:10:30 +11:00
bunnei
fd891ee9c0
Merge pull request #1456 from ogniK5377/aoc-u-fixups
Fixed assertion due to CountAddOnContent & Casting warnings
2018-10-08 01:21:05 -04:00
David Marcec
c5c184246d Unmapping an unmapped buffer should succeed
Hardware tests show that trying to unmap an unmapped buffer already should always succeed. Hardware test was tested up to 32 iterations of attempting to unmap
2018-10-08 13:26:48 +11:00
David Marcec
fa3f3cd07f Fixed assertion due to CountAddOnContent
Word count should be 3 since we're pushing a result code and a u32.

Also fixed up compiler warnings due to casting
2018-10-08 00:25:46 +11:00
bunnei
6e4d2e672d
Merge pull request #1396 from DarkLordZach/packed-updates
loader: Add support for packed updates
2018-10-06 23:58:24 -04:00
David Marcec
612ce89eca Added forward define for ServerPort 2018-10-06 17:47:33 +10:00
David Marcec
f84b9ed4e8 Ported #4296 from citra
This will allow us to easily remove the use of "NFC" in "System"
2018-10-06 16:49:01 +10:00
Lioncash
6ddf8f34db
kernel/mutex: Amend behavior of TransferMutexOwnership()
This was the result of a typo accidentally introduced in
e51d715700. This restores the previous
correct behavior.

The behavior with the reference was incorrect and would cause some games
to fail to boot.
2018-10-06 01:13:02 -04:00
balika011
1a5d6de0d4 thread: Make the scheduler pointer a regular pointer
Conceptually, it doesn't make sense for a thread to be able to persist
the lifetime of a scheduler. A scheduler should be taking care of the
threads; the threads should not be taking care of the scheduler.

If the threads outlive the scheduler (or we simply don't actually
terminate/shutdown the threads), then it should be considered a bug
that we need to fix.

Attributing this to balika011, as they opened #1317 to attempt to fix
this in a similar way, but my refactoring of the kernel code caused
quite a few conflicts.
2018-10-05 14:53:01 -04:00
bunnei
e51d715700
Merge pull request #1439 from lioncash/thread
kernel/thread: Make all instance variables private
2018-10-05 13:41:54 -04:00
Zach Hilman
38c2ac95af romfs_factory: Extract packed update setter to new function 2018-10-05 08:53:51 -04:00
Lioncash
baed7e1fba kernel/thread: Make all instance variables private
Many of the member variables of the thread class aren't even used
outside of the class itself, so there's no need to make those variables
public. This change follows in the steps of the previous changes that
made other kernel types' members private.

The main motivation behind this is that the Thread class will likely
change in the future as emulation becomes more accurate, and letting
random bits of the emulator access data members of the Thread class
directly makes it a pain to shuffle around and/or modify internals.
Having all data members public like this also makes it difficult to
reason about certain bits of behavior without first verifying what parts
of the core actually use them.

Everything being public also generally follows the tendency for changes
to be introduced in completely different translation units that would
otherwise be better introduced as an addition to the Thread class'
public interface.
2018-10-04 00:14:15 -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
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
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
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
raven02
4092907687 Implement ISystemDisplayService::GetDisplayMode 2018-09-30 10:04:03 +08: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
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
bunnei
efcb83fb41
Merge pull request #1400 from lioncash/header
service: Add missing headers inclusions where applicable
2018-09-26 16:11:19 -04:00
Lioncash
e42bb5e003 service: Add missing headers inclusions where applicable
Gets rid of a few indirect inclusions.
2018-09-25 17:14:38 -04:00
bunnei
7b81e1e525
Merge pull request #1365 from DarkLordZach/lfs
file_sys: Add support for LayeredFS mods
2018-09-25 16:59:44 -04:00
Lioncash
a58eefa7e4 kernel/scheduler: Take ARM_Interface instance by reference in the constructor
It doesn't make sense to allow a scheduler to be constructed around a
null pointer.
2018-09-25 16:00:17 -04:00
bunnei
b67c1fdf38
Merge pull request #1393 from tech4me/svc
svc: Updated svc names
2018-09-25 10:47:12 -04:00
Lioncash
83377113bf memory: Dehardcode the use of fixed memory range constants
The locations of these can actually vary depending on the address space
layout, so we shouldn't be using these when determining where to map
memory or be using them as offsets for calculations. This keeps all the
memory ranges flexible and malleable based off of the virtual memory
manager instance state.
2018-09-24 22:16:03 -04:00
Lioncash
6c6f95d071 svc: Report correct memory-related values within some of the cases in svcGetInfo()
Previously, these were reporting hardcoded values, but given the regions
can change depending on the requested address spaces, these need to
report the values that the memory manager contains.
2018-09-24 22:16:03 -04:00
Lioncash
7fd598636e memory: Dehardcode the use of a 36-bit address space
Given games can also request a 32-bit or 39-bit address space, we
shouldn't be hardcoding the address space range as 36-bit.
2018-09-24 22:15: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
David
367c52ff0d Implemented fatal:u properly (#1347)
* Implemented fatal:u properly

fatal:u now is properly implemented with all the ipc cmds. Error reports/Crash reports are also now implemented for fatal:u. Crash reports save to yuzu/logs/crash_reports/
The register dump is currently known as sysmodules send all zeros. If there are any non zero values for the "registers" or the unknown values, let me know!

* Fatal:U fixups

* Made fatal:u execution break more clear

* Fatal fixups
2018-09-23 22:34:11 -04:00
David
2513e086ab Stubbed IRS (#1349)
* Stubbed IRS

Currently we have no ideal way of implementing IRS. For the time being we should have the functions stubbed until we come up with a way to emulate IRS properly.

* Added IRS to logging backend

* Forward declared shared memory for irs
2018-09-23 22:33:29 -04:00
bunnei
f2c1fd08f9
Merge pull request #1354 from ogniK5377/ssl-version
Corrected SSL::SetInterfaceVersion
2018-09-23 22:32:14 -04:00
Lioncash
2f6a611311 stream: Preserve enum class type in GetState()
Preserves the meaning/type-safetiness of the stream state instead of
making it an opaque u32. This makes it usable for other things outside
of the service HLE context.
2018-09-23 20:03:38 -04:00
tech4me
d42424ace0 svc: Updated svc names 2018-09-23 17:03:38 -07:00
David Marcec
c461188f51 Added audren:u#GetAudioRendererState 2018-09-23 22:32:01 +10:00