Commit Graph

330 Commits

Author SHA1 Message Date
◱ PixelyIon
33bbfb9fb7 Implement Conditional Variables 2021-03-05 14:55:34 +05:30
◱ PixelyIon
7079f11add Implement PI-Mutexes + Optimize InsertThread 2021-03-05 14:55:34 +05:30
◱ PixelyIon
7ba7cd2394 Support Priority & Affinity Mask Changes 2021-03-05 14:55:34 +05:30
◱ PixelyIon
f41bcd1e22 Implement Preemptive Scheduling 2021-03-05 14:55:34 +05:30
◱ PixelyIon
cf000f5750 Implement Cooperative Scheduling With Load Balancing 2021-03-05 14:55:34 +05:30
◱ PixelyIon
8564edcb16 Address CR Comments #2 2020-11-23 11:44:43 +05:30
◱ PixelyIon
fbf9f06244 Address CR Comments + Fix Clock Rescaling 2020-11-22 23:56:17 +05:30
◱ PixelyIon
a3dd759a1c Fix Circular Queue Destructor + Memory Infos + Improve Priority Documentation 2020-11-22 23:56:17 +05:30
Billy Laws
7167393e3c Only initialise maxEntry for active input devices
This caused the menus in Sonic Mania to be nonfunctional, futhermore,
default init is not ran for the input structs so the default max
definition in CommonHeader never actually applied.
2020-11-22 23:56:17 +05:30
◱ PixelyIon
bc5c094860 Fix CircularQueue + NPDM ACI0 & Kernel Capability Parsing 2020-11-22 23:56:17 +05:30
◱ PixelyIon
a5927c5c7b Fix Native-Initiated Exiting 2020-11-22 23:56:17 +05:30
◱ PixelyIon
d155e9cd71 Complete Exceptional Signal Handler Implementation + Fix More Destruction Behavior 2020-11-22 23:56:17 +05:30
Billy Laws
8bf08ed66f Fix CircularQueue and improve debug logging + exefs loading
CircularQueue was looping around too early resulting in the wrong
pushbuffers being used. The debug logging is useful for interpreting the
GPU method call logs.

Exefs loading was changed to check if an NSO exists before trying to
read it, preventing exceptions that get annoying while debugging.
2020-11-22 23:56:17 +05:30
Billy Laws
c161ef0cac Various accuracy improvements in services
* 'Fix' memory accounting to not measure reserved regions
* Fix some copy bugs introduced by switch to span
* Correct remap the behaviour of Modify so it actually works
2020-11-22 23:56:17 +05:30
Billy Laws
c7e5202042 Rework GPU VMM variable naming 2020-11-22 23:56:17 +05:30
Billy Laws
4c9d453008 Update formatter config for new AS and reformat 2020-11-22 23:56:17 +05:30
◱ PixelyIon
668f623256 Implement Exceptional Signal Handler + Fix Destruction Behavior
An exceptional signal handler allows us to convert an OS signal into a C++ exception, this allows us to alleviate a lot of crashes that would otherwise occur from signals being thrown during execution of games and be able to handle them gracefully.
2020-11-22 23:56:17 +05:30
◱ PixelyIon
3cde568c51 Run Guest on Main Emulator Thread + Remove Mutex/GroupMutex + Introduce PresentationEngine 2020-11-22 23:56:17 +05:30
◱ PixelyIon
779884edcf Introduce TID to Logger + Fix VMM Bug + Fix NSO Backtrace + Improve Logger 2020-11-22 23:56:17 +05:30
Billy Laws
39f0345ac7 Fix bugs introduced by refactoring
GPU VMM was mistakenly checking the alignment of the PA rather than the
VA and NvMap::Free was not accounting for the handle index starting from
one.
2020-11-22 23:56:17 +05:30
◱ PixelyIon
c65c91e1bc Implement NPDM, Core Mask SVCs + Fix VMM bug + Introduce Verbose Log Level 2020-11-22 23:56:17 +05:30
◱ PixelyIon
324381908b Implement SvcMap/UnmapPhysicalMemory + Fix W-Register Writing + Improve Accuracy of SvcGetInfo 2020-11-22 23:56:17 +05:30
◱ PixelyIon
657beea070 JVM Auto-Attach + Fix Thread Exiting + Fix Thread Signal Handler 2020-11-22 23:56:17 +05:30
◱ PixelyIon
6f2cd41470 Move .patch to start of executable (Pre-Patching) 2020-11-22 23:56:17 +05:30
◱ PixelyIon
369bd469f6 Dynamic Guest Memory Base Allocation 2020-11-22 23:56:17 +05:30
◱ PixelyIon
cffbfc8034 Skip Saving Callee-Saved Registers + Fix GetMemoryObject 2020-11-22 23:56:17 +05:30
Billy Laws
31efb5e930 Correct an NSO loader bug and use the correct address space extents 2020-11-22 23:56:17 +05:30
Billy Laws
17feb68eb5 Fix audren voice sample copying 2020-11-22 23:56:17 +05:30
◱ PixelyIon
745ea19f42 Use u64s for FmtCast + Remove Functional Casts + Fix VMM Bugs 2020-11-22 23:56:17 +05:30
◱ PixelyIon
1db76dee1e NCE3: In-Process Guest Execution 2020-11-22 23:56:17 +05:30
◱ PixelyIon
90127740f0 Rework NCE/KThread/KProcess + Remove Guest Process 2020-11-22 23:56:17 +05:30
◱ PixelyIon
878cb24389 Make fmt::ptr implicit for raw pointers + Update Submodules 2020-11-22 23:56:17 +05:30
◱ PixelyIon
02f3e37c4f Remove KProcess Memory Functions 2020-11-22 23:56:17 +05:30
◱ PixelyIon
60e82e6af0 Rework VMM + Adapt KMemory Objects to be in-process
Note: This commit isn't functional on it's own, it will require the rest of NCE3 to work
2020-11-22 23:56:17 +05:30
Billy Laws
85d5dd3619
Extend NvServices and implement IDirectory (#107)
* Fix alignment handling in NvHostAsGpu::AllocSpace

* Implement Ioctl{2,3} ioctls

These were added in HOS 3.0.0 in order to ease handling ioctl buffers.

* Introduce support for GPU address space remapping

* Fix nvdrv and am service bugs

Syncpoints are supposed to be allocated from ID 1, they were allocated
at 0 before. The ioctl functions were also missing from the service map

* Fix friend:u service name

* Stub NVGPU_IOCTL_CHANNEL_SET_TIMESLICE

* Stub IManagerForApplication::CheckAvailability

* Add OsFileSystem Directory support and add a size field to directory entries

The size field will be needed by the incoming HOS IDirectory support.

* Implement support for IDirectory

This is used by applications to list the contents of a directory.

* Address feedback
2020-11-03 15:10:42 +05:30
◱ PixelyIon
7ad86ec46f Improve span::as_string and other minor fixes 2020-10-02 15:28:48 +00:00
◱ PixelyIon
97ac45d83b Update Logger to use NDK Logger APIs + Improve Backing API + Fix FDSAN issues 2020-10-02 15:28:48 +00:00
◱ PixelyIon
4070686897 Refactor Comments + Other Minor Fixes 2020-10-02 15:28:48 +00:00
◱ PixelyIon
429af1990a Equal -> Brace Initializer + Remove Constexpr Auto for Integers 2020-10-02 15:28:48 +00:00
◱ PixelyIon
2764bd7c96 Use Vector for Kernel Handles + Remove Redundant Includes 2020-10-02 15:28:48 +00:00
◱ PixelyIon
20559c5dca Introduce Custom Span Class + IPC Buffer -> Span 2020-10-02 15:28:48 +00:00
◱ PixelyIon
4d6ae9aa26 Constexpr Maps for Service Functions 2020-10-02 15:28:48 +00:00
◱ PixelyIon
157c54f918 Implement a few HID Functions + Fix FAB handler 2020-10-02 15:28:48 +00:00
◱ PixelyIon
4970e58999 Address CR Comments (#102) 2020-09-20 20:07:33 +00:00
◱ PixelyIon
bb2c31264d Implement IOCTL2 & IOCTL3 2020-09-20 20:07:33 +00:00
◱ PixelyIon
a5fece8020 NVDRV IOCTL Refactor
Buffer -> Span + All buffers as arguments + Return -> NvStatus + Print Service Names + Function Names
2020-09-20 20:07:33 +00:00
◱ PixelyIon
70d67ef563 Constexpr Maps for NvDevice IOCTLs 2020-09-20 20:07:33 +00:00
◱ PixelyIon
20253a9573 Improve NvDevice Registration + Access 2020-09-20 20:07:33 +00:00
◱ PixelyIon
4cc3a3b2e8 Move NVDRV + IHOSBinder Internals to Discrete Components + Fix Lint 2020-09-20 20:07:33 +00:00
◱ PixelyIon
5f0073dd87 Fix Surface Deswizzling OOB writes + Fix PL README 2020-09-20 20:07:33 +00:00
Willi Ye
4076d84efc
NCA decryption (#99)
* NCA decryption
* Remove unnecessary new lines
* Remove loader error dialog
* Always show ROMs
* Address CRs
* Add subtitle padding in grid mode
2020-09-14 19:23:40 +05:30
◱ PixelyIon
65019375ca Implement Guest Touch-Screen Support 2020-09-08 12:55:33 +00:00
Billy Laws
89718804d0 Refactor service functions to return result codes 2020-09-06 19:12:18 +00:00
Billy Laws
74a150dff1 Rework service API to be cleaner with significantly less boilerplate
This patch reduces the burden of adding services significantly, rather
than having to create an enum entry and add strings in the constructor
it will all be determined at runtime through RTTI. A macro is also used
in the service creation case to reduce clutter.
2020-09-06 19:12:18 +00:00
◱ PixelyIon
21e2c826a1 Improve Accuracy of Vibration + Unify Translation + Add Comments 2020-09-06 15:31:20 +00:00
◱ PixelyIon
1a58a2e967 Implement Rumble Support for Controllers and Device Vibrators 2020-09-06 15:31:20 +00:00
Billy Laws
d8ccdd723e
Refactor Audio + Fix NV Bugs (#92)
* Fix NvHostCtrl:EventSignal event ID parsing
* Divide the audout buffer length by the sample size
* Correct audout channel quantity handling
* A few bugfixes for audio tracks
* * Correctly lock in CheckReleasedBuffers and only call the callback once
* * Check if the identifier queue is empty before accessing it's iterator
* Refactor audio to better fit the codestyle
* Explictly specify reference when using GetReference
* Fix CheckReleasedBuffers
2020-08-21 18:58:47 +05:30
◱ PixelyIon
7290a80c3e Move to Callback for Input Initialization + ConditionalVariable for Surface 2020-08-21 11:48:29 +00:00
◱ PixelyIon
07c2f2d891 Significantly Improve Accuracy of HID
This commit significantly increases the accuracy of the prior HID code due to testing on the Switch. It is now fully accurate in all supported scenarios, them being assignment mode, orientation, color writes and system properties. In addition, review comments were addressed and fixed in the PR.
2020-08-21 11:48:29 +00:00
◱ 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
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
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
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
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