Quite a few service functions are stubbed but still pop all their
arguments, which can lead to unused variable warnings.
We can mark the unused arguments with [[maybe_unused]] to silence these
warnings until a full implementation of these functions are made.
Allows implementations to allocate the object and the shared_ptr control
block in one allocation instead of needing to do two separate
allocations.
Also looks much nicer to the reader.
* swkbd: Fix a bug where clicking Cancel hangs the game
The text is validated in `Finalize`. If the validation fails, an error is returned and the applet is not actually finalized. This can result in hangs.
This is usually not a problem as the frontend is expected to validate the text passed to `Finalize`. However, when the user clicked on `Cancel`, the text is ignored and the frontend won't do any validation. Therefore, we should skip the validation here as well.
Also fixed a potential data race. All these functions should now be called on the same thread
* Address review comments
Renamed the fields
Remove close button
This class is memcpy-ed and memcpy has the requirement that data passed
to it must be trivially copyable, otherwise the behavior is undefined.
This is trivial to resolve as BitField was made trivially copyable a
while ago, so this explicit copy assignment operator isn't necessary.
This can be removed as it's not used. Even if it were however, it would
be an incorrect forward declaration, as ServiceManager exists within the
Service::SM namespace, not the top-level SM namespace.
Same behavior, no heap allocation.
strings returned from glGetString() are guaranteed to be static strings,
so this is safe to do. They're also guaranteed to be null-terminated.
Some implementations can use the std::nullopt_t constructor of
std::optional to avoid needing to completely zero out the internal
buffer of the optional and instead only set the validity byte within it.
e.g. Consider the following function:
std::optional<std::vector<ShaderDiskCacheRaw>> fn() {
return {};
}
With libc++ this will result in the following code generation on x86-64:
Fn():
mov rax, rdi
vxorps xmm0, xmm0, xmm0
vmovups ymmword ptr [rdi], ymm0
vzeroupper
ret
With libstdc++, we also get the similar equivalent:
Fn():
vpxor xmm0, xmm0, xmm0
mov rax, rdi
vmovdqu XMMWORD PTR [rdi], xmm0
vmovdqu XMMWORD PTR [rdi+16], xmm0
ret
If we change this function to return std::nullopt instead, then this
simplifies both the code gen from libc++ and libstdc++ down to:
Fn():
mov BYTE PTR [rdi+24], 0
mov rax, rdi
ret
Given how little of a change is necessary to result in better code
generation, this is essentially a "free" very minor optimization.