Commit graph

2406 commits

Author SHA1 Message Date
bunnei
f5efac3442
Merge pull request #876 from lioncash/include
kernel: Remove unnecessary includes
2018-07-31 19:16:05 -07:00
Lioncash
bba63b33a1 service/audio: Add missing services
Adds the missing audctl service, as well as the :a and :d services for
audin, audout, audrec, and audren.
2018-07-31 21:58:30 -04:00
bunnei
da07faebfe
Merge pull request #879 from lioncash/audio
audout_u: Remove std::move in OpenAudioOutImpl()
2018-07-31 16:49:56 -07:00
bunnei
3575c076cb
Merge pull request #869 from Subv/ubsan
Corrected a few error cases detected by asan/ubsan
2018-07-31 09:24:13 -07:00
bunnei
fd020ad52a
Merge pull request #875 from lioncash/fgm
service: Add fgm services
2018-07-31 09:23:17 -07:00
bunnei
3a2581cc7d
Merge pull request #874 from lioncash/am
service/am: Add missing am services
2018-07-31 09:22:56 -07:00
Lioncash
369f6e58aa kernel: Remove unused object_address_table.cpp/.h
These source files were entirely unused throughout the rest of the
codebase. This also has the benefit of getting rid of a global variable
as well.
2018-07-31 11:03:08 -04:00
Lioncash
1ced7bbea5 audout_u: Remove std::move in OpenAudioOutImpl()
Previously the code was using the values from params further below after
it was std::moved. Thankfully, given AudoutParams is a trivially
copyable struct, the values would have simply been copied in this
instance and not invalidated to garbage values.
2018-07-31 10:24:38 -04:00
Lioncash
a2304fad16 kernel: Remove unnecessary includes
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
2018-07-31 10:15:17 -04:00
Lioncash
7da8f15461 service/am: Add missing am services
Adds the basic skeleton for missing am services idle:sys, omm, and spsm
based off the information provided by Switch Brew.
2018-07-31 08:02:20 -04:00
Lioncash
268eeeb406 service: Add fgm services
Adds the basic skeleton for the fgm services based off the information
provided by Switch Brew.
2018-07-31 08:01:19 -04:00
Lioncash
e373027a73 service: Add the pcie service
Adds the basic skeleton of the pcie service based off information on
Switch Brew.
2018-07-31 06:40:21 -04:00
Subv
e119e17d18 nvhost_gpu: Added checks to ensure we don't read past the end of the entries when handling a GPU command list. 2018-07-30 20:09:13 -05:00
Subv
2482aca7c3 nvhost_ctrl_gpu: Only read the input parameters if they are actually there.
Passing nullptr to memcpy is undefined behavior.
2018-07-30 20:08:36 -05:00
bunnei
eaf66b4c9f audio_core: Move to audout_u impl.
- This is necessary so streams are created on the same thread.
2018-07-30 18:44:16 -04:00
David
a483e5e28d Implemented various hwopus functions (#853) 2018-07-30 15:42:20 -07:00
bunnei
c5fa3560a6
Merge pull request #857 from lioncash/wlan
service: Add wlan services
2018-07-30 10:06:52 -07:00
bunnei
2c4bb11015
Merge pull request #856 from lioncash/btm
service: Add btm services
2018-07-30 10:06:34 -07:00
Hexagon12
fd797e2424 Add some HID commands (#843)
* Added some HID commands

* Addressed comments
2018-07-30 10:06:21 -07:00
Lioncash
6ea416091e service: Add wlan services
Adds the basic skeleton for the wlan services based off the information
on Switch Brew.
2018-07-28 21:54:55 -04:00
Lioncash
7ce6858086 service/btm: Add basic implementation of GetCoreImpl()
Based off information on SwIPC and Switch Brew.
2018-07-28 21:09:07 -04:00
Lioncash
ca7655be3a service: Add btm services
Adds the skeleton for the btm services based off the information on
Switch Brew.
2018-07-28 21:09:07 -04:00
bunnei
458fdda700
Merge pull request #847 from lioncash/ncm
service: Add ncm services
2018-07-28 10:46:09 -07:00
bunnei
d00dcdb1be
Merge pull request #846 from lioncash/mii
service: Add mii services
2018-07-28 10:45:31 -07:00
bunnei
f1c519f2cb audout: Implement IAudioOut interface with AudioCore. 2018-07-27 22:55:39 -04:00
Lioncash
7931cc0ceb service: Add ncm services
Adds the basic skeleton for the ncm services based off information on
Switch Brew.
2018-07-27 17:38:30 -04:00
bunnei
0191a1e526
Merge pull request #845 from lioncash/nfc
service: Add nfc services
2018-07-27 14:29:27 -07:00
bunnei
833ebbb626
Merge pull request #844 from lioncash/lbl
service: Add the lbl service
2018-07-27 13:06:11 -07:00
bunnei
d2749ef0ed
Merge pull request #841 from lioncash/btdrv
service: Add the btdrv service
2018-07-27 13:05:36 -07:00
Lioncash
f46bfdd77d service: Add mii services
Adds the skeleton for the mii services based off information provided by
Switch Brew
2018-07-27 16:01:29 -04:00
Lioncash
50dadc33e3 service/nfc: Implement Create[x]Interface functions
These simply return the respective interface.
2018-07-27 15:12:08 -04:00
Lioncash
04d144aa40 service: Add nfc services
Adds the skeleton of the nfc service based off the information provided
on Switch Brew.
2018-07-27 14:50:24 -04:00
Lioncash
ea8dd8b650 service/lbl: Implement EnableVrMode, DisableVrMode and GetVrMode
Implements these functions according to the information available on
Switch Brew.
2018-07-27 14:20:42 -04:00
Lioncash
c2c543e8f7 service: Add the lbl service
Adds the skeleton of the lbl service based off the information provided
by Switch Brew.
2018-07-27 14:20:07 -04:00
bunnei
dc4e5f9159
Merge pull request #837 from lioncash/priv
kernel/timer: Make data members private where applicable
2018-07-27 07:18:50 -07:00
Lioncash
f49248437e service: Add the btdrv service
Adds the skeleton for the btdrv service based off the information provided by Switch Brew
2018-07-26 18:06:17 -04:00
Lioncash
1121622dc1 service/hid: Add the hidbus, hid:dbg, hid:sys, and hid:tmp services 2018-07-26 15:05:42 -04:00
Lioncash
7550c2c866 service/hid: Add the xcd:sys service 2018-07-26 15:05:42 -04:00
Lioncash
82cb5f030d service/hid: Add irs services 2018-07-26 15:05:24 -04:00
bunnei
8440b814bc
Merge pull request #834 from lioncash/grc
service: Add the grc:c service
2018-07-26 12:03:30 -07:00
bunnei
41d7b020a8
Merge pull request #832 from lioncash/nim
service: Add the nim services
2018-07-26 12:02:29 -07:00
bunnei
e4191b624c
Merge pull request #831 from lioncash/ldn
service: Add ldn services
2018-07-26 11:52:42 -07:00
bunnei
40eb243f86
Merge pull request #830 from lioncash/socket
service/sockets: Add missing socket services
2018-07-26 11:51:11 -07:00
Lioncash
b28af1f6c9 service: Add the grc:c service
Adds the basic skeleton for the grc:c service based off the information
provided by Switch Brew.
2018-07-26 09:53:58 -04:00
Lioncash
0cd843151f kernel/timer: Make data members private where applicable
Instead, we can just expose functions that return the queryable state
instead of letting anything modify it.
2018-07-26 09:51:44 -04:00
Lioncash
f916611e32 service: Add the nim services
Adds the skeleton for the nim services based off information from Switch
Brew.
2018-07-26 02:47:06 -04:00
Lioncash
8781beaf0d service: Add ldn services
Adds ldn services based off information provided by Switch Brew.
2018-07-26 01:48:06 -04:00
bunnei
57cd80c410
Merge pull request #827 from lioncash/log
service/lm: Minor changes
2018-07-25 22:30:43 -07:00
Lioncash
3f5dfc4d96 service/sockets: Add ethc:c and ethc:i services 2018-07-26 01:07:21 -04:00
Lioncash
165e7645e1 service/sockets: Add missing bsdcfg socket service 2018-07-26 01:00:15 -04:00
Sebastian Valle
1958d07d7d
Merge pull request #828 from lioncash/ldr
service: Add ldr services
2018-07-25 23:44:13 -05:00
Sebastian Valle
8ac52c6b56
Merge pull request #826 from lioncash/erpt
service: Add erpt and eupld services
2018-07-25 23:43:47 -05:00
Sebastian Valle
0e05f98be2
Merge pull request #823 from lioncash/nifm
service/nifm: Deduplicate interface code
2018-07-25 23:43:03 -05:00
Lioncash
3fb124961e service: Add ldr services
Adds the skeleton for the ldr-related services based off the information
provided on Switch Brew.
2018-07-25 23:11:03 -04:00
Lioncash
91d86df920 lm: Move LM's class declaration into the cpp file
This isn't used directly outside of this translation unit, so we can
hide it from external use.
2018-07-25 22:40:16 -04:00
Lioncash
6f4d3d8163 lm: Amend names of Initialize() in Logger and Initialize() in LM
Amends these to match the information on Switch Brew.
2018-07-25 22:39:39 -04:00
Lioncash
8650be1020 lm: Add missing function entry to Logger's function table 2018-07-25 22:26:32 -04:00
Lioncash
7458e71f24 service: Add eupld services
Adds the skeleton for the eupld services based off information on Switch
Brew.
2018-07-25 22:13:43 -04:00
Lioncash
821f2c03cb service: Add the erpt services
Adds the basic skeleton of the erpt service based off information on
Switch Brew.
2018-07-25 22:13:39 -04:00
bunnei
b0adb9a3d9
Merge pull request #824 from lioncash/nvdrv
service/nvdrv: Minor changes
2018-07-25 19:02:08 -07:00
bunnei
851089b482
Merge pull request #822 from lioncash/pm
service: Add pm services
2018-07-25 19:01:28 -07:00
Lioncash
f9951352f6 service/nvdrv: Take std::string in Open() by const reference
Avoids copies from being made, since the string is only ever used for
lookup, the data is never transfered anywhere.

Ideally, we'd use a std::string_view here, but devices is a
std::unordered_map, not a std::map, so we can't use heterogenous lookup
here.
2018-07-25 17:37:43 -04:00
Lioncash
a2cd07d094 service/nvdrv: Use std::move where applicable
Avoids unnecessary reference count increments and decrements.

In one case, we don't need to make a shared_ptr copy at all,
just to call a member function.
2018-07-25 17:31:08 -04:00
Lioncash
85ed42a1d2 service/nifm: Deduplicate interface code
Rather than having the same code for each nifm service variant, we can
centralize it on one class and get rid of a bit of extra code.
2018-07-25 17:18:41 -04:00
Lioncash
c664f8a257 service: Add pm services
Adds the skeleton for the process management services based off
information on Switch Brew.
2018-07-25 16:57:16 -04:00
Lioncash
4175712976 service: Add the es service
Adds the skeleton for the ETicket service based off the information on
Switch Brew
2018-07-25 15:36:55 -04:00
Mat M
1e4935c3a0
Merge pull request #801 from lioncash/time
time: Add the time:a service
2018-07-25 15:08:33 -04:00
Mat M
d3fd0351a7
Merge pull request #804 from lioncash/log
svc: Log parameters in SetMemoryAttribute()
2018-07-25 14:43:24 -04:00
Lioncash
3c1cb3b11e time: Add the time:a service
Given we already have time:s and time:u, we should also have time:a
2018-07-25 14:42:04 -04:00
bunnei
657bd113e3
Merge pull request #803 from MerryMage/core_timing_util
core_timing: Split off utility functions into core_timing_util
2018-07-25 11:09:31 -07:00
bunnei
5c42cadbc9
Merge pull request #800 from lioncash/set
set_sys: Implement SetColorSetId()
2018-07-25 10:25:29 -07:00
bunnei
340771ccd7
Merge pull request #806 from lioncash/friend
friend: Deduplicate interfaces
2018-07-24 17:42:16 -07:00
Lioncash
07c2d057bd friend: Add friend:m, friend:s, and friend:v services
Given we already have friend:a and friend:u, we should add the remaining
services as well.
2018-07-24 10:26:01 -04:00
Lioncash
9539a1eadd friend/interface: Add missing CreateDaemonSuspendSessionService() to the function handler table 2018-07-24 10:24:16 -04:00
Lioncash
77daef44b0 friend: Deduplicate interfaces 2018-07-24 10:21:51 -04:00
Lioncash
c73410bf2c svc: Resolve sign comparison warnings in WaitSynchronization()
The loop's induction variable was signed, but we were comparing against
an unsigned variable.
2018-07-24 09:55:17 -04:00
Lioncash
8e8e906432 svc: Log parameters in SetMemoryAttribute()
Provides slightly more context than only logging out the address value.
2018-07-24 09:46:46 -04:00
bunnei
23e85b6b9f
Merge pull request #797 from lioncash/explicit
core: Make converting constructors explicit where applicable
2018-07-24 04:47:26 -07:00
bunnei
1cbf7ac6ea
Merge pull request #795 from lioncash/decl
apm/interface: Remove redundant declaration of InstallInterfaces()
2018-07-24 04:46:41 -07:00
bunnei
d092ea0870
Merge pull request #794 from lioncash/ref
mutex: Pass SharedPtr to GetHighestPriorityMutexWaitingThread() by reference
2018-07-24 04:45:34 -07:00
Lioncash
a61124a9e7 time: Simplify interface creation
We can use one instance of the interface instead of duplicating code.
2018-07-24 06:21:27 -04:00
MerryMage
44646e2ea0 core_timing: Split off utility functions into core_timing_util 2018-07-24 11:03:24 +01:00
Lioncash
63c605c04a set_sys: Implement SetColorSetId() 2018-07-24 00:48:16 -04:00
Lioncash
76f191ce36 ipc_helper: Add helper member function for popping enum values to RequestParser 2018-07-24 00:47:51 -04:00
bunnei
2f029577c7
Merge pull request #793 from lioncash/priv
ipc_helpers: Make member variables of ResponseBuilder private
2018-07-23 21:23:27 -07:00
Lioncash
1d755abce4 core: Make converting constructors explicit where applicable
Avoids unwanted implicit conversions. Thankfully, given the large amount
of cleanup in past PRs, only this tiny amount is left over to cover.
2018-07-23 23:13:22 -04:00
Lioncash
8b83adfed6 apm/interface: Remove redundant declaration of InstallInterfaces()
This is already declared in apm/apm.h
2018-07-23 23:01:04 -04:00
Lioncash
42b5158c96 mutex: Pass SharedPtr to GetHighestPriorityMutexWaitingThread() by reference
The pointed to thread's members are simply observed in this case, so we
don't need to copy it here.
2018-07-23 22:54:35 -04:00
Zach Hilman
59cb258409 VFS Regression and Accuracy Fixes (#776)
* Regression and Mode Fixes

* Review Fixes

* string_view correction

* Add operator& for FileSys::Mode

* Return std::string from SanitizePath

* Farming Simulator Fix

* Use != With mode operator&
2018-07-23 19:40:35 -07:00
Lioncash
22fd3f0026 hle_ipc: Make constructors explicit where applicable 2018-07-23 22:40:24 -04:00
Lioncash
2a1daf8f83 ipc_helpers: Make member variables of ResponseBuilder private
These aren't used externally at all, so they can be made private.
2018-07-23 22:29:07 -04:00
bunnei
52ec1840f5
Merge pull request #780 from lioncash/move
vi: Minor changes
2018-07-23 18:29:11 -07:00
bunnei
e0b6771e25
Merge pull request #779 from lioncash/shared
hle: Remove unused config_mem and shared_page source files
2018-07-23 18:28:45 -07:00
Lioncash
1432912ae8 vi: Add std::is_trivially_copyable checks to Read and Write functions
It's undefined behavior to memcpy an object that isn't considered
trivially copyable, so put a compile-time check in to make sure this
doesn't occur.
2018-07-23 14:53:54 -04:00
Lioncash
344a0c91f2 vi: std::move std::vector in constructors where applicable
Allows avoiding unnecessary copies of the vector depending on the
calling code.

While we're at it, remove a redundant no-parameter base constructor call
2018-07-23 14:49:54 -04:00
Lioncash
cbe841c9c9 hle: Remove config_mem.h/.cpp
This is just an unused hold-over from citra, so we can get rid of this
to trim off an exposed global, among other things.
2018-07-23 12:57:34 -04:00
Lioncash
1f3889a290 hle: Remove shared_page.h/.cpp
This is a holdover from citra that's essentially unused.
2018-07-23 12:53:07 -04:00
Lioncash
e85308cd90 set: Add missing log call in GetAvailableLanguageCodeCount()
Forgot to include this in 22f448b632
2018-07-23 12:37:42 -04:00
bunnei
a85366a40c
Merge pull request #777 from lioncash/lang
set: Amend return value of GetAvailableLanguageCodes()
2018-07-23 09:34:08 -07:00
Lioncash
22f448b632 set: Implement GetAvailableLanguageCodeCount()
This just returns the size of the language code buffer.
2018-07-23 00:29:40 -04:00
Lioncash
37aeecd29f set: Correct return code size of value in GetAvailableLanguageCodes()
The return code should be 32-bit in size.
2018-07-23 00:29:22 -04:00
bunnei
a4b2af7382
Merge pull request #774 from Subv/atomic_signal
Kernel/SVC: Perform atomic accesses in SignalProcessWideKey as per the real kernel.
2018-07-22 12:26:03 -07:00
Subv
7841447cf0 Kernel/SVC: Perform atomic accesses in SignalProcessWideKey as per the real kernel. 2018-07-22 12:27:24 -05:00
Lioncash
398444e676 file_util, vfs: Use std::string_view where applicable
Avoids unnecessary construction of std::string instances where
applicable.
2018-07-22 03:22:21 -04:00
bunnei
9533875eeb
Merge pull request #760 from lioncash/path
file_util: Use an enum class for GetUserPath()
2018-07-21 18:30:04 -07:00
Subv
5c49e56d41 GPU: Implement the NVGPU_IOCTL_CHANNEL_KICKOFF_PB ioctl2 command.
This behaves quite similarly to the SubmitGPFIFO command. Referenced from Ryujinx.
Many thanks to @gdkchan for investigating this!
2018-07-21 15:50:02 -05:00
Lioncash
d66b43dadf file_util: Use an enum class for GetUserPath()
Instead of using an unsigned int as a parameter and expecting a user to
always pass in the correct values, we can just convert the enum into an
enum class and use that type as the parameter type instead, which makes
the interface more type safe.

We also get rid of the bookkeeping "NUM_" element in the enum by just
using an unordered map. This function is generally low-frequency in
terms of calls (and I'd hope so, considering otherwise would mean we're
slamming the disk with IO all the time) so I'd consider this acceptable
in this case.
2018-07-21 16:21:19 -04:00
bunnei
fe2498a650
Merge pull request #751 from Subv/tpidr_el0
CPU: Save and restore the TPIDR_EL0 system register on every context switch
2018-07-21 10:48:30 -07:00
Subv
d84eb9dac6 CPU: Save and restore the TPIDR_EL0 system register on every context switch.
Note that there's currently a dynarmic bug preventing this register from being written.
2018-07-20 19:57:45 -05:00
bunnei
2b7d862366
Merge pull request #742 from bunnei/misc-apm
apm: Improve stub for GetPerformanceConfiguration.
2018-07-20 15:01:19 -07:00
bunnei
dffd154d6d apm: Improve stub for GetPerformanceConfiguration. 2018-07-20 15:20:01 -04:00
Lioncash
0a0b3c4b9f ipc_helpers: Add PushEnum() member function to ResponseBuilder
Allows pushing strongly-typed enum members without the need to always
cast them at the call sites.

Note that we *only* allow strongly-typed enums in this case. The reason
for this is that strongly typed enums have a guaranteed defined size, so
the size of the data being pushed is always deterministic. With regular
enums this can be a little more error-prone, so we disallow them.

This function simply uses the underlying type of the enum to determine
the size of the data. For example, if an enum is defined as:

enum class SomeEnum : u16 {
  SomeEntry
};

if PushEnum(SomeEnum::SomeEntry); is called, then it will push a
u16-size amount of data.
2018-07-20 15:00:58 -04:00
bunnei
c1c9ab31e8
Merge pull request #740 from Subv/acc_crash
HLE/ACC: Stub IManagerForApplication::GetAccountId to return an error.
2018-07-20 09:47:47 -07:00
bunnei
701c7cb85c
Merge pull request #736 from lioncash/null
audout_u/audren_u: Ensure null terminators are written out in ListAudioOutsImpl(), ListAudioDeviceName(), and GetActiveAudioDeviceName()
2018-07-20 09:17:07 -07:00
bunnei
741cae1e1d
Merge pull request #734 from lioncash/thread
thread: Convert ThreadStatus into an enum class
2018-07-20 09:15:52 -07:00
Subv
9c7321fe6d HLE/ACC: Stub IManagerForApplication::GetAccountId to return an error.
And make IManagerForApplication::CheckAvailability always return false.
Returning a bogus id from GetAccountId causes games to crash on boot.
We should investigate this with a hwtest and either stub it properly or implement it.
2018-07-20 11:02:25 -05:00
Lioncash
40c9c5a55c audren_u: Use a std::array instead of std::string for holding the audio interface/device name
std::string doesn't include the null-terminator in its data() + size()
range. This ensures that the null-terminator will also be written to the buffer
2018-07-19 23:15:27 -04:00
Lioncash
c20cea118b audout_u: Use a std::array instead of std::string for holding the audio interface name
Uses a type that doesn't potentially dynamically allocate, and ensures
that the name of the interface is properly null-terminated when writing
it to the buffer.
2018-07-19 23:15:00 -04:00
Lioncash
dbfe82773d thread: Convert ThreadStatus into an enum class
Makes the thread status strongly typed, so implicit conversions can't
happen. It also makes it easier to catch mistakes at compile time.
2018-07-19 22:08:56 -04:00
Lioncash
1bdb67440b pl_u: Simplify WriteBuffer() calls in GetSharedFontInOrderOfPriority()
With the new overload, we can simply pass the container directly.
2018-07-19 19:50:30 -04:00
bunnei
d3cfaf95c8
Merge pull request #726 from lioncash/overload
hle_ipc: Introduce generic WriteBuffer overload for multiple container types
2018-07-19 16:18:38 -07:00
bunnei
0b13ce1435
Merge pull request #725 from lioncash/bytes
pl_u: Specify correct size for buffers in GetSharedFontInOrderOfPriority()
2018-07-19 16:16:30 -07:00
bunnei
af08034c71
Merge pull request #728 from Subv/acc_profile
HLE/ACC: Change the default user id and small improvements to the way we handle profiles
2018-07-19 16:15:01 -07:00
bunnei
2aeb3355e4
Merge pull request #727 from Subv/acc_users
HLE/ACC: Write a single whole user id in ListAllUsers and ListOpenUsers.
2018-07-19 16:13:45 -07:00
bunnei
c6352ffc58
Merge pull request #724 from lioncash/printf
pl_u: Remove printf specifier in log call in a log call in GetSharedFontInOrderOfPriority()
2018-07-19 16:13:07 -07:00
bunnei
f43d8ea523
Merge pull request #722 from lioncash/signed
hid: Resolve a signed/unsigned comparison warning
2018-07-19 16:12:15 -07:00
bunnei
2194308245
Merge pull request #721 from lioncash/svc
svc: Correct always true assertion case in SetThreadCoreMask
2018-07-19 16:11:40 -07:00
bunnei
31413f0d2f
Merge pull request #717 from lioncash/explicit
hle/service: Make constructors explicit where applicable
2018-07-19 16:08:07 -07:00
Subv
05549e45c5 HLE/ACC: Return an IProfile that is consistent with what was requested.
The default username for now is "yuzu".
We should eventually allow the creation of users in the emulator and have the ability to modify their parameters.
2018-07-19 16:53:42 -05:00
Subv
50e2777724 HLE/ACC: Change the default user id to be consistent with what we tell games on startup.
In IApplicationFunctions::PopLaunchParameter we tell the games that they were launched as user id 1.
2018-07-19 16:51:55 -05:00
Subv
b102815f1f HLE/ACC: Write a single whole user id in ListAllUsers and ListOpenUsers.
We only emulate a single user id for now.
2018-07-19 16:19:46 -05:00
bunnei
7244671137
Merge pull request #716 from lioncash/construct
nvflinger: Emplace Display instances directly
2018-07-19 14:18:29 -07:00
Lioncash
ff500a7b68 hle_ipc: Introduce generic WriteBuffer overload for multiple container types
This introduces a slightly more generic variant of WriteBuffer().
Notably, this variant doesn't constrain the arguments to only accepting
std::vector instances. It accepts whatever adheres to the
ContiguousContainer concept in the C++ standard library.

This essentially means, std::array, std::string, and std::vector can be
used directly with this interface. The interface no longer forces you to
solely use containers that dynamically allocate.

To ensure our overloads play nice with one another, we only enable the
container-based WriteBuffer if the argument is not a pointer, otherwise
we fall back to the pointer-based one.
2018-07-19 17:05:12 -04:00
bunnei
eb9b55eafe
Merge pull request #715 from lioncash/const-ref
nvdrv: Take std::string by const reference in GetDevice()
2018-07-19 13:27:48 -07:00
Sebastian Valle
78dd1cd441
Merge pull request #720 from Subv/getentrytype_root
Filesystem: Return EntryType::Directory for the root directory.
2018-07-19 15:23:32 -05:00
Lioncash
df001e83b1 pl_u: Specify correct size for buffers in GetSharedFontInOrderOfPriority()
This WriteBuffer overload expects its size argument to be in bytes, not
elements.
2018-07-19 15:57:58 -04:00
Lioncash
b879fb84a2 svc: Correct always true assertion case in SetThreadCoreMask
The reason this would never be true is that ideal_processor is a u8 and
THREADPROCESSORID_DEFAULT is an s32. In this case, it boils down to how
arithmetic conversions are performed before performing the comparison.

If an unsigned value has a lesser conversion rank (aka smaller size)
than the signed type being compared, then the unsigned value is promoted
to the signed value (i.e. u8 -> s32 happens before the comparison). No
sign-extension occurs here either.

An alternative phrasing:

Say we have a variable named core and it's given a value of -2.

u8 core = -2;

This becomes 254 due to the lack of sign. During integral promotion to
the signed type, this still remains as 254, and therefore the condition
will always be true, because no matter what value the u8 is given it
will never be -2 in terms of 32 bits.

Now, if one type was a s32 and one was a u32, this would be entirely
different, since they have the same bit width (and the signed type would
be converted to unsigned instead of the other way around) but would
still have its representation preserved in terms of bits, allowing the
comparison to be false in some cases, as opposed to being true all the
time.

---

We also get rid of two signed/unsigned comparison warnings while we're
at it.
2018-07-19 15:46:17 -04:00
Lioncash
68c1ffdd1c pl_u: Remove printf specifier in log call in a log call in GetSharedFontInOrderOfPriority()
This can just use the fmt specifiers and be type-agnostic.
2018-07-19 15:44:04 -04:00
Sebastian Valle
7eace8f512
Merge pull request #714 from lioncash/index
hle_ipc: Amend usage of buffer_index within one of HLERequestContext's WriteBuffer() overloads
2018-07-19 14:36:34 -05:00
bunnei
38b35e752b
Merge pull request #712 from lioncash/fsp
fsp_srv: Misc individual changes
2018-07-19 12:31:33 -07:00
Lioncash
a37a47448d hid: Use a ranged-for loops in UpdatePadCallback
Modernizes the loops themselves while also getting rid of a signed/unsigned
comparison in a loop condition.
2018-07-19 15:11:08 -04:00
Lioncash
95103a1b7b hid: Use HID_NUM_LAYOUTS constant for indicating size of the layouts array
Gets rid of the use of a magic constant
2018-07-19 15:07:36 -04:00
Subv
e5c916a27c Filesystem: Return EntryType::Directory for the root directory.
It is unknown if this is correct behavior, but it makes sense and fixes a regression with Stardew Valley.
2018-07-19 13:11:09 -05:00
Lioncash
c061c2bf3c hle/service: Make constructors explicit where applicable
Prevents implicit construction and makes these lingering non-explicit
constructors consistent with the rest of the other classes in services.
2018-07-19 12:25:02 -04:00
Lioncash
f3daecafeb nvflinger: Emplace Display instances directly
We can use emplace_back to construct the Display instances directly,
instead of constructing them separately and copying them, avoiding the
need to copy std::string and std::vector instances that are part of the
Display struct.
2018-07-19 11:50:12 -04:00
Lioncash
dc35c3f9d7 nvdrv: Take std::string by const reference in GetDevice()
This is only ever used as a lookup into the device map, so we don't need to
take the std::string instance by value here.
2018-07-19 11:40:36 -04:00
Lioncash
af2698dcea hle_ipc: Amend usage of buffer_index within one of HLERequestContext's WriteBuffer() overloads
Previously, the buffer_index parameter was unused, causing all writes to
use the buffer index of zero, which is not necessarily what is wanted
all the time.

Thankfully, all current usages don't use a buffer index other than zero,
so this just prevents a bug before it has a chance to spring.
2018-07-19 11:10:16 -04:00
Lioncash
6c1ba02e0c fsp_srv: Remove unnecessary vector construction in IFile's Write() function
We can avoid constructing a std::vector here by simply passing a pointer
to the original data and the size of the copy we wish to perform to the
backend's Write() function instead, avoiding copying the data where it's
otherwise not needed.
2018-07-19 11:01:07 -04:00
Lioncash
3e9b79e088 fsp_srv: Remove unnecessary std::vector construction in IDirectory's Read() function
We were using a second std::vector as a buffer to convert another
std::vector's data into a byte sequence, however we can just use
pointers to the original data and use them directly with WriteBuffer,
which avoids copying the data at all into a separate std::vector.

We simply cast the pointers to u8* (which is allowed by the standard,
given std::uint8_t is an alias for unsigned char on platforms that we
support).
2018-07-19 10:46:54 -04:00
Lioncash
5da4c78c6a filesystem: std::move VirtualDir instance in VfsDirectoryServiceWrapper's constructor
Avoids unnecessary atomic reference count incrementing and decrementing
2018-07-19 10:34:11 -04:00