Commit graph

7807 commits

Author SHA1 Message Date
bunnei 78f2a6a9e1
Merge pull request #1443 from DarkLordZach/lower-loader-logs-1
content_archive/patch_manager: Lower log levels to eliminate some unnecessary logs
2018-10-16 11:26:54 -04:00
David 92d8ad3770 Implement VI ConvertScalingMode (#1475)
* Implement VI ConvertScalingMode

* Fixed push enum

* Scale mode now uses Nintendo scale mode as an enum as well
2018-10-16 11:25:42 -04:00
bunnei 88b8383da2
Merge pull request #1502 from lioncash/unique
core: Convert shared_ptr instances into unique_ptr instances where applicable for System and Cpu
2018-10-16 11:21:42 -04:00
Zach Hilman 9d4e6176eb savedata_factory: Add TemporaryStorage SaveDataSpaceId
Required for TemporaryStorage saves (in addition to SaveDataType)
2018-10-16 10:20:04 -04:00
Zach Hilman 74890cf2da savedata_factory: Add support for DeviceSaveData
Uses the same path as SaveData except with UID 0. Adds a warning if UID is not 0.
2018-10-16 10:19:21 -04:00
Lioncash 39ae73b356 file_sys/registered_cache: Use unique_ptr and regular pointers instead of shared_ptrs where applicable
The data retrieved in these cases are ultimately chiefly owned by either
the RegisteredCache instance itself, or the filesystem factories. Both
these should live throughout the use of their contained data. If they
don't, it should be considered an interface/design issue, and using
shared_ptr instances here would mask that, as the data would always be
prolonged after the main owner's lifetime ended.

This makes the lifetime of the data explicit and makes it harder to
accidentally create cyclic references. It also makes the interface
slightly more flexible than the previous API, as a shared_ptr can be
created from a unique_ptr, but not the other way around, so this allows
for that use-case if it ever becomes necessary in some form.
2018-10-16 09:38:52 -04:00
bunnei 548958bcaf
Merge pull request #1473 from lioncash/cmake
web_service: Make linkage of web_service-related externals and the library private
2018-10-15 21:33:32 -04:00
bunnei 870c18b078
Merge pull request #1487 from lioncash/maybe-unused
yuzu/main: Apply the [[maybe_unused]] attribute to the parameter of SetDiscordEnabled
2018-10-15 21:33:14 -04:00
Lioncash 76fc8b59b2 file_sys/control_metadata: Get rid of magic constants
These are just the size of the data being passed in, so we can specify
that via the size() member function.
2018-10-15 20:11:44 -04:00
bunnei 9b21fbd1eb
Merge pull request #1494 from DarkLordZach/aoc-signature-fixes
aoc: Fix various bugs in current AOC implementation
2018-10-15 18:34:02 -04:00
bunnei 50e6205c21
Merge pull request #1499 from lioncash/nro
nro/nso: Minor error handling changes
2018-10-15 17:48:36 -04:00
bunnei 7665411317
Merge pull request #1500 from DarkLordZach/key-derivation-6.0.0
crypto: Various crypto fixes for quickstart guide
2018-10-15 17:48:13 -04:00
Lioncash bed872ed38 nso: Return an optional address from LoadModule
If a malformed NSO is attempted to be loaded, we shouldn't continue
onwards. We should be reporting an error and bailing out.
2018-10-15 17:02:11 -04:00
ReinUsesLisp 936c36a514 shader_bytecode: Add Control Code enum 0xf
Control Code 0xf means to unconditionally execute the instruction. This
value is passed to most BRA, EXIT and SYNC instructions (among others)
but this may not always be the case.
2018-10-15 15:36:47 -03:00
ReinUsesLisp b461342a84 gl_shader_decompiler: Fixup style inconsistencies 2018-10-15 15:35:26 -03:00
ReinUsesLisp 27916764b1 gl_rasterizer: Silence implicit cast warning in glBindBufferRange 2018-10-15 15:26:50 -03:00
Lioncash 5484742fda core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrs 2018-10-15 14:15:56 -04:00
Lioncash 59f872a8e0 core: Make the live Cpu instances unique_ptrs instead of shared_ptrs
There's no need for shared ownership here, as the only owning class
instance of those Cpu instances is the System class itself. We can also
make the thread_to_cpu map use regular pointers instead of shared_ptrs,
given that the Cpu instances will always outlive the cases where they're
used with that map.
2018-10-15 14:15:56 -04:00
Lioncash aeadbfa790 core: Make the exclusive monitor a unique_ptr instead of a shared_ptr
Like the barrier, this is owned entirely by the System and will always
outlive the encompassing state, so shared ownership semantics aren't
necessary here.
2018-10-15 14:15:50 -04:00
Lioncash c34efbbd60 core: Make CPUBarrier a unique_ptr instead of a shared_ptr
This will always outlive the Cpu instances, since it's destroyed after
we destroy the Cpu instances on shutdown, so there's no need for shared
ownership semantics here.
2018-10-15 09:11:47 -04:00
Zach Hilman 720d36ca71 crypto: Various crypto fixes for quickstart guide 2018-10-14 21:57:52 -04:00
Lioncash bb9cf8a127 nso: Make LoadModule take a VfsFile by const reference 2018-10-14 20:38:19 -04:00
Lioncash 0732786ddc nro: Make LoadNro take a VfsFile by const reference
This function doesn't need to care about ownership semantics, so we can
just pass it a reference to the file itself, rather than a
std::shared_ptr alias.
2018-10-14 20:24:18 -04:00
Lioncash 90f8474fc1 svc: Clarify enum values for AddressSpaceBaseAddr and AddressSpaceSize in svcGetInfo()
So, one thing that's puzzled me is why the kernel seemed to *not* use
the direct code address ranges in some cases for some service functions.
For example, in svcMapMemory, the full address space width is compared
against for validity, but for svcMapSharedMemory, it compares against
0xFFE00000, 0xFF8000000, and 0x7FF8000000 as upper bounds, and uses
either 0x200000 or 0x8000000 as the lower-bounds as the beginning of the
compared range. Coincidentally, these exact same values are also used in
svcGetInfo, and also when initializing the user address space, so this
is actually retrieving the ASLR extents, not the extents of the address
space in general.
2018-10-14 20:11:16 -04:00
Zach Hilman 5737441374 aoc: Read DLC base title ID from RegisteredCache
Falls back to title ID + 0x1000, which is what HOS does.
2018-10-14 18:58:14 -04:00
bunnei b3cca34f50
Merge pull request #1486 from lioncash/file
key_manager/partition_data_manager: Minor changes
2018-10-14 14:46:47 -04:00
bunnei 3203193a67
Merge pull request #1490 from lioncash/boot
yuzu/main: Simplify OnMenuLoadFile()
2018-10-14 14:44:49 -04:00
bunnei 14286f70f0
Merge pull request #1488 from Hexagon12/astc-types
video_core: Added ASTC 5x4; 8x5 types
2018-10-14 14:44:24 -04:00
bunnei 0d2ba0a320
Merge pull request #1491 from lioncash/reference
filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem by reference
2018-10-14 14:42:57 -04:00
bunnei b82bbfba77
Merge pull request #1480 from FernandoS27/neue-swizzle
Introduce 3D Swizzle seamlessly
2018-10-14 14:42:38 -04:00
bunnei 2f8ca32020
Merge pull request #1492 from lioncash/proc
svc: Implement svcGetProcessInfo
2018-10-14 14:37:58 -04:00
FernandoS27 1d6559fbd3 Implement Arrays on Tex Instruction 2018-10-14 13:31:02 -04:00
David Marcec 92fae7e1ab Stop all threads on svcBreak
This should help diagnose crashes easier and prevent many users thinking that a game is still running when in fact it's just an audio thread still running(this is typically not killed when svcBreak is hit since the game expects us to do this)
2018-10-14 18:14:51 +11:00
Zach Hilman 7e2096db8a aoc: Return size in ListAddOnContent 2018-10-13 22:52:54 -04:00
FernandoS27 d880b77698 Fix TLDS 2018-10-13 22:14:25 -04:00
FernandoS27 331ce2942c Shorten the implementation of 3D swizzle to only 3 functions 2018-10-13 20:58:00 -04:00
Lioncash 1c7a7ed79b svc: Implement svcGetProcessInfo
A fairly basic service function, which only appears to currently support
retrieving the process state. This also alters the ProcessStatus enum to
contain all of the values that a kernel process seems to be able of
reporting with regards to state.
2018-10-13 17:00:43 -04:00
FernandoS27 1ff20d8538 Fix a Crash on Zelda BotW and Splatoon 2, and simplified LoadGLBuffer 2018-10-13 16:11:11 -04:00
FernandoS27 e0ca938b22 Propagate depth and depth_block on modules using decoders 2018-10-13 15:25:18 -04:00
FernandoS27 d4ae43f9c1 Remove old Swizzle algorithms and use 3d Swizzle 2018-10-13 15:25:17 -04:00
FernandoS27 4d959c6bdc Implement Precise 3D Swizzle 2018-10-13 15:25:16 -04:00
FernandoS27 736db284d2 Implement Fast 3D Swizzle 2018-10-13 15:25:15 -04:00
Lioncash 0149162dba filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem instance by reference
Neither of these functions alter the ownership of the provided pointer,
so we can simply make the parameters a reference rather than a direct
shared pointer alias. This way we also disallow passing incorrect memory values like
nullptr.
2018-10-13 11:36:35 -04:00
Lioncash a4c57436fc yuzu/main: Simplify OnMenuLoadFile()
We can utilize QStringList's join() function to perform all of the
appending in a single function call.

While we're at it, make the extension list a single translatable string
and add a disambiguation comment to explain to translators what %1
actually is.
2018-10-13 10:35:18 -04:00
Lioncash 53a0221484 yuzu/main: Apply the [[maybe_unused]] attribute to the parameter of SetDiscordEnabled()
Depending on whether or not USE_DISCORD_PRESENCE is defined, the "state"
parameter can be used or unused. If USE_DISCORD_PRESENCE is not defined,
the parameter will be considered unused, which can lead to compiler
warnings. So, we can explicitly mark it with [[maybe_unused]] to inform
the compiler that this is intentional.
2018-10-13 10:10:29 -04:00
Hexagon12 cbf723896f Added ASTC 5x4; 8x5 2018-10-13 17:10:26 +03:00
Lioncash 6467b01de2 partition_data_manager: Reserve and insert data within output vector in DecryptPackage2()
We can just reserve the memory then perform successive insertions
instead of needing to use memcpy. This also avoids the need to zero out
the output vector's memory before performing the insertions.

We can also std::move the output std::vector into the destination so
that we don't need to make a completely new copy of the vector, getting
rid of an unnecessary allocation.

Additionally, we can use iterators to determine the beginning and end
ranges of the std::vector instances that comprise the output vector, as
the end of one range just becomes the beginning for the next successive
range, and since std::vector's iterator constructor copies data within
the range [begin, end), this is more straightforward and gets rid of the
need to have an offset variable that keeps getting incremented to
determine where to do the next std::memcpy.
2018-10-13 09:50:08 -04:00
Lioncash 781fd7983c partition_data_manager: Remove unused std::map instance within DecryptPackage2()
Aside from emplacing elements into the map, the map itself is never
actually queried for contained data.
2018-10-13 09:27:12 -04:00
Lioncash e0c76226ad partition_data_manager: Take package2_keys by const reference
These are only ever read from, so we don't need to make a copy of all
the keys here.
2018-10-13 09:24:41 -04:00
Lioncash 3d9df49619 partition_data_manager: Move IV data to where it's needed in DecryptPackage2()
Given it's only used in one spot and has a fairly generic name, we can
just specify it directly in the function call. This also the benefit of
automatically moving it.
2018-10-13 09:20:21 -04:00
Lioncash bc2196bb09 partition_data_manager: Remove commented out code
Commented out code shouldn't be left in without a reason indicating why
in a comment.
2018-10-13 09:17:02 -04:00
Lioncash 6da2ed4232 key_manager/partition_data_manager: Silence truncation compiler warnings 2018-10-13 09:13:19 -04:00
Lioncash f56a8da46a partition_data_manager: Dehardcode array bounds
Instead, we can make it part of the type and make named variables for
them, so they only require one definition (and if they ever change for
whatever reason, they only need to be changed in one spot).
2018-10-13 08:52:37 -04:00
Lioncash d257a3b56c partition_data_manager: Take VirtualFile by const reference in constructor
Given the VirtualFile instance isn't stored into the class as a data
member, or written to, this can just be turned into a const reference,
as the constructor doesn't need to make a copy of it.
2018-10-13 08:39:05 -04:00
Lioncash e96d69c328 partition_data_manager: Amend constructor initializer list order
Orders the members in the exact order they would be initialized. This
also prevents compiler warnings about this sort of thing.
2018-10-13 08:36:26 -04:00
Lioncash aaca7543f0 partition_data_manager: Remove unused includes
Gets unused includes out of the headers and moves them into the cpp file
if they're used there instead.
2018-10-13 08:33:49 -04:00
Lioncash 06898263f6 key_manager: Use std::vector's insert() instead of std::copy with a back_inserter
If the data is unconditionally being appended to the back of a
std::vector, we can just directly insert it there without the need to
insert all of the elements one-by-one with a std::back_inserter.
2018-10-13 08:29:35 -04:00
Lioncash e70c08b543 key_manager: Brace long conditional body
If a conditional (or it's body) travels more than one line, it should be
braced.
2018-10-13 08:24:21 -04:00
Lioncash ef5639bfbb key_manager: Don't assume file seeks and reads will always succeed
Given the filesystem should always be assumed to be volatile, we should
check and bail out if a seek operation isn't successful. This'll prevent
potentially writing/returning garbage data from the function in rare
cases.

This also allows removing a check to see if an offset is within the
bounds of a file before perfoming a seek operation. If a seek is
attempted beyond the end of a file, it will fail, so this essentially
combines two checks into one in one place.
2018-10-13 08:24:18 -04:00
Lioncash 82ea1cf35a key_manager: Remove unnecessary seek in DeriveSDSeed()
Given the file is opened a few lines above and no operations are done,
other than check if the file is in a valid state, the read/write pointer
will always be at the beginning of the file.
2018-10-13 08:08:44 -04:00
Zach Hilman f61379f8d2 patch_manager: Move non-Program RomFS patch log to Debug
Normal Program-type patches will still be logged to aid in debugging, but for others (mainly Control), it was moved to Debug.
2018-10-12 23:27:19 -04:00
Zach Hilman 90c07e0d33 content_archive: Move get key log to Trace level
Avoids printing live keys in the general log.
2018-10-12 23:25:59 -04:00
bunnei 1584fb6b38
Merge pull request #1409 from DarkLordZach/key-derivation
crypto: Add support for full key derivation
2018-10-12 22:55:49 -04:00
bunnei c2aa4293ec
Merge pull request #1483 from lioncash/codeset
kernel/process: Make CodeSet a regular non-inherited object
2018-10-12 22:52:12 -04:00
bunnei 38b027aa81
Merge pull request #1484 from FernandoS27/calculate-size
Implemented helper function to correctly calculate a texture's size
2018-10-12 21:12:53 -04:00
bunnei ffcda6c08e
Merge pull request #1481 from lioncash/typo
svc: Fix typos in sanitizing checks for MapMemory/UnmapMemory
2018-10-12 20:46:55 -04:00
FernandoS27 97b6405a17 Implemented helper function to correctly calculate a texture's size 2018-10-12 14:21:53 -04:00
bunnei 2946d4bdbe
Merge pull request #1467 from ogniK5377/svcbreak-type-fix
Fixed incorrect types for svcBreak
2018-10-12 12:08:08 -04:00
Lioncash 1abed2f4c4 kernel/process: Make CodeSet a regular non-inherited object
These only exist to ferry data into a Process instance and end up going
out of scope quite early. Because of this, we can just make it a plain
struct for holding things and just std::move it into the relevant
function. There's no need to make this inherit from the kernel's Object
type.
2018-10-12 12:07:32 -04:00
bunnei 0f7ab3e21a
Merge pull request #1478 from ogniK5377/remap-invalidhandle-remap
Passing an invalid nmap handle to Remap should throw an error
2018-10-12 12:07:14 -04:00
bunnei f9d03b1d41
Merge pull request #1482 from lioncash/init
thread: Remove unnecessary memset from ResetThreadContext()
2018-10-12 12:06:51 -04:00
bunnei dc328440c8
Merge pull request #1479 from ogniK5377/nmap-revamped
Added error codes for nvmap
2018-10-12 12:06:22 -04:00
Lioncash b492d43e63 thread: Remove unnecessary memset from ResetThreadContext()
Regular value initialization is adequate here for zeroing out data. It
also has the benefit of not invoking undefined behavior if a non-trivial
type is ever added to the struct for whatever reason.
2018-10-12 10:57:31 -04:00
David Marcec 4d2de6564f Returned an error before processing other remaps 2018-10-12 17:10:41 +11:00
David Marcec c55b5de0fb Made the minimum alignment more clear 2018-10-12 17:06:46 +11:00
Lioncash 4ccf30dfaa svc: Fix typos in sanitizing checks for MapMemory/UnmapMemory 2018-10-12 01:48:26 -04:00
David Marcec 98b760c645 Wip 2018-10-12 16:28:00 +11:00
bunnei 9bf409f275
Merge pull request #1474 from ogniK5377/hwopus-decodeinterleavedwithperformance
HwOpus, Implemented DecodeInterleavedWithPerformance
2018-10-11 16:52:13 -04:00
bunnei 3fd26b7147
Merge pull request #1472 from lioncash/san
svc: Add missing address range sanitizing checks to MapMemory/UnmapMemory
2018-10-11 16:51:41 -04:00
bunnei bc293e1751
Merge pull request #1476 from bunnei/fix-unmap-flush
nvhost_as_gpu: Flush/invalidate CPU VAddr on UnmapBuffer.
2018-10-11 16:51:28 -04:00
David Marcec 85b0d9a7be Dynamically decide handheld variant based on supported npad id priority
Kirby input still doesn't work, should fix a lot of other games
2018-10-12 02:56:49 +11:00
David Marcec c7763603ef Added error codes for nvmap 2018-10-11 23:06:34 +11:00
David Marcec 5dd538cace Passing an invalid nmap handle to Remap should throw an error
Added error for invalid nmap handles
2018-10-11 20:32:21 +11:00
ReinUsesLisp 17290a4416 gl_shader_decompiler: Implement VMAD 2018-10-11 04:15:10 -03:00
bunnei bf795edac4 nvhost_as_gpu: Flush CPU VAddr on UnmapBuffer. 2018-10-11 00:19:36 -04:00
Lioncash 28ec921d0d core/CMakeLists: Make all web_service-related libraries private
Now that all external dependencies are hidden, we can remove
json-headers from the publically linked libraries, as the use of this
library is now completely hidden from external users of the web_service
library. We can also make the web_services library private as well,
considering it's not a requirement. If a library needs to link in
web_service, it should be done explicitly -- not via indirect linking.
2018-10-10 22:29:39 -04:00
Lioncash 183a664405 web_backend: Make Client use the PImpl idiom
Like with TelemetryJson, we can make the implementation details private
and avoid the need to expose httplib to external libraries that need to
use the Client class.
2018-10-10 22:29:35 -04:00
David Marcec fa10905e1e HwOpus, Implemented DecodeInterleavedWithPerformance
Used by sonic ages
2018-10-11 13:06:56 +11:00
bunnei 6d82c4adf9
Merge pull request #1458 from FernandoS27/fix-render-target-block-settings
Fixed block height settings for RenderTargets and Depth Buffers
2018-10-10 21:24:07 -04:00
Lioncash a7725d354c telemetry_json: Use the PImpl idiom to avoid unnecessary dependency exposure
Users of the web_service library shouldn't need to care about an
external library like json.h. However, given it's exposed in our
interface, this requires that other libraries publicly link in the JSON
library. We can do better.

By using the PImpl idiom, we can hide this dependency in the cpp file
and remove the need to link that library in altogether.
2018-10-10 21:10:36 -04:00
Lioncash c422f146ee telemetry_json: Add missing override specifier to the destructor of TelemetryJson 2018-10-10 21:00:39 -04:00
Lioncash 881bb2295d telemetry_json: Take std::string parameters by value
Taking them by const reference isn't advisable here, because it means
the std::move calls were doing nothing and we were always copying the
std::string instances.
2018-10-10 20:59:28 -04:00
Lioncash a34e5e51d8 telemetry_json: Remove unnecessary includes
Removes unused includes. Also rectifies a missing <chrono> include.
2018-10-10 20:57:31 -04:00
Lioncash 6e6ce2ce39 core/CMakeLists: Use target_compile_definitions instead of add_definitions for specifying ENABLE_WEB_SERVICE
Avoids introducing the definition to the whole directory space and
localizes it to being added to the library that needs it.
2018-10-10 20:54:02 -04:00
Lioncash 72e9cb523e svc: Add missing address range sanitizing checks to MapMemory/UnmapMemory
This adds the missing address range checking that the service functions
do before attempting to map or unmap memory. Given that both service
functions perform the same set of checks in the same order, we can wrap
these into a function and just call it from both functions, which
deduplicates a little bit of code.
2018-10-10 20:30:49 -04:00
bunnei 03ec936ca0
Merge pull request #1460 from FernandoS27/scissor_test
Implemented Scissor Testing
2018-10-10 12:04:10 -04:00
bunnei ee1b204749
Merge pull request #1425 from ReinUsesLisp/geometry-shaders
gl_shader_decompiler: Implement geometry shaders
2018-10-10 11:51:29 -04:00
David Marcec 9e924f2ef2 Added BeginPermitVibrationSession and EndPermitVibrationSession
Used by Mario Party
2018-10-11 00:58:47 +11:00
David Marcec 3d75c9cd7a Added GetLedPattern and HandheldVariant
HandheldVariant is for specific games which expect handheld controllers to be at position 8(kirby), however this doesn't fix all games as some games require handhelds to be at position 0(snipperclips)
2018-10-10 21:38:43 +11:00
Lioncash 5c0408596f kernel/thread: Use a regular pointer for the owner/current process
There's no real need to use a shared pointer in these cases, and only
makes object management more fragile in terms of how easy it would be to
introduce cycles. Instead, just do the simple thing of using a regular
pointer. Much of this is just a hold-over from citra anyways.

It also doesn't make sense from a behavioral point of view for a
process' thread to prolong the lifetime of the process itself (the
process is supposed to own the thread, not the other way around).
2018-10-10 02:04:55 -04:00