Commit Graph

24749 Commits

Author SHA1 Message Date
Morph
7ad3e3c7bb bit_field: Left/right shifts are well defined in C++20 2023-07-24 17:37:07 -04:00
Morph
334567d33b common: Introduce macro-based BitField
The current BitField implementation requires the use of the union, which makes it both non-constexpr (due to accessing inactive union members), and prevents the usage of smaller types and enums, reducing its flexibility.

Furthermore, BitField is not trivially copyable (and by extension, not trivial).

Moreover, it is not well documented that BitField performs automatic sign extension on signed integers, as a recent PR made an assumption that these signed integers were zero extended.

These considerations resulted in this new BitField implementation, which uses macros to generate functions for accessing / setting bitfield values.

2 macros are provided:

`YUZU_RO_BITFIELD` for read-only BitFields, which generates a member function that directly returns the specified type.

`YUZU_BITFIELD`, which generates a member function that returns a `BitFieldHelper` class which allows setting the value using `operator=` or `Set()`, and performs implicit conversion to the specified type.

Types:

The following type tags are added:

Automatic type deduction:
AutoUInt, AutoSignExtSInt, AutoZeroExtSInt, AutoFloat

Automatic type deduction selects the smallest type that contains at least the specified NumBits bits.
However, in testing, MSVC is pretty bad at optimizing smaller-than-32-bit accesses, so it may be advisable to specify 32 bit types in performance sensitive code.

Signed Integers:
SignExtSInt<>, ZeroExtSInt<>

The new SignExtSInt and ZeroExtSInt are mandatory type tags for signed integers to explicitly specify whether to sign extend (preserving the sign and value) or zero extend the bitfield value.

These changes have sacrificed compatibility with `_be` types. This is a worthwhile sacrifice as we do not have usages of these types in BitField.

Example usage:

```cpp
struct MyTestStruct {
    u32 raw;

    YUZU_RO_BITFIELD(0, 3, AutoUInt, field0);
    YUZU_BITFIELD(3, 4, AutoSignExtSInt, field1);
    YUZU_BITFIELD(7, 5, ZeroExtSInt<s16>, field2);
    YUZU_RO_BITFIELD(12, 1, bool, flag0);
};

MyTestStruct s{0x1234567};
s.field1() = -1;
s.field2() = -2;
fmt::print("field0={}, field1={}, field2={}, flag0={}", s.field0(), s.field1(), s.field2(), s.flag0());
```
2023-07-24 17:37:07 -04:00
liamwhite
18000df5e9
Merge pull request #11095 from liamwhite/memory2
memory: cleanup
2023-07-24 13:47:11 -04:00
liamwhite
bb0edb53ae
Merge pull request #11135 from liamwhite/getaddrinfo
core: implement GetGaiStringErrorRequest, IContextRegistrar
2023-07-24 13:47:02 -04:00
liamwhite
099295d7c6
Merge pull request #11136 from liamwhite/sp3shader
ssa_rewrite_pass: use proper maps
2023-07-24 13:46:53 -04:00
Liam
dad0d076ee ssa_rewrite_pass: use proper maps 2023-07-23 11:38:01 -04:00
Liam
3e3294e1c2 core: implement GetGaiStringErrorRequest, IContextRegistrar 2023-07-22 23:29:45 -04:00
Liam
9f3f615e05 core: reduce TOCTTOU memory access 2023-07-22 11:19:29 -04:00
Liam
d144168442 memory: minimize dependency on process 2023-07-22 11:19:29 -04:00
liamwhite
3e4029b238
Merge pull request #11042 from lat9nq/wayland-appimage
ci/linux: Target deploy script from appimage path
2023-07-22 11:17:48 -04:00
liamwhite
b1aed2c5b7
Merge pull request #11094 from liamwhite/get
kernel: misc cleanup of page table accessors
2023-07-22 11:17:36 -04:00
liamwhite
0ea138fb5b
Merge pull request #11098 from GPUCode/texel-buffers
buffer_cache: Increase number of texture buffers
2023-07-22 11:17:27 -04:00
bunnei
482c957f5d
Merge pull request #11113 from liamwhite/nsd1
nsd: add GetApplicationServerEnvironmentType
2023-07-21 21:24:36 -07:00
bunnei
39edd2ff82
Merge pull request #11129 from liamwhite/dynamic_cast
general: remove uses of dynamic_cast
2023-07-21 21:22:51 -07:00
Liam
05bc024260 core: remove remaining uses of dynamic_cast 2023-07-21 19:37:29 -04:00
Liam
4bee333d84 general: reduce use of dynamic_cast 2023-07-21 19:22:14 -04:00
liamwhite
efda6cc9ec
Merge pull request #11123 from Morph1984/remove-mem-hungry-opts
ci: Remove GA, Gr optimizations from MSVC
2023-07-21 15:06:07 -04:00
liamwhite
8927f016e1
Merge pull request #11069 from lat9nq/mingw-no-tzdb
common: Use arithmetic instead of string ops to get time zone
2023-07-21 15:05:59 -04:00
liamwhite
c0202da9ac
Merge pull request #11096 from german77/amiibooo
service: nfc: Update Implementation to match with latest RE
2023-07-21 09:21:48 -04:00
Morph
7fc5ef68d2 ci: Remove GA, Gr optimizations from MSVC
Internal testing has shown these result in higher committed memory usage in some systems.
Also Ob2 is already implied by O2, so that can be removed as well.
2023-07-21 01:30:43 -04:00
liamwhite
014ca709c9
Merge pull request #11116 from lat9nq/clang-shadowing
general: Silence -Wshadow{,-uncaptured-local} warnings
2023-07-19 17:14:55 -04:00
liamwhite
86bbfe3b1d
Merge pull request #11114 from Kelebek1/warnings
Mark SetIdleTimeDetectionExtension logging as debug
2023-07-19 17:14:45 -04:00
lat9nq
1ab3bd5a5e demangle: Update to llvm/llvm-project@ecbc812e0c 2023-07-18 22:39:26 -04:00
lat9nq
c1e57ad358 CMake: Require LLVM 17 or later
API changes necessitate an update here.
2023-07-18 22:39:13 -04:00
lat9nq
4ecedc4991 vk_buffer_cache: Format 2023-07-18 19:56:20 -04:00
lat9nq
71b3b2a2f0 general: Silence -Wshadow{,-uncaptured-local} warnings
These occur in the latest commits in LLVM Clang.
2023-07-18 19:31:35 -04:00
Kelebek1
80cd67ed7b Debug SetIdleTimeDetectionExtension 2023-07-18 10:16:14 +01:00
Morph
3fded314f2
Merge pull request #11109 from Morph1984/net
network: Fix compilation with ENABLE_WEB_SERVICE=OFF
2023-07-17 23:57:39 -04:00
Liam
8f1d48fda6 nsd: add GetApplicationServerEnvironmentType 2023-07-17 21:34:23 -04:00
Morph
16c238e4b9 ssl: Link with crypt32 for secure channel backend 2023-07-17 15:46:24 -04:00
Morph
e0fb1d3d17 ssl: Reorder inclusions 2023-07-17 15:46:24 -04:00
Morph
5bbc3aef13 network: Forward declarations 2023-07-17 15:36:03 -04:00
Narr the Reg
54f150b70a service: nfc: Update Implementation to match with latest RE 2023-07-17 11:24:23 -06:00
liamwhite
5593bed08a
Merge pull request #10934 from abouvier/cmake-vma
cmake: allow using system VMA library
2023-07-17 10:42:41 -04:00
liamwhite
8750564bd2
Merge pull request #11102 from v1993/your-mom-is-encrypted
android: fix links to re-dumping guides
2023-07-17 10:42:31 -04:00
liamwhite
2461c78e3f
Merge pull request #10912 from comex/ssl
Implement SSL service
2023-07-16 16:56:47 -04:00
Valeri Ochinski
50fe45f1e4
android: fix links to re-dumping guides 2023-07-16 20:22:27 +03:00
GPUCode
4347dd26c6 buffer_cache: Increase number of texture buffers 2023-07-15 23:09:58 +03:00
Liam
474db2d8da kernel: reduce page table region checking 2023-07-14 22:33:10 -04:00
Liam
a85ce8ea56 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Tobias
04868ab9da
file_sys/content_archive: Detect compressed NCAs (#11047) 2023-07-12 23:17:18 +02:00
lat9nq
63a0a1f826 time_zone: Clean up includes 2023-07-12 03:03:03 -04:00
lat9nq
9e0d6f7d54 time_zone: Swap subtraction order 2023-07-12 03:02:45 -04:00
lat9nq
13755c0903 time_zone: Account for leap years
Protects against invalid hour offsets during transitions to years
following leap years.
2023-07-12 02:34:02 -04:00
Alexandre Bouvier
c3050c1b48 cmake: allow using system VMA library 2023-07-12 04:51:45 +02:00
bunnei
28598c9090
Merge pull request #10985 from liamwhite/handle-translate
k_server_session: translate special header for non-HLE requests
2023-07-11 16:49:24 -07:00
bunnei
11cb4d88f0
Merge pull request #11070 from t895/home-setting-warning
android: Visualize disabled home options
2023-07-11 16:48:57 -07:00
Charles Lombardo
4b870b28e8 android: Visualize disabled home options
Allow for displaying options in the home options that are disabled with messages that explain why they are disabled.

This includes reasoning for the GPU driver installation button.
2023-07-10 22:17:19 -04:00
bunnei
ce7c418e0c
Merge pull request #10996 from Kelebek1/readblock_optimisation
Use spans over guest memory where possible instead of copying data
2023-07-10 18:54:19 -07:00
bunnei
169b198d08
Merge pull request #11050 from SuperSamus/sdl-button-labels
input_common: set `SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS` to 0
2023-07-10 18:53:16 -07:00