* audout: Implement GetAudioOutBufferCount, GetAudioOutPlayedSampleCount and FlushAudioOutBuffers
This PR implement audout service calls:
- GetAudioOutBufferCount
- GetAudioOutPlayedSampleCount
- FlushAudioOutBuffers
The RE calls just give some hints about no extra checks.
Since we use a totally different implementation because of our backend, I can't do something better for now.
SetAudioOutVolume and GetAudioOutVolume are fixed too by set/get the volume of the current opened track, previous implementation was wrong.
This fix#1133, fix#1258 and fix#1519.
Thanks to @jduncanator for this help during the implementation and all his precious advices.
* Fix some debug leftovers
* Address jD feedback
* 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
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
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.
Changes:
Implement software surround downmixing (fix#796).
Fix a crash when no audio renderer were created when stopping emulation.
NOTE: This PR also disable support of 5.1 surround on the OpenAL backend as we cannot detect if the hardware directly support it. (the downmixing applied by OpenAL on Windows is terribly slow)
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.
* 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.
* 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>
* Fix a crash when closing the main Ui
Also make sure to dispose the OpenAL context to not leak memory when
unloading the emulation context.
* Improve keys and 'game already running' dialogs
* Make sure to dispose the page table and ThreadContext
Less memory leaks!
* Fix tests
* Address gdk's comments
* audout:u: Implement SetAudioOutVolume and GetAudioOutVolume
- Implementation of `audout:u` SetAudioOutVolume and GetAudioOutVolume (checked with RE).
- Add Get and Set for Volume into audio backends.
- Cleanup of all audio backends to follow the `IAalOutput` structure and .NET standard.
- Split OpenAL backend into 2 files for consistency.
* Address comments
* Fix the volume calculation
* 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
* 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
* 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
* Audio: Select a shared audio device by default
This ensures that a non-raw audio device is selected wherever possible.
* Audio: Resolve libsoundio version mismatch between bindings and binaries
It turns out we were using bindings generated with libsoundio 1.1.0 git source, but the binaries we were using were built from master git source. I've rebuilt both binaries and bindings to ensure they are version matched.
This should resolve all outstanding issues with libsoundio (including the Linux segfault issue, and the "cannot open device" Windows issue).
* Audio: Reformat MarshalExtensions
* Resolve code indentation issues
* Audio: Properly implements audio fallback for SoundIO
Given some drivers have issues with SoundIO (for the time being), this attempts to detect if SoundIO can open the default audio device, and then return false in IsSupported if it can't.
* Audio: Handle the backend disconnected event
libsoundio panics by default when a backend disconnects, this catches that event and gracefully handles it.
* Audio: Fix styling nits
* Audio: Fix nits
Because Ac_K. 😫
* Audio: Implement libsoundio as an alternative audio backend
libsoundio will be preferred over OpenAL if it is available on the machine. If neither are available, it will fallback to a dummy audio renderer that outputs no sound.
* Audio: Fix SoundIoRingBuffer documentation
* Audio: Unroll and optimize the audio write callback
Copying one sample at a time is slow, this unrolls the most common audio channel layouts and manually copies the bytes between source and destination. This is over 2x faster than calling CopyBlockUnaligned every sample.
* Audio: Optimize the write callback further
This dramatically reduces the audio buffer copy time. When the sample size is one of handled sample sizes the buffer copy operation is almost 10x faster than CopyBlockAligned.
This works by copying full samples at a time, rather than the individual bytes that make up the sample. This allows for 2x or 4x faster copy operations depending on sample size.
* Audio: Fix typo in Stereo write callback
* Audio: Fix Surround (5.1) audio write callback
* Audio: Update Documentation
* Audio: Use built-in Unsafe.SizeOf<T>()
Built-in `SizeOf<T>()` is 10x faster than our `TypeSize<T>` helper. This also helps reduce code surface area.
* Audio: Keep fixed buffer style consistent
* Audio: Address styling nits
* Audio: More style nits
* Audio: Add additional documentation
* Audio: Move libsoundio bindings internal
As per discussion, moving the libsoundio native bindings into Ryujinx.Audio
* Audio: Bump Target Framework back up to .NET Core 2.1
* Audio: Remove voice mixing optimizations.
Leaves Saturation optimizations in place.
* 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
* Partial voice implementation on audio renderer
* Implemented audren resampler (based on original impl)
* Fix BiquadFilter struct
* Pause audio playback on last stream buffer
* Split audren/audout files into separate folders, some minor cleanup
* Use AudioRendererParameter on GetWorkBufferSize aswell
* Bump audren version to REV4, name a few things, increase sample buffer size
* Remove useless new lines
* Add support for events, move concept of domains to IpcService
* Support waiting for KThread, remove some test code, other tweaks
* Use move handle on NIFM since I can't test that now, it's better to leave it how it was