Commit graph

612 commits

Author SHA1 Message Date
jduncanator
b5efe21eac Vi: Implement ConvertScalingMode (#581)
* Vi: Implement ConvertScalingMode

For now, it seems Nintendo just map 1:1 between the two enums.

* Resolve style nits

* Vi: Correct mapping order
2024-02-22 19:14:12 -05:00
gdkchan
7f315152c3 Fix XMAD shader instruction, gl_FrontFacing and enable face culling (#583)
* Fix XMAD shader instruction implementation

* Fix gl_FrontFacing constant value

* Enable face culling again

* Fix typo
2024-02-22 19:14:11 -05:00
Thomas Guillemard
0c4e1e836d Support HomeBrew Loader (#577)
* Make it possibles to load hb-loader and hb-menu

One issue remains with hb-menu homebrew icons because of SIMD issues
(libjpeg-turbo related) and netloader doesn't work.

* Implement GetApplicationControlData

* Fix shared fonts for NSO/NRO

* Add homebrew NRO romfs support

This readd the NRO support by parsing the ASET header

* Address comments about HomebrewRomFs

* override Dispose in homebrew romfs stream

* Use a struct for file timestamp

* Simplify positional increments in GetApplicationControlData

* Address comments

* improve readability of the memory permission check in SetProcessMemoryPermission

* Fix previous broken check

* Add address space checks in SetProcessMemoryPermission
2024-02-22 19:14:11 -05:00
gdkchan
8be2859681 Change timestamp value on GPU query with timestamp and counter writeback (#547)
This issue was reported by `Mark290580`, and, according to them causes rendering issues on SMO.
2024-02-22 19:14:11 -05:00
jduncanator
e3dcf615c9 Audio: Select a shared audio device by default (#574)
* Audio: Select a shared audio device by default

This ensures that a non-raw audio device is selected wherever possible.

* Audio: Resolve libsoundio version mismatch between bindings and binaries

It turns out we were using bindings generated with libsoundio 1.1.0 git source, but the binaries we were using were built from master git source. I've rebuilt both binaries and bindings to ensure they are version matched.

This should resolve all outstanding issues with libsoundio (including the Linux segfault issue, and the "cannot open device" Windows issue).

* Audio: Reformat MarshalExtensions

* Resolve code indentation issues
2024-02-22 19:14:11 -05:00
jduncanator
55067b16a1 Config: Resolve config and file log to application directory (#580) 2024-02-22 19:14:11 -05:00
gdkchan
e206508d6f Do not increment played wave buffers count for empty wave buffers (#568)
* Do not increment played wave buffers count for empty wave buffers

* Remove unused setter
2024-02-22 19:14:10 -05:00
jduncanator
6fee7d1804 Logger and Configuration Refactoring (#573)
* Logging: Refactor log targets into Ryujinx.Common

* Logger: Implement JSON Log Target

* Logger: Optimize Console/File logging targets

Implement a simple ObjectPool to pool up StringBuilders to avoid causing excessive GCing of gen1/2 items when large amounts of log entries are being generated.

We can also pre-determine the async overflow action at initialization time, allowing for an easy optimization in the message enqueue function, avoiding a number of comparisons.

* Logger: Implement LogFormatters

* Config: Refactor configuration file and loading

* Config: Rename to .jsonc to avoid highlighting issues in VSC and GitHub

* Resolve style nits

* Config: Resolve incorrect default key binding

* Config: Also update key binding default in schema

* Tidy up namespace imports

* Config: Update CONFIG.md to reflect new Config file
2024-02-22 19:14:10 -05:00
gdkchan
49aa95390c Implement speculative translation on the CPU (#515)
* Implement speculative translation on the cpu, and change the way how branches to unknown or untranslated addresses works

* Port t0opt changes and other cleanups

* Change namespace from translation related classes to ChocolArm64.Translation, other minor tweaks

* Fix typo

* Translate higher quality code for indirect jumps aswell, and on some cases that were missed when lower quality (tier 0) code was available

* Remove debug print

* Remove direct argument passing optimization, and enable tail calls for BR instructions

* Call delegates directly with Callvirt rather than calling Execute, do not emit calls for tier 0 code

* Remove unused property

* Rename argument on ArmSubroutine delegate
2024-02-22 19:14:10 -05:00
BaronKiko
8c86e1cabe Scissor test fix (#563)
* Handle negative viewport coordinates

* Disable scissor before framebuffer blit

* Comment to explain scissor disable will be reenabled if needed

* Comma and spelling mistake
2024-02-22 19:14:09 -05:00
emmauss
252f0bac9d Disable file log by default 2024-02-22 19:14:09 -05:00
gdkchan
45df176552 Initial support for shader half float instructions (#507) 2024-02-22 19:14:09 -05:00
emmauss
6417fee224 Add file logging and handle unhandled exceptions (#558)
* add unhandled exception handler

* added file logging

* add option in config

* consolidated console and file log
2024-02-22 19:14:09 -05:00
gdkchan
d51859d807 Implement some ARM32 memory instructions and CMP (#565)
* Implement ARM32 memory instructions: LDM, LDR, LDRB, LDRD, LDRH, LDRSB, LDRSH, STM, STR, STRB, STRD, STRH (immediate and register + immediate variants), implement CMP (immediate and register shifted by immediate variants)

* Rename some opcode classes and flag masks for consistency

* Fix a few suboptimal ARM32 codegen issues, only loads should be considered on decoder when checking if Rt == PC, and only NZCV flags should be considered for comparison optimizations

* Take into account Rt2 for LDRD instructions aswell when checking if the instruction changes PC

* Re-align arm32 instructions on the opcode table
2024-02-22 19:14:09 -05:00
LDj3SNuD
25b3ab2485 Add Smlal_Ve, Smlsl_Ve, Smull_Ve, Umlal_Ve, Umlsl_Ve, Umull_Ve Inst.; add Tests. Add Sse Opt. for Trn1/2_V and Uzp1/2_V Inst. Nits. (#566)
* Update OpCodeTable.cs

* Update InstEmitSimdArithmetic.cs

* Update InstEmitSimdHelper.cs

* Update CpuTestSimdRegElem.cs

* Update InstEmitSimdMove.cs

* Update InstEmitSimdCvt.cs

* Update SoftFallback.cs

* Update InstEmitSimdHelper.cs

* Update SoftFloat.cs

* Update CryptoHelper.cs

* Update InstEmitSimdArithmetic.cs

* Update InstEmitSimdCmp.cs

* Address PR feedback.

* Address PR feedback.
2024-02-22 19:14:09 -05:00
gdkchan
6d56573a34 Add ARM32 support on the translator (#561)
* Remove ARM32 interpreter and add ARM32 support on the translator

* Nits.

* Rename Cond -> Condition

* Align code again

* Rename Data to Alu

* Enable ARM32 support and handle undefined instructions

* Use the IsThumb method to check if its a thumb opcode

* Remove another 32-bits check
2024-02-22 19:14:09 -05:00
Thomas Guillemard
7b154aedaa Add support of PFS0 as ExeFS (#564)
Also add .pfs0 support
2024-02-22 19:14:09 -05:00
jduncanator
ec354ceee6 Resolve build merge conflict (#559) 2024-02-22 19:14:09 -05:00
gdkchan
0dc4427d4d Improve kernel IPC implementation (#550)
* Implement some IPC related kernel SVCs properly

* Fix BLZ decompression when the segment also has a uncompressed chunck

* Set default cpu core on process start from ProgramLoader, remove debug message

* Load process capabilities properly on KIPs

* Fix a copy/paste error in UnmapPhysicalMemory64

* Implement smarter switching between old and new IPC system to support the old HLE services implementation without the manual switch

* Implement RegisterService on sm and AcceptSession (partial)

* Misc fixes and improvements on new IPC methods

* Move IPC related SVCs into a separate file, and logging on RegisterService (sm)

* Some small fixes related to receive list buffers and error cases

* Load NSOs using the correct pool partition

* Fix corner case on GetMaskFromMinMax where range is 64, doesn't happen in pratice however

* Fix send static buffer copy

* Session release, implement closing requests on client disconnect

* Implement ConnectToPort SVC

* KLightSession init
2024-02-22 19:14:08 -05:00
BaronKiko
15d430496a SNK 40th Anniversary Out of Bounds Fix (#557)
* Check vertex array is enabled before reading constant attribute to avoid out of bounds exception

* Removed new line
2024-02-22 19:14:08 -05:00
BaronKiko
7ef80d3b04 Scissor test implementation. Partially stubbed until geometry shaders… (#556)
* Scissor test implementation. Partially stubbed until geometry shaders are fixed

* Apply to all viewports when geometry shaders are disabled.

* Also apply enable cap to all viewports when geometry shaders are disabled

* Added fixme as per suggestion

Co-Authored-By: BaronKiko <BaronKiko@users.noreply.github.com>

* Apparently no alignment needed here.

* Comment on new line

* Correct height calculation
2024-02-22 19:14:08 -05:00
jduncanator
f31f353577 Refactor Ryujinx.Common and HLE Stub Logging (#537)
* Refactor Ryujinx.Common and HLE Stub Logging

* Resolve review comments

* Rename missed loop variable

* Optimize PrintStub logging function

* Pass the call-sites Thread ID through to the logger

* Remove superfluous lock from ConsoleLog

* Process logged data objects in the logger target

Pass the data object all the way to the output logger targets, to allow them to "serialize" this in whatever appropriate format they're logging in.

* Use existing StringBuilder to build the properties string

* Add a ServiceNotImplemented Exception

Useful for printing debug information about unimplemented service calls

* Resolve Style Nits

* Resolve Merge Issues

* Fix typo and align declarations
2024-02-22 19:14:08 -05:00
emmauss
441e35f937 add missing return 2024-02-22 19:14:08 -05:00
Thomas Guillemard
6d44aaee6c Some improvements for nvnflinger (#555)
* Initial fixes for last release of libnx

For now, the framebuffer aren't okay but it will not crash/

* Improve code reaadability in NvFlinger parsing

* Make surfaces access more userfriendly

* Add ColorFormat

* Fix code style in ColorFormat.cs

* Add multiple framebuffer support in nvnflinger

This fix libnx console rendering

* Move ReadStruct/WriteStruct to Ryujinx.Common

* fix the last nit

* Fix inverted color for R5G6B5

Also add some other format that libnx might uses.

* Remove hardcoded BlockHeight in nvflinger
2024-02-22 19:14:08 -05:00
Alex Barney
0a28cc6603 Update to LibHac 0.2.0 (#549)
* Update to LibHac 0.2.0

* Changes based on feedback
2024-02-22 19:14:08 -05:00
BaronKiko
fcbfa98fcb Quad to triangle optimization (#552)
* Fix minor bug with ordering leading to incorrect ordering

* Converts quads and quadstrips to triangle

* A new line for emmaus

* Refactor to remove Ib from quadhelper methods

* 20 extra brackets...
2024-02-22 19:14:08 -05:00
gdkchan
3803367e59 This kind of thing drives me crazy 2024-02-22 19:14:08 -05:00
emmauss
609c4b2960 fix wrong contenttype (#553) 2024-02-22 19:14:08 -05:00
WilliamWsyHK
554c339f9b System Language can be configurable. (#535) 2024-02-22 19:14:08 -05:00
HorrorTroll
11daefd472 Add RG16 Sint (#517) 2024-02-22 19:14:08 -05:00
gdkchan
198ccadd14 Do not attempt to read unused attribute, fix attributes count (#520) 2024-02-22 19:14:08 -05:00
LDj3SNuD
3c85aae61d Fix Frecpe_S/V and Frsqrte_S/V (full FP emu.). Add Sse Opt. & SoftFloat Impl. for Fcmeq/ge/gt/le/lt_S/V (Reg & Zero), Faddp_S/V, Fmaxp_V, Fminp_V Inst.; add Sse Opt. for Shll_V, S/Ushll_V Inst.; improve Sse Opt. for Xtn_V Inst.. Add Tests. (#543)
* Update Optimizations.cs

* Update InstEmitSimdShift.cs

* Update InstEmitSimdHelper.cs

* Update InstEmitSimdArithmetic.cs

* Update InstEmitSimdMove.cs

* Update SoftFloat.cs

* Update InstEmitSimdCmp.cs

* Update CpuTestSimdShImm.cs

* Update CpuTestSimd.cs

* Update CpuTestSimdReg.cs

* Nit.

* Update SoftFloat.cs

* Update InstEmitSimdArithmetic.cs

* Update InstEmitSimdHelper.cs

* Update CpuTestSimd.cs

* Explicit some implicit casts.

* Simplify some powers; nits.

* Update OpCodeTable.cs

* Update InstEmitSimdArithmetic.cs

* Update CpuTestSimdReg.cs

* Update InstEmitSimdArithmetic.cs
2024-02-22 19:14:08 -05:00
Thomas Guillemard
a22d464e64 Fix issues with compressed NSO without a section (#548)
* Fix issues with compressed NSO without a section

Avoid trying to decompress something that doesn't exist

* don't use the lengths of the buffer directly
2024-02-22 19:14:08 -05:00
gdkchan
a9ee9052e6 Refactor SVC handler (#540)
* Refactor SVC handler

* Get rid of KernelErr

* Split kernel code files into multiple folders
2024-02-22 19:14:07 -05:00
Dudejoe870
95616c582c Update the Readme (#546)
* Update the Readme (finally)

* Address Feedback

Move default button mappings to CONFIG.MD
Change "Ryujinx solution folder" to "Ryujinx project folder"
Re-word the help section
Get rid of "(RC1)" on the .NET Core download link

* Update discord link
2024-02-22 19:14:07 -05:00
Thomas Guillemard
40c7584212 Move MaxUboSize definition (#530)
* Move MaxUboSize definition

This fix a crash on Ryujinx.ShaderTools caused by the absence of an
OpenGL context.

* Use a constant for the value in ShaderTools

* Address comments
2024-02-22 19:14:07 -05:00
MS-DOS1999
c3d52f4c57 Add Frintz_S/V opcode and unit test, correction of some unit tests (#523)
* Add Frintz_S/V opcode and unit test, correction of some unit tests

* --test

* fix code style issue

* delete tab
2024-02-22 19:14:07 -05:00
Roderick Sieben
1b0619598a Optimized memory modified check (#538)
* Optimized memory modified check

This was initially in some cases more expensive than plainly sending the data. Now it should have way better performance.

* Small refactoring

* renamed InvalidAccessEventArgs
* Renamed PtPageBits

* Removed ValueRange(set)

They are currently unused and won't be likely to be used in the near future
2024-02-22 19:14:07 -05:00
gdkchan
90bc04cbff Misc. CPU improvements (#519)
* Fix and simplify TranslatorCache

* Fix some assignment alignments, remove some unused usings

* Changes to ILEmitter, separate it from ILEmitterCtx

* Rename ILEmitter to ILMethodBuilder

* Rename LdrLit and *_Fix opcodes

* Revert TranslatorCache impl to the more performant one, fix a few issues with it

* Allow EmitOpCode to be called even after everything has been emitted

* Make Emit and AdvanceOpCode private, simplify it a bit now that it starts emiting from the entry point

* Remove unneeded temp use

* Add missing exit call on TestExclusive

* Use better hash

* Implement the == and != operators
2024-02-22 19:14:07 -05:00
emmauss
0eaed349ae Fix homebrew input (#528)
* fix homebrew input
2024-02-22 19:14:07 -05:00
HorrorTroll
4c2c2926b6 Fix InitializeOld & add FinalizeOld, SetAndWaitOld, GetOld on mm:u (#521)
* Fix mm:u

* Align some missing

* Fix some uncorrect code
2024-02-22 19:14:07 -05:00
Alex Barney
cd1cb5f57e Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields

* Naming conventions

* Remove unneeded ".this"

* Remove unneeded semicolons

* Remove unused Usings

* Don't use var

* Remove unneeded enum underlying types

* Explicitly label class visibility

* Remove unneeded @ prefixes

* Remove unneeded commas

* Remove unneeded if expressions

* Method doesn't use unsafe code

* Remove unneeded casts

* Initialized objects don't need an empty constructor

* Remove settings from DotSettings

* Revert "Explicitly label class visibility"

This reverts commit ad5eb5787c.

* Small changes

* Revert external enum renaming

* Changes from feedback

* Apply previous refactorings to the merged code
2024-02-22 19:14:06 -05:00
gdkchan
75b2a2b9a1 Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)
This reverts commit 85dbb9559a.
2024-02-22 19:14:05 -05:00
Alex Barney
8cccd8ddbe Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields

* Naming conventions

* Remove unneeded ".this"

* Remove unneeded semicolons

* Remove unused Usings

* Don't use var

* Remove unneeded enum underlying types

* Explicitly label class visibility

* Remove unneeded @ prefixes

* Remove unneeded commas

* Remove unneeded if expressions

* Method doesn't use unsafe code

* Remove unneeded casts

* Initialized objects don't need an empty constructor

* Remove settings from DotSettings

* Revert "Explicitly label class visibility"

This reverts commit ad5eb5787c.

* Small changes

* Revert external enum renaming

* Changes from feedback

* Remove unneeded property setters
2024-02-22 19:14:04 -05:00
gdkchan
7e371ce8a0 NVDEC implementation using FFmpeg (#443)
* Initial nvdec implementation using FFmpeg

* Fix swapped channels on the video decoder and the G8R8 texture format

* Fix texture samplers not being set properly (regression)

* Rebased

* Remove unused code introduced on the rebase

* Add support for RGBA8 output format on the video image composer

* Correct spacing

* Some fixes for rebase and other tweaks

* Allow size mismatch on frame copy

* Get rid of GetHostAddress calls on VDec
2024-02-22 19:14:04 -05:00
LDj3SNuD
2394afa5c2 Fix Sshl_V; Add S/Uqrshl_V, S/Uqshl_V, S/Urshl_V; Add Tests. (#516)
* Update OpCodeTable.cs

* Update InstEmitSimdShift.cs

* Update SoftFallback.cs

* Update CpuTestSimdReg.cs

* Nit.

* Update SoftFallback.cs

* Update Optimizations.cs

* Update InstEmitSimdLogical.cs

* Update InstEmitSimdArithmetic.cs
2024-02-22 19:14:03 -05:00
jduncanator
dcc1361b12 Normalize all the line endings (#518) 2024-02-22 19:14:03 -05:00
gdkchan
c1ba8d09a8 Add support for bigger UBOs, fix sRGB regression, small improvement t… (#503)
* Add support for bigger UBOs, fix sRGB regression, small improvement to the 2D copy engine

* Break into multiple lines

* Read fractions for source/step values on the 2d copy engine aswell

* Use fixed point math for more speed

* Fix reinterpret when texture sizes are different
2024-02-22 19:14:03 -05:00
gdkchan
5fe41e86c1 Better process implementation (#491)
* Initial implementation of KProcess

* Some improvements to the memory manager, implement back guest stack trace printing

* Better GetInfo implementation, improve checking in some places with information from process capabilities

* Allow the cpu to read/write from the correct memory locations for accesses crossing a page boundary

* Change long -> ulong for address/size on memory related methods to avoid unnecessary casts

* Attempt at implementing ldr:ro with new KProcess

* Allow BSS with size 0 on ldr:ro

* Add checking for memory block slab heap usage, return errors if full, exit gracefully

* Use KMemoryBlockSize const from KMemoryManager

* Allow all methods to read from non-contiguous locations

* Fix for TransactParcelAuto

* Address PR feedback, additionally fix some small issues related to the KIP loader and implement SVCs GetProcessId, GetProcessList, GetSystemInfo, CreatePort and ManageNamedPort

* Fix wrong check for source pages count from page list on MapPhysicalMemory

* Fix some issues with UnloadNro on ldr:ro
2024-02-22 19:14:03 -05:00
HorrorTroll
686a3a2c45 Add RGBA16 Unorm (#513) 2024-02-22 19:14:03 -05:00