Commit graph

2882 commits

Author SHA1 Message Date
Thog
59f4490e22 Increment PTC version (#1311)
Fix issues caused by 2421186d97
2024-02-22 19:15:02 -05:00
Ficture Seven
9eca28857c Generalize tail continues (#1298)
* Generalize tail continues

* Fix DecodeBasicBlock

`Next` and `Branch` would be null, which is not the state expected by
the branch instructions. They end up branching or falling into a block
which is never populated by the `Translator`. This causes an assert to
be fired when building the CFG.

* Clean up Decode overloads

* Do not synchronize when branching into exit block

If we're branching into an exit block, that exit block will tail
continue into another translation which already has a synchronization.

* Remove A32 predicate tail continue

If `block` is not an exit block then the `block.Next` must exist (as
per the last instruction of `block`).

* Throw if decoded 0 blocks

Address gdkchan's feedback

* Rebuild block list instead of setting to null

Address gdkchan's feedback
2024-02-22 19:15:02 -05:00
LDj3SNuD
ce57dc3f5e 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>
2024-02-22 19:15:02 -05:00
riperiperi
a8fff72c30 VABS takes one input register, not two. (#1300) 2024-02-22 19:15:02 -05:00
riperiperi
42b87695b9 Optimize texture format conversion, and MethodCopyBuffer (#1274)
* Improve performance when converting texture formats.

Still more work to do.

* Speed up buffer -> texture copies.

No longer copies byte by byte. Fast path when formats are identical.

* Fix a few things, 64 byte block fast copy.

* Spacing cleanup, unrelated change.

* Fix base offset calculation for region copies.

* Fix Linear -> BlockLinear

* Fix some nits. (part 1 of review feedback)

* Use a generic version of the Convert* functions rather than lambdas.

This is some real monkey's paw shit.

* Remove unnecessary span constructor.

* Revert "Use a generic version of the Convert* functions rather than lambdas."

This reverts commit aa43dcfbe8.

* Fix bug with rectangle destination writing, better rectangle calculation for linear textures.
2024-02-22 19:15:02 -05:00
mageven
213e995638 Change console log to discard on overflow (#1241) 2024-02-22 19:15:02 -05:00
Shrek5InTheatres2019
90fd7a99d7 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>
2024-02-22 19:15:02 -05:00
merry
9a846f739d Faster crc32 implementation (#1294)
* Add Pclmulqdq intrinsic

* Implement crc32 in terms of pclmulqdq

* Address PR comments
2024-02-22 19:15:02 -05:00
Thog
61a8e0d285 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
2024-02-22 19:15:02 -05:00
gdkchan
1e0b2226b7 Implement FIFO semaphore (#1286)
* Implement FIFO semaphore

* New enum for FIFO semaphore operation
2024-02-22 19:15:01 -05:00
gdkchan
99da86d638 Add new depth-stencil formats (#1284) 2024-02-22 19:15:01 -05:00
gdkchan
73c08482db Fix wrong face culling once and for all (#1277)
* Viewport swizzle support on NV and clip origin

* Initialize default viewport swizzle state, emulate viewport swizzle on shaders when not supported

* Address PR feedback
2024-02-22 19:15:01 -05:00
LDj3SNuD
55765f6866 Add FMaxNmV & FMinNmV Inst.s with Test. (#1279)
Successful unit testing on Windows (debug and release mode).
2024-02-22 19:15:01 -05:00
gdkchan
3da08dbf76 Support separate textures and samplers (#1216)
* Support separate textures and samplers

* Add missing bindless flag, fix SNORM format on buffer textures

* Add missing separation

* Add comments about the new handles
2024-02-22 19:15:01 -05:00
gdkchan
deb1c7b8af Omit image format if possible, and fix BA bit (#1280)
* Omit image format if possible, and fix BA bit

* Match extension name
2024-02-22 19:15:01 -05:00
mageven
e10fb6c592 Fix GetDesiredLanguage (#1275)
* Fix GetDesiredLanguage

* Correct tzcnt slip-up

* Address gdkchan's comments
2024-02-22 19:15:01 -05:00
mageven
29217448a6 Fix GetDisplayVersion (#1276) 2024-02-22 19:15:01 -05:00
riperiperi
8507600a5e Flush GL commands before inevitably waiting for a query result. (#1278) 2024-02-22 19:15:01 -05:00
riperiperi
1898e64ae3 Remember bound framebuffer to avoid glGetInteger use. (#1273)
glGetInteger seems to sync with GPU which is less than ideal, and slowing down texture copies.
2024-02-22 19:15:01 -05:00
mageven
6dd3202470 Implement CNTVCT_EL0 (#1268)
* Implement CNTVCT_EL0

* Fix comment
2024-02-22 19:15:01 -05:00
Thog
c2292223d4 Implement TMML and TMML.B (#1270)
* Implement TMML and TMML.B

This implement TMML and TMML.B instructions

* Fix TmmlB declaration alignment

* Address gdkchan's comments

* Fix inverted encoding definitions
2024-02-22 19:15:01 -05:00
gdkchan
61363b833c Spanify Graphics Abstraction Layer (#1226)
* Spanify Graphics Abstraction Layer

* Be explicit about BufferHandle size
2024-02-22 19:15:01 -05:00
Thog
1c3b6ea58c 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.
2024-02-22 19:15:01 -05:00
Alex Barney
a7a574acea Update to LibHac 0.11.2 (#1240) 2024-02-22 19:15:01 -05:00
LDj3SNuD
791cff51ab Unwinding Follow-up. Fix a bug in JitUnwindWindows where ... (#1238)
... in case of "Vector" unwind codes the remaining unwind codes could be corrupted.
Nits.
2024-02-22 19:15:01 -05:00
Thog
51951ded13 surfaceflinger: FreeBufferLocked doesn't reset the graphic buffer
That's the job of the user on Horizon (via SetPreallocatedBuffer).
2024-02-22 19:15:00 -05:00
mageven
e96242e342 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
2024-02-22 19:15:00 -05:00
Thog
e0356412c8 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
2024-02-22 19:15:00 -05:00
Thog
d1bc68b1dd Surface Flinger: Implement GetBufferHistory (#1232)
* Surface Flinger: Implement GetBufferHistory

Also fix some bugs on the Surface Flinger implementation

* Address Ac_K's comment
2024-02-22 19:15:00 -05:00
Ac_K
299433badc 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
2024-02-22 19:15:00 -05:00
Ficture Seven
4d38a9e820 Fix RET Xn translation (#1242) 2024-02-22 19:15:00 -05:00
gdkchan
e7303344f2 Remove CpuId IR instruction (#1227) 2024-02-22 19:15:00 -05:00
Ac_K
e5e2e2cad5 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
2024-02-22 19:15:00 -05:00
VolcaEM
5afdd21ebf 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)
2024-02-22 19:15:00 -05:00
Ac_K
09232557aa am: Implement GetFriendInvitationStorageChannelEvent (#1220)
* am: Implement GetFriendInvitationStorageChannelEvent

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

* Fix handle name

* add GetNotificationStorageChannelEvent
2024-02-22 19:15:00 -05:00
Ficture Seven
95df9d4ff6 Fix tailcall case in EmitterContext (#1235) 2024-02-22 19:15:00 -05:00
mageven
5970cfefb2 Suppress CS0169 CS0649 warns from HID structs (#1222)
Also fix typo in a pragma restore in Logger
2024-02-22 19:15:00 -05:00
VolcaEM
96c39de164 Add various error codes to Settings (#1229)
The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
2024-02-22 19:15:00 -05:00
VolcaEM
40d6408257 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
2024-02-22 19:15:00 -05:00
VolcaEM
ac29c181ff 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
2024-02-22 19:15:00 -05:00
VolcaEM
2591a71162 Add various error codes to NCM LR (#1225)
The error codes were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
2024-02-22 19:15:00 -05:00
Ac_K
365e124da7 Fix SystemInfo logging to file (#1217)
We currently logs system informations before we load the configuration file.
Since the logger use the configuration file (to sets if it should store the logs in a file, etc...), if we print something before the configuration init, the log file doesn't contains any system informations.
Now it's fixed.
2024-02-22 19:15:00 -05:00
gdkchan
fe6e7ec417 Fix block iteration on kernel MemoryManager InsertBlock function (#1184) 2024-02-22 19:15:00 -05:00
gdkchan
f71035cd7c Refactor shader GPU state and memory access (#1203)
* Refactor shader GPU state and memory access

* Fix NVDEC project build

* Address PR feedback and add missing XML comments
2024-02-22 19:14:59 -05:00
plutoo
71a37b8898 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>
2024-02-22 19:14:59 -05:00
SeraUX
2caa451d3d Logging the current firmware version (#1199)
* Logging the curent firmware version

* fixed an error in cases when firmware is not installed
2024-02-22 19:14:59 -05:00
HorrorTroll
daca61cbda Add Docked/Handheld text on status bar (#1205)
* Add Dock/Handheld on status bar

* Simplified the code & move next to V-Sync

* Nit.
2024-02-22 19:14:59 -05:00
VolcaEM
8eb86541e8 Add error code for denied internet request in Friends (#1207)
* Add error code for denied internet request in Friends

* Fix formatting from previous PR
2024-02-22 19:14:58 -05:00
VolcaEM
c4316eba7c 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
2024-02-22 19:14:58 -05:00
gdkchan
b8858a0913 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
2024-02-22 19:14:58 -05:00