Commit graph

724 commits

Author SHA1 Message Date
Ac_K
8cdb50d703
appletAE: Implement SetLcdBacklighOffEnabled (#2037)
This PR implement `appletAE ICommonStateGetter SetLcdBacklighOffEnabled` accordingly to RE.

Closes #2021
2021-02-21 09:21:32 +01:00
mageven
65eb9901f1
Allow modding AddOnContent RomFS (#2024)
Simplify some misc logic
2021-02-20 01:25:01 +01:00
mageven
d9b3f3fa3a
Allow reconfiguring "Ignore Missing Services" during emulation (#2034) 2021-02-19 20:31:57 +01:00
Ac_K
b93fe5979a
nifm: Fix returned buffer size of GetClientId (#2036)
This PR fix an issue introduced on last IPC rewrite PRs where some returned buffer size have to be explicit now.
`GetClientId` without an explicit buffer size return some garbage to the guest and then `nifm` service crashes because of a wrong ClientId. It's fixed now.

Horizon Chase Turbo and Doom regression are fixed now.  (Probably some other games too)
2021-02-19 20:18:13 +01:00
Ac_K
c6d3c4207a
settings: Fix returned buffer size of GetFirmwareVersion (#2029) 2021-02-17 21:10:53 +01:00
Ac_K
80ed8596c1
prepo: Implement GetSystemSessionId and add perms (#2014)
* prepo: Implement GetSystemSessionId and add perms

* address feedbacks
2021-02-11 20:24:54 +01:00
Caian Benedicto
f16d7f91f1
Improve inline keyboard compatibility (#1959)
* Improve compatibility of the inline keyboard with some games

* Send an empty first text to avoid crashing some games

* Implement SetCustomizedDictionaries and fix SetCustomizeDic

* Expand Bg and Fg –abbreviations in the swkbd applet

* Fix variable names and add comments to software keyboard
2021-02-11 01:28:44 +01:00
Joshi234
51f7cc1483
Implemented ISystemSettingsServer.IsUserSystemClockAutomaticCorrectionEnabled (#1932)
* Added IsUserSystemClockAutomaticCorrectionEnabled

This is used when a game want to check if you game is synced with a server

* Update ISystemSettingsServer.cs

* Implemented OpenDataStorageWithProgramIndex

* Update IFileSystemProxy.cs

* Commited that file on accidant

* Update IFileSystemProxy.cs

* Revert "Merge branch 'master' of https://github.com/Joshi234/Ryujinx"

This reverts commit 375f430455, reversing
changes made to 672e2c8f7d.

* Revert "Update IFileSystemProxy.cs"

This reverts commit 672e2c8f7d.

* Update IFileSystemProxy.cs

* Update ISystemSettingsServer.cs

* removed accidantel addition of IFileSystemProxy.OpenDataStorageWithProgramIndex

* Update Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs

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

* Update Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs

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

* Fix formating and add missing stub

* Update ISystemSettingsServer.cs

* Update ISystemSettingsServer.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2021-02-09 09:41:31 +01:00
gdkchan
5ea7d77981
Fix inter-process data copy on non-contiguous physical regions (#1988) 2021-02-08 10:54:49 +11:00
mageven
d1e24ba5c2
Initial Setup: Reload keys before verifying firmware (#1955)
* Initial Setup: Reload keys before verifying firmware

Also, display the NoKeys dialog if keyset is empty when verifying
firmware.

* LoadApplications: Remove the lone debug log and print the error directly
2021-01-26 18:45:07 +01:00
mageven
6982282cc8
TZ: Fix loop condition in GetTZName (#1950)
Closes #1949
2021-01-23 13:29:14 +01:00
Caian Benedicto
3b20080637
Fix inverted read only flag in transfer memory creation (#1945) 2021-01-23 13:48:03 +11:00
gdkchan
6a95a3b01a
Fix alignment on CreateTransferMemoryStorage (#1937) 2021-01-19 21:48:27 -03:00
Ac_K
1364f36161
am: Implement CreateHandleStorage and fixes (#1929) 2021-01-19 13:28:35 +11:00
Bruno Macabeus
996e6905ba
android-fence: call callback when fence is invalid (#1881) 2021-01-13 10:53:13 +01:00
Caian Benedicto
e57b140429
Add support for inline software keyboard (#1868)
* Add background mode configuration to SoftwareKeyboardApplet

* Add placeholder text generator for Software Keyboard in background mode

* Add stub for GetIndirectLayerImageMap

* Fix default state of DecidedCancel response

* Add GUI text input to Software Keyboard in background mode

* Fix graphical glitch when Inline Software Keyboard appears

* Improve readability of InlineResponses class

* Improve code styling and fix compiler warnings

* Replace ServiceDisplay log class by ServiceVi

* Replace static readonly by const

* Add proper finalization to the keyboard applet in inline mode

* Rename constants to start with uppercase

* Fix inline keyboard not working with some games

* Improve code readability

* Fix code styling
2021-01-11 19:27:55 +01:00
Steven Smith
5117b21c52
Only attempt to import common tickets. (#1886) 2021-01-11 14:47:13 +11:00
Ac_K
3c09abf9e6
pctl: Stub IsFreeCommunicationAvailable (#1893)
* pctl: Stub IsFreeCommunicationAvailable

This PR stub call IsFreeCommunicationAvailable since it's the same as call CheckFreeCommunicationPermission without a sets of an internal field.
I've fixed a wrong logic found while I'm checked the call by RE.

This fix #1883.

* Fix comments
2021-01-10 21:26:59 +01:00
gdkchan
8e0a421264
Fix remap when handle is 0 (#1882)
* Nvservices cleanup and attempt to fix remap

* Unmap if remap handle is 0

* Remove mapped pool add from Remap
2021-01-10 10:11:31 +11:00
Ac_K
71e2a00221
am: stub PresetLibraryAppletGpuTimeSliceZero (#1876) 2021-01-08 23:43:36 -03:00
mageven
acf3a3f837
Update missing sample timestamp in DebugPad (#1873) 2021-01-07 19:43:33 +01:00
Somebody Whoisbored
a03ab0c4a0
Fix exefs mod loading with unpacked games (#1857)
* Add the ability to layeredfs individual exefs with mod loader

* Address code style issues

* Further adjustments to the mod loading

* Update Ryujinx.HLE/HOS/ModLoader.cs

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

* Apply suggestions from code review

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

* Address issue with checking for NSO existence (and code style fixes)

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2021-01-03 12:30:31 +01:00
Ac_K
b001040c2f
account: Services Refactoring (#1833)
* account: Services Refactoring

* Remove extra empty space

* Fix IProfile::Get

* address gdkchan feedback
2021-01-02 23:34:28 +01:00
Ac_K
4f01c13f50
surfaceflinger: Fix fence callback issue (#1839)
This PR fixes a regression introduced in #1741. The actual implementation do the assumption of fences always exist and then registering the callback.
Homebrews may not use fences, so the code crashes when it try to register the callback.
2021-01-02 23:21:44 +01:00
Bruno Macabeus
3e7383b3fd
services: add "apm:p" (#1854)
* services: add "apm:p"

* review: change amp:p version range

* review: remove uneeded calls

* review: fix ImanagerPrivileged
2021-01-02 16:11:38 +01:00
Bruno Macabeus
b9fd7c8b23
Remove long <-> ulong casts from Nvservices code (#1848)
* Remove long <-> ulong casts from Nvservices code

* review: fix lint
2021-01-01 19:03:33 -03:00
gdkchan
532b8cad13
Update KAddressArbiter implementation to 11.x kernel (#1851)
* Update KAddressArbiter implementation to 11.x kernel

* InsertSortedByPriority is no longer needed
2021-01-01 14:59:26 -03:00
Somebody Whoisbored
fb0db32338
Add the ability to add individual files exefs with mod loader (#1766)
Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-12-29 20:54:32 +01:00
LDj3SNuD
b5c215111d
PPTC Follow-up. (#1712)
* Added support for offline invalidation, via PPTC, of low cq translations replaced by high cq translations; both on a single run and between runs.

Added invalidation of .cache files in the event of reuse on a different user operating system.

Added .info and .cache files invalidation in case of a failed stream decompression.

Nits.

* InternalVersion = 1712;

* Nits.

* Address comment.

* Get rid of BinaryFormatter.

Nits.

* Move Ptc.LoadTranslations().

Nits.

* Nits.

* Fixed corner cases (in case backup copies have to be used). Added save logs.

* Not core fixes.

* Complement to the previous commit. Added load logs. Removed BinaryFormatter leftovers.

* Add LoadTranslations log.

* Nits.

* Removed the search and management of LowCq overlapping functions.

* Final increment of .info and .cache flags.

* Nit.

* GetIndirectFunctionAddress(): Validate that writing actually takes place in dynamic table memory range (and not elsewhere).

* Fix Ptc.UpdateInfo() due to rebase.

* Nit for retrigger Checks.

* Nit for retrigger Checks.
2020-12-17 20:32:09 +01:00
riperiperi
10aa11ce13
Interrupt GPU command processing when a frame's fence is reached. (#1741)
* Interrupt GPU command processing when a frame's fence is reached.

* Accumulate times rather than %s

* Accurate timer for vsync

Spin wait for the last .667ms of a frame. Avoids issues caused by signalling 16ms vsync. (periodic stutters in smo)

* Use event wait for better timing.

* Fix lazy wait

Windows doesn't seem to want to do 1ms consistently, so force a spin if we're less than 2ms.

* A bit more efficiency on frame waits.

Should now wait the remainder 0.6667 instead of 1.6667 sometimes (odd waits above 1ms are reliable, unlike 1ms waits)

* Better swap interval 0 solution

737 fps without breaking a sweat. Downside: Vsync can no longer be disabled on games that use the event heavily (link's awakening - which is ok since it breaks anyways)

* Fix comment.

* Address Comments.
2020-12-17 19:39:52 +01:00
Ac_K
eae39f80e7
nim: Implement IsLargeResourceAvailable (#1821)
* nim: Implement IsLargeResourceAvailable

* Fix comments
2020-12-17 05:19:28 +01:00
gdkchan
f5d64b4d68
Terminate application before services (#1812)
* Terminate application before services

* Use flags instead of title ID
2020-12-17 01:44:06 +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
Ac_K
808380690c
am/gui: Implement Wake-up message (#1750)
* am/gui: Implement Wake-up message.

This implement the ability to send a Wake-up (Resume) message to the guest.
Sometime games needs to Sleep and Wake-up the switch to unlock some ingame features.

* Address gdkchan feedback
2020-12-15 21:41:42 -03:00
gdkchan
19d18662ea
Correct type of executable sizes (#1802) 2020-12-13 08:30:27 +01:00
gdkchan
ef157bbe26
Remove inexistent buffer from GetNintendoAccountUserResourceCacheForApplication (#1809) 2020-12-12 22:10:12 +11:00
gdkchan
74aa7b20be
Rewrite size for fixed size buffers (#1808) 2020-12-12 14:06:20 +11:00
sharmander
8a6607540e
GPU: Improve unnecessary return value in Map function. (#1799)
* Implement VFNMA.F<32/64>

* Update PTC Version

* Update Implementation & Renames & Correct Order

* Add Logging

* Additional logging

* Add additional check to restart loop from beginning if address goes beyond maximum allowed.

* Additional Check that the total range required doesn't exceed capacity of allocator addresses.

* Improve logging

* Ensure hex output

* Update Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs

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

* Remove extra page at end

* Remove unnecessary return val in Map function.

* Remove incorrect description

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2020-12-11 06:05:53 +01:00
sharmander
d9ec2b3a81
GPU: Resolve Memory Allocation Issues (#1797)
* Implement VFNMA.F<32/64>

* Update PTC Version

* Update Implementation & Renames & Correct Order

* Add Logging

* Additional logging

* Add additional check to restart loop from beginning if address goes beyond maximum allowed.

* Additional Check that the total range required doesn't exceed capacity of allocator addresses.

* Improve logging

* Ensure hex output

* Update Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs

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

* Remove extra page at end

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2020-12-10 21:32:23 +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
3484265d37
am: Implement GetHealthWarningDisappearedSystemEvent (#1788)
This implement IApplicationFunctions GetHealthWarningDisappearedSystemEvent call which is needed by Mario Kart 8 in Chinese version. Call was checked by RE.
We still have to determine where to signals some AM events.

Thanks to Kakasita on our Discord to reported this and confirm this works fine!
2020-12-09 00:08:36 +01:00
riperiperi
4594c3b310
Signal memory tracking before/after mapping into another process (#1785)
* Signal memory tracking before/after mapping into another process

* Wording.

* Add missing method.
2020-12-07 21:42:17 -03:00
Mary
0ab1c42eea
Make sure to not leak copy handles passed in request (#1772)
* Make sure to not leak copy handles passed in request

Following last gdkchan's PR this make sure to close copy handles that
are passed by guest when it should.

* fix comment copy pasta
2020-12-03 19:19:10 +01:00
gdkchan
1b053d2222
Close audio WorkBuffer transfer memory handle (#1770) 2020-12-02 21:58:20 +01:00
gdkchan
f7617cae12
Create a single guest process per IPC message processor (#1769) 2020-12-02 13:14:44 +01:00
gdkchan
cf6cd71488
IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458)
* IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel

* Fix for applet transfer memory + some nits

* Keep handles if possible to avoid server handle table exhaustion

* Fix IPC ZeroFill bug

* am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer

CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0

* Make it exit properly

* Make ServiceNotImplementedException show the full message again

* Allow yielding execution to avoid starving other threads

* Only wait if active

* Merge IVirtualMemoryManager and IAddressSpaceManager

* Fix Ro loading data from the wrong process

Co-authored-by: Thog <me@thog.eu>
2020-12-02 00:23:43 +01:00
Ac_K
7b66cb0d90
audio: Cleanup Ryujinx.Audio and fix OpenAL issue (#1746)
* audio: Cleanup SoundIO and fix OpenAL issue

* fix tabs by spaces

* Fix extra spaces

* Fix SoundIO.cs

* Fix ContainsAudioOutBuffer
2020-11-27 20:55:00 +01:00
Ac_K
632a84155b
pctl: Implement IsRestrictionEnabled and fix CheckFreeCommunicationPermission (#1747)
* pctl: Implement IsRestrictionEnabled and fix CheckFreeCommunicationPermission

* fix comment
2020-11-24 21:19:06 +01:00
Ac_K
44c1f16280
am: Fix GetSaveDataSize stub (#1748) 2020-11-24 20:45:23 +01:00
Ac_K
fd0b9d1926
am: Cleaning and stub TryPopFromFriendInvitationStorageChannel (#1738) 2020-11-21 23:38:34 +01:00
Ac_K
3dc9bab91f
audin: fix wrong id ListAudioInsAuto call (#1737) 2020-11-21 21:43:36 +01:00
Ac_K
57c4e6ef21
audout: Implement and fix some calls (#1725)
* 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
2020-11-20 21:59:01 +01:00
Ac_K
c2356a7653
olsc: Add service olsc:u and stub some calls (#1734) 2020-11-20 09:56:23 +11:00
Ac_K
7c3b559830
loaders: Fix possible parsing errors of informations on some NSO (#1724)
This fix possible parsing errors of informations on some NSO where the "zero" field don't exist introduced by #1661 leading to crashes at start.

References:
https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/creport/source/creport_modules.cpp#L202
https://github.com/Thog/oss-rtld/blob/master/source/main.cpp#L14
2020-11-18 19:04:42 +01:00
Mary
863edae328
shader cache: Fix Linux boot issues (#1709)
* shader cache: Fix Linux boot issues

This rollback the init logic back to previous state, and replicate the
way PTC handle initialization.

* shader cache: set default state of ready for translation event to false

* Fix cpu unit tests
2020-11-17 22:40:19 +01:00
Ac_K
fcc9cbf816
am: Fix VR enabled by default (#1715)
This PR fix an issue I've made in #1688 which is enabled VR as default.
It could cause rendering issues in games when VR mode isn't used, as users have reported in Smash:
2020-11-15 22:38:11 -03:00
Ac_K
313f8d2eb6
am/lbl/hid/pctl: Enabled VR Rendering (#1688)
* am/lbl/hid/pctl: Enabled VR Rendering

This PR enable VR rendering on games which support it through the Toy-Con VR Goggles.

Please remember Ryujinx currently don't support console SixAxis sensor and for now, in some games, the view can't be moved.

Everything is implemented accordingly to RE:
- am: ICommonStateGetter: SetVrModeEnabled, BeginVrModeEx, EndVrModeEx.
- lbl: ILblController: SetBrightnessReflectionDelayLevel, GetBrightnessReflectionDelayLevel, SetCurrentAmbientLightSensorMapping, GetCurrentAmbientLightSensorMapping, SetCurrentBrightnessSettingForVrMode, GetCurrentBrightnessSettingForVrMode, EnableVrMode, DisableVrMode, IsVrModeEnabled.
- pctl: IParentalControlService: ConfirmStereoVisionPermission, ConfirmStereoVisionRestrictionConfigurable, GetStereoVisionRestriction, SetStereoVisionRestriction, ResetConfirmedStereoVisionPermission, IsStereoVisionPermitted.
- hid: IHidServer: ResetSevenSixAxisSensorTimestamp is stubbed because we don't support console SixAxisSensor for now.

Maybe we could add a setting later to enable or disable VR. But I think it's fine to keep this always available since you have to enable it in games.

* Fix permission flag check

* Address gdkchan feedback
2020-11-15 22:30:20 +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
mageven
8d0d299792
IPSwitch: Quick fix to patch sets toggling (#1668)
* IPSwitch: Quick fix to patch sets toggling

* fmt fix: newlines before continue and return
2020-11-13 02:35:49 +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
riperiperi
7166e82c3c
Update performance mode when docked mode changes. (#1696) 2020-11-12 16:59:18 +11:00
Ac_K
eda6b78894
apm/am: Refactoring/Unstub services (#1662)
* apm: Refactoring/Unstub service

This PR implement some IPC calls of apm service:
- nn::apm::IManager is fully implemented.
- nn::apm::ISession is fully implemented (close #1633).
- nn::apm::ISystemManager is partially implemented.

nn::appletAE::ICommonStateGetter have some calls which are just a layer of apm IPC calls. What we did in some calls was wrong, it's fixed now!

Everything is checked with RE.

* abstract Apm *Server as Thog requested

* abstract ISession and fix other classes

* Address gdkchan feedback

* Fix class

* Fix Logging
2020-11-08 17:00:54 -03:00
Ac_K
b677e44300
Loaders: Log extra NSO informations (#1661)
NSO files can contains useful informations who aren't currently logged.
This PR fix that by logging Module name, Libraries and SDK Version when they are available.
2020-11-06 19:58:57 +01:00
emmauss
9f13f957af
Motion Fixes (#1589)
* fix stalling when server is offline

* add retry timer to fail server connections, fix alt slot number

* fix alt slot key issue

* fix crash when saving controller config with empty fields

* code fixes

* add index check in motion hid update, made HandleResponse async

Co-authored-by: Emmanuel <nhv3@localhost.localdomain>
2020-10-28 20:52:07 +01:00
riperiperi
aec8177850
Replace Host FPS with GPU command queue load ("Fifo %") (#1585)
* Replace Host FPS with FIFO%

* Change measurement order. Improve calculation.

Now at 100% when FIFO is blocking game exectution, rather than "0".

* Address feedback (1)

* Remove Host FPS

* FIFO rather than Fifo

* Address Ac_k feedback

* Rebase
2020-10-14 07:54:42 +11:00
Mary
c482718d2e
surfaceflinger: Disable async buffer (#1603)
This fix a mistake I made during my original reimplementation of SurfaceFlinger by disabling async buffer.

This fix a memory corruption on Super Mario All-Stars 3D (Super Mario Sunshine & Super
Mario Galaxy now go ingame).

Thanks to @gdkchan for tracing the memory corruption.
2020-10-10 21:45:49 +11:00
Mary
8506b7a334
Fix exiting emulator with multi programs (#1590)
THis fix a bug introduced in #1560 that would cause "Stop emulation" to
actually restart the game all the time.
2020-10-10 00:52:11 +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
Ac_K
4f65043ad7
Basic impl of Error Applet (#1551) 2020-09-28 00:00:38 +02:00
mageven
16e9d15674
Isolate more services to separate threads (#1573)
* Isolate more services to separate threads

* Fix DisplayServer

* Add explanation for vi services
2020-09-25 20:18:28 +10:00
riperiperi
e00ca92063
Return "NotAvailable" when no UserChannel data is present. (#1569)
* Return "NotAvailable" when no UserChannel data is present.

* Return ObjectInvalid for undefined parameter kinds.

* No need to specify which, there's only one.

* Just works as a literal string.
2020-09-23 18:57:18 -03:00
mageven
840afabc22
Run audren in a separate thread (#1572) 2020-09-23 23:21:43 +02:00
gdkchan
6c9565693f
IPC refactor part 1: Use explicit separate threads to process requests (#1447)
* Changes to allow explicit management of service threads

* Remove now unused code

* Remove ThreadCounter, its no longer needed

* Allow and use separate server per service, also fix exit issues

* New policy change: PTC version now uses PR number
2020-09-22 14:50:40 +10:00
Mary
33f8284bc0
hle/ui: Basic multi programs support (#1560)
* hos/gui: Add a check of NCA program index in titleid

This add a check to `ApplicationLoader` for the last 2 digits of the game TitleId who seems to be the NCA program index.
We currently return the last index, instead of the lower one.
Same check is added to ApplicationLibrary in the UI.

I've cleaned up both file too.

* hle: implement partial relaunch logic

TODO: make the emulator auto relauch.

* Handle auto relaunch

* hle: Unify update usage system

* hle: Implement support of multi programs in update system

* Add some documentation

* Address rip's comment

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-09-21 13:45:30 +10:00
Ac_K
0158dc4db3
acc/hid: Implement ListQualifiedUsers and SetTouchScreenConfiguration (#1555)
* acc/hid: Implement ListQualifiedUsers and SetTouchScreenConfiguration

* Fix symbols
2020-09-20 14:32:58 +10:00
Ac_K
31a84eedcb
friend: Implement GetCompletionEvent and AddPlayHistory (#1554) 2020-09-20 13:45:46 +10:00
Ac_K
ac04cfa96c
am: Stub Begin/EndBlockingHomeButton (#1553) 2020-09-20 13:40:10 +10:00
Ac_K
da3a53a29c
caps: Stub SetShimLibraryVersion (#1552) 2020-09-20 13:32:48 +10:00
Billy Laws
4b1bed1b05
Correct the threshold for control stick buttons (#1483)
This was tested against HW with https://github.com/Xpl0itR/Input-Test/tree/master/Input-Test and a few changes to record the minimum value axis value when the stick buttons were marked as pressed.
2020-09-19 17:10:53 +02:00
riperiperi
5d69d9103e
Texture/Buffer Memory Management Improvements (#1408)
* Initial implementation. Still pending better valid-overlap handling,
disposed pool, compressed format flush fix.

* Very messy backend resource cache.

* Oops

* Dispose -> Release

* Improve Release/Dispose.

* More rule refinement.

* View compatibility levels as an enum - you can always know if a view is only copy compatible.

* General cleanup.

Use locking on the resource cache, as it is likely to be used by other threads in future.

* Rename resource cache to resource pool.

* Address some of the smaller nits.

* Fix regression with MK8 lens flare

Texture flushes done the old way should trigger memory tracking.

* Use TextureCreateInfo as a key.

It now implements IEquatable and generates a hashcode based on width/height.

* Fix size change for compressed+non-compressed view combos.

Before, this could set either the compressed or non compressed texture with a size with the wrong size, depending on which texture had its size changed. This caused exceptions when flushing the texture.

Now it correctly takes the block size into account, assuming that these textures are only related because a pixel in the non-compressed texture represents a block in the compressed one.

* Implement JD's suggestion for HashCode Combine

Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>

* Address feedback

* Address feedback.

Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>
2020-09-10 16:44:04 -03:00
Alex Barney
1bb7fdaca4
Update to LibHac 0.12.0 (#1485)
* Update to LibHac 0.12.0

* Auto-formatting. Fixed a bug in SetApplicationCopyrightImage
2020-09-01 17:08:59 -03: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
2f2623b379
Clean up and update readme (#1501)
* Clean up and update readme

THis clean up and improve the README a bit.

* Apply suggestions from code review

Co-authored-by: EmulationFanatic <62343878+EmulationFanatic@users.noreply.github.com>

Co-authored-by: EmulationFanatic <62343878+EmulationFanatic@users.noreply.github.com>
2020-08-30 18:35:42 +02:00
mageven
27179d0218
Improve multi-controller support in HID and Controller Applet (#1453)
* Initial commit

Enable proper LED patterns
Toggle Hotkeys only on focus
Ignore Handheld on Docked mode
Remove PrimaryController
Validate NpadIdType
Rewrite NpadDevices to process config in update loop
Cleanup

* Notify in log periodically when no matched controllers

* Remove duplicate StructArrayHelpers in favor of Common.Memory

Fix struct padding CS0169 warns in Touchscreen

* Remove GTK markup from Controller Applet

Use IList instead of List
Explicit list capacity in 1ms loop
Fix formatting

* Restrict ControllerWindow to show valid controller types

Add selected player name to ControllerWindow title

* ControllerWindow: Fix controller type initial value

NpadDevices: Simplify default battery charge

* Address AcK's comments

Use explicit types and fix formatting

* Remove HashSet for SupportedPlayers

Fixes potential exceptions due to race

* Fix ControllerSupportArg struct packing

Also comes with two revisions of struct for 4/8 players max.
2020-08-23 22:54:11 +02:00
Ac_K
5eb0ee3cca
account: Implement IManagerForApplication calls and IAsyncContext (#1466)
* account: Implement IManagerForApplication calls and IAsyncContext

This implement:
- IManagerForApplication::EnsureIdTokenCacheAsync (accordingly to RE) but the Async task is stubbed.
- IAsyncContext interface (accordingly to RE).
- IManagerForApplication::LoadIdTokenCache (checked with RE, and stubbed).

I've tried some games but now they needs some `sfdnsres` calls, some other boots and crashes with other issues.
Maybe we should disable the connection somewhere to lets the game think we are offline. I have done many attempts, without success, but since the code is here now, it's better than nothing.

(I've cleaned up `using` of IGeneralService too)

Closes #629 and closes #630

* change AccountId

* Fix gdkchan's comments

* use CompletedTask
2020-08-18 21:24:54 +02:00
Mary
5b26e4ef94
Misc audio fixes (#1348)
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)
2020-08-18 21:03:55 +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
Ac_K
1ad9045c6b
bluetooth: Fix event handle in IBluetoothDriver (#1464)
This fix the InitializeBluetoothLe call who didn't return any event handle
2020-08-13 01:04:59 +02:00
LDj3SNuD
e36e97c64d
CPU: This PR fixes Fpscr, among other things. (#1433)
* CPU: This PR fixes Fpscr, among other things.

* Add Fpscr.Qc = 1 if sat. for Vqrshrn & Vqrshrun.

* Fix Vcmp & Vcmpe opcode table.

* Revert "Fix Vcmp & Vcmpe opcode table."

This reverts commit c117d9410d.

* Address PR feedbacks.
2020-08-08 17:18:51 +02:00
Alex Barney
8d59ad88b4
Forward OpenSaveDataInfoReaderOnlyCacheStorage to OpenSaveDataInfoReaderWithFilter (#1449) 2020-08-08 16:02:06 +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
c11855565e
Implement Software Keyboard GTK frontend (#1434)
* Implement SwKbd GUI

* Relocate UI handler to Emu Context from Config

Also create a common interface for UI handlers in the context and specialize for Gtk

Add basic input length validation in InputDialog

* Add Transfer Memory support to AppletCreator

Read Initial Text for SwKbd using Transfer Memory

* Improve InputDialog widget

Improve length validation
Has extra label to show validition info
Handle potential errors and log them

* Misc improvements

* Improve string validation
* Improve error handling
* Remove tuple in struct
* Address formatting nits

* Add proper Cancel functionality

Also handle GUI errors in UI handler

* Address jD's comments

* Fix _uiHandler init

* Address AcK's comments
2020-08-03 03:30:58 +02:00
Ac_K
1457ab5456
friend: Implement GetPlayHistoryRegistrationKey (#1424)
* friend: Implement GetPlayHistoryRegistrationKey

This implement IServiceCreator::GetPlayHistoryRegistrationKey call accordingly to RE.

Close #1110

* Fix comments

* Fix guid and comment some codes

* Improve guid casting and remove unused vars
2020-08-02 02:20:44 +02:00
Mary
3c099454ca
fs: stub ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute (#1443)
This is required by AC:NH for the new online save features of 1.4.0
2020-07-31 12:25:33 +02:00
gdkchan
57bb0abda3
Print guest stack trace on invalid memory access (#1407)
* Print guest stack trace on invalid memory access

* Improve XML docs
2020-07-30 23:16:41 +10: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
Ac_K
d8515b603b
audin: Implement IAudioInManager ListAudioIns (#1419)
* audin: Implement IAudioInManager ListAudioIns

This implement some calls of IAudioInManager:
- ListAudioIns
- ListAudioInsAuto
- ListAudioInsAutoFiltered

Accordingly to RE.

Close #1056

* Fix count

* Comment condition

* Fix comment
2020-07-27 00:25:04 +02:00
gdkchan
8dbcae1ff8
Implement BGRA texture support (#1418)
* Implement BGRA texture support

* Missing AppendLine

* Remove empty lines

* Address PR feedback
2020-07-26 00:03:40 -03:00
Alex Barney
41ac824273
Update to LibHac 0.11.3 (#1414)
Removes the timeout when deleting files from the local file system
2020-07-24 06:12:19 +02:00
gdkchan
5a7df48975
New GPFifo and fast guest constant buffer updates (#1400)
* Add new structures from official docs, start migrating GPFifo

* Finish migration to new GPFifo processor

* Implement fast constant buffer data upload

* Migrate to new GPFifo class

* XML docs
2020-07-23 23:53:25 -03:00
Ac_K
9e141bc3da
vi: Implement GetIndirectLayerImageRequiredMemoryInfo (#1415)
This implement GetIndirectLayerImageRequiredMemoryInfo call from vi service, accordingly to RE.

Thanks to Thog and gdkchan for helping me to understand some GPU things.

Close #942
2020-07-23 20:25:41 +10:00
Ac_K
c6e12949e5
Add multiple calls to am service (#1411)
* Add multiple calls to am service

This implement/stub some am calls:

- SetAutoSleepDisabled
- IsAutoSleepDisabled
- SetAlbumImageTakenNotificationEnabled
- EnableApplicationCrashReport
- GetPreviousProgramIndex
- NeedsToExitProcess
- RequestForAppletToGetForeground
- GetIndirectLayerConsumerHandle

All checked by RE.
Additionnaly to that, there is some cleanup here and there.

Fix #1387, #1324, #1165, #1163, #1065

* Fix casting

* Thread safe assign
2020-07-22 14:56:00 +10:00
mageven
4aa47a66c6
Better TimeZone entry in System Settings (#1254)
* Better timezone labels in System TimeZone

Replace with GtkEntry with auto-complete

Also removed async task as now loading is fast

Address Thog's comments

self-nit: Remove string alias

Address AcK's comments

* Improve parsing
* Optimize and fix string matching

Address jD's comments

* Also, make abbreviations searchable
* Optimize EntryCompletion's MatchFunc

* nit: Result.IsFailure()

* Fix potential crash on opening Settings window w/o FW installed
2020-07-21 06:14:42 +02:00
gdkchan
1c84b683c2
Fix IDeliveryCacheProgressService GetEvent (#1409) 2020-07-21 10:54:50 +10:00
Mary
d5c34291a3
ipc hle: Fix disposing of session created with MakeObject (#1404)
This fix a missing part of #1397, making HLE ipc session being disposed
when needed.

THis is needed for upcoming wip changes.
2020-07-20 12:23:26 +10:00
gdkchan
e7f2a5ecb7
Fix session service disposal and improve transfer memory implementation (#1397)
* Fix session service disposal and improve transfer memory implementation

* Remove useless assignment
2020-07-19 15:24:18 -03:00
gdkchan
9d65de74fc
Do not print guest stack trace for svcBreak debug calls (#1398) 2020-07-18 12:54:41 +10:00
gdkchan
20774dab14
Improve kernel WaitSynchronization syscall implementation (#1362) 2020-07-17 14:22:13 +10:00
gdkchan
9f6b24edfd
Improve kernel IPC related syscalls (#1379)
* Implement session count decrement when the handle is closed

* Remove unused field

* Implement SendSyncRequestWithUserBuffer, SendAsyncRequestWithUserBuffer and ReplyAndReceiveWithUserBuffer syscalls

* Nits

* Fix swapped copy dst/src

* Add missing pointer buffer descriptor write on reply

* Fix IPC unaligned buffer copy and restoring client attributes on reply

* Oops

* Fix SetIpcMappingPermission

* Fix unaligned copy bugs

* Free memory used for temporary IPC buffers
2020-07-17 14:19:07 +10:00
gdkchan
46f8cef6a9
Fix resource limit reserve taking too long (#1391) 2020-07-17 14:18:31 +10:00
mageven
16dafe6316
mods: Fix crash when loading via LoadCart (#1388) 2020-07-15 09:40:17 +10: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
Mary
43b78ae157
prepo: Update implementation for 10.x changes (#1361)
* prepo: Update implementation for 10.x changes

On 10.x, Nintendo changed yet another time the prepo SaveReport &
SaveReportWithUser command ids.

This PR add support for command 10104 & 10105 and update naming of the
old variants to match switchbrew.

* Fix misalign and remove a ToString

* Address jD's comment
2020-07-05 10:58:11 +10:00
Mary
2c48750ff0
Fix compilation warnings and use new LibHac APIs for executable loading (#1350)
* Fix compilation warnings and use new LibHac APIs for executable loading

* Migrate NSO loader to the new reader and fix kip loader

* Fix CS0162 restore

* Remove extra return lines

* Address Moose's comment
2020-07-04 01:58:01 +02:00
mageven
5644780e6e
Stub nifm IRequest GetAppletInfo (#1326)
* Stub GetAppletInfo to be consistent with GetResult

* Fix formatting and enum

* Update and use ResultCode
2020-07-04 00:48:07 +02:00
Mary
c70056bc76
sockets: Make sure to write the receivedBuffer (#1346)
Fix #1341
2020-07-04 00:13:35 +02:00
Xpl0itR
4472196b48 Import DLC title key from ticket when loading into content manager (#1318) 2020-06-23 16:48:27 +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
VolcaEM
a78a69a6e7
Update NRR structs (#1291)
* Update NRR structs

This was based on Switchbrew page: switchbrew.org/wiki/NRR

* Address review comments
2020-06-22 13:36:55 +02:00
mageven
1c2af7ce92
Implement aoc:u and support loading AddOnContent (#1221)
* Initial rebased AddOnContent support

* Fix bounds calculation
* Use existing GameCard in VFS per Xpl0itR's suggestion
+ Add dummy IPurchaseEventManager per AcK's suggestion

* Support multiple containers

* Add option to selectively disable addons

* Import tickets from AOC FS

* Load all nsps in base directory automatically

* Revert LoadNsp renaming

Removes conflicts with Mods PR. Not much is lost, old names were fine.

* Address AcK's comments

* Address Thog's comments

Dispose opened nsp files
Fix potential bug by clearing metadata on load
2020-06-20 19:38:14 +02: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
Shrek5InTheatres2019
4ef689c67d
Stubbing ImportServerPki (#1281)
* Stubbed ImportServerPki

* thought it might be nice to name this variable properly

* i really need to name variables better

* Change Var

Co-authored-by: Thog <thog@protonmail.com>

* Change .ReadBytes(5) to IPC send buffer

Co-authored-by: Thog <thog@protonmail.com>

* Add description comment

Co-authored-by: Thog <thog@protonmail.com>

* fix build issue

* Resolve final suggestion

Co-authored-by: Thog <thog@protonmail.com>

* uhh

* it should work now shut up

* aligned variables just look so much nicer :)

* better variable alignment

* aligned

Co-authored-by: Thog <thog@protonmail.com>
2020-06-06 13:04:30 +02:00
Thog
bcb7761eac
SurfaceFlinger: fix some bugs (#1262)
* SurfaceFlinger: fix some bugs

This fixes some bugs in the current implementation and make it closer to
the real implementation.

* Fix align of some variables
2020-06-02 17:58:19 +02:00
mageven
b663cd22c8
Fix GetDesiredLanguage (#1275)
* Fix GetDesiredLanguage

* Correct tzcnt slip-up

* Address gdkchan's comments
2020-05-27 10:40:23 +02:00
mageven
6b55cedd73
Fix GetDisplayVersion (#1276) 2020-05-27 18:22:50 +10:00
Thog
cc8dbdd3fb
time: Make sure to initialize the network system clock with a valid system clock (#1259)
This should fix AC:NH events and probably other games.
2020-05-20 11:35:30 +02:00
Alex Barney
9544ed98b6
Update to LibHac 0.11.2 (#1240) 2020-05-16 12:12:13 +02:00
Thog
da3fd3f71b surfaceflinger: FreeBufferLocked doesn't reset the graphic buffer
That's the job of the user on Horizon (via SetPreallocatedBuffer).
2020-05-15 12:20:24 +02:00
mageven
ba4830293e
Refactor out Application details from Horizon (#1236)
* Initial Application refactor

* Misc typo and access modifier fixes

* Clean unused namespaces

* Address gdkchan's comments

* Move ticket reading to common method

* Change IParentalControlService to use ApplicationLoader.ControlData
2020-05-15 03:16:46 -03:00
Thog
0ff00bd6d3
am: Implement common web applets (#1188)
* am: Implemnet common web applets

This implement parsing of input and output of web applets while making
those close directly.

TODO for the future: Use and hook a web browser.

* Address Ac_K's comments
2020-05-15 03:56:14 +02:00
Thog
378259a40a
Surface Flinger: Implement GetBufferHistory (#1232)
* Surface Flinger: Implement GetBufferHistory

Also fix some bugs on the Surface Flinger implementation

* Address Ac_K's comment
2020-05-15 03:30:08 +02:00
Ac_K
b2e5855928
pctl: refactoring IParentalControlServiceFactory and IParentalControl… (#1219)
* pctl: refactoring IParentalControlServiceFactory and IParentalControlService call

Our previous implementation was totally guessed. Now it's implemented according to RE, even if it's stubbed because we will not support Parental Control for now.

* unknownFlag > permissionFlag
2020-05-15 03:14:38 +02:00
Ac_K
1f8e45c2ba
nvdrv: Partially implementation of GetStatus (#1215)
* nvdrv: Partially implementation of GetStatus

This implement GetStatus call according to RE.
Since we don't handle tranfert memory on the initialize of the service, it's fine sets fields at 0 for now.
Tested on Undertale.

Fix #635

* Fix struct
2020-05-13 15:29:16 +10:00
VolcaEM
b96aa7574f
Add missing error code to Time (#1237)
The error code was taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)

Even if TimeServiceNotInitialized's "description" is 0, the result "value" of "(0 << ErrorCodeShift) | ModuleId" is 0x74 so it is not the same as "Success" (0)
2020-05-13 15:28:53 +10:00
Ac_K
76e1a162dd
am: Implement GetFriendInvitationStorageChannelEvent (#1220)
* am: Implement GetFriendInvitationStorageChannelEvent

This implement GetFriendInvitationStorageChannelEvent according to RE, needed by Streets of Rage 4

* Fix handle name

* add GetNotificationStorageChannelEvent
2020-05-12 16:52:27 +02:00
mageven
492bb6ee5f
Suppress CS0169 CS0649 warns from HID structs (#1222)
Also fix typo in a pragma restore in Logger
2020-05-10 16:02:41 +02:00
VolcaEM
be98a7a649
Add various error codes to Settings (#1229)
The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
2020-05-10 13:33:15 +02:00
VolcaEM
1dd78142fa
Add two error codes to SDB PDM (#1230)
* Add two error codes to SDB PDM

The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)

* Remove empty line
2020-05-09 10:57:19 +02:00
VolcaEM
8b81819716
Add two error codes to Mii (#1224)
* Add two error codes to Mii

The two errors added are InvalidDatabaseSignatureValue and InvalidDatabaseEntryCount, which were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)

* Fix typo

* Remove unnecessary empty line
2020-05-08 16:23:26 +02:00
VolcaEM
fe72bc9274
Add various error codes to NCM LR (#1225)
The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
2020-05-08 16:06:32 +02:00
gdkchan
1e687c4eea
Fix block iteration on kernel MemoryManager InsertBlock function (#1184) 2020-05-06 22:48:57 +10:00
plutoo
7f500e7cae
set: Quick implementation of GetKeyCodeMap/GetKeyCodeMap2 (#1210)
* set: Quick implementation of GetKeyCodeMap/GetKeyCodeMap2

This fixed USB keyboard access in official titles.

* hid: Stub SendKeyboardLockKeyEvent

* Update Ryujinx.HLE/HOS/Services/Settings/ISettingsServer.cs

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

* Update Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs

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

* set: KeyboardLayout bringup

* set: Small bugfix

* Fix GetKeyCodeMapImpl

* Revert SystemRegion > RegionCode in Configuration

* Fix SendKeyboardLockKeyEvent

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-05-05 20:50:53 +02:00
VolcaEM
f84fb20959
Add error code for denied internet request in Friends (#1207)
* Add error code for denied internet request in Friends

* Fix formatting from previous PR
2020-05-04 23:10:15 +10:00
VolcaEM
232d53a1ff
Add various error codes to Loader (#1208)
* Add various result codes to Loader

The error codes were taken from Switchbrew (switchbrew.org/wiki/Error_codes)

For the last 9 errors, Switchbrew says: ACID/ACI0 don't match for descriptor (descriptor)

* Fix typo
2020-05-04 13:22:28 +02:00
gdkchan
15d1cc806b
Move kernel state out of the Horizon class (#1107)
* Move kernel state from Horizon to KernelContext

* Merge syscalls partial classes, split 32 and 64-bit variants

* Sort usings
2020-05-04 13:41:29 +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
gdkchan
f77694e4f7
Implement a new physical memory manager and replace DeviceMemory (#856)
* Implement a new physical memory manager and replace DeviceMemory

* Proper generic constraints

* Fix debug build

* Add memory tests

* New CPU memory manager and general code cleanup

* Remove host memory management from CPU project, use Ryujinx.Memory instead

* Fix tests

* Document exceptions on MemoryBlock

* Fix leak on unix memory allocation

* Proper disposal of some objects on tests

* Fix JitCache not being set as initialized

* GetRef without checks for 8-bits and 16-bits CAS

* Add MemoryBlock destructor

* Throw in separate method to improve codegen

* Address PR feedback

* QueryModified improvements

* Fix memory write tracking not marking all pages as modified in some cases

* Simplify MarkRegionAsModified

* Remove XML doc for ghost param

* Add back optimization to avoid useless buffer updates

* Add Ryujinx.Cpu project, move MemoryManager there and remove MemoryBlockWrapper

* Some nits

* Do not perform address translation when size is 0

* Address PR feedback and format NativeInterface class

* Remove ghost parameter description

* Update Ryujinx.Cpu to .NET Core 3.1

* Address PR feedback

* Fix build

* Return a well defined value for GetPhysicalAddress with invalid VA, and do not return unmapped ranges as modified

* Typo
2020-05-04 08:54:50 +10:00
VolcaEM
b0f0bd205d
Add various error codes to Audio (#1201)
The error codes were taken from Switchbrew (switchbrew.org/wiki/Error_codes)
2020-05-03 22:45:22 +02:00
VolcaEM
cf1ea4d155
Add various error codes to BCAT (#1202)
* Add various error codes to BCAT

The error codes were taken from Switchbrew (switchbrew.org/wiki/Error_codes)

As for InternetRequestDenied, it seems that this error is common for multiple services like Account for example
I already added this error code in Account in PR #1182

* Add some results codes from Libhac and keep names consistent
2020-05-03 17:06:30 +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
764891e670
nvservice: add a lock around NvHostEvent and remove release fence on SFv2 (#1197)
* nvservice: add a lock to NvHostEvent

* Disable surface flinger release fence and readd infinite timeout

* FenceAction: Add a timeout of 1 seconds as this shouldn't wait forever anyuway

* surfaceflinger: remove leftovers from the release fence

* Don't allow infinite timeout on syncpoint while printing all timeout for better debugging
2020-05-02 22:47:06 +02:00
VolcaEM
0a3b75ae2b
Add error code for denied internet request in Account (#1182)
InternetRequestDenied (I can't find a better name) was taken from Switchbrew (switchbrew.org/wiki/Error_codes)
Regarding this error, SwitchBrew notes: "IsAnyInternetRequestAccepted with the output from GetClientId returned false."
2020-05-02 14:12:11 +02:00
VolcaEM
8a7c00c39a
Add various error codes to AM (#1183)
* Add various error codes to AM

The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)

* TitleID -> TitleId
2020-05-02 13:45:45 +02:00
Thog
81cba3c3df
nvservices: mitigate abort with heavy load on the GPU processing thread (#1173)
* nvservices: mitigate abort with heavy load on the GPU processing thread.

This should fix Mario Tennis and LM3 regressions with syncpoints.

NOTE: Mario Tennis seems to have another issue related to the texture
cache that happens randomly when starting a match.

PS: Also add a debug logger for all known ioctl call to facilitate
debugging and add a missing UpdateMin in EventSignal.

* Address LDj3SNuD's comment

* Address gdkchan's comment
2020-05-01 23:18:42 +02:00
Thog
a0c06103c9
am: add IsVrModeEnabled (#1189)
* am: stub IsVrMode

Needed by SSBU 7.0.0

* Address Ac_K's comments
2020-05-01 18:51:00 +02:00
Alex Barney
ba7db8ccef
Update to LibHac 0.11.1 (#1186)
- Adds EnumerateDeliveryCacheDirectory to BCAT
2020-05-01 00:11:10 +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
Alex Barney
7ab3fccd4d
Add BCAT delivery cache support (#1154)
* Initial bcat delivery cache support

* Use LibHac 0.11.0

* Add option to open the BCAT savedata directory
2020-04-30 14:58:19 +10:00
Thog
23170da5a0
audren: implement Renderer Info output informations (#1179)
This implement the rendering information output informations of
RequestUpdate.

This is needed by some games to keep track of the count of update on the
DSP.
2020-04-30 13:03:05 +10: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
gdkchan
bcc5b0d21e
Fix kernel memory allocator block coalescing (#1155)
* Fix kernel memory allocator block coalescing

* Fix and move clear bit logic to a separate method
2020-04-25 23:25:22 +10:00
Thog
75ec30c962
SurfaceFlinger: fix SetPreallocatedBuffer correctness (#1153)
Nintendo sets the buffer count in SetPreallocatedBuffer too.

This fix triple buffering on all games and finally fix SSBU flickering.
2020-04-25 12:08:50 +02:00
Thog
cdbb689b80
Add support for dynamic docking/undocking (#1147)
* Add support for dynamic docking/undocking

As SurfaceFlinger is now working more accurately, we can now support
dynamic configuration of docking mode :)

* Simplify a bt the code

* Fix import ordering

* Remove unused argument
2020-04-23 13:59:11 +02:00
Thog
21a0b0ebeb
SurfaceFlinger: Invalid GraphicBuffer in SetPreallocatedBuffer (#1145)
This invalidate the GraphicBuffer on the consumer side when
SetPreallocatedBuffer is called on a buffer slot.

This fix rendering issues on games with a dynamic resolution like Yoshi
Crafted World.
2020-04-22 21:18:53 +02: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
Cristallix
4738113f29
Suppress warnings from fields never used or never assigned (CS0169 and CS0649) (#919)
* chore : disable unwanted warnings and minor code cleanup

* chore : remove more warnings

* fix : reorder struct correctly

* fix : restore _isKernel and remove useless comment

* fix : copy/paste error

* fix : restore CallMethod call

* fix : whitespace

* chore : clean using

* feat : remove warnings

* fix : simplify warning removal on struct

* fix : revert fields deletion and code clean up

* fix : re-add RE value

* fix : typo
2020-04-21 07:59:59 +10:00
Thog
644de99e86
Implement GPU syncpoints (#980)
* Implement GPU syncpoints

This adds support for GPU syncpoints on the GPU backend & nvservices.

Everything that was implemented here is based on my researches,
hardware testing of the GM20B and reversing of nvservices (8.1.0).

Thanks to @fincs for the informations about some behaviours of the pusher
and for the initial informations about syncpoints.

* syncpoint: address gdkchan's comments

* Add some missing logic to handle SubmitGpfifo correctly

* Handle the NV event API correctly

* evnt => hostEvent

* Finish addressing gdkchan's comments

* nvservices: write the output buffer even when an error is returned

* dma pusher: Implemnet prefetch barrier

lso fix when the commands should be prefetch.

* Partially fix prefetch barrier

* Add a missing syncpoint check in QueryEvent of NvHostSyncPt

* Address Ac_K's comments and fix GetSyncpoint for ChannelResourcePolicy == Channel

* fix SyncptWait & SyncptWaitEx cmds logic

* Address ripinperi's comments

* Address gdkchan's comments

* Move user event management to the control channel

* Fix mm implementation, nvdec works again

* Address ripinperi's comments

* Address gdkchan's comments

* Implement nvhost-ctrl close accurately + make nvservices dispose channels when stopping the emulator

* Fix typo in MultiMediaOperationType
2020-04-19 11:25:57 +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
Alex Barney
6a94538b6d
Ensure account save data exists when launching an extracted game (#1108)
Also fix a regression from cecbd256 where the dummy control data wouldn't be used
2020-04-15 10:10:27 +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
Alex Barney
6052aa17f2
Print the result name in SetTerminateResult if possible (#1105) 2020-04-12 22:13:23 +10:00
Elise
dc144d2e19
Use libhac for loading NSO and KIP (#1047)
* Use libhac for loading NSOs and KIPs

* Fix formatting

* Refactor KIP and NSO executables for libhac

* Fix up formatting

* Remove Ryujinx.HLE.Loaders.Compression

* Remove reference to Ryujinx.HLE.Loaders.Compression in NxStaticObject.cs

* Remove reference to Ryujinx.HLE.Loaders.Compression in KernelInitialProcess.cs

* Rename classes in Ryujinx.HLE.Loaders.Executables

* Fix space alignment

* Fix up formatting
2020-04-07 19:41:02 -03:00
mageven
4d93f97408
Revert SwKbd Applet ReadStruct and fix IApplet's ReadStruct to catch (#1087)
error at compile time
2020-04-03 17:53:06 +11:00
mageven
2365ddfc36
HID SharedMem Rework (#1003)
* Delete old HLE.Input

* Add new HLE Input.

git shows Hid.cs as modified because of the same name. It is new.

* Change HID Service

* Change Ryujinx UI to reflect new Input

* Add basic ControllerApplet

* Add DebugPad

Should fix Kirby Star Allies

* Address Ac_K's comments

* Moved all of HLE.Input to Services.Hid
* Separated all structs and enums each to a file
* Removed vars
* Made some naming changes to align with switchbrew
* Added official joycon colors

As an aside, fixed a mistake in touchscreen headers and added checks to
important SharedMem structs at init time.

* Further address Ac_K's comments

* Addressed gdkchan's and some more Ac_K's comments

* Address AcK's review comments

* Address AcK's second review comments

* Replace missed Marshal.SizeOf and address gdkchan's comments
2020-04-03 11:10:02 +11:00
Thog
8f21db810d
Reduce requirements for running homebrew (#1053)
* Reduce requirements for running homebrews

This commit change the following behaviours:

- TimeZoneBinary system archive isn't required until guest code call LoadTimeZoneRule.
- Fonts system archives aren't requred until a "pl:u" IPC call is made.
- Custom font support was dropped.
- TimeZoneBinary missing message is now an error and not a warning.

* Address comments
2020-03-30 08:23:05 +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
56374c8633
prepo: Implement RequestImmediateTransmission and GetTransmissionStatus (#1033)
* prepo: Implement RequestImmediateTransmission and GetTransmissionStatus

This implement RequestImmediateTransmission and GetTransmissionStatus of the prepo service accurately to RE.
Since we don't use reports, I've explained what the calls do in the real service.

Close #958

* fix comment
2020-03-25 12:28:15 +01:00
Alex Barney
21c9c04f9f
Add IMultiCommitManager (#1011)
* Update LibHac

* Add IMultiCommitManager

* Updates

* Delete NuGet.Config

* Add command version
2020-03-25 19:14:35 +11:00
jduncanator
daecb1193d
prepo: Resolve JSON parsing issues in prepo report handling (#1022)
It seems MsgPack.Cli incorrectly converts some unicode control characters directly to JSON literal Unicode strings (eg. '\1'). As these are invalid, pretty printing the JSON report fails.

This removes pretty printing, pending a proper implementation, and tidies up MsgPack deserialization.
2020-03-24 23:26:37 +01:00
Thog
e590262531
friends: Stub GetBlockedUserListIds (#1017) 2020-03-23 22:19:45 +01:00
Ac_K
b2d307d34f
Fix Prepo parsing reports (#1016)
This fix the parsing of prepo service reports which could failed in some edge case. I've improved the parsing of the object to a JSON string too.
2020-03-23 21:58:41 +01: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
Thog
7475e180b4
audren: Accept REV8 (#993)
REV8 only added changes on performance buffer and wavebuffer dsp command
generation.

As we don't support any of those, we can just increment the revision
number for now.
2020-03-18 09:43:47 +11:00
riperiperi
d904706fc0
Use a Jump Table for direct and indirect calls/jumps, removing transitions to managed (#975)
* Implement Jump Table for Native Calls

NOTE: this slows down rejit considerably! Not recommended to be used
without codegen optimisation or AOT.

- Does not work on Linux
- A32 needs an additional commit.

* A32 Support

(WIP)

* Actually write Direct Call pointers to the table

That would help.

* Direct Calls: Rather than returning to the translator, attempt to keep within the native stack frame.

A return to the translator can still happen, but only by exceptionally
bubbling up to it.

Also:
- Always translate lowCq as a function. Faster interop with the direct
jumps, and this will be useful in future if we want to do speculative
translation.
- Tail Call Detection: after the decoding stage, detect if we do a tail
call, and avoid translating into it. Detected if a jump is made to an
address outwith the contiguous sequence of blocks surrounding the entry
point. The goal is to reduce code touched by jit and rejit.

* A32 Support

* Use smaller max function size for lowCq, fix exceptional returns

When a return has an unexpected value and there is no code block
following this one, we now return the value rather than continuing.

* CompareAndSwap (buggy)

* Ensure CompareAndSwap does not get optimized away.

* Use CompareAndSwap to make the dynamic table thread safe.

* Tail call for linux, throw on too many arguments.

* Combine CompareAndSwap 128 and 32/64.

They emit different IR instructions since their PreAllocator behaviour
is different, but now they just have one function on EmitterContext.

* Fix issues separating from optimisations.

* Use a stub to find and execute missing functions.

This allows us to skip doing many runtime comparisons and branches, and reduces the amount of code we need to emit significantly.

For the indirect call table, this stub also does the work of moving in the highCq address to the table when one is found.

* Make Jump Tables and Jit Cache dynmically resize

Reserve virtual memory, commit as needed.

* Move TailCallRemover to its own class.

* Multithreaded Translation (based on heuristic)

A poor one, at that. Need to get core count for a better one, which
means a lot of OS specific garbage.

* Better priority management for background threads.

* Bound core limit a bit more

Past a certain point the load is not paralellizable and starts stealing from the main thread. Likely due to GC, memory, heap allocation thread contention. Reduce by one core til optimisations come to improve the situation.

* Fix memory management on linux.

* Temporary solution to some sync problems.

This will make sure threads exit correctly, most of the time. There is a potential race where setting the sync counter to 0 does nothing (counter stays at what it was before, thread could take too long to exit), but we need to find a better way to do this anyways. Synchronization frequency has been tightened as we never enter blockwise segments of code. Essentially this means, check every x functions or loop iterations, before lowcq blocks existed and were worth just as much. Ideally it should be done in a better way, since functions can be anywhere from 1 to 5000 instructions. (maybe based on host timer, or an interrupt flag from a scheduler thread)

* Address feedback minus CompareAndSwap change.

* Use default ReservedRegion granularity.

* Merge CompareAndSwap with its V128 variant.

* We already got the source, no need to do it again.

* Make sure all background translation threads exit.

* Fix CompareAndSwap128

Detection criteria was a bit scuffed.

* Address Comments.
2020-03-12 14:20:55 +11:00
Alex Barney
08c0e3829b
Insert the SD card by default (#968) 2020-03-10 09:34:35 +11:00
Ac_K
25c3b8b356
Implement some calls of ISelfController (#965)
* Implement some calls of ISelfController

This PR implement some calls of ISelfController:

- EnterFatalSection
- LeaveFatalSection
- GetAccumulatedSuspendedTickValue (close #937)

According to RE of the 8.1.0 am service.

* thread safe increment/decrement

* Fix thread safe

* remove unused using
2020-03-04 00:41:41 -03:00
Alex Barney
cecbd256a5
Add support for cache storage (#936)
* Update LibHac

* Run EnsureApplicationCacheStorage when launching a game

* Add new FS commands
2020-03-03 15:07:06 +01:00
Thog
47f079d23e
stub GetNintendoAccountUserResourceCacheForApplication (#962) 2020-03-03 01:07:27 +11:00
Thog
3b531de670
Implement mii:u and mii:e entirely (#955)
* Implement mii:u and mii:e entirely

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

This commit implement the mii service accurately.

This is based on Ac_k work but was polished and updated to 7.x.

Please note that the following calls are partially implemented:

- Convert: Used to convert from old console format (Wii/Wii U/3ds)
- Import and Export: this is shouldn't be accesible in production mode.

* Remove some debug leftovers

* Make it possible to load an arbitrary mii database from a Switch

* Address gdk's comments

* Reduce visibility of all the Mii code

* Address Ac_K's comments

* Remove the StructLayout of DatabaseSessionMetadata

* Add a missing line return in DatabaseSessionMetadata

* Misc fixes and style changes

* Fix some issues from last commit

* Fix database server metadata UpdateCounter in MarkDirty (Thanks Moose for the catch)

* MountCounter should only be incremented when no error is reported

* Fix FixDatabase

Co-authored-by: Alex Barney <thealexbarney@gmail.com>
2020-03-02 09:56:01 +11:00
Alex Barney
165e658f02
Actually use the dummy NACP for EnsureApplicationSaveData (#939) 2020-02-18 22:35:47 +11:00
Thog
e9a37ca6a8
Implement GetCurrentIpConfigInfo (#943)
* Implement GetCurrentIpConfigInfo

This is needed by Rocket League.

Also fix GetCurrentIpConfigInfo to not return ipv6 addresses

* Address Ac_K comment
2020-02-17 16:28:41 +01:00
Thog
c464e1ec52
Stub the application copyright framebuffer api (#921)
* Stub the application copyright framebuffer api

As we currently don't support multi layers on vi/nvnflinger, this PR
implement a stub of this API.

* Address Cyuubi's comments

* Add IPC checks and comments for future reversing

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

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-02-12 00:07:13 +01:00
Thog
a906f2071c
Fix a crash when closing the main UI (#904)
* 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
2020-02-06 12:38:24 +01: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
Thog
ea14a95524
Fix inconsistencies with UserId (#906)
* Fix inconsistencies with UserId

The account user id isn't an UUID. This PR adds a new UserId type with
the correct value ordering to avoid mismatch with LibHac's Uid. This also fix
an hardcoded value of the UserId.

As the userid has been invalid for quite some time (and to avoid forcing
users to their recreate saves), the userid has been changed to "00000000000000010000000000000000".

Also implement a stub for IApplicationFunctions::GetSaveDataSize. (see
the sources for the reason)

Fix #626

* Address jd's & Ac_k's comments
2020-02-02 14:24:17 +11:00
Xpl0itR
7b0576db71
Fix application list (#891)
* Fix application list

* Convert file extensions to lowercase before comparing

* AcK's requested changes

* fixed bug found by gdkchan's requested changes

* Account for mismatch between LibHac.TitleLanguage and ...System.Language
2020-01-31 19:21:46 +01:00
gdkchan
793f38b9aa
Discard higher 32-bits of IPC message magic and command number (#911) 2020-01-30 21:43:47 +01:00
Ac_K
d218c2eead
prepo IPrepoService accurate parsing for report (#905)
* prepo IPrepoService accurate parsing for report

I've found they use msgpack for the report, so I've added a nuget package and deserialize the report in the right way.

Close #838

* jD requested changes

* Change nuget to MsgPack.Cli

* Use var instead of explicit cast
2020-01-30 17:39:05 +01:00
Thog
5bd75477eb
Fix OpenBisFileSystem wrong buffer type (#909)
As the title say.
2020-01-27 21:09:04 +01:00
bunnei
ad2424171a SoftwareKeyboard: Interactive data size should include size field. (#907) 2020-01-26 16:14:21 +11:00
Thog
1d8da18334 Make VirtualFileSystem only instanciable once (#901)
This fix a regression caused by #888 on temporary saves for SNES Online.
(and probably other games)
2020-01-24 17:01:21 +01:00
Thog
d6b9babe1d Keep the GUI alive when closing a game (#888)
* Keep the GUI alive when closing a game

Make HLE.Switch init when starting a game and dispose it when closing
the GlScreen.

This also make HLE in charge of disposing the audio and gpu backend.

* Address Ac_k's comments

* Make sure to dispose the Discord module and use GTK quit method

Also update Discord Precense when closing a game.

* Make sure to dispose MainWindow

* Address gdk's comments
2020-01-21 23:23:11 +01:00
Thog
d0f15cb0b1 Update 32 bits syscalls to match 64 bits implementation (#892)
* Implement 32 bits syscalls

Co-authored-by: riperiperi <rhy3756547@hotmail.com>

Implement all 32 bits counterparts of the 64 bits syscalls we currently
have.

* Add FlushProcessDataCache32

* Address jd's comments
2020-01-19 19:21:53 -03:00
bylaws
90b4759085 Various small audren fixes (#894)
* Remove redundant modulo on wave buffer index

This is already performed by SetBufferIndex

* Correct typo in UpdateDataHeader

MixeSize -> MixSize

* Remove unused variable in audren

'volume' was unused and 'voice.Volume' was used instead so remove 'volume'
2020-01-18 23:29:52 +01:00
gdkchan
595e7716d8 Support audio effect output status (#890)
* Support audio effect output status

* Remove extra line
2020-01-17 10:07:27 +01:00
Alex Barney
c5f872c70a Update to LibHac 0.8.2 (#889)
* Update to LibHac 0.8.2

This brings support for temporary savedata, ignores case in key names when loading from a file, and prints the rights ID correctly when missing a title key.

* Auto-format IFileSystemProxy
2020-01-16 19:08:39 -03:00
Thog
892df335e6 Rework SVC handling (#883)
* Rework SVC handling

Prepare for 32 bits support.

* QueryMemory64 x1 is an output

* Pregenerate all SVC handler

Also clean up + 32 bits code path

* Address gdk's comments

* Simplify local setter loop

* Address jd's comments
2020-01-13 13:04:28 +11: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
Thog
f0055482fd Fix race condition in ContentManager (#884)
* Fix race condition in ContentManager

This fix a race condition happening since #791 when trying to load a
game via command line.

* Address gdk's comments

* Ensure to dispose the FileStream and not the IStorage
2020-01-13 01:17:44 +01:00
Alex Barney
e348f95495 Call EnsureApplicationSaveData when launching a game (#871)
* Workaround for the lack of a program registry

* Call EnsureApplicationSaveData when launching a game
2020-01-12 12:15:17 +01:00
Thog
9c8d48edff
Add 32 bits support to HleProcessDebugger (#859)
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2020-01-12 12:06:26 +01:00
Thog
29e8576b0d MapBufferEx: take page size into account (#873)
Fix #744
2020-01-12 03:14:27 +01:00
emmauss
e485ee049d System firmware installer (#791)
* firmware installer

* Add directory installation option and fix 9.x support for directory

* Fix missing system font error while installing for the first time

* Address code style comments

* Create and use InvalidFirmwarePackageException

* Fix LDj3SNuD's comments

* addressed alex's comments

* add label to status bar to show current firmware version

Co-authored-by: Thog <thog@protonmail.com>
2020-01-12 03:10:55 +01:00
Thog
ab29521faa Fix R5G6B5 in SurfaceFlinger (#863)
Also fix B5G6R5Unorm wrong definition in Ryujinx.Graphics.OpenGL.
2020-01-09 19:12:47 +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
gdkchan
59fdaa744b GPU resource disposal 2020-01-09 02:13:00 +01:00
gdkchan
647d0962df Initialize GPU physical memory accessor from KProcess, to allow homebrew that never maps anything on the GPU to work 2020-01-09 02:13:00 +01:00
gdk
16d88c21fc Improved and simplified window texture presentation 2020-01-09 02:13:00 +01:00
gdk
8cba252b23 Add per-source type memory change tracking, simplified state change tracking, other fixes 2020-01-09 02:13:00 +01:00
gdk
1876b346fe Initial work 2020-01-09 02:13:00 +01:00
Thog
f617fb542a Fix timezone month being reported incorrectly to games (#861)
Nintendo actually uses range from 1 to 12 for months (when original timezone code manage 0-11)
2020-01-09 11:08:57 +11:00
Alex Barney
63b24b4af2 Rename "RyuFs" directory to "Ryujinx" and use the same savedata system the Switch uses (#801)
* Use savedata FS commands from LibHac

* Add EnsureSaveData. Use ApplicationControlProperty struct

* Add a function to migrate to the new directory layout

* LibHac update

* Change backup structure

* Don't create UI files in the save path

* Update RyuFs paths

* Add GetProgramIndexForAccessLog

Ryujinx only runs one program at a time, so always return values reflecting that

* Load control NCA when loading from an NSP

* Skip over UI stats when exiting

* Set TitleName and TitleId in more cases. Fix TitleID naming style

* Completely comment out GUI play stats code

* rebase

* Update LibHac

* Update LibHac

* Revert UI changes

* Do migration automatically at startup

* Rename RyuFs directory to Ryujinx

* Update RyuFs text

* Store savedata paths in the GUI

* Make "Open Save Directory" work

* Use a dummy NACP in EnsureSaveData if one is not loaded

* Remove manual migration button

* Respond to feedback

* Don't read the installer config to get a version string

* Delete nuget.config

* Exclude 'sdcard' and 'bis' during migration

Co-authored-by: Thog <thog@protonmail.com>
2020-01-05 12:49:44 +01:00
Thog
e0e12b1672
Fix EphemeralNetworkSystemClock wrong steady clock (#858)
oops
2020-01-04 18:39:27 +01:00
Thog
ad84f3a7b3
Fix GUI freeze wehn closing without any emulation running (#853) 2019-12-29 23:37:54 +01:00
Thog
1db3a66da3 Fix LibHac.IStorage not being disposed in FileSystem proxy (#851) 2019-12-26 02:58:38 +01:00
Thog
55c956e2ec Make HLE disposable safely (#850)
* Make HLE disposable safely

This fix the oldest issue with the HLE code: the kernel side
disposability.

Changelog:

- Implement KProcess::UnpauseAndTerminateAllThreadsExcept, KThread::Terminate, KThread::TerminateCurrentProcess, KThread::PrepareForTermiation and the svc post handler accurately.
- Implement svcTerminateProcess and svcExitProcess. (both untested)
- Fix KHandleTable::Destroy not decrementing refcount of all objects stored in the table.
- Spawn a custom KProcess with the maximum priority to terminate every guest KProcess. (terminating kernel emulation safely)
- General system stability improvements to enhance the user's experience.

* Fix a typo in a comment in KProcess.cs

* Address gdk's comments
2019-12-26 02:50:17 +01:00
gdkchan
87bfe681ef Fix remap ioctl map offset (#852)
* Fix remap ioctl map offset

* Correct offset type
2019-12-25 02:54:26 +01:00
Thog
bce8972e7a Fix an endge case in bsd IClient::Poll implementation (#848)
This add some code to handle usage of poll without any fds.

This is required by Dark Souls Remastered main loop logic as it's
calling it without any fds during initialization.

===
General system stability improvements to enhance the user's experience.
2019-12-23 06:33:59 +11: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
Thog
d925de2d0e
Fix ILogger type and size decoding (#842)
* Fix ILogger type and size decoding

The type and size are custom encoded integer not byte.

This fix issues on games that send messages longer than 127 characters.

* Address gdk's comments
2019-12-08 14:35:25 +01:00
jduncanator
d562ba37a0 Fully reverse swkbd configuration structure and follow-up to swkbd implementation (#839)
* am: Fully reverse swkbd configuration structure

* Add documentation

* Remove explicit access modifiers

* Fix formatting

* Fix further formatting issues
2019-12-03 05:00:56 +01:00
Ac_K
bb7600e215 prepo: Silent error while parsing report (#837)
Due to a guessed parsing implementation of the report, sometime it throw an error, since the data isn't really useful, it's better to silent possible exceptions with a message.
2019-11-29 15:42:44 +11:00
Xpl0itR
da4e0856c9 Add features to GUI (#757)
* controller image changes depending on the selected controller type

the new controller image assets are temporary until i get new ones

* Game list scans subdirs for games

* Key file existence check

* Only shows Program NCAs in Application list

* Change shown GUI columns without restarting

* Sort by column if you click on the column header

Columns are sorted as text so there are inaccuracies on some columns

* Fix sort on Time Played, Last Played and File Size columns

* Add ability to designate favourite games #1

TODO:
- Make fav games persistent
- Fix invisible check marks due to theme

* Add ability to designate favourite games #2

Also removed default theme

* Added a Windows specific build condition and a Linux bug fix

* bugfix

* Load metadata from JSONs

* Temp bug fix for MacOS

* lil clean up

* requested changes

* Misc fixes

* edited schema and config

* Show the TitleID of games on the title bar

* gui column config option have names

* Async loading of game list

* bugfix and cleanup

* thog's requested changes

* requested changes and cleanup

still need to fix the gtk seizure

* Fix issue where an ExeFS as a NSP didn't show up in the application list

* Minor fixes

* catch glib unhandled exceptions

* Make sure to do UI manipulation in the main thread

* Print path of invalid files

* Ac_k's requested changes

* Return of the dark theme

* move AboutInfo struct to another file

* sort usings

* changes

- gdkchan's requested changes that have been marked resolved
- made some structs internal as they aren't used outside of the GUI
- renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure
- fixed bug where controller type dropdown box is stretched
2019-11-29 15:32:51 +11:00
Thog
c24e1892ad time: Fix wrong buffer usage in CalculateStandardUserSystemClockDifferenceByUser & CalculateSpanBetween (#836) 2019-11-27 19:27:30 +01:00
Thog
69329dc569 Fix issues on ro implementation (#834)
* ro: Fixes some bugs

* Fix critical overflow in random computation
2019-11-26 19:41:17 +01:00
Ac_K
3f3ae99a0f prepo: Implement calls of IPrepoService (#830)
* prepo: Implement calls of IPrepoService

- Implement `SaveReportOld`, `SaveReportWithUserOld`, `SaveReport`, `SaveReportWithUser` not accurate by RE (except for result codes). It's  here to do something with the data since we will never use the `Play Report` sent by the game. So it's better than just a stub.
- Fix a typo in `ldn` result code.

Close #807

* Add a processing method

* Address some comments

* remove unneeded using

* Resolve requested changes

* Typo

* Update IPrepoService.cs
2019-11-25 10:45:54 +11:00
Thog
a0e0745f2f Remove one extraneous incrementation (#833)
This incrementation is entirely wrong.
2019-11-25 10:32:07 +11: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
jduncanator
ee81ab547e Initial swkbd implementation (#826)
* am: Initial swkbd implementation

Currently only implements the full screen keyboard, inline keyboard will come later.

* Remove unnecessary logging

* Miscellaneous tidy up

* am: Always pop incoming interactive session data

* am: Add a reminder to implement the full config struct

* am: Check for a max length of zero

We should only limit/truncate text when the max length is set to a non-zero value.

* Add documentation

* am: Return IStorage not available when queue is empty

We should be returning the appropriate error code when the FIFO is empty, rather than just throwing an exception and killing the emulator.

* Fix typo

* Code style changes
2019-11-18 12:16:26 +01:00
Ac_K
79abc6ed93 Implement IApplicationFunctions & IQueryService commands (#823)
* Implement IApplicationFunctions & IQueryService commands

- Fix some nits in `IApplicationFunctions`
- Implement `QueryApplicationPlayStatistics` and `QueryApplicationPlayStatisticsByUid` checked by RE.
- Implement `QueryApplicationPlayStatisticsForSystem` and `QueryApplicationPlayStatisticsByUserAccountIdForSystem` checked by RE.
- Implement `QueryPlayStatisticsManager` to get/set played games statistics. We currently don't store any statistics because it's handled by qlaunch (or maybe am service?) on Switch.
We can add support later if games use returned statistics for something.

* Fix reviews
2019-11-15 01:25:22 +01:00
Natalie C
b9ae0b09d9 Set AArch32 mode in KThread (#818)
* Set AArch32 mode in KThread

* Update ProgramLoader.cs
2019-11-14 15:28:13 +01:00