Commit graph

664 commits

Author SHA1 Message Date
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
Mary
51fa1b2cb0
hle: Improve safety (#2778)
* timezone: Make timezone implementation safe

* hle: Do not use TrimEnd to parse ASCII strings

This adds an util that handle reading an ASCII string in a safe way.
Previously it was possible to read malformed data that could cause
various undefined behaviours in multiple services.

* hid: Remove an useless unsafe modifier on keyboard update

* Address gdkchan's comment

* Address gdkchan's comment
2021-10-24 19:13:20 -03:00
Mary
b4dc33efc2
kernel: Clear pages allocated with SetHeapSize (#2776)
* kernel: Clear pages allocated with SetHeapSize

Before this commit, all new pages allocated by SetHeapSize were not
cleared by the kernel.

This would cause undefined data to be pass to the userland and possibly
resulting in weird memory corruption.

This commit also add support for custom fill heap and ipc value (that is also
supported by the official kernel)

* Remove dots at the end of KPageTableBase.MapPages new documentation

* Remove unused _stackFillValue
2021-10-24 18:52:59 -03:00
Billy Laws
8c4e4ab3b3
Fixup channel submit IOCTL syncpoint parameters (#2774)
* Fixup channel submit IOCTL syncpoint parameters

The current arguments worked by happenstance as games only ever submit
one syncpoint and request one fence back, if a game were to do something
other than this then the arguments would've been parsed entirely wrong.

* Address feedback
2021-10-24 18:34:44 -03:00
Mary
dc837c0042
kernel: Add resource limit related syscalls (#2773)
* kernel: Add resource limit related syscalls

This commit implements all resource limit related syscalls.

* Fix register mapping being wrong for SetResourceLimitLimitValue

* Address gdkchan's comment
2021-10-24 01:40:13 +02:00
Mary
c94d47cc40
kernel: Implement SetMemoryPermission syscall (#2772)
* kernel: Implement SetMemoryPermission syscall

This commit implement the SetMemoryPermission syscall accurately.
This also fix KMemoryPermission not being an unsigned 32 bits type and
add the "DontCare" bit (used by shared memory, currently unused in
Ryujinx)

* Update MemoryPermission mask

* Address gdkchan's comments

* Fix a nit

* Address gdkchan's comment
2021-10-24 01:24:49 +02:00
Mary
e7e65ccbc9
kernel: Add missing address space check in SetMemoryAttribute syscall (#2771) 2021-10-24 01:07:41 +02:00
gdkchan
0d174cbd45
EventWait should not signal the event when it returns Success (#2739)
* Fix race when EventWait is called and a wait is done on the CPU

* This is useless now

* Fix EventSignal

* Ensure the signal belongs to the current fence, to avoid stale signals
2021-10-19 17:25:32 -03:00
Caian Benedicto
1b81653478
Fix regression with foreground software keyboard (#2732) 2021-10-13 12:20:48 -03:00
riperiperi
a2c6cd5132
Enqueue frame before signalling the frame is ready. (#2722)
It seems that certain games (Link's Awakening, Xenoblade DE) had their fences reached already when posting framebuffers, so the signal that a frame was ready would go out _before_ the frame was enqueued, and the render loop would fail to dequeue anything and "skip" a frame.

This was resulting in their performance lowering dramatically after some loading transitions, as a frame signal would be consumed and presentation would be one frame behind.

It's possible this might have eventually caused deadlocks in these games or others, if it happened twice.
2021-10-12 23:29:50 +02:00
Ac_K
0510fde25a
spl: Implement IGeneralInterface GetConfig (#2705)
* spl: Implement IGeneralInterface GetConfig

This PR implement the GetConfig call of the spl service. This is currently needed for some homebrews which currently needs Ignore Missing Service to boot. Now it's fixed.
Implementation was done using Atmosphère code and REing too.

* Addresses gdkchan feedback
2021-10-12 22:15:55 +02:00
Caian Benedicto
380b95bc59
Inline software keyboard without input pop up dialog (#2180)
* Initial implementation

* Refactor dynamic text input keys out to facilitate configuration via UI

* Fix code styling

* Add per applet indirect layer handles

* Remove static functions from SoftwareKeyboardRenderer

* Remove inline keyboard reset delay

* Remove inline keyboard V2 responses

* Add inline keyboard soft-lock recovering

* Add comments

* Forward accept and cancel key names to the keyboard and add soft-lock prevention line

* Add dummy window to handle paste events

* Rework inline keyboard state machine and graphics

* Implement IHostUiHandler interfaces on headless WindowBase class

* Add inline keyboard assets

* Fix coding style

* Fix coding style

* Change mode cycling shortcut to F6

* Fix invalid calc size error in games using extended calc

* Remove unnecessary namespaces
2021-10-12 21:54:21 +02:00
gdkchan
11b437eafc
Fix DisplayInfo struct (#2708) 2021-10-05 12:38:44 -03:00
Ac_K
33dc4c9ce4
clkrst: Stub/Implement IClkrstManager and IClkrstSession calls (#2692)
This PR stubs and implements some clkrst call because they are used to overclock the Switch hardware and it's pointless in our case as we emulate the system.
Everything was done checked by RE.

Fixes #2686
2021-09-29 01:03:35 +02:00
gdkchan
f4f496cb48
NVDEC (H264): Use separate contexts per channel and decode frames in DTS order (#2671)
* Use separate NVDEC contexts per channel (for FFMPEG)

* Remove NVDEC -> VIC frame override hack

* Add missing bottom_field_pic_order_in_frame_present_flag

* Make FFMPEG logging static

* nit: Remove empty lines

* New FFMPEG decoding approach -- call h264_decode_frame directly, trim surface cache to reduce memory usage

* Fix case

* Silence warnings

* PR feedback

* Per-decoder rather than per-codec ownership of surfaces on the cache
2021-09-29 00:43:40 +02:00
Ac_K
79c854dd2e
irs: Stub some service calls (#2665)
This PR stubs some irs service calls which are needed to get some games playable or at least bootable since we don't support IR data throught real JoyCon for now.

- Stubs `IIrSensorServer` `StopImageProcessor`, `RunMomentProcessor`, `RunClusteringProcessor`, `RunImageTransferProcessor`, `GetImageTransferProcessorState`, `RunTeraPluginProcessor`. All calls are a bit checked by RE.

Closes #2267, #2248, #2126

Night Vision and SpyAlarm are now bootable (but still unplayable due to the lack of the IR data):
2021-09-29 00:10:10 +02:00
Mary
32c09af71a amadeus: Fix regression from #2654 on ListAudioDeviceName 2021-09-19 13:42:16 +02:00
Ac_K
40d1acd198
vi: Unify resolutions values and accurate implementation of them. (#2640)
* vi: Unify resolutions values and accurate implementation of them.

To continue what was made in #2618, I've REd `vi` service a bit. Now values and checks related to displays are more accurate.

- `am`  GetDefaultDisplayResolution / GetDefaultDisplayResolutionChangeEvent have more informations on what the service does.
- `vi:u/vi:m/vi:s` GetDisplayService are now accurate.
- `IApplicationDisplay` GetRelayService, GetSystemDisplayService, GetManagerDisplayService, GetIndirectDisplayTransactionService, ListDisplays, OpenDisplay, OpenDefaultDisplay, CloseDisplay, GetDisplayResolution are now properly implemented.
- Some other calls are cleaned or have extra checks accordingly to RE.

Additionnaly, `IFriendService` have some wrong aligned things, and `pm:info` service placeholder was missing.

* just use _openedDisplayInfo.Remove()

* use context.Memory.Fill()

* fix some casting

* remove unneeded comment

* cleanup

* uses TryAdd

* displayId > ulong

* GetDisplayResolution > ulong

* UL
2021-09-19 12:57:39 +02:00
Mary
e17eb7bfaf
amadeus: Update to REV10 (#2654)
* amadeus: Update to REV10

This implements all the changes made with REV10 on 13.0.0.

* Address Ack's comment

* Address gdkchan's comment
2021-09-19 12:29:19 +02:00
mpnico
fe9d5a1981
Fix problems added by Pause (#2645)
* Disable Pause/Resume menu instead of trying to hide them

* Fix Resume menu being active before renderer starts

* Fix emulator not being able to close properly
2021-09-18 14:31:44 +02:00
MutantAura
843401635a
Adjustments to framerate metric and addition of frametime (#2638)
* Adjust framerate data and add frametime

* Update PerformanceStatistics.cs

* Revert deletions of average framerate

* Update Ryujinx.csproj

* Remove separate GTK column

* Increase FPS precision

* general cleanup

* even generaler cleanup

* fix dumb

* Remove legacy code

* Update PerformanceStatistics.cs

* Update PerformanceStatistics.cs
2021-09-15 02:26:10 +02:00
Ac_K
5d08e9b495
hos: Cleanup the project (#2634)
* hos: Cleanup the project

Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more.
This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable.

* Address gdkchan feedback

* addresses Thog feedback

* Revert ElfSymbol
2021-09-15 01:24:49 +02:00
gdkchan
016fc64b3d
Implement GetVaRegions on nvservices (#2621)
* Implement GetVaRegions on nvservices

* This would just result in 0
2021-09-11 22:39:02 +02:00
gdkchan
a4089fc878
Report 1080p resolution when in docked mode (#2618) 2021-09-11 22:24:10 +02:00