Experimental Nintendo Switch Emulator written in C#
Go to file
sharmander 06aa8a7578
GPU - Improve Memory Allocation (#1722)
* Implement TreeMap from scratch.

Begin implementation of MemoryBlockManager

* Implement GetFreePosition using MemoryBlocks

* Implementation of Memory Management using a Tree.

Still some issues to work around, but promising thus far.

* Resolved invalid mapping issue.

Performance appears promising.

* Add tick metrics

* Use the logger instead

* Use debug loggin instead of info.

* Remove unnecessary code. Add descriptions of added functions.

* Improve memory allocation even further. As well as improve speed of position fetching.

* Add TreeDictionary to Ryujinx Commons

Removed Unnecessary  Usigns

* Add a Performance Profiler + Improve ReserveFixed

* Begin transition to allocation in nvdrv

* Create singleton nvmemallocator

* Moved Allocation into Nv Related Files

As requested by gdkchan, any allocation of memory has been moved into the driver files.

Mapping remains in the GPU MemoryManager.

* Remove unnecessary usings

* Add missing descriptions

* Correct descriptions

* Fix formatting.

* Remove unnecessary whitespace

* Formatting / Convention Updates

* Changes / Fixes

Made syntax and convention changes as requested by gdkchan.

Fixed an issue where IsRegionUsed would return the wrong boolean.

Fixed an issue where GetFreePosition was asked for an address instead of a size.

* Undo commenting of Assert in shader cache

* Update Ryujinx.Common/Collections/TreeDictionary.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

* Resolved many suggestions

* Implement Improved TreeDictionary

Based off of Pseudo code and custom implementations.

* Rename _set to _dictionary

* Remove unused code

* Remove unused code.

* Remove unnecessary MapLow function.

* Resolve data-structure based issues

* Make adjustments to memory management.

Deactive de-allocation for now, it causes more harm than good.

* Minor refactorings + Re-implement deallocation

Also cleaned up unnecessary code.

* Add Tests for TreeDictionary

* Update data structure to properly balance the tree

* Experimental Implementation:

1. Reduce Time to Next Node to O(1) Runtime
2. Reduce While Loop Ct To 2 (In Most Cases)

* Address issues w/ Deallocating Memory

* Final Build

+ Fully Implement Dictionary Interface for new Data Structure
+ Cover All Memory Allocation Edge Cases, particularly w/ Games that De-Allocate a lot.

* Minor Corrections

Give TreeDictionary its own count (do not depend on inner dictionary)

Properly remove adjacent allocations

* Add AsList

* Fix bug where internal dictionary wasn't being updated w/ new node for overwritten key.

* Address comments in review.

* Fix issue where block wouldn't break out (Fixes UE4 issues)

* Update descriptions

* Update descriptions

* Reduce Node visibility to protect TreeDictionary Integrity + Remove usage of struct.

* Update tests to use new TreeDictionary implementation.

* Remove usage of dictionary in TreeDictionary

* Refactoring / Renaming

* Remove unneeded memoryblock class.

* Add space for while

* Add space for if

* Formatting / descriptions

* Clarified some descriptions

* Reduce visibility of memory allocator

* Edit method names to make more sense as memory blocks are no longer in use.

* Make names consistent.

* Protect against npe when sucessorof is called against keys that don't exist. (Not in use by memory manager, this is for other prs that might use this data structure)

* Possible edge-case resolve

* Update Ryujinx.Common/Collections/TreeDictionary.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

* Update Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

* Reduce # of unnecessary duplicate variables / Reduce visibility of variables only internally used.

* Rename count to _count

* Update Description of Add method.

* Fix copypasta

* Address comments

* Address comments

* Remove whitespace

* Address comments, condense variables.

* Consolidate vars

* Fix whitespace.

* Nit

* Fix exception msg

* Fix arrayIndex check

* Fix arrayIndex check + indexer

* Remove whitespace from cast

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2020-12-09 19:26:05 -03:00
.github infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
ARMeilleure CPU: Implement VFNMA.F32 | F.64 (#1783) 2020-12-07 21:04:01 -03:00
Ryujinx Rewrite scheduler context switch code (#1786) 2020-12-09 19:20:05 -03:00
Ryujinx.Audio audio: Cleanup Ryujinx.Audio and fix OpenAL issue (#1746) 2020-11-27 20:55:00 +01:00
Ryujinx.Audio.Renderer amadeus: Fix a typo in TapFrame logic (#1767) 2020-12-02 00:46:26 +01:00
Ryujinx.Common GPU - Improve Memory Allocation (#1722) 2020-12-09 19:26:05 -03:00
Ryujinx.Cpu IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458) 2020-12-02 00:23:43 +01:00
Ryujinx.Graphics.Device infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Graphics.GAL Allow copy destination to have a different scale from source (#1711) 2020-11-20 17:14:45 -03:00
Ryujinx.Graphics.Gpu GPU - Improve Memory Allocation (#1722) 2020-12-09 19:26:05 -03:00
Ryujinx.Graphics.Host1x infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Graphics.Nvdec infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Graphics.Nvdec.H264 infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Graphics.Nvdec.Vp9 Remove some warnings and cleaning code (#1736) 2020-11-27 18:57:20 +01:00
Ryujinx.Graphics.OpenGL Dummy out gl queries with 0 draws, remove glFlush call (#1773) 2020-12-03 19:42:59 +01:00
Ryujinx.Graphics.Shader Implement Force Early Z Register (#1755) 2020-12-02 00:13:27 +01:00
Ryujinx.Graphics.Texture Perform Compressed<->Uncompressed copies using Pixel Buffer Objects (#1732) 2020-11-20 13:30:59 -03:00
Ryujinx.Graphics.Vic infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Graphics.Video infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.HLE GPU - Improve Memory Allocation (#1722) 2020-12-09 19:26:05 -03:00
Ryujinx.Memory Signal memory tracking before/after mapping into another process (#1785) 2020-12-07 21:42:17 -03:00
Ryujinx.Memory.Tests Signal memory tracking before/after mapping into another process (#1785) 2020-12-07 21:42:17 -03:00
Ryujinx.ShaderTools infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Ryujinx.Tests GPU - Improve Memory Allocation (#1722) 2020-12-09 19:26:05 -03:00
Ryujinx.Tests.Unicorn infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
.editorconfig Adding .editorconfig so code style can be consistent and localized (#1131) 2020-05-03 00:58:58 +02:00
.gitattributes aloha 2018-02-04 20:08:20 -03:00
.gitignore Implement ContentManager and related services (#438) 2018-11-18 17:37:41 -02:00
appveyor.yml infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
global.json infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
LICENSE.txt Update license (#788) 2019-10-12 23:48:31 -03:00
README.md Specify the X64 version of .NET 5, and change the build command to be the right one (#1719) 2020-11-17 22:55:32 +01:00
Ryujinx.sln Support 3D BC4 and BC5 compressed textures (#1655) 2020-11-01 15:32:53 -03:00
Ryujinx.sln.DotSettings Add features to GUI (#757) 2019-11-29 15:32:51 +11:00

Ryujinx

An experimental Switch emulator written in C#

As of November 2020, Ryujinx has been tested to go past menus to in-game on approximately 1,900 commercial titles. Of those, over 1,000 are considered playable. See the compatibility list here.

Usage

To run this emulator, we recommend that your PC have at least 8GB of RAM; less than this amount can result in unpredictable behavior and may cause crashes or unacceptable performance.

See our Setup & Configuration Guide on how to set up the emulator.

Latest build

These builds are compiled automatically for each commit on the master branch. While we strive to ensure optimal stability and performance prior to pushing an update, our automated builds may be unstable or completely broken.

The latest automatic build for Windows, macOS, and Linux can be found on the Official Website.

Building

If you wish to build the emulator yourself you will need to:

Step one: Install the X64 version of .NET 5.0 (or higher) SDK.

Step two (choose one):
(Variant one)

After the installation of the .NET SDK is done; go ahead and copy the Clone link from GitHub from here (via Clone or Download --> Copy HTTPS Link. You can Git Clone the repo by using Git Bash or Git CMD.

(Variant two):

Download the ZIP Tarball. Then extract it to a directory of your choice.

Step three:

Build the App using a Command prompt in the project directory. You can quickly access it by holding shift in explorer (in the Ryujinx directory) then right clicking, and typing the following command:
Run dotnet build -c Release inside the Ryujinx project folder to build Ryujinx binaries.

Ryujinx system files are stored in the Ryujinx folder. This folder is located in the user folder, which can be accessed by clicking Open Ryujinx Folder under the File menu in the GUI.

Features

  • Audio

    Audio output is entirely supported, audio input (microphone) isn't supported. We use C# wrappers for OpenAL (installation needed), and libsoundio as the fallback.

  • CPU

    The CPU emulator, ARMeilleure, emulates an ARMv8 CPU and currently has support for most 64-bit ARMv8 and some of the ARMv7 (and older) instructions, including partial 32-bit support. It translates the ARM code to a custom IR, performs a few optimizations, and turns that into x86 code.
    Ryujinx also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads. The net result is a significant reduction in load times (the amount of time between launching a game and arriving at the title screen) for nearly every game. NOTE: this feature is disabled by default and must be enabled in the Options menu > System tab. You must launch the game at least twice to the title screen or beyond before performance improvements are unlocked on the third launch! These improvements are permanent and do not require any extra launches going forward.

  • GPU

    The GPU emulator emulates the Switch's Maxwell GPU using the OpenGL API (version 4.4 minimum) through a custom build of OpenTK. There are currently two graphics enhancements available to the end user in Ryujinx: resolution scaling and anisotropic filtering. These can both be adjusted in the GUI.

  • Input

    We currently have support for keyboard, mouse, touch input, JoyCon input support emulated through the keyboard, and most controllers. Controller support varies by operating system, as outlined below.
    Windows: Xinput-compatible controllers are supported natively; other controllers can be supported with the help of Xinput wrappers such as x360ce.
    Linux: most modern controllers are supported.
    In either case, you can set up everything inside the input configuration menu.

  • DLC & Modifications

    Ryujinx is able to manage add-on content/downloadable content through the GUI. Mods (romfs and exefs) are also supported and the GUI contains a shortcut to open the respective mods folder for a particular game.

  • Configuration

    The emulator has settings for enabling or disabling some logging, remapping controllers, and more. You can configure all of them through the graphical interface or manually through the config file, Config.json, found in the user folder which can be accessed by clicking Open Ryujinx Folder under the File menu in the GUI.

Compatibility

You can check out the compatibility list here.

Don't hesitate to open a new issue if a game isn't already on there.

Help

If you are having problems launching homebrew or a particular game marked status-playable or status-ingame in our compatibility list, you can contact us through our Discord server. We'll take note of whatever is causing the app/game to not work, put it on the watch list and fix it at a later date.

If you need help with setting up Ryujinx, you can ask questions in the #support channel of our Discord server.

Contact

If you have contributions, need support, have suggestions, or just want to get in touch with the team, join our Discord server!

If you'd like to donate, please take a look at our Patreon.

License

This software is licensed under the terms of the MIT license. The Ryujinx.Audio.Renderer project is licensed under the terms of the LGPLv3 license. This project makes use of code authored by the libvpx project, licensed under BSD and the ffmpeg project, licensed under LGPLv3. See LICENSE.txt and THIRDPARTY.md for more details.