Commit graph

4815 commits

Author SHA1 Message Date
bunnei
adb882bf90
Merge pull request #1814 from lioncash/ptr
file_sys/registered_cache: Use regular const references instead of std::shared_ptr for InstallEntry()
2018-11-27 19:20:12 -05:00
bunnei
ac74b71d75 dma_pushbuffer: Optimize to avoid loop and copy on Push. 2018-11-27 19:17:33 -05:00
Zach Hilman
6df74ff579 npad: Fix copy/paste error with LED position assignments 2018-11-27 17:23:44 -05:00
bunnei
3cc204aff8
Merge pull request #1802 from DarkLordZach/user-data-storage
profile_manager: Save and load ProfileData from disk
2018-11-27 16:36:23 -05:00
Lioncash
7b1aaaa069 file_sys/registered_cache: Remove unused <map> include 2018-11-27 16:33:18 -05:00
Lioncash
d72c809030 file_sys/registered_cache: Use regular const references instead of std::shared_ptr for InstallEntry()
These parameters don't need to utilize a shared lifecycle directly in
the interface. Instead, the caller should provide a regular reference
for the function to use. This also allows the type system to flag
attempts to pass nullptr and makes it more generic, since it can now be
used in contexts where a shared_ptr isn't being used (in other words, we
don't constrain the usage of the interface to a particular mode of
memory management).
2018-11-27 16:33:14 -05:00
Lioncash
d4e3d567ce control_metadata: Correct typo in language name (Portugese -> Portuguese)
While we're at it, organize the array linearly, since clang formats the
array elements quite wide length-wise with the addition of the missing
'u'.

Technically also fixes patch lookup and icon lookup with Portuguese,
though I doubt anyone has actually run into this issue.
2018-11-27 13:21:46 -05:00
bunnei
11c17465d8
Merge pull request #1804 from lioncash/cast
gdbstub: Silence value truncation warning within FpuWrite()
2018-11-26 23:19:40 -05:00
bunnei
abea6fa90c gpu: Rewrite GPU command list processing with DmaPusher class.
- More accurate impl., fixes Undertale (among other games).
2018-11-26 23:14:01 -05:00
Lioncash
5905162e36 svc: Implement svcSetResourceLimitLimitValue()
The opposite of the getter functions, this function sets the limit value
for a particular ResourceLimit resource category, with the restriction
that the  new limit value must be equal to or greater than the current
resource value. If this is violated, then ERR_INVALID_STATE is returned.

e.g.

Assume:

current[Events] = 10;
limit[Events] = 20;

a call to this service function lowering the limit value to 10 would be
fine, however, attempting to lower it to 9 in this case would cause an
invalid state error.
2018-11-26 21:23:15 -05:00
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
David Marcec
cc4521fc70 Added comment on Main memory size for more clarity 2018-11-27 12:56:50 +11:00
David Marcec
f058de337e Made svcSetHeapSize and svcCreateSharedMemory more readable 2018-11-27 12:53:18 +11:00
David Marcec
f271316822 Reworked svcs slightly, improved error messages in AM and fsp_srv 2018-11-27 12:29:06 +11:00
Lioncash
474c745502 gdbstub: Silence value truncation warning within FpuWrite()
Previously this would cause an implicit truncation warning about
assigning a u64 value to a u32 value without an explicit cast.
2018-11-26 19:58:23 -05:00
Zach Hilman
dac0c33fd2 profile_manager: Save and load ProfileData from disk
The ProfileData is a 0x80-sized structure that stores various pieces of miscellaneous data for the account.
2018-11-26 17:11:12 -05:00
David Marcec
dace6087d6 Fixed hwopus compile error 2018-11-26 21:52:10 +11:00
David Marcec
3d627df4d8 Improved error messages in AM, HwOpus and NvMap 2018-11-26 20:05:09 +11:00
David Marcec
9662ca918d Improved error messages for SVCs 2018-11-26 19:47:39 +11:00
David Marcec
a2cc3b10bb Changed logging to be "Log before execution", Added more error logging, all services should now log on some level 2018-11-26 17:06:13 +11: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
69a9bd8187
Merge pull request #1692 from Hedges/GDBClean
GDBStub Improvements
2018-11-23 23:36:36 -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
67ff974387
Merge pull request #1747 from DarkLordZach/exefs-lfs
patch_manager: Add support for applying LayeredFS patches to ExeFS
2018-11-23 23:31:48 -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
f1969ee1f3
Merge pull request #1777 from lioncash/core-mgr
core: Relocate CPU core management to its own class
2018-11-23 09:00:41 -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
Lioncash
232d95b56e core: Relocate CPU core management to its own class
Keeps the CPU-specific behavior from being spread throughout the main
System class. This will also act as the home to contain member functions
that perform operations on all cores. The reason for this being that the
following pattern is sort of prevalent throughout sections of the
codebase:

If clearing the instruction cache for all 4 cores is necessary:

Core::System::GetInstance().ArmInterface(0).ClearInstructionCache();
Core::System::GetInstance().ArmInterface(1).ClearInstructionCache();
Core::System::GetInstance().ArmInterface(2).ClearInstructionCache();
Core::System::GetInstance().ArmInterface(3).ClearInstructionCache();

This is kind of... well, silly to copy around whenever it's needed.
especially when it can be reduced down to a single line.

This change also puts the basics in place to begin "ungrafting" all of the
forwarding member functions from the System class that are used to
access CPU state or invoke CPU-specific behavior. As such, this change
itself makes no changes to the direct external interface of System. This
will be covered by another changeset.
2018-11-22 04:28:19 -05: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
Zach Hilman
54e74b3572 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
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
bunnei
67486c0568
Merge pull request #1746 from lioncash/random
kernel/process: Move <random> include to the cpp file
2018-11-20 16:12:29 -08:00
Lioncash
820bcee6a4 file_sys/card_image: Provide named members for the GamecardInfo struct
Fills out the struct according to information provided by SwitchBrew
2018-11-20 18:40:53 -05:00
Zach Hilman
da6d4cde56 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
17d8e25cbf 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
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
Zach Hilman
0fd45e78f4 hid: Add keyboard bindings for Keyboard controller 2018-11-18 23:22:36 -05:00
Zach Hilman
06cf050c0a hid: Add controller bindings for DebugPad controller
Used by developers to test games, not present on retail systems. Some games are known to respond to DebugPad input though, for example Kirby Star Allies.
2018-11-18 23:22:36 -05:00
Zach Hilman
c77454b9d0 settings: Add settings for multiple players and controllers
Uses the PlayerInput struct to represent all of the data that constitutes a player.
2018-11-18 23:21:33 -05:00
Zach Hilman
fd5fa48674 settings: Add Native type for keyboard 2018-11-18 23:21:33 -05:00
Zach Hilman
152422bab1 settings: Add Native type for mouse buttons 2018-11-18 23:21:33 -05:00
David Marcec
0c3e7b7086 Added missing start/end touch attributes to touchscreen 2018-11-18 23:21:33 -05:00
David Marcec
f66c6fe554 Added debugpad skeleton 2018-11-18 23:21:33 -05:00
David Marcec
362b28d052 Added controller helper funcs 2018-11-18 23:21:33 -05:00
David Marcec
a69b9d73f5 Changed polling rate of hid and Right joycon rotation 2018-11-18 23:21:33 -05:00
David Marcec
7fbe2c83a7 Left joycon rotation button remapping 2018-11-18 23:21:33 -05:00
David Marcec
b9c1e4b0e7 Added automatic npad switch based on supported stylesets 2018-11-18 23:21:33 -05:00
David Marcec
beab38601b Added multi-input support and controller assignment at any port 2018-11-18 23:21:33 -05:00
David Marcec
60fecee1ec Removed hard coded values for width and height 2018-11-19 15:20:47 +11:00
Zach Hilman
ea680bea60 software_keyboard: Check for UTF-8 config flag 2018-11-18 23:14:48 -05:00
bunnei
e34d47e6e3
Merge pull request #1620 from DarkLordZach/ldr-ro
ldr_ro: Complete LDR:RO implementation
2018-11-18 19:23:38 -08:00
bunnei
f08b4cbbc8
Merge pull request #1718 from ogniK5377/lets-go-softlock
Implemented CalculateStandardUserSystemClockDifferenceByUser
2018-11-18 19:22:47 -08:00
bunnei
611141e09f
Merge pull request #1671 from DarkLordZach/vi-disconnect
vi: Implement TransactParcel for Disconnect and DetachBuffer
2018-11-18 19:18:46 -08:00
Mat M
9a1bac840e
Merge pull request #1728 from FearlessTobi/reset-signal
svc: ResetSignal is not stubbed
2018-11-18 15:51:32 -05:00
Tobias
13f79cc5bd
svc: ResetSignal is not stubbed
https://user-images.githubusercontent.com/20753089/48677874-b8e01c80-eb7b-11e8-8043-b99faa29022c.PNG
2018-11-18 21:49:17 +01:00
Zach Hilman
02e6602baa software_keyboard: Push all data over all channels on dialog completion 2018-11-18 10:53:47 -05:00
Zach Hilman
4ee087fb3c applet: Use std::queue instead of std::vector for storage stack 2018-11-18 10:53:47 -05:00
Zach Hilman
19b2571aec applet: Add operation completed callback 2018-11-18 10:53:47 -05:00