Commit Graph

220 Commits

Author SHA1 Message Date
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
da0100042b Correct 'libNX' to 'libnx' in readme as per their branding 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
Billy Laws
26025d9adf Implement backing modes
These are used to determine the capabilities of a backing.
2020-07-01 06:24:41 +00:00
Billy Laws
b94248cec0 Move the loader backing out of the main loader class
The presence of a backing is an implementation detail.
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
◱ PixelyIon
e7f880e782 Clear floating point registers on guest entry
Mesosphere does this too:
fa4a96d021/libraries/libmesosphere/source/arch/arm64/kern_k_thread_context.cpp (L135)
2020-06-28 03:49:10 +00:00
Billy Laws
f381883c0b Use X9 rather than LR when jumping to the guest
The homebrew ABI expects LR to be zero otherwise on exit it will jump to
it upon exit rather than exiting. Use X9 instead to fix this.
2020-06-28 03:49:10 +00:00
Billy Laws
b823f1cd0d Correct the handle argument in svcGetThreadPriority
The thread handle is sent in w1 rather than w0.
2020-06-28 03:49:10 +00:00
Billy Laws
138e219e0c Emulate TPIDR_EL0 accesses using TLS 2020-06-28 03:49:10 +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
8d470d3218 Introduce basic RomFS support
This commit adds support for reading the RomFS data from an NRO and
obtaining an IStorage handle to it through 'OpenDataStorageByCurrentProcess'.
There is currently only support for reading and no support
for enlarging or writing.

Also fixup a few capitalisation issues.
2020-06-22 16:45:32 +00:00
Billy Laws
b9b889fc3c Add loader to the emulator state
This will allow accessing data from the loader within other parts of the
emulator, such as in fssrv for RomFS.
2020-06-22 16:45:32 +00:00
Billy Laws
57b5630422 Note that comments on virtual functions are optional in the contributing
guidelines
2020-06-20 20:26:53 +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
dca06f2b49 Rework loader abstractions and the NRO loader to use the vfs APIs
This will make it easier for us to implement more executable formats in
the future.
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
4d787c904e Improvements to UI/UX
This commit makes a few improvements to the UI/UX:
* Crop Game Icons to ImageView
* Controller Support for Game List
* EmulationActivity is fullscreen now
2020-04-24 17:09:13 +05:30
Ivar
f909c00e31 Improve README
This commit improves the README by changing the license and adding in more extensive credit + changing up other parts of it.
2020-04-24 02:33:36 +05:30
◱ PixelyIon
925d05d049 Add String Support to IPC Push/Pop
This commit does some minor renaming/reordering in IPC and adds support for strings to IPC Push/Pop. It also fixes a tiny regression with the frametime display.
2020-04-23 22:26:27 +05:30
◱ 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
05f3e3c3ac Improve NCE and Finish Up Refactor
This commit mainly finishes up refactor by fixing everything brought up in the CR + Improving NCE somewhat and actually killing the child processes properly now.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
c76ef3730b Move to MPL-2.0
We earlier moved to LGPLv3.0 or Later. This was a mistake as what we wanted was being able to link to proprietary libraries but LGPL is the opposite and it allows linking proprietary libraries to libskyline instead. After further consideration, we've moved to MPL-2.0, it allows linking to proprietary libraries and is a standardized license as compared to adding an exception to GPL.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
1c54bff215 Make AppDialog Expand Fully and Fix Race in MainActivity::addEntries
This commit mainly fixes the issue with `AppDialog` where it didn't expand fully in landscape leading to UX issues. In addition, a race condition was fixed in `MainActivity::addEntries`, in regards to `foundCurrent` being returned incorrectly. The text in the performance counters were also made yellow and much more opaque.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
a0b9a635ca Fix Killing Guest Processes in KThread::Kill and fix TID/PID naming
This commit mainly fixes the problem with process leakage before where the guest process wouldn't be killed. In addition, it clears up the problem with naming differences with PID/TID where purely PID was used before but that term is generally used to refer to the PGID. So, `KProcess` has a `pid` member but `KThread` has a `tid` member.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
4637b4ac97 Run Android Studio Formatter on the Project
This commit fixes a lot of style errors throughout the project by letting the Android Studio Formatter fix them. This commit also splits the Circular Buffer into it's own file.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
7f78a679c3 Add Performance Statistics to EmulationActivity
This commit adds performance statistics to the emulator that can be toggled in preferences. The layout of `EmulationActivity` was also changed from `ConstraintLayout` to `RelativeLayout` due to poor performance of the former.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
fb1a158e8f Optimize Audio by using Circular Buffers, Handle Device Disconnection and Fix Some Bugs
This optimizes a lot of audio by using a circular buffer rather than queues. In addition to handling device disconnection using oboe callbacks and fix bugs in regards to audio saturation.
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
af98455ede Add Mutexes to Logger, Introduce util::MakeMagic and Refactor IPC
This commit adds mutexes to the logger so they produce a valid log file rather than breaking due to a race condition. It also introduced `util::MakeMagic` so the magic functions are far more clear. A small refactor of IPC was also done which cleared up some of the for loops.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
91644255da Add Preference For Always Showing Game Information
This commit mainly adds a preference for always showing the game information. In addition to a tiny tweak to the contributing guidelines.
2020-04-23 22:26:27 +05:30
◱ PixelyIon
11e24620b8 Fix GitHub Actions build running out of disk space
This commit fixes the GitHub Actions build running out of disk space by removing the existing NDK image as we already install that manually.
2020-04-23 22:26:27 +05:30