Commit graph

2254 commits

Author SHA1 Message Date
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
Lioncash
abbf038191 filesystem: Use std::string's empty() function instead of comparing against a literal
This is simply a basic value check as opposed to potentially doing
string based operations (unlikely, but still, avoiding it is free).
2018-07-19 10:32:23 -04:00
Lioncash
2cc0ef83cf filesystem: Remove pragma disabling global optimizations
This was just an artifact missed during PR review.
2018-07-19 10:30:53 -04:00
Lioncash
f317080f40 fsp_srv: Make IStorage constructor explicit
Prevents implicit conversions.
2018-07-19 10:04:16 -04:00
Lioncash
910ad2e110 fsp_srv: Add missing includes
Gets rid of relying on indirect inclusions.
2018-07-19 10:03:17 -04:00
Lioncash
6be342118a fsp_srv: Resolve sign-mismatch warnings in assertion comparisons 2018-07-19 09:58:32 -04:00
Lioncash
d6e9b96e2f fsp_srv: Respect write length in Write()
Previously we were just copying the data whole-sale, even if the length
was less than the total data size. This effectively makes the
actual_data vector useless, which is likely not intended.

Instead, amend this to only copy the given length amount of data.

At the same time, we can avoid zeroing out the data before using it by
passing iterators to the constructor instead of a size.
2018-07-19 09:57:48 -04:00
bunnei
368e1d25be
Merge pull request #692 from lioncash/assign
address_arbiter: Correct assignment within an assertion statement in WakeThreads()
2018-07-18 20:56:28 -07:00
bunnei
85421f3406
Merge pull request #690 from lioncash/move
core/memory, core/hle/kernel: Use std::move where applicable
2018-07-18 20:55:55 -07:00
bunnei
1371e2fb6a
Merge pull request #691 from lioncash/guard
service/prepo: Add missing header guard
2018-07-18 19:46:14 -07:00
bunnei
90ce935f3d
Merge pull request #688 from lioncash/comma
vm_manager: Add missing commas to string literal array elements in GetMemoryStateName()
2018-07-18 18:59:09 -07:00
bunnei
49b0966003
Merge pull request #687 from lioncash/instance
core: Don't construct instance of Core::System, just to access its live instance
2018-07-18 18:55:58 -07:00
Zach Hilman
29aff8d5ab Virtual Filesystem 2: Electric Boogaloo (#676)
* Virtual Filesystem

* Fix delete bug and documentate

* Review fixes + other stuff

* Fix puyo regression
2018-07-18 18:07:11 -07:00
Lioncash
2cd3141c30 address_arbiter: Correct assignment within an assertion statement in WakeThreads()
This was introduced within 4f81bc4e1b, and
considering there's no comment indicating that this is intentional, this
is very likely a bug.
2018-07-18 19:46:46 -04:00
Lioncash
296e68fd43 service/prepo: Add missing header guard 2018-07-18 19:43:28 -04:00
Lioncash
93cba6f699 vm_manager: Add missing commas to string literal array elements in GetMemoryStateName()
Without these, this would perform concatenation, which is definitely not
what we want here.
2018-07-18 19:37:19 -04:00
Lioncash
46458e7284 core/memory, core/hle/kernel: Use std::move where applicable
Avoids pointless copies
2018-07-18 19:34:31 -04:00
Lioncash
3a4841e403 core: Don't construct instance of Core::System, just to access its live instance
This would result in a lot of allocations and related object
construction, just to toss it all away immediately after the call.

These are definitely not intentional, and it was intended that all of
these should have been accessing the static function GetInstance()
through the name itself, not constructed instances.
2018-07-18 18:18:27 -04:00
Zach Hilman
c337272ca9 Fill in more fields in TouchScreenEntryTouch 2018-07-18 16:33:11 -04:00
Zach Hilman
f2f368014e Single touch support 2018-07-18 14:06:33 -04:00
bunnei
49e5de9f03 vi: Change TransactionId::CancelBuffer to LOG_CRITICAL. 2018-07-17 22:47:35 -04:00
bunnei
0d1a99edf6 vi: Fix size for ListDisplays default display. 2018-07-17 22:18:14 -04:00
bunnei
c3dd456d51 vi: Partially implement buffer crop parameters. 2018-07-17 20:13:17 -04:00
Zach Hilman
69bfe075b5 General Filesystem and Save Data Fixes (#670) 2018-07-17 12:42:15 -07:00
bunnei
88a3140c9b
Merge pull request #671 from MerryMage/clear-exclusive-state
scheduler: Clear exclusive state when switching contexts
2018-07-17 07:33:32 -07:00
bunnei
519035db3d
Merge pull request #672 from SciresM/to_address_fix
svc:: Fix bug in svcWaitForAddress
2018-07-17 07:32:42 -07:00
bunnei
170e19d4ea nvflinger: Fix for BufferQueue event handling. 2018-07-17 00:26:23 -04:00
Michael Scire
3b885691a1 Kernel/Arbiter: Fix bug in WaitIfLessThan 2018-07-16 20:55:53 -06:00
MerryMage
56cc1c11ec scheduler: Clear exclusive state when switching contexts 2018-07-16 11:24:00 +01:00
James Rowe
7d209b3c9f HID: Update controllers less often 2018-07-15 13:47:41 -06:00
bunnei
c324a378ac
Merge pull request #663 from Subv/bsd
Services/BSD: Corrected the return for StartMonitoring according to SwIPC
2018-07-14 19:40:34 -07:00
Subv
b07f4d6afb Services/BSD: Corrected the return for StartMonitoring according to SwIPC. 2018-07-14 12:34:07 -05:00
David Marcec
a7d6c0d6ea No need to use ASSERT_MSG with an empty message 2018-07-14 23:13:16 +10:00
David Marcec
8bd8d1e3da We only need to alert for memory pool changes 2018-07-13 10:36:28 +10:00
David Marcec
6642011706 initialized voice status and unused sizes in the update data header 2018-07-13 10:35:44 +10:00
bunnei
4f41ffdd41
Merge pull request #648 from ogniK5377/no-net
Let games/application know that we're offline
2018-07-12 06:44:15 -07:00
David Marcec
706892de7d Audout "Auto" functions
Audout autos are identical to their counterpart except for the buffer type which yuzu already handles for us.
2018-07-12 16:57:31 +10:00
David Marcec
3d68f6ba6c Added IsWirelessCommunicationEnabled, IsEthernetCommunicationEnabled, IsAnyInternetRequestAccepted
Since we have no socket implementation we should be returning 0 to indicate we're currently offline.
2018-07-12 16:40:17 +10:00
bunnei
7230ceb584
Merge pull request #559 from Subv/mount_savedata
Services/FS: Return the correct error code when trying to mount a nonexistent savedata.
2018-07-11 20:21:52 -07:00
bunnei
12a6996262 hid: Fix timestamps and controller type.
- This fixes user input in SMO.
2018-07-10 22:55:13 -04:00
David Marcec
0944bfe3cb NvOsGetConfigU32 production impl
Settings are only  used when RMOS_SET_PRODUCTION_MODE is set to 0.
If production mode is set, the error code 0x30006 is returned instead
2018-07-10 14:10:17 +10:00
bunnei
1b3dd30ba8 nvhost_ctrl: Fix NvOsGetConfigU32 for Snipper Clips. 2018-07-08 17:01:46 -04:00
bunnei
913896cbd9 Revert "Virtual Filesystem (#597)"
This reverts commit 77c684c114.
2018-07-07 20:24:51 -07:00
Zach Hilman
77c684c114 Virtual Filesystem (#597)
* Add VfsFile and VfsDirectory classes

* Finish abstract Vfs classes

* Implement RealVfsFile (computer fs backend)

* Finish RealVfsFile and RealVfsDirectory

* Finished OffsetVfsFile

* More changes

* Fix import paths

* Major refactor

* Remove double const

* Use experimental/filesystem or filesystem depending on compiler

* Port partition_filesystem

* More changes

* More Overhaul

* FSP_SRV fixes

* Fixes and testing

* Try to get filesystem to compile

* Filesystem on linux

* Remove std::filesystem and document/test

* Compile fixes

* Missing include

* Bug fixes

* Fixes

* Rename v_file and v_dir

* clang-format fix

* Rename NGLOG_* to LOG_*

* Most review changes

* Fix TODO

* Guess 'main' to be Directory by filename
2018-07-06 10:51:32 -04:00
David
3dab0e284b Update AudioRenderer Voice Sections (#614)
* voice section updating

* fixed slight offset miscalculation

* fixed overflow
2018-07-03 13:09:10 -04:00
James Rowe
0d46f0df12 Update clang format 2018-07-02 21:45:47 -04:00
James Rowe
638956aa81 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Subv
6c0c81dfdc GPU: Remove a surface from the cache when its backing memory is being unmapped from the GPU's MMU. 2018-07-01 10:50:06 -05:00
Subv
a093feca62 nvmap: Return the address of the nvmap object when Freeing it for the last time.
This behavior is confirmed by reverse engineering.
2018-07-01 10:48:50 -05:00
bunnei
da2bdbc0d7
Merge pull request #588 from mailwl/hwopus
Service/Audio: add hwopus service, stub GetWorkBufferSize function
2018-06-27 21:57:21 -04:00
David
c9e821e93e Send the correct RequestUpdateAudioRenderer revision in the output header (#587)
* We should be returning our revision instead of what is requested.

Hardware test on a 5.1.0 console

* Added sysversion comment
2018-06-25 10:34:41 -04:00
mailwl
11fb17054e Service/Audio: add hwopus service, stub GetWorkBufferSize function 2018-06-25 16:44:17 +03:00
David
838724c588 Removed duplicate structs, changed AudioRendererResponse -> UpdateDataHeader (#583)
* Removed duplicate structs, changed AudioRendererResponse -> UpdateDataHeader

According to game symbols(SMO), there's references to UpdateDataHeader which seems to be what AudioRendererResponse actually is

* oops

* AudioRendererParameters should be AudioRendererParameter according to SMO
2018-06-23 20:46:29 -04:00