Commit Graph

4372 Commits

Author SHA1 Message Date
Lioncash
a58eefa7e4 kernel/scheduler: Take ARM_Interface instance by reference in the constructor
It doesn't make sense to allow a scheduler to be constructed around a
null pointer.
2018-09-25 16:00:17 -04:00
bunnei
b67c1fdf38
Merge pull request #1393 from tech4me/svc
svc: Updated svc names
2018-09-25 10:47:12 -04:00
Lioncash
83377113bf memory: Dehardcode the use of fixed memory range constants
The locations of these can actually vary depending on the address space
layout, so we shouldn't be using these when determining where to map
memory or be using them as offsets for calculations. This keeps all the
memory ranges flexible and malleable based off of the virtual memory
manager instance state.
2018-09-24 22:16:03 -04:00
Lioncash
6c6f95d071 svc: Report correct memory-related values within some of the cases in svcGetInfo()
Previously, these were reporting hardcoded values, but given the regions
can change depending on the requested address spaces, these need to
report the values that the memory manager contains.
2018-09-24 22:16:03 -04:00
Lioncash
7fd598636e memory: Dehardcode the use of a 36-bit address space
Given games can also request a 32-bit or 39-bit address space, we
shouldn't be hardcoding the address space range as 36-bit.
2018-09-24 22:15:53 -04:00
Lioncash
75603b005b process/vm_manager: Amend API to allow reading parameters from NPDM metadata
Rather than hard-code the address range to be 36-bit, we can derive the
parameters from supplied NPDM metadata if the supplied exectuable
supports it. This is the bare minimum necessary for this to be possible.

The following commits will rework the memory code further to adjust to
this.
2018-09-24 17:24:50 -04:00
David
367c52ff0d Implemented fatal:u properly (#1347)
* Implemented fatal:u properly

fatal:u now is properly implemented with all the ipc cmds. Error reports/Crash reports are also now implemented for fatal:u. Crash reports save to yuzu/logs/crash_reports/
The register dump is currently known as sysmodules send all zeros. If there are any non zero values for the "registers" or the unknown values, let me know!

* Fatal:U fixups

* Made fatal:u execution break more clear

* Fatal fixups
2018-09-23 22:34:11 -04:00
David
2513e086ab Stubbed IRS (#1349)
* Stubbed IRS

Currently we have no ideal way of implementing IRS. For the time being we should have the functions stubbed until we come up with a way to emulate IRS properly.

* Added IRS to logging backend

* Forward declared shared memory for irs
2018-09-23 22:33:29 -04:00
bunnei
f2c1fd08f9
Merge pull request #1354 from ogniK5377/ssl-version
Corrected SSL::SetInterfaceVersion
2018-09-23 22:32:14 -04:00
Zach Hilman
b3c2ec362b fsmitm: Cleanup and modernize fsmitm port 2018-09-23 21:50:20 -04:00
Lioncash
2f6a611311 stream: Preserve enum class type in GetState()
Preserves the meaning/type-safetiness of the stream state instead of
making it an opaque u32. This makes it usable for other things outside
of the service HLE context.
2018-09-23 20:03:38 -04:00
tech4me
d42424ace0 svc: Updated svc names 2018-09-23 17:03:38 -07:00
David Marcec
c461188f51 Added audren:u#GetAudioRendererState 2018-09-23 22:32:01 +10:00
Philippe Babin
fb6bc2c495 FPCR register was uninitialized at start up 2018-09-22 21:17:43 -04:00
Zach Hilman
ba0873d33c qt: Add UI elements for LayeredFS and related tools 2018-09-21 19:53:33 -04:00
Zach Hilman
050547b801 romfs: Implement CreateRomFS 2018-09-21 19:53:33 -04:00
Zach Hilman
6eada3c57d file_sys: Port Atmosphere-NX fs_mitm implementation 2018-09-21 19:53:33 -04:00
Zach Hilman
940a711caf filesystem: Add LayeredFS VFS directory getter 2018-09-21 19:53:33 -04:00
Zach Hilman
50a470eab8 bis_factory: Add mod directory VFS getter 2018-09-21 19:53:33 -04:00
Zach Hilman
16188acb50 patch_manager: Add LayeredFS mods support 2018-09-21 19:53:33 -04:00
Zach Hilman
44fdac334c vfs_concat: Rewrite and fix ConcatenatedVfsFile 2018-09-21 19:53:33 -04:00
Zach Hilman
3e5c3d0f16 vfs_layered: Add LayeredVfsDirectory
Reads multiple dirs through as if a waterfall.
2018-09-21 19:53:05 -04:00
Zach Hilman
b52343a428 vfs_vector: Add VectorVfsFile
Maps a vector into the VFS interface.
2018-09-21 19:53:05 -04:00
Zach Hilman
c65d4d119f vfs_static: Add StaticVfsFile
Always returns the template argument byte for all reads. Doesn't support writes.
2018-09-21 19:53:05 -04:00
Zach Hilman
f68e324672 vfs: Add and rewite VfsRawCopy functions 2018-09-21 19:53:05 -04:00
Zach Hilman
d6cbb3a3e0 vfs: Add GetEntries method
Maps name string to directory or file.
2018-09-21 19:53:05 -04:00
Lioncash
48b2eda492 svc: Move most process termination code to its own function within Process
Reduces the use of Process class members externally and keeps most code
related to tearing down a process with the rest of the process code.
2018-09-21 06:07:41 -04:00
Lioncash
acfc801d14 thread/process: Move TLS slot marking/freeing to the process class
Allows making several members of the process class private, it also
avoids going through Core::CurrentProcess() just to retrieve the owning
process.
2018-09-21 03:50:12 -04:00
David
1db1e013e0 Added support for uncompressed NSOs (#1374)
* Added support for uncompressed NSOs

* Moved compressed section check to NsoHeader
2018-09-21 00:39:30 -04:00
bunnei
0285ddfbd4
Merge pull request #1372 from lioncash/thread
kernel/thread: Use owner_process when setting the page table in SetupMainThread()
2018-09-20 23:35:29 -04:00
bunnei
072053ab95
Merge pull request #1371 from lioncash/fwd-arm
arm_interface: Replace kernel vm_manager include with a forward declaration
2018-09-20 23:35:06 -04:00
bunnei
c1c59617ad
Merge pull request #1364 from lioncash/content
file-sys: Default heavy-weight class destructors in the cpp file
2018-09-20 23:31:31 -04:00
bunnei
b0b57c21e6
Merge pull request #1368 from ogniK5377/nifm-fix
Added IRequest::Submit
2018-09-20 23:30:11 -04:00
David Marcec
b918925bd5 Revert GetRequestState
Even though setting this value to 3 is more correct. We break more games than we fix due to missing implementations. We should keep this as 0 for the time being
2018-09-21 12:15:49 +10:00
Lioncash
05aa4aa01a kernel/thread: Use owner_process when setting the page table in SetupMainThread()
The owning process of a thread is required to exist before the thread,
so we can enforce this API-wise by using a reference. We can also avoid
the reliance on the system instance by using that parameter to access
the page table that needs to be set.
2018-09-20 21:10:00 -04:00
Lioncash
9b8fc2b689 arm_interface: Replace kernel vm_manager include with a forward declaration
Avoids an unnecessary inclusion and also uncovers three places where
indirect inclusions were relied upon, which allows us to also resolve
those.
2018-09-20 19:35:36 -04:00
Mat M
f237265187
Merge pull request #1370 from Hedges/GDBClean
Correct endianness of BRK
2018-09-20 17:25:56 -04:00
Mat M
1e35d8fa8f
Merge pull request #1362 from MerryMage/dynarmic
externals: Update dynarmic to 171d116
2018-09-20 17:22:42 -04:00
Jarek Syrylak
74f966404d Correct endianness of BKPT 2018-09-20 22:03:57 +01:00
MerryMage
ef31487624 arm_dynarmic: Halt when BRK encountered 2018-09-20 19:12:42 +01:00
David Marcec
3f49725a51 Fixed submit 2018-09-21 00:51:13 +10:00
David Marcec
cfc9fe4460 Added IRequest::Submit
This fixes updated versions of SMO. Currently unable to test as I don't have an updated version
2018-09-21 00:47:30 +10:00
bunnei
8fe9572271
Merge pull request #1358 from DarkLordZach/temp-storage
savedata_factory: Add TemporaryStorage SaveDataType
2018-09-20 10:13:38 -04:00
bunnei
0931a711de
Merge pull request #1363 from lioncash/control
control_metadata: Move language name array definition to the cpp file
2018-09-20 10:13:23 -04:00
bunnei
b02a1e38fa
Merge pull request #1361 from lioncash/nax
xts_archive/nax: Minor interface changes
2018-09-20 10:13:10 -04:00
David Marcec
583137709f Removed unneeded event clear 2018-09-20 15:16:08 +10:00
David Marcec
335e9d18ae Implemented NTC & IEnsureNetworkClockAvailabilityService
Needed because of the recent nim fixes
2018-09-20 15:14:07 +10:00
Lioncash
05ef9dfc10 file-sys: Default heavy-weight class destructors in the cpp file
Several classes have a lot of non-trivial members within them, or don't
but likely should have the destructor defaulted in the cpp file for
future-proofing/being more friendly to forward declarations.

Leaving the destructor unspecified allows the compiler to inline the
destruction code all over the place, which is generally undesirable from
a code bloat perspective.
2018-09-19 19:34:08 -04:00
Lioncash
3146502a12 control_metadata: Remove unnecessary else within GetLanguageEntry()
There's no need to indent the code here, given the if case contains a
return statement at the end of it.
2018-09-19 19:02:06 -04:00
Lioncash
05d49962b6 control_metadata: Move language name array definition to the cpp file
This was used in two different translation units
(deconstructed_rom_directory and patch_manager). This means we'd be
pointlessly duplicating the whole array twice due to it being defined
within the header.
2018-09-19 18:57:26 -04:00
MerryMage
3b4a158230 arm_dynarmic: Support BKPT instruction 2018-09-19 21:00:38 +01:00
Lioncash
2e5f0e5024 xts_archive: Remove unused variables from CalculateHMAC256()
These variables aren't used, which still has an impact, as std::vector
cannot be optimized away by the compiler (it's constructor and
destructor are both non-trivial), so this was just wasting memory.
2018-09-19 14:23:13 -04:00
Lioncash
2752183883 xts_archive: Make AsNCA() return a std::unique_ptr instead of a std::shared_ptr
std::shared_ptr isn't strictly necessary here and is only ever used in
contexts where the object doesn't depend on being shared. This also
makes the interface more flexible, as it's possible to create a
std::shared_ptr from a std::unique_ptr (std::shared_ptr has a
constructor that accepts a std::unique_ptr), but not the other way
around.
2018-09-19 14:22:37 -04:00
Lioncash
45195a51a7 nax: Avoid re-parsing NAX data with GetFileType()
An instance of the NAX apploader already has an existing NAX instance in
memory. Calling directly into IdentifyType() directly would re-parse the
whole file again into yet another NAX instance, only to toss it away
again.

This gets rid of unnecessary/redundant file parsing and allocations.
2018-09-19 14:22:37 -04:00
Lioncash
c8c4105659 nax: Avoid unnecessary calls to AsNCA() in IdentifyType()
AsNCA() allocates an NCA instance every time it's called. In the current
manner it's used, it's quite inefficient as it's making a redundant
allocation.

We can just amend the order of the conditionals to make it easier to
just call it once.
2018-09-19 14:22:37 -04:00
Lioncash
f272261c21 xts_archive: Ensure NAX's type member is always initialized
Ensures that the member always has a deterministic value.
2018-09-19 14:22:37 -04:00
Lioncash
92a98a8b19 xts_archive: Amend initializer order of NAX's constructor
Orders the initializer list in the same order the members would be
initialized. Avoids compiler warnings.
2018-09-19 14:22:30 -04:00
David
0432af5ad1 Reworked incorrect nifm stubs (#1355)
* Reworked incorrect nifm stubs

Need confirmation on `CreateTemporaryNetworkProfile`, unsure which game uses it but according to reversing. It should return a uuid which we currently don't do.

Any 0 client id is considered an invalid client id.

GetRequestState 0 is considered invalid.

* Fixups for nifm
2018-09-19 11:59:01 -04:00
bunnei
8dff92c5f6
Merge pull request #1359 from ogniK5377/nes
Fixed GetAccountId stub, Added error code for OpenDirectory and added ActivateNpadWithRevision
2018-09-19 10:01:36 -04:00
David Marcec
cbc7ad8f6d Fixed GetAccountId stub, Added error code for OpenDirectory and added ActivateNpadWithRevision
With these, `Nintendo Entertainment System - Nintendo Switch Online` loads
2018-09-19 23:25:00 +10:00
Zach Hilman
dfaea55be5 savedata_factory: Add TemporaryStorage SaveDataType
Seems to be used by NSO NES Emulator
2018-09-19 09:06:22 -04:00
David Marcec
d06f4cfc63 Corrected SSL::SetInterfaceVersion
Should be a single u32
2018-09-19 16:46:11 +10:00
David Marcec
08819ec70a Removed MakeBuilder as it's not needed anymore 2018-09-19 15:13:56 +10:00
David Marcec
6a0612f2bf Removed the use of rp.MakeBuilder
Due to keeping the code style consistent in the yuzu codebase. `rb = rp.MakeBuilder(...)` was replaced with `rb{ctx, ...}`
2018-09-19 15:09:59 +10:00
bunnei
b33ce787b7
Merge pull request #1348 from ogniK5377/GetImageSize
Implemented IProfile::GetImageSize
2018-09-18 22:15:18 -04:00
bunnei
c9942fe46e
Merge pull request #1351 from ogniK5377/GetDefaultDisplayResolution
Implemented GetDefaultDisplayResolution
2018-09-18 22:13:28 -04:00
bunnei
bf957d5345
Merge pull request #1341 from lioncash/dependency
core/core_cpu: Replace exclusive monitor include with forward declaration
2018-09-18 22:13:05 -04:00
bunnei
c768535463
Merge pull request #1346 from lioncash/svc
svc_wrap: Convert the PARAM macro into a function
2018-09-18 22:12:47 -04:00
bunnei
e9abbcae85
Merge pull request #1350 from ogniK5377/Six-Axis-Stub
Stubbed ActivateConsoleSixAxisSensor & StartConsoleSixAxisSensor
2018-09-18 22:12:12 -04:00
Philippe Babin
9155c8daeb Invalid default value of username in yuzu_cmd (#1334)
* Fix bug where default username value for yuzu_cmd create an userprofile with uninitialize data as username

* Fix format

* Apply code review changes

* Remove nullptr check
2018-09-18 19:58:28 -04:00
bunnei
733c47623b
Merge pull request #1343 from lioncash/mutex
kernel/svc: Handle invalid address cases within svcArbitrateLock() and svcArbitrateUnlock()
2018-09-18 14:25:00 -04:00
bunnei
c2cf784376
Merge pull request #1344 from lioncash/arm
arm_interface: Remove ARM11-isms from the CPU interface
2018-09-18 14:24:20 -04:00
David Marcec
de9604d63e Added ActivateGesture 2018-09-19 01:13:58 +10:00
David Marcec
1a2d33eeb4 Implemented GetDefaultDisplayResolution 2018-09-19 01:10:16 +10:00
David Marcec
a8b1c7763b Added StopSixAxisSensor 2018-09-19 00:56:02 +10:00
David Marcec
717889e93c Stubbed ActivateConsoleSixAxisSensor & StartConsoleSixAxisSensor 2018-09-19 00:52:20 +10:00
David Marcec
528e5cee67 Implemented GetImageSize 2018-09-19 00:16:52 +10:00
Lioncash
f85ab0a123 svc_wrap: Convert the PARAM macro into a function
This can just be a regular function, getting rid of the need to also
explicitly undef the define at the end of the file. Given FuncReturn()
was already converted into a function, it's #undef can also be removed.
2018-09-18 04:27:38 -04:00
Lioncash
ead2a4eeb4 arm_dynarmic: Correct ExclusiveWrite128()'s operation
Previously the second half of the value being written would overwrite
the first half. Thankfully this wasn't a bug that was being encountered,
as the function is currently unused.
2018-09-18 03:56:32 -04:00
Lioncash
b51e7e0288 arm_interface: Remove ARM11-isms from the CPU interface
This modifies the CPU interface to more accurately match an
AArch64-supporting CPU as opposed to an ARM11 one. Two of the methods
don't even make sense to keep around for this interface, as Adv Simd is
used, rather than the VFP in the primary execution state. This is
essentially a modernization change that should have occurred from the
get-go.
2018-09-18 03:20:04 -04:00
Lioncash
71b48cb00f kernel/mutex: Replace ResultCode construction for invalid addresses with the named variant
We already have a ResultCode constant for the case of an invalid
address, so we can just use it instead of re-rolling that ResultCode
type.
2018-09-17 23:27:53 -04:00
Lioncash
b6867602ca kernel/svc: Handle error cases for svcArbitrateLock() and svcArbitrateUnlock()
The kernel does the equivalent of the following check before proceeding:

if (address + 0x8000000000 < 0x7FFFE00000) {
    return ERR_INVALID_MEMORY_STATE;
}

which is essentially what our IsKernelVirtualAddress() function does. So
we should also be checking for this.

The kernel also checks if the given input addresses are 4-byte aligned,
however our Mutex::TryAcquire() and Mutex::Release() functions already
handle this, so we don't need to add code for this case.
2018-09-17 23:27:53 -04:00
Lioncash
4a84986bc3 core/core_cpu: Replace exclusive monitor include with forward declaration
We don't need to include this as a dependency within the header. A
regular forward declaration will suffice here.
2018-09-17 18:16:55 -04:00
bunnei
2c9c0d70a3
Merge pull request #1312 from lioncash/fwd
service/vi: Replace includes with forward declarations where applicable
2018-09-17 12:32:28 -04:00
bunnei
2bfb9fd0e6
Merge pull request #1313 from lioncash/error
kernel/errors: Amend error code for ERR_NOT_FOUND
2018-09-17 12:28:40 -04:00
bunnei
fc46183e03
Merge pull request #1318 from lioncash/errors-sm
services/sm: Amend error code constants
2018-09-17 12:27:01 -04:00
bunnei
e6367ab955
Merge pull request #1315 from lioncash/size
kernel/svc: Handle a few error cases within memory-related functions
2018-09-17 10:11:26 -04:00
bunnei
e561afdcd5
Merge pull request #1328 from FearlessTobi/port-4192
Port #4192 from Citra: "svc: change unknown to thread in CreateThread"
2018-09-17 09:56:48 -04:00
Valentin Vanelslande
54ddb37b3c Port # #4192 from Citra: "svc: change unknown to thread in CreateThread" 2018-09-15 15:28:35 +02:00
fearlessTobi
63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash
da64da367b services/sm: Amend error code constants
Courtesy of @ogniK5377.

This also moves them into the cpp file and limits the visibility to
where they're directly used. It also gets rid of unused or duplicate
error codes.
2018-09-14 01:44:02 -04:00
Lioncash
4f8756edd0 kernel/svc: Sanitize creation of shared memory via svcCreateSharedMemory()
The kernel caps the size limit of shared memory to 8589930496 bytes (or
(1GB - 512 bytes) * 8), so approximately 8GB, where every GB has a 512
byte sector taken off of it.

It also ensures the shared memory is created with either read or
read/write permissions for both permission types passed in, allowing the
remote permissions to also be set as "don't care".
2018-09-13 23:07:27 -04:00
Lioncash
accd1f17e4 kernel/svc: Sanitize addresses, permissions, and sizes within svcMapSharedMemory() and svcUnmapSharedMemory()
Part of the checking done by the kernel is to check if the given
address and size are 4KB aligned, as well as checking if the size isn't
zero. It also only allows mapping shared memory as readable or
read/write, but nothing else, and so we shouldn't allow mapping as
anything else either.
2018-09-13 23:07:23 -04:00
Lioncash
496c67fd73 kernel/svc: Sanitize addresses and sizes within svcMapMemory() and svcUnmapMemory()
The kernel checks if the addresses and given size is 4KB aligned before
continuing onwards to map the memory.
2018-09-13 21:34:54 -04:00
Lioncash
7bd2faad9a kernel/svc: Sanitize heap sizes within svcSetHeapSize()
The kernel checks if the given size is a multiple of 2MB and <= to 4GB
before going ahead and attempting to allocate that much memory.
2018-09-13 21:34:48 -04:00
bunnei
df5a44a40b
Merge pull request #1310 from lioncash/kernel-ns
kernel/thread: Include thread-related enums within the kernel namespace
2018-09-13 19:50:47 -04:00
bunnei
fb65076b0f
Merge pull request #1309 from lioncash/nested
service: Use nested namespace specifiers where applicable
2018-09-13 19:50:11 -04:00
bunnei
3ef134a092
Merge pull request #1307 from lioncash/pl
services/pl_u: Add missing Korean font to the fallback case for shared fonts
2018-09-13 19:49:39 -04:00
Lioncash
50a5d09d32 kernel/errors: Amend error code for ERR_NOT_FOUND
This is the value returned by the kernel for svcConnectToNamedPort() if
the named port cannot be found.
2018-09-13 17:12:01 -04:00
Lioncash
0258b444ef service/vi: Replace includes with forward declarations where applicable 2018-09-13 16:55:47 -04:00
Lioncash
2ea45fe75b kernel/thread: Include thread-related enums within the kernel namespace
Previously, these were sitting outside of the Kernel namespace, which
doesn't really make sense, given they're related to the Thread class
which is within the Kernel namespace.
2018-09-13 16:05:57 -04:00
Lioncash
a0e51d8b98 service: Use nested namespace specifiers where applicable
There were a few places where nested namespace specifiers weren't being
used where they could be within the service code. This amends that to
make the namespacing a tiny bit more compact.
2018-09-13 15:52:55 -04:00
Valentin Vanelslande
2ec9fbc2d4
ipc: minor fix 2018-09-13 11:59:23 -05:00
Lioncash
ce97d8ef6c services/pl_u: Add missing Korean font to the fallback case for shared fonts
Previously this wasn't using the Korean font at all.
2018-09-12 19:23:51 -04:00
bunnei
926dd41587
Merge pull request #1163 from FearlessTobi/add-audio-stretching
audio_core: Add audio stretching support
2018-09-12 18:23:54 -04:00
bunnei
d9e21eebe8
Merge pull request #1297 from lioncash/pl
pl_u: Eliminate mutable file-scope state
2018-09-12 16:03:53 -04:00
bunnei
79217f9870
Merge pull request #1303 from lioncash/error
kernel/errors: Amend invalid thread priority and invalid processor ID error codes
2018-09-12 12:14:51 -04:00
Lioncash
fbe462099b svc: Return ERR_INVALID_PROCESSOR_ID in CreateThread() if an invalid processor ID is given
This is what the kernel does for an out-of-range processor ID.
2018-09-12 05:20:02 -04:00
Lioncash
3c5c292592 kernel/errors: Correct error codes for invalid thread priority and invalid processor ID 2018-09-12 05:19:57 -04:00
Lioncash
9b3bc0b282 svc: Do nothing if svcOutputDebugString() is given a length of zero
While unlikely, it does avoid constructing a std::string and
unnecessarily calling into the memory code if a game or executable
decides to be really silly about their logging.
2018-09-12 04:51:44 -04:00
Lioncash
04d723baf9 svc: Correct parameter type for OutputDebugString()
This should be a u64 to represent size.
2018-09-12 04:49:11 -04:00
bunnei
475222a496
Merge pull request #1296 from lioncash/prepo
service/prepo: Move class into the cpp file
2018-09-11 23:15:07 -04:00
Lioncash
c243bc09d4 service/audio: Replace includes with forward declarations where applicable
A few headers were including other headers when a forward declaration
can be used instead, allowing the include to be moved to the cpp file.
2018-09-11 21:54:33 -04:00
Lioncash
c061e27155 pl_u: Eliminate mutable file-scope state
Converts the PL_U internals to use the PImpl idiom and makes the state
part of the Impl struct, eliminating mutable global/file state.
2018-09-11 21:24:19 -04:00
Lioncash
325c259fc5 service/prepo: Move class into the cpp file
This doesn't need to be exposed within the header and be kept in the
translation unit, eliminating the need to include anything within the
header.
2018-09-11 20:49:01 -04:00
bunnei
1470b85af9
Merge pull request #1291 from lioncash/default
hle/service: Default constructors and destructors in the cpp file where applicable
2018-09-11 11:42:05 -04:00
Lioncash
46ba1bc40f externals: Place font data within cpp files
This places the font data within cpp files, which mitigates the
possibility of the font data being duplicated within the binary if it's
referred to in more than one translation unit in the future. It also
stores the data within a std::array, which is more flexible when it
comes to operating with the standard library.

Furthermore, it makes the data arrays const. This is what we want, as it
allows the compiler to store the data within the read-only segment. As
it is, having several large sections of mutable data like this just
leaves spots in memory that we can accidentally write to (via accidental
overruns, what have you) and actually have it work. This ensures the
font data remains the same no matter what.
2018-09-11 04:25:33 -04:00
Lioncash
6ac955a0b4 hle/service: Default constructors and destructors in the cpp file where applicable
When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.

The cause of the above mentioned non-obvious errors can be demonstrated
as follows:

------- Demonstrative example, if you know how the described error happens, skip forwards -------

Assume we have the following in the header, which we'll call "thing.h":

\#include <memory>

// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;

class Thing {
public:
    // assume no constructors or destructors are specified here,
    // or the constructors/destructors are defined as:
    //
    // Thing() = default;
    // ~Thing() = default;
    //

    // ... Some interface member functions would be defined here

private:
    std::shared_ptr<Object> obj;
};

If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:

1. Decrement the shared reference count of the object being pointed to,
   and if the reference count decrements to zero,

2. Free the Object instance's memory (aka deallocate the memory it's
   pointing to).

And so the compiler generates the code for the destructor doing this inside main.cpp.

Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.

Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.

---------------------- End example ----------------------------

Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
2018-09-10 23:55:31 -04:00
Tobias
3bac3051fc Use open-source shared fonts if no dumped file is available (#1269)
* Add open-source shared fonts

* Address review comments
2018-09-10 21:31:01 -04:00
Markus Wick
0cfb0bacb2 video_core: Move command buffer loop.
This moves the hot loop into video_core. This refactoring shall reduce the CPU overhead of calling ProcessCommandList.
2018-09-10 22:06:13 +02:00
bunnei
50c191439d
Merge pull request #1276 from FearlessTobi/fix-stupid-stub
hid: Implement ReloadInputDevices
2018-09-09 22:31:04 -04:00
Lioncash
136040ee15 service: Remove unused g_kernel_named_ports variable
With the named port functionality all migrated over to the kernel,
there's no need to keep this around anymore.
2018-09-09 22:10:54 -04:00
fearlessTobi
500e81429a hid: Implement ReloadInputDevices 2018-09-09 00:57:41 +02:00
fearlessTobi
a6efff8b02 Add audio stretching support 2018-09-08 18:26:23 +01:00
Lioncash
3f17fe7133 core: Migrate current_process pointer to the kernel
Given we now have the kernel as a class, it doesn't make sense to keep
the current process pointer within the System class, as processes are
related to the kernel.

This also gets rid of a subtle case where memory wouldn't be freed on
core shutdown, as the current_process pointer would never be reset,
causing the pointed to contents to continue to live.
2018-09-06 20:52:58 -04:00
bunnei
a164b413fa
Merge pull request #1250 from lioncash/file-sys
file_sys/{nca_patch, patch_manager}: Amend unnecessary/missing includes.
2018-09-06 19:20:09 -04:00
Lioncash
56ab608044 core/core: Remove unnecessary sm/controller include
The only reason this include was necessary, was because the constructor
wasn't defaulted in the cpp file and the compiler would inline it
wherever it was used. However, given Controller is forward declared, all
those inlined constructors would see an incomplete type, causing a
compilation failure. So, we just place the constructor in the cpp file,
where it can see the complete type definition, allowing us to remove
this include.
2018-09-06 14:38:39 -04:00
Lioncash
54724fe918 file_sys/nca_patch: Amend constructor initializer list order
Orders the elements in the initializer list in the order they're
specified in the class. This prevents compiler warnings about
initialization order.
2018-09-06 14:00:11 -04:00
Lioncash
b155b3ef81 file_sys/nca_patch: Remove unnecessary includes
romfs.h doesn't need to be included in the header, the only real
dependency here is common's swap.h that needs to be included.
2018-09-06 13:58:53 -04:00
Lioncash
a859a35ec8 file_sys/patch_manager: Add missing includes
These includes were previously being satisfied indirectly.
2018-09-06 13:53:23 -04:00
bunnei
94f193af65
Merge pull request #1242 from lioncash/file-sys
file_sys/submission_package: Replace includes with forward declarations where applicable
2018-09-05 18:53:32 -04:00
Lioncash
6bd6beee20 file_sys/submission_package: Correct constructor initialization list order
Orders the elements in the sequence to match the order in which they'll
actually be initialized in.
2018-09-05 13:44:42 -04:00
Lioncash
c0b7ed8b58 file_sys/submission_package: Replace includes with forward declarations where applicable 2018-09-05 12:08:04 -04:00
Zach Hilman
c913136eb2 bktr: Fix bucket overlap error 2018-09-04 17:01:54 -04:00
Zach Hilman
7d5d781b20 drd: Parse title ID from program metadata 2018-09-04 16:25:30 -04:00
Zach Hilman
23a16c1720 patch_manager: Centralize Control-type NCA parsing 2018-09-04 16:25:10 -04:00
Zach Hilman
92e26df00f nsp: Fix error masking issue with XCI files
Now display correct error instead of catch-all MissingProgramNCA
2018-09-04 16:24:24 -04:00
Zach Hilman
c91b60a421 game_list: Fix version display on non-NAND titles 2018-09-04 16:24:02 -04:00
Zach Hilman
cbd517d8cc bktr: Add logging on successful patch 2018-09-04 16:24:02 -04:00
Zach Hilman
a6e75cd45b bktr: Implement IVFC offset shifting
Fixes base game read errors
2018-09-04 16:24:02 -04:00
Zach Hilman
9664ce255d bktr: Fix missing includes and optimize style 2018-09-04 16:24:02 -04:00
Zach Hilman
f5e03b9173 loader: Add BKTR-specific error messages and codes 2018-09-04 16:23:44 -04:00
Zach Hilman
08fcb4694f loader: Ignore patches on NRO and DRD 2018-09-04 16:23:15 -04:00
Zach Hilman
97bf83bc56 patch_manager: Add usages of patches to ExeFS 2018-09-04 16:23:15 -04:00
Zach Hilman
8e900a301a file_sys: Add class to manage game patches
Right now only includes Updates, but should eventually contain all of the other patches we need.
2018-09-04 16:22:25 -04:00
Zach Hilman
54e7ddb93a file_sys: Add BKTR patching mechanism 2018-09-04 16:22:25 -04:00
Zach Hilman
1efe5a76b1 content_archive: Add BKTR header parsing to NCA 2018-09-04 16:22:25 -04:00
Zach Hilman
9951f6d054 registration: Add RegisteredCacheUnion
Aggregates multiple caches into one interface
2018-09-04 16:21:40 -04:00
Zach Hilman
d2caf4af7d game_list: Use RegisteredCacheUnion for installed
Reduces code
2018-09-04 16:21:40 -04:00
Zach Hilman
99fbcb3bf2 aes_util: Fix error involving reads of less than 0x10
Issues with block size are fixed by making all reads minimum length of 0x10
2018-09-04 16:21:40 -04:00
Zach Hilman
87be4bc283 main: Only show DRD deprecation warning once 2018-09-04 14:44:48 -04:00
Zach Hilman
e973cceadd control_metadata: Use alternate language names if AmericanEnglish isn't available 2018-09-04 14:30:03 -04:00
Zach Hilman
23d2c50479 card_image: Add program title ID getter 2018-09-04 14:29:19 -04:00
Zach Hilman
e4e55d064e nsp: Comply with style and performance guidelines 2018-09-04 14:29:19 -04:00
Zach Hilman
58473309a0 qt: Add UI support for NSP files 2018-09-04 14:28:41 -04:00
Zach Hilman
f7eaea424d registration: Add support for installing NSP files 2018-09-04 14:28:41 -04:00
Zach Hilman
d7518cf6e0 loader: Add AppLoader for NSP files 2018-09-04 14:27:33 -04:00
Zach Hilman
5c8aff984e card_image: Parse XCI secure partition with NSP
Eliminated duplicate code and adds support for Rev1+ carts
2018-09-04 14:27:33 -04:00
Zach Hilman
93703431e2 file_sys: Add Nintendo Submission Package (NSP) 2018-09-04 14:25:54 -04:00
Zach Hilman
a040929c90 drd: Load title ID from program metadata
Previously only loaded from control metadata
2018-09-04 14:25:54 -04:00
Zach Hilman
b555311438 loader: Add NSP file type and NSP-specific errors 2018-09-04 14:25:54 -04:00
Zach Hilman
d770c60205 key_manager: Avoid autogeneration if key exists 2018-09-04 14:25:54 -04:00
bunnei
9a07e9f805
Merge pull request #1237 from degasus/optimizations
Optimizations
2018-09-04 12:16:06 -04:00
bunnei
ed37b68fb5
Merge pull request #1223 from DarkLordZach/custom-nand-sd-dirs
file_sys: Allow for custom NAND/SD directories
2018-09-04 11:54:22 -04:00
bunnei
8ec1e16867
Merge pull request #1235 from lioncash/forward-decl
file_sys: Replace includes with forward declarations where applicable
2018-09-04 11:51:54 -04:00
bunnei
5a29b358aa
Merge pull request #1236 from degasus/microprofile
Update microprofile scopes.
2018-09-04 11:50:58 -04:00
bunnei
c156ee8eb8
Merge pull request #1230 from lioncash/ssl
ssl: Move SSL class to cpp file
2018-09-04 11:49:22 -04:00
Markus Wick
dce624e3f1 core: Use a raw pointer in GetGPUDebugContext.
This helper is called very often. The memory ownership shall not be transfered, so just return the raw pointer.
2018-09-04 14:10:05 +02:00
Markus Wick
10bc725944 Update microprofile scopes.
Blame the subsystems which deserve the blame :)

The updated list is not complete, just the ones I've spotted on random sampling the stack trace.
2018-09-04 11:04:26 +02:00
Lioncash
a813c10e1c file_sys: Replace includes with forward declarations where applicable
Cuts down on include dependencies, resulting in less files that need to
be rebuilt when certain things are changed.
2018-09-03 22:52:24 -04:00
bunnei
1c5636e690
Merge pull request #1231 from lioncash/global
service: Migrate global named port map to the KernelCore class
2018-09-03 21:21:12 -04:00
Zach Hilman
b2268f1f8d settings: Save and load NAND/SD dirs from config 2018-09-03 19:23:33 -04:00
Lioncash
a405373144 vfs_real: Forward declare IOFile
Eliminates the need to rebuild some source files if the file_util header
ever changes. This also uncovered some indirect inclusions, which have
also been fixed.
2018-09-02 12:38:14 -04:00
Lioncash
1242c1ec0a service: Migrate global named port map to the KernelCore class
Now that we have a class representing the kernel in some capacity, we
now have a place to put the named port map, so we move it over and get
rid of another piece of global state within the core.
2018-09-02 12:35:30 -04:00
Lioncash
41cd766438 ssl: Move SSL class to cpp file
This isn't required to be visible to anything outside of the main source
file, and will eliminate needing to rebuild anything else including the
header if the SSL class needs to be changed in the future.
2018-09-02 11:45:26 -04:00
bunnei
325f3e0693
Merge pull request #1213 from DarkLordZach/octopath-fs
filesystem/maxwell_3d: Various changes to boot Project Octopath Traveller
2018-09-02 10:49:18 -04:00
Lioncash
fda8f1da20 filesystem: Move dir retrieval after path checking in DeleteFile()
We don't need to do the lookup if the path is considered empty
currently.
2018-09-02 09:20:17 -04:00
Zach Hilman
19d0951ae6 filesystem: Implement OpenReadOnlySaveDataFilesystem 2018-08-31 23:19:49 -04:00
Zach Hilman
7939ea18e8 filesystem: Add OpenFileSystemWithPatch 2018-08-31 23:19:23 -04:00
Lioncash
4a587b81b2 core/core: Replace includes with forward declarations where applicable
The follow-up to e2457418da, which
replaces most of the includes in the core header with forward declarations.

This makes it so that if any of the headers the core header was
previously including change, then no one will need to rebuild the bulk
of the core, due to core.h being quite a prevalent inclusion.

This should make turnaround for changes much faster for developers.
2018-08-31 16:30:14 -04:00
bunnei
d647d9550c gl_renderer: Cache textures, framebuffers, and shaders based on CPU address. 2018-08-31 13:07:27 -04:00
Lioncash
e2457418da core: Make the main System class use the PImpl idiom
core.h is kind of a massive header in terms what it includes within
itself. It includes VFS utilities, kernel headers, file_sys header,
ARM-related headers, etc. This means that changing anything in the
headers included by core.h essentially requires you to rebuild almost
all of core.

Instead, we can modify the System class to use the PImpl idiom, which
allows us to move all of those headers to the cpp file and forward
declare the bulk of the types that would otherwise be included, reducing
compile times. This change specifically only performs the PImpl portion.
2018-08-31 07:16:57 -04:00
Lioncash
0cbcd6ec9a kernel: Eliminate kernel global state
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.

This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.

This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.

The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
2018-08-28 22:31:51 -04:00
bunnei
4d7e1662c8
Merge pull request #1193 from lioncash/priv
gpu: Make memory_manager private
2018-08-28 12:28:57 -04:00
Lioncash
45fb74d262 gpu: Make memory_manager private
Makes the class interface consistent and provides accessors for
obtaining a reference to the memory manager instance.

Given we also return references, this makes our more flimsy uses of
const apparent, given const doesn't propagate through pointers in the
way one would typically expect. This makes our mutable state more
apparent in some places.
2018-08-28 11:11:50 -04:00
Lioncash
f1bc62bb4c hle/result: Make ResultVal's move constructor as noexcept
Many containers within the standard library provide different behaviors
based on whether or not a move constructor/assignment operator can be
guaranteed not to throw or not.

Notably, implementations will generally use std::move_if_noexcept (or an
internal implementation of it) to provide strong exception guarantees.
If a move constructor potentially throws (in other words, is not
noexcept), then certain behaviors will create copies, rather than moving
the values.

For example, consider std::vector. When a std::vector calls resize(),
there are two ways the elements can be relocated to the new block of
memory (if a reallocation happens), by copy, or by moving the existing
elements into the new block of memory. If a type does not have a
guarantee that it will not throw in the move constructor, a copy will
happen. However, if it can be guaranteed that the move constructor won't
throw, then the elements will be moved.

This just allows ResultVal to be moved instead of copied all the time if
ever used in conjunction with containers for whatever reason.
2018-08-28 09:39:50 -04:00
bunnei
a409d49bbd
Merge pull request #1177 from lioncash/err
kernel/error: Amend several error codes
2018-08-27 18:37:48 -04:00
bunnei
90fd03015a
Merge pull request #1188 from lioncash/unused
vfs_real: Remove unused variable in CreateDirectoryRelative()
2018-08-27 18:24:23 -04:00
bunnei
62edc01525
Merge pull request #1175 from lioncash/ns
core: Namespace all code in the arm subdirectory under the Core namespace
2018-08-27 18:17:12 -04:00
bunnei
5d2043598e
Merge pull request #1187 from lioncash/shadow
registered_cache: Get rid of variable shadowing in ProcessFiles()
2018-08-27 18:15:49 -04:00
Lioncash
c6024379a4 vfs_real: Remove unused variable in CreateDirectoryRelative() 2018-08-27 15:58:23 -04:00
Lioncash
d3934d7da7 registered_cache: Get rid of variable shadowing in ProcessFiles()
Prevents compiler warnings.
2018-08-27 15:55:56 -04:00
bunnei
af59d4bff0
Merge pull request #1176 from lioncash/info
svc: Return process title ID if queried in GetInfo()
2018-08-27 15:44:52 -04:00
bunnei
f96ded9815
Merge pull request #1174 from lioncash/debug
debug_utils: Minor individual interface changes
2018-08-27 15:44:29 -04:00
bunnei
8c66a5a9a5
Merge pull request #1162 from ogniK5377/ttf-plu
PL:U Added SharedFonts loading via TTF
2018-08-27 15:43:10 -04:00
bunnei
34a447d24e
Merge pull request #1168 from lioncash/header
hid: Move core include to cpp file
2018-08-27 15:42:52 -04:00
bunnei
8d86747514
Merge pull request #1171 from lioncash/true
core: Remove always true conditionals in Load()
2018-08-27 15:41:58 -04:00
tech4me
d26a46feed set: Fixed GetAvailableLanguageCodes() to follow the max_entries
Rightnow, in games use GetAvailableLanguageCodes(), there is a WriteBuffer() with size larger than the buffer_size. (Core Critical core\hle\kernel\hle_ipc.cpp:WriteBuffer:296: size (0000000000000088) is greater than buffer_size (0000000000000078))

0x88 = 17(languages) * 8
0x78 = 15(languages) * 8

GetAvailableLanguageCodes() can only support 15 languages.
After firmware 4.0.0 there are 17 supported language instead of 15, to enable this GetAvailableLanguageCodes2() need to be used.
So GetAvailableLanguageCodes() will be caped at 15 languages.
Reference:
http://switchbrew.org/index.php/Settings_services
2018-08-26 00:11:13 -07:00
Lioncash
f708207ae6 kernel/error: Amend error code for ERR_MAX_CONNECTIONS_REACHED
We can make this error code an alias of the resource limit exceeded
error code, allowing us to get rid of the lingering 3DS error code of
the same type.
2018-08-25 09:40:42 -04:00
Lioncash
bfb0c87b7b kernel/error: Amend error code for ERR_PORT_NAME_TOO_LONG
We can treat this as an alias of TooLarge for documentation purposes.
This also lets us get rid of another lingering 3DS-related error code.
2018-08-25 09:40:29 -04:00