Commit graph

9828 commits

Author SHA1 Message Date
Lioncash
ba4e1adda1 yuzu/main: Use static variant of QFile's exists()
There's no need to construct a QFile instance just to check for its
existence.
2019-04-03 23:53:31 -04:00
Lioncash
0e2f617abc common/lz4_compression: Remove #pragma once directive from the cpp file
Introduced within 798d76f4c7, this only
really has an effect within header files.

Silences a -Wpragma-once-outside-header warning with clang.
2019-04-03 22:07:04 -04:00
bunnei
acde8d3f68
Merge pull request #2328 from lioncash/transfer
service/am: Correct behavior of CreateTransferMemoryStorage()
2019-04-03 21:54:32 -04:00
bunnei
a56c4ac91b
Merge pull request #2095 from FreddyFunk/open-transferable-shader-cache
frontend: Open transferable shader cache for a selected game in the gamelist
2019-04-03 21:51:50 -04:00
bunnei
d6374b2522
Merge pull request #2093 from FreddyFunk/disk-cache-better-compression
Better LZ4 compression utilization for the disk based shader cache and the yuzu build system
2019-04-03 21:50:29 -04:00
bunnei
d7438d067f
Merge pull request #2299 from lioncash/maxwell
gl_shader_manager: Remove reliance on a global accessor within MaxwellUniformData::SetFromRegs()
2019-04-03 21:47:48 -04:00
bunnei
a655b59cef
Merge pull request #2324 from lioncash/enum-unused
kernel/object: Remove unused handle type entry
2019-04-03 21:47:09 -04:00
Lioncash
a973271b8c file_sys/control_metadata: Amend naming of members
Quite a bit of these were out of sync with Switchbrew (and in some cases
entirely wrong). While we're at it, also expand the section of named
members. A segment within the control metadata is used to specify
maximum values for the user, device, and cache storage max sizes and
journal sizes.

These appear to be generally used by the am service (e.g. in
CreateCacheStorage, etc).
2019-04-03 21:18:12 -04:00
Lioncash
c39c8e6982 kernel/svc: Properly sanitize mutex address in WaitProcessWideKeyAtomic
We need to be checking whether or not the given address is within the
kernel address space or if the given address isn't word-aligned and bail
in these scenarios instead of trashing any kernel state.
2019-04-03 20:25:41 -04:00
ReinUsesLisp
78bd66d037 gl_state: Rework to enable individual applies 2019-04-03 20:26:27 -03:00
Lioncash
ea8f633dc0 service/am: Correct behavior of CreateTransferMemoryStorage()
For whatever reason, shared memory was being used here instead of
transfer memory, which (quite clearly) will not work based off the name
of the function.

This corrects this wonky usage of shared memory.
2019-04-03 17:49:21 -04:00
Lioncash
140cd5e209 kernel/transfer_memory: Add accessors to data and sizes
Also amend erroneous use of size_t. We should be using u64 here.
2019-04-03 17:49:16 -04:00
ReinUsesLisp
06c1f75f21 gl_shader_decompiler: Return early when an operation is invalid 2019-04-03 16:02:09 -03:00
bunnei
a6d5ff05dc
Merge pull request #2294 from lioncash/fatal
service/am: Implement EnterFatalSection/LeaveFatalSection
2019-04-03 12:12:07 -04:00
bunnei
908f24eb88
Merge pull request #2323 from lioncash/include
yuzu/debugger/profiler: Remove unnecessary includes
2019-04-03 12:08:16 -04:00
bunnei
7931a68d4e
Merge pull request #2302 from ReinUsesLisp/vk-swapchain
vk_swapchain: Implement a swapchain manager
2019-04-03 11:50:05 -04:00
bunnei
580e3564c9
Merge pull request #2305 from lioncash/shared
kernel/shared_memory: Sanitize supplied size when unmapping
2019-04-03 11:48:11 -04:00
bunnei
74a4a50470
Merge pull request #2314 from lioncash/const
kernel/thread: Minor interface cleanup
2019-04-03 11:46:17 -04:00
Lioncash
65ae1ac4e5 yuzu/applets/software_keyboard: Use QDialogButtonBox standard buttons instead of custom buttons
Like the previous change, this allows Qt to handle proper translations
of the UI buttons, rather than us needing to handle it.
2019-04-03 11:17:10 -04:00
Lioncash
a504bad3fb yuzu/applets/profile_select: Use QDialogButtonBox standard buttons instead of custom buttons
Makes for shorter code, while also not requiring the buttons to be
directly translated, they'll be handled by Qt itself.
2019-04-03 11:15:54 -04:00
Lioncash
a074363a5d kernel/server_session: Provide a GetName() override
Given server sessions can be given a name, we should allow retrieving
it instead of using the default implementation of GetName(), which would
just return "[UNKNOWN KERNEL OBJECT]".
2019-04-03 10:39:06 -04:00
Lioncash
7ccb0b16cd kernel/object: Remove unused handle type entry
The AddressArbiter type isn't actually used, given the arbiter itself
isn't a direct kernel object (or object that implements the wait object
facilities).

Given this, we can remove the enum entry entirely.
2019-04-03 10:24:32 -04:00
Lioncash
6b629f4816 yuzu/debugger/profiler: Remove unnecessary includes
Moves includes into the cpp file where necessary. This way,
microprofile-related stuff isn't dumped into other UI-related code when
the dialog header gets included.
2019-04-03 10:07:12 -04:00
bunnei
e796351a0d
Merge pull request #2270 from lioncash/plist
kernel/svc: Implement svcGetProcessList and svcGetThreadList
2019-04-02 21:40:39 -04:00
bunnei
57279e1981
Merge pull request #2313 from lioncash/reslimit
kernel/resource_limit: Remove the name member from resource limits
2019-04-02 16:03:54 -04:00
Lioncash
28719ee3b4 kernel/svc: Implement svcGetThreadList
Similarly like svcGetProcessList, this retrieves the list of threads
from the current process. In the kernel itself, a process instance
maintains a list of threads, which are used within this function.

Threads are registered to a process' thread list at thread
initialization, and unregistered from the list upon thread destruction
(if said thread has a non-null owning process).

We assert on the debug event case, as we currently don't implement
kernel debug objects.
2019-04-02 00:48:40 -04:00
Lioncash
cb2bce8006 kernel/svc: Implement svcGetProcessList
This service function simply copies out a specified number of kernel
process IDs, while simultaneously reporting the total number of
processes.
2019-04-02 00:47:14 -04:00
ReinUsesLisp
592a24ae53 process: Fix up compilation 2019-04-02 01:44:32 -03:00
bunnei
29df6bbbd3
Merge pull request #2281 from lioncash/memory
kernel/codeset: Make CodeSet's memory data member a regular std::vector
2019-04-01 22:20:05 -04:00
bunnei
4555b63750 gpu_thread: Improve synchronization by using CoreTiming. 2019-04-01 21:32:39 -04:00
Lioncash
4366241739 kernel/thread: Make AllWaitObjectsReady() a const qualified member function
Now that ShouldWait() is a const qualified member function, this one can
be made const qualified as well, since it can handle passing a const
qualified this pointer to ShouldWait().
2019-04-01 18:23:50 -04:00
Lioncash
20cc0b8d3c kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const
Given this is intended as a querying function, it doesn't make sense to
allow the implementer to modify the state of the given thread.
2019-04-01 18:19:45 -04:00
Lioncash
2d70c30fb2 kernel/thread: Avoid sign conversion within GetCommandBufferAddress()
Previously this was performing a u64 + int sign conversion. When dealing
with addresses, we should generally be keeping the arithmetic in the
same signedness type.

This also gets rid of the static lifetime of the constant, as there's no
need to make a trivial type like this potentially live for the entire
duration of the program.
2019-04-01 17:59:45 -04:00
Lioncash
26d0381161 kernel/thread: Make parameter of GetWaitObjectIndex() const qualified
The pointed to member is never actually modified, so it can be made
const.
2019-04-01 17:48:33 -04:00
Lioncash
d09e98f566 kernel/resource_limit: Remove the name member from resource limits
This doesn't really provide any benefit to the resource limit interface.
There's no way for callers to any of the service functions for resource
limits to provide a custom name, so all created instances of resource
limits other than the system resource limit would have a name of
"Unknown".

The system resource limit itself is already trivially identifiable from
its limit values, so there's no real need to take up space in the object to
identify one object meaningfully out of N total objects.
2019-04-01 16:49:28 -04:00
bunnei
62860dc0b0
Merge pull request #2301 from FearlessTobi/remove-amiibo-setting
core/yuzu: Remove enable_nfc setting
2019-04-01 15:02:08 -04:00
Lioncash
781ab8407b general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-01 12:53:47 -04:00
ReinUsesLisp
38658b38b4 gl_shader_decompiler: Hide local definitions inside an anonymous namespace 2019-03-31 00:26:34 -03:00
Mat M
da02946f4f
shader_ir/decode: Silent implicit sign conversion warning
Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
2019-03-31 00:12:54 -03:00
bunnei
d9b7bc4474
Merge pull request #2304 from lioncash/memsize
kernel/process: Report total physical memory used to svcGetInfo slightly better
2019-03-30 20:11:17 -04:00
bunnei
a89266bc5e
Merge pull request #2303 from lioncash/thread
common/thread: Remove unused functions
2019-03-30 20:10:32 -04:00
bunnei
1960164055
Merge pull request #2297 from lioncash/reorder
video_core: Amend constructor initializer list order where applicable
2019-03-30 20:00:26 -04:00
bunnei
e199d1e14f
Merge pull request #2298 from lioncash/variable
video_core/{gl_rasterizer, gpu_thread}: Remove unused class variables where applicable
2019-03-30 19:59:45 -04:00
bunnei
ba3d95e550
Merge pull request #2308 from lioncash/deduction
kernel/scheduler: Minor tidying up
2019-03-30 19:59:10 -04:00
Lioncash
824b8e4086 kernel/scheduler: Remove unused parameter to AddThread()
This was made unused in b404fcdf14, but
the parameter itself wasn't removed.
2019-03-30 05:29:33 -04:00
Lioncash
cb805f45ae kernel/scheduler: Use deduction guides on mutex locks
Since C++17, we no longer need to explicitly specify the type of the
mutex within the lock_guard. The type system can now deduce these with
deduction guides.
2019-03-30 05:28:43 -04:00
Lioncash
4b33a346ed service/fatal: Mark local variables as const where applicable 2019-03-30 03:06:23 -04:00
Lioncash
11505d3d9f service/fatal: Remove unnecessary semicolon
Resolves a -Wextra-semi warning.
2019-03-30 03:04:16 -04:00
Lioncash
cc737e5832 service/fatal: Name FatalInfo structure members
Based off RE, most of these structure members are register values, which
makes, sense given this service is used to convey fatal errors.

One member indicates the program entry point address, one is a set of
bit flags used to determine which registers to print, and one member
indicates the architecture type.

The only member that still isn't determined is the final member within
the data structure.
2019-03-30 03:01:20 -04:00
ReinUsesLisp
e8abe4b77c gl_shader_decompiler: Add AOFFI backing implementation 2019-03-30 02:55:18 -03:00
ReinUsesLisp
cb68ce7c2f shader_ir/decode: Implement AOFFI for TEX and TLD4 2019-03-30 02:53:29 -03:00
ReinUsesLisp
cf4ecc1945 shader_ir: Implement immediate register tracking 2019-03-30 02:53:16 -03:00
Lioncash
108be41316 kernel/shared_memory: Remove unused core/memory.h include
Nothing from this header is used, so we can remove this include, getting
rid of a dependency on it.
2019-03-29 18:16:22 -04:00
Lioncash
c6147a439d kernel/shared_memory: Sanitize supplied size when unmapping
The kernel makes sure that the given size to unmap is always the same
size as the entire region managed by the shared memory instance,
otherwise it returns an error code signifying an invalid size.

This is similarly done for transfer memory (which we already check for).
2019-03-29 18:16:19 -04:00
Lioncash
394095438a common/thread: Remove unused functions
Many of these functions are carried over from Dolphin (where they aren't
used anymore). Given these have no use (and we really shouldn't be
screwing around with OS-specific thread scheduler handling from the
emulator, these can be removed.

The function for setting the thread name is left, however, since it can
have debugging utility usages.
2019-03-29 13:26:21 -04:00
unknown
b4857e326f common/zstd_compression: simplify decompression interface 2019-03-29 18:22:08 +01:00
unknown
aa92da205e gl_shader_disk_cache: Fixup clang format 2019-03-29 18:22:08 +01:00
unknown
35ebbbc167 gl_shader_disk_cache: Use Zstandard for compression 2019-03-29 18:22:08 +01:00
unknown
72477731ed common/zstd_compression: Add Zstandard wrapper 2019-03-29 18:22:08 +01:00
unknown
ca82589350 common: Link libzstd_static 2019-03-29 18:22:07 +01:00
unknown
a05f94dcc8 Addressed feedback 2019-03-29 18:22:07 +01:00
unknown
cec7da37b9 core: Do not link LZ4 to core. Use common/data_compression for nso segment decompression instead. 2019-03-29 18:20:48 +01:00
unknown
4fad477aeb gl_shader_disk_cache: Use LZ4HC with compression level 9 instead of compression level 12 for less compression time 2019-03-29 18:13:00 +01:00
unknown
c791192d64 Addressed feedback 2019-03-29 18:12:42 +01:00
unknown
6a1a2d4aa5 core: Do not link LZ4 to core. Use common/data_compression for nso segment decompression instead. 2019-03-29 16:42:34 +01:00
unknown
74cee1b65d gl_shader_disk_cache: Use better compression for transferable and precompiled shader disk chache files 2019-03-29 16:42:19 +01:00
unknown
798d76f4c7 data_compression: Move LZ4 compression from video_core/gl_shader_disk_cache to common/data_compression 2019-03-29 16:42:19 +01:00
fearlessTobi
ff7e6a42c1 core/yuzu: Remove enable_nfc setting
This was initially added to prevent problems from stubbed/not implemented NFC services, but as we never encountered such and as it's only used in a deprecated function anyway, I guess we can just remove it to prevent more clutter of the settings.
2019-03-29 15:02:28 +01:00
ReinUsesLisp
746dab407e vk_swapchain: Implement a swapchain manager 2019-03-29 00:00:51 -03:00
Lioncash
3a846aa80f kernel/process: Report total physical memory used to svcGetInfo
Reports the (mostly) correct size through svcGetInfo now for queries to
total used physical memory. This still doesn't correctly handle memory
allocated via svcMapPhysicalMemory, however, we don't currently handle
that case anyways.
2019-03-28 22:59:20 -04:00
Lioncash
2289e895aa kernel/process: Store the total size of the code memory loaded
This will be necessary to properly report the used memory size in
svcGetInfo.
2019-03-28 22:51:17 -04:00
bunnei
f770c17d01
Merge pull request #2266 from FernandoS27/arbitration
Kernel: Fixes to Arbitration and SignalProcessWideKey Management
2019-03-28 21:42:24 -04:00
bunnei
b404fcdf14
Merge pull request #2265 from FernandoS27/multilevelqueue
Replace old Thread Queue for a new Multi Level Queue
2019-03-28 21:41:40 -04:00
Lioncash
5d4ab5ec2f kernel/process: Store the main thread stack size to a data member
This will be necessary in order to properly report memory usage within
svcGetInfo.
2019-03-28 18:45:06 -04:00
Lioncash
427f1e3e3d kernel/process: Make Run's stack size parameter a u64
This will make operating with the process-related SVC commands much
nicer in the future (the parameter representing the stack size in
svcStartProcess is a 64-bit value).
2019-03-28 18:26:12 -04:00
Lioncash
2aca7b9e1e kernel/process: Ensure that given stack size is always page-aligned
The kernel always makes sure that the given stack size is aligned to
page boundaries.
2019-03-28 18:25:00 -04:00
bunnei
16dc3a1dd5
Merge pull request #2284 from lioncash/heap-alloc
kernel/vm_manager: Unify heap allocation/freeing functions
2019-03-28 17:56:49 -04:00
bunnei
76f024865d
Merge pull request #2296 from lioncash/override
video_core: Add missing override specifiers
2019-03-28 17:54:51 -04:00
Lioncash
c1ba3e3d4a gl_shader_manager: Remove unnecessary gl_shader_manager inclusion
This isn't used at all in the OpenGL shader cache, so we can remove it's
include here, meaning one less file needs to be recompiled if any
changes ever occur within that header.

core/memory.h is also not used within this file at all, so we can remove
it as well.
2019-03-28 11:16:25 -04:00
Lioncash
1650593927 gl_shader_manager: Move using statement into the cpp file
Avoids introducing Maxwell3D into the namespace for everything that
includes the header.
2019-03-28 11:16:21 -04:00
Lioncash
7d88fc83bf gl_shader_manager: Remove reliance on global accessor within MaxwellUniformData::SetFromRegs()
We can just pass in the Maxwell3D instance instead of going through the
system class to get at it.

This also lets us simplify the interface a little bit. Since we pass in
the Maxwell3D context now, we only really need to pass the shader stage
index value in.
2019-03-28 11:14:24 -04:00
Zach Hilman
552d5071fa patch_manager: Dump NSO name with build ID 2019-03-27 20:09:01 -04:00
Fernando Sahmkow
db42bcb306 Fixes and corrections on formatting. 2019-03-27 14:49:43 -04:00
Fernando Sahmkow
f35e09fe0d Fixes to multilevelqueue's iterator. 2019-03-27 14:34:33 -04:00
Fernando Sahmkow
dde0814837 Use MultiLevelQueue instead of old ThreadQueueList 2019-03-27 14:34:32 -04:00
Fernando Sahmkow
9dbba9240b Add MultiLevelQueue Tests 2019-03-27 14:34:31 -04:00
Fernando Sahmkow
3bc815a5dc Implement intrinsics CountTrailingZeroes and test it. 2019-03-27 14:34:29 -04:00
Fernando Sahmkow
522957f9f3 Implement a MultiLevelQueue 2019-03-27 14:33:44 -04:00
Lioncash
d68716efdc gl_shader_manager: Amend Doxygen string for MaxwellUniformData
Previously only one line of the whole comment was in proper Doxygen
formatting.
2019-03-27 13:10:43 -04:00
Lioncash
947d364dba gpu_thread: Remove unused dma_pusher class member variable from ThreadManager
The pusher instance is only ever used in the constructor of the
ThreadManager for creating the thread that the ThreadManager instance
contains. Aside from that, the member is unused, so it can be removed.
2019-03-27 12:51:21 -04:00
Lioncash
e2131f7310 gl_rasterizer: Remove unused reference member variable from RasterizerOpenGL
This member variable is no longer being used, so it can be removed,
removing a dependency on EmuWindow from the rasterizer's interface"
2019-03-27 12:45:59 -04:00
Lioncash
a5fa4b311e video_core: Amend constructor initializer list order where applicable
Specifies the members in the same order that initialization would take
place in.

This also silences -Wreorder warnings.
2019-03-27 12:37:53 -04:00
Lioncash
bbe700359d video_core: Add missing override specifiers
Ensures that the signatures will always match with the base class.

Also silences a few compilation warnings.
2019-03-27 12:24:52 -04:00
Lioncash
e36f1a5ba9 video_core/gpu: Amend typo in GPU member variable name
smaphore -> semaphore
2019-03-27 12:12:57 -04:00
Zach Hilman
41d2565f29 game_list: Register content with ContentProvider 2019-03-26 22:05:37 -04:00
Zach Hilman
60f39060c6 core: Port current uses of RegisteredCache to ContentProvider 2019-03-26 22:05:37 -04:00
Zach Hilman
45cb41f517 core: Store system-wide ContentProvider for the emulator 2019-03-26 22:05:37 -04:00
Zach Hilman
a6c7ae6fe8 file_sys: Create ContentProvider interface and default implementations 2019-03-26 22:03:26 -04:00
Lioncash
758d84db9a service/am: Implement EnterFatalSection and LeaveFatalSection
These functions act in tandem similar to how a lock or mutex require a
balanced lock()/unlock() sequence.

EnterFatalSection simply increments a counter for how many times it has
been called, while LeaveFatalSection ensures that a previous call to
EnterFatalSection has occured. If a previous call has occurred (the
counter is not zero), then the counter gets decremented as one would
expect. If a previous call has not occurred (the counter is zero), then
an error code is returned.
2019-03-26 17:02:42 -04:00
Lioncash
96d518a59f service/am: Sort ISelfController's member functions according to table order
Makes the declaration order of the handling functions consistent with
the handler table itself.
2019-03-26 17:02:29 -04:00
bunnei
47f2405ab1
Merge pull request #2285 from lioncash/unused-struct
kernel/process: Remove unused AddressMapping struct
2019-03-26 11:17:03 -04:00
bunnei
595511876e
Merge pull request #2287 from lioncash/coretiming-cb
core/core_timing: Make callback parameters consistent
2019-03-25 21:06:33 -04:00
bunnei
8a24a804c5
Merge pull request #2286 from lioncash/fwd
kernel/kernel: Remove unnecessary forward declaration
2019-03-25 21:05:33 -04:00
ReinUsesLisp
9ebc27234d bootmanager: Bypass input focus issues 2019-03-25 17:10:34 -03:00
ReinUsesLisp
bbb396d7f1 bootmanager: Bypass resizing issue 2019-03-25 17:10:34 -03:00
ReinUsesLisp
9ff72ca9f2 bootmanager: Delete container to avoid crash on game restarting
While we are at it, remove nullptr checks for deletion, since the C++
standard defines that delete does it by its own
2019-03-25 17:10:34 -03:00
Lioncash
b26481c94b core/cheat_engine: Make MemoryReadImpl and MemoryWriteImpl internally linked
These don't need to be visible outside of the translation unit, so they
can be enclosed within an anonymous namespace.
2019-03-24 18:34:42 -04:00
Lioncash
c5d41fd812 core/core_timing: Make callback parameters consistent
In some cases, our callbacks were using s64 as a parameter, and in other
cases, they were using an int, which is inconsistent.

To make all callbacks consistent, we can just use an s64 as the type for
late cycles, given it gets rid of the need to cast internally.

While we're at it, also resolve some signed/unsigned conversions that
were occurring related to the callback registration.
2019-03-24 18:12:17 -04:00
Lioncash
bd7ec1a749 kernel/kernel: Remove unnecessary forward declaration
This is no longer necessary, as ResultVal isn't used anywhere in the
header.
2019-03-24 17:48:54 -04:00
Lioncash
7c4bc7b883 kernel/process: Remove unused AddressMapping struct
Another leftover from citra that's now no longer necessary.
2019-03-24 17:40:11 -04:00
Lioncash
1e92ba2785 kernel/vm_manager: Handle shrinking of the heap size within SetHeapSize()
One behavior that we weren't handling properly in our heap allocation
process was the ability for the heap to be shrunk down in size if a
larger size was previously requested.

This adds the basic behavior to do so and also gets rid of HeapFree, as
it's no longer necessary now that we have allocations and deallocations
going through the same API function.

While we're at it, fully document the behavior that this function
performs.
2019-03-24 17:08:30 -04:00
Lioncash
99a163478b kernel/vm_manager: Rename HeapAllocate to SetHeapSize
Makes it more obvious that this function is intending to stand in for
the actual supervisor call itself, and not acting as a general heap
allocation function.

Also the following change will merge the freeing behavior of HeapFree
into this function, so leaving it as HeapAllocate would be misleading.
2019-03-24 17:08:30 -04:00
Lioncash
abdb81ccaf kernel/vm_manager: Handle case of identical calls to HeapAllocate
In cases where HeapAllocate is called with the same size of the current
heap, we can simply do nothing and return successfully.

This avoids doing work where we otherwise don't have to. This is also
what the kernel itself does in this scenario.
2019-03-24 17:08:30 -04:00
Lioncash
9f63acac0f kernel/vm_manager: Remove unused class variables
Over time these have fallen out of use due to refactoring, so these can
be removed.
2019-03-24 17:08:30 -04:00
Lioncash
52980df1aa kernel/vm_manager: Remove unnecessary heap_used data member
This isn't required anymore, as all the kernel ever queries is the size
of the current heap, not the total usage of it.
2019-03-24 17:08:16 -04:00
Lioncash
586cab6172 kernel/vm_manager: Tidy up heap allocation code
Another holdover from citra that can be tossed out is the notion of the
heap needing to be allocated in different addresses. On the switch, the
base address of the heap will always be managed by the memory allocator
in the kernel, so this doesn't need to be specified in the function's
interface itself.

The heap on the switch is always allocated with read/write permissions,
so we don't need to add specifying the memory permissions as part of the
heap allocation itself either.

This also corrects the error code returned from within the function.
If the size of the heap is larger than the entire heap region, then the
kernel will report an out of memory condition.
2019-03-24 16:17:31 -04:00
bunnei
3f74518e19
Merge pull request #2232 from lioncash/transfer-memory
core/hle/kernel: Split transfer memory handling out into its own class
2019-03-24 16:00:23 -04:00
bunnei
1665b70cc6
Merge pull request #2221 from DarkLordZach/firmware-version
set_sys: Implement GetFirmwareVersion(2) for libnx hosversion
2019-03-23 13:48:29 -04:00
bunnei
f08db7295a
Merge pull request #2253 from lioncash/flags
Migrate off directly modifying CMAKE_* compilation-related flags directly
2019-03-23 13:46:53 -04:00
bunnei
6af322a347
Merge pull request #2280 from lioncash/nso
loader/nso: Minor refactoring
2019-03-23 13:46:09 -04:00
Lioncash
c0a01f3adc kernel/codeset: Make CodeSet's memory data member a regular std::vector
The use of a shared_ptr is an implementation detail of the VMManager
itself when mapping memory. Because of that, we shouldn't require all
users of the CodeSet to have to allocate the shared_ptr ahead of time.
It's intended that CodeSet simply pass in the required direct data, and
that the memory manager takes care of it from that point on.

This means we just do the shared pointer allocation in a single place,
when loading modules, as opposed to in each loader.
2019-03-22 18:43:46 -04:00
bunnei
819dd93257
Merge pull request #2279 from lioncash/cheat-global
file_sys/cheat_engine: Remove use of global system accessors
2019-03-22 18:41:44 -04:00
bunnei
e5893db3e6
Merge pull request #2256 from bunnei/gpu-vmm
gpu: Rewrite MemoryManager based on the VMManager implementation.
2019-03-22 18:41:12 -04:00
bunnei
a7157fe27d
Merge pull request #2277 from bunnei/fix-smo-transitions
Revert "Devirtualize Register/Unregister and use a wrapper instead."
2019-03-22 18:40:53 -04:00
Lioncash
f3297d8cd1 loader/nso: Place translation unit specific functions into an anonymous namespace
Makes it impossible to indirectly violate the ODR in some other
translation unit due to these existing.
2019-03-22 15:25:53 -04:00
Lioncash
733cf179b8 file_sys/cheat_engine: Silence truncation and sign-conversion warnings 2019-03-22 14:43:41 -04:00
Lioncash
540235bb05 file_sys/cheat_engine: Remove use of global system accessors
Instead, pass in the core timing instance and make the dependency
explicit in the interface.
2019-03-22 14:43:37 -04:00
Lioncash
611f4666fd loader/nso: Clean up use of magic constants
Now that the NSO header has the proper size, we can just use sizeof on
it instead of having magic constants.
2019-03-22 14:39:17 -04:00
Lioncash
1cf90f4570 file_sys/patch_manager: Deduplicate NSO header
This source file was utilizing its own version of the NSO header.
Instead of keeping this around, we can have the patch manager also use
the version of the header that we have defined in loader/nso.h
2019-03-22 14:39:10 -04:00
Lioncash
90e27ea003 loader/nso: Fix definition of the NSO header struct
The total struct itself is 0x100 (256) bytes in size, so we should be
providing that amount of data.

Without the data, this can result in omitted data from the final loaded
NSO file.
2019-03-22 14:26:58 -04:00
Lioncash
ee49e1fcb6 file_sys/patch_manager: Remove two magic values
These correspond to the NSOBuildHeader.
2019-03-22 14:17:50 -04:00
ReinUsesLisp
d708d03d20 video_core: Implement API agnostic view based texture cache
Implements an API agnostic texture view based texture cache. Classes
defined here are intended to be inherited by the API implementation and
used in API-specific code.

This implementation exposes protected virtual functions to be called
from the implementer.

Before executing any surface copies methods (defined in API-specific code)
it tries to detect if the overlapping surface is a superset and if it
is, it creates a view. Views are references of a subset of a surface, it
can be a superset view (the same as referencing the whole texture).
Current code manages 1D, 1D array, 2D, 2D array, cube maps and cube map
arrays with layer and mipmap level views. Texture 3D slices views are
not implemented.

If the view attempt fails, the fast path is invoked with the overlapping
textures (defined in the implementer). If that one fails (returning
nullptr) it will flush and reload the texture.
2019-03-22 13:34:04 -03:00
bunnei
7b6d516faa
Merge pull request #2234 from lioncash/mutex
core/hle/kernel: Make Mutex a per-process class.
2019-03-21 22:18:36 -04:00
bunnei
b78e7b3454
Merge pull request #2274 from lioncash/include
core/memory: Remove unnecessary includes
2019-03-21 22:14:27 -04:00
bunnei
d0dddb3e9d Revert "Devirtualize Register/Unregister and use a wrapper instead."
- Fixes graphical issues from transitions in Super Mario Odyssey.
2019-03-21 21:56:56 -04:00
bunnei
4d95adcac5
Merge pull request #2275 from lioncash/memflags
kernel/vm_manager: Amend flag value for code data
2019-03-21 21:43:15 -04:00
bunnei
e703772c83
Merge pull request #2276 from lioncash/am
service/am: Add function table for IDebugFunctions
2019-03-21 21:42:17 -04:00
bunnei
639f0c524d
Merge pull request #1933 from DarkLordZach/cheat-engine
file_sys: Implement parser and interpreter for game memory cheats
2019-03-21 21:41:59 -04:00
Lioncash
76f27d1f44 service/am: Add function table for IDebugFunctions
We already have the service related stuff set up for this, however, it's
missing the function table.
2019-03-21 15:58:03 -04:00
Lioncash
18918f5f2f kernel/vm_manager: Rename CodeStatic/CodeMutable to Code and CodeData respectively
Makes it more evident that one is for actual code and one is for actual
data. Mutable and static are less than ideal terms here, because
read-only data is technically not mutable, but we were mapping it with
that label.
2019-03-21 11:43:35 -04:00
Lioncash
56c80a2a21 kernel/vm_manager: Amend flag values for CodeMutable
This should actually be using the data flags, rather than the code
flags.
2019-03-21 11:23:14 -04:00
Lioncash
c221308a66 core/memory: Remove unnecessary includes
In 93da8e0abf, the page table construct
was moved to the common library (which utilized these inclusions). Since
the move, nothing requires these headers to be included within the
memory header.
2019-03-21 09:48:54 -04:00
bunnei
839c0f829b
Merge pull request #2260 from lioncash/sdl
input_common/sdl: Correct return values within GetPollers implementations
2019-03-21 00:20:49 -04:00
Lioncash
109b78a6d6 common/bit_util: Fix bad merge duplicating the copy constructor
Introduced as a result of #2090, we already define the copy constructor
further down below, so this isn't needed.
2019-03-20 23:48:37 -04:00
bunnei
3e930304fe
Merge pull request #2090 from FearlessTobi/port-4599
Port citra-emu/citra#4244 and citra-emu/citra#4599: Changes to BitField
2019-03-20 23:44:20 -04:00
bunnei
52f36ea1c7
Merge pull request #2262 from lioncash/enum
file_sys/content_archive: Amend name of Data_Unknown5 enum entry
2019-03-20 23:13:32 -04:00
bunnei
b72664abfd
Merge pull request #2273 from lioncash/guard
common/uint128: Add missing header guard
2019-03-20 23:13:06 -04:00
bunnei
2117edd0f8 memory_manager: Cleanup FindFreeRegion. 2019-03-20 23:12:28 -04:00
bunnei
5a5fccaa23 memory_manager: Use Common::AlignUp in public interface as needed. 2019-03-20 22:58:49 -04:00
Lioncash
f2c41ba256 common/uint128: Add missing header guard 2019-03-20 22:39:00 -04:00
Lioncash
b0d70096a1 common/uint128: Add missing top-file source text 2019-03-20 22:38:25 -04:00
bunnei
e76f442a0e
Merge pull request #2268 from lioncash/codeset
core/kernel: Migrate CodeSet to its own source files
2019-03-20 22:37:58 -04:00
bunnei
72837e4b3d memory_manager: Bug fixes and further cleanup. 2019-03-20 22:36:03 -04:00
bunnei
3ae0de9b53 memory: Check that core is powered on before attempting to use GPU.
- GPU will be released on shutdown, before pages are unmapped.
- On subsequent runs, current_page_table will be not nullptr, but GPU might not be valid yet.
2019-03-20 22:36:03 -04:00
bunnei
19330f45d3 maxwell_dma: Check for valid source in destination before copy.
- Avoid a crash in Octopath Traveler.
2019-03-20 22:36:03 -04:00
bunnei
197dcf0b5e memory_manager: Add protections for invalid GPU addresses.
- Avoid a crash in Xenoblade Chronicles 2.
2019-03-20 22:36:03 -04:00
bunnei
21eb4cfa7f gl_rasterizer_cache: Check that backing memory is valid before creating a surface.
- Fixes a crash in Puyo Puyo Tetris.
2019-03-20 22:36:02 -04:00
bunnei
22d3dfbcd4 gpu: Rewrite virtual memory manager using PageTable. 2019-03-20 22:36:02 -04:00
bunnei
241563d15c gpu: Move GPUVAddr definition to common_types. 2019-03-20 22:36:02 -04:00
Lioncash
1b6adb5308 common/CMakeLists: Amend boost dependency
When #2247 was created, thread_queue_list.h was the only user of
boost-related code, however #2252 moved the page table struct into
common, which makes use of Boost.ICL, so we need to add the dependency
to the common library's link interface again.
2019-03-20 21:42:13 -04:00
bunnei
872a7bee72
Merge pull request #2267 from FernandoS27/fix-2238
Fix crash caused by #2238.
2019-03-20 21:36:55 -04:00
bunnei
e8ff8a66b0
Merge pull request #2247 from lioncash/include
common/thread_queue_list: Remove unnecessary dependency on boost
2019-03-20 21:34:12 -04:00
bunnei
723ad4512f
Merge pull request #2224 from lioncash/opus
hwopus: Leverage multistream API for decoding regular Opus packets
2019-03-20 21:33:37 -04:00
bunnei
c1409602da
Merge pull request #2239 from FearlessTobi/port-4684
Port citra-emu/citra#4684: "frontend: qt: fix a freeze where if you click on entry in the game list too fast, citra will hang"
2019-03-20 21:33:05 -04:00
Lioncash
8f454a5c68 kernel/process: Make MapSegment lambda reference parameter const
The segment itself isn't actually modified.
2019-03-20 13:07:09 -04:00
Lioncash
1b6bd9d6df kernel: Move CodeSet structure to its own source files
Given this is utilized by the loaders, this allows avoiding inclusion of
the kernel process definitions where avoidable.

This also keeps the loading format for all executable data separate from
the kernel objects.
2019-03-20 13:07:04 -04:00
bunnei
9d11303a36
Merge pull request #2264 from lioncash/linker
core/loader: Remove vestigial Linker class
2019-03-20 12:31:00 -04:00
Fernando Sahmkow
8a320a6ee2 Fix crash caused by 2238. 2019-03-19 22:45:34 -04:00
Fernando Sahmkow
9c7319a4d4 Fix small bug that kept a thread as a condvar thread after being signalled. 2019-03-19 22:43:13 -04:00
Lioncash
1342c53e27 loader: Remove Linker class
Given the class is now currently unused, it can be removed.
2019-03-19 21:32:02 -04:00
Lioncash
ab00552118 loader: Remove Linker inheritance from NRO and NSO loaders
Neither the NRO or NSO loaders actually make use of the functions or
members provided by the Linker interface, so we can just remove the
inheritance altogether.
2019-03-19 21:31:59 -04:00
Fernando Sahmkow
acbdfdae64 Add CondVar Thread State. 2019-03-19 20:32:47 -04:00
Fernando Sahmkow
774f139e65 Small fixes to address_arbiter to better match the IDB. 2019-03-19 20:32:46 -04:00
xperia64
ec74a4fd4a Fix getopt on systems where char is unsigned by default 2019-03-19 23:53:40 +01:00
Lioncash
b8c7072206 file_sys/content_archive: Amend name of Data_Unknown5 enum entry
While we're at it, give each entry some documentation.
2019-03-19 15:58:38 -04:00
bunnei
746167f11a
Merge pull request #2258 from lioncash/am
service/am: Supply remaining missing IAudioController functions
2019-03-18 22:20:36 -04:00
Lioncash
eb335f51ca input_common/sdl: Correct return values within implementations of GetPollers()
In both cases, we weren't actually returning anything, which is
undefined behavior.
2019-03-18 11:40:38 -04:00
Lioncash
874826b6dd input_common/sdl: Use a type alias to shorten declaration of GetPollers
Just makes the definitions a little bit more tidy.
2019-03-18 11:40:35 -04:00
bunnei
8dc2f01eae
Merge pull request #2259 from lioncash/fsp
fsp_srv: Unstub SetCurrentProcess
2019-03-18 11:13:52 -04:00
bunnei
e05136f70b
Merge pull request #2254 from lioncash/redundant
input_common/sdl_impl: Minor cleanup in SDLState constructor
2019-03-18 11:13:20 -04:00
Lioncash
9f092554c2 fsp_srv: Unstub SetCurrentProcess
This just acts as a basic setter for a given PID value and performs no
further checking, so we can just store the passed in value.
2019-03-18 10:38:01 -04:00
Lioncash
26b809549b service/am: Add basic implementation of ChangeMainAppletMasterVolume
All this does is supply a new volume level and a fade time in
nanoseconds for the volume transition to occur within.
2019-03-18 09:18:34 -04:00
Lioncash
c07ebeac19 service/am: Unstub SetTransparentVolumeRate()
Like the other volume setter, this mainly just sets a data member within
the service, nothing too special.
2019-03-18 09:18:34 -04:00
Lioncash
ecd3afdc8e service/am: Unstub SetExpectedMasterVolume()
This function passes in the desired main applet and library applet
volume levels. We can then just pass those values back within the
relevant volume getter functions, allowing us to unstub those as well.

The initial values for the library and main applet volumes differ. The
main applet volume is 0.25 by default, while the library applet volume
is initialized to 1.0 by default in the services themselves.
2019-03-18 09:18:34 -04:00
bunnei
30f228a8c9
Merge pull request #2238 from lioncash/thread
kernel/thread: Amend conditional test and assignment within UpdatePriority()
2019-03-17 22:27:33 -04:00
bunnei
57ca1e3e69
Merge pull request #2252 from bunnei/move-page-table
core: Move PageTable struct into Common.
2019-03-17 14:42:57 -04:00
Lioncash
e6612d6d8d CMakeLists: Move off of modifying CMAKE_*-related flags
Modifying CMAKE_* related flags directly applies those changes to every
single CMake target. This includes even the targets we have in the
externals directory.

So, if we ever increased our warning levels, or enabled particular ones,
or enabled any other compilation setting, then this would apply to
externals as well, which is often not desirable.

This makes our compilation flag setup less error prone by only applying
our settings to our targets and leaving the externals alone entirely.

This also means we don't end up clobbering any provided flags on the
command line either, allowing users to specifically use the flags they
want.
2019-03-17 06:55:24 -04:00
Lioncash
114060fd87 input_common/sdl_impl: Make lambda capture more specific in SDLState constructor
We don't need to universally capture by reference. We specifically just
need to capture the this pointer.
2019-03-17 04:02:52 -04:00
Lioncash
d74aa13bd3 input_common/sdl_impl: Remove unnecessary std::chrono::duration construction
Specifying the time unit itself is sufficient here.
2019-03-17 04:02:52 -04:00
Lioncash
834d3fe336 input_common/sdl_impl: Remove unused variable in SDLState constructor 2019-03-17 04:02:48 -04:00
Lioncash
13bc74e957 CMakeLists: Move compilation flags into the src directory
We generally shouldn't be hijacking CMAKE_CXX_FLAGS, etc as a means to
append flags to the targets, since this adds the compilation flags to
everything, including our externals, which can result in weird issues
and makes the build hierarchy fragile.

Instead, we want to just apply these compilation flags to our targets,
and let those managing external libraries to properly specify their
compilation flags.

This also results in us not getting as many warnings, as we don't raise
the warning level on every external target.
2019-03-17 01:49:09 -04:00
bunnei
41566c615b
Merge pull request #2251 from bunnei/skip-zero-flush
gl_rasterizer: Skip zero addr/sized regions on flush/invalidate.
2019-03-17 01:40:32 -04:00
bunnei
9ad3b01d30
Merge pull request #2249 from lioncash/ipc
ipc_helpers: Allow pushing and popping floating-point values
2019-03-16 22:22:03 -04:00
bunnei
ed7a1e1443
Merge pull request #2245 from lioncash/unused-def
kernel/thread: Actually remove the definition of ExitCurrentThread()
2019-03-16 22:12:40 -04:00
bunnei
93da8e0abf core: Move PageTable struct into Common. 2019-03-16 22:05:40 -04:00
bunnei
032e4c4ca3 gl_rasterizer: Skip zero addr/sized regions on flush/invalidate. 2019-03-16 22:03:19 -04:00
bunnei
2392e146b0
Merge pull request #2244 from bunnei/gpu-mem-refactor
video_core: Refactor to use MemoryManager interface for all memory access.
2019-03-16 21:59:45 -04:00
bunnei
bf41132aa9
Merge pull request #2243 from bunnei/mem-simplify-cache
memory: Simplify rasterizer cache operations.
2019-03-16 21:59:30 -04:00
bunnei
059465d496
Merge pull request #2129 from FernandoS27/cntpct
Correct CNTPCT from using CPU Cycles to using Clock Cycles
2019-03-16 21:58:59 -04:00
Lioncash
64444ff481 ipc_helpers: Allow pushing and popping floating-point values
Certain values that are passed through the IPC buffer are actually
floating point values, not solely integral values.
2019-03-16 14:05:03 -04:00