aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS
AgeCommit message (Collapse)Author
2023-04-27Move solution and projects to srcTSR Berry
2023-04-25Add missing check for thread termination on ArbitrateLock (#4722)gdkchan
* Add missing check for thread termination on ArbitrateLock * Use TerminationRequested in all places where it can be used
2023-04-24Reducing Memory Allocations 202303 (#4624)jhorv
* use ArrayPool, avoid 6000-7000 allocs/sec of runtime * use ArrayPool, avoid ~7k allocs/second during game execution * use ArrayPool, avoid ~3000 allocs/sec during game execution * use MemoryPool, reduce 0.5 MB/sec of new allocations during game execution * avoid over-allocation by setting List<> Capacity when known * remove LINQ in KTimeManager.UnscheduleFutureInvocation * KTimeManager - avoid spinning one more time when the time has arrived * KTimeManager - let SpinWait decide when to Thread.Yield(), and don't SpinOnce() immediately after Thread.Yield() * use MemoryPool, reduce ~175k bytes/sec allocation during game execution * IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array * Make ButtonMappingEntry a record struct to avoid allocations. Set the List<ButtonMappingEntry> capacity according to use. * add MemoryBuffer type for working with MemoryPool<byte> * update changes to use MemoryBuffer * make parameter ReadOnlySpan instead of Span * whitespace fix * Revert "IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array" This reverts commit f2c698bdf65f049e8481c9f2ec7138d9b9a8261d. * tweak KTimeManager spin behavior * replace MemoryBuffer with ByteMemoryPool modeled after System.Buffers.ArrayMemoryPool<T> * make ByteMemoryPoolBuffer responsible for renting memory
2023-04-16[GUI] Add network interface dropdown (#4597)TSRBerry
* Add network adapter dropdown from LDN build * Ava: Add NetworkInterfaces to SettingsNetworkTab * Add headless network interface option * Add network interface dropdown to Avalonia * Fix handling network interfaces without a gateway address * gtk: Actually save selected network interface to config * Increment config version
2023-04-14Rename Hipc to Cmif where appropriate (#3880)Alex Barney
2023-04-05Eliminate boxing allocations caused by ISampledData structs (#4556)jhorv
* Redesign use of ISampledData for accessing the SamplingNumber value on input data structs. * Always read SamplingNumber as little-endian * Restored field order for SixAxisSensorState. Rework to allow possibility of non-zero offsets for the SamplingNumber field. Set StructLayout Pack=8 - the KeyboardState struct is 4 bytes shorter with any other value. * fix spelling Co-authored-by: riperiperi <rhy3756547@hotmail.com> * set Pack = 1 for ISampledDataStruct types, added Unknown field to KeyboardState * extend size of KeyboardModifier --------- Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2023-04-03Source generated json serializers (#4582)Andrey Sukharev
* Use source generated json serializers in order to improve code trimming * Use strongly typed github releases model to fetch updates instead of raw Newtonsoft.Json parsing * Use separate model for LogEventArgs serialization * Make dynamic object formatter static. Fix string builder pooling. * Do not inherit json version of LogEventArgs from EventArgs * Fix extra space in object formatting * Write log json directly to stream instead of using buffer writer * Rebase fixes * Rebase fixes * Rebase fixes * Enforce block-scoped namespaces in the solution. Convert style for existing code * Apply suggestions from code review Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Rebase indent fix * Fix indent * Delete unnecessary json properties * Rebase fix * Remove overridden json property names as they are handled in the options * Apply suggestions from code review Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Use default json options in github api calls * Indentation and spacing fixes * Fix json serialization * Fix missing JsonConverter for config enums * Add double \n\n after the whole string, not inside join --------- Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
2023-03-31HLE: Refactoring of ApplicationLoader (#4480)Ac_K
* HLE: Refactoring of ApplicationLoader * Fix SDL2 Headless * Addresses gdkchan feedback * Fixes LoadUnpackedNca RomFS loading * remove useless casting * Cleanup and fixe empty application name * Remove ProcessInfo * Fixes typo * ActiveProcess to ActiveApplication * Update check * Clean using. * Use the correct filepath when loading Homebrew.npdm * Fix NRE in ProcessResult if MetaLoader is null * Add more checks for valid processId & return success * Add missing logging statement for npdm error * Return result for LoadKip() * Move error logging out of PFS load extension method This avoids logging "Could not find Main NCA" followed by "Loading main..." when trying to start hbl. * Fix GUIs not checking load results * Fix style and formatting issues * Fix formatting and wording * gtk: Refactor LoadApplication() --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
2023-03-24Fix handle leak on IShopServiceAccessServerInterface.CreateServerInterface ↵gdkchan
(#4591)
2023-03-21Revert "Use source generated json serializers in order to improve code ↵gdkchan
trimming (#4094)" (#4576) This reverts commit 4ce4299ca2a6b11332f2341c69f40efd7205282f.
2023-03-21Use source generated json serializers in order to improve code trimming (#4094)Andrey Sukharev
* Use source generated json serializers in order to improve code trimming * Use strongly typed github releases model to fetch updates instead of raw Newtonsoft.Json parsing * Use separate model for LogEventArgs serialization * Make dynamic object formatter static. Fix string builder pooling. * Do not inherit json version of LogEventArgs from EventArgs * Fix extra space in object formatting * Write log json directly to stream instead of using buffer writer * Rebase fixes * Rebase fixes * Rebase fixes * Enforce block-scoped namespaces in the solution. Convert style for existing code * Apply suggestions from code review Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Rebase indent fix * Fix indent * Delete unnecessary json properties * Rebase fix * Remove overridden json property names as they are handled in the options * Apply suggestions from code review Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Use default json options in github api calls * Indentation and spacing fixes --------- Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
2023-03-19Avoid copying more handles than we have space for (#4564)TSRBerry
* Avoid copying more handles than we have space for * Use locks instead * Reduce nesting by combining the lock statements * Add locks for other uses of _sessionHandles and _portHandles * Use one object to lock instead of locking twice * Release the lock as soon as possible
2023-03-17Reducing memory allocations (#4537)jhorv
* add RecyclableMemoryStream dependency and MemoryStreamManager * organize BinaryReader/BinaryWriter extensions * add StreamExtensions to reduce need for BinaryWriter * simple replacments of MemoryStream with RecyclableMemoryStream * add write ReadOnlySequence<byte> support to IVirtualMemoryManager * avoid 0-length array creation * rework IpcMessage and related types to greatly reduce memory allocation by using RecylableMemoryStream, keeping streams around longer, avoiding their creation when possible, and avoiding creation of BinaryReader and BinaryWriter when possible * reduce LINQ-induced memory allocations with custom methods to query KPriorityQueue * use RecyclableMemoryStream in StreamUtils, and use StreamUtils in EmbeddedResources * add constants for nanosecond/millisecond conversions * code formatting * XML doc adjustments * fix: StreamExtension.WriteByte not writing non-zero values for lengths <= 16 * XML Doc improvements. Implement StreamExtensions.WriteByte() block writes for large-enough count values. * add copyless path for StreamExtension.Write(ReadOnlySpan<int>) * add default implementation of IVirtualMemoryManager.Write(ulong, ReadOnlySequence<byte>); remove previous explicit implementations * code style fixes * remove LINQ completely from KScheduler/KPriorityQueue by implementing a custom struct-based enumerator
2023-03-17Update syscall capabilites to include SVCs from FW 15.0.0 (#4530)TSRBerry
* Add CapabilityType enum * Add SupervisorCallCount * kernel: Add CapabilityExtensions & Change type of capabilities to uint * Remove private setter from Mask arrays * Pass ReadOnlySpan directly & Remove redundant type casts
2023-03-11Misc performance tweaks (#4509)jhorv
* use Array.Empty() where instead of allocating new zero-length arrays * structure for loops in a way that the JIT will elide array/Span bounds checking * avoiding function calls in for loop condition tests * avoid LINQ in a hot path * conform with code style * fix mistake in GetNextWaitingObject() * fix GetNextWaitingObject() possibility of returning null if all list items have TimePoint == long.MaxValue * make GetNextWaitingObject() behave FIFO behavior for multiple items with the same TimePoint
2023-03-04Minor code formatting (#4498)gdkchan
2023-03-01Update LibHac to 0.18.0 (#4414)Steveice10
* Update LibHac to 0.18.0 * Change instance of AsBytes(CreateReadOnlySpan(...)) to AsReadOnlyByteSpan(...)
2023-02-28Sockets: Properly convert error codes on MacOS (#4491)riperiperi
* Sockets: Properly convert error codes on MacOS The error codes for MacOS are very different to how they are on windows or linux. An alternate mapping is used when the host operating system is MacOS. This PR also defaults IsDhcpEnabled to true when interfaceProperties.DhcpServerAddresses is not available. This change was already in `macos1`. * Address feedback
2023-02-10Treat NpadIdType < 0 as invalid. Filter invalid SupportedPlayers inside ↵Logan Stromberg
IHidServer.SetSupportedNpadIdType(). (#4377) Co-authored-by: Logan Stromberg <lostromb@microsoft.com>
2023-02-08Replace BitConverter.ToString(bytes).Replace("-", "") with ↵Berkan Diler
Convert.ToHexString(bytes) (#4382)
2023-02-01Implement Account LoadOpenContext (#4359)gdkchan
* Implement Account LoadOpenContext * Formatting
2023-01-29Initial Apple Hypervisor based CPU emulation (#4332)gdkchan
* Initial Apple Hypervisor based CPU emulation implementation * Add UseHypervisor Setting * Add basic MacOS support to Avalonia * Fix initialization * Fix GTK build * Fix/silence warnings * Change exceptions to asserts on HvAddressSpaceRange * Replace DllImport with LibraryImport * Fix LibraryImport * Remove unneeded usings * Revert outdated change * Set DiskCacheLoadState when using hypervisor too * Fix HvExecutionContext PC value * Address PR feedback * Use existing entitlements.xml file on distribution folder --------- Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2023-01-21Catch Profile.json parse to prevent crash on launch (#3393)Phi
* Catch Profile.json parse to prevent crash on launch * Update Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: PhiZero <wolkan.craanen@gmail.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
2023-01-18Optimize string memory usage. Use Spans and StringBuilders where possible ↵Andrey Sukharev
(#3933) * Optimize string memory usage. Use ReadOnlySpan<char> and StringBuilder where possible. * Fix copypaste error * Code generator review fixes * Use if statement instead of switch * Code style fixes Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Another code style fix * Styling fix Co-authored-by: Mary-nyan <thog@protonmail.com> * Styling fix Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2023-01-18HOS: Load RomFs by pid (#4301)Ac_K
We currently loading only one RomFs at a time, which could be wrong if one day we want to load more than one guest at time. This PR fixes that by loading romfs by pid.
2023-01-17Implement support for page sizes > 4KB (#4252)gdkchan
* Implement support for page sizes > 4KB * Check and work around more alignment issues * Was not meant to change this * Use MemoryBlock.GetPageSize() value for signal handler code * Do not take the path for private allocations if host supports 4KB pages * Add Flags attribute on MemoryMapFlags * Fix dirty region size with 16kb pages Would accidentally report a size that was too high (generally 16k instead of 4k, uploading 4x as much data) Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2023-01-15Implement missing service calls in `pm` (#4210)Isaac Marovitz
* Implement `GetTitleId` Fixes #2516 * Null check + Proper result code * Better comment * Implement `GetApplicationProcessId` * Add TODOs * Update Ryujinx.HLE/HOS/Services/Pm/IInformationInterface.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update Ryujinx.HLE/HOS/Services/Pm/IDebugMonitorInterface.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Remove new function from KernelStatic Co-authored-by: Ac_K <Acoustik666@gmail.com>
2023-01-09Replace tabs with spaces across the project (#4244)gdkchan
* Replace tabs with spaces across the project * Include AXAML files too
2023-01-08Horizon: Impl Prepo, Fixes bugs, Clean things (#4220)Ac_K
* Horizon: Impl Prepo, Fixes bugs, Clean things * remove ToArray() * resultCode > status * Remove old services * Addresses gdkchan's comments and more cleanup * Addresses Gdkchan's feedback 2 * Reorganize services, make sure service are loaded before guest Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com> * Create interfaces for lm and sm Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
2023-01-05hle: Add safety measure around overflow in ScheduleFutureInvocationMary
Fix crash on Linux since 08831eecf77cedd3c4192ebab5a9c485fb15d51e.
2023-01-05Make PPTC state non-static (#4157)gdkchan
* Make PPTC state non-static * DiskCacheLoadState can be null
2023-01-04IPC refactor part 3+4: New server HIPC message processor (#4188)gdkchan
* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization * Make types match on calls to AlignUp/AlignDown * Formatting * Address some PR feedback * Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations * Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory * Implement EventType * Address more PR feedback * Log request processing errors since they are not normal * Rename waitable to multiwait and add missing lock * PR feedback * Ac_K PR feedback
2022-12-29HLE: Add basic stubs to get Labo VR booting to title screen. (#4007)Luminoso-256
* HLE: Add basic stubs to get Labo VR booting to title screen. * Address code review * Apply suggestions from code review (pt. 2) Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Apply suggestions from code review (pt. 3) Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Formatting: final batch? Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Address last? bit of formatting Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
2022-12-26Added Generic Math to BitUtils (#3929)Hunter
* Generic Math Update Updated Several functions in Ryujinx.Common/Utilities/BitUtils to use generic math * Updated BitUtil calls * Removed Whitespace * Switched decrement * Fixed changed method calls. The method calls were originally changed on accident due to me relying too much on intellisense doing stuff for me * Update Ryujinx.Common/Utilities/BitUtils.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-12-26bsd::RecvFrom: verify output buffer size before writing socket address (#4135)gnisman
* bsd::RecvFrom: Ryujinx does not verify output buffer size before writing socket address * Calculate the size of BsdSockAddr * use bsdSockAddr variable * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * set errno to ENOMEM in case we can't write the address to memory * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
2022-12-24Some minor cleanups and optimizations (#4174)Berkan Diler
* Replace Array.Clear(x, 0, x.Length) with Array.Clear(x) * Use DateTime.UnixEpoch field * Replace SHA256.ComputeHash calls with static SHA256.HashData call More performant and avoids the need to initialize a SHA256 instance.
2022-12-21make UI display correct content in Chinese (#4155)Ccl
2022-12-21hle: Handle GPU profiler and debugger device path correctly (#4138)Mary-nyan
This fix a warning on "慟哭そして…" by handling correctly the debug mode flag. When debug mode isn't enabled, opening /dev/nvhost-dbg-gpu or /dev/nvhost-prof-gpu should fail with a not implemented error code. This implement this behaviour and also define stubbed interfaces for completness.
2022-12-18hle: Fix wrong conversion in UserPresence.ToString (#4142)Mary-nyan
This fixes an error from #3805 that caused a wrong conversion of ``AppKeyValueStorage`` to string. As that information isn't really relevant without appropriate parsing, it was removed from ``ToString``. This should get ride of "bell warning" in Mario Kart 8 when entering Time Trials.
2022-12-12Bsd: Add support for dns_mitm (#4102)TSRBerry
* bsd: Add dns_mitm from Atmosphère related AMS files: - https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp - https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp * Remove debug logging and adjust redirect message * Improve formatting Co-authored-by: Ac_K <Acoustik666@gmail.com> * Replace Initialize with instance property * bsd: dns_mitm - Ignore empty lines * bsd: Mark _mitmHostEntries as readonly * bsd: Initialize Aliases when returning IpHostEntry Fixes NullReferenceException Co-authored-by: Ac_K <Acoustik666@gmail.com>
2022-12-12Use method overloads that support trimming. Mark some types to be trimming ↵Andrey Sukharev
friendly (#4083) * Use method overloads that support trimming. Mark some types to be trimming friendly * Use generic version of marshalling method
2022-12-12Bsd: Implement Select (#4017)TSRBerry
* bsd: Add gdkchan's Select implementation Co-authored-by: TSRBerry <20988865+tsrberry@users.noreply.github.com> * bsd: Fix Select() causing a crash with an ArgumentException .NET Sockets have to be used for the Select() call * bsd: Make Select more generic * bsd: Adjust namespaces and remove unused imports * bsd: Fix NullReferenceException in Select Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-12-10Fix Redundant Qualifer Warnings (#4091)Isaac Marovitz
* Fix Redundant Qualifer Warnings * Remove unnecessary using
2022-12-07acc: Stub CheckNetworkServiceAvailabilityAsync (#4052)Ac_K
2022-12-07hle: Do not add disabled AoC item to the list (#4044)Ac_K
* hle: Do not add disabled AoC item to the list We currently add all AoC items to a list in `ContentManager` and the enable check is only done when FS service ask for the data. Which is wrong. It causes an issue in MK8D which doesn't boot even if you have disabled a not updated DLC. I've fixed it by not adding the disabled AoC item to the list, I've removed some duplicate code too. There is still an edge case because we currently don't check the AoC Item version, but that should be fixed later since now MK8D throw an error if the DLC isn't updated. * remove useless "enabled"
2022-12-06UI: Add Metal surface creation for MoltenVK (#3980)riperiperi
* Initial implementation of metal surface across UIs * Fix SDL2 on windows * Update Ryujinx/Ryujinx.csproj Co-authored-by: Mary-nyan <thog@protonmail.com> * Address Feedback Co-authored-by: Mary-nyan <thog@protonmail.com>
2022-12-05Make structs readonly when applicable (#4002)Andrey Sukharev
* Make all structs readonly when applicable. It should reduce amount of needless defensive copies * Make structs with trivial boilerplate equality code record structs * Remove unnecessary readonly modifiers from TextureCreateInfo * Make BitMap structs readonly too
2022-12-04Add InfoType.MesosphereCurrentProcess (#3792)Shane Slattery
* Add InfoType.MesosphereCurrentProcess * Make outHandle inlined Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
2022-12-04Use source generated regular expressions (#4005)Andrey Sukharev
2022-12-01Revert "nuget: bump SixLabors.ImageSharp from 1.0.4 to 2.1.3 (#3976)"Mary
This reverts commit 9677ddaa5d8424604bdbf17496f8a878855a118d. SixLabors.ImageShar switched to a shady and vague license starting with 2.x without mentioning it on their changelog. As a result we are staying on 1.x (licensed under Apache-2) and will seak an alternative package.