Commit Graph

327 Commits

Author SHA1 Message Date
◱ PixelyIon
ee2fdbdf6a Fix Joy-Con Pair Crash + Implement More HID Service Functions
This fixes a Joy-Con Pair bug which caused a crash when a partner device was set to none while being set as a partner. In addition, the following HID service functions were implemented:
* GetSupportedNpadStyleSet
* ActivateNpadWithRevision
* GetNpadJoyHoldType
* AcquireNpadStyleSetUpdateEventHandle
2020-08-21 11:48:29 +00:00
◱ PixelyIon
6a931b95b0 Implement C++ Support for Controller Configuration
This commit adds support to the C++ end of things for controller configuration. It isn't targeting being 1:1 to HOS for controller assignment but is rather based on intuition of how things should be.
2020-08-21 11:48:29 +00:00
◱ PixelyIon
75d485a9a7 Addition of Controller Configuration UI
This commit adds in the UI for Controller Configuration to Settings, in addition to introducing the storage and loading of aforementioned configurations to a file that can be saved/loaded at runtime. This commit also fixes updating of individual fields in Settings when changed from an external activity.
2020-08-21 11:48:29 +00:00
◱ PixelyIon
8e1f8ae7e9 Make UI fully usable using a controller
This commit focuses on making the UI completely usable using a controller so that a user won't have to switch between their device's touch screen and a controller constantly.
2020-08-21 11:48:29 +00:00
◱ PixelyIon
102f26d08e Refactor C++ Input
This commit refactors the C++ end of Input so it'll be in line with the rest of the codebase and be ready for the extension with multiple players and controller configuration.
2020-08-21 11:48:29 +00:00
◱ PixelyIon
5fec7eefd0 Refactor HID Shared Memory
This commit refactors and reorders a lot of the HID Shared Memory from the previous commits to be in line with the rest of the codebase.
2020-08-21 11:48:29 +00:00
Billy Laws
b167abcdb7 Initial Kotlin Input Implementation
This commit contains the Kotlin side of the initial Input implementation, this is based on the work done in the `hid` branch in `bylaws/skyline`.
Co-authored-by: ◱ PixelyIon <pixelyion@protonmail.com>
2020-08-21 11:48:29 +00:00
Billy Laws
0219eda2db Initial C++ Input Implementation
This commit contains the C++ side of the initial Input implementation, this is based on the work done in the `hid` branch in `bylaws/skyline`.
Co-authored-by: ◱ PixelyIon <pixelyion@protonmail.com>
2020-08-21 11:48:29 +00:00
Billy Laws
817d37600e Convert all make all hex uppercase according to codestyle 2020-08-15 10:21:41 +00:00
Billy Laws
e5264f7762 Address review comments 2020-08-15 10:21:41 +00:00
Billy Laws
ae131502c6 Fix reservation in GPU VMM
Rather than reserving a region so it *can* be used by MapAllocate
reserved actually prevents a region from being used by MapAllocate.
2020-08-15 10:21:41 +00:00
Billy Laws
ade8a711fb Format code and misc cleanup 2020-08-15 10:21:41 +00:00
Billy Laws
fcae5d54da Switch NvHostCtrlGpu to use QueryEvent 2020-08-15 10:21:41 +00:00
Billy Laws
cf60869fac Stub INotificationService 2020-08-15 10:21:41 +00:00
Billy Laws
9d90cd877c Stub IFile:Flush 2020-08-15 10:21:41 +00:00
Billy Laws
c69efed2ad Implement GetAccumulatedSuspendedTickChangedEvent 2020-08-15 10:21:41 +00:00
Billy Laws
6c9e0a943c Add some IApplicationFunctions calls used by newer games 2020-08-15 10:21:41 +00:00
Billy Laws
9e39cbaf7b Implement GetBase in IProfile 2020-08-15 10:21:41 +00:00
Billy Laws
dc6da8303e Add support for listing users in account services 2020-08-15 10:21:41 +00:00
Billy Laws
cae270a174 Use nvhost fences in IHOSBinderDriver 2020-08-15 10:21:41 +00:00
Billy Laws
94d1b40faf Add an empty ISslContext service 2020-08-15 10:21:41 +00:00
Billy Laws
7503496bb0 Implement the basis of the Maxwell 3D engine together with a macro
interpreter.

The Maxwell 3D engine handles all 3D rendering, currently only non
rendering related methods are implemented. Macros are small pieces of
code that run on the GPU and allow methods to be quickly called for
things like instanced drawing.
2020-08-15 10:21:41 +00:00
Billy Laws
68d5a48df1 Implement syncpoints and nvhost events and fix an nvmap bug
These are used to allow the CPU to synchronise with the GPU as it
reaches specific points in its command stream.

Also fixes an nvmap bug where a struct was incorrect.
2020-08-15 10:21:41 +00:00
Billy Laws
ed3ff862f6 Extend GPU VMM with unmapping/remapping support + code cleanup 2020-08-15 10:21:41 +00:00
Billy Laws
cf468c20e2 Extend the GPFIFO implementation with support for engines and fix a few
bugs

An engine is effectively a HW block in the GPU, the main one is the
Maxwell 3D which is used for 3D graphics. Engines can be bound to
individual subchannels and then methods within them can be called
through pushbuffers.

The engine side of the GPFIO is also included, it currently does nothing
but will need to be extended in the future with semaphores.
2020-08-15 10:21:41 +00:00
Billy Laws
9fd0dd848b Add support for processing GP Entries and the pushbuffers they contain
This is the backbone of the GPU, in the future this will be expanded to
support calling into engines.
2020-08-15 10:21:41 +00:00
Billy Laws
be70f8715d Enable the use of C++20 2020-08-15 10:21:41 +00:00
Billy Laws
8dc9a10324 Implement the host side of host1x syncpoints
This will be extended in the future to support interfacing with the GPU.
2020-08-15 10:21:41 +00:00
Billy Laws
3c5cc33a34 Minor bug fixes in GPU VMM and add support for reading 2020-08-15 10:21:41 +00:00
Billy Laws
78712712c7 Fix a few bugs in CreateStrayLayer 2020-08-15 10:21:41 +00:00
Billy Laws
6edf89b538
Initial Savedata Implementation (#75)
* Rework VFS to support creating and writing files and introduce OsFileSystem
OsFileSystem abstracts a directory on the device using the filesystem API.
This also introduces GetEntryType and changes FileExists to use it.

* Implement the Horizon FileSystem APIs using our VFS framework
Horizon provides access to files through its IFileSystem class, we can
closely map this to our vfs::FileSystem class.

* Add support for creating application savedata
This implements basic savedata creation using the OsFileSystem API. The
data is stored in Skyline's private directory is stored in the same
format as yuzu.
2020-08-09 01:08:51 +05:30
Willi Ye
f72b81fcea
Make sure icons have a 1:1 ratio (#80)
* Make sure icons have a 1:1 ratio
* Use recyclerview padding to increase grid edge margins
* Fix race condition in searching roms
* Use notify insert for adapter
2020-08-08 23:31:21 +05:30
Willi Ye
392a1ac437 account: Remove unnecessary null termination 2020-07-21 18:29:45 +00:00
Willi Ye
1f282af87e More code style aligning
* Null terminate nickname array and correct character limit in settings perference
2020-07-21 18:29:45 +00:00
Willi Ye
93da9f2826 Align code style with project
* Return correct error code for invalid user
* Always return first icon color
2020-07-21 18:29:45 +00:00
Willi Ye
ffb9e743dd Add profile service to support custom usernames 2020-07-21 18:29:45 +00:00
Willi Ye
b86aac26d7 Align with code style and remove unnecessary code 2020-07-21 18:11:43 +00:00
Willi Ye
c3e54d1abf Redesign cards in grid view
* Refactor some classes and clean up
* Refresh style on the fly
2020-07-21 18:11:43 +00:00
Billy Laws
b23779bda1 Implement a block based GPU virtual memory manager
The GPU has it's own seperate address space to the CPU. It is able to
address 40 bit addresses and accesses the system memory. A sorted vector
has been used to store blocks as insertions are not very frequent.
2020-07-17 16:21:34 +00:00
Billy Laws
80e7b82bad Fix the LUT shift in the audio resampler
We do not need to shift back as we use a struct to hold the LUT entries.
2020-07-17 14:30:53 +00:00
Billy Laws
a3a2cb682e Truncate service names to 8 chars maximum 2020-07-17 14:30:53 +00:00
Billy Laws
8684e20a29 Treat GetAudioDeviceServiceWithRevisionInfo as GetAudioDeviceService 2020-07-17 14:30:53 +00:00
Billy Laws
3734599615 Extend the IAudioController implementation with volume stubs
This is used by ARMS.
2020-07-17 14:30:53 +00:00
Billy Laws
4cd7502df2 Implement post 4.0.0 language list features in ISettingsServer 2020-07-17 14:30:53 +00:00
Billy Laws
d1c1fa214c Stub (un)lockExit in ISelfController 2020-07-17 14:30:53 +00:00
Billy Laws
c2fadffe60 Extend time services with support for the steady clock
The steady clock has a fixed timepoint that can not change while an
application is running.
2020-07-17 14:30:53 +00:00
Billy Laws
e3313ae731 Use the device sample rate when creating an audio track in audren 2020-07-17 14:30:53 +00:00
Willi Ye
27d7839bcb MainActivity: Fix snackbar overlapping FABs 2020-07-14 09:15:57 +00:00
Willi Ye
c69e72a12e services: Add missing audio functions
* Those are needed to run playtone and audren from switch homebrew examples
2020-07-13 21:14:57 +01:00
Willi Ye
118b4d8a43 MainActivity: Fix shadows of FABs
* Don't cut them off
2020-07-09 20:19:55 +01:00
Billy Laws
6548d4914d Implement IAudioDevice for accessing audio output properties
This is used by Super Mario Odyssey in its init routine.
2020-07-09 18:42:36 +00:00
Billy Laws
f71b54b901 Stub SetRestartMessageEnabled in ISelfController
This is used by Super Mario Odyssey.
2020-07-09 18:42:36 +00:00
Billy Laws
2b4adee213 Stub gameplay recording and save data checking functions
Gameplay recording does not need to be emulated and EnsureSaveData isn't
necessary for proper save data support.
2020-07-09 18:42:36 +00:00
Billy Laws
2e60b5e60d Stub play reporting services 2020-07-09 18:42:36 +00:00
Billy Laws
378e494d82 Add an empty ssl service implementation
This stubs a single function that is needed for SMO's init.
2020-07-09 18:42:36 +00:00
Billy Laws
a2c6a2a4ff Add a base socket (bsd) services implementation
This stubs enough to pass SMO's socket init.
2020-07-09 18:42:36 +00:00
Billy Laws
2aefb4ae84 Implement network interface services
nifm:u is used by applications to enable a connection to the network.
2020-07-09 18:42:36 +00:00
Billy Laws
7102fa910e Implement nfp services 2020-07-09 18:42:36 +00:00
Billy Laws
4cf7f9288e Add an empty friend service implementation
This is used to access a users friends. It is used by Super Mario
Odyssey.
2020-07-09 18:42:36 +00:00
Billy Laws
ff5dddbd5b Extend account services to support BAAS and some user operations
These are needed by Super Mario Odyssey and several other games.
2020-07-09 18:42:36 +00:00
Billy Laws
80270637c1 Fix the spacing on lm log messages 2020-07-09 18:42:36 +00:00
Billy Laws
dae799dbb5 Implement svcClearEvent
This removes a signal from a KEvent. It is used by Mario Odyssey.
2020-07-09 18:42:36 +00:00
Billy Laws
92e3f84242 Stub SetGraphicsFirmwareMemoryMarginEnabled
This is used by most retail games released after 3.0.
2020-07-09 18:42:36 +00:00
Billy Laws
ef9760570b Extend parental control services 2020-07-09 18:42:36 +00:00
◱ PixelyIon
180ba97440 Print the sleep duration before actually sleeping 2020-07-09 14:08:58 +00:00
Billy Laws
c708c353e3 Fix block insertion
The subtraction was the wrong way round causing an underflow.
2020-07-09 14:08:58 +00:00
Billy Laws
1383e17341 Mark CodeStatic regions that are writable as CodeMutable instead
This is required for applications that attempt to map from the bss.
2020-07-09 14:08:58 +00:00
Billy Laws
2f8a217204 Use the heap size rather than the heap address when calculating the
total memory usage

Without this fix allocations are broken in Puyo Puyo Tetris.
2020-07-09 14:08:58 +00:00
Billy Laws
f1a28f7a1c Fix the behaviour of svcQueryMemory and allow getting the extents of
unmapped regions

svcQueryMemory will return a valid descriptor for anything in the
address space, from 0 to 1 << addrSpaceBits, this was handled
incorrectly before and we were only returning descriptors if the
address was in a mapped region.

If an address in an unmapped region is requested then the extents of the
unmapped region up to the address space end are returned. If the address
requested is outside of the address space then the extents of the
inaccessible address space are returned.

To facilitate this support was added to MemoryManager::Get for
generating the extents of unmapped regions using the chunk list.
2020-07-09 14:08:58 +00:00
Billy Laws
670a80d2c4 Create a memory chunk for the stack shared memory
As the stack is automatically mapped in the guest by `clone` we do not
need to explicitly map it. This adds a flag to solve the issue.

Also mark the stack as stack rather than reserved.
2020-07-09 14:08:58 +00:00
Billy Laws
7884a60679 Make regions public members of the memory class and drop the type enum
There isn't really much benefit in having a getter or an enum, so drop
it.
2020-07-09 14:08:58 +00:00
Billy Laws
eadc016525 Lock the audio buffer lock when reading released buffers
This is required to prevent races in Puyo Puyo Tetris and potentially
other games.
2020-07-09 14:08:58 +00:00
Billy Laws
6329537a9e Correct audren event handling and zero the sample buffer
Not zeroing the sample buffer causes issues when a voice is started but
is playing no samples. The system event handling was also reworked
according to Thog's info.
2020-07-09 14:08:58 +00:00
Billy Laws
24d086cbec Correctly check the usage bits in DequeueBuffer and fix it's result
The extra parameters in result are required for retail games to accept
it as valid.
2020-07-09 14:08:58 +00:00
Billy Laws
a96b8eb7a3 Add vi:u and vi:s to service list and fix the result parcel type of OpenLayer
vi:u is used by user applications and games and it has the same api as
vi:m.
2020-07-09 14:08:58 +00:00
◱ PixelyIon
9ef25a6beb IPC bug fixes
This fixes two bugs in IPC that were discovered when running Puyo Puyo
Tetris.

The CloneCurrentObject control IPC will now correctly return the handle
of the newly created object through move handles, rather than pushing it
as a result.

The size array of u16s with the sizes of each C buffer is now taken into
account when reading them. Before this change C buffers were entirely
broken.
2020-07-09 14:08:58 +00:00
Billy Laws
6e074d596c Extend applet manager services for the library applet
This commit adds stubs for the library applet and adds support for
writing to an AM IStorage.
2020-07-09 13:57:28 +00:00
Billy Laws
30936ce6dc Implement an ADPCM decoder for audren
This is used by many retail games, it only supports mono sound.

This implementation is based on Ryu's.
2020-07-09 13:56:04 +00:00
Billy Laws
b1e15efbab Use new android R APIs for hiding insets 2020-07-08 20:11:55 +00:00
Billy Laws
1e484a7766 Update gradle, SDK and build tools to Android R 2020-07-08 20:11:55 +00:00
Billy Laws
7fed6ca73d Enable -Wall for compilation
This gives some useful warnings for less significant issues.
Warnings for reordering are left disabled as they are rather pedantic
and serve little benefit.
2020-07-08 20:11:55 +00:00
Billy Laws
012be0adae Fix some warnings produced by enabling -Wall 2020-07-08 20:11:55 +00:00
Billy Laws
af709efb15 Kotlin updates for compatibility with the Android R SDK preview 2020-07-08 20:11:55 +00:00
Billy Laws
68fcb2e4e5 Extend account services and add support for PopLaunchParameters
This is needed for Puyo Puyo Tetris.
2020-07-07 16:21:13 +00:00
Billy Laws
ff1c0e254f Add an empty account services implementation
This implements the base account service and stubs
InitializeApplicationInfoV0 which is used by Puyo Puyo Tetris. Support
for the entirety of account services will be added in the future.
2020-07-06 21:04:31 +01:00
Billy Laws
3a343d3a48 Implement log services (lm)
lm is used by applications to print messages to the system log. Log
messages are made up of a header and then several fields containing
metadata or string messages.
2020-07-06 19:59:26 +00:00
Billy Laws
8985fe705f Implement IStorage services in Applet Manager
In the case of am, IStorage is used to exchange buffers of data such
as application launch parameters or an applets result. It has no
relation to fsp-srv's IStorage.
2020-07-06 19:57:00 +00:00
Billy Laws
162df93870 Add an empty pctl implementation
This is required by Puyo Puyo Tetris. It may be stubbed further if
needed in the future.
2020-07-06 20:46:38 +01:00
Billy Laws
23d6b596b2 Add an empty aoc:u implementation
This is required by Puyo Puyo Tetris, it will be extended in the future
to allow using real DLC with the emulator.
2020-07-06 19:43:17 +00:00
Billy Laws
4a88adafb6 Implement the set service together with GetAvailableLanguageCodes
The 'set' service is used to obtain user settings such as language.
This is used by Puyo Puyo Tetris.
2020-07-06 19:17:20 +00:00
Billy Laws
801382e43a Implement pl:u for accessing shared fonts
Fonts are stored in an array of TTF data with an 8 byte header
containing a magic and an XOR'd length. Instead of requiring users to
provide original Nintendo fonts we pack open source replacements.
They are generated with the scripts here
https://github.com/FearlessTobi/yuzu_system_archives. All the fonts are
licenced under the Open Font or Apache 2 License so we can include them
all freely.
2020-07-06 19:17:02 +00:00
Billy Laws
4df50cefee Fix lz4 submodule 2020-07-01 06:24:41 +00:00
Billy Laws
45b4811c5b Create adaptive icons for pinned games 2020-07-01 06:24:41 +00:00
Billy Laws
f2c5b96b04 Revert "Use X9 rather than LR when jumping to the guest"
This caused issues loading retail games and will be soon obsoleted by
pre-patching.
This reverts commit f381883c0b.
2020-07-01 06:24:41 +00:00
Billy Laws
a53d6266c7 Implement a basic NSP loader
An NSP (Nintendo Submission Package) is effectively a PFS0 containing
NCAs, there are also tickets and a CNMT file which contains metadata
about updates. The current implementation is very basic and only
support Control and Program NCAs which is enough for loading games.

Support for updates and dlc will be added at a later date.
2020-07-01 06:24:41 +00:00
Billy Laws
a5513bd7e6 Implement an NCA parser and loader
Nintendo Content Archives are used to store the assets, executables
and updates of applications. They support holding either a PFS0 or a
RomFS.

An NCA's ExeFS can be loaded by placing each NSO sequentially into
memory, starting with rtld which will link them together.

Currently only decrypted NCAs are supported, encryption and BKTR
handling will be added at a later time.
2020-07-01 06:24:41 +00:00
Billy Laws
db64f53cfb Implement filesystem backends for RomFS and Partition FS
RomFS is a hierarchial filesystem where each level is made up of a
linked list of files and child directories. It is used in NCAs to store
the applications icon as well as by applications themselves for
accessing assets.

Partition FS encapsulates both the HFS0 found in XCIs and the PFS0 used
for ExeFS images and NSPs, it is purely file based and has no support at
all for directories aside from the root.
2020-07-01 06:24:41 +00:00
Billy Laws
2071796696 Implement basic filesystem support in VFS
This mirrors Horizon's IFileSystem, it will be used by the nsp and nca
loaders to read their content.
https://switchbrew.org/wiki/Filesystem_services#IFileSystem
2020-07-01 06:24:41 +00:00
Billy Laws
e2bd50a1fd Implement a simple directory system in VFS
This mirrors Horizon's IDirectory:
https://switchbrew.org/wiki/Filesystem_services#IDirectory
2020-07-01 06:24:41 +00:00
Billy Laws
7114ad1734 Use the first available language entry in NACPs rather than hardcoding
American English

Without this, if an NACP didn't contain a title for a US english it
would show in the UI as blank.
2020-07-01 06:24:41 +00:00