Commit Graph

89 Commits

Author SHA1 Message Date
PixelyIon
8cba1edf6d Introduce Boost as a submodule + Minor Fixes
Utilize Boost Container's `small_vector` for optimizing allocations, fix certain implicit casting issues and make `ILogger` not output an additional newline in the log when the application supplies one at the end of the log
2021-10-05 01:13:22 +05:30
Billy Laws
a18f1aa889 Address feedback 2021-09-30 02:11:19 +05:30
Billy Laws
75a67dcfa5 Allow supplying a custom ResultValue result type and optimise span
This allows PosixResultValue to be created easily.
2021-09-30 02:11:19 +05:30
sspacelynx
14dc42b991 Add IntegerFor template class + Update GenerateUuidV4 2021-09-22 06:24:05 +05:30
sspacelynx
10d43c88c9 csrng service implementation
Implements the 'csrng:' service using C++ <random>'s Mersenne Twister, this does make it insecure for cryptographic purposes but it is pointless to attempt to do this regardless as we cannot ensure that the guest will run in a secure environment which cannot be mutated by an attacker. Used by Prison Princess, Pokemon Cafe Mix, Paint your Pet and more.
2021-09-22 06:24:05 +05:30
sspacelynx
06674b3d07 hwopus decoder service implementation 2021-07-19 02:07:12 +05:30
PixelyIon
ce804254ab Support Swap Interval + Cropping + Transforms and more for QueueBuffer
Support for the following parameters was added to `QueueBuffer`:
* Earliest Present Timestamp
* Swap Interval
* Crop
* Scaling Mode
* Transform
* Frame ID (Not returned to guest yet)
We utilize ANativeWindow APIs directly to achieve all of this in an efficient manner since HWC will be used directly for it, we do plan to introduce Vulkan equivalents for all of these operations later down the line for a port to non-Android platforms.
2021-07-12 21:27:49 +05:30
PixelyIon
6854e07356 Replace LogActivity with "Share Logs" + Add Timestamp to Logger 2021-07-12 21:27:49 +05:30
PixelyIon
36547cd5dc Redesign Texture Class + Improve Presentation Engine
This commit reworks the `Texture` class to include a Vulkan Image backing that can be optionally owning or non-owning and swapped in with consideration for Vulkan image layout, it also adds CPU-sided synchronization for the texture objects with FenceCycle. It also makes the appropriate changes to `PresentationEngine` and `GraphicBufferProducer` to work with the new `Texture` class while setting the groundwork for supporting swapchain recreation. It also fixes a log in `IpcResponse` and improves the display mode selection algorithm by further weighing refresh rate.
2021-07-12 21:27:49 +05:30
PixelyIon
d8025e7178 Rework GraphicBufferProducer
This commit makes GraphicBufferProducer significantly more accurate by matching the behavior of AOSP alongside mirroring the tweaks made by Nintendo. 

It eliminates a lot of the magic structures and enumerations used prior and replaces them with the correct values from AOSP or HOS. 

There was a lot of functional inaccuracy as well which was fixed, we emulate the exact subset of HOS behavior that we need to. A lot of the intermediate layers such as GraphicBufferConsumer or Gralloc/Sync are not emulated as they're pointless abstractions here.
2021-07-12 21:27:49 +05:30
PixelyIon
3f7373209a Move Guest GPU into SoC Directory
We decided to restructure Skyline to draw a layer of separation between guest and host GPU. We're reserving the `gpu` namespace and directory for purely host GPU and creating a new `soc` directory and namespace for emulation of parts of the X1 SoC which is currently limited to guest GPU but will be expanded to contain components like the audio DSP down the line.
2021-03-25 22:57:26 +05:30
PixelyIon
0ea6d9bee5 Address CR Comments (#150)
Correct a single grammatical error
2021-03-23 02:40:02 +05:30
PixelyIon
ae68009f9b Extend Perfetto Tracing
Add Tracing for SVCs, Services, NVDRV, and Synchronization Primitives. In addition, fix `TRACE_EVENT_END("guest")` being emitted when a signal is received while being in the guest rather than host which would cause an exception. This commit also disables warnings for the Perfetto library as we do not control fixing them.
2021-03-23 02:40:02 +05:30
PixelyIon
2b4a094cd8 Logger Function Prefix Support 2021-03-23 02:40:02 +05:30
Billy Laws
d8d4b4c9e0 Address review feedback 2021-03-21 18:56:31 +05:30
Billy Laws
34cb0b49e8 Implement the entirety of time services
This reimplements our time backend to be significantly more accurate to
the real PSC and provides complete implementations for every time IPC
allowing many newer games to work properly.

Time is unique in its use of glue services, the core sysmodule is fully
isolated and doesn't interface with any other services. Glue is instead
used where that is needed (e.g. for fetching settings), this distinction
is also present in our implementation.

Another unique feature of time is its global state, as time is
calibrated from the start of the service its state cannot be lost as
that would result in the application offsetting time incorrectly
whenever it closed a session.

A large proportion of this is based off of Thog's 9.0.0 PSC reversing.
2021-03-21 18:56:31 +05:30
Billy Laws
937e3d6f68 Add endiannes swapping helper functions
Avoid using compiler functions manually to create a cleaner interface,
and allow swapping the endianness of arbritary lengths.
2021-03-21 18:56:31 +05:30
Billy Laws
def9f96b02 Add a ResultValue helper class to simplify result handling
This is a very common usecase for result handling and allows much
cleaner code.
2021-03-21 18:56:31 +05:30
Billy Laws
48acb6d369 Address a bunch of issues detected by clang-tidy 2021-03-06 18:58:04 +05:30
PixelyIon
fe5061a8e0 Address CR Comments (#132) + Change Core Migration API
This addresses all CR comments including more codebase-wide changes arising from certain review comments like proper usage of its/it's and consistent contraction of it is into it's. 

An overhaul was made to the presentation and formatting of `KThread.h` and `LoadBalance` works has been superseded by `GetOptimalCoreForThread` which can be used alongside `InsertThread` or `MigrateToCore`. It makes the API far more atomic and neater. This was a major point of contention for the design prior, it's simplified some code and potentially improved performance.
2021-03-05 14:55:34 +05:30
◱ PixelyIon
a621408b9c Move to using ASCII separators for Logger
We've moved to using RS and GS from ASCII as delimiters rather than
'\n' and '|', this allows more robust parsing and increases the
readability of the log files
2021-03-05 14:55:34 +05:30
◱ PixelyIon
80302cf1ad Update NDK, Gradle and dependencies + Improve Settings API + Migrate to PugiXML 2021-03-05 14:55:34 +05:30
◱ PixelyIon
ebadc1d1e1 Generate Stack Traces + More Robust Terminate Handler + Exit Process on Signal in Guest 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
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
◱ 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
c65c91e1bc Implement NPDM, Core Mask SVCs + Fix VMM bug + Introduce Verbose Log Level 2020-11-22 23:56:17 +05:30
◱ PixelyIon
369bd469f6 Dynamic Guest Memory Base Allocation 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
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
◱ 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
4970e58999 Address CR Comments (#102) 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
20253a9573 Improve NvDevice Registration + Access 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