Commit graph

35 commits

Author SHA1 Message Date
LDj3SNuD
5e724cf24e
Add Profiled Persistent Translation Cache. (#769)
* Delete DelegateTypes.cs

* Delete DelegateCache.cs

* Add files via upload

* Update Horizon.cs

* Update Program.cs

* Update MainWindow.cs

* Update Aot.cs

* Update RelocEntry.cs

* Update Translator.cs

* Update MemoryManager.cs

* Update InstEmitMemoryHelper.cs

* Update Delegates.cs

* Nit.

* Nit.

* Nit.

* 10 fewer MSIL bytes for us

* Add comment. Nits.

* Update Translator.cs

* Update Aot.cs

* Nits.

* Opt..

* Opt..

* Opt..

* Opt..

* Allow to change compression level.

* Update MemoryManager.cs

* Update Translator.cs

* Manage corner cases during the save phase. Nits.

* Update Aot.cs

* Translator response tweak for Aot disabled. Nit.

* Nit.

* Nits.

* Create DelegateHelpers.cs

* Update Delegates.cs

* Nit.

* Nit.

* Nits.

* Fix due to #784.

* Fixes due to #757 & #841.

* Fix due to #846.

* Fix due to #847.

* Use MethodInfo for managed method calls.

Use IR methods instead of managed methods about Max/Min (S/U).
Follow-ups & Nits.

* Add missing exception messages.

Reintroduce slow path for Fmov_Vi.
Implement slow path for Fmov_Si.

* Switch to the new folder structure.

Nits.

* Impl. index-based relocation information. Impl. cache file version field.

* Nit.

* Address gdkchan comments.

Mainly:
- fixed cache file corruption issue on exit; - exposed a way to disable AOT on the GUI.

* Address AcK77 comment.

* Address Thealexbarney, jduncanator & emmauss comments.

Header magic, CpuId (FI) & Aot -> Ptc.

* Adaptation to the new application reloading system.

Improvements to the call system of managed methods.
Follow-ups.
Nits.

* Get the same boot times as on master when PTC is disabled.

* Profiled Aot.

* A32 support (#897).

* #975 support (1 of 2).

* #975 support (2 of 2).

* Rebase fix & nits.

* Some fixes and nits (still one bug left).

* One fix & nits.

* Tests fix (by gdk) & nits.

* Support translations not only in high quality and rejit.

Nits.

* Added possibility to skip translations and continue execution, using `ESC` key.

* Update SettingsWindow.cs

* Update GLRenderer.cs

* Update Ptc.cs

* Disabled Profiled PTC by default as requested in the past by gdk.

* Fix rejit bug. Increased number of parallel translations. Add stack unwinding stuffs support (1 of 2).

Nits.

* Add stack unwinding stuffs support (2 of 2). Tuned number of parallel translations.

* Restored the ability to assemble jumps with 8-bit offset when Profiled PTC is disabled or during profiling.

Modifications due to rebase.
Nits.

* Limited profiling of the functions to be translated to the addresses belonging to the range of static objects only.

* Nits.

* Nits.

* Update Delegates.cs

* Nit.

* Update InstEmitSimdArithmetic.cs

* Address riperiperi comments.

* Fixed the issue of unjustifiably longer boot times at the second boot than at the first boot, measured at the same time or reference point and with the same number of translated functions.

* Implemented a simple redundant load/save mechanism.

Halved the value of Decoder.MaxInstsPerFunction more appropriate for the current performance of the Translator.
Replaced by Logger.PrintError to Logger.PrintDebug in TexturePool.cs about the supposed invalid texture format to avoid the spawn of the log.
Nits.

* Nit.

Improved Logger.PrintError in TexturePool.cs to avoid log spawn.
Added missing code for FZ handling (in output) for fp max/min instructions (slow paths).

* Add configuration migration for PTC

Co-authored-by: Thog <me@thog.eu>
2020-06-16 20:28:02 +02:00
mageven
ba4830293e
Refactor out Application details from Horizon (#1236)
* Initial Application refactor

* Misc typo and access modifier fixes

* Clean unused namespaces

* Address gdkchan's comments

* Move ticket reading to common method

* Change IParentalControlService to use ApplicationLoader.ControlData
2020-05-15 03:16:46 -03:00
plutoo
7f500e7cae
set: Quick implementation of GetKeyCodeMap/GetKeyCodeMap2 (#1210)
* set: Quick implementation of GetKeyCodeMap/GetKeyCodeMap2

This fixed USB keyboard access in official titles.

* hid: Stub SendKeyboardLockKeyEvent

* Update Ryujinx.HLE/HOS/Services/Settings/ISettingsServer.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* Update Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* set: KeyboardLayout bringup

* set: Small bugfix

* Fix GetKeyCodeMapImpl

* Revert SystemRegion > RegionCode in Configuration

* Fix SendKeyboardLockKeyEvent

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-05-05 20:50:53 +02:00
gdkchan
f77694e4f7
Implement a new physical memory manager and replace DeviceMemory (#856)
* Implement a new physical memory manager and replace DeviceMemory

* Proper generic constraints

* Fix debug build

* Add memory tests

* New CPU memory manager and general code cleanup

* Remove host memory management from CPU project, use Ryujinx.Memory instead

* Fix tests

* Document exceptions on MemoryBlock

* Fix leak on unix memory allocation

* Proper disposal of some objects on tests

* Fix JitCache not being set as initialized

* GetRef without checks for 8-bits and 16-bits CAS

* Add MemoryBlock destructor

* Throw in separate method to improve codegen

* Address PR feedback

* QueryModified improvements

* Fix memory write tracking not marking all pages as modified in some cases

* Simplify MarkRegionAsModified

* Remove XML doc for ghost param

* Add back optimization to avoid useless buffer updates

* Add Ryujinx.Cpu project, move MemoryManager there and remove MemoryBlockWrapper

* Some nits

* Do not perform address translation when size is 0

* Address PR feedback and format NativeInterface class

* Remove ghost parameter description

* Update Ryujinx.Cpu to .NET Core 3.1

* Address PR feedback

* Fix build

* Return a well defined value for GetPhysicalAddress with invalid VA, and do not return unmapped ranges as modified

* Typo
2020-05-04 08:54:50 +10:00
Thog
cdbb689b80
Add support for dynamic docking/undocking (#1147)
* Add support for dynamic docking/undocking

As SurfaceFlinger is now working more accurately, we can now support
dynamic configuration of docking mode :)

* Simplify a bt the code

* Fix import ordering

* Remove unused argument
2020-04-23 13:59:11 +02:00
Thog
36749c358d
SurfaceFlinger v2 (#981)
* Rewrite SurfaceFlinger

Reimplement accurately SurfaceFlinger (based on my 8.1.0 reversing of it)

TODO: support swap interval properly and reintroduce disabled "game vsync" support.

* Some fixes for SetBufferCount

* uncomment a test from last commit

* SurfaceFlinger: don't free the graphic buffer in SetBufferCount

* SurfaceFlinger: Implement swap interval correctly

* SurfaceFlinger: Reintegrate Game VSync toggle

* SurfaceFlinger: do not push a fence on buffer release on the consumer side

* Revert "SurfaceFlinger: do not push a fence on buffer release on the consumer side"

This reverts commit 586b52b0bfab2d11f361f4b59ab7b7141020bbad.

* Make the game vsync toggle work dynamically again

* Unregister producer's Binder object when closing layer

* Address ripinperi's comments

* Add a timeout on syncpoint wait operation

Syncpoint aren't supposed to be waited on for more than a second.

This effectively workaround issues caused by not having a channel
scheduling in place yet.

PS: Also introduce Android WaitForever warning about fence being not
signaled for 3s

* Fix a print of previous commit

* Address Ac_K's comments

* Address gdkchan's comments

* Address final comments
2020-04-22 14:10:27 +10:00
Cristallix
4738113f29
Suppress warnings from fields never used or never assigned (CS0169 and CS0649) (#919)
* chore : disable unwanted warnings and minor code cleanup

* chore : remove more warnings

* fix : reorder struct correctly

* fix : restore _isKernel and remove useless comment

* fix : copy/paste error

* fix : restore CallMethod call

* fix : whitespace

* chore : clean using

* feat : remove warnings

* fix : simplify warning removal on struct

* fix : revert fields deletion and code clean up

* fix : re-add RE value

* fix : typo
2020-04-21 07:59:59 +10:00
mageven
2365ddfc36
HID SharedMem Rework (#1003)
* Delete old HLE.Input

* Add new HLE Input.

git shows Hid.cs as modified because of the same name. It is new.

* Change HID Service

* Change Ryujinx UI to reflect new Input

* Add basic ControllerApplet

* Add DebugPad

Should fix Kirby Star Allies

* Address Ac_K's comments

* Moved all of HLE.Input to Services.Hid
* Separated all structs and enums each to a file
* Removed vars
* Made some naming changes to align with switchbrew
* Added official joycon colors

As an aside, fixed a mistake in touchscreen headers and added checks to
important SharedMem structs at init time.

* Further address Ac_K's comments

* Addressed gdkchan's and some more Ac_K's comments

* Address AcK's review comments

* Address AcK's second review comments

* Replace missed Marshal.SizeOf and address gdkchan's comments
2020-04-03 11:10:02 +11:00
Ac_K
32d3f3f690
Implement GetRegionCode and add the RegionCode to settings (#999)
This implement `GetRegionCode` accordingly to RE. I've added a setting in the GUI and a field in the Configuration file with a way to update the Configuration file if needed.
2020-03-20 09:37:55 +11:00
Thog
d6b9babe1d Keep the GUI alive when closing a game (#888)
* Keep the GUI alive when closing a game

Make HLE.Switch init when starting a game and dispose it when closing
the GlScreen.

This also make HLE in charge of disposing the audio and gpu backend.

* Address Ac_k's comments

* Make sure to dispose the Discord module and use GTK quit method

Also update Discord Precense when closing a game.

* Make sure to dispose MainWindow

* Address gdk's comments
2020-01-21 23:23:11 +01:00
gdkchan
59fdaa744b GPU resource disposal 2020-01-09 02:13:00 +01:00
gdk
16d88c21fc Improved and simplified window texture presentation 2020-01-09 02:13:00 +01:00
gdk
1876b346fe Initial work 2020-01-09 02:13:00 +01:00
Alex Barney
63b24b4af2 Rename "RyuFs" directory to "Ryujinx" and use the same savedata system the Switch uses (#801)
* Use savedata FS commands from LibHac

* Add EnsureSaveData. Use ApplicationControlProperty struct

* Add a function to migrate to the new directory layout

* LibHac update

* Change backup structure

* Don't create UI files in the save path

* Update RyuFs paths

* Add GetProgramIndexForAccessLog

Ryujinx only runs one program at a time, so always return values reflecting that

* Load control NCA when loading from an NSP

* Skip over UI stats when exiting

* Set TitleName and TitleId in more cases. Fix TitleID naming style

* Completely comment out GUI play stats code

* rebase

* Update LibHac

* Update LibHac

* Revert UI changes

* Do migration automatically at startup

* Rename RyuFs directory to Ryujinx

* Update RyuFs text

* Store savedata paths in the GUI

* Make "Open Save Directory" work

* Use a dummy NACP in EnsureSaveData if one is not loaded

* Remove manual migration button

* Respond to feedback

* Don't read the installer config to get a version string

* Delete nuget.config

* Exclude 'sdcard' and 'bis' during migration

Co-authored-by: Thog <thog@protonmail.com>
2020-01-05 12:49:44 +01:00
Thog
01a4c80ed5
Rewrite the configuration system (#831)
The configuration system was quite fragile and too dependent on everything, this fix #812 .

The changes:

    The file configuration is now entirely independent from the internal configuration state.
    The file configuration is versioned (current version is 1).
    Every configuration elements are now reactive properties that the emulator can register on to handle initialization and configuration changes.
    The configuration system is now in Ryujinx.Common to be accessible on every projects.
    Discord integration is now independent from the UI and can be reloaded.
    The primary controller is now configurable at runtime (NOTE: the UI currently doesn't have any options to configure real controller).
    The logger is entirely reloadable.
    You can now hotplug your controller when the emulator is running.
    The logger now takes name for every LogTarget to make them removable at runtime.
    The logger now always add the default "console" target to avoid loosing early init logs.
    The configuration system now generates a default file configuration if it's missing or too new.
    General system stability improvements to enhance the user's experience
2019-12-21 20:52:31 +01:00
jduncanator
d306115750 Logger and Configuration Refactoring (#573)
* Logging: Refactor log targets into Ryujinx.Common

* Logger: Implement JSON Log Target

* Logger: Optimize Console/File logging targets

Implement a simple ObjectPool to pool up StringBuilders to avoid causing excessive GCing of gen1/2 items when large amounts of log entries are being generated.

We can also pre-determine the async overflow action at initialization time, allowing for an easy optimization in the message enqueue function, avoiding a number of comparisons.

* Logger: Implement LogFormatters

* Config: Refactor configuration file and loading

* Config: Rename to .jsonc to avoid highlighting issues in VSC and GitHub

* Resolve style nits

* Config: Resolve incorrect default key binding

* Config: Also update key binding default in schema

* Tidy up namespace imports

* Config: Update CONFIG.md to reflect new Config file
2019-02-11 09:00:32 -03:00
Alex Barney
fb1d9493a3 Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields

* Naming conventions

* Remove unneeded ".this"

* Remove unneeded semicolons

* Remove unused Usings

* Don't use var

* Remove unneeded enum underlying types

* Explicitly label class visibility

* Remove unneeded @ prefixes

* Remove unneeded commas

* Remove unneeded if expressions

* Method doesn't use unsafe code

* Remove unneeded casts

* Initialized objects don't need an empty constructor

* Remove settings from DotSettings

* Revert "Explicitly label class visibility"

This reverts commit ad5eb5787c.

* Small changes

* Revert external enum renaming

* Changes from feedback

* Apply previous refactorings to the merged code
2018-12-06 09:16:24 -02:00
gdkchan
3615a70cae
Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)
This reverts commit 85dbb9559a.
2018-12-04 22:52:39 -02:00
Alex Barney
85dbb9559a Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields

* Naming conventions

* Remove unneeded ".this"

* Remove unneeded semicolons

* Remove unused Usings

* Don't use var

* Remove unneeded enum underlying types

* Explicitly label class visibility

* Remove unneeded @ prefixes

* Remove unneeded commas

* Remove unneeded if expressions

* Method doesn't use unsafe code

* Remove unneeded casts

* Initialized objects don't need an empty constructor

* Remove settings from DotSettings

* Revert "Explicitly label class visibility"

This reverts commit ad5eb5787c.

* Small changes

* Revert external enum renaming

* Changes from feedback

* Remove unneeded property setters
2018-12-04 18:23:37 -02:00
gdkchan
00579927e4
Better process implementation (#491)
* Initial implementation of KProcess

* Some improvements to the memory manager, implement back guest stack trace printing

* Better GetInfo implementation, improve checking in some places with information from process capabilities

* Allow the cpu to read/write from the correct memory locations for accesses crossing a page boundary

* Change long -> ulong for address/size on memory related methods to avoid unnecessary casts

* Attempt at implementing ldr:ro with new KProcess

* Allow BSS with size 0 on ldr:ro

* Add checking for memory block slab heap usage, return errors if full, exit gracefully

* Use KMemoryBlockSize const from KMemoryManager

* Allow all methods to read from non-contiguous locations

* Fix for TransactParcelAuto

* Address PR feedback, additionally fix some small issues related to the KIP loader and implement SVCs GetProcessId, GetProcessList, GetSystemInfo, CreatePort and ManageNamedPort

* Fix wrong check for source pages count from page list on MapPhysicalMemory

* Fix some issues with UnloadNro on ldr:ro
2018-11-28 20:18:09 -02:00
gdkchan
d2bb458b51 Improved GPU command lists decoding (#499)
* Better implementation of the DMA pusher, misc fixes

* Remove some debug code

* Correct RGBX8 format

* Add support for linked Texture Sampler Control

* Attempt to fix upside down screen issue
2018-11-17 05:01:31 +01:00
ReinUsesLisp
b3a4662be1 Move logging to Ryujinx.Common and make it a static class (#413) 2018-10-17 14:15:50 -03:00
emmauss
db1a759c59 Lock GbpQueueBuffer till Vsync is signalled (#367)
* Initial Framerate limit implementation

* use seperate event for limiter

* check for vsync signal after queue up framebuffer

* removed ingame toggle

* fix nits
2018-09-10 01:38:56 +02:00
emmauss
fc77b089a6 Implements proper save path (#386)
* initial save path implementation

* fix savedatatype offset, remove incomplete createsavedata implimentation

* address nits

* fix crash if npdm is not found

* made saveinfo readonly, other stuff

* remove context param from saveinfo contructor

* fix style

* remove whitespace
2018-09-08 19:04:26 -03:00
Alex Barney
3227218114 Add XCI, NSP and NCA loading support (#404)
* Add XCI and NCA loading support

* Code style changes

* Add NSP loading

* Changes from code review

* Read XCIs with patches. Code style

* Add KEYS.md file

* Make file extension matching case-insensitive
2018-09-08 15:33:27 -03:00
ReinUsesLisp
ce1d5be212 Move GPU emulation from Ryujinx.HLE to Ryujinx.Graphics and misc changes (#402)
* Move GPU LLE emulation from HLE to Graphics

* Graphics: Move Gal/Texture to Texture

* Remove Engines/ directory and namespace

* Use tables for image formats

* Abstract OpCode decoding

* Simplify image table

* Do not leak Read* symbols in TextureReader

* Fixups

* Rename IGalFrameBuffer -> IGalRenderTarget

* Remove MaxBpp hardcoded value

* Change yet again texture data and add G8R8 flipping

* Rename GalFrameBufferFormat to GalSurfaceFormat

* Unident EnsureSetup in ImageHandler

* Add IsCompressed

* Address some feedback
2018-09-08 14:51:50 -03:00
gdkchan
521751795a
Code style fixes and nits on the HLE project (#355)
* Some style fixes and nits on ITimeZoneService

* Remove some unneeded usings

* Remove the Ryujinx.HLE.OsHle.Handles namespace

* Remove hbmenu automatic load on process exit

* Rename Ns to Device, rename Os to System, rename SystemState to State

* Move Exceptions and Utilities out of OsHle

* Rename OsHle to HOS

* Rename OsHle folder to HOS

* IManagerDisplayService and ISystemDisplayService style fixes

* BsdError shouldn't be public

* Add a empty new line before using static

* Remove unused file

* Some style fixes on NPDM

* Exit gracefully when the application is closed

* Code style fixes on IGeneralService

* Add 0x prefix on values printed as hex

* Small improvements on finalization code

* Move ProcessId and ThreadId out of AThreadState

* Rename VFs to FileSystem

* FsAccessHeader shouldn't be public. Also fix file names casing

* More case changes on NPDM

* Remove unused files

* Move using to the correct place on NPDM

* Use properties on KernelAccessControlMmio

* Address PR feedback
2018-08-16 20:47:36 -03:00
gdkchan
c393cdf8e3
More flexible memory manager (#307)
* Keep track mapped buffers with fixed offsets

* Started rewriting the memory manager

* Initial support for MapPhysicalMemory and UnmapPhysicalMemory, other tweaks

* MapPhysicalMemory/UnmapPhysicalMemory support, other tweaks

* Rebased

* Optimize the map/unmap physical memory svcs

* Integrate shared font support

* Fix address space reserve alignment

* Some fixes related to gpu memory mapping

* Some cleanup

* Only try uploading const buffers that are really used

* Check if memory region is contiguous

* Rebased

* Add missing count increment on IsRegionModified

* Check for reads/writes outside of the address space, optimize translation with a tail call
2018-08-15 15:59:51 -03:00
gdkchan
9ac5583513
Better support for user accounts (#349)
* Better support for user accounts

* Nits

* Check for invalid ids
2018-08-14 19:02:42 -03:00
emmauss
17f54b5d78 Implement IProfile Get and GetBase (#266)
* implement IProfile Get(Base)

* use default user

* changed userid
2018-08-13 21:13:01 -03:00
Thomas Guillemard
eeb626947e Implement Shared Fonts (#215)
* Implement Shared Fonts

This fully implements shared fonts.
This commit is provided without fonts.
This commit also add Size to HSharedMem.Positions to be able to add fonts to shared zones when RequestLoad is called.

* Require the user to provide fonts in RyuFS/system

* Use File.Exits instead of relying ona try/catch and change system resource exception format a bit

* Make sure that font sum doesn't exceed 17MB

Also rename font data dictionary for coherence.
2018-08-04 18:38:49 -03:00
Thomas Guillemard
c2c765b30f hbabi: Implement argv (#272)
This commit implements the argv config key in Ryujinx (by creating a temporary copy of the homebrew executable in the sdmc VFS) to make it possible
to load libnx's "romfs" files.

This commit also call Os.Dispose in Ns.OnFinish to dispose all resources when exiting
2018-07-17 16:14:27 -03:00
ReinUsesLisp
cd18ab29df Loop GLScreen with custom method (#244)
* Loop GLScreen with custom method

* Fix deadlocks

* Fix screen resizing

* Change event to bool

* Try to fix quitting error

* Set title from main thread

* Queue max 1 vsync, fix high FPS after a slowdown
2018-07-12 14:03:52 -03:00
gdkchan
e7559f128f
Small OpenGL Renderer refactoring (#177)
* Call OpenGL functions directly, remove the pfifo thread, some refactoring

* Fix PerformanceStatistics calculating the wrong host fps, remove wait event on PFIFO as this wasn't exactly was causing the freezes (may replace with an exception later)

* Organized the Gpu folder a bit more, renamed a few things, address PR feedback

* Make PerformanceStatistics thread safe

* Remove unused constant

* Use unlimited update rate for better pref
2018-06-23 21:39:25 -03:00
gdkchan
76f3b1b3a4 Rename Ryujinx.Core to Ryujinx.HLE and add a separate project for a future LLE implementation 2018-06-10 21:46:42 -03:00
Renamed from Ryujinx.Core/Switch.cs (Browse further)