Commit graph

154 commits

Author SHA1 Message Date
Mary
bec67dbef7
misc: Move configuration management to the Ryujinx project (#2269)
* Decouple configuration from Ryujinx.HLE and Ryujinx.Input

* Move Configuration to the Ryujinx project
2021-05-16 17:12:14 +02:00
Mary
eb056218a1
audio: Implement a SDL2 backend (#2258)
* audio: Implement a SDL2 backend

This adds support to SDL2 as an audio backend.
It has the same compatibility level as OpenAL without its issues.

I also took the liberty of restructuring the SDL2 code to have one
shared project between audio and input.

The configuration version was also incremented.

* Address gdkchan's comments

* Fix update logic

* Add an heuristic to pick the correct target sample count wanted by the game

* Address gdkchan's comments

* Address Ac_k's comments

* Fix audren output

* Address gdkchan's comments
2021-05-05 23:37:09 +02:00
Ac_K
106512229e
ffmpeg: Redirect log output (#2266)
* ffmpeg: Redirect log output

* Remove leftover delegate

* Logging -> Log
2021-05-05 23:30:29 +02:00
Mark Araujo
1998a3a90a
Changes ordering of config.json and configuration files (#2253)
This allows configuration values to be written to log file for analysis
2021-04-30 21:39:42 +02:00
riperiperi
3f126487ab Data should not be public for nvapi unicode string 2021-04-18 17:34:01 +01:00
riperiperi
d6547abebf Use IntPtr for handles, remove unsafe keyword 2021-04-18 17:34:00 +01:00
riperiperi
1239c82d2f Forcibly enable threaded optimization on boot. 2021-04-18 17:34:00 +01:00
Mary
6cb22c9d38
Miria: The Death of OpenTK 3 (#2194)
* openal: Update to OpenTK 4

* Ryujinx.Graphics.OpenGL: Update to OpenTK 4

* Entirely removed OpenTK 3, still wip

* Use SPB for context creation and handling

Still need to test on GLX and readd input support

* Start implementing a new input system

So far only gamepad are supported, no configuration possible via UI but detected via hotplug/removal

Button mapping backend is implemented

TODO: front end, configuration handling and configuration migration
TODO: keyboard support

* Enforce RGB only framebuffer on the GLWidget

Fix possible transparent window

* Implement UI gamepad frontend

Also fix bad mapping of minus button and ensure gamepad config is updated in real time

* Handle controller being disconnected and reconnected again

* Revert "Enforce RGB only framebuffer on the GLWidget"

This reverts commit 0949715d1a03ec793e35e37f7b610cbff2d63965.

* Fix first color clear

* Filter SDL2 events a bit

* Start working on the keyboard detail

- Rework configuration classes a bit to be more clean.
- Integrate fully the keyboard configuration to the front end (TODO: assigner)
- Start skeleton for the GTK3 keyboard driver

* Add KeyboardStateSnapshot and its integration

* Implement keyboard assigner and GTK3 key mapping

TODO: controller configuration mapping and IGamepad implementation for keyboard

* Add missing SR and SL definitions

* Fix copy pasta mistake on config for previous commit

* Implement IGamepad interface for GTK3 keyboard

* Fix some implementation still being commented in the controller ui for keyboard

* Port screen handle code

* Remove all configuration management code and move HidNew to Hid

* Rename InputConfigNew to InputConfig

* Add a version field to the input config

* Prepare serialization and deserialization of new input config and migrate profile loading and saving

* Support input configuration saving to config and bump config version to 23.

* Clean up in ConfigurationState

* Reference SPB via a nuget package

* Move new input system to Ryujinx.Input project and SDL2 detail to Ryujinx.Input.SDL2

* move GTK3 input to the right directory

* Fix triggers on SDL2

* Update to SDL2 2.0.14 via our own fork

* Update buttons definition for SDL2 2.0.14 and report gamepad features

* Implement motion support again with SDL2

TODO: cemu hooks integration

* Switch to latest of nightly SDL2

* SDL2: Fix bugs in gamepad id matching allowing different gamepad to match on the same device index

* Ensure values are set in UI when the gamepad get hot plugged

* Avoid trying to add controllers in the Update method and don't open SDL2 gamepad instance before checking ids

This fixes permanent rumble of pro controller in some hotplug scenario

* Fix more UI bugs

* Move legcay motion code around before reintegration

* gamecontroller UI tweaks here and there

* Hide Motion on non motion configurations

* Update the TODO grave

Some TODO were fixed long time ago or are quite oudated...

* Integrate cemu hooks motion configuration

* Integrate cemu hooks configuration options to the UI again

* cemuhooks => cemuhooks

* Add cemu hook support again

* Fix regression on normal motion and fix some very nasty bugs around

* Fix for XCB multithreads issue on Linux

* Enable motion by default

* Block inputs in the main view when in the controller configuration window

* Some fixes for the controller ui again

* Add joycon support and fixes other hints

* Bug fixes and clean up

- Invert default mapping if not a Nintendo controller
- Keep alive the controller being selected on the controller window (allow to avoid big delay for controller needing time to init when doing button assignment)
- Clean up hints in use
- Remove debug logs around
- Fixes potential double free with SDL2Gamepad

* Move the button assigner and motion logic to the Ryujinx.Input project

* Reimplement raw keyboard hle input

Also move out the logic of the hotkeys

* Move all remaining Input manager stuffs to the Ryujinx.Input project

* Increment configuration version yet again because of master changes

* Ensure input config isn't null when not present

* Fixes for VS not being nice

* Fix broken gamepad caching logic causing crashes on ui

* Ensure the background context is destroyed

* Update dependencies

* Readd retrocompat with old format of the config to avoid parsing and crashes on those versions

Also updated the debug Config.json

* Document new input APIs

* Isolate SDL2Driver to the project and remove external export of it

* Add support for external gamepad db mappings on SDL2

* Last clean up before PR

* Addresses first part of comments

* Address gdkchan's comments

* Do not use JsonException

* Last comment fixes
2021-04-14 12:28:43 +02:00
Mark Araujo
faa654dbaf
Improves logging to console. (#2146)
* Restore removed text

* Adds more items to logs:

- Remove #1942

* Further removal of changes from #1942

* Removes hardcoded config state variables for logging
- Adds Configuration logging

* Decoupled logging from ReactiveObject
- Event handler added to Configuration state to handle logging of value changes

* Decoupled logging from ReactiveObject
- Event handler added to Configuration state to handle logging of value changes
2021-04-13 21:58:47 +02:00
gdkchan
874540bb5c
Allow DRAM size to be increased from 4GB to 6GB (#2174)
* Allow DRAM size to be increased from 4GB to 6GB

* Add option on the UI
2021-04-04 14:06:59 +02:00
Caian Benedicto
0c1ea1212a
Add the TamperMachine module for runtime mods and cheats (#1928)
* Add initial implementation of the Tamper Machine

* Implement Atmosphere opcodes 0, 4 and 9

* Add missing TamperCompilationException class

* Implement Atmosphere conditional and loop opcodes 1, 2 and 3

* Inplement input conditional opcode 8

* Add register store opcode A

* Implement extended pause/resume opcodes FF0 and FF1

* Implement extended log opcode FFF

* Implement extended register conditional opcode C0

* Refactor TamperProgram to an interface

* Moved Atmosphere classes to a separate subdirectory

* Fix OpProcCtrl class not setting process

* Implement extended register save/restore opcodes C1, C2 and C3

* Refactor code emitters to separate classes

* Supress memory access errors from the Tamper Machine

* Add debug information to tamper register and memory writes

* Add block stack check to Atmosphere Cheat compiler

* Add handheld input support to Tamper Machine

* Fix code styling

* Fix build id and cheat case mismatch

* Fix invalid immediate size selection

* Print build ids of the title

* Prevent Tamper Machine from change code regions

* Remove Atmosphere namespace

* Remove empty cheats from the list

* Prevent code modification without disabling the tampering

* Fix missing addressing mode in LoadRegisterWithMemory

* Fix wrong addressing in RegisterConditional

* Add name to the tamper machine thread

* Fix code styling
2021-03-27 15:12:05 +01:00
mageven
e44850fed4
Implement friendlier portable mode (#1885)
* Implement friendlier portable mode

* Remove first run dialog

* Disable updates in portable mode for now

* Convert relative custom paths to absolute ones

Also, fix a regression when custom path doesn't exist
2021-03-15 22:10:36 +01:00
mageven
06a2b03cc9
Revise SystemInfo (#2047)
* Revise SystemInfo

Cleans up and adds a bit more info (logical core count and available mem at launch) to logs.

- Extract CPU name from CPUID when supported.
- Linux: Robust parsing of procfs files
- Windows: Prefer native calls to WMI
- Remove unnecessary virtual specifiers

* Address gdkchan's comments

* Address AcK's comments

* Address formatting nits
2021-03-01 15:22:00 +11:00
sharmander
d5081e3f93
Make windows DPI aware to display properly on high-resolution screens. (#1983)
* Make Windows DPI aware to display properly on high-resolution screens.

* remove empty line

* Don't use app manifest, set process dpi aware programatically.

Store variables in Program.cs for use instead of re-creating them per class/ method.

* Fix for linux/osx

* Add braces

* Re-use manifest. It appears to be required on linux.

* Undo previous commit -- it appears linux was simply never affected.

* Addressed AcK's comments

* Remove unused usings

* Address comments by AcK #2

* Re-order

* Move FromHwnd call to ForceDpiAware class. Wrap in Try-Catch to prevent crashes on systems that don't support it.

* Additional code cleanup

* Remove "global::" reference.
2021-02-20 01:34:41 +01:00
pineappleEA
6f1d964801
Hide Cursor On Idle (#1993)
* Implement "Hide Cursor On Idle" option

Adds a general option to autohide the cursor after 8s have elapsed.

* Fix cursor not hiding on Windows and dispose it

* Don't dispose cursor, fix var names

* Abide by the GNOME documentation

* Fix nits

* Disabled by default, make it so it doesn't utilize any timer

* Remove *NIX time and extra lines

* Don't calculate if option is disabled

* Move if case

* Fix alignment
2021-02-15 22:48:21 +01:00
Xpl0itR
94f93727cf
Load default config when an invalid config is found (#1008)
- Bind toggle events after setting up their current values. This fixes the issue where the config is saved 10 times when the main window is opened 😬

- Write to disk immediately to decrease the chances of corruption
2021-02-09 10:24:37 +01:00
ShahilSharma
9eb0ab05c6
Enable Docked Mode by Default (#1953)
Enables Docked Mode by default, since I see no reason to keep it off by Default.
2021-01-28 13:55:01 +11:00
EliEron
ad491b5570
Prevent Display Sleep on Windows while running a game (#1850)
Co-authored-by: EliEron <example@example.com>
2021-01-25 10:02:00 +11:00
Bruno Macabeus
1e5b37c94f
settings: add Show Confirm Exist toggle (#1856) 2021-01-14 23:30:52 +01:00
Ac_K
a9cb31e75f
gui: Refactoring Part 1 (#1859)
* gui: Refactoring Part 1

* Fix ProfileDialog.glade path

* Fix Application.Quit assert

* Fix TitleUpdateWindow parent

* Fix TitleUpdate selected item

* Remove extra line in TitleUpdateWindow

* Fix empty assign of Enum.TryParse

* Add Patrons list in the About Window

* update about error messages
2021-01-08 09:14:13 +01:00
EmulationFanatic
0a55657bd2
Enable Profiled Persistent Translation Cache (PPTC) by default (#1844)
* Enable Profiled Persistent Translation Cache (PPTC) by default

Enables PPTC by default. Enough time has passed and enough games tested that it should be the preferred setting for 99.9% of games. In case we are worried about PPTC files being put on the user's disk, shader cache already does this by default and generates about the same size files on average, so this should no longer be a concern.

* Update config.json with PTC set to true

* Updated _schema.json to set PPTC to true.
2021-01-01 15:36:47 +01:00
Ac_K
11222516c4
gui/gpu: Implement setting and toggle for Aspect Ratio (#1777)
* gui/gpu: Implement setting and toggle for Aspect Ratio

* address gdkchan feedback and add 16:10

* fix config.json file

* Fix rebase

* Address gdkchan feedback

* Address rip feedback

* Fix aspectWidth
2020-12-15 23:19:07 -03:00
gdkchan
19d18662ea
Correct type of executable sizes (#1802) 2020-12-13 08:30:27 +01:00
Ac_K
c0b9ac6653
ngct: Fix services and stub calls (#1756) 2020-12-10 03:08:28 +01:00
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
gdkchan
48278905d1
Rewrite scheduler context switch code (#1786)
* Rewrite scheduler context switch code

* Fix race in UnmapIpcRestorePermission

* Fix thread exit issue that could leave the scheduler in a invalid state

* Change context switch method to not wait on guest thread, remove spin wait, use SignalAndWait to pass control

* Remove multi-core setting (it is always on now)

* Re-enable assert

* Remove multicore from default config and schema

* Fix race in KTimeManager
2020-12-09 19:20:05 -03:00
Ac_K
668720b088
logger: Add build version to the log file names (#1782) 2020-12-07 20:29:22 +11:00
Xpl0itR
bd8d28c59d
Add option to start games in fullscreen mode (#1580)
* Add option to start games in fullscreen mode

* Add command line option

* Use pascal case on menu item
2020-12-01 23:02:27 +01:00
Ac_K
5e6dc37aed
common: Fix last warning in SystemInfo (#1757)
* common: Fix last warning in SystemInfo

* info to Info

* fix MacOSSystemInfo file name by delete the file

* MacOSSysteminfo to MacOSSystemInfo
2020-12-01 22:26:00 +01:00
Ac_K
a04a1b663d
config: Fix MaxAnisotropy value parsing (#1764) 2020-12-01 21:44:04 +01:00
Ac_K
b1877632cf
Remove some warnings and cleaning code (#1736) 2020-11-27 18:57:20 +01:00
Ac_K
c2356a7653
olsc: Add service olsc:u and stub some calls (#1734) 2020-11-20 09:56:23 +11:00
gdkchan
eafee34fee
Improvements with new .NET 5 functions or bugfixes (#1714)
* Improvements with new .NET 5 functions or bugfixes

* This no longer needs to be unsafe
2020-11-18 19:28:40 +01:00
Mary
aa129fdbdf
infra: Migrate to .NET 5 (#1694)
* infra: Migrate to .NET 5

This migrate projects and CI to .NET 5

* Remove language version restrictions (now on 9.0 by default)

* infra: pin .NET 5 to avoid later issues

* infra: Cleanup csproj files

* infra: update dependencies

* infra: Add temporary workaround for a bug in Vector128.Create

see https://github.com/dotnet/runtime/issues/44704 for more informations
2020-11-15 19:27:15 +01:00
Mary
48f6570557
Salieri: shader cache (#1701)
Here come Salieri, my implementation of a disk shader cache!

"I'm sure you know why I named it that."
"It doesn't really mean anything."

This implementation collects shaders at runtime and cache them to be later compiled when starting a game.
2020-11-13 00:15:34 +01:00
Mary
2ac0ce4557
Fix GetStream implementation (#1588)
Fix wrong argument usage on GetStream.

Doesn't change anything as it's not used but a nice catch from jD ^^.
2020-10-01 05:22:09 +02:00
emmauss
26319d5ab3
Add Motion controls (#1363)
* Add motion controls

Apply suggestions from code review

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

* cleanup

* add reference orientation and derive relative orientation from it

* cleanup

* remove unused variable and strange file

* Review_2.

* change GetInput to TryGetInput

* Review_3.

Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: LDj3SNuD <dvitiello@gmail.com>
2020-09-29 23:32:42 +02:00
MelonSpeedruns
a15459366e
Appveyor Ryujinx Updater (#1403)
Co-authored-by: Xpl0itR <xpl0itr@outlook.com>
2020-09-29 22:05:25 +02:00
Mary
4f3ae6f62c
Remove the Ryujinx.Debugger project (#1506)
This project wasn't really used by anyone and isn't worth mantaining.

This commit remove the profiler entirely from Ryujinx and remove the associated CI tasks.
2020-08-30 19:06:05 +02:00
mageven
b9398f1f3a
Allow launching with custom data directories (#1505)
* Allow launching with custom data directories

Don't load alternate keys when using custom directory

* Address gdkchan's comments

* Misc fixes to log levels

Added more enabled log levels by default

Moved successful config updation to Notice as
1. It's not a warning
2. Warnings could've been disabled by the config load and hence message
   would be lost
2020-08-30 18:51:53 +02:00
Mary
a389dd59bd
Amadeus: Final Act (#1481)
* Amadeus: Final Act

This is my requiem, I present to you Amadeus, a complete reimplementation of the Audio Renderer!

This reimplementation is based on my reversing of every version of the audio system module that I carried for the past 10 months.
This supports every revision (at the time of writing REV1 to REV8 included) and all features proposed by the Audio Renderer on real hardware.

Because this component could be used outside an emulation context, and to avoid possible "inspirations" not crediting the project, I decided to license the Ryujinx.Audio.Renderer project under LGPLv3.

- FE3H voices in videos and chapter intro are not present.
- Games that use two audio renderer **at the same time** are probably going to have issues right now **until we rewrite the audio output interface** (Crash Team Racing is the only known game to use two renderer at the same time).

- Persona 5 Scrambler now goes ingame but audio is garbage. This is caused by the fact that the game engine is syncing audio and video in a really aggressive way. This will disappears the day this game run at full speed.

* Make timing more precise when sleeping on Windows

Improve precision to a 1ms resolution on Windows NT based OS.
This is used to avoid having totally erratic timings and unify all
Windows users to the same resolution.

NOTE: This is only active when emulation is running.
2020-08-17 22:49:37 -03:00
mageven
e19193e073
Rename DebugLevel Performance to Slowdowns (#1450) 2020-08-07 15:30:06 +02:00
gdkchan
157ad3f54f
Silence several build warnings (#1428)
* Silence several build warnings

* Remove fixed buffers from NVDEC struct

* Remove unused field and usings

* Fix wrong name

* Silence more warning on H264 PictureInfo
2020-08-06 23:40:41 +02:00
mageven
a33dc2f491
Improved Logger (#1292)
* Logger class changes only

Now compile-time checking is possible with the help of Nullable Value
types.

* Misc formatting

* Manual optimizations

PrintGuestLog
PrintGuestStackTrace
Surfaceflinger DequeueBuffer

* Reduce SendVibrationXX log level to Debug

* Add Notice log level

This level is always enabled and used to print system info, etc...
Also, rewrite LogColor to switch expression as colors are static

* Unify unhandled exception event handlers

* Print enabled LogLevels during init

* Re-add App Exit disposes in proper order

nit: switch case spacing

* Revert PrintGuestStackTrace to Info logs due to #1407

PrintGuestStackTrace is now called in some critical error handlers
so revert to old behavior as KThread isn't part of Guest.

* Batch replace Logger statements
2020-08-04 01:32:53 +02:00
mageven
f0c91d9efb
Facilitate OpenGL debug logging via GUI (#1373)
* Allow printing GL Debug logs with GUI options

Improve GL Debugger

Make the new option persistent

Address gdkchan's comments
- Rename enum to GraphicsDebugLevel
- Move Debugger Init to Renderer Init
- Fix formatting

* nit: newlines
2020-08-02 16:41:24 +02:00
Ac_K
16bab8fb88
common: Fix WMI exception (#1422)
* common: Fix WMI exception

We currently don't check if WMI service is available when we get the CPU name and the RAM size.
This fix the issue by catching all exceptions and set default values instead.

Close #1353

* remove useless assign

* Fix Exception

* Address comments

Co-authored-by: Thog <me@thog.eu>
2020-07-30 21:02:06 +02:00
Ac_K
ca0d1f8205
ns/nim: Stub eShop related calls (#1420)
* ns/nim: Stub eShop related calls

As we aren't able to process purchase on the eShop throught the emulator, I have:
- Stub IPurchaseEventManager::SetDefaultDeliveryTarget (with RE check).
- Implement IPurchaseEventManager::GetPurchasedEventReadableHandle (with RE check).

As we can't do any eShop async call throught the emulator, I have:
- Stub IShopServiceAccessServerInterface::CreateServerInterface
- Stub IShopServiceAccessServer::CreateAccessorInterface
- Stub IShopServiceAccessor::IShopServiceAsync

Close #1084 and #1322

* fix handle copy

* Fix align

* Fix readonly event
2020-07-27 01:04:08 +02:00
gdkchan
4d02a2d2c0
New NVDEC and VIC implementation (#1384)
* Initial NVDEC and VIC implementation

* Update FFmpeg.AutoGen to 4.3.0

* Add nvdec dependencies for Windows

* Unify some VP9 structures

* Rename VP9 structure fields

* Improvements to Video API

* XML docs for Common.Memory

* Remove now unused or redundant overloads from MemoryAccessor

* NVDEC UV surface read/write scalar paths

* Add FIXME comments about hacky things/stuff that will need to be fixed in the future

* Cleaned up VP9 memory allocation

* Remove some debug logs

* Rename some VP9 structs

* Remove unused struct

* No need to compile Ryujinx.Graphics.Host1x with unsafe anymore

* Name AsyncWorkQueue threads to make debugging easier

* Make Vp9PictureInfo a ref struct

* LayoutConverter no longer needs the depth argument (broken by rebase)

* Pooling of VP9 buffers, plus fix a memory leak on VP9

* Really wish VS could rename projects properly...

* Address feedback

* Remove using

* Catch OperationCanceledException

* Add licensing informations

* Add THIRDPARTY.md to release too

Co-authored-by: Thog <me@thog.eu>
2020-07-12 05:07:01 +02:00
mageven
189c0c9c72
Implement modding support (#1249)
* Implement Modding Support

* Executables: Rewrite to use contiguous mem and Spans

* Reorder ExeFs, Npdm, ControlData and SaveData calls

After discussion with gdkchan, it was decided it's best to call
LoadExeFs after all other loads are done as it starts the guest process.

* Build RomFs manually instead of Layering FS

Layered FS approach has considerable latency when building the final
romfs. So, we manually replace files in a single romfs instance.

* Add RomFs modding via storage file

* Fix and cleanup MemPatch

* Add dynamically loaded NRO patching

* Support exefs file replacement

* Rewrite ModLoader to use mods-search architecture

* Disable PPTC when exefs patches are detected

Disable PPTC on exefs replacements too

* Rewrite ModLoader, again

* Increased maintainability and matches Atmosphere closely
* Creates base mods structure if it doesn't exist
* Add Exefs partition replacement
* IPSwitch: Fix nsobid parsing

* Move mod logs to new LogClass

* Allow custom suffixes to title dirs again

* Address nits

* Add a per-App "Open Mods Directory" context menu item

Creates the path if not present.

* Normalize tooltips verbiage

* Use LocalStorage and remove unused namespaces
2020-07-09 14:31:15 +10:00
riperiperi
484eb645ae
Implement Zero-Configuration Resolution Scaling (#1365)
* Initial implementation of Render Target Scaling

Works with most games I have. No GUI option right now, it is hardcoded.

Missing handling for texelFetch operation.

* Realtime Configuration, refactoring.

* texelFetch scaling on fragment shader (WIP)

* Improve Shader-Side changes.

* Fix potential crash when no color/depth bound

* Workaround random uses of textures in compute.

This was blacklisting textures in a few games despite causing no bugs. Will eventually add full support so this doesn't break anything.

* Fix scales oscillating when changing between non-native scales.

* Scaled textures on compute, cleanup, lazier uniform update.

* Cleanup.

* Fix stupidity

* Address Thog Feedback.

* Cover most of GDK's feedback (two comments remain)

* Fix bad rename

* Move IsDepthStencil to FormatExtensions, add docs.

* Fix default config, square texture detection.

* Three final fixes:

- Nearest copy when texture is integer format.
- Texture2D -> Texture3D copy correctly blacklists the texture before trying an unscaled copy (caused driver error)
- Discount small textures.

* Remove scale threshold.

Not needed right now - we'll see if we run into problems.

* All CPU modification blacklists scale.

* Fix comment.
2020-07-07 04:41:07 +02:00
Xpl0itR
7cb6532971
Implement audio backend configuration option (#1325)
* Implement audio backend configuration option

* Use OpenAL by default

* Increment version number in config.json

and add 30px to the height of the settings window

* nits

* capitalise audio backend names
2020-07-04 01:16:49 +02:00
Xpl0itR
68a6960617
Remember GUI column sort and separate hotkey settings from emulated input settings (#1223)
* Separate hotkey settings from emulated input settings

* Remember gui column sort

* nit

* fix schema

* nit

* Remove unused SaveDataPath to speed up game list loading

* Reset the vertical scrollbar to the top when titles finish loading
2020-06-26 12:30:16 +02:00
Xpl0itR
2ed9db1fcd
Implement dlc management window (#1313)
* Implement dlc management window

* reduce repetition

* Implement per NCA toggling of DLC rather than per container
2020-06-23 10:32:07 +10:00
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
ce983f360b
Change console log to discard on overflow (#1241) 2020-06-09 20:22:54 -03:00
Mary
651a07c6c2
Refactor SystemInfo and implement macOS system info backend (#1177) 2020-05-04 12:15:27 +10:00
Ac_K
4c54f36c38
Upgrade projects to C#8 (#1193)
Some parts of our code needs C# 8 who isn't set as default in Visual Studio. To fix this we have to set the C# version correctly in the csproj files and then we are be able to build the project using Visual Studio.
2020-05-04 12:14:48 +10:00
Thog
80d0cc7d6f system: Make index 0 of keyboards in configuration 'all keyboards' 2020-05-03 15:00:29 +02:00
Xpl0itR
538fba826b
Improvements to input and input configuration in the GUI. (#849)
* Improvements to input and input configuration in the GUI

* Requested changes

* nits

* more nits
2020-05-03 04:00:53 +02:00
Thog
886e42fb19
Use the official JSON parser (#1151)
This remove Utf8son and JsonPrettyPrinter dependencies.

NOTE: the standard JSON parser doesn't support configurable
indentation, as a result, all the pretty printed JSON are indented with 2
spaces.
2020-04-30 14:07:41 +02:00
Thog
486f3163f3
Fix hbl 2.3.1 and hbmenu 3.3.0 (#1171)
* Fix hbl 2.3.1 and hbmenu 3.3.0

* log class: Add ServicePtm

* fix build issue

* do not cast titleId to byte

* Address Ac_K's comment
2020-04-28 11:44:29 +10:00
Xpl0itR
a065dc1626
Log Ryujinx Version, OS Name, CPU Name and RAM size (#1102)
* Log Ryujinx version and OS

* Log total RAM size and CPU name

* Requested changes

* requested change

* jd's requested changes

* jd's requested changes
2020-04-25 23:01:32 +10:00
Michael Kuklinski
c46edfab85
Update .NET Core to 3.1, and update NuGet Packages (#1121)
* Updated all NuGet packages to latest, and updated the framework from .NET Core 3.0 to 3.1.

* Updating appveyor settings for 3.1

Updating appveyor to use the netcoreapp3.1 path instead of 3.0.

* Removing unneeded NuGet package System.Runtime.CompilerServices.Unsafe.

* Removing unused NuGet package SharpFontCore.

* Removing unused NuGet package TimeZoneConverter.Posix

* Cleaning up by adding newline to a csproj.

* Simplfying a NuGet conditional include, and adding a warning disable for an annoying NuGet package.

* I'm not sure if .travis.yml is still used, but I'm updating its 'dotnet' version to the correct SDK.

* Making the runtime version into its own environment variable so it's a bit easier to change in the future.

* Removing OpenTK.NetStandard reference from Ryujinx.Common

* Fixing indentation in Common.csproj

* Updating the README to specify .NET Core 3.1.

* Reverting the update of the GTKSharp package so it doesn't block the PR.
2020-04-22 14:13:41 +10: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
CJ Bok
0a7c6caedf
System Time Offset Implementation (#1101)
* System Time Offset Implementation

* Addressed @Thog's comments

* Addressed JD's comments

* Addressed @Thog's and @AcK77's comments

* formatting correction
2020-04-17 09:18:54 +10:00
Xpl0itR
ad3d2fb5a9
Implement update loader and log loaded application info (#1023)
* Implement update loader

* Add title version to titlebar and log loaded application info

* nits

* requested changes
2020-04-12 23:02:37 +02:00
Xpl0itR
12d49c37d2
Make max anisotropy configurable (#1043)
* Make max anisotropy configurable

* Move opengl command to opengl project

* Add GUI option
2020-03-31 08:38:52 +11:00
Thog
0dd38028cb
Make Device Location Name configuration (custom TZ) (#1031)
This permit to use arbitrary timezone (instead of UTC).

Useful for games like ACNH.
2020-03-26 09:23:21 +11:00
jduncanator
82c3df83c4
prepo: Add a MessagePack object formatter (#1034) 2020-03-26 08:33:18 +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
BaronKiko
505f95848b
Reducing log sizes (#724)
* Separated out log's into a separate file for each run. It will keep up to 3

* Rebase part 2

Co-authored-by: Andy Adshead <andy.075109@hotmail.co.uk>
2020-02-12 12:18:33 +11:00
emmauss
3aa3c4261a
Add inbuilt Opengl renderer to window (#922)
* add gl rendering widget

* embed renderer into main window

* add input

* fix mouse input

* fix mouse coords

* refresh game list after closing game, remove profiler method

* rebase, hide game list progress bar while game is running

* Some bug fixes

Changelog:

- Reapply some changes that got lost while rebasing from #904
- Make sure to guarantee exclusivity on the GL context (fixing multiple
possible race conditions on Windows)
- Avoid making GLRenderer disposed multiple time

* add fullscreen,  enable input on focus, disable aplha

* addressed comments

* Disable transparency in the window

* fix fullscreen state, fix focus, addressed comments

* nit

* addressed nit

Co-authored-by: Thog <thog@protonmail.com>
2020-02-12 01:56:19 +01:00
riperiperi
6db16b4110
Only enumerate cached textures that are modified when flushing. (#918)
* Only enumarate cached textures that are modified when flushing, rather than all of them.

* Remove locking.

* Add missing clear.

* Remove texture from modified list when data is disposed.

In case the game does not call either flush method at any point.

* Add ReferenceEqualityComparer from jD for the HashSet
2020-02-07 08:49:26 +11:00
emmauss
f2b9a9c2b0
Render Profiler in GUI (#854)
* move profiler output to gui

* addressed commits, rebased

* removed whitespaces
2020-02-06 11:25:47 +00:00
Thog
db9f8f999f
Implement IDeliveryCacheProgressService in bcat (#908)
* Implement IDeliveryCacheProgressService in bcat

This stub IDeliveryCacheProgressService IPC interface as we don't plan
to support cache delivery.

* Address jd's comments

* Address jd's comment correctly

* Address gdk's comments
2020-02-06 05:09:59 +01:00
Ac_K
5facc0c07f Name all threads (#886)
* Name all threads

Close #874

* use ThreadName instead of ThreadId in Logging
2020-01-13 01:21:54 +01:00
gdkchan
29a825b43b Address PR feedback
Removes a useless null check

Aligns some values to improve readability
2020-01-09 02:13:00 +01:00
gdkchan
18814d44b2 Address PR feedback
Add TODO comment for GL_EXT_polygon_offset_clamp
2020-01-09 02:13:00 +01:00
Alex Barney
d1ab9fb42c ASTC optimizations (#845)
* ASTC optimizations

* Move code to Ryujinx.Common

* Support 3D textures

* Address feedback

* Remove ASTC logging

* Use stackalloc instead of a Buffer20 struct

* Code style and cleanup

* Respond to feedback

* Rearrange public/private property ordering
2020-01-09 02:13:00 +01:00
gdk
278a4c317c Implement BFI, BRK, FLO, FSWZADD, PBK, SHFL and TXD shader instructions, misc. fixes 2020-01-09 02:13:00 +01:00
gdk
1876b346fe Initial work 2020-01-09 02:13:00 +01:00
Thog
40039c5631
Fix ReactiveObject initial event not being propagated with boolean types (#860)
* Fix ReactiveObject initial event not being propagated with boolean types.

This fix the logger configuration initial state being ignored.
2020-01-05 17:35:55 +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
Ac_K
bb74aeae54 Use BinaryPrimitives.ReverseEndianness instead EndianSwap class (#832)
This PR remove the `EndianSwap` class who isn't needed anymore since .NET Core 3.0 got a buildin method `BinaryPrimitives.ReverseEndianness` who did the same thing.
2019-11-23 13:15:15 +11:00
Ac_K
cfcc360d06 ldn: Implement calls of UserLocalCommunicationService (#829)
* ldn: Implement calls of UserLocalCommunicationService

- Implement `IUserServiceCreator: CreateUserLocalCommunicationService` according to RE.
- Implement `IUserLocalCommunicationService` calls:
  - Every calls in this interface are layered to `NetworkInterface`.
  - `GetState` according to RE.
  - `InitializeOld`, `Initialize` and `Finalize` stubbed with the appropriate result code and some TODO according to RE.
  - `AttachStateChangeEvent` according to RE.

* Fix var name and TODO comments

* Fix review
2019-11-21 13:24:06 +01:00
LDj3SNuD
eee639d6ba .NET Core 3.0 is here! (#784)
* .NET Core 3.0 is here!

* Remove IMemoryManager.cs and its references.

* Add T Math/F.FusedMultiplyAdd(T, T, T). Nits.

* Nit.

* Update appveyor.yml

* Revert "Resolve Visual Studio build issues"

This reverts commit 1772128ce0.

* Update SvcTable.cs
2019-10-31 19:09:03 +01:00
Thomas Guillemard
9142aca48f Fix hwopus DecodeInterleaved implementation (#786)
* Fix hwopus DecodeInterleaved implementation

Also implement new variants of this api.

This should fix #763

* Sample rate shouldn't be hardcoded

This fix issues while opening Pokémon Let's Go pause menu.

* Apply Ac_K's suggestion about EndianSwap

* Address gdkchan's comment

* Address Ac_k's comment
2019-10-11 17:22:24 +02:00
LDj3SNuD
72b9f8f0a0 Misc fixes (#772)
* Update Logger.cs

* Update MainWindow.cs

* Update SvcTable.cs

* Update SvcTable.cs

* Update SvcTable.cs
2019-09-19 20:59:48 -03:00
Ac_K
333651d346 Implement Bluetooth, Btm, Hid and Nsd services and calls. (#761)
- Implement `btdrv` service (IBluetoothDriver).
  Implement call `InitializeBluetoothLe` for initialize events of `bt` service according to RE.

- Implement `bt` service (IBluetoothUser).
  Implement call `RegisterBleEvent` according to RE.

- Add a placeholder for the `btm` service (close #750).

- Implement `btm:u` service (IBtmUser) (close #751).
  Implement call `GetCore` according to RE (close #752).

- Implement `IBtmUserCore` and calls `AcquireBleScanEvent`, `AcquireBleConnectionEvent`, `AcquireBleServiceDiscoveryEvent` and `AcquireBleMtuConfigEvent` according to RE.

- Implement `SetPalmaBoostMode` in `IHidServer` according to RE.

- Add stub for `SetIsPalmaAllConnectable` in `IHidServer` because we will not support Palma devices soon.

- Implement `nsd:a` and `nsd:u` service (IManager) (close #755).
  Implement call `ResolveEx` according to RE (close #756).
  Implement calls `GetSettingName`, `GetEnvironmentIdentifier`, `GetDeviceId`, `DeleteSettings`, `Resolve`, `ReadSaveDataFromFsForTest`, `WriteSaveDataToFsForTest` and `DeleteSaveDataOfFsForTest` according to RE.
2019-09-06 16:58:50 +02:00
gdkchan
a731ab3a2a Add a new JIT compiler for CPU code (#693)
* Start of the ARMeilleure project

* Refactoring around the old IRAdapter, now renamed to PreAllocator

* Optimize the LowestBitSet method

* Add CLZ support and fix CLS implementation

* Add missing Equals and GetHashCode overrides on some structs, misc small tweaks

* Implement the ByteSwap IR instruction, and some refactoring on the assembler

* Implement the DivideUI IR instruction and fix 64-bits IDIV

* Correct constant operand type on CSINC

* Move division instructions implementation to InstEmitDiv

* Fix destination type for the ConditionalSelect IR instruction

* Implement UMULH and SMULH, with new IR instructions

* Fix some issues with shift instructions

* Fix constant types for BFM instructions

* Fix up new tests using the new V128 struct

* Update tests

* Move DIV tests to a separate file

* Add support for calls, and some instructions that depends on them

* Start adding support for SIMD & FP types, along with some of the related ARM instructions

* Fix some typos and the divide instruction with FP operands

* Fix wrong method call on Clz_V

* Implement ARM FP & SIMD move instructions, Saddlv_V, and misc. fixes

* Implement SIMD logical instructions and more misc. fixes

* Fix PSRAD x86 instruction encoding, TRN, UABD and UABDL implementations

* Implement float conversion instruction, merge in LDj3SNuD fixes, and some other misc. fixes

* Implement SIMD shift instruction and fix Dup_V

* Add SCVTF and UCVTF (vector, fixed-point) variants to the opcode table

* Fix check with tolerance on tester

* Implement FP & SIMD comparison instructions, and some fixes

* Update FCVT (Scalar) encoding on the table to support the Half-float variants

* Support passing V128 structs, some cleanup on the register allocator, merge LDj3SNuD fixes

* Use old memory access methods, made a start on SIMD memory insts support, some fixes

* Fix float constant passed to functions, save and restore non-volatile XMM registers, other fixes

* Fix arguments count with struct return values, other fixes

* More instructions

* Misc. fixes and integrate LDj3SNuD fixes

* Update tests

* Add a faster linear scan allocator, unwinding support on windows, and other changes

* Update Ryujinx.HLE

* Update Ryujinx.Graphics

* Fix V128 return pointer passing, RCX is clobbered

* Update Ryujinx.Tests

* Update ITimeZoneService

* Stop using GetFunctionPointer as that can't be called from native code, misc. fixes and tweaks

* Use generic GetFunctionPointerForDelegate method and other tweaks

* Some refactoring on the code generator, assert on invalid operations and use a separate enum for intrinsics

* Remove some unused code on the assembler

* Fix REX.W prefix regression on float conversion instructions, add some sort of profiler

* Add hardware capability detection

* Fix regression on Sha1h and revert Fcm** changes

* Add SSE2-only paths on vector extract and insert, some refactoring on the pre-allocator

* Fix silly mistake introduced on last commit on CpuId

* Generate inline stack probes when the stack allocation is too large

* Initial support for the System-V ABI

* Support multiple destination operands

* Fix SSE2 VectorInsert8 path, and other fixes

* Change placement of XMM callee save and restore code to match other compilers

* Rename Dest to Destination and Inst to Instruction

* Fix a regression related to calls and the V128 type

* Add an extra space on comments to match code style

* Some refactoring

* Fix vector insert FP32 SSE2 path

* Port over the ARM32 instructions

* Avoid memory protection races on JIT Cache

* Another fix on VectorInsert FP32 (thanks to LDj3SNuD

* Float operands don't need to use the same register when VEX is supported

* Add a new register allocator, higher quality code for hot code (tier up), and other tweaks

* Some nits, small improvements on the pre allocator

* CpuThreadState is gone

* Allow changing CPU emulators with a config entry

* Add runtime identifiers on the ARMeilleure project

* Allow switching between CPUs through a config entry (pt. 2)

* Change win10-x64 to win-x64 on projects

* Update the Ryujinx project to use ARMeilleure

* Ensure that the selected register is valid on the hybrid allocator

* Allow exiting on returns to 0 (should fix test regression)

* Remove register assignments for most used variables on the hybrid allocator

* Do not use fixed registers as spill temp

* Add missing namespace and remove unneeded using

* Address PR feedback

* Fix types, etc

* Enable AssumeStrictAbiCompliance by default

* Ensure that Spill and Fill don't load or store any more than necessary
2019-08-08 21:56:22 +03:00
Alex Barney
b2b736abc2 Misc cleanup (#708)
* Fix typos

* Remove unneeded using statements

* Enforce var style more

* Remove redundant qualifiers

* Fix some indentation

* Disable naming warnings on files with external enum names

* Fix build

* Mass find & replace for comments with no spacing

* Standardize todo capitalization and for/if spacing
2019-07-02 04:39:22 +02:00
Thomas Guillemard
db21621bb6 PrntStub: Add a way to print arrays (#711)
* PrntStub: Add a way to print arrays

This commit adds support for printing arrays in stubs (useful for IPC InBuffer/InPointer).
This also add an util to parse an array of structure from a BinaryReader

* Fix missing space

Co-Authored-By: Ac_K <Acoustik666@gmail.com>
2019-06-27 13:11:51 +02:00
Alex Barney
350a3667f7 Implement OutputAccessLogToSdCard and expose an FS access log option (#700)
* Add OutputAccessLogToSdCard

* Add config options for the FS access log
2019-06-16 03:31:18 +02:00
BaronKiko
a07086c280 Built in profiling (#567)
* Profiler initial setup

* Capture actual timing data

* Profiling data dumped to file on close

* Support for multiple sessions under the same name

* Service profiling

* Sort output for easier read

* csv output

* Split session into 2 seperate values

* Refactor name to category

* Basic profiling window dummy. Toggle with F1 or set key with config
No actual data displayed yet, just a pretty triangle

* Simple font rendering

* Display some actual timing data

* Fix font bearing being ignored

* x bearing and advance. Fixed y bearing calc

* Different coloured lines to make reading easier

* Scrolling

* Multiple columns for name

* Column titles

* display in ms rather than ticks

* Bars to display times

* Sortable columns

* Regex filtering

* Better instant timing calculation
Fixed minor regex bug

* Better filtering
Better max value calculation
Skip some rendering to reduce profiler weight

* Variable update rate

* Show/hide inactive button
Some other touchups

* Add missing project reference

* Hide inactive and pause

* Fix viewport errors

* Update initial window position

* Variable name cleanup

* Disable timing dump by default

* Internal Profile refactor and cleanup

* Timing info cleanup

* Profile config cleanup

* Settings cleanup

* Button refactor

* Profile refactor

* Profile window cleanup

* Window manager refactor

* Font service cleanup

* Fixed bug in profiling method where method was called twice without profiling enabled

* Allow update rates of less than 1hz

* Stop using window.run because it's apparently not great for performance.
Some other performance things, should only draw a new frame when something has changed

* Improved time tracking to keep history

* Profile window was getting too long so I added regions and split bar rendering out into partial class

* Dummy graph view with button to toggle

* Realtime graphing initial commit

* Display totals on new bar

* Simple zooming support with arrow keys

* Limit graph zoom and label start and stop

* Added support for timing flags

* Stop data running away when paused and frame updated

* Manual step button

* Update at when flag issued (ie every frame)

* Removed useless finish profiling call

* Enable and disable profiling at compile time.

* Better plage for frame swap flag, also kept enough flags to cover larger time spans

* No more stopwatches created, uses PerformanceCounter now

* public and internal fields to props

* Move visible update to update rather than draw as it causes a lockup if called from draw
Also added profile window disposal so closing main window closes profiler too

* Fixed optimization settings for profiled builds

* Appveyer script guess to add profiling builds

* Quotes

* 1 less quote

* Maybe escape space?

* Specify config

* Different approach

* Fix file paths

* Fix another path

* Better artifact naming

* Missing -

* test  string

* Removed for, to test

* readd for

* moved dashes around so artifacts can begin with letters

* quote env vars

* martix

* Removed configs

* Much more efficient capture, ConcurrentDictionary was causing too much overhead

* Skip repeating pixels during draw

* Stop ram usage getting too high. Compensating for cleanup doing more now

* Profile CPU, execute skipped because it's just too much work

* Fixed bug with skipping draws. Furthest needed to be reset every loop

* Less distracting colour for timing flags

* Removed profile method function. It just doesn't play nice with conditional compilation so best to remove it now before it's used a lot

* Null check for category, group and item

* Forgot to reset instant count/time

* Increment line when blank

* Fix threading conflict
Fixed instant count and time. Now accuratly represents the total time and count in the buffer

* Fixed bug in time rendering where times were being trimmed to an int.
Also added  microsecond/millisecond formatting to reduce the number of decimal places needed

* Support for multiple profiling levels

* Sometimes it would have to wait a long time for lock to clear so moved it to a tryenter and skip if already locked

* Dumb bug regarding clearing of timestamps. Start is already removed so no need to add it to the start

* Optimisations in drawing routine:
Only calculate bar top and bottom once per bar rather than once per timestamp
Pre-calculate the right side of the graph as it was being calculated multiple times per bar
Skip rendering timestamps that occupy the same pixel space now uses the raw timestamp to decide. While technically not as accurate it's much easier as the right side of the bar doesn't have to be calculated for a skipped timestamp

* Couple alignment changes

* Custom equals overload for profile config. The default implpmentation was just too slow

* Bump cleanup thread priority. It clears the timer queue so it need to be run frequently

* Fixed bug with scrolling caused by recent rendering optimisations. Simply forgot to increment the line index on a skipped line

* Stopped blocking memory disposal so much. Also parralised(?) cleanup call

* Uses Arial for font.

* Enable AA

* Inital seperated config support

* Fix profile input from keyboard

* Check toggle visible key from profiler

* Can't use conditional here as _profileWindow doesn't exist it non-profiling build

* Removed junk from merge in sln

* Fromatting cleanup for review

* Fiked small bug caused by race condition

* Added multiple flags with colours
Added way to set max flags

* Fixed flag times
Dispays time flags in window

* Colors for text frame times

* enable and disable flags button added
better fix for race crash

* Re factored npad out

* Explicitly specified type in foreach

* Removed extra line

* Added s to fix nit

* Comment to clarify default time

* Another s nit

* Ordering nit

* Uses Interlocked.Increment over lock

* Unindented #if's and #regions

* Comment to clarify these are indexes in the list

* Uses iequatable over override equals to avoid conversion and checks at runtime

* Removed no longer used variable
2019-04-26 14:53:10 +10:00
LDj3SNuD
1bef70c068 Add Rshrn_V & Shrn_V Sse opt.. Add Mla_V, Mls_V & Mul_V Sse opt.; add Tests. (#614)
* Update CountLeadingZeros().

* Remove obsolete Tests.

* Follow-up.

* Follow-up.

* Follow-up.

* Add Mla_V, Mls_V & Mul_V Tests.

* Update PackageReferences.

* Remove EmitLd/Stvectmp2().

* Remove Dup. Nits.

* Remove EmitLd/Stvectmp2() & Dup; nits.

* Remove Tmp stuff & Dup; rework Fcvtz() as Fcvtn().

* Remove Tmp stuff, EmitLd/Stvectmp2() & Dup. Nits.

* Add (R)shrn_V Sse opt.; add "Part" & "Shift" opt..

Remove Tmp stuff; remove Dup.
Nits.

* Add Mla/Mls/Mul_V Sse opt.. Add "Part" opt..

Remove EmitLd/Stvectmp2(), remove Dup.
Nits.

* Nits.

* Nits.

* Nit.

* Add "Part" opt.. Nit.

* Nit.

* Nit.

* Add Cmhi_V & Cmhs_V Sse opt..
2019-03-13 19:23:52 +11:00
Thomas Guillemard
884b4e5fd3 Initial non 2D textures support (#525)
* Initial non 2D textures support

- Shaders still need to be changed
- Some types aren't yet implemented

* Start implementing texture instructions suffixes

Fix wrong texture type with cube and TEXS

Also support array textures in TEX and TEX.B

Clean up TEX and TEXS coords managment

Fix TEXS.LL with non-2d textures

Implement TEX.AOFFI

Get the right arguments for TEX, TEXS and TLDS

Also, store suffix operands in appropriate values to support multiple
suffix combinaisons

* Support depth in read/writeTexture

Also support WrapR and detect mipmap

* Proper cube map textures support + fix TEXS.LZ

* Implement depth compare

* some code clean up

* Implement CubeMap textures in OGLTexture.Create

* Implement TLD4 and TLD4S

* Add Texture 1D support

* updates comments

* fix some code style issues

* Fix some nits + rename some things to be less confusing

* Remove GetSuffix local functions

* AOFFI => AOffI

* TextureType => GalTextureTarget

* finish renaming TextureType to TextureTarget

* Disable LL, LZ and LB support in the decompiler

This needs more work at the GL level (GLSL implementation should be
right)

* Revert "Disable LL, LZ and LB support in the decompiler"

This reverts commit 64536c3d9f673645faff3152838d1413c3203395.

* Fix TEXS ARRAY_2D index

* ImageFormat depth should be 1 for all image format

* Fix shader build issues with sampler1DShadow and texture

* Fix DC & AOFFI combinaison with TEX/TEXS

* Support AOFFI with TLD4 and TLD4S

* Fix shader compilation error for TLD4.AOFFI with no DC

* Fix binding isuses on the 2d copy engine

TODO: support 2d array copy

* Support 2D array copy operation in the 2D engine

This make every copy right in the GPU side.
Thie CPU copy probably needs to be updated

* Implement GetGpuSize + fix somes issues with 2d engine copies

TODO: mipmap level in it

* Don't throw an exception in the layer handling

* Fix because of rebase

* Reject 2d layers of non textures in 2d copy engine

* Add 3D textures and mipmap support on BlockLinearSwizzle

* Fix naming on new BitUtils methods

* gpu cache: Make sure to invalidate textures that doesn't have the same target

* Add the concept of layer count for array instead of using depth

Also cleanup GetGpuSize as Swizzle can compute the size with mipmap

* Support multi layer with mip map in ReadTexture

* Add more check for cache invalidation & remove cubemap and cubemap array code for now

Also fix compressed 2d array

* Fix texelFetchOffset shader build error

* Start looking into cube map again

Also add some way to log write in register in engines

* fix write register log levles

* Remove debug logs in WriteRegister

* Disable AOFFI support on non NVIDIA drivers

* Fix code align
2019-02-28 12:12:24 +11: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
emmauss
c81abdde4c Add file logging and handle unhandled exceptions (#558)
* add unhandled exception handler

* added file logging

* add option in config

* consolidated console and file log
2019-01-30 23:49:15 -03:00
jduncanator
8406ec6272 Refactor Ryujinx.Common and HLE Stub Logging (#537)
* Refactor Ryujinx.Common and HLE Stub Logging

* Resolve review comments

* Rename missed loop variable

* Optimize PrintStub logging function

* Pass the call-sites Thread ID through to the logger

* Remove superfluous lock from ConsoleLog

* Process logged data objects in the logger target

Pass the data object all the way to the output logger targets, to allow them to "serialize" this in whatever appropriate format they're logging in.

* Use existing StringBuilder to build the properties string

* Add a ServiceNotImplemented Exception

Useful for printing debug information about unimplemented service calls

* Resolve Style Nits

* Resolve Merge Issues

* Fix typo and align declarations
2019-01-11 01:11:46 +01:00
Thomas Guillemard
b4d91402c6 Some improvements for nvnflinger (#555)
* Initial fixes for last release of libnx

For now, the framebuffer aren't okay but it will not crash/

* Improve code reaadability in NvFlinger parsing

* Make surfaces access more userfriendly

* Add ColorFormat

* Fix code style in ColorFormat.cs

* Add multiple framebuffer support in nvnflinger

This fix libnx console rendering

* Move ReadStruct/WriteStruct to Ryujinx.Common

* fix the last nit

* Fix inverted color for R5G6B5

Also add some other format that libnx might uses.

* Remove hardcoded BlockHeight in nvflinger
2019-01-05 22:26:16 +01:00