Commit graph

687 commits

Author SHA1 Message Date
MutantAura
ee174be57c
Mod loading from atmosphere SD directories (#3176)
* initial sd support

* GUI option

* alignment

* review changes
2022-03-06 22:12:01 +01:00
JavidPack
a3dd04deef
Implement -p or --profile command line argument (#2947)
* Implement -p or --profile command line argument

* Put command line logic all in Program and reference it elsewhere

* Address feedback
2022-03-02 09:51:37 +01:00
Alex Barney
3705c20668
Update LibHac to v0.16.0 (#3159) 2022-02-27 00:52:25 +01:00
Berkan Diler
644b497df1
Collapse AsSpan().Slice(..) calls into AsSpan(..) (#3145)
* Collapse AsSpan().Slice(..) calls into AsSpan(..)

Less code and a bit faster

* Collapse an Array.Clear(array, 0, array.Length) call to Array.Clear(array)
2022-02-22 10:32:10 -03:00
riperiperi
fb935fd201
Add dedicated ServerBase for FileSystem services (#3142)
This should prevent filesystem services from blocking other services that don't have their own ServerBase. May improve filesystem related stutters in certain titles.

Improves button advanced cutscenes such as Miqol's Request in Xenoblade: DE when the game is on a network share (used to stutter when voice lines played).

Should probably be tested to make sure no mysterious bugs have been unearthed, and to see if any other filesystem related perf issues are improved.
2022-02-19 15:29:11 +01:00
gdkchan
92d166ecb7
Enable CPU JIT cache invalidation (#2965)
* Enable CPU JIT cache invalidation

* Invalidate cache on IC IVAU
2022-02-18 02:53:18 +01:00
Berkan Diler
98c838b24c
Use BitOperations methods and delete now unused BitUtils methods (#3134)
Replaces BitUtils.CountTrailingZeros/CountLeadingZeros/IsPowerOfTwo with BitOperations methods
2022-02-18 02:35:23 +01:00
gdkchan
63c9c64196
Move kernel syscall logs to new trace log level (#3137) 2022-02-18 02:14:05 +01:00
Ac_K
a113ed0811
Implement/Stub mnpp:app service and some hid calls (#3131)
* Implement/Stub mnpp:app service and some hid calls

This PR Implement/Stub the `mnpp:app` service (closes #3107) accordingly to RE, which seems to do some telemetry for China region only, so everything is stubbed.

This PR fixes some inconsistencies in the hid service too and stub EnableSixAxisSensorUnalteredPassthrough, IsSixAxisSensorUnalteredPassthroughEnabled, LoadSixAxisSensorCalibrationParameter, GetSixAxisSensorIcInformation calls (closes #3123 and closes #3124).

* Addresses Thog review
2022-02-18 02:00:06 +01:00
mlgatto
95cc18a7b4
Added trace log level (#3096)
* added trace log level

* use trace log level instead of debug ( #1547)

* alignment #1547

* moved trace logs toggle at the bottom #1547

* bumped config file version #3096

* added migration step #3096

* setting moved to the dev section #1547

* performance warning displayed when trace is enabled #1547
2022-02-17 21:08:07 -03:00
Alex Barney
c017c77365
Change ServiceNv map creation logs to the Debug level (#3058) 2022-02-18 00:41:21 +01:00
Berkan Diler
8f35345729
Use Enum and Delegate.CreateDelegate generic overloads (#3111)
* Use Enum generic overloads

* Remove EnumExtensions.cs

* Use Delegate.CreateDelegate generic overloads
2022-02-13 10:50:07 -03:00
Mary
6dffe0fad4
misc: Make PID unsigned long instead of long (#3043) 2022-02-09 17:18:07 -03:00
Alex Barney
d317cfd639
Try to ensure save data always has a valid owner ID (#3057)
- Run the extra data fix in FixExtraData on non-system saves that have no owner ID.
- Set the owner ID in the dummy application control property if an application doesn't have a proper one available.
2022-02-02 14:49:49 -07:00
Mary
20ce37dee6
kernel: A bit of refactoring and fix GetThreadContext3 correctness (#3042)
* Start refactoring kernel a bit and import some changes from kernel decoupling PR

* kernel: Put output always at the start in Syscall functions

* kernel: Rewrite GetThreadContext3 to use a structure and to be accurate

* kernel: make KernelTransfer use generic types and simplify

* Fix some warning and do not use getters on MemoryInfo

* Address gdkchan's comment

* GetThreadContext3: use correct pause flag
2022-01-29 22:18:03 +01:00
Mary
4910b214f5
Set _vibrationPermitted to True by default (#2985)
Co-authored-by: SpookyBee123 <82302189+SpookyBee123@users.noreply.github.com>
2022-01-23 12:24:55 +01:00
Mary
929a97d432
kernel: Fix deadlock when pinning in interrupt handler (#2999)
* kernel: Fix deadlock when pinning in interrupt handler

This fix a deadlock on DoDonPachi Resurrection when starting a new game

* Address gdkchan's comment
2022-01-16 13:21:44 +01:00
Mary
3fa7ef21b4
ssl: Implement SSL connectivity (#2961)
* implement certain servicessl functions

* ssl: Implement more of SSL connection and abstract it

This adds support to non blocking SSL operations and unlink the SSL
implementation from the IPC logic.

* Rename SslDefaultSocketConnection to SslManagedSocketConnection

* Fix regression on Pokemon TV

* Address gdkchan's comment

* Simplify value read from previous commit

* ssl: some changes

- Implement builtin certificates parsing and retrieving
- Fix issues with SSL version handling
- Improve managed SSL socket error handling
- Ensure to only return a certificate on DoHandshake when actually requested

* Add missing BuiltInCertificateManager initialization call

* Address gdkchan's comment

* Address Ack's comment

Co-authored-by: InvoxiPlayGames <webmaster@invoxiplaygames.uk>
2022-01-13 23:29:04 +01:00
Mary
366fe2dbb2
bsd: Revamp API and make socket abstract (#2960)
* bsd: Revamp API and make socket abstract

This part of the code was really ancient and needed some love.
As such this commit aims at separating the socket core logic from the IClient class and make it uses more modern APIs to read/write/parse data.

* Address gdkchan's comment

* Move TryConvertSocketOption to WinSockHelper

* Allow reusing old fds and add missing locks around SocketInternal and ShutdownAllSockets

* bsd: ton of changes

- Make sockets per process
- Implement eventfds
- Rework Poll for support of eventfds
- Handle protocol auto selection by type (used by gRPC)
- Handle IPv6 socket creation

* Address most of gdkchan comments

* Fix inverted read logic for BSD socket read

* bsd: Make Poll abstract via IBsdSocketPollManager

* bsd: Improve naming of everything

* Fix build issue from last commit (missed to save on VC)

* Switch BsdContext registry to a concurrent dictionary

* bsd: Implement socket creation flags logic and the non blocking flag

* Remove unused enum from previous commit

* bsd: Fix poll logic when 0 fds are present for a given poll manager and when timeout is very small (or 0)

* Address gdkchan's comment
2022-01-12 19:31:08 +01:00
Mary
d300a5a45b
sfdnsres: Fix serialization issues (#2992)
* sfdnsres: Fix serialization issues

Fix a crash on Monster Hunter Rise

* Address gdkchan's comments

* Address gdkchan's comments
2022-01-12 17:43:00 +01:00
Alex Barney
f4bbc019b9
Update to LibHac 0.15.0 (#2986) 2022-01-12 12:22:19 +01:00
Mary
275275f7ac
account: Rework LoadIdTokenCache to auto generate a random JWT token (#2991)
This improve correctness of that call while possibly spoofing possible recognizable patterns.
2022-01-11 09:22:20 +01:00
Mary
e32a19520b
sfdnsres: Block communication attempt with NPLN servers (#2990)
Seen on Monster Hunter Rise.
2022-01-11 08:58:57 +01:00
gdkchan
4864648e72
Return error on DNS resolution when guest internet access is disabled (#2983)
* Return error on DNS resolution when guest internet access is disabled

* Log DNS lookup calls
2022-01-08 20:18:09 -03:00
Mary
60f03cb78a
sfdnsres: Implement NSD resolution (#2962)
This fix a missing implementation usage of NSD on IResolver when
requested on GetAddrInfoRequest* and GetHostByNameRequest*.
2022-01-03 22:12:50 +01:00
Emmanuel Hansen
e98abf1820
Add Cheat Manager (#2964)
* add cheatmanager

* use modloader to load cheats for manager

* addressed nits
2022-01-03 09:39:43 +01:00
Mary
dc8a1d5cba
misc: Improve DNS blacklist for Nintendo servers (#2963)
This blocks more that have been seen in the wild
2022-01-03 08:57:03 +01:00
Ac_K
b4f8ae7a75
friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable (#2949)
* friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable

This PR stubs IsFriendListCacheAvailable and EnsureFriendListAvailable call of friend service which close #2896.

Sadly, Super Bomberman R Online is still stuck on the loading screen and keep calling `TryPopFromFriendInvitationStorageChannel`, probably because another issue somewhere.

* Add FW version

* Apply suggestions from gdkchan

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

* Update IFriendService.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-12-30 11:42:22 +01:00
Ac_K
512cce6ed3
am: Stub SetMediaPlaybackStateForApplication (#2952)
This PR stub `SetMediaPlaybackStateForApplication` of the am service. Accordingly to gdkchan it's needed by the Youtube app. This is checked by RE aswell.
2021-12-30 11:25:46 +01:00
Mary
e96ef6d532
kernel: Implement thread pinning support (#2840)
* kernel: Implement Thread pinning support

This commit adds support for 8.x thread pinning changes and implement SynchronizePreemptionState syscall.

Based on kernel 13.x reverse.

* Address gdkchan's comment

* kernel: fix missing critical section leave in SetActivity

Fix Unity games

* Implement missing bits on the interrupt handler and inline update pinning function as it cannot be generic

* Fix some bugs in SetActivity and SetCoreAndAffinityMask

* Address gdkchan's comments
2021-12-30 10:55:06 +01:00
gdkchan
8544b1445b
Improve SocketOption handling (#2946) 2021-12-29 15:04:38 +01:00
Ac_K
322c14ee31
hid: A little cleanup (#2950)
While I'm looking to the code, I've found some syntax issue, and a little inconsistencie between `ActivateNpad` and `ActivateNpadWithRevision`. Nothing more.
2021-12-29 14:49:10 +01:00
gdkchan
6dacc4c577
Fix GetHostByNameRequestWithOptions and GetHostByAddrRequestWithOptions (#2943) 2021-12-28 08:22:58 -03:00
gdkchan
0b1185284c
Fix GetAddrInfoWithOptions and some sockets issues (#2936)
* Fix GetAddrInfoWithOptions and some sockets issues

* Was not supposed to remove this log
2021-12-26 15:17:13 +01:00
gdkchan
a438a4bc16
Remove PortRemoteClosed warning (#2928) 2021-12-23 14:43:30 -03:00
Alex Barney
aa932a6df1
Update to LibHac v0.14.3 (#2925)
* Update to LibHac v0.14.3

* Fix loading NCAs that don't have a data partition
2021-12-23 13:55:50 -03:00
sharmander
cb43cc7e32
UI - Add Volume Controls + Mute Toggle (F2) (#2871)
* Add the ability to toggle mute in the status bar.

* Add the ability to toggle mute in the status bar.

* Formatting fixes

* Add hotkey (F2) to mute

* Add default hotkey to config.json

* Add ability to change volume via slider.

* Fix Headless

* Fix SDL2 Problem : Credits to d3xMachina

* Remove unnecessary work

* Address gdk comments

* Toggling with Hotkey now properly restores volume to original level.

* Toggling with Hotkey now properly restores volume to original level.

* Update UI to show Volume % instead of Muted/Unmuted

* Clean up the volume ui a bit.

* Undo unintentionally committed code.

* Implement AudRen Support

* Restore intiial volume level in function definition.

* Finalize UI

* Finalize UI

* Use clamp for bounds check

* Use Math.Clamp for volume in soundio

* Address comments by gdkchan

* Address remaining comments

* Fix missing semicolon

* Address remaining gdkchan comment

* Fix comment

* Change /* to //

* Allow volume slider to change volume immediately.
Also force label text to cast to int to prevent decimals from showing in status bar

* Remove blank line

* Undo setting of volume level when "Cancel" is pressed.

* Fix allignment for settings window code
2021-12-23 13:33:56 -03:00
Mary
2ab777885b
kernel: Improve GetInfo readability and update to 13.0.0 (#2900)
* kernel: Define InfoTYpe and make it less obscure when reading GetInfo

Also map ThreadTickCount to 25 instead of 0xF0000002 like 13.x kernel.

* kernel: Implement GetInfo IsApplication

* kernel: Implement GetInfo FreeThreadCount
2021-12-04 20:23:26 -03:00
Mary
7c9360d393
Fix Amiibo hanging since .NET 6 changes (#2890)
The .NET 6 changes ended up causing a difference in the way we deserialise and would end up deserializing wrongly.

This commit fixes it by resoring previous behaviour while still fixing the illink warning that caused that change in the first place
2021-11-30 11:09:32 +01:00
Logan Stromberg
560ed5eebd
Don't blow up everything if a DLC file is moved or renamed. (#2867)
* Don't blow up everything if a DLC file is missing

* change comment

* More correctly setting the "enabled" check box on dlc dialog for the add-on NSP based on the enabled state of all NCAs in the package.

* Update Ryujinx.HLE/HOS/ApplicationLoader.cs

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

Co-authored-by: Logan Stromberg <lostromb@microsoft.com>
Co-authored-by: Ac_K <Acoustik666@gmail.com>
2021-11-29 15:21:27 -03:00
Mary
57d3296ba4
infra: Migrate to .NET 6 (#2829)
* infra: Migrate to .NET 6

* Rollback version naming change

* Workaround .NET 6 ZipArchive API issues

* ci: Switch to VS 2022 for AppVeyor

CI is now ready for .NET 6

* Suppress WebClient warning in DoUpdateWithMultipleThreads

* Attempt to workaround System.Drawing.Common changes on 6.0.0

* Change keyboard rendering from System.Drawing to ImageSharp

* Make the software keyboard renderer multithreaded

* Bump ImageSharp version to 1.0.4 to fix a bug in Image.Load

* Add fallback fonts to the keyboard renderer

* Fix warnings

* Address caian's comment

* Clean up linux workaround as it's uneeded now

* Update readme

Co-authored-by: Caian Benedicto <caianbene@gmail.com>
2021-11-28 21:24:17 +01:00
Mary
7b040e51b0
kernel: Fix sleep timing accuracy (#2828)
* kernel: Fix sleep timing accuracy

This commit corrects some mistake while comparing reversing of kernel
13.x with our own.

WaitAndCheckScheduledObjects timing accuracy was also improved.

* Make KTimeManager.WaitAndCheckScheduledObjects spin wait for sub milliseconds

Fix performance regression on Pokemon Let's Go games and possibly
others.

* Address rip's comment

* kernel: Fix issues with timeout of -1 (0xFFFFFFFF)

Fixes possible hang on Pokemon DP and possibly others
2021-11-28 13:15:26 +01:00
Mary
786fb04d20
kernel: Add support for CFI (#2839)
Add basic support for the CFI value being passed in X18 since 11.0.0 by the official kernel.
We do not implement any random generator atm in the kernel and as such the KSystemControl.GenerateRandom function is stubbed
2021-11-28 13:01:17 +01:00
Ac_K
3dcee8c437
account/ns: Implement 13.0.0+ service calls (#2820)
This PR implements/stubs some missing calls introduced in recent firmware (13.0.0).

- `acc:u0 InitializeApplicationInfoV2` needed by ACNH.
- `aoc:u NotifyMountAddOnContent/NotifyUnmountAddOnContent/CheckAddOnContentMountStatus` checked by RE. Needed by ACNH.
- `IPurchaseEventManager PopPurchasedProductInfo` needed by Dying Light.

Now ACNH 2.0 update is fully playable, and Dying Light can boot further:
2021-11-24 18:11:50 -03:00
VocalFan
02d786a086
Nickname! - Init Amiibos with Profile's name! (#2804)
* Remove comment from code.

* Added needed RegisterInfo for TODO.

* Forgot to add two words...

* Stop being tired and fixed the one issue.

* Removing suggested line from GDKchan.

* GDK seems to have been incorrect?

* Update Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs

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

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-11-15 20:03:17 -03:00
gdkchan
81e9b86cdb
Ensure syncpoints are released and event handles closed on channel close (#2812) 2021-11-04 20:27:21 -03:00
Mary
f41687f4c1
hle: Make Ryujinx.HLE project entirely safe (#2789)
* Remove a bit of unsafety around

* Regenerate StructArrayHelpers with a max element value of 256

* hle: remove unsafe marker from all struct that had it

* hle: make SoftwareKeyboardRenderer.TryCopyTo safe

* hle: remove unsafety in NpadDevice and remove AllowUnsafeBlocks from csproj

* Revert "Regenerate StructArrayHelpers with a max element value of 256"

This reverts commit f32a6e5be0.

* Introduce ByteArray of various size and use that instead of ArrayXXX to avoid stackoverflow in .NET runtime type resolution

* Use ByteArray more

* Add some missing spaces on Pack = 1 for various structs

* Fix broken logic for TryCopyTo

* Address gdkchan's comment

* Address gdkchan's comment
2021-11-01 19:38:13 -03:00
gdkchan
e48530e9d9
When waiting on CPU, do not return a time out error from EventWait (#2780)
* When waiting on CPU, do not return a time out error from EventWait

* And while I'm at it...
2021-11-01 19:10:02 -03:00
gdkchan
a7a40a77f2
Add support for the brazilian portuguese language code (#2792)
* Add support for the brazilian portuguese language code

* Fix error applet message
2021-10-28 23:06:45 +02:00
Mary
5c66a36ed6
kernel: Fix inverted condition on permission check of SetMemoryPermission syscall (#2777)
* kernel: Fix inverted condition on permission check of SetMemoryPermission syscall

* Fix condition for real..
2021-10-24 20:00:31 -03:00