Commit graph

64 commits

Author SHA1 Message Date
gdkchan
22bacc6188
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
2019-01-18 20:26:39 -02:00
jduncanator
8406ec6272 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
2019-01-11 01:11:46 +01:00
Thomas Guillemard
b4d91402c6 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
2019-01-05 22:26:16 +01:00
Alex Barney
290f5e812e Update to LibHac 0.2.0 (#549)
* Update to LibHac 0.2.0

* Changes based on feedback
2019-01-05 01:41:49 +01:00
emmauss
8dcfeb64a3
fix wrong contenttype (#553) 2018-12-30 15:36:35 +02:00
WilliamWsyHK
5b029ae7a2 System Language can be configurable. (#535) 2018-12-27 17:08:34 +02:00
gdkchan
0039bb6394
Refactor SVC handler (#540)
* Refactor SVC handler

* Get rid of KernelErr

* Split kernel code files into multiple folders
2018-12-18 03:33:36 -02:00
Roderick Sieben
2e143365eb 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
2018-12-11 23:48:54 -02:00
HorrorTroll
5b4382f459 Fix InitializeOld & add FinalizeOld, SetAndWaitOld, GetOld on mm:u (#521)
* Fix mm:u

* Align some missing

* Fix some uncorrect code
2018-12-07 13:19:10 -02:00
Alex Barney
fb1d9493a3 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
2018-12-06 09:16:24 -02:00
gdkchan
3615a70cae
Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)
This reverts commit 85dbb9559a.
2018-12-04 22:52:39 -02:00
Alex Barney
85dbb9559a 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
2018-12-04 18:23:37 -02:00
gdkchan
c86aacde76
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
2018-12-03 00:38:47 -02:00
gdkchan
00579927e4
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
2018-11-28 20:18:09 -02:00
Ac_K
ea35b3d1b0 Clean LM string (#512)
* Update ILogger.cs

* Update ILogger.cs

remove optionnal args

* Change to interpolated strings
2018-11-21 04:27:18 -02:00
emmauss
dc02ac08ca Support other switch controller types (#487)
* Make controllers modular, support changing controller type

* return readable events

* signal hid events

* fix style
2018-11-20 01:01:36 +01:00
emmauss
fe8fbb6fb9 Implement ContentManager and related services (#438)
* Implement contentmanager and related services

* small changes

* read system firmware version from nand

* add pfs support, write directoryentry info for romfs files

* add file check in fsp-srv:8

* add support for open fs of internal files

* fix filename when accessing pfs

* use switch style paths for contentpath

* close nca after verifying type

* removed publishing profiles, align directory entry

* fix style

* lots of style fixes

* yasf(yet another style fix)

* yasf(yet another style fix) plus symbols

* enforce path check on every fs access

* change enum type to default

* fix typo
2018-11-18 17:37:41 -02:00
gdkchan
d2bb458b51 Improved GPU command lists decoding (#499)
* Better implementation of the DMA pusher, misc fixes

* Remove some debug code

* Correct RGBX8 format

* Add support for linked Texture Sampler Control

* Attempt to fix upside down screen issue
2018-11-17 05:01:31 +01:00
gdkchan
b833183ef6 HwOpus service implementation (#201)
* Started to implement the hwopus service

* Write outputs on decode method, some basic error handling

* Fix buffer size read from header and check

* Fix order of values
2018-11-17 04:36:49 +01:00
jduncanator
8275bc3c08 Implement libsoundio as an alternative audio backend (#406)
* Audio: Implement libsoundio as an alternative audio backend

libsoundio will be preferred over OpenAL if it is available on the machine. If neither are available, it will fallback to a dummy audio renderer that outputs no sound.

* Audio: Fix SoundIoRingBuffer documentation

* Audio: Unroll and optimize the audio write callback

Copying one sample at a time is slow, this unrolls the most common audio channel layouts and manually copies the bytes between source and destination. This is over 2x faster than calling CopyBlockUnaligned every sample.

* Audio: Optimize the write callback further

This dramatically reduces the audio buffer copy time. When the sample size is one of handled sample sizes the buffer copy operation is almost 10x faster than CopyBlockAligned.

This works by copying full samples at a time, rather than the individual bytes that make up the sample. This allows for 2x or 4x faster copy operations depending on sample size.

* Audio: Fix typo in Stereo write callback

* Audio: Fix Surround (5.1) audio write callback

* Audio: Update Documentation

* Audio: Use built-in Unsafe.SizeOf<T>()

Built-in `SizeOf<T>()` is 10x faster than our `TypeSize<T>` helper. This also helps reduce code surface area.

* Audio: Keep fixed buffer style consistent

* Audio: Address styling nits

* Audio: More style nits

* Audio: Add additional documentation

* Audio: Move libsoundio bindings internal

As per discussion, moving the libsoundio native bindings into Ryujinx.Audio

* Audio: Bump Target Framework back up to .NET Core 2.1

* Audio: Remove voice mixing optimizations.

Leaves Saturation optimizations in place.
2018-11-15 03:22:50 +01:00
Alex Barney
53e6664526 Update libhac. Load tickets from XCI files (#476) 2018-10-30 23:34:27 -03:00
Alex Barney
9cb57fb4bb Adjust naming conventions for Ryujinx and ChocolArm64 projects (#484)
* Change naming convention for Ryujinx project

* Change naming convention for ChocolArm64 project

* Fix NaN

* Remove unneeded this. from Ryujinx project

* Adjust naming from new PRs

* Name changes based on feedback

* How did this get removed?

* Rebasing fix

* Change FP enum case

* Remove prefix from ChocolArm64 classes - Part 1

* Remove prefix from ChocolArm64 classes - Part 2

* Fix alignment from last commit's renaming

* Rename namespaces

* Rename stragglers

* Fix alignment

* Rename OpCode class

* Missed a few

* Adjust alignment
2018-10-30 22:43:02 -03:00
jduncanator
c1b7340023 Timing: Optimize Timestamp Aquisition (#479)
* Timing: Optimize Timestamp Aquisition

Currently, we make use of Environment.TickCount in a number of places. This has some downsides, mainly being that the TickCount is a signed 32-bit integer, and has an effective limit of ~25 days before overflowing and wrapping around. Due to the signed-ness of the value, this also caused issues with negative numbers. This resolves these issues by using a 64-bit tick count obtained from Performance Counters (via the Stopwatch class). This has a beneficial side effect of being significantly more accurate than the TickCount.

* Timing: Rename ElapsedTicks to ElapsedMilliseconds and expose TicksPerX

* Timing: Some style changes

* Timing: Align static variable initialization
2018-10-28 19:31:13 -03:00
gdkchan
2fd23577ce
Move prio/core locals inside the lock on yield (#478) 2018-10-24 09:45:37 -03:00
Ac_K
7920dc1d2f Implement basic psm service (#467)
* Implement basic psm service

- Add `IPsmServer`
- Stub `GetBatteryChargePercentage` & `GetChargerType`

* Fix wrong sorting

* Add IPsmSession

- Add `IPsmSession` by Thog
- Implement `OpenSession`
2018-10-21 03:01:22 -03:00
Thomas Guillemard
b5f7d8106b Complete rewrite of bsd IClient (#460)
This should provide accurate behaviours.
This implementation has been tested with ftpd and libtransistor bsd tests.

This implementation lacks OOB support.
2018-10-20 22:08:58 +00:00
gdkchan
2cb8541462 Print stack trace on invalid memory accesses (#461)
* Print stack trace on invalid memory accesses

* Rebased, change code region base address for 39-bits address space, print stack trace on break and undefined instructions too
2018-10-20 22:07:52 +00:00
gdkchan
0e1e094b7a
Improve texture tables (#457)
* Improve texture tables

* More renaming and other tweaks

* Minor tweaks
2018-10-17 18:02:23 -03:00
gdkchan
02a8e7fc93
Remove unnecessary usings (#463)
* Remove unnecessary usings

* Fix CastExpression while I'm at it
2018-10-17 14:55:10 -03:00
ReinUsesLisp
b3a4662be1 Move logging to Ryujinx.Common and make it a static class (#413) 2018-10-17 14:15:50 -03:00
Thomas Guillemard
9b19ea3c87 Remove IFileSystem::OpenDirectory extraneous check (#459)
A directory can be open more than one time. This fix issues with
homebrews opening the same directory multiple time.
2018-10-16 23:55:10 +00:00
Thomas Guillemard
ac1a379265 Fix some issues with UserId (#455) 2018-10-14 02:07:56 +00:00
Ac_K
3561062bc6 Update IAccountService and IManagerForApplication (#454)
* Update IAccountService and IManagerForApplication

`IAccountService`:
- Add symbols.
- Fix some mistake.
- Add `IsUserRegistrationRequestPermitted` and `TrySelectUserWithoutInteraction`.

`IManagerForApplication`:
- Add symbols.
- Add Uuid args.
- Little improvement of `GetAccountId`
2018-10-14 01:16:02 +02:00
Thomas Guillemard
b2063be597 Implement IResolver (#442)
* Implement IResolver

- GetAddrInfo & GetNameInfo still need to be implemented.

* Address comments

* Use MakeError
2018-10-10 01:15:07 +02:00
Thomas Guillemard
d5c0de8362 Implement IRoInterface (#445)
* Implement IRoInterface

This is required by Super Mario Party.
This commit also adds MapProcessCodeMemory and UnmapProcessCodeMemory functions in KMemoryManager. Those two calls might not reflect what the SVC of the same names do.

* Fix some code style issues

* Use MakeError to clarify error code

* Add NRR and NRO constants

* Fix some codestyle issues

* Fix InvalidMemoryState error code
2018-10-10 01:01:49 +02:00
Thomas Guillemard
65c67bb4a5
Break: don't crash when bit 31 is set (#444) 2018-10-08 20:53:08 +02:00
emmauss
625fc8c0e0 Stubs Again (#439)
* stub/implement audren commands

* stub ISelfController get/set IdleTimeDetectonExtension

* stub irs

* add irs logclass, stub mmu:u irequest 1

* style fixes, addressed comments
2018-10-07 17:12:11 +02:00
emmauss
caa181edf2 Save Common implementation (#434)
* save common implementation

* remove zero userid check

* Renamed UserId to UInt128

* fix index in hex conversion
2018-10-07 15:13:46 +02:00
Ac_K
5b8ccb717f Implement ISslContext (#440)
This PR implement an empty `ISslContext` and update `CreateContext` and `SetInterfaceVersion` inside `ISslService`
2018-10-07 00:16:42 +02:00
Alex Barney
5821ff675d Misc content loading improvements (#432)
* Misc content loading improvements
2018-10-06 18:11:47 +03:00
emmaus
0ada047eaf fix out of handles error 2018-09-28 10:47:53 +00:00
Ac_K
40282da93a Implement friend:a IFriendService: 10101 (#429)
* Implement friend:a IFriendService: 10101

* Update Profile Picture

* Update IFriendServiceTypes.cs

* Update IFriendServiceTypes.cs

* Update IFriendService.cs

* Update IFriendServiceTypes.cs

* Update IFriendServiceTypes.cs

* Update IFriendService.cs
2018-09-25 19:59:29 -03:00
ReinUsesLisp
2562ca6c3f Fix multiple rendertargets (#427)
* Simplify render target bindings

* Implement multiple viewports

* Pack glViewportIndexed calls into a single glViewportArray

* Use ARB_viewport_array when available

* Cache framebuffer attachments

* Use get accessors in OGLExtension

* Address feedback
2018-09-26 00:55:30 +02:00
gdkchan
7de7b559ad Improve kernel events implementation (#430)
* Improve kernel events implementation

* Some cleanup

* Address PR feedback
2018-09-23 20:11:46 +02:00
Ac_K
a76660eac5
Fix IHidServer code style 2018-09-21 06:30:58 +02:00
Ac_K
e77c1560e6 Full 5.X stubbed IHidServer (#428)
* Full 5.X stubbed IHidServer

Since we can't support all those Hid calls in the right way, we can stub them with more information as possible in the logs.
I have added all symbols in it to be more revelant as possible.
It's remove some Hid spam in few games too, because we assign some var as the game want.

* Fix issues

* Fix code according to review
2018-09-21 02:08:35 +02:00
gdkchan
6d65e53664
Remove cold methods from the CPU cache (#224)
* Remove unused tracing functionality from the CPU

* GetNsoExecutable -> GetExecutable

* Unsigned comparison

* Re-add cpu tracing

* Config change

* Remove cold methods from the translation cache on the cpu

* Replace lock with try lock, pass new ATranslatorCache instead of ATranslator

* Rebase fixups
2018-09-19 17:07:56 -03:00
gdkchan
99b2692425
Fix performance regression caused by the new scheduler changes (#422)
* Call interrupt less often, remove some leftovers from the old scheduler code

* Remove unneeded attribute
2018-09-19 12:16:20 -03:00
emmauss
fae097408e Show Game Title on Titlebar (#408)
* support reading control data

* show game info on titlebar

* use first language is default is not available

* use seperate language enums for titles

* fix hex display
2018-09-19 14:09:49 +02:00
gdkchan
b8133c1997
Thread scheduler rewrite (#393)
* Started to rewrite the thread scheduler

* Add a single core-like scheduling mode, enabled by default

* Clear exclusive monitor on context switch

* Add SetThreadActivity, misc fixes

* Implement WaitForAddress and SignalToAddress svcs, misc fixes

* Misc fixes (on SetActivity and Arbiter), other tweaks

* Rebased

* Add missing null check

* Rename multicore key on config, fix UpdatePriorityInheritance

* Make scheduling data MLQs private

* nit: Ordering
2018-09-18 20:36:43 -03:00