Commit Graph

319 Commits

Author SHA1 Message Date
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
704a5bdcb1 Refactor base service implementation
Remove looping support - it is slow and no services use it.
Store service name in in base service class - removes the
need for having sub-services in the service name map.
General code clean up - remove {} from single if statements etc.
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
08bbc66b09 Fix CR issues and Game Duplication + Move to Vector for Memory Map
This commit fixed the issues outlined in the CR (Mainly correlated to formatting), moves to a sorted vector from a sorted list for the memory map in addition to using binary search for sorting through rather than iteratively and fixes item duplication in the game list when directory is changed in Settings.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
66d20a9429 Fix GroupMutex and Clock Rescaling
This commit mainly fixes GroupMutex and clock rescaling. In addition, clock rescaling is no longer performed if the CNTFRQ_EL0 of the host device is same as that of the Switch (19.2MHz) which is fairly common on higher end devices.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
003e9c5a01 Fix issues with not being able to run ROMs concurrently
This commit fixes GroupMutex and by extension issues with trying to run ROMs without quitting the application in between.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
694c8ef4e2 Addition of Conditional Variables
This commit adds working conditional variables, in addition to the mutex and threading implementation. It directly depends on the memory optimization from the previous commit to be able to perform atomic operations on the mutex.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
03b65bd90a Optimize Memory Implementation using Shared Memory
This commit further improves the memory implementation by using shared memory for all allocations so we won't have to depend on a kernel call for doing any host <-> guest memory transfers.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
d02267c34f Add support for threads and mutexes
This commit adds support for threading and mutexes. However, there is also a basis of conditional variables but these don't work due to the lack of a shared memory model between the guest and host. So, conditional variables will be deferred to after the shared memory model is in place.
2020-02-15 10:25:14 +00:00
Billy Laws
2aebf04b4b guest: Add memory barrier after saving context
Forces all registers to be saved before signalling to the kernel that we
are ready; without this the kernel may read incorrect context data
causing undefined behaviour.
2020-02-15 10:25:14 +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
b13002f0e1 Fix some minor inaccuracies in SVCs and Services
This commit fixes some minor inaccuracies in SVCs and some Service functions.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
36f05ee7e0 Fix svcSignalProcessWideKey and svcWaitSynchronization timeout overflow
This commit mainly just fixes svcSignalProcessWideKey and svcWaitSynchronization and their related issues.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
493a1a93ec Use .clang-tidy and remove madvise DO_FORK/DONT_FORK calls
This commit causes Android Studio to use the .clang-tidy file for configuration and removes madvise DO_FORK/DONT_FORK calls as they cause problems on many devices and are mostly unnecessary.
2020-02-15 10:25:14 +00:00
Billy Laws
81dba3da4b KProcess: Use process_{read, write}_vm to access guest memory
This is much quicker than pread/write however we now need to abide by the
regions permissions, so fallback to pread/write if read/write vm fails.
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
de6d8d8f48 Work on making the kernel thread-safe #1 + add asynchronous ROM scanning
This commit makes the kernel thread safe in some instances (but not fully) and showcases the significantly improved performance over the ptrace method used prior. In addition, scanning for ROMs is now done asynchronously.
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
b84859d352 Remove support for multiple guest processes
This commit removes support for more than one guest processes as it requires a fair bit of extra code to support in addition the HLE service implementations don't support it anyway.
2020-02-15 10:25:14 +00:00
◱ PixelyIon
48d47a2b25 Move from dependency on JNI and Implement AtomicMutex
This commit is the start of moving towards a lockless and faster kernel which can run multiple independent threads with fast userspace synchronization.
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
f7ad017726 Adapt GetDefaultDisplayResolution to Push/Pop System
The PR: https://github.com/skyline-emu/skyline/pull/13 added in GetDefaultDisplayResolution but it used the older WriteValue function to write the data back. Moving to the Push/Pop system fixes this.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
abaa404baa Support creating launcher shortcuts for ROMs
This commit adds the ability to create launcher shortcuts to specific ROMs for convenience.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
4a72704c4d Associate with NRO files
This commit adds the ability to open NRO files directly from a file browser rather than the emulator itself.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
8d1545aabf Addition of Dark Theme and Compatibility with Android 10 Dark Mode
This commit adds support for Android Night Mode and adds in a dark theme for the UI.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
4ab9af04ff Add ability to open a ROM directly and Make URI Persistent
Before ROMs needed to be opened by setting the path, now they can be directly opened using the file picker. In addition, Document Tree URIs are now set to be persistent rather than being revoked after reboot.
2019-12-11 17:31:12 +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
b3e811d488 Adapt C++ backend to changes
This commit adapts the C++ backend to the Kotlin frontend by moving to usage of file descriptors and, provides an interface to access frontend code via JNI which is used to check the state of the activity and catch events such as surface destruction. In addition, this commit fixes some minor linting errors and changes the CMake version to 3.10.2+.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
e4dc602f4d Migrate to SAF APIs for file access
This commit moves from conventional file access to using URIs and such provided by the SAF APIs.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
9db0c20c92 Move from Java to Kotlin
This commit converts all Java code to Kotlin and improves the structure and performance of most rewritten parts.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
38716989ae Improve IPC interface
This commit changes how IPC is interacted with in two ways:
* Simplify all buffers into just InputBuffer and OutputBuffer
* Use pushing/popping for data payload
2019-12-11 17:31:12 +00:00
◱ PixelyIon
745cb208a6 Optimize deswizzling implementation and support multiple formats
The deswizzling implementation currently writes linearly and reads non-linearly, this is non optimal as the MMU cannot read ahead. This flips that and reads linearly while it writes non-linearly. This is based on: 324a3624ac/nx/source/display/framebuffer.c (L189).
2019-12-11 17:31:12 +00:00
◱ PixelyIon
e11d7d9ce0 Fix threading implementation & Fix SVC logging
This commit fixes the threading implementation and fixes errors in SVC logging and improves them in general.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
1956a3bbbb Make SVCs more accurate & Improve KSharedMemory
This commit adds logging to almost all SVCs with the exception of svcGetSystemTick and adds accurate error handling to them. It also improves how KSharedMemory is handled.
2019-12-11 17:31:12 +00:00
◱ PixelyIon
26a67f70b7 Move services out of the kernel and fix service registration
In addition, this adds a constructor for "RegionInfo".
2019-12-11 17:31:12 +00:00
greggameplayer
42239ae58b Implement additional applet services and functions
This commit implements the services ISystemAppletProxy, IOverlayAppletProxy & IAppletCommonFunctions and implements the function GetDefaultDisplayResolution.
2019-11-17 22:29:58 +00:00
◱ PixelyIon
0d141b71e9 Min. API version to 26 (8.0) and use ASharedMemory
Move Minimum API version to Android 8.0 and switch from /dev/ashmem to ASharedMemory APIs.
2019-11-16 01:08:50 +05:30
◱ PixelyIon
423540328a Fix svcWaitSynchronization
svcWaitSynchronization would return the handle of the object instead of the index of it's handle earlier, this is now fixed.
2019-11-15 19:30:04 +00:00
◱ PixelyIon
b3517357e1 Fix: Crash on reading domain header from Control message
The application would crash if there was a control request from a domain message. As it would still try to read the domain header in the message.
2019-11-15 19:30:04 +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
bylaws
2e0014ba7c Fix External Storage Access on Android 10 (#10)
Android 10 and above block access to the legacy java file APIs on external storage without the 'android:requestLegacyExternalStorage' flag set. This is a temporary measure while we adopt newer APIs.
2019-11-09 13:39:40 +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
2476c5d48a libNX HID initialization
What was added:
* HID Service
* Support for Mutexes and Conditional Variables
What was improved:
* Service API now creates one instance per Session rather than a single instance for all Sessions
* Changed std::map objects into std::unordered_map in KProcess
* Comments on enumeration values
2019-10-16 18:11:30 +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
a5d63c9bbb Add reverse name lookup services for better debugging and fix bugs 2019-09-26 22:34:20 +05:30
Ryan Teal
45f4255ff6
Implement some appletOE calls 2019-09-26 16:37:24 +01:00
◱ PixelyIon
da74d8d78c Some minor fixes
This fixes some files so release now works and removes the dependancy of "<cutils/ashmem.h>" as it isn't present on all NDK includes.
2019-09-25 15:02:17 +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
62cb561888 Implement sharing of logs using Hastebin 2019-08-29 18:10:39 +05:30
◱ PixelyIon
da55a1d9ba Rearrange OS folder 2019-08-21 17:07:43 +05:30
Starlet Leonhart
7dd04afdcf Code clean up by friendly neighborhood Cyuubi 2019-08-21 02:22:45 +05:30
◱ PixelyIon
9657064740 Fix 32-bit register reading/writing
Co-Authored-By: Ryan Teal <rynteal@protonmail.com>
2019-08-19 03:37:47 +05:30
Ryan Teal
9a36d5fcf9
Remove unused include in kernel.cpp 2019-08-18 15:32:52 +01:00
Ryan Teal
d4e2079474
Fix casts in cpu.cpp 2019-08-18 14:08:02 +01:00
◱ PixelyIon
342fee841f Fix C++ entry and tiny cleanup 2019-08-18 18:31:32 +05:30
Ryan Teal
113bfd059e Halt execution after unimplemented SVC 2019-08-18 12:40:07 +01:00
◱ PixelyIon
3855daa849 Rename to LightSwitch and emu.lightswitch 2019-08-18 12:57:55 +05:30
◱ PixelyIon
449f0a0248 Addition of Remapping and Unmapping to Memory class 2019-08-18 03:48:27 +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
Ryan Teal
182729b247
Add logcat to the logger
Shame, Pixelylon, shame.
2019-07-26 19:31:42 +01:00
◱ PixelyIon
3bdbe41c13 Fix: Crash if log file is missing + Crash on random interrupt 2019-07-25 02:31:31 +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
fd2bf8ebd5
Merge branch 'master' of https://github.com/Cyuubi/Lightswitch 2019-07-09 22:36:14 +01:00
Ryan Teal
4cd7c985f0
IPC Episode 1 - Prologue 2019-07-09 22:35:51 +01:00
Starlet Leonhart
18de764e96
Fix something I keep forgetting to do in unicorn.h 2019-07-05 12:33:31 -04:00
Ryan Teal
1e057cb5f9
Add hos/kernel/kernel.cpp to CMake 2019-07-05 13:48:18 +01:00
Ryan Teal
e44f7f8feb
Basic KObject implementation 2019-07-05 13:33:58 +01:00
◱ PixelyIon
c7fafd3f72 Remove pop-up image for non-libnx NROs 2019-07-04 02:21:45 +05:30
◱ PixelyIon
4da7a9cdbc Support non-libnx NROs 2019-07-04 02:18:43 +05:30
Ryan Teal
2bf88e129d
Remove Picasso leftovers 2019-07-03 21:12:06 +01:00
Ryan Teal
07fb87b441
Use NRO0 verification instead of ASET verification 2019-07-03 21:02:59 +01:00
◱ PixelyIon
012b1df5d8 NRO Validation
The NRO files are now validated before they're added to the game list.
2019-07-04 01:25:06 +05:30
Ryan Teal
0eef380781
Implement GetInfo #8 IsCurrentProcessBeingDebugged 2019-07-03 20:53:51 +01:00
◱ PixelyIon
3ed3365d81 UI update: Pop-up Icons
The icons of games will now pop-up if you click on them.
2019-07-04 00:49:21 +05:30
◱ PixelyIon
ae6dddf9f6 UI update: Snackbars + NRO Metadata
This UI updates adds Snackbar notifications for actions and extracts metadata in the form of an icon, name and author from NRO files to display in the game list.

Co-Authored-By: Ryan Teal <zephyren25@users.noreply.github.com>
2019-07-04 00:14:28 +05:30
Ryan Teal
4921bb41ea
Add the Picasso image loading library 2019-07-03 18:50:44 +01:00
Ryan Teal
bbf02e29e5
Fix hacky icon loading method 2019-07-03 18:42:12 +01:00
Ryan Teal
f0daeebb03
Clean up imports 2019-07-03 18:28:22 +01:00
Ryan Teal
e84e0c7705
Add NRO icon loading 2019-07-03 18:27:49 +01:00
Ryan Teal
892960e8fd
Add launcher icon 2019-07-03 15:58:38 +01:00
Ryan Teal
eb8f9928ed
Add NRO TitleEntry parsing 2019-07-03 15:42:08 +01:00
◱ PixelyIon
15f8c4b5f0 Addition of a UI: Settings and NRO list
This update adds a minimal UI.
2019-07-03 04:49:45 +05:30
Starlet Leonhart
d4ddbe9b88 Add title ID in getinfo 2019-07-02 17:55:31 -04:00
Starlet Leonhart
be79abd213 Another minor code clean up, because I'm dumb 2019-07-02 17:51:34 -04:00
Starlet Leonhart
f10e4463fe Clean up again 2019-07-02 17:48:42 -04:00
Ryan Teal
13b1354a00
Implement svcGetInfo 2019-07-02 22:45:34 +01:00
Starlet Leonhart
040121340a Minor code cleanup 2019-07-02 17:43:49 -04:00
Ryan Teal
e108d4a0be
Implement svcOutputDebugString 2019-07-02 22:34:08 +01:00
Starlet Leonhart
80955679e0 Remove ARMv7 support, turns out I was talking out of my ass. 2019-07-02 17:32:20 -04:00
Starlet Leonhart
f5971905d8 Nearly forgot the ABI filters 2019-07-02 17:10:12 -04:00
Starlet Leonhart
ca1eb1d7e3 Add ARMv7 libunicorn static library 2019-07-02 17:09:06 -04:00
Ryan Teal
f8605a417d
Add SVC handler 2019-07-02 21:04:52 +01:00
Ryan Teal
ffbcf0fb33
Add as include directory 2019-07-02 21:00:57 +01:00
Ryan Teal
8080760cd5
Remove unused forward declarations in cpu.cpp 2019-07-02 20:46:39 +01:00
Ryan Teal
5cece7daed
Fix Cyuubi's CPU implementation 2019-07-02 20:40:35 +01:00
Ryan Teal
67b2ee3ea5
Add TLS memory map 2019-07-02 16:30:43 +01:00
Ryan Teal
4310ffd4dd
Fix interrupt hook and memory maps 2019-06-30 22:07:10 +01:00
Starlet Leonhart
75c608fd25 Add CPU class 2019-06-30 12:42:55 -04:00
Ryan Teal
39b591bcfd
Move namespaces to core:: 2019-06-30 16:00:17 +01:00
Ryan Teal
2f24f28084
An actual memory implementation 2019-06-30 15:39:56 +01:00
Ryan Teal
64f2f90087
Add external storage permission dialog 2019-06-30 15:35:25 +01:00
Ryan Teal
856f00bf7e
Clean up main source file 2019-06-30 15:04:22 +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
89346359cd Port ARM64 unicorn sample 2019-06-29 10:21:59 -04:00
Starlet Leonhart
6ebee35104 Remove unneeded unicorn headers 2019-06-29 10:06:00 -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