Commit graph

5277 commits

Author SHA1 Message Date
bunnei
2d9546848e
Merge pull request #2230 from lioncash/global
kernel/process: Remove use of global system accessors
2019-03-14 20:42:46 -04:00
bunnei
e7850a7f11
Merge pull request #2226 from lioncash/private
kernel/server_port: Make data members private
2019-03-13 14:44:21 -04:00
bunnei
c1ea6a39a0
Merge pull request #2223 from lioncash/error
core/hle/result: Tidy up the base error code result header.
2019-03-13 14:43:14 -04:00
bunnei
e8a21f5276
Merge pull request #2166 from lioncash/vi-init-service
service/vi: Unstub GetDisplayService
2019-03-13 10:01:54 -04:00
Lioncash
5379063108 core/hle/kernel/svc: Implement svcUnmapTransferMemory
Similarly, like svcMapTransferMemory, we can also implement
svcUnmapTransferMemory fairly trivially as well.
2019-03-13 06:04:49 -04:00
Lioncash
567134f874 core/hle/kernel/svc: Implement svcMapTransferMemory
Now that transfer memory handling is separated from shared memory, we
can implement svcMapTransferMemory pretty trivially.
2019-03-13 06:04:49 -04:00
Lioncash
cb198d7985 core/hle/kernel: Split transfer memory handling out into its own class
Within the kernel, shared memory and transfer memory facilities exist as
completely different kernel objects. They also have different validity
checking as well. Therefore, we shouldn't be treating the two as the
same kind of memory.

They also differ in terms of their behavioral aspect as well. Shared
memory is intended for sharing memory between processes, while transfer
memory is intended to be for transferring memory to other processes.

This breaks out the handling for transfer memory into its own class and
treats it as its own kernel object. This is also important when we
consider resource limits as well. Particularly because transfer memory
is limited by the resource limit value set for it.

While we currently don't handle resource limit testing against objects
yet (but we do allow setting them), this will make implementing that
behavior much easier in the future, as we don't need to distinguish
between shared memory and transfer memory allocations in the same place.
2019-03-13 06:04:44 -04:00
Lioncash
6eddb60db0 kernel/process: Remove use of global system accessors
Now that we pass in a reference to the system instance, we can utilize
it to eliminate the global accessors in Process-related code.
2019-03-12 19:03:28 -04:00
bunnei
3bfd199497
Merge pull request #2211 from lioncash/arbiter
kernel: Make the address arbiter instance per-process
2019-03-12 17:54:48 -04:00
Zach Hilman
cd2921a047 set_sys: Move constants to anonymous namespace 2019-03-11 11:16:35 -04:00
Lioncash
aa44eb639b kernel/server_port: Make data members private
With this, all kernel objects finally have all of their data members
behind an interface, making it nicer to reason about interactions with
other code (as external code no longer has the freedom to totally alter
internals and potentially messing up invariants).
2019-03-11 10:41:05 -04:00
Lioncash
7ad3d4e49c hwopus: Leverage multistream API for decoding regular Opus packets
After doing a little more reading up on the Opus codec, it turns out
that the multistream API that is part of libopus can handle regular
packets. Regular packets are just a degenerate case of multistream Opus
packets, and all that's necessary is to pass the number of streams as 1
and  provide a basic channel mapping, then everything works fine for
that case.

This allows us to get rid of the need to use both APIs in the future
when implementing multistream variants in a follow-up PR, greatly
simplifying the code that needs to be written.
2019-03-11 07:06:18 -04:00
Zach Hilman
debc7442f2 set_sys: Use official nintendo version string 2019-03-10 19:54:13 -04:00
Zach Hilman
73f2ee5484 system_version: Correct sizes on VectorVfsFile construction 2019-03-10 19:16:17 -04:00
Zach Hilman
597c00698d set_sys: Use correct error codes in GetFirmwareVersion* 2019-03-10 19:09:23 -04:00
Lioncash
0c28ab92e6 core/hle/result: Remove now-unnecessary manually defined copy assignment operator
Previously this was required, as BitField wasn't trivially copyable.
BitField has since been made trivially copyable, so now this isn't
required anymore.
2019-03-10 18:34:20 -04:00
Lioncash
3f602dde0f core/hle/result: Amend error in comment description for ResultCode
Gets rid of another holdover from Citra, and describes the OS on the
Switch instead.
2019-03-10 18:29:31 -04:00
Lioncash
f7ec0bcfc2 core/hle/result: Remove now-unused constructor for ResultCode
Now that the final stray ErrorDescription member was relocated, we can
finally remove it and its relevant constructor in the ResultCode union.
2019-03-10 18:26:12 -04:00
Lioncash
d870cc5ad7 core/hle/result: Relocate IPC error code to ipc_helpers
Relocates the error code to where it's most related, similar to how all
the other error codes are. Previously we were including a non-generic
error in the main result code header.
2019-03-10 18:23:42 -04:00
Lioncash
8603f0f9b1 service/service: Remove unncessary calls to c_str()
These can just be passed regularly, now that we use fmt instead of our
old logging system.

While we're at it, make the parameters to MakeFunctionString
std::string_views.
2019-03-10 18:00:57 -04:00
bunnei
0aa824b12f
Merge pull request #2207 from lioncash/hwopus
service/audio/hwopus: Move decoder state to its own class
2019-03-10 17:32:39 -04:00
bunnei
037d9bdde3
Merge pull request #2193 from lioncash/global
kernel/scheduler: Pass in system instance in constructor
2019-03-10 17:29:01 -04:00
Zach Hilman
ed82bb968a set_sys: Implement GetFirmwareVersion(2) for libnx hosversion
Uses the synthesized system archive 9 (SystemVersion) and reports v5.1.0-0.0
2019-03-10 16:51:42 -04:00
Hexagon12
e6f652ae12 clang fix 2019-03-09 16:42:56 +02:00
Hexagon12
6ce8de4b5f Log 2 new setting values 2019-03-09 14:58:15 +02:00
bunnei
9909d40530
Merge pull request #2210 from lioncash/optional
kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optional
2019-03-08 16:35:57 -05:00
Lioncash
fbb82e61e3 kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optional
There's no real need to use a shared lifetime here, since we don't
actually expose them to anything else. This is also kind of an
unnecessary use of the heap given the objects themselves are so small;
small enough, in fact that changing over to optionals actually reduces
the overall size of the HLERequestContext struct (818 bytes to 808
bytes).
2019-03-07 23:34:37 -05:00
Lioncash
8e510d5afa kernel: Make the address arbiter instance per-process
Now that we have the address arbiter extracted to its own class, we can
fix an innaccuracy with the kernel. Said inaccuracy being that there
isn't only one address arbiter. Each process instance contains its own
AddressArbiter instance in the actual kernel.

This fixes that and gets rid of another long-standing issue that could
arise when attempting to create more than one process.
2019-03-07 23:27:51 -05:00
Lioncash
b7f331afa3 kernel/svc: Move address arbiter signaling behind a unified API function
Similar to how WaitForAddress was isolated to its own function, we can
also move the necessary conditional checking into the address arbiter
class itself, allowing us to hide the implementation details of it from
public use.
2019-03-07 23:27:47 -05:00
Lioncash
0209de123b kernel/svc: Move address arbiter waiting behind a unified API function
Rather than let the service call itself work out which function is the
proper one to call, we can make that a behavior of the arbiter itself,
so we don't need to directly expose those implementation details.
2019-03-07 23:27:20 -05:00
bunnei
d26ee6e01e
Merge pull request #2195 from lioncash/shared-global
kernel/shared_memory: Get rid of the use of global accessor functions within Create()
2019-03-07 17:26:11 -05:00
bunnei
c63a0e88b7
Merge pull request #2202 from lioncash/port-priv
kernel/client_session, kernel/server_session: Make data members private
2019-03-07 15:31:26 -05:00
bunnei
d9e9e71aec
Merge pull request #2206 from lioncash/audio-stop
service/audio/audout_u: Only actually stop the audio stream in StopAudioOut if the stream is playing
2019-03-07 10:47:59 -05:00
bunnei
4f352833a5
Merge pull request #2055 from bunnei/gpu-thread
Asynchronous GPU command processing
2019-03-07 10:41:53 -05:00
Lioncash
d03ae881fd service/audio/hwopus: Move decoder state to its own class
Moves the non-multistream specific state to its own class. This will be
necessary to support the multistream variants of opus decoding.
2019-03-07 07:47:09 -05:00
Lioncash
960057cba0 service/audio/hwopus: Provide a name for the second word of OpusPacketHeader
This indicates the entropy coder's final range.
2019-03-07 05:48:35 -05:00
Lioncash
d41d85766f service/audio/hwopus: Move Opus packet header out of the IHardwareOpusDecoderManager
This will be utilized by more than just that class in the future. This
also renames it from OpusHeader to OpusPacketHeader to be more specific
about what kind of header it is.
2019-03-07 05:37:08 -05:00
Lioncash
3293877456 service/audio/hwopus: Enclose internals in an anonymous namespace
Makes it impossible to violate the ODR, as well as providing a place for
future changes.
2019-03-07 05:32:42 -05:00
Lioncash
64e7524f36 service/audio/audout_u: Only actually stop the audio stream in StopAudioOut if the stream is playing
The service itself only does further actions if the stream is playing.
If the stream is already stopped, then it just exits successfully.
2019-03-07 03:39:01 -05:00
bunnei
ed0bdcc638
Merge pull request #2197 from lioncash/include
core/hle/ipc: Remove unnecessary includes
2019-03-06 21:55:16 -05:00
bunnei
aaa373585c gpu: Refactor a/synchronous implementations into their own classes. 2019-03-06 21:48:57 -05:00
bunnei
7b574f406b gpu: Move command processing to another thread. 2019-03-06 21:48:57 -05:00
bunnei
d2ff93c319
Merge pull request #2190 from lioncash/ogl-global
core: Remove the global telemetry accessor function
2019-03-06 21:41:53 -05:00
bunnei
ac51d048a9 gpu: Refactor command and swap buffers interface for asynch. 2019-03-06 21:09:09 -05:00
bunnei
4483089d70 gpu: Refactor to take RendererBase instead of RasterizerInterface. 2019-03-06 21:09:09 -05:00
bunnei
d6015ee211 settings: Add new graphics setting for use_asynchronous_gpu_emulation. 2019-03-06 21:09:09 -05:00
bunnei
81e086b5ac core: Set is_powered_on before GPU is initialized. 2019-03-06 21:07:33 -05:00
bunnei
75b417489a
Merge pull request #2199 from lioncash/arbiter
kernel/address_arbiter: Convert the address arbiter into a class
2019-03-06 15:55:56 -05:00
Lioncash
9ac176d5a3 hle/service/audio/audout_u: Correct lack of return in failure case of AppendAudioOutBufferImpl()
Previously we were overwriting the error case with a success code
further down (which is definitely not what we should be doing here).
2019-03-06 11:44:32 -05:00
bunnei
234f00bdd4
Merge pull request #2194 from lioncash/mem
svc: Move memory range checking functions to the VMManager class
2019-03-06 11:43:07 -05:00
bunnei
5a57b1a09b
Merge pull request #2200 from lioncash/audio
hle/service/audio: Extract audio error codes to a header
2019-03-06 10:52:45 -05:00
Lioncash
221613d4ea kernel/server_session: Make data members private
Makes it much nicer to locally reason about server session behavior, as
part of its functionality isn't placed around other classes.
2019-03-05 20:10:07 -05:00
Lioncash
7526b6fce3 kernel/client_session: Make data members private
These can be made private, as they aren't accessed in contexts that
require them to be public.
2019-03-05 20:10:03 -05:00
Lioncash
ad9dbeb44b hle/service/audio: Extract audio error codes to a header
Places all error codes in an easily includable header.

This also corrects the unsupported error code (I accidentally used the
hex value when I meant to use the decimal one).
2019-03-05 16:51:37 -05:00
Lioncash
c161389a0f kernel/address_arbiter: Pass in system instance to constructor
Allows getting rid of reliance on the global accessor functions and
instead operating on the provided system instance.
2019-03-05 15:47:03 -05:00
Lioncash
9d9676f620 kernel/address_arbiter: Minor tidying up
- Invert conditions into guard clases where applicable.
- Mark std::vector parameter of WakeThreads as const
2019-03-05 12:58:31 -05:00
Lioncash
ec6664f6d6 kernel/address_arbiter: Convert the address arbiter into a class
Places all of the functions for address arbiter operation into a class.
This will be necessary for future deglobalizing efforts related to both
the memory and system itself.
2019-03-05 12:58:26 -05:00
Zach Hilman
52ac6419da vm_manager: Remove cheat-specific ranges from VMManager 2019-03-05 10:09:36 -05:00
Lioncash
79f970e6de kernel/thread: Remove obsolete TODO in Create()
This is a TODO carried over from Citra that doesn't apply here.
2019-03-05 10:05:49 -05:00
Lioncash
02bc9e9de1 core/hle/ipc: Remove unnecessary includes
Removes a few inclusion dependencies from the headers or replaces
existing ones with ones that don't indirectly include the required
headers.

This allows removing an inclusion of core/memory.h, meaning that if the
memory header is ever changed in the future, it won't result in
rebuilding the entirety of the HLE services (as the IPC headers are used
quite ubiquitously throughout the HLE service implementations).
2019-03-05 09:53:38 -05:00
Zach Hilman
7053546687 core: Add support for registering and controlling ownership of CheatEngine 2019-03-04 18:41:29 -05:00
Zach Hilman
769b346682 cheat_engine: Add parser and interpreter for game cheats 2019-03-04 18:39:58 -05:00
Zach Hilman
c100a4b8d4 loader/nso: Set main code region in VMManager
For rom directories (and by extension, XCI/NSP/NAX/NCA) this is for the NSO with name 'main', for regular NSOs, this is the NSO.
2019-03-04 18:39:58 -05:00
Zach Hilman
b952a30555 vm_manager: Add support for storing and getting main code region
Used as root for one region of cheats, set by loader
2019-03-04 18:39:58 -05:00
Zach Hilman
4495bf5706 patch_manager: Display cheats in game list add-ons 2019-03-04 18:39:57 -05:00
Zach Hilman
c5091bfe00 patch_manager: Add support for loading cheats lists
Uses load/<title_id>/<mod_name>/cheats as root dir, file name is all upper or lower hex first 8 bytes build ID.
2019-03-04 18:39:57 -05:00
Zach Hilman
9d1ab766a0 controllers/npad: Add accessor for current press state
Allows frontend/features to access pressed buttons conveniently as possible
2019-03-04 18:39:57 -05:00
Lioncash
40de7f6fe8 vm_manager: Use range helpers in HeapAlloc() and HeapFree()
Significantly tidies up two guard conditionals.
2019-03-04 17:16:52 -05:00
Lioncash
6c42a23550 vm_manager: Provide address range checking functions for other memory regions
Makes the interface uniform when it comes to checking various memory
regions.
2019-03-04 17:08:55 -05:00
Lioncash
fad20213e6 kernel/scheduler: Pass in system instance in constructor
Avoids directly relying on the global system instance and instead makes
an arbitrary system instance an explicit dependency on construction.

This also allows removing dependencies on some global accessor functions
as well.
2019-03-04 17:01:37 -05:00
Lioncash
f59040d752 kernel/shared_memory: Get rid of the use of global accessor functions within Create()
Given we already pass in a reference to the kernel that the shared
memory instance is created under, we can just use that to check the
current process, rather than using the global accessor functions.

This allows removing direct dependency on the system instance entirely.
2019-03-04 16:52:36 -05:00
Lioncash
0be8fffc99 svc: Migrate address range checking functions to VMManager
Provides a bit of a more proper interface for these functions.
2019-03-04 16:32:03 -05:00
Lioncash
b114928459 core/core: Remove the global telemetry accessor function
With all usages converted off of it, this function can be removed.
2019-03-04 10:24:13 -05:00
Lioncash
b5f0dc95db core/core: Replace direct usage of the global system telemetry accessor from Shutdown()
The telemetry instance is actually a member of the class itself, so we
can access it directly instead of going through the global accessor.
2019-03-04 10:24:13 -05:00
Weiyi Wang
5159f4eee8 Memory: don't lock hle mutex in memory read/write
The comment already invalidates itself: neither MMIO nor rasterizer cache belongsHLE kernel state. This mutex has a too large scope if MMIO or cache is included, which is prone to dead lock when multiple thread acquires these resource at the same time. If necessary, each MMIO component or rasterizer should have their own lock.
2019-03-02 15:20:05 +01:00
bunnei
12e74fe801
Merge pull request #2180 from lioncash/audren
service/audio: Provide an implementation of ExecuteAudioRendererRendering
2019-03-01 09:50:14 -05:00
Lioncash
84aff56644 service/audio/audren_u: Implement OpenAudioRendererAuto
This currently has the same behavior as the regular
OpenAudioRenderer API function, so we can just move the code within
OpenAudioRenderer to an internal function that both service functions
call.
2019-03-01 05:40:29 -05:00
Lioncash
42dc73157c service/audio: Provide an implementation of ExecuteAudioRendererRendering
This service function appears to do nothing noteworthy on the switch.
All it does at the moment is either return an error code or abort the
system. Given we obviously don't want to kill the system, we just opt
for always returning the error code.
2019-03-01 03:37:00 -05:00
bunnei
49c6d21b31
Merge pull request #2174 from lioncash/fwd
service/hid: Amend forward declaration of ServiceManager
2019-02-27 21:20:06 -05:00
Annomatg
ef84c70d22 Speed up memory page mapping (#2141)
- Memory::MapPages total samplecount was reduced from 4.6% to 1.06%.
- From main menu into the game from 1.03% to 0.35%
2019-02-27 17:22:47 -05:00
Lioncash
6335bf136f service/hid: Amend forward declaration of ServiceManager
The SM namespace is within the Service namespace, so this was forward
declaring a type that didn't exist.
2019-02-27 11:36:48 -05:00
bunnei
42f7c11021
Merge pull request #2169 from lioncash/naming
audio_core/audio_renderer: Provide names for some parameters of AudioRendererParameter
2019-02-27 11:26:54 -05:00
bunnei
14430f7df9
Merge pull request #2170 from lioncash/emu-window
core/frontend/emu_window: Make ClipToTouchScreen a const member function
2019-02-27 11:26:24 -05:00
bunnei
eb5a3dd1c7
Merge pull request #2161 from lioncash/handle-table
kernel/handle_table: Allow process capabilities to limit the handle table size
2019-02-27 11:22:26 -05:00
Lioncash
46b3209abb core/frontend/emu_window: Make ClipToTouchScreen a const member function
This member function doesn't modify instance state, so it can have the
const specifier applied to it.
2019-02-27 08:54:42 -05:00
Lioncash
0e1b5acc6a audio_core/audio_renderer: Name previously unknown parameters of AudioRendererParameter
Provides names for previously unknown entries (aside from the two u8
that appear to be padding bytes, and a single word that also appears
to be reserved or padding).

This will be useful in subsequent changes when unstubbing behavior related
to the audio renderer services.
2019-02-27 06:09:07 -05:00
Lioncash
b9238edd0d common/math_util: Move contents into the Common namespace
These types are within the common library, so they should be within the
Common namespace.
2019-02-27 03:38:39 -05:00
Lioncash
1b855efd5e common/vector_math: Move Vec[x] types into the Common namespace
These types are within the common library, so they should be using the
Common namespace.
2019-02-26 22:38:36 -05:00
Lioncash
92ea1c32d6 service/vi: Unstub GetDisplayService
This function is also supposed to check its given policy type with the
permission of the service itself. This implements the necessary
machinery to unstub these functions.

Policy::User seems to just be basic access (which is probably why vi:u
is restricted to that policy), while the other policy seems to be for
extended abilities regarding which displays can be managed and queried,
so this is assumed to be for a background compositor (which I've named,
appropriately, Policy::Compositor).
2019-02-26 20:16:23 -05:00
Lioncash
254b1e3df7 core/ipc_helper: Allow popping all signed value types with RequestParser
There's no real reason this shouldn't be allowed, given some values sent
via a request can be signed. This also makes it less annoying to work
with popping enum values, given an enum class with no type specifier
will work out of the box now.

It's also kind of an oversight to allow popping s64 values, but nothing
else.
2019-02-26 18:10:36 -05:00
Lioncash
1b2872eebc service/vi: Remove use of a module class
This didn't really provide much benefit here, especially since the
subsequent change requires that the behavior for each service's
GetDisplayService differs in a minor detail.

This also arguably makes the services nicer to read, since it gets rid
of an indirection in the class hierarchy.
2019-02-26 17:44:03 -05:00
bunnei
c3471bf618
Merge pull request #2156 from FreddyFunk/patch-1
file_sys/vfs_vector: Fix ignored offset on Write
2019-02-25 18:28:58 -05:00
Lioncash
d29f9e9709 kernel/handle_table: Make local variables as const where applicable
Makes immutable state explicit.
2019-02-25 11:12:38 -05:00
Lioncash
5167d1577d kernel/handle_table: Allow process capabilities to limit the handle table size
The kernel allows restricting the total size of the handle table through
the process capability descriptors. Until now, this functionality wasn't
hooked up. With this, the process handle tables become properly restricted.

In the case of metadata-less executables, the handle table will assume
the maximum size is requested, preserving the behavior that existed
before these changes.
2019-02-25 11:12:32 -05:00
Lioncash
4f8cd74061 kernel/handle-table: In-class initialize data members
Directly initializes members where applicable.
2019-02-25 10:14:05 -05:00
Lioncash
0220862ba5 kernel/handle_table: Resolve truncation warnings
Avoids implicit truncation warnings from u32 -> u16 (the truncation is
desirable behavior here).
2019-02-25 09:53:21 -05:00
Lioncash
be7dad5e7e service/vi: Update IManagerDisplayService's function table
Amends it to add the 7.0.0+ CreateStrayLayer function.
2019-02-25 08:09:00 -05:00
Frederic L
517933adcb
file_sys/vfs_vector: Fix ignored offset on Write 2019-02-25 00:27:49 +01:00
Lioncash
90528f1326 service/nvflinger: Store BufferQueue instances as regular data members
The NVFlinger service is already passed into services that need to
guarantee its lifetime, so the BufferQueue instances will already live
as long as they're needed. Making them std::shared_ptr instances in this
case is unnecessary.
2019-02-21 22:09:46 -05:00
Lioncash
fd15730767 service/vi/vi_layer: Convert Layer struct into a class
Like the previous changes made to the Display struct, this prepares the
Layer struct for changes to its interface. Given Layer will be given
more invariants in the future, we convert it into a class to better
signify that.
2019-02-21 12:13:09 -05:00
Lioncash
fa4dc2cf42 service/nvflinger: Move display specifics over to vi_display
With the display and layer structures relocated to the vi service, we
can begin giving these a proper interface before beginning to properly
support the display types.

This converts the display struct into a class and provides it with the
necessary functions to preserve behavior within the NVFlinger class.
2019-02-21 12:13:04 -05:00
bunnei
ae437320c8
Merge pull request #2130 from lioncash/system_engine
video_core: Remove usages of System::GetInstance() within the engines
2019-02-20 21:24:56 -05:00
Jungy
3273f93cd5 Fixes Unicode Key File Directories (#2120)
* Fixes Unicode Key File Directories

Adds code so that when loading a file it converts to UTF16 first, to
ensure the files can be opened. Code borrowed from FileUtil::Exists.

* Update src/core/crypto/key_manager.cpp

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

* Update src/core/crypto/key_manager.cpp

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

* Using FileUtil instead to be cleaner.

* Update src/core/crypto/key_manager.cpp

Co-Authored-By: Jungorend <Jungorend@users.noreply.github.com>
2019-02-20 21:24:25 -05:00
Lioncash
8d5d369b54 service/nvflinger: Relocate definitions of Layer and Display to the vi service
These are more closely related to the vi service as opposed to the
intermediary nvflinger.

This also places them in their relevant subfolder, as future changes to
these will likely result in subclassing to represent various displays
and services, as they're done within the service itself on hardware.

The reasoning for prefixing the display and layer source files is to
avoid potential clashing if two files with the same name are compiled
(e.g. if 'display.cpp/.h' or 'layer.cpp/.h' is added to another service
at any point), which MSVC will actually warn against. This prevents that
case from occurring.

This also presently coverts the std::array introduced within
f45c25aaba back to a std::vector to allow
the forward declaration of the Display type. Forward declaring a type
within a std::vector is allowed since the introduction of N4510
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510.html) by
Zhihao Yuan.
2019-02-19 18:27:16 -05:00
Fernando Sahmkow
a8d4927e29 Corrections, documenting and fixes. 2019-02-16 16:52:24 -04:00
Lioncash
0113c36300 address_arbiter: Use nested namespaces where applicable
A fairly trivial change. Other sections of the codebase use nested
namespaces instead of separate namespaces here. This one must have just
been overlooked.
2019-02-16 12:41:30 -05:00
Lioncash
a8fa5019b5 video_core: Remove usages of System::GetInstance() within the engines
Avoids the use of the global accessor in favor of explicitly making the
system a dependency within the interface.
2019-02-15 22:06:23 -05:00
Fernando Sahmkow
ecccfe0337 Use u128 on Clock Cycles calculation. 2019-02-15 22:57:16 -04:00
Fernando Sahmkow
5b7ec71fb7 Correct CNTPCT to use Clock Cycles instead of Cpu Cycles. 2019-02-15 22:55:29 -04:00
Lioncash
bd983414f6 core_timing: Convert core timing into a class
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.

Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
2019-02-15 21:50:25 -05:00
bunnei
8490e7746a
Merge pull request #2115 from lioncash/local
core_timing: Make EmptyTimedCallback a local variable
2019-02-13 21:42:04 -05:00
Lioncash
f0bfb24c61 threadsafe_queue: Remove NeedSize template parameter
The necessity of this parameter is dubious at best, and in 2019 probably
offers completely negligible savings as opposed to just leaving this
enabled. This removes it and simplifies the overall interface.
2019-02-12 22:09:51 -05:00
Lioncash
83ba3515ec core_timing: Make EmptyTimedCallback a local variable
Given this is only used in one place, it can be moved closest to its
usage site.
2019-02-12 21:47:18 -05:00
Lioncash
48d9d66dc5 core_timing: Rename CoreTiming namespace to Core::Timing
Places all of the timing-related functionality under the existing Core
namespace to keep things consistent, rather than having the timing
utilities sitting in its own completely separate namespace.
2019-02-12 12:42:17 -05:00
Tobias
259e52ccb2 nvdisp_disp0: change drawing message log level from Warning to Trace
This is a leftover from the early yuzu days.
We shouldn't log every time when we are drawing by default, so let's change the log level to Trace.
2019-02-08 19:26:49 +01:00
bunnei
ca482997fe
Merge pull request #2091 from FearlessTobi/port-4603
Port citra-emu/citra#4603: "gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memory"
2019-02-06 21:51:46 -05:00
ReinUsesLisp
eb73247433 gl_shader_cache: Link loading screen with disk shader cache load 2019-02-06 22:23:40 -03:00
ReinUsesLisp
7fefec585c gl_shader_disk_cache: Pass core system as argument and guard against games without title ids 2019-02-06 22:23:40 -03:00
ReinUsesLisp
e78da8dc1f settings: Hide shader cache behind a setting 2019-02-06 22:20:57 -03:00
ReinUsesLisp
0ed5d728ca rasterizer_interface: Add disk cache entry for the rasterizer 2019-02-06 22:20:57 -03:00
Dimitri ALBORA
8b800369ea gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memory 2019-02-06 19:07:35 +01:00
Weiyi Wang
89abef3518 remove all occurance of specifying endianness inside BitField
This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)

BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
2019-02-06 18:13:45 +01:00
Lioncash
ef073ff117 service/nvflinger,service/vi: Handle failure cases with exposed API
Converts many of the Find* functions to return a std::optional<T> as
opposed to returning the raw return values directly. This allows
removing a few assertions and handles error cases like the service
itself does.
2019-02-05 18:03:28 -05:00
Lioncash
7320c667df service/nvflinger: Mark FindVsyncEvent() as a const member function
This member function doesn't actually modify instance state, so it can
be marked as a const member function.
2019-02-05 15:57:29 -05:00
Lioncash
3c02cdcc57 service/nvflinger: Rename GetVsyncEvent() to FindVsyncEvent()
This was missed within #2075. Renames the member function to make it
consistent with the rest of the Find* functions.
2019-02-05 15:55:18 -05:00
bunnei
4076d8fe3e
Merge pull request #2073 from lioncash/opus
hwopus: Implement DecodeInterleaved (the newest variant)
2019-02-01 13:02:16 -05:00
Lioncash
414cc1eb1f kernel: Remove the Timer class
A holdover from citra, the Horizon kernel on the switch has no
prominent kernel object that functions as a timer. At least not
to the degree of sophistication that this class provided.

As such, this can be removed entirely. This class also wasn't used at
all in any meaningful way within the core, so this was just code sitting
around doing nothing. This also allows removing a few things from the
main KernelCore class that allows it to use slightly less resources
overall (though very minor and not anything really noticeable).
2019-01-31 23:05:15 -05:00
bunnei
b0b027d2d0
Merge pull request #2072 from lioncash/service
service: Update function tables
2019-01-31 15:19:44 -05:00
bunnei
db21ac2627
Merge pull request #2077 from lioncash/virt
kernel/wait_object: Devirtualize functions related to manipulating the thread list directly
2019-01-31 15:19:02 -05:00
Lioncash
a3cdd773c3 kernel/wait_object: Devirtualize functions related to manipulating the thread list directly
No inheritors of the WaitObject class actually make use of their own
implementations of these functions, so they can be made non-virtual.

It's also kind of sketchy to allow overriding how the threads get added
to the list anyways, given the kernel itself on the actual hardware
doesn't seem to customize based off this.
2019-01-30 12:50:37 -05:00
Lioncash
4596ef5274 kernel/timer: Remove unnecessary WakeupAllWaitingThreads() override
This implementation just calls the base class variant of the function,
so this isn't necessary.
2019-01-30 12:45:00 -05:00
Lioncash
1a302d4d47 kernel/readable_event: Remove unnecessary WakeupAllWaitingThreads() override
This just calls the base variant of the function, so it can be removed.
2019-01-30 12:45:00 -05:00
Lioncash
a897feb21e hwopus: Implement DecodeInterleaved
This functions almost identically to DecodeInterleavedWithPerfOld,
however this function also has the ability to reset the decoder context.

This is documented as a potentially desirable thing in the libopus
manual in some circumstances as it says for the OPUS_RESET_STATE ctl:

"This should be called when switching streams in order to prevent the
back to back decoding from giving different result from one at a time
decoding."
2019-01-30 11:35:41 -05:00
Lioncash
ba14fb42e4 service/nvflinger: Make FindBufferQueueId() a const member function
This member function doesn't actually modify instance state, so it can
be const-qualified.
2019-01-30 11:14:08 -05:00
Lioncash
1d11def9c4 service/nvflinger: Rename Get prefix on function to Find
This more accurately describes what the function is actually attempting
to do (it's not a simple trivial getter).
2019-01-30 11:11:32 -05:00
Lioncash
07b86dc28c hwopus: Deduplicate the decoding code within DecodeInterleavedOld and DecodeInterleavedWithPerfOld
Keeps the logic in one spot for use by both functions.
2019-01-29 22:53:35 -05:00
Lioncash
44f39bfb68 hwopus: Replace std::optional<std::reference_wrapper<u64>> with u64*
This doesn't really offer anything over the use of a direct pointer, so
we can just use that instead.
2019-01-29 22:53:35 -05:00
Lioncash
eb1a3c1f4a hwopus: Mark local variables as const where applicable
Makes non-mutable state more explicit.
2019-01-29 22:53:35 -05:00
Lioncash
06887c80a5 hwopus: Fill in the rest of the unknown service function names
Filled in via information provided by SwitchBrew.
2019-01-29 22:53:34 -05:00
Lioncash
5078106068 service/ns: Update function tables
Updates function tables based off information provided by SwitchBrew
2019-01-29 22:50:26 -05:00
Lioncash
1710847d08 service/ncm: Update function tables
Updates function tables based off information provided by SwitchBrew
2019-01-29 22:50:26 -05:00
Lioncash
0db8918947 service/audio: Update function tables
Updates function tables based off information provided by SwitchBrew.
2019-01-29 22:50:26 -05:00
Lioncash
c3affdd162 service/am/applet_ae: Update function tables
Updates function tables based off information provided by SwitchBrew.
2019-01-29 22:50:26 -05:00
Lioncash
09727a6a97 service/fsp-srv: Update function tables
Updates function tables based off information provided by SwitchBrew.
2019-01-29 22:50:26 -05:00
Lioncash
c6c1c1b45f service/btm: Update function tables
Updates function tables based off information provided by SwitchBrew
2019-01-29 22:50:26 -05:00
Lioncash
0c59e6265f service/btdrv: Update function tables
Updates function tables based off information provided by SwitchBrew.
2019-01-29 22:50:18 -05:00
Lioncash
49a3571e76 service/psc: Update function tables
Updates the function tables based off information on SwitchBrew. Gets
rid of a swath of unknown names.
2019-01-29 21:16:24 -05:00
Lioncash
7e92497402 nvflinger: Add the Null display
In addition to the default, external, EDID, and internal displays,
there's also a null display provided as well, which as the name
suggests, does nothing but discard all commands given to it. This is
provided for completeness.
2019-01-29 21:13:33 -05:00
Lioncash
679e63550a nvflinger: Change log message in OpenDisplay to be a debug log instead of a warning
Opening a display isn't really a thing to warn about. It's an expected
thing, so this can be a debug log. This also alters the string to
indicate the display name better.

Opening "Default" display reads a little nicer compared to Opening
display Default.
2019-01-29 21:13:33 -05:00
Lioncash
3d81a8efd5 nvflinger: Remove unnecessary header inclusions 2019-01-29 21:13:33 -05:00