Commit Graph

117 Commits

Author SHA1 Message Date
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
ef9760570b Extend parental control services 2020-07-09 18:42:36 +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
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
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
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
3a23ec06a4 Implement NSO loader
The NSO format is used by all retail games and some homebrew. It
supports compressing sections with lz4 and dynamic linking through the
use of rtld.
2020-06-28 07:54:12 +00:00
Billy Laws
bf46293fc7 Commonise executable loading infrastructure
Mapping and writing segments into memory is now handled by a common
function that can be shared between all loaders. All they need to do now
is to pack each segment into a common struct.
2020-06-28 07:54:12 +00:00
Billy Laws
c423a66020
Fixes for control IPC (#57)
* Correctly handle -WithContext IPC Requests

They should be treated the same as the non WithContext variants.

* Only send domain data on non-control IPC responses

Control IPC doesn't make use of domains so we shouldn't send extra data
in the response.

* Add the IStorage implementation to CMakeLists
2020-06-23 18:49:06 +00:00
Billy Laws
1bb979a7e1 Introduce new loader JNI for parsing application data and port Kotlin
code to use it

This will help ease the process of implementing new formats in the
future and remove duplicated code.
2020-06-20 20:26:53 +00:00
Billy Laws
4950dd5638 Introduce NACP class for reading control data
This contains info such as the application name and publisher.
2020-06-20 20:26:53 +00:00
Billy Laws
5c103ce9a6 Introduce basic VFS backing system together with two implementations
- The backing system provides a flexible way to access a a region of
   abstract memory.

- It is currently barebones and only has support for reading data but
   this will be expanded as necessary.

The current implementations are:
- OsBacking - A backing that abstracts a linux file descriptor
- RegionBacking - A backing that creates a region from a portion of an
   existing one
2020-06-20 20:26:53 +00:00
◱ PixelyIon
63154d05d1 Move vkhpp to it's own repository
This commit moves vkhpp (https://github.com/skyline-emu/vkhpp) to it's own repository and include it as a submodule instead
2020-04-23 22:26:27 +05:30
◱ PixelyIon
4e4ed5aac0 Refactor Audio
This commit refactors a lot of audio by fixing a lot of nitpicks here and there.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
820bbaede5 Fix occurrence of multiple headers in game list + Make TinyXML2 Static
This commit mainly fixes multiple headers in the game list, which was caused by using the wrong variable for the recursive function. In addition, it makes TinyXML2 statically linked to libskyline which makes it the lone shared objects present in APKs.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
d75d30b809 Minor Audio Refactor (and fix sm:IUserManager service name)
This makes some tiny changes to audio to make them compliant with the guidelines. In addition, to changing `IUserManager:IUserManager` to `sm:IUserManager`.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
618353c1fa Move to linking libraries statically
We used to link libraries dynamically before, this has obvious disadvantages and extra run-time overhead. Linking them statically instead has a lot of benefits as memory allocations and such don't need to be done independently, interaction with external libraries should be faster in general due to functions not being needed to be called virtually.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
42d982c6fb Refactor Display Services and GPU
This commit addresses the incorrect hierarchy of the GPU and refactors them at the same time. Now, the hierarchy much closely matches HOS. This commit also introduces a texture classes, albeit they're not complete and only partially implemented.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
500b49d329 Add Vulkan-Hpp to libraries
This commit adds Vulkan-Hpp as a library to the project. The headers are from a modified version of `VulkanHppGenerator`. They are broken into multiple files to avoid exceeding the Intellisense file size limit of Android Studio.
2020-04-23 22:26:27 +05:30
Billy Laws
4af37c4367 Refactor am services
Use the new service naming scheme.
Remove redundant casts and template specifiers in response.Push.
2020-04-23 22:26:27 +05:30
Billy Laws
616222a6db Refactor apm services
Use the new service naming scheme.
Switch to std::array for performanceConfig.
2020-04-23 22:26:27 +05:30
Billy Laws
52d47120a8 Refactor audio backend and services
Use the new service naming convention.
Move both audout and audren into one directory.
Close the audio stream upon emulator exit.
2020-04-23 22:26:27 +05:30
Billy Laws
2e0ac9bdd5 Refactor fatal services
Use the new service naming convention.
2020-04-23 22:26:27 +05:30
Billy Laws
644cfbe332 Refactor filesystem services
Use the new service naming convention.
2020-04-23 22:26:27 +05:30
Billy Laws
524cd26649 Refactor HID services
Use the new service naming convention.
Tidy up some unused includes.
Move constants to service namespace.
2020-04-23 22:26:27 +05:30
Billy Laws
f4620dd992 Refactor settings services
Use the new service naming convention.
2020-04-23 22:26:27 +05:30
Billy Laws
c8846ca07b Refactor service manager services
Use the new service naming convention.
Fix some small code style issues with {} on if statements
2020-04-23 22:26:27 +05:30
Billy Laws
ab33f692c6 Refactor time services
Use the new service naming convention.
Split out each sub-service into it's own file.
Fix some incorrect comments.
2020-04-23 22:26:27 +05:30
Billy Laws
bbe61e37f2 Add support for audio renderer services
Audren is used by many games and homebrews to make use of more advanced
audio features than audout.
2020-02-16 12:53:50 +00:00
Billy Laws
ddd1fc61ef audio: Add support for resampling tracks
Uses the resampling algorithm derived from HOS by the Ryujinx team
to resample the stream on the fly to 48KHz.
It is currently used only in audout.
2020-02-16 12:53:50 +00:00
Billy Laws
93206d5a3c Add support for audio playback via audout
Adds an audio manager to state to manage the creation of audio tracks and an audout service implementation that interfaces with it.
2020-02-16 12:53:50 +00:00
◱ PixelyIon
00cdc1fd6f Refactor the memory implementation and add Regions
This commit does a major refactor of the memory implementation, it forms a memory map which is far cleaner than trying to access it through a handle table lookup. In addition, it creates a common interface for all memory kernel objects: KMemory from which all other kernel memory objects inherit. This allows doing resizing, permission change, etc without casting to the base memory type.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
65018aedbc Complete making the kernel thread-safe #2 + Fix Shared Memory Implementation
This commit makes the kernel completely thread-safe and fixes an issue that caused libNX games to not work due to an error with KSharedMemory. In addition, implement GroupMutex to allow the kernel threads to run in parallel but still allow them to not overlap with the JNI thread.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
970dde8c27 Move from ptrace to junction branching and make kernel multithreaded
This commit is a huge step in the direction of better performance, as we move from ptrace to junction branching and have kernel call overhead similar to that of a native kernel call! In addition, this sets the base for the kernel to go fully multi-threaded. However, the kernel is currently not thread-safe and therefore this commit currently causes a crash.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
3e9bfaec0e Introduce Basic Junction Patching
This commit introduces basic junction patching or patching code to jump to a junction then execute intermediate functions and jump back.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
c5dce22a8c Fix JNI Race Condition, Fix Release Builds and Fix Searching
This commit fixes JNI race conditions by usage of a mutex, fixes a bug in release builds due to ProGuard member obfuscation and fix searching by fixing the HeaderAdapter filter.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
c005d7df74 Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-15 19:30:04 +00:00
◱ PixelyIon
19eae34315 libNX FS Initalization (v0.3)
What was added:
* libNX FS initalization
What was fixed:
* Release builds
2019-10-18 16:22:38 +05:30
◱ PixelyIon
e44809355c libNX Time Initalization
What was added:
* Time service
* CNTPCT_EL0 redirected to CNTVCT_EL0
2019-10-17 01:53:35 +05:30
◱ PixelyIon
ec71735ece Fixes and Additions for HID support
The following things were fixed:
* KSharedMemory
* KSyncObject (and how waiting on them works)
* Inclusion of Headers
What was added:
* Transfer Memory
* svcSleepThread
2019-10-13 13:34:47 +05:30
◱ PixelyIon
f7effe86ae libNX Applet Manager Initalization
This commit completes the 'am' initialization for libNX
2019-09-27 21:39:56 +05:30
◱ PixelyIon
7ad2e11705 Milestone 3 - Services API
This commit adds the Services API and implements some services. It also changes the name of the application to Skyline and replaces the icon.
2019-09-25 02:28:25 +05:30
◱ PixelyIon
a54f5ff578 Milestone 2 - Memory & IPC Marshalling
This commit introduces a new memory model that supports true shared memory with separate permissions for remote and local processes, implements svcQueryMemory and completes svcGetInfo further, adds IPC support with the IpcRequest and IpcResponse classes.
2019-09-25 02:28:25 +05:30
◱ PixelyIon
9e1e06c64b Milestone 1 - Processes & Threads
Reworks the API a fair bit and adds documentation to almost everything.
2019-09-25 02:28:25 +05:30
◱ PixelyIon
da55a1d9ba Rearrange OS folder 2019-08-21 17:07:43 +05:30
◱ PixelyIon
92c1491a84 Native Code Execution (NCE)
It's finally here, we're executing code completely natively. This is something that would completely break the project if it wasn't possible.
2019-08-17 04:34:37 +05:30
◱ PixelyIon
696ebde527 Rewrite C++ parts and UI update
This update took way way too long to create. However, it was worthwhile. :)
2019-07-25 01:49:43 +05:30
Ryan Teal
4cd7c985f0
IPC Episode 1 - Prologue 2019-07-09 22:35:51 +01:00
Ryan Teal
1e057cb5f9
Add hos/kernel/kernel.cpp to CMake 2019-07-05 13:48:18 +01:00
Ryan Teal
ffbcf0fb33
Add as include directory 2019-07-02 21:00:57 +01:00
Ryan Teal
2f24f28084
An actual memory implementation 2019-06-30 15:39:56 +01:00
Ryan Teal
1142e397c6
Implement NRO loader 2019-06-30 14:26:57 +01:00
◱ PixelyIon
8839bfaaf4 push communist agenda 2019-06-29 22:09:23 +05:30
Starlet Leonhart
faad5a7c72 push some bullcrap 2019-06-29 12:13:36 -04:00
Starlet Leonhart
48338f9459 another minor change 2019-06-29 09:56:13 -04:00
Starlet Leonhart
b4c04b016a minor cmakelists change to improve the overall user experience 2019-06-29 09:53:37 -04:00
◱ PixelyIon
875fe194f6 Structure Code and Link libunicorn 2019-06-29 19:05:24 +05:30
Starlet Leonhart
2e5d107f5d add files, cannot figure out why native lib is broken 2019-06-28 20:35:14 -04:00