Commit graph

1440 commits

Author SHA1 Message Date
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
EmulationFanatic
0a55657bd2
Enable Profiled Persistent Translation Cache (PPTC) by default (#1844)
* Enable Profiled Persistent Translation Cache (PPTC) by default

Enables PPTC by default. Enough time has passed and enough games tested that it should be the preferred setting for 99.9% of games. In case we are worried about PPTC files being put on the user's disk, shader cache already does this by default and generates about the same size files on average, so this should no longer be a concern.

* Update config.json with PTC set to true

* Updated _schema.json to set PPTC to true.
2021-01-01 15:36:47 +01:00
Mary
73118dcb98 amadeus: Update copyright year
Happy new Year
2021-01-01 00:12:32 +01:00
Mary
b1d3cfd2da
Distribute with OpenAL Soft on Windows (#1847)
* Distribute with OpenAL Soft on Windows

This remove dependency on OpenAL EA on Windows and allows to operate with both backend without any user interventions.

Co-authored-by: jduncanator <jduncanator@hotmail.com>

* Fix Atmosphere utf8 issue

Co-authored-by: jduncanator <jduncanator@hotmail.com>
2020-12-31 09:08:09 +11: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
AigleSpartiate
9a808fe484
Fix button press issue (#1836)
A small code change to fix the issue that was forcing the user to press the "Yes" button twice to restart Ryujinx after it had been updated, instead of only once.
2020-12-26 15:59:41 +01:00
EmulationFanatic
d05db79a3e
Update InvalidMemoryRegionException.cs to abide by English rules. (#1834) 2020-12-25 04:09:02 +01:00
Ac_K
5b9c876155 Hotfix for #1814 2020-12-24 04:44:39 +01:00
LDj3SNuD
2502f1f07f
Free up memory allocated by Pools during any PPTC translations at boot time. (#1814)
* 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.

* Free up memory allocated by Pools during any PPTC translations at boot time.

* Nit due to rebase.
2020-12-24 03:58:36 +01:00
LDj3SNuD
8a33e884f8
Fix Vnmls_S fast path (F64: losing input d value). Fix Vnmla_S & Vnmls_S slow paths (using fused inst.s). Fix Vfma_V slow path not using StandardFPSCRValue(). (#1775)
* Fix Vnmls_S fast path (F64: losing input d value). Fix Vnmla_S & Vnmls_S slow paths (using fused inst.s).

Add Vfma_S & Vfms_S Fma fast paths.
Add Vfnma_S inst. with Fma/Sse fast paths and slow path.
Add Vfnms_S Sse fast path.

Add Tests for affected inst.s.

Nits.

* InternalVersion = 1775

* Nits.

* Fix Vfma_V slow path not using StandardFPSCRValue().

* Nit: Fix Vfma_V order.

* Add Vfms_V Sse fast path and slow path.

* Add Vfma_V and Vfms_V Test.
2020-12-17 20:43:41 +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
sharmander
e901b7850c
CPU: Implement VRINTX.F32 | VRINTX.F64 (#1776)
* Start implementation

* Draft

* Updated opcode.

Needs verification.

* Clean up code.

* Update implementation and tests.

* Update implemenation + tests

* Get RM from FPSCR + Do not use emit/addintrinsic

* Remove "fast" path, as recommended by gdk.

* Variable DELETED.

* Update ARMeilleure/Decoders/OpCodeTable.cs

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>

* Update ARMeilleure/Instructions/InstEmitSimdCvt32.cs

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>

* Update ARMeilleure/Instructions/InstEmitSimdCvt32.cs

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>

* Update ARMeilleure/Instructions/InstEmitSimdCvt32.cs

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>

* Move method

* stringing things together :)

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
2020-12-16 20:27:15 -03:00
gdkchan
61634dd415
Clear JIT cache on exit (#1518)
* Initial cache memory allocator implementation

* Get rid of CallFlag

* Perform cache cleanup on exit

* Basic cache invalidation

* Thats not how conditionals works in C# it seems

* Set PTC version to PR number

* Address PR feedback

* Update InstEmitFlowHelper.cs

* Flag clear on address is no longer needed

* Do not include exit block in function size calculation

* Dispose jump table

* For future use

* InternalVersion = 1519 (force retest).

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
2020-12-16 17:07:42 -03: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
sharmander
3332b29f01
CPU: Implement VFMA (Vector) (#1762)
* Implement VFMA.F64

* Simplify switch

* Simplify FMA Instructions into their own IntrinsicType.

* Remove whitespace

* Fix indentation

* Change tests for Vfnms -- disable inf / nan

* Move args up, not description ;)

* Implementation Complete.

All Tests Pass (Slow / Fast Path)

* Move location of function in assembler + test updates.

* Shift params upwards

* Remove unused function

* Update PTC version.

* Add comments / re-oreder opcode table.

* Remove whitespace

* Fix nit

* Fix nit.

* Fix whitespace

* Wrong opcode was used by a bad merge.

* Addressed rip's comments.
2020-12-15 00:01:52 -03:00
gdkchan
47ba81c661
Fix pre-allocator shift instruction copy on a specific case (#1752)
* Fix pre-allocator shift instruction copy on a specific case

* Fix to make shift use int rather than long for constants
2020-12-14 17:56:07 -03:00
gdkchan
c8bb3cc50e
Fix register read after write on STREX implementation (#1801)
* Fix register read after write on STREX implementation

* PTC version update
2020-12-13 12:19:38 -03:00
Mary
6bc2733c17
salieri: Support read-only mode if archive is already opened (#1807)
This improves shader cache resilience when people opens another program that touch the cache.zip.
2020-12-13 08:46:07 +01: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
riperiperi
06057a99a6
End empty gl queries before returning them to the pool. (#1806) 2020-12-12 10:31:39 +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
riperiperi
c9b6be1ef8
NVIDIA Thread create/delete stutter workarounds (#1760)
* Thread create/delete stutter workarounds Pt 1

* As tiered compilation is disabled, disable quick jit too

Should result in tier 1 compilation all the time

* Fix rebase.
2020-12-09 19:36:08 -03: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
sharmander
36f6bbf5b9
CPU: Implement VFNMA.F32 | F.64 (#1783)
* Implement VFNMA.F<32/64>

* Update PTC Version

* Update Implementation & Renames & Correct Order

* Fix alignment

* Update implementation to not trigger assert

* Actually use the intrinsic that makes sense :)
2020-12-07 21:04:01 -03:00
LDj3SNuD
567ea726e1
Add support for guest Fz (Fpcr) mode through host Ftz and Daz (Mxcsr) modes (fast paths). (#1630)
* Add support for guest Fz (Fpcr) mode through host Ftz and Daz (Mxcsr) modes (fast paths).

* Ptc.InternalVersion = 1630

* Nits.

* Address comments.

* Update Ptc.cs

* Address comment.
2020-12-07 10:37:07 +01:00
Ac_K
668720b088
logger: Add build version to the log file names (#1782) 2020-12-07 20:29:22 +11:00
riperiperi
24d316cc92
Extract texture Target from Info for quick access (#1774) 2020-12-03 20:34:27 +01:00
sharmander
b479a43939
CPU: Implement VFNMS.F32/64 (#1758)
* Add necessary methods / op-code

* Enable Support for FMA Instruction Set

* Add Intrinsics / Assembly Opcodes for VFMSUB231XX.

* Add X86 Instructions for VFMSUB231XX

* Implement VFNMS

* Implement VFNMS Tests

* Add special cases for FMA instructions.

* Update PPTC Version

* Remove unused Op

* Move Check into Assert / Cleanup

* Rename and cleanup

* Whitespace

* Whitespace / Rename

* Re-sort

* Address final requests

* Implement VFMA.F64

* Simplify switch

* Simplify FMA Instructions into their own IntrinsicType.

* Remove whitespace

* Fix indentation

* Change tests for Vfnms -- disable inf / nan

* Move args up, not description ;)

* Undo vfma

* Completely remove vfms code.,

* Fix order of instruction in assembler
2020-12-03 20:20:02 +01:00
riperiperi
c00d39b675
Dummy out gl queries with 0 draws, remove glFlush call (#1773) 2020-12-03 19:42:59 +01:00
riperiperi
2c39a4f15d
Cache delegate for QueryModified, use regular multi handle. (#1771) 2020-12-03 19:34:32 +01: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
Mary
bc11443621
amadeus: Fix a typo in TapFrame logic (#1767)
This fix a crash at boot in Pang Adventures
2020-12-02 00:46:26 +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
riperiperi
461c24092a
Implement Force Early Z Register (#1755) 2020-12-02 00:13:27 +01:00
Xpl0itR
e383c41b6e
Add a "Remove All" button to the DLC and Update windows (#1579) 2020-12-01 23:51:49 +01:00
Xpl0itR
bd8d28c59d
Add option to start games in fullscreen mode (#1580)
* Add option to start games in fullscreen mode

* Add command line option

* Use pascal case on menu item
2020-12-01 23:02:27 +01:00
Mary
f6d88558b1
salieri: Fix missing guest GPU accessor missing on hashes (#1759)
This adds the guest GPU accessor to hashes computation.
As this change all the hashes from the cache, I added some migration
logic.

This is required for #1755.
2020-12-01 22:48:31 +01:00