Commit graph

8639 commits

Author SHA1 Message Date
zhupengfei
0f65dac964
service/ps: Address review 2019-04-16 22:17:07 +08:00
Weiyi Wang
5f5e991884
Merge pull request #4734 from FearlessTobi/port-2391
Port yuzu-emu/yuzu#2391 and yuzu-emu/yuzu#2392: Changes to common
2019-04-16 09:48:52 -04:00
Lioncash
42535468c3 kernel/server_session: Return a std::pair from CreateSessionPair()
Keeps the return type consistent with the function name. While we're at
it, we can also reduce the amount of boilerplate involved with handling
these by using structured bindings.
2019-04-15 21:46:57 +02:00
Weiyi Wang
bbc8fd7165
Merge pull request #4735 from FearlessTobi/port-2388
Port yuzu-emu/yuzu#2388: "kernel: Make handle type declarations constexpr"
2019-04-15 13:33:38 -04:00
Lioncash
1afc2c72d6 kernel/server_port: Return a std::pair from CreatePortPair()
Returns the same type that the function name describes.
2019-04-15 18:42:17 +02:00
Lioncash
c4c644b285 kernel: Make handle type declarations constexpr
Some objects declare their handle type as const, while others declare it
as constexpr. This makes the const ones constexpr for consistency, and
prevent unexpected compilation errors if these happen to be attempted to be
used within a constexpr context.
2019-04-15 18:10:11 +02:00
Lioncash
b8d43d4dfb common/swap: Improve codegen of the default swap fallbacks
Uses arithmetic that can be identified more trivially by compilers for
optimizations. e.g. Rather than shifting the halves of the value and
then swapping and combining them, we can swap them in place.

e.g. for the original swap32 code on x86-64, clang 8.0 would generate:

    mov     ecx, edi
    rol     cx, 8
    shl     ecx, 16
    shr     edi, 16
    rol     di, 8
    movzx   eax, di
    or      eax, ecx
    ret

while GCC 8.3 would generate the ideal:

    mov     eax, edi
    bswap   eax
    ret

now both generate the same optimal output.

MSVC used to generate the following with the old code:

    mov     eax, ecx
    rol     cx, 8
    shr     eax, 16
    rol     ax, 8
    movzx   ecx, cx
    movzx   eax, ax
    shl     ecx, 16
    or      eax, ecx
    ret     0

Now MSVC also generates a similar, but equally optimal result as clang/GCC:

    bswap   ecx
    mov     eax, ecx
    ret     0

====

In the swap64 case, for the original code, clang 8.0 would generate:

    mov     eax, edi
    bswap   eax
    shl     rax, 32
    shr     rdi, 32
    bswap   edi
    or      rax, rdi
    ret

(almost there, but still missing the mark)

while, again, GCC 8.3 would generate the more ideal:

    mov     rax, rdi
    bswap   rax
    ret

now clang also generates the optimal sequence for this fallback as well.

This is a case where MSVC unfortunately falls short, despite the new
code, this one still generates a doozy of an output.

    mov     r8, rcx
    mov     r9, rcx
    mov     rax, 71776119061217280
    mov     rdx, r8
    and     r9, rax
    and     edx, 65280
    mov     rax, rcx
    shr     rax, 16
    or      r9, rax
    mov     rax, rcx
    shr     r9, 16
    mov     rcx, 280375465082880
    and     rax, rcx
    mov     rcx, 1095216660480
    or      r9, rax
    mov     rax, r8
    and     rax, rcx
    shr     r9, 16
    or      r9, rax
    mov     rcx, r8
    mov     rax, r8
    shr     r9, 8
    shl     rax, 16
    and     ecx, 16711680
    or      rdx, rax
    mov     eax, -16777216
    and     rax, r8
    shl     rdx, 16
    or      rdx, rcx
    shl     rdx, 16
    or      rax, rdx
    shl     rax, 8
    or      rax, r9
    ret     0

which is pretty unfortunate.
2019-04-15 17:56:16 +02:00
Lioncash
686d067271 common/swap: Mark byte swapping free functions with [[nodiscard]] and noexcept
Allows the compiler to inform when the result of a swap function is
being ignored (which is 100% a bug in all usage scenarios). We also mark
them noexcept to allow other functions using them to be able to be
marked as noexcept and play nicely with things that potentially inspect
"nothrowability".
2019-04-15 17:56:09 +02:00
Lioncash
5664613640 common/swap: Simplify swap function ifdefs
Including every OS' own built-in byte swapping functions is kind of
undesirable, since it adds yet another build path to ensure compilation
succeeds on.

Given we only support clang, GCC, and MSVC for the time being, we can
utilize their built-in functions directly instead of going through the
OS's API functions.

This shrinks the overall code down to just

if (msvc)
  use msvc's functions
else if (clang or gcc)
  use clang/gcc's builtins
else
  use the slow path
2019-04-15 17:56:01 +02:00
Lioncash
f108d3c6e6 common/swap: Remove 32-bit ARM path
We don't plan to support host 32-bit ARM execution environments, so this
is essentially dead code.
2019-04-15 17:55:55 +02:00
Lioncash
aab503fe71 common/scope_exit: Replace std::move with std::forward in ScopeExit()
The template type here is actually a forwarding reference, not an rvalue
reference in this case, so it's more appropriate to use std::forward to
preserve the value category of the type being moved.
2019-04-15 17:55:44 +02:00
zhupengfei
b34847d59e
service/ps: Implement PS:EncryptDecryptAES 2019-04-15 22:56:55 +08:00
Weiyi Wang
11754778bb
Merge pull request #4716 from wwylele/client-is-known
HLE/IPC: HLEContext can memorize the client thread and use it for SleepClientThread
2019-04-15 09:08:07 -04:00
Weiyi Wang
e3b6bf93bc gl_rasterizer_cache: validate surface in mipmap/cubemap if the children is not validated yet 2019-04-15 09:07:36 -04:00
Weiyi Wang
4a206237be
Merge pull request #4726 from FearlessTobi/port-2312
Port yuzu-emu/yuzu#2312: "general: Use deducation guides for std::lock_guard and std::unique_lock"
2019-04-13 18:00:09 -04:00
Tobias
e9c2b27c68
Merge pull request #4681 from FearlessTobi/port-2188-2190
Port yuzu-emu/yuzu#2188 and yuzu-emu/yuzu#2190: various minor code refactoring changes
2019-04-09 21:18:34 +02:00
zhupengfei
d7fbc1ca2c
common/string_util: Move TextFromBuffer to string_util 2019-04-08 22:34:21 +08:00
zhupengfei
25be09c7a3
applets/swkbd: Address comments 2019-04-08 21:45:32 +08:00
zhupengfei
8078256a88 applets/swkbd: Add callback support 2019-04-08 21:45:29 +08:00
Weiyi Wang
2ff7ed4200
Merge pull request #4693 from FearlessTobi/port-stuffffz
Port yuzu-emu/yuzu#2189, yuzu-emu/yuzu#2222, yuzu-emu/yuzu#2218
2019-04-07 14:12:21 -04:00
ReinUsesLisp
c0ceecd7cd yuzu_cmd/config: Silent implicit cast warning
Also replaces (float) with static_cast<float>(...) for consistency.
2019-04-07 18:29:14 +02:00
Lioncash
aba5dae557 service/service: Remove unncessary calls to c_str()
These can just be passed regularly, now that we use fmt instead of our
old logging system.

While we're at it, make the parameters to MakeFunctionString
std::string_views.
2019-04-07 18:27:14 +02:00
Lioncash
b7518fc26c web_service: Remove unnecessary inclusions
Reduces the potential amount of rebuilding necessary if any headers
change. In particular, we were including a header from the core library
when we don't even link the core library to the web_service library, so
this also gets rid of an indirect dependency.
2019-04-07 18:27:14 +02:00
Weiyi Wang
9fb5cb580e
Merge pull request #4635 from FearlessTobi/mii-thingy-v9999
citra-qt: Implement Mii selector applet
2019-04-07 12:23:54 -04:00
fearlessTobi
e9bd34f7da Address remaining review comments 2019-04-07 17:00:28 +02:00
fearlessTobi
1517d2fef7 Address more reviews 2019-04-07 15:35:32 +02:00
fearlessTobi
781d4b787a Address first batch of review comments 2019-04-07 15:35:32 +02:00
fearlessTobi
041638ea4d applets: implement HLE mii selector applet 2019-04-07 15:35:29 +02:00
fearlessTobi
f903d3161d ptm: move ptm_shared_extdata_id to header 2019-04-07 15:35:29 +02:00
Lioncash
21c71d21ae general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-07 15:14:29 +02:00
Weiyi Wang
d5bcb45b2a
Merge pull request #4723 from jroweboy/minorfix
Destroy the callback after the stream is destroyed to prevent crashes on close
2019-04-06 14:31:49 -04:00
Weiyi Wang
c2b514cb97
Merge pull request #4722 from adityaruplaha/input-fixup
ConfigureInput::GetUsedKeyboardKeys(): Change index of home button to use NativeButton instead of magic number.
2019-04-06 11:25:48 -04:00
Adityarup Laha
ebba9f5a70
ConfigureInput::GetUsedKeyboardKeys(): Change index of home button to use NativeButton instead of magic number.
Fixes a bug where users can't bind anything to the B key.
Arises because this was not changed in #4537.
2019-04-06 10:41:28 +05:30
James Rowe
f4d0bdd09a Destroy the callback after the stream is destroyed
Prevents a crash on close if the callback was running on a different
thread.
2019-04-05 14:16:55 -06:00
James Rowe
14730ed560
Merge pull request #4718 from khang06/clang-format-spaces-fix
Fix clang-format target when using a path with spaces on Windows
2019-04-02 19:14:35 -06:00
khang06
7842decde6 fix clang-format target when using a path with spaces on windows 2019-04-02 21:02:43 -04:00
Weiyi Wang
f565ea80f0 HLE/IPC: HLEContext can memorize the client thread and use it for SleepClientThread
This reduces the boilerplate that services have to write out the current thread explicitly. Using current thread instead of client thread is also semantically incorrect, and will be a problem when we implement multicore (at which time there will be multiple current threads)
2019-04-02 13:23:39 -04:00
Weiyi Wang
daeba65fb4
Merge pull request #4710 from wwylele/why-instrusive-ptr
Kernel: replace boost::intrusive_ptr with std::shared_ptr
2019-04-02 11:06:13 -04:00
Weiyi Wang
fe8daa2590
Merge pull request #4715 from wwylele/cam-init
CAM: initialize states
2019-03-30 12:19:16 -04:00
Weiyi Wang
8d2718a18f CAM: initialize states 2019-03-30 11:07:11 -04:00
Weiyi Wang
05058863b5 cleanup includes 2019-03-26 10:50:41 -04:00
Weiyi Wang
5f11c5f733 Kernel: replace boost::intrusive_ptr with std::shared_ptr 2019-03-24 14:32:11 -04:00
Weiyi Wang
c1de8acfe5
Merge pull request #4689 from wwylele/server-leak
ServiceFrameworkBase: remove ownership to ServerPort
2019-03-24 14:29:41 -04:00
Weiyi Wang
941248466b
Merge pull request #4125 from ccawley2011/travis-ninja
travis: Use Ninja for Travis builds
2019-03-23 23:15:00 -04:00
Weiyi Wang
21bda754b3
Merge pull request #4396 from FearlessTobi/open-delays
fs_user: Add a delay for each file open
2019-03-23 12:21:12 -04:00
fearlessTobi
d755a15891 fix compilation problems 2019-03-23 12:43:03 +01:00
Weiyi Wang
9b07ff9681
Merge pull request #4683 from wwylele/misc-global-clean
Misc global instance reference cleaup
2019-03-22 22:28:50 -04:00
Weiyi Wang
4b6295ae68
Merge pull request #4709 from FearlessTobi/port-2247
Port yuzu-emu/yuzu#2247: "common/thread_queue_list: Remove unnecessary dependency on boost"
2019-03-22 22:23:59 -04:00
Lioncash
bd4c04aec1 common/thread_queue_list: Remove unnecessary dependency on boost
We really don't need to pull in several headers of boost related
machinery just to perform the erase-remove idiom (particularly with
C++20 around the corner, which adds universal container std::erase and
std::erase_if, which we can just use instead).

With this, we don't need to link in anything boost-related into common.
2019-03-22 23:13:30 +01:00
Weiyi Wang
17c0e903db
Merge pull request #4694 from FearlessTobi/port-2210
Port commit from yuzu-emu/yuzu#2210: "common/bit_field: Make BitField trivially copyable"
2019-03-22 11:22:53 -04:00