Commit graph

2954 commits

Author SHA1 Message Date
Lioncash
eb5596044d svc: Implement svcGetResourceLimitCurrentValue()
This kernel service function is essentially the exact same as
svcGetResourceLimitLimitValue(), with the only difference being that it
retrieves the current value for a given resource category using the
provided resource limit handle, rather than retrieving the limiting
value of that resource limit instance.

Given these are exactly the same and only differ on returned values, we
can extract the existing code for svcGetResourceLimitLimitValue() to
handle both values.
2018-11-26 21:23:11 -05:00
Lioncash
1d6399c222 svc: Implement svcGetResourceLimitLimitValue()
This kernel service function retrieves the maximum allowable value for
a provided resource category for a given resource limit instance. Given
we already have the functionality added to the resource limit instance
itself, it's sufficient to just hook it up.

The error scenarios for this are:

1. If an invalid resource category type is provided, then ERR_INVALID_ENUM is returned.

2. If an invalid handle is provided, then ERR_INVALID_HANDLE is returned (bad thing goes in, bad thing goes out, as one would expect).

If neither of the above error cases occur, then the out parameter is
provided with the maximum limit value for the given category and success
is returned.
2018-11-26 21:12:13 -05:00
Lioncash
4ef2af8c98 svc: Implement svcCreateResourceLimit()
This function simply creates a ResourceLimit instance and attempts to
create a handle for it within the current process' handle table. If the
kernal fails to either create the ResourceLimit instance or create a
handle for the ResourceLimit instance, it returns a failure code
(OUT_OF_RESOURCE, and HANDLE_TABLE_FULL respectively). Finally, it exits
by providing the output parameter with the handle value for the
ResourceLimit instance and returning that it was successful.

Note: We do not return OUT_OF_RESOURCE because, if yuzu runs out of
available memory, then new will currently throw. We *could* allocate the
kernel instance with std::nothrow, however this would be inconsistent
with how all other kernel objects are currently allocated.
2018-11-26 21:10:31 -05:00
bunnei
ee764c3b4b
Merge pull request #1793 from lioncash/ref
service/sm: Take std::string by const reference in UnregisterService
2018-11-25 23:04:21 -05:00
Luke Street
94e8dfc0c7 svc: Return ERR_INVALID_ENUM_VALUE from svcGetInfo 2018-11-25 16:48:44 -05:00
bunnei
932fbd5a25
Merge pull request #1791 from bunnei/nvdrv-stub
nvdrv: Implement/stub DumpGraphicsMemoryInfo and GetStatus.
2018-11-24 23:45:24 -05:00
Lioncash
b0df09335c
service/sm: Take std::string by const reference in UnregisterService
Avoids the need to create a copy of the std::string instance
(potentially allocating).

The only reason RegisterService takes its argument by value is because
it's std::moved internally.
2018-11-24 00:08:13 -05:00
bunnei
f7a1827aaa
Merge pull request #1641 from DarkLordZach/sm-register-unregister
sm: Implement RegisterService and UnregisterService
2018-11-23 23:59:01 -05:00
bunnei
7c4fb09a7c
Merge pull request #1731 from DarkLordZach/change-dir-crash
filesystem: Clear registered union paths on factory creation
2018-11-23 23:58:31 -05:00
bunnei
e65966bcfc
Merge pull request #1708 from ogniK5377/res-scale
Report resolution scaling support for vi and am
2018-11-23 23:32:19 -05:00
bunnei
0d673a84b6 nvdrv: Implement/stub DumpGraphicsMemoryInfo and GetStatus.
- Used by Undertale.
2018-11-23 23:22:04 -05:00
bunnei
c267aea29b
Merge pull request #1770 from DarkLordZach/applet-stub
applets: Add StubApplet and use it as fallback when AppletId is not implemented
2018-11-23 09:02:25 -08:00
bunnei
cb5b68cb0a
Merge pull request #1762 from bunnei/getgputime
nvhost_ctrl_gpu: Implement IoctlGetGpuTime.
2018-11-23 08:35:26 -08:00
Zach Hilman
f820e58be4 am: Return StubApplet instead of nullptr when AppletId not found 2018-11-22 15:58:11 -05:00
Zach Hilman
b358e88512 debug_pad: Avoid loading input for nonexistent buttons (Home and Screenshot)
Prevents memory exceptions when the debug pad is enabled.
2018-11-22 12:23:43 -05:00
bunnei
af159a4d08
Merge pull request #1765 from bunnei/multi-audout
audout_u: Add support for multiple IAudioOut streams.
2018-11-22 08:43:53 -08:00
bunnei
5a6dc4d041 audout_u: Add support for multiple IAudioOut streams.
- Used by Undertale.
2018-11-22 00:53:39 -05:00
bunnei
f926559ef4
Merge pull request #1767 from lioncash/handle
kernel/handle_table: Minor changes
2018-11-21 21:26:48 -08:00
Zach Hilman
699900eed0 applets: Add StubApplet
This will log all data it receives, log all calls to its methods and push dummy data into both channels on execution.
2018-11-21 21:20:02 -05:00
Lioncash
0e35f1bb18 kernel/handle_table: Move private static functions into the cpp file
These don't depend on class state, and are effectively implementation
details, so they can go into the cpp file .
2018-11-21 18:31:01 -05:00
Lioncash
568bcbc29d kernel/handle_table: Restrict handle table size to 1024 entries
The previous handle table size is a holdover from Citra. The actual
handle table construct on Horizon only allows for a maximum of 1024
entries.
2018-11-21 18:28:03 -05:00
Lioncash
f5ce71793e kernel/handle_table: Default destructor in the cpp file
We don't need to potentially inline the teardown logic of all of the
handle instances.
2018-11-21 18:23:09 -05:00
bunnei
d4012a4540
Merge pull request #1742 from lioncash/hle-swkbd
am/applets: Minor cleanup
2018-11-21 11:43:43 -08:00
bunnei
7f10db1c20 nvhost_ctrl_gpu: Implement IoctlGetGpuTime.
- Used by Undertale.
2018-11-21 11:43:25 -05:00
Lioncash
f17e122025 am: Correct build failure
The interface for shared memory was changed, but another commit was
merged that relied on the (previously public) internals of SharedMemory.

This amends that discrepancy.
2018-11-20 19:49:07 -05:00
bunnei
aa7e53ab5c
Merge pull request #1734 from lioncash/shared
kernel/shared_memory: Make data members private, plus minor interface changes
2018-11-20 16:13:30 -08:00
bunnei
ab292c501c
Merge pull request #1733 from lioncash/ldr
ldr: Clean up error codes
2018-11-20 16:13:09 -08:00
Lioncash
31d1e06eb1 kernel/process: Move <random> include to the cpp file
<random> isn't necesary directly within the header and can be placed in
the cpp file where its needed. Avoids propagating random generation
utilities via a header file.
2018-11-20 17:46:20 -05:00
Lioncash
73b7748984 am/applets: Make the applet data broker part of the applet itself.
The accessor should be doing just that, accessing, rather than retaining
the lifetime of the data broker as well.
2018-11-20 12:36:33 -05:00
Lioncash
8b4b560df5 am/applets: Replace includes with forward declarations where applicable
Also resolve places where includes should have been provided, but
weren't.
2018-11-20 11:53:55 -05:00
Lioncash
dd254c603d am/applets: Relocate comments above the relevant data member in AppletDataBroker
Avoids wonky wrapping and makes it nicer to read.
2018-11-20 11:49:49 -05:00
bunnei
b6d2c64f4d
Merge pull request #1667 from DarkLordZach/swkbd
am: Implement HLE software keyboard applet
2018-11-20 08:24:11 -08:00
bunnei
e9265ac598
Merge pull request #1739 from lioncash/lm
lm: Implement SetDestination by doing nothing
2018-11-19 18:40:17 -08:00
Lioncash
5d46038c5c kernel/resource_limit: Clean up interface
Cleans out the citra/3DS-specific implementation details that don't
apply to the Switch. Sets the stage for implementing ResourceLimit
instances properly.

While we're at it, remove the erroneous checks within CreateThread() and
SetThreadPriority(). While these are indeed checked in some capacity,
they are not checked via a ResourceLimit instance.

In the process of moving out Citra-specifics, this also replaces the
system ResourceLimit instance's values with ones from the Switch.
2018-11-19 18:16:39 -05:00
Lioncash
34e4aaddd9 lm: Implement SetDestination by doing nothing
This service function was likely intended to be a way to redirect where
the output of a log went. e.g. Firing a log over a network, dumping over
a tunneling session, etc.

Given we always want to see the log and not change its output. It's one
of the lucky service functions where the easiest implementation is to
just do nothing at all and return success.
2018-11-19 18:09:40 -05:00
Zach Hilman
a9fa890f14 software_keyboard: Fix erroneous extra PushNormalData 2018-11-19 16:30:17 -05:00
Zach Hilman
d68795c665 software_keyboard: Return correct result code on user cancel operation 2018-11-19 15:10:01 -05:00
Zach Hilman
32775125b7 applet: Add AppletDataBroker to manage HLE to AM service interaction
This cleans up most of the callbacks and such in the Applets::Applet interface, while also properly implementing all four data channels.
2018-11-19 14:24:36 -05:00
Zach Hilman
96535c13a5 software_keyboard: Use correct offset for inital text string 2018-11-19 11:22:04 -05:00
Lioncash
233e495c14 kernel/shared_memory: Make Map() and Unmap() take the target process by reference rather than as a pointer
Both member functions assume the passed in target process will not be
null. Instead of making this assumption implicit, we can change the
functions to be references and enforce this at the type-system level.
2018-11-19 09:20:29 -05:00
Lioncash
fb5d4b17de kernel/shared_memory: Add a const qualified member function overload for GetPointer()
Given this doesn't mutate instance state, we can provide a
const-qualified variant as well.
2018-11-19 09:20:29 -05:00
Lioncash
2d37ca3726 kernel/shared_memory: Use 64-bit types for offset and size in CreateForApplet
Keeps the interface consistent with the regular Create() function.
2018-11-19 09:20:29 -05:00
Lioncash
76ac234bf6 kernel/shared_memory: Make GetPointer() take a std::size_t instead of a u32
Makes the interface nicer to use in terms of 64-bit code, as it makes it
less likely for one to get truncation warnings (and also makes sense in
the context of the rest of the interface where 64-bit types are used for
sizes and offsets
2018-11-19 09:20:29 -05:00
Lioncash
f472232705 kernel/shared_memory: Make data members private
Rather than allow unfettered access to the class internals, we hide all
members by default and create and API that other code can operate
against.
2018-11-19 09:20:25 -05:00
Lioncash
43e7c6cf49 ldr: Clean up error codes
The separate enum isn't particularly necessary here, and the values can
just be directly put into the ResultCode instances, given the names are
also self-documenting here.
2018-11-19 08:12:25 -05:00
Zach Hilman
c3becdbca7 filesystem: Clear registered union paths on factory creation 2018-11-18 23:31:30 -05:00
Zach Hilman
3a6cd5b3c8 hid: Use player-defined controller type as PREFERRED_CONTROLLER 2018-11-18 23:22:36 -05:00
Zach Hilman
55ded706d6 hid/npad: Update NPad to use player controller bindings and type 2018-11-18 23:22:36 -05:00
Zach Hilman
e9145c3e16 hid/touchscreen: Update Touchscreen to use advanced parameters
Including finger ID, diamater x/y, and angle. Additionally, checks if the touchscreen is enabled.
2018-11-18 23:22:36 -05:00
Zach Hilman
3b25426bd9 hid: Add controller bindings for Mouse controller 2018-11-18 23:22:36 -05:00